blib/lib/Games/Axmud/Client.pm untested

filter: Statementstmt 0.0% 0 / 5909 Branchbran 0.0% 0 / 2546 Conditioncond 0.0% 0 / 2076 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 927 Podpod 0.0% 0 / 922 totaltotal 0.0% 0 / 12380 CC 1274 SCAR 53.8
CC
1274
Cov
0%
start
3192.0
loadPlugin
1560.0
tts
1406.0
CRAP 218.0
1 # Copyright (C) 2011-2022 A S Lewis
2 #
3 # This program is free software: you can redistribute it and/or modify it under the terms of the GNU
4 # General Public License as published by the Free Software Foundation, either version 3 of the
5 # License, or (at your option) any later version.
6 #
7 # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
8 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9 # General Public License for more details.
10 #
11 # You should have received a copy of the GNU General Public License along with this program. If not,
12 # see <http://www.gnu.org/licenses/>.
13 #
14 #
15 # Games::Axmud::Client
16 # The main body of code for the Axmud client
17  
18 { package Games::Axmud::Client;
19  
20 use strict;
21 use warnings;
22 use diagnostics;
23  
24 use Glib qw(TRUE FALSE);
25 # Include module here, as well as in axmud.pl, so that .../t/00-compile.t won't fail
26 use Archive::Tar;
27  
28 our @ISA = qw(Games::Axmud);
29  
30 ##################
31 # Constructors
32  
33 sub new {
34  
35 # Called by axmud.pl on startup
36 #
37 # Expected arguments
38 # (none besides $class)
39 #
40 # Return values
41 # 'undef' on improper arguments
42 # Blessed reference to the newly-created object on success. The calling function sets the
43 # $CLIENT global variable
44  
45 my ($class, $check) = @_;
46  
47 # Local variables
48 my (
49 $urlRegex, $shortRegex, $emailRegex,
50 @cmdList,
51 %soundHash, %msspHash,
52 );
53  
54 # Check for improper arguments
55 if (! defined $class || defined $check) {
56  
57 # Global variable $axmud::CLIENT not set yet, so we'll just have to print the
58 # improper arguments message
59 print "IMPROPER ARGUMENTS: Games::Axmud::Client->new " . join(' ', @_) . "\n";
60 return undef;
61 }
62  
63 # Set regexes to recognise URLs
64 $urlRegex = 'http(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)'
65 . '([a-zA-Z0-9\-?\.\?\,\'\/\\\+&amp;%\$#_\=\~]*)?';
66 $shortRegex = '[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*\.(com|org|net|int|edu|gov|mil|io|uk)';
67 # Set a regex to recognise email addresses
68 $emailRegex = '\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b';
69  
70 # Setup
71 my $self = {
72 _objName => 'client',
73 _objClass => $class,
74 _parentFile => undef, # No parent file object
75 _parentWorld => undef, # No parent file object
76 _privFlag => TRUE, # All IVs are private
77  
78 # Perl object components
79 # ----------------------
80  
81 # The main desktop object (GA::Obj::Desktop), which arranges windows on the desktop
82 # across one or more workspaces
83 desktopObj => undef,
84  
85 # An IV which stores a 'main' window. First set when Axmud starts, and a spare 'main'
86 # window, not belonging to any session, opens before the Connections window opens
87 # Briefly set back to 'undef' when the spare 'main' window is destroyed, just before a
88 # new 'main' window for a new session is created to replace it
89 # Then set whenever $self->currentSession is set
90 mainWin => undef,
91  
92 # The About window (only one can be open at a time)
93 aboutWin => undef, # Set by $self->set_aboutWin
94 # A 'dialogue' window created by a call to GA::Generic::Win->showBusyWin, e.g. the
95 # 'Loading...' window created by $self->start
96 busyWin => undef, # Set by $self->set_busyWin
97 # The Connections window (only one can be open at a time)
98 connectWin => undef, # Set by $self->set_connectWin
99 # The Client Console window (only one can be open at a time)
100 consoleWin => undef, # Set by $self->set_consoleWin
101  
102 # Instance variable constants
103 # ---------------------------
104  
105 # All of Axmud's Perl objects have instance variables (IVs); the vast majority of them
106 # are either scalar IVs (including references stored in scalar variables), list IVs or
107 # hash IVs. There are a few more complex structures (e.g. arrays of arrays, hashes of
108 # arrays, etc), but besides that, there no other data structures (globs, etc)
109 #
110 # All objects have five standard 'constant' IVs which should not be modified, namely
111 # ->_objName, ->_objClass, ->_parentFile, ->_parentWorld and ->privFlag.
112 # ->_objName gives a name to an object, even if it doesn't have a ->name IV.
113 # ->_objName is not necessarily unique
114 # ->_objectClass is the same as the package name for the object (e.g. GA::Client)
115 # ->_parentFile matches a key in the file object registry, $self->fileObjHash (see
116 # further below). It tells us which data file is used to save this object. (A few
117 # objects don't have a parent file; in these casees, ->_parentFile is set to 'undef')
118 # ->_parentWorld is the name of the current world profile, in the GA::Session to which
119 # the object belongs. (Some objects don't belong to a particular GA::Session; in these
120 # cases, ->_parentWorld is set to 'undef')
121 # ->_privFlag is set to TRUE if the object's IVs are private; FALSE if they are public.
122 # (See the comments at the top of generic_obj.pm)
123 #
124 # In addition, any IV whose name begins with 'const' is treated as a constant value
125 # which should not be modified
126 #
127 # The generic object, Games::Axmud, from which all Axmud objects inherit, provides
128 # several useful functions for accessing and storing values for all IVs, such as
129 # ->ivPush, ->ivSplice and ->ivPeek
130 # The most important one is ->ivPoke. When an IV's value (or values) are set, it should
131 # not be done with a call to
132 # $self->{iv_name} = $value
133 # but with a call to
134 # $self->ivPoke('iv_name', $value)
135 # ->ivPoke (like all the generic object's IV functions) tells the equivalent
136 # GA::Obj::File that its data has been modified, and that it needs to be saved
137 # ->ivPoke, etc, can't be used to modify constant IVs (the five mentioned above, and any
138 # IV whose names starts 'const'
139 #
140 # Constant registry hash of constant instance variables (IVs) required by every Perl
141 # object. A hash in the form
142 # $constIVHash{iv_name} = undef
143 constIVHash => {
144 '_objName' => undef,
145 '_objClass' => undef,
146 '_parentFile' => undef,
147 '_parentWorld' => undef,
148 '_privFlag' => undef,
149 },
150 # Constant registry hash of reserved names that can't be used by profiles and other
151 # Perl objects which have unique names (case-insensitive; these values never change)
152 # Hash in the form
153 # $constReservedHash{string} = undef
154 # NB Plurals have been added only when necessary, specifically because there's a file
155 # object with a name in the plural
156 constReservedHash => {
157 'about' => undef,
158 'alias' => undef,
159 'amud' => undef,
160 'axmud' => undef,
161 'automap' => undef,
162 'automapper' => undef,
163 'buffer' => undef,
164 'cage' => undef,
165 'client' => undef,
166 'cmd' => undef,
167 'colour' => undef,
168 'color' => undef, # American too
169 'component' => undef,
170 'config' => undef,
171 'connect' => undef,
172 'console' => undef,
173 'contact' => undef,
174 'contacts' => undef,
175 'current' => undef,
176 'custom' => undef,
177 'default' => undef,
178 'defn' => undef,
179 'definition' => undef,
180 'delete' => undef,
181 'desktop' => undef,
182 'dict' => undef,
183 'dictionary' => undef,
184 'dicts' => undef,
185 'edit' => undef,
186 'exit' => undef,
187 'external' => undef,
188 'favourite' => undef,
189 'favorite' => undef, # American too
190 'file' => undef,
191 'fixed' => undef,
192 'flag' => undef,
193 'free' => undef,
194 'gauge' => undef,
195 'generic' => undef,
196 'grid' => undef,
197 'gui' => undef,
198 'hash' => undef,
199 'help' => undef,
200 'hook' => undef,
201 'icon' => undef,
202 'init' => undef,
203 'interface' => undef,
204 'internal' => undef,
205 'jmud' => undef, # Old JMud plugin for KildClient
206 'keycode' => undef,
207 'keycodes' => undef,
208 'label' => undef,
209 'link' => undef,
210 'list' => undef,
211 'load' => undef,
212 'localhost' => undef,
213 'login' => undef,
214 'loop' => undef,
215 'macro' => undef,
216 'main' => undef,
217 'map' => undef,
218 'misc' => undef,
219 'mission' => undef,
220 'model' => undef,
221 'name' => undef,
222 'node' => undef,
223 'not_applicable' => undef, # Used in data files to represent assoc'd world
224 'obj' => undef,
225 'other' => undef,
226 'otherdefn' => undef,
227 'otherprof' => undef,
228 'package' => undef,
229 'phrasebook' => undef,
230 'plugin' => undef,
231 'pref' => undef,
232 'preference' => undef,
233 'profile' => undef,
234 'pseudo' => undef,
235 'quest' => undef,
236 'region' => undef,
237 'regionmap' => undef,
238 'regionpath' => undef,
239 'room' => undef,
240 'save' => undef,
241 'scalar' => undef,
242 'scheme' => undef,
243 'separator' => undef,
244 'session' => undef,
245 'sigil' => undef,
246 'sound' => undef,
247 'ssh' => undef,
248 'ssl' => undef,
249 'standard' => undef,
250 'strip' => undef,
251 'sub' => undef,
252 'tab' => undef,
253 'table' => undef,
254 'tablezone' => undef,
255 'task' => undef,
256 'tasks' => undef,
257 'telnet' => undef,
258 'template' => undef,
259 'text' => undef,
260 'textview' => undef,
261 'timer' => undef,
262 'toolbar' => undef,
263 'tooltip' => undef,
264 'trigger' => undef,
265 'tts' => undef,
266 'usercomm' => undef,
267 'viewer' => undef,
268 'window' => undef,
269 'winmap' => undef,
270 'winmaps' => undef,
271 'winzone' => undef,
272 'workspace' => undef,
273 'worlddefn' => undef,
274 'worldprof' => undef,
275 'worldmodel' => undef,
276 'zone' => undef,
277 'zonemap' => undef,
278 'zonemaps' => undef,
279 # Telnet options and MUD protocols
280 'echo' => undef,
281 'sga' => undef,
282 'ttype' => undef,
283 'eor' => undef,
284 'naws' => undef,
285 'newenviron' => undef,
286 'charset' => undef,
287 'mccp' => undef,
288 'msdp' => undef,
289 'mssp' => undef,
290 'mccp' => undef,
291 'msp' => undef,
292 'mxp' => undef,
293 'pueblo' => undef,
294 'zmp' => undef,
295 'aard102' => undef,
296 'atcp' => undef,
297 'gmcp' => undef,
298 'mtts' => undef,
299 'mnes' => undef,
300 'mcp' => undef,
301 },
302  
303 # File objects
304 # ------------
305  
306 # Flags to allow/forbid loading/saving of data
307 # Should loading/saving of the 'config' file for the client be allowed?
308 loadConfigFlag => TRUE, # Saved in file [config]
309 saveConfigFlag => TRUE, # [config]
310 # Should loading/saving of other data files be allowed?
311 loadDataFlag => TRUE, # [config]
312 saveDataFlag => TRUE, # [config]
313 # Flag set to TRUE if, when the script starts, the existing 'config' file and the
314 # entire contents of the /log and /data directories should be deleted; FALSE if they
315 # should not be deleted
316 # (The flag can be set to TRUE while developing Axmud code; should be set to FALSE for
317 # any public releases)
318 deleteFilesAtStartFlag => FALSE,
319 # Flag set to TRUE whenever any file operation (launched from the client commands
320 # ';load', ';save', ';importfiles', ';exportfiles', ';importdata', ';exportdata')
321 # fails, wholly or partially. Any code can set this flag to FALSE (with a call to
322 # $self->set_fileFailFlag) before initiating the file operation, in order to test its
323 # success
324 fileFailFlag => FALSE,
325 #
326 # Emergency saves - when a file save operation fails and this flag is TRUE, user can be
327 # prompted to save a copy of all data files in a new location (a USB drive, perhaps),
328 # so that data in memory is not lost permanently. If this flag is FALSE, the user is
329 # not prompted
330 # NB Even if this flag is FALSE, the user can still do an emergency save using the
331 # ';emergencysave' client command
332 # NB The only reason to set this flag to FALSE is for testing and development, when you
333 # don't want to be prompted all the time. For that reason, there are no client
334 # command and no preference window options for setting the flag
335 emergencySaveFlag => TRUE,
336 #
337 # Auto-save. Flag set to TRUE if auto-save is turned on, FALSE if not
338 autoSaveFlag => TRUE, # [config]
339 # When auto-save is turned on, the number of minutes between saves. (Each GA::Session
340 # has an ->autoSaveCheckTime IV, the time at which to do the next auto-save). Min
341 # value 1 minute; values must be integers
342 autoSaveWaitTime => 5, # [config]
343 # When a file is saved, a temporary copy of an existing file with the same name is
344 # created. If this flag is set to TRUE, the temporary file is not deleted as soon as
345 # the 'save' operation is completed; in that case, if the saved file is corrupted, the
346 # user can manually restore the previous version. If this flag is set to FALSE, the
347 # backup is destroyed as soon as the save process is complete.
348 autoRetainFileFlag => TRUE, # [config]
349 #
350 # Auto-backup (a process which creates a .tgz or .zip of the entire Axmud data
351 # directory)
352 # Auto-backup mode: 'no_backup' (don't do auto-backups'), 'all_start' (do an auto-backup
353 # whenever Axmud starts), 'all_stop' (do an auto-backup whenever Axmud stops),
354 # 'interval_start' (do an auto-backup at regular intervals, performed when Axmud
355 # first starts after the interval has passed), 'interval_stop' (do an auto backup at
356 # regular intervals, when Axmud stops)
357 autoBackupMode => 'no_backup', # [config]
358 # The directory in which the backup is saved. If 'undef' or an empty string, the user
359 # is prompted for a directory each time
360 autoBackupDir => undef, # [config]
361 # For auto-backup mode 'interval_start' and 'interval_stop', the number of days between
362 # successive backups. 1 means do daily backups, 8 means do weekly backups, 366 means
363 # backup once a year. 0 means stop doing backups temporarily (but remember when the
364 # last backup occured, so when the interval is change back to a positive integer, that
365 # interval is applied to the time since the last backup). Range 0-366
366 autoBackupInterval => 8, # [config]
367 # The time of the last successful auto-backup, set a string returned by $self->localDate
368 # (in the form 'Thu Dec 18, 2010'). 'undef' or an empty string if no auto-backup has
369 # ever been performed, or if auto-backup mode is currently 'no_backup', 'all_start' or
370 # 'all_stop'. The value is not modified if the user performs a manual backup using the
371 # ';backupdata' command
372 autoBackupDate => undef, # [config]
373 # Auto-backup file type: 'tar' to use a .tgz file, 'zip' to use a .zip file, 'default'
374 # to use a convenient file type for the system (.tgz for Linux/*BSD, .zip for MS
375 # Windows)
376 autoBackupFileType => 'default', # [config]
377 # Flag set to TRUE if the time should be appended to auto-backups and to manual backups
378 # using the ';backupdata' command
379 autoBackupAppendFlag => FALSE, # [config]
380 #
381 # Axmud retains information about the config and data files it has loaded/saved since
382 # the script started. Each file that can be loaded or saved is handled by a
383 # GA::Obj::File
384 # There are eleven types of file object. Each file object has a name that is the same as
385 # its type (except for 'worldprof' file objects, whose name is the same as the world
386 # profile to which it corresponds)
387 # The types of data files Axmud uses are:
388 # File type Standard directory Unique name Stored
389 # 'config' <SCRIPT_DIR>/axmud.conf config Client
390 # 'worldprof' <SCRIPT_DIR>/data/worlds/<WORLD>/worldprof.axm WORLD Both
391 # 'otherprof' <SCRIPT_DIR>/data/worlds/<WORLD>/otherprof.axm otherprof Session
392 # 'worldmodel' <SCRIPT_DIR>/data/worlds/<WORLD>/worldmodel.axm worldmodel Session
393 # 'tasks' <SCRIPT_DIR>/data/tasks.axm tasks Client
394 # 'scripts' <SCRIPT_DIR>/data/scripts.axm scripts Client
395 # 'contacts' <SCRIPT_DIR>/data/contacts.axm contacts Client
396 # 'dicts' <SCRIPT_DIR>/data/dicts.axm dicts Client
397 # 'toolbar' <SCRIPT_DIR>/data/toolbar.axm toolbar Client
398 # 'usercmds' <SCRIPT_DIR>/data/usercmds.axm usercmds Client
399 # 'zonemaps' <SCRIPT_DIR>/data/zonemaps.axm zonemaps Client
400 # 'winmaps' <SCRIPT_DIR>/data/winmaps.axm winmaps Client
401 # 'tts' <SCRIPT_DIR>/data/tts.axm tts Client
402 # (WORLD is replaced by the name of the associated world profile)
403 #
404 # This GA::Client has a registry of file objects; each GA::Session also has its own one
405 # The only overlap is for 'worldprof' files. The GA::Client stores all 'worldprof' file
406 # objects; the GA::Session stores only the 'worldprof' file object for its current
407 # world profile (if any)
408 # In GA::Client's registry, there are any number of 'worldprof' file objects, but only
409 # one instance of the other types of file object. In GA::Session's registry, there is
410 # one 'worldprof' file object, any number of 'otherprof' file objects, and one
411 # 'worldmodel file object
412 #
413 # NB Every file object has a ->modifyFlag which is set to TRUE whenever its data in
414 # memory has changed, which means the file needs to be saved. The flag is set back to
415 # FALSE when the file is saved (or loaded, overwritng the data in memory)
416 # It's possible to call the GA::Obj::File->set_modifyFlag method directly, but the
417 # easier way to do it, is to call GA::Client->setModifyFlag() - for file objects
418 # stored here - or GA::Session->setModifyFlag() - for file objects stored in the
419 # session's file object registry
420 #
421 # Registry hash of file objects, in the form
422 # $fileObjHash{unique_name} = blessed_reference_to_file_object
423 fileObjHash => {},
424 # A shortcut to the blessed reference of the 'config' file object (very useful for all
425 # the parts of the code that need to set the file object's ->modifyFlag)
426 configFileObj => undef,
427 # Every time the 'config' file is loaded, the list of world profiles it contains is
428 # copied into this list (empty if the 'config' file doesn't list any world
429 # profile). This list will become obsolete as soon as profiles are created/destroyed/
430 # loaded, so it shouldn't be used for any other purpose
431 configWorldProfList => [],
432  
433 # GA::Session->setupProfiles can optionally create a 'Loading...' popup window by
434 # calling GA::Generic::Win->showBusyWin, if the file(s) it's loading are above a
435 # certain size. It's up to the calling function to close the popup window when all
436 # load operations are complete
437 # The standard file size above which a 'Loading...' popup can be shown, if some part of
438 # the Axmud code wants it
439 constLargeFileSize => 5_000_000, # (roughly 5MB)
440  
441 # Large world models can cause 'out of memory' errors on low-spec machines. The
442 # problem is not that the world model takes up too much memory, but that the Perl
443 # Storable module struggles to load very large files into memory
444 # Since v1.1.529, the world model is saved either as a monolithic file (as previously),
445 # or as multiple files, all of which are handled by a single file object
446 # Flag set to TRUE if we should allow large world models to be saved as multiple files,
447 # FALSE if world models should always be saved as a single monolithic file
448 allowModelSplitFlag => TRUE, # [config]
449 # If multiple files are allowed, this value sets the maximum size of the world model
450 # for which a monolithic file is still used. It also sets the size of multiple files,
451 # when they are used. The value corresponds to a number of model objects (regions,
452 # rooms etc) or exit model objects
453 # The constant (default) value
454 constModelSplitSize => 5000,
455 # The value actually used (must be an integer, minimum value is 1000)
456 modelSplitSize => 5000,
457  
458 # Plugins
459 # -------
460  
461 # Registry list of plugins (.pm files) that should be loaded as plugins at startup. Each
462 # item in the list is the full file path
463 initPluginList => [], # [config]
464 # Registry hash of plugins (.pm files) that have been loaded, in the form
465 # $pluginHash{plugin_name} = blessed_reference_to_plugin_object
466 pluginHash => {},
467 # Registry hash of client commands that are created when a plugin is loaded, in the form
468 # $pluginCmdHash{command_name} = plugin_name
469 # ...where 'command_name' matches a key in $self->clientCmdHash (e.g. 'about') and
470 # 'plugin_name' matches a key in $self->pluginHash
471 # NB If a (built-in) client command of the same name already exists, it is replaced. If
472 # the plugin is later disabled, the original command is restored. If the plugin is
473 # then re-enabled, the original command is again replaced, and so on. This works very
474 # well as long as the plugins you load don't themselves have client commands of the
475 # same name, so try to avoid that
476 pluginCmdHash => {},
477 # Registry hash of tasks that are added when a plugin is loaded, in the form
478 # $pluginTaskHash{task_name} = plugin_name
479 # ...where 'task_name' matches the task's standard name (a key in
480 # $self->taskPackageHash) and 'plugin_name' matches a key in $self->pluginHash
481 # NB Tasks with the same name as existing tasks (built-in, or from a plugin that's
482 # already been loaded) will not be added
483 pluginTaskHash => {},
484 # Registry hash of 'grid' windows added by the plugin. If the plugin is disabled, the
485 # windows are closed (and, for 'main' windows, all sessions in the 'main' windows are
486 # terminated). Hash in the form
487 # $pluginGridWinHash{package_name} = plugin_name
488 pluginGridWinHash => {},
489 # Registry hash of 'free' windows added by the plugin (not including 'dialogue'
490 # windows). If the plugin is disabled, the windows are closed. Hash in the form
491 # $pluginFreeWinHash{package_name} = plugin_name
492 pluginFreeWinHash => {},
493 # Registry hash of strip objects added by the plugin. Strip objects are always
494 # available, even if their parent plugin is disabled. Hash in the form
495 # $pluginStripObjHash{package_name} = plugin_name
496 pluginStripObjHash => {},
497 # Registry hash of table objects added by the plugin. Table objects are always
498 # available, even if their parent plugin is disabled. Hash in the form
499 # $pluginTableObjHash{package_name} = plugin_name
500 pluginTableObjHash => {},
501 # Registry hash of cages that are added when a plugin is loaded, in the form
502 # $pluginCageHash{cage_name} = plugin_name
503 # ...where 'cage_name' matches the cage's name (an item in $self->cageTypeList) and
504 # 'plugin_name' matches a key in $self->pluginHash
505 pluginCageHash => {},
506 # For cages that have been added by a plugin, a registry hash of package names in the
507 # form
508 # $pluginCagePackageHash{cage_name} = cage_package
509 # ...where 'cage_name' is an item in $self->cageTypeList, and 'cage_package' is the
510 # package name of the Perl object
511 pluginCagePackageHash => {},
512 # For cages that have been added by a plugin, a registry hash of 'edit' windows added by
513 # the plugin (where available)
514 # Hash in the form
515 # $pluginCageEditWinHash{cage_name} = config_window_package_name
516 # NB If no 'edit' window exists for a particular cage, 'edit_window_package_name' will
517 # be 'undef'
518 pluginCageEditWinHash => {},
519 # Registry hash of functions to call every time a menu strip object (GA::Strip::MenuBar)
520 # creates a menu in an 'internal' window, in order to add menu menu items for the
521 # plugin. Hash in the form
522 # $pluginMenuFuncHash{plugin_name} = func_ref
523 # ...where 'func_ref' is a reference to a function within a plugin that creates menu
524 # items, when passed an existing Gtk3::Menu widget
525 pluginMenuFuncHash => {},
526 # For MXP file filters that must be passed to a plugin, a registry hash of the plugin
527 # functions to call when the filter is applied to a file. Hash in the form
528 # $pluginMxpFilterHash{package_name} = reference_to_function
529 pluginMxpFilterHash => {},
530  
531 # System loops
532 # ------------
533  
534 # The client time (used by various parts of the code that need a time that stays
535 # consistent for some measured period, but which is updated frequently). Set by
536 # $self->spinClientLoop, whenever the client loop spins, to the same value stored as
537 # $self->clientLoopObj->spinTime
538 # (See also the corresponding session IV, GA::Session->sessionTime)
539 clientTime => 0,
540 # Each session has a session loop, also called by a Glib timer. If a Perl error is
541 # generated, the code in axmud.pl this flag to TRUE, which suspends the client loop
542 # and
543 # all session loops until the user lifts the suspension with the ';restart' command
544 suspendSessionLoopFlag => FALSE,
545  
546 # Client loop
547 # -----------
548  
549 # The GA::Obj::Loop which handles the client loop
550 clientLoopObj => undef,
551 # Flag set to TRUE (by GA::Obj::Loop->spinLoop) when the client loop spins, set back to
552 # FALSE when the spin is complete. The TRUE setting prevents one client loop spin from
553 # taking place if another is still being processed
554 clientLoopSpinFlag => FALSE,
555 # The client loop default delay, in seconds (never changes once set; absolute minimum
556 # value is 0.01)
557 clientLoopDelay => 0.1,
558  
559 # File objects
560 # When there are no file objects in GA::Client->fileObjHash whose ->modifyFlag is set to
561 # TRUE (meaning that none of them need to be saved), this flag is set to FALSE
562 # When the first file object has its ->modifyFlag set to TRUE, this flag is set to TRUE
563 # When the flag changes, $self->checkMainWinTitles changes the title of all 'main'
564 # windows together, with an asterisk if the flag is TRUE, and no asterisk if the flag
565 # is FALSE
566 showModFlag => FALSE,
567  
568 # 'internal' window blinkers (not to be confused with blinking text in textviews)
569 # Blinkers in GA::Strip::ConnectInfo objects (in 'internal' windows) are handled by the
570 # client loop. Each session has its own ->blinkerStateHash, which specifies the
571 # current state of each blinker when that session is the window's visible session
572 # ('off' or 'on' for some specified time)
573 # This IV specifies the blinker delay - how many seconds until the blinker, having been
574 # turned on, should be turned off
575 blinkerDelay => 0.25,
576  
577 # Blinking text in textviews (not to be confused with 'internal' window blinkers)
578 # The time per blink for 'blink_slow' text, in seconds
579 blinkSlowTime => 1, # 60 blinks per minute
580 # The time (matches $self->clientTime) at which the 'blink_slow' text should next appear
581 # or disappear (one blink = one appearance and disappearance)
582 blinkSlowCheckTime => undef,
583 # Flag set to TRUE when 'blink_slow' text is visible, FALSE when 'blink_slow' text is
584 # invisible
585 blinkSlowFlag => undef,
586 # The time per blink for 'blink_fast' text, in seconds
587 blinkFastTime => 0.4, # 150 blinks per minute
588 # The time (matches $self->clientTime) at which the 'blink_slow' text should next appear
589 # or disappear (one blink = one appearance and disappearance)
590 blinkFastCheckTime => undef,
591 # Flag set to TRUE when 'blink_fast' text is visible, FALSE when 'blink_fast' text is
592 # invisible
593 blinkFastFlag => undef,
594  
595 # In 'internal' windows, the strip object GA::Strip::Entry includes a switcher button to
596 # switch between pane objects (GA::Table::Pane); the scroll lock/split screen buttons
597 # then apply to the selected pane object
598 # When a pane object is selected, its border size is briefly increased by a call to
599 # $self->modifyPane, then restored to normal by a call to $self->restorePane after a
600 # short period
601 # The period to wait (in seconds) before restoring a border to its normal size
602 paneDelay => 0.5,
603 # Pane object numbers are not unique to the client, so in this hash we take the unusual
604 # step of using a system time as a key, matching the time at which the border size
605 # should be restored. Hash in the form
606 # $paneRestoreHash{system_time} = pane_object
607 paneRestoreHash => {},
608  
609 # When system messages are written but there's no session open in which they can be
610 # displayed, they are written to the terminal, and also stored here. Then, the next
611 # time the Client Console window is open, they are displayed there
612 # (If the Client Console window is already open, the system message is displayed there
613 # immediately and is not added to this list)
614 # List in groups of 2, in the form (type, message), where 'type' is the type of system
615 # message: 'system', 'error', 'warning', 'debug' or 'improper'
616 systemMsgList => [],
617  
618 # Sessions
619 # --------
620  
621 # Registry hash of GA::Session objects
622 # Each connection to a world has its own session. Sessions can also be created for
623 # simulated connections in 'connect offline' mode
624 # If $self->shareMainWinFlag TRUE, each session corresponds to a tab in a single 'main'
625 # window. If $self->shareMainWinFlag is FALSE, each session has its own 'main' window
626 # Hash in the form
627 # $sessionHash{unique_number} = blessed_reference_to_session_object
628 sessionHash => {},
629 # Number of session objects ever created (used to give each session object a unique
630 # number)
631 sessionCount => 0,
632 # The absolute maximum number of sessions allowed - to prevent a possible infinite loop
633 # of new sessions
634 constSessionMax => 1024,
635 # The current number of sessions allowed (ignored when $axmud::BLIND_MODE_FLAG is TRUE,
636 # when only one session is allowed)
637 sessionMax => 16, # [config]
638 # The current session is set whenever a session's default tab becomes the visible tab in
639 # a 'main' window, and is set back to 'undef' when there are no sessions running
640 # Set/reset by $self->setCurrentSession
641 currentSession => undef,
642 # Flag set to TRUE when Axmud should be shut down. The END() function in axmud.pl checks
643 # this flag and, if it's still set to FALSE, calls GA::Client->stop() before
644 # terminating the script. If it's set to TRUE, GA::Client->stop() has already been
645 # called, and we don't need to call it again
646 shutdownFlag => FALSE,
647 # Flag set to TRUE when $self->stop is first called, to prevent multiple concurrent
648 # calls to that function
649 terminatingFlag => FALSE,
650 # Flag that determines how a session deals with a disconnection from a world (i.e. when
651 # its ->status is 'connected'). FALSE if it should switch to 'disconnected' mode, TRUE
652 # if it should switch to 'offline' mode (as if the user had clicked the 'Connect
653 # offline' button in the Connections window)
654 offlineOnDisconnectFlag => FALSE, # [config]
655  
656 # The way in which text on each session's tab label (if it's visible) is displayed:
657 # 'bracket' - displayed as 'deathmud (Gandalf)'
658 # 'hyphen' - 'deathmud - Gandalf'
659 # 'world' - 'deathmud'
660 # 'char' - 'gandalf'
661 # NB If $self->xTermTitleFlag is TRUE and an xterm title is received, that title is
662 # displayed instead
663 # NB If $self->longTitleFlag is TRUE, the world's long name (rather than the world's
664 # profile name) is used
665 sessionTabMode => 'bracket', # [config]
666 # Flag set to TRUE if xterm titles (in the form ESC]0;stringBEL ) should be displayed
667 # in a 'main' window tab's title (if the tab is visible) when they are received from
668 # the world; set to FALSE if the normal text (specified by
669 # GA::Session->checkTabLabels) should be displayed there (if the tab is visible)
670 # NB If set to TRUE, the normal text is displayed until the first xterm title is
671 # received
672 xTermTitleFlag => TRUE, # [config]
673 # Flag set to TRUE if the tab label (if it's visible) should use the world's long name,
674 # FALSE if the tab label should use the profile name
675 longTabLabelFlag => TRUE, # [config]
676 # Flag set to TRUE if a so-called 'simple tab' (a standalone Gtk3::TextView, rather than
677 # a tab in a Gtk3::Notebook) should be displayed when only a single session is open
678 # in a 'main' window (it's replaced with a Gtk3::Notebook when a second session is
679 # opened in the same 'main' window)
680 # Flag set to FALSE if a Gtk3::Notebook should always be used
681 # NB This IV only applies to pane objects used for sessions' default tabs
682 simpleTabFlag => FALSE, # [config]
683 # Flag set to TRUE if the user should be prompted for a confirmation if they try to
684 # close a 'main' window by clicking on its 'X' widget, and any of the sessions using
685 # the window are connected to a world
686 confirmCloseMainWinFlag => TRUE, # [config]
687 # Flag set to TRUE if the user should be prompted for a confirmation if they try to
688 # close a tab by clicking on its 'X' widget, and the session is connected to a world
689 confirmCloseTabFlag => TRUE, # [config]
690 # Equivalent flag set to TRUE if the user should be prompted for a confirmation if they
691 # try to stop the session by clicking the main window menu, and the session is
692 # connected to a world
693 confirmCloseMenuFlag => TRUE, # [config]
694 # Equivalent flag set to TRUE if the user should be prompted for a confirmation if they
695 # try to stop the session by clicking the main window toolbutton, and the session is
696 # connected to a world
697 confirmCloseToolButtonFlag => TRUE, # [config]
698  
699 # The default character set to use. Must be one of the character sets available with the
700 # Perl Encode module
701 constCharSet => 'iso-8859-1',
702 # The current character set. For each individual session, if the current world's
703 # ->worldCharSet IV is set, that character set is used instead
704 charSet => undef, # [config] Set below
705 # Ordered list of available character sets (from the Perl 'encode' module)
706 charSetList => [], # Set below
707  
708 # Flag set to TRUE if details about every connection to a world should be stored in the
709 # world profile, FALSE if not
710 connectHistoryFlag => TRUE, # [config]
711  
712 # Client commands
713 # ---------------
714  
715 # All client command objects are stored in the following hash. Each command object
716 # inherits from GA::Generic::Cmd
717 # (Actually, there are two types of client command: 'built-in' commands which exist in
718 # every copy of Axmud, and commands loaded from plugins which Axmud treats in almost
719 # exactly the same way. If plugin client commands have the same name as built-in
720 # client commands, then the built-in command is not available for as long as the
721 # plugin is enabled)
722 #
723 # Registry hash of client command objects, in the form
724 # $clientCmdHash{command_name} = blessed_reference_to_command_object
725 # e.g. $clientCmdHash{'about'} = blessed_reference_to_command_object
726 clientCmdHash => {},
727 # When a plugin adds a command with same 'command_name' as an existing client
728 # command, the existing command is moved out of ->clientCmdHash and into this hash.
729 # Later, if the plugin is disabled, the original command is moved back into
730 # ->clientCmdHash, and the plugin command is moved into this hash - and so on,
731 # ad infinitum
732 replaceClientCmdHash => {},
733 # A constant list of built-in client commands, grouped thematically and in a pre-defined
734 # order. Elements beginning with the @ character are group headings; everything else
735 # is a built-in client command
736 constClientCmdPrettyList => [
737 '@Debug commands',
738 'Test', 'HelpTest', 'DumpAscii', 'TestColour', 'TestXTerm', 'TestFile',
739 'TestModel', 'TestPattern',
740 'QuickInput',
741 'SimulateWorld', 'SimulatePrompt', 'SimulateCommand', 'SimulateHook',
742 'DebugToggle', 'DebugConnection', 'Restart', 'Peek', 'Poke', 'PeekHelp',
743 '@Client commands',
744 'Help', 'Hint', 'QuickHelp', 'SearchHelp', 'ListReserved',
745 'About', 'OpenAboutWindow', 'CloseAboutWindow',
746 'EditQuick', 'EditClient', 'EditSession',
747 'SwitchSession', 'MaxSession', 'ListSession', 'SetSession',
748 'Connect', 'Reconnect', 'XConnect', 'Telnet', 'SSH', 'SSL',
749 'Login',
750 'Quit', 'Qquit', 'QuitAll', 'Exit', 'Xxit', 'ExitAll',
751 'AbortSelfDestruct', 'StopSession', 'StopClient', 'Panic',
752 'AwayFromKeys', 'SetReminder', 'SetCountdown', 'SetCountup',
753 'SetLookup', 'ResetLookup', 'ForceLookup', 'ListLookup',
754 'SetCharSet',
755 'SetCustomMonth', 'SetCustomWeek', 'SetCommifyMode',
756 'SetApplication', 'ResetApplication', 'SetPromptDelay',
757 'Repeat', 'IntervalRepeat', 'StopCommand',
758 'RedirectMode', 'SetRedirectMode',
759 'ToggleInstruction', 'ToggleSigil', 'CommandSeparator',
760 'Echo', 'Perl', 'Multi', 'SpeedWalk', 'SlowWalk', 'Crawl', 'Bypass',
761 'AddUserCommand', 'DeleteUserCommand', 'ListUserCommand', 'ResetUserCommand',
762 'DisplayBuffer', 'SetDisplayBuffer', 'EditDisplayBuffer', 'DumpDisplayBuffer',
763 'InstructionBuffer', 'SetInstructionBuffer', 'EditInstructionBuffer',
764 'DumpInstructionBuffer',
765 'CommandBuffer', 'SetCommandBuffer', 'EditCommandBuffer', 'DumpCommandBuffer',
766 'SaveBuffer', 'LoadBuffer', 'ReplayBuffer', 'HaltReplay', 'SetAutoComplete',
767 'ToggleWindowKey', 'ToggleMainWindow', 'ToggleLabel', 'ToggleIrreversible',
768 'TogglePopup', 'ToggleShortLink',
769 'ShowFile', 'DisableSaveLoad', 'DisableSaveWorld', 'Save', 'Load',
770 'AutoSave', 'EmergencySave',
771 'ExportFiles', 'ImportFiles', 'ExportData', 'ImportData',
772 'RetainFileCopy',
773 'ListDataDirectory', 'SetDataDirectory', 'BackupData', 'RestoreData',
774 'AutoBackup',
775 'ImportPlugin', 'LoadPlugin', 'EnablePlugin', 'DisablePlugin', 'TestPlugin',
776 'ListPlugin',
777 'AddInitialPlugin', 'DeleteInitialPlugin', 'ListInitialPlugin',
778 'SetTelnetOption', 'SetMUDProtocol', 'SetTermType', 'ConfigureTerminal',
779 'MSDP', 'MSSP', 'MXP', 'MSP', 'ZMP', 'SendZMP', 'InputZMP', 'Aardwolf', 'ATCP',
780 'SendATCP', 'GMCP', 'SendGMCP', 'MNES', 'MCP',
781 'Log',
782 '@Sound and text-to-speech',
783 'Sound', 'ASCIIBell',
784 'AddSoundEffect', 'PlaySoundEffect', 'QuickSoundEffect', 'Beep',
785 'DeleteSoundEffect', 'ResetSoundEffect', 'ListSoundEffect',
786 'Speech', 'Speak',
787 'Split', 'Skip', 'Unskip', 'First', 'Last', 'Resume', 'Shutup', 'Prompt',
788 'FreeKeys', 'HijackKeys',
789 'Read', 'PermRead', 'Switch', 'PermSwitch', 'Alert', 'PermAlert',
790 'ListAttribute', 'AddConfig', 'CloneConfig', 'EditConfig', 'ModifyConfig',
791 'DeleteConfig', 'ListConfig',
792 '@Other windows',
793 'OpenObjectViewer', 'CloseObjectViewer',
794 'OpenAutomapper', 'CloseAutomapper', 'ToggleAutomapper',
795 'LocatorWizard',
796 '@Dictionaries',
797 'AddDictionary', 'SetDictionary', 'CloneDictionary', 'EditDictionary',
798 'DeleteDictionary', 'ListDictionary', 'SetLanguage', 'SwitchLanguage',
799 'AddWord', 'QuickAddWord', 'DeleteWord', 'ListWord',
800 'ModifyPrimary', 'AddSecondary', 'ModifySecondary', 'DeleteSecondary',
801 'AddRelative', 'DeleteRelative', 'ListDirection',
802 'SetAutoSecondary', 'ListAutoSecondary',
803 'AddSpeedWalk', 'DeleteSpeedWalk', 'ListSpeedWalk',
804 'AddModifierChar', 'DeleteModifierChar', 'ListModifierChar',
805 '@Profiles - general',
806 'ListProfile',
807 'SetProfilePriority', 'ListProfilePriority',
808 'AddTemplate', 'CloneTemplate', 'EditTemplate', 'DeleteTemplate',
809 'ListTemplate', 'AddScalarProperty', 'AddListProperty', 'AddHashProperty',
810 'DeleteProperty', 'ListProperty',
811 '@Profiles - world profiles',
812 'AddWorld', 'SetWorld', 'CloneWorld', 'EditWorld', 'DeleteWorld', 'ListWorld',
813 'SetFavouriteWorld', 'ListFavouriteWorld', 'SetAutoWorld', 'ListAutoWorld',
814 'RestoreWorld', 'ListRestoreWorld', 'UpdateWorld', 'ListBasicWorld',
815 'ToggleHistory', 'ClearHistory', 'ShowHistory',
816 '@Profiles - other profiles',
817 'AddGuild', 'SetGuild', 'UnsetGuild', 'CloneGuild', 'EditGuild', 'DeleteGuild',
818 'ListGuild',
819 'AddRace', 'SetRace', 'UnsetRace', 'CloneRace', 'EditRace', 'DeleteRace',
820 'ListRace',
821 'AddChar', 'SetChar', 'UnsetChar', 'CloneChar', 'EditChar', 'DeleteChar',
822 'ListChar',
823 '@Profiles - custom profiles',
824 'AddCustomProfile', 'SetCustomProfile', 'UnsetCustomProfile',
825 'CloneCustomProfile', 'EditCustomProfile', 'DeleteCustomProfile',
826 'ListCustomProfile',
827 '@Cages',
828 'EditCage', 'DeleteCage', 'ListCage', 'SetCageMask', 'EditCageMask',
829 '@Interfaces',
830 'EnableActiveInterface', 'DisableActiveInterface', 'MoveActiveInterface',
831 'EditActiveInterface', 'ListActiveInterface',
832 'EditInterfaceModel', 'ListInterfaceModel',
833 'AddTrigger', 'ModifyTrigger', 'DeleteTrigger', 'ListTrigger',
834 'AddAlias', 'ModifyAlias', 'DeleteAlias', 'ListAlias',
835 'AddMacro', 'ModifyMacro', 'DeleteMacro', 'ListMacro',
836 'AddTimer', 'ModifyTimer', 'DeleteTimer', 'ListTimer',
837 'AddHook', 'ModifyHook', 'DeleteHook', 'ListHook',
838 '@Keycodes',
839 'ListKeycode', 'ListKeycodeAlternative',
840 '@Task package names',
841 'AddTaskPackage', 'DeleteTaskPackage', 'ResetTaskPackage', 'ListTaskPackage',
842 '@Task labels',
843 'AddTaskLabel', 'DeleteTaskLabel', 'ResetTaskLabel', 'ListTaskLabel',
844 '@Current tasks',
845 'TaskHelp', 'StartTask', 'HaltTask', 'KillTask', 'PauseTask', 'ResumeTask',
846 'ResetTask', 'FreezeTask', 'EditTask', 'ListTask', 'SetRunList',
847 '@Initial tasks',
848 'AddInitialTask', 'EditInitialTask', 'DeleteInitialTask', 'ListInitialTask',
849 '@Custom tasks',
850 'AddCustomTask', 'EditCustomTask', 'DeleteCustomTask', 'ListCustomTask',
851 'StartCustomTask',
852 '@Initial scripts',
853 'AddInitialScript', 'DeleteInitialScript', 'ListInitialScript',
854 '@Axbasic commands',
855 'EditScript', 'CheckScript', 'RunScript', 'RunScriptTask', 'AxbasicHelp',
856 'AddDirectory', 'DeleteDirectory', 'ListDirectory',
857 '@Workspaces',
858 'UseWorkspace', 'EditWorkspace', 'RemoveWorkspace', 'ListWorkspace',
859 'SetWorkspaceDirection',
860 'AddInitialWorkspace', 'ModifyInitialWorkspace', 'DeleteInitialWorkspace',
861 'ListInitialWorkspace',
862 'SetWindowSize',
863 'TestWindowControls', 'SetWindowControls', 'ListWindowControls',
864 'TestPanel', 'SetPanel', 'ListPanel',
865 '@Workspace grids',
866 'ActivateGrid', 'DisactivateGrid', 'SetGrid', 'ResetGrid', 'EditGrid',
867 'ListGrid',
868 'SetLayer', 'LayerUp', 'LayerDown',
869 'ToggleWindowStorage', 'ApplyWindowStorage', 'ClearWindowStorage',
870 'DumpWindowStorage',
871 '@Winmaps and winzones',
872 'AddWinmap', 'CloneWinmap', 'EditWinmap', 'ModifyWinmap', 'DeleteWinmap',
873 'ResetWinmap', 'SetDefaultWinmap', 'ListWinmap',
874 'AddWinzone', 'EditWinzone', 'ModifyWinzone', 'DeleteWinzone', 'ListWinzone',
875 '@Zonemaps and zone models',
876 'AddZonemap', 'CloneZonemap', 'EditZonemap', 'DeleteZonemap', 'ResetZonemap',
877 'ListZonemap',
878 'AddZoneModel', 'EditZoneModel', 'ModifyZoneModel', 'DeleteZoneModel',
879 'ListZoneModel',
880 '@\'Grid\' windows',
881 'ToggleShare', 'SwapWindow', 'MoveWindow', 'RestoreWindow', 'GrabWindow',
882 'BanishWindow', 'FixWindow', 'FlashWindow', 'UnflashWindow', 'CloseWindow',
883 'EditWindow', 'ListWindow',
884 '@\'Internal\' windows',
885 'EditWindowStrip', 'ListWindowStrip', 'EditWindowTable', 'ListWindowTable',
886 'OpenTaskWindow', 'CloseTaskWindow',
887 'EditToolbar', 'ListToolbar',
888 '@\'Free\' windows',
889 'EditFreeWindow', 'CloseFreeWindow', 'ListFreeWindow',
890 '@Textviews',
891 'ScrollLock', 'SplitScreen', 'ClearTextView', 'SetTextView', 'ListTextView',
892 'FindText', 'FindReset', 'ConvertText',
893 'SetColour', 'ListColour',
894 'SetSystemColour', 'ListSystemColour',
895 'SetXTerm', 'TogglePalette',
896 'AddColourScheme', 'EditColourScheme', 'ModifyColourScheme',
897 'UpdateColourScheme', 'ApplyColourScheme', 'DeleteColourScheme',
898 'ListColourScheme',
899 '@Recordings, missions, quests and routes',
900 'Record', 'PauseRecording', 'WorldCommand', 'ClientCommand', 'SpeedWalkCommand',
901 'Comment', 'Break',
902 'InsertRecording', 'DeleteRecording', 'ListRecording', 'CopyRecording',
903 'StartMission', 'Mission', 'NudgeMission', 'HaltMission',
904 'RepeatComment', 'RepeatMission',
905 'AddMission', 'CloneMission', 'EditMission', 'DeleteMission', 'ListMission',
906 'PresentMission',
907 'AddQuest', 'CloneQuest', 'EditQuest', 'ModifyQuest', 'FinishQuest',
908 'DeleteQuest', 'ListQuest',
909 'AddRoute', 'EditRoute', 'DeleteRoute', 'ListRoute',
910 'Go', 'Drive', 'Road', 'Quick', 'Circuit',
911 '@Advance task',
912 'ResetGuildSkills', 'ListGuildSkills', 'Advance', 'SkipAdvance', 'ListAdvance',
913 'ListAdvanceHistory',
914 '@Attack task',
915 'Kill', 'KKill', 'KillAll', 'KillMall', 'Interact', 'IInteract', 'InteractAll',
916 'InteractMall',
917 '@Channels and Divert tasks',
918 'AddChannelPattern', 'DeleteChannelPattern', 'ListChannelPattern',
919 'EmptyChannelsWindow', 'EmptyDivertWindow',
920 '@Chat task',
921 'GetIP', 'ChatListen', 'ChatIgnore', 'AddContact', 'EditContact',
922 'DeleteContact', 'ListContact',
923 'ChatCall', 'ChatMCall', 'ChatZCall', 'Chat', 'Emote', 'ChatGroup',
924 'EmoteGroup', 'ChatAll', 'EmoteAll', 'ChatPing', 'ChatDND', 'ChatSubmit',
925 'ChatEscape', 'ChatCommand', 'ChatSendFile', 'ChatStopFile', 'ChatSnoop',
926 'ChatHangUp', 'ChatPeek', 'ChatRequest', 'ChatInfo', 'ChatSet',
927 'ChatSetName', 'ChatSetGroup', 'ChatSetEmail', 'ChatSetSmiley',
928 'ChatSetIcon',
929 'AddSmiley', 'DeleteSmiley', 'ListSmiley', 'ResetSmiley',
930 '@Compass task',
931 'Compass', 'PermCompass', 'WorldCompass',
932 '@Inventory / Condition tasks',
933 'ActivateInventory', 'DisactivateInventory',
934 'ProtectObject', 'UnprotectObject', 'ListProtectObject',
935 'MonitorObject', 'UnmonitorObject', 'ListMonitorObject',
936 'SellAll', 'DropAll', 'UseAll',
937 '@Locator task',
938 'MoveDirection', 'RelayDirection', 'Teleport', 'AddTeleport', 'DeleteTeleport',
939 'ListTeleport', 'InsertLook', 'InsertFailedExit', 'ResetLocatorTask',
940 'SetFacing',
941 'AddExitPattern', 'DeleteExitPattern', 'ListExitPattern',
942 'CollectUnknownWords', 'EmptyUnknownWords', 'ListUnknownWords',
943 'CollectContentsLines', 'EmptyContentsLines', 'ListContentsLines',
944 '@Status task',
945 'ActivateStatusTask', 'DisactivateStatusTask', 'ResetCounter',
946 'AddStatusCommand', 'DeleteStatusCommand', 'ListStatusCommand', 'SetWimpy',
947 'SetLife', 'SetStatusEvent', 'ShowStatusGauge',
948 '@System task',
949 'SetSystemMode',
950 '@Watch task',
951 'EmptyWatchWindow',
952 '@World model commands',
953 'AddRegion', 'AddRoom', 'AddModelObject', 'SetModelParent', 'EditModelObject',
954 'EditRegionmap', 'EmptyRegion', 'DeleteRegion', 'DeleteTemporaryRegion',
955 'DeleteRoom', 'DeleteModelObject', 'ListModel', 'ListOrphan', 'DumpModel',
956 'SplitModel', 'EditModel', 'MergeModel', 'UpdateModel', 'CompressModel',
957 'ModelReport', 'ListSourceCode',
958 'AddRegionScheme', 'EditRegionScheme', 'RenameRegionScheme',
959 'DeleteRegionScheme', 'ListRegionScheme',
960 'AddLabelStyle', 'EditLabelStyle', 'RenameLabelStyle', 'DeleteLabelStyle',
961 'ListLabelStyle',
962 'QuickLabelDelete',
963 'AddPlayerCharacter', 'DeletePlayerCharacter', 'ListPlayerCharacter',
964 'AddMinionString', 'DeleteMinionString', 'ListMinionString',
965 'SetLightList', 'ResetLightList', 'SetLightStatus',
966 'SetRoom', 'ResetRoom', 'SetOfflineRoom', 'LocateRoom',
967 'EditRoomComponent', 'ListRoomComponent',
968 'EditPainter',
969 'SetAssistedMoves', 'SetProtectedMoves',
970 'RoomCommand', 'IgnoreRoomCommand', 'NoticeRoomCommand', 'ListRoomCommand',
971 '@Exit model commands',
972 'AddExit', 'EditExit', 'DeleteExit', 'ListExitModel', 'DumpExitModel',
973 'AllocateExit', 'AlternativeExit',
974 ],
975 # An ordered list of commands, initially set to $self->constClientCmdPrettyList, and
976 # modified when plugins are loaded, enabled or disabled in order to show (or remove)
977 # any plugin client commands
978 clientCmdPrettyList => [], # set below
979 # An ordered list of commands - initially set to $self->constClientCmdPrettyList but
980 # with the headings removed, and all in lower-case (e.g. 'AddChar' becomes 'addchar')
981 clientCmdList => [],
982 # When plugins are loaded, anything to be added to ->clientCmdPrettyList is also added
983 # to this hash. Then, when the plugin is disabled and/or re-enabled,
984 # ->clientCmdPrettyList can be updated
985 # Hash in the form
986 # $clientCmdReplacePrettyHash{plugin_name}
987 # = reference_to_list_of_group_headings_and_client_commands
988 clientCmdReplacePrettyHash => {},
989 #
990 # Each client command has one or more corresponding 'user commands'. Most user commands
991 # are abbreviations; for example, the client command 'addchar' has the user commands
992 # 'ach' and 'addchar'
993 # When the user types a client command in the 'main' window, what they're actually
994 # typing is a user command. Axmud translates the user command into the corresponding
995 # client command before executing it
996 # Both client and user commands have a maximum length of 32 characters
997 #
998 # The constant hash of user commands (these values never change). A hash in the form
999 # $constUserCmdHash{user_command} = standard_command
1000 # e.g. $constUserCmdHash{'ab'} = 'about'
1001 # The hash is set up by a call to $self->setupCmds
1002 constUserCmdHash => {},
1003 # The customisable hash of user commands, in the form
1004 # $userCmdHash{user_command} = standard_command
1005 userCmdHash => {}, # [usercmds]
1006 # e.g. ->constUserCmdHash{'my_custom_about'} = 'about'
1007  
1008 # Instructions
1009 # ------------
1010  
1011 # Axmud offers several different kinds of instructions. Instructions are usually typed
1012 # in the 'main' window's command entry box, but any part of the Axmud code can
1013 # generate its own instructions
1014 # For example, most interfaces (triggers, aliases, macros, timers and hooks) generate an
1015 # instruction as their response to a stimulus, and that instruction is executed as if
1016 # it had been typed in the 'main' window's command entry box
1017 # Instructions can beging with one of Axmud's instruction sigils. The sigil specifies
1018 # what kind of instruction it is
1019 # Some sigils are invariable (cannot be disabled, but others can be enabled or disabled
1020 # according to the user's requirements
1021 # If an instruction doesn't begin with a recognised instruction sigil, or if it begins
1022 # with an instruction sigil that's currently disabled, it is executed as an ordinary
1023 # world command (sent to the current world)
1024 #
1025 # The following sigils can be enabled/disabled (but are disabled by default):
1026 #
1027 # The " (double quote) character indicates an 'echo command'. Echo commands are
1028 # displayed in the current session's 'main' window in the same colour used by Axmud
1029 # system messages
1030 #
1031 # e.g. "hello world
1032 # - Displays a 'hello world' message in the session's 'main' window
1033 #
1034 # The / (forward slash) character indicates a 'Perl command'. Perl commands are run as
1035 # a mini-Perl programme. The programme's return value is then executed as an
1036 # instruction. For security, the programme has limited functionality (for example,
1037 # it's not possible to accidentally run 'rm *' )
1038 #
1039 # e.g. /$a = 5; $b = 2; $a * $b;
1040 # - Evaluates the programme, which returns a value of 10, which is executed as a
1041 # world command
1042 #
1043 # The & (ampersand) character indicates a 'script command'. Script commands cause an
1044 # Axbasic script to run. Note that, unlike Perl programmes, Axbasic scripts don't have
1045 # a return value, so no instruction is executed when the script terminates
1046 #
1047 # e.g. &wumpus
1048 # - Runs the wumpus.bas script; it's the equivalent of ';runscript wumpus'
1049 #
1050 # The : (colon) character indicates a 'multi command'. Multi commands are executed in
1051 # multiple sessions - either in sessions connected to the same world as the session
1052 # executing the command, or in all sessions (depending on the value of
1053 # $self->maxMultiCmdFlag) - as a forced world command
1054 #
1055 # e.g. :shout I'm going for lunch
1056 # - Executes the forced world command in multiple sessions
1057 #
1058 # The . (full stop) character indicates a 'speedwalk command'. Speedwalk commands are
1059 # strings like '3nw2e' which resolved to a series of world commands. For special
1060 # features of speedwalk commands, see the comments in GA::Session->speedWalkCmd
1061 #
1062 # e.g. .3nw2s
1063 # - The equivalent of 'north;north;north;west;south;south'
1064 #
1065 # The > (greater than) character indicates a 'bypass command'. Bypass commands are
1066 # ordinary world commands that are executed immediately, ahead of any stored excess
1067 # commands (if the world profile's slowwalking settings specify a command limit, or if
1068 # the session is in crawl mode)
1069 #
1070 # e.g. >drink water
1071 # - Executes the world command immediately, perhaps to drink in order to increase
1072 # the character's energy points before they run out, and while still moving
1073 # along a path (specifically, bypasses a queue of unsent world commands
1074 # created in slowwalking or crawl mode)
1075 #
1076 # The following sigils are always enabled:
1077 #
1078 # The ; (semicolon) character indicates a 'client command'. Axmud provides several
1079 # hundred client commands so that its internal data can be accessed and modified
1080 # from the command line
1081 #
1082 # e.g. ;help
1083 # - Displays Axmud help
1084 #
1085 # The ,, (two commas) sequence indicates a 'forced world command'. Everything following
1086 # the commas is executed as a world command, even if the rest of the command starts
1087 # with a different instruction sigil
1088 #
1089 # e.g. ,,/connect
1090 # - Executes '/connect/ as a world command, rather than as a Perl command
1091 #
1092 # If an instruction doesn't begin with a recognised instruction sigil (or if it does,
1093 # but the sigil is disabled), the instruction is executed as an ordinary world command
1094 # (not a forced world command)
1095 #
1096 # World commands can be modified in some circumstances
1097 # - They can be intercepted by aliases, and either modified or diverted to some part
1098 # of the Axmud code
1099 # - Primary directions like 'north' can be modified if 'redirect' mode is on, or if
1100 # the automapper's assisted moves are on
1101 # - The instruction might be split into two or more world commands, if the command
1102 # separator (a semicolon by default) occurs in the command
1103 # - commands typed in upper-case letters (only) can be converted to lower-case letters
1104 # if $self->convertWorldCmdFlag is set
1105 # However, none of these apply to forced world commands, which are never modified before
1106 # being sent to the world
1107 #
1108 # The instruction sigils. Modifying the values of these IVs is strongly discouraged
1109 # If you do modify them, do not use empty strings or strings containing whitespace. Make
1110 # sure each sigil starts with a different character (i.e. don't set the client command
1111 # sigil to '@1' and the echo command sigil to '@2', or something like that)
1112 # Axmud system messages do not consult these IVs; they generally assume that the sigils
1113 # have not been modified. Changing these sigils will not affect the way missions or
1114 # the Chat task operate
1115 constClientSigil => ';',
1116 constForcedSigil => ',,',
1117 constEchoSigil => '"',
1118 constPerlSigil => '/',
1119 constScriptSigil => '&',
1120 constMultiSigil => ':',
1121 constSpeedSigil => '.',
1122 constBypassSigil => '>',
1123 # Flags to enable (TRUE) or disable (FALSE) some instruction sigils
1124 echoSigilFlag => FALSE,
1125 perlSigilFlag => FALSE,
1126 scriptSigilFlag => FALSE,
1127 multiSigilFlag => FALSE,
1128 speedSigilFlag => FALSE,
1129 bypassSigilFlag => FALSE,
1130 #
1131 # The default character (or string) used to separate commands in a string (maximum 4
1132 # characters)
1133 constCmdSep => ';',
1134 # The current character (or string) used
1135 cmdSep => undef, # [config] Set below
1136  
1137 # Constant default sizes for display, instruction and world command buffers (any
1138 # registry which stores GA::Buffer::Display, GA::Buffer::Instruct or
1139 # GA::Buffer::Cmd objects)
1140 constDisplayBufferSize => 10000,
1141 constInstructBufferSize => 1000,
1142 constCmdBufferSize => 1000,
1143 # Constant minimum/maximum buffer sizes
1144 constMinBufferSize => 10,
1145 constMaxBufferSize => 1000000,
1146 # Custom sizes for display, instruction and world command buffers. Minimum 10,
1147 # maximum 1000000
1148 customDisplayBufferSize => undef, # [config] set below
1149 customInstructBufferSize => undef, # [config]
1150 customCmdBufferSize => undef, # [config]
1151  
1152 # Flag set to TRUE if world commands should be confirmed (also displayed) in the
1153 # session's default textview object, after being sent to the world; set to FALSE
1154 # otherwise
1155 confirmWorldCmdFlag => TRUE, # [config]
1156 # Flag set to TRUE if single-word world commands that are in ALL CAPITAL LETTERS
1157 # (usually after typing all-caps elsewhere, perhaps the text for a label in the
1158 # automapper window) should be converted to lower-case letters, before being processed
1159 convertWorldCmdFlag => TRUE, # [config]
1160 # Flag set to TRUE if the last world command typed in the 'main' window's command entry
1161 # box should be preserved after the user types RETURN; set to FALSE otherwise (also
1162 # applies to multi commands, speedwalk commands and bypass commands)
1163 preserveWorldCmdFlag => TRUE, # [config]
1164 # Flag set to TRUE if the last instruction (besides world, multi, speedwalk and bypass
1165 # commands commands) typed in the 'main' window's command entry box should be
1166 # preserved after the user types RETURN, set to FALSE otherwise
1167 preserveOtherCmdFlag => FALSE, # [config]
1168 # Flag set to TRUE if multi commands (those beginning with the instruction sigil ':')
1169 # should be executed as world commands in all sessions, FALSE if they should be
1170 # executed as world commands only in sessions with the same current world
1171 maxMultiCmdFlag => TRUE, # [config]
1172  
1173 # Auto-complete mode - what to do when an 'internal' window's command entry box is in
1174 # focus, and the user presses the up/down arrow keys
1175 # 'none' - Do nothing
1176 # 'auto' - Auto-complete the command using the 'tab' key, or navigate through
1177 # instructions/world commands using the 'up'/'down' keys
1178 autoCompleteMode => 'auto', # [config]
1179 # Auto-complete type - navigate through an instruction buffer ('instruct') or through a
1180 # world command buffer ('cmd')
1181 autoCompleteType => 'cmd', # [config]
1182 # Auto-complete registry location. Registries to store display, instruction and world
1183 # command buffers exist in GA::Client and GA::Session. Which registry to use:
1184 # 'combined' or 'session'
1185 autoCompleteParent => 'session', # [config]
1186  
1187 # Flag set to TRUE if the page up/page down/home/end keys should cause the a textview in
1188 # the active 'internal' window to scroll up and down; set to FALSE otherwise
1189 useScrollKeysFlag => TRUE, # [config]
1190 # Flag set to FALSE if the page up/page down keys should scroll the size of a page (so
1191 # that no text from the previous page is visible), TRUE if the keys should scroll the
1192 # size of a page increment (which is a little smaller, so that text from the top or
1193 # bottom is still visible)
1194 smoothScrollKeysFlag => TRUE, # [config]
1195 # Flag set to TRUE if the page up/home keys should cause a textview object to engage
1196 # split screen mode (if it's not engaged already), and the page down/end keys should
1197 # cause a textview object to disengage split screen mode
1198 autoSplitKeysFlag => TRUE, # [config]
1199 # Flag set to TRUE if the tab/cursor up/cursor down should autocomplete text in the
1200 # active 'internal' window's command entry box; set to FALSE otherwise
1201 # (NB GA::Client->autoCompleteMode must also be set to 'auto')
1202 useCompleteKeysFlag => TRUE, # [config]
1203 # Flag set to TRUE if the TAB key should switch between tabs in a pane object
1204 # (GA::Table::Pane) in the active 'internal' window; set to FALSE otherwise
1205 # If the window contains an entry strip object (GA::Strip::Entry), the TAB key is used
1206 # in auto-completion, so CTRL+TAB is required to switch tabs. If there's no entry
1207 # strip object, TAB will do the job
1208 useSwitchKeysFlag => TRUE, # [config]
1209  
1210 # The instruction buffer for the client. Every instruction processed by any session is
1211 # assigned its own GA::Buffer::Instruct object in that session's registry, as well as
1212 # a separate GA::Buffer:Instruct object in this registry
1213 # Instructions includes client commands like ';setworld deathmud', Perl commands, echo
1214 # commands as well as world commands
1215 # In addition, if the user types 'north;kill troll;eat corpse', that chain of world
1216 # commands is stored as a single GA::Buffer::Instruct (and also as three separate
1217 # GA::Buffer::Cmd objects in the world command buffer)
1218 # When the buffer is full, adding an instruction to the buffer also deletes the oldest
1219 # existing one
1220 # Hash in the form
1221 # $instructBufferHash{number} = blessed_reference_to_buffer_object
1222 instructBufferHash => {},
1223 # How many instructions have been processed altogether (used to give every
1224 # GA::Buffer::Instruct object a unique number)
1225 instructBufferCount => 0,
1226 # The ->number of the earliest surviving GA::Buffer::Instruct object in the buffer,
1227 # deleted when the buffer is full and a new object is added
1228 instructBufferFirst => undef,
1229 # The ->number of the most recently-created GA::Buffer::Instruct object in the buffer
1230 # (when set, always one less than $self->instructBufferCount)
1231 instructBufferLast => undef,
1232 # When the user navigates through instructions in an 'internal' window's command entry
1233 # box by pressing the up/down arrow keys, the number of the buffer object whose
1234 # instruction is currently used (matches a key in ->instructBufferHash)
1235 # Set on the first such key press in the window. Reset back to 'undef' when the current
1236 # session changes or an instruction is processed by the visible session (even if it's
1237 # a GA::Session->pseudoCmd call)
1238 instructBufferPosn => undef,
1239  
1240 # The world command buffer for the client. Every world command processed by any session
1241 # is assigned its own GA::Buffer::Cmd object in that session's registry, as well as a
1242 # separate GA::Buffer:Cmd object in this registry
1243 # If the user types 'north;kill troll;eat corpse', three world commands are processed
1244 # and three GA::Buffer:Cmd objects are added
1245 # When the buffer is full, adding an instruction to the buffer also deletes the oldest
1246 # existing one
1247 # Hash in the form
1248 # $cmdBufferHash{number} = blessed_reference_to_buffer_object
1249 cmdBufferHash => {},
1250 # How many world commands have been processed altogether (used to give every
1251 # GA::Buffer::Cmd object a unique number)
1252 cmdBufferCount => 0,
1253 # The ->number of the earliest surviving GA::Buffer::Cmd object in the buffer,
1254 # deleted when the buffer is full and a new object is added
1255 cmdBufferFirst => undef,
1256 # The ->number of the most recently-created GA::Buffer::Cmd object in the buffer
1257 # (when set, always one less than $self->cmdBufferCount)
1258 cmdBufferLast => undef,
1259 # When the user navigates through world commands in an 'internal' window's command entry
1260 # box by pressing the up/down arrow keys, the number of the buffer object whose
1261 # world command is currently used (matches a key in ->cmdBufferHash)
1262 # Set on the first such key press in the window. Reset back to 'undef' when the current
1263 # session changes or an instruction is processed by the visible session (even if it's
1264 # a GA::Session->pseudoCmd call)
1265 cmdBufferPosn => undef,
1266  
1267 # Profiles
1268 # --------
1269  
1270 # 'Profiles' are Perl objects describing the properties of things like worlds, guilds,
1271 # races and characters. All profiles are associated with a particular world. For every
1272 # single world profile, there can be any number of associated guild, race and
1273 # character profiles. The profiles for each world have a unique name, so you can't
1274 # have a character and a race profile both called 'wolf' (but you can have two
1275 # character profiles, both called 'Gandalf', associated with different worlds)
1276 # Other data can be represented by profiles - for example, it's possible for the user to
1277 # create 'faction', 'gang' or 'house' profiles
1278 # At the start of the session, Axmud loads from file (or creates) all the profiles
1279 # associated with that world. One profile of each category can be marked as 'current'.
1280 # There doesn't have to be a current profile from each category, but there is always a
1281 # current 'world' profile (and usually a current 'character' profile)
1282 # A 'profile template' is a blueprint for a new category of profile. The template can
1283 # spawn copies of itself which are profiles in their own right
1284 #
1285 # Profiles serve two purposes. Firstly, they allow us to store data about the world,
1286 # secondly, they allow us to attach Axmud interfaces to a subset of characters on the
1287 # world. (Interfaces are triggers, aliases, macros, timers and hooks)
1288 # In short, when a player logs in to Deathmud with the character Gandalf, Axmud is able
1289 # to activate only the relevant interfaces, disactivating all the others. For example,
1290 # if we have three aliases called 'shopping' (one for wizards, one for warriors and
1291 # one for thieves), only the 'shopping' alias for wizards will be activated
1292 #
1293 # Profiles categories have a priority order, with the highest priority on the left of
1294 # the list. The default priority order is character > race > guild > world
1295 # The priority order can be changed, but with a few restrictions: it must contain at
1296 # least 'world' and 'char', and 'world' always has the lowest priority (is the last
1297 # item on the list)
1298 # If we have two aliases called 'shopping', one for Gandalf only and one for wizards in
1299 # general, the Gandalf alias is the active one because characters take priority over
1300 # guilds (by default)
1301 #
1302 # Constant registry list of profile priorities (these values never change)
1303 constProfPriorityList => ['char', 'race', 'guild', 'world'],
1304 # Constant registry hash of profile IVs that are used with every category of profile,
1305 # and which therefore can't be changed or removed in profile templates or custom
1306 # profiles
1307 constProfStandardHash => {
1308 name => undef,
1309 category => undef,
1310 parentWorld => undef,
1311 initTaskHash => undef,
1312 initTaskOrderList => undef,
1313 initTaskTotal => undef,
1314 initScriptHash => undef,
1315 initScriptOrderList => undef,
1316 initMission => undef,
1317 initCmdList => undef,
1318 setupCompleteFlag => undef,
1319 notepadList => undef,
1320 privateHash => undef,
1321 # Also, the IVs used by profile templates, but not built-in profiles
1322 constFixedFlag => undef,
1323 # Also, constant IVs specified by $self->constIVHash
1324 _objName => undef,
1325 _objClass => undef,
1326 _parentFile => undef,
1327 _parentWorld => undef,
1328 _privFlag => undef,
1329 },
1330 #
1331 # Registry hash of all world profile objects, in the form
1332 # $worldProfHash{unique_string_name} = blessed_reference_to_profile_object
1333 worldProfHash => {}, # [config] [worldprof]
1334 #
1335 # Axmud comes with some pre-configured world profiles. A constant registry hash of those
1336 # world profiles, and the Axmud version in which they were introduced
1337 # If the user is using a newer version of Axmud, this IV is consulted and any new
1338 # pre-configured worlds are imported into Axmud's data directories
1339 constWorldHash => {
1340 'aardwolf' => '1.0.140', # Aardwolf MUD / aardmud.org 40000
1341 'achaea' => '1.0.050', # Achaea / achaea.com 23
1342 'advun' => '1.1.138', # Adventures Unlimited / tharel.net 5005
1343 'aetolia' => '1.0.376', # Aetolia / aetolia.com 23
1344 'alteraeon' => '1.0.140', # Alter Aeon / alteraeon.com 3000
1345 'anguish' => '1.0.050', # Ancient Anguish / ancient.anguish.org 2222
1346 'aochaos' => '1.1.050', # Age of Chaos / aoc.pandapub.com 4000
1347 'archipelago' => '1.0.140', # Archipelago MUD / the-firebird.net 8000
1348 'arctic' => '1.1.0', # ArcticMud / mud.arctic.org 2700
1349 'ateraan' => '1.1.0', # New Worlds: Ateraan / www.ateraan.com 4002
1350 'avalonmud' => '1.1.050', # Avalon (Germany) / avalon.mud.de 7777
1351 'avalonrpg' => '1.1.0', # Avalon; The Legend Lives / avalon-rpg.com 23
1352 'avatarmud' => '1.1.0', # Avatar MUD / avatar.outland.org 3000
1353 'batmud' => '1.0.140', # BatMUD / batmud.bat.org 23
1354 'bedlam' => '1.0.140', # Bedlam / mud.playbedlam.com 9000
1355 'burningmud' => '1.1.0', # Burning MUD / burningmud.com 4000
1356 'bylins' => '1.1.138', # Bylins MUD / bylins.su 4000
1357 'carrion' => '1.1.050', # Carrion Fields / carrionfields.net 4449
1358 'clessidra' => '1.1.138', # Clessidra MUD / mud.clessidra.it 4000
1359 'clok' => '1.0.275', # CLOK / clok.contrarium.net 4000
1360 'coffeemud' => '1.1.0', # CoffeeMud / coffeemud.net 23
1361 'cryosphere' => '1.0.376', # Cryosphere / cryosphere.org 6666
1362 'cyberassault' => '1.1.050', # CyberASSAULT / cyberassault.org 11111
1363 'darkrealms' => '1.1.0', # Dark Realms: City of Syne / 64.227.89.30 1138
1364 'dartmud' => '1.1.0', # DartMUD / dartmud.com 2525
1365 'dawn' => '1.1.0', # Dawn / dawnmud.com 3000
1366 'discworld' => '1.0.140', # Discworld MUD / discworld.starturtle.net 23
1367 'dragonstone' => '1.1.138', # DragonStone / dragonstone.mudmagic.com 2345
1368 'dsdev' => '1.0.0', # Dead Souls development mud / dead-souls.net 8000
1369 'dslands' => '1.0.0', # Dark and Shattered Lands / dsl-mud.org 4000
1370 'dslocal' => '1.0.0', # Local installation of Dead Souls mudlib
1371 # / localhost 6666
1372 'dsprime' => '1.0.0', # Dead Souls game mud / dead-souls.net 6666
1373 'dswords' => '1.1.270', # Dragon Swords / dragonswordsmud.com 1234
1374 'dunemud' => '1.1.0', # DuneMUD / dunemud.net 6789
1375 'duris' => '1.0.0', # Duris: Land of BloodLust / mud.durismud.com 7777
1376 'edmud' => '1.1.138', # Eternal Darkness / eternaldarkness.net 9700
1377 'elephantmud' => '1.1.0', # Elephant MUD / elephant.org 23
1378 'elysium' => '1.1.050', # Elysium RPG / elysium-rpg.com 7777
1379 'empire' => '1.1.0', # EmpireMUD 2.0 / empiremud.net 4000
1380 'eotl' => '1.1.0', # End of the Line / eotl.org 2010
1381 'fkingdoms' => '1.1.270', # Forgotten Kingdoms / forgottenkingdoms.org 4000
1382 'fourdims' => '1.0.050', # 4Dimensions / 4dimensions.org 6000
1383 'forestsedge' => '1.1.270', # Forest's Edge / mud.theforestsedge.com 4000
1384 'genesis' => '1.0.0', # Genesis / mud.genesismud.org 3011
1385 'greatermud' => '1.1.270', # GreaterMUD / greatermud.com 23
1386 'gwapoc' => '1.3.0', # Godwars: Rebirth of Apocalypse
1387 # / apoc.godwars.net 6660
1388 'hellmoo' => '1.1.050', # HellMOO / hellmoo.org 7777
1389 'hexonyx' => '1.1.138', # HexOnyx / mud.hexonyx.com 7777
1390 'holyquest' => '1.1.0', # HolyQuest / holyquest.org 8080
1391 'iberia' => '1.0.0', # Iberia MUD / iberiamud.com 5900
1392 'icesus' => '1.1.0', # Icesus / naga.icesus.org 4000
1393 'ifmud' => '1.0.275', # ifMUD / ifmud.port4000.com 4000
1394 'imperian' => '1.0.376', # Imperian: Sundered Heavens / imperian.com 23
1395 'islands' => '1.1.0', # Islands / play.islands-game.live 3000
1396 'kallisti' => '1.1.0', # Legends of Kallisti / legendsofkallisti.com 4000
1397 'lambda' => '1.1.0', # LambdaMOO / lambda.moo.mud.org 8888
1398 'legendmud' => '1.0.275', # LegendMUD / mud.legendmud.org 9999
1399 'lostsouls' => '1.1.0', # Lost Souls / lostsouls.org 23
1400 'lowlands' => '1.3.0', # Lowlands / lolamud.net 6969
1401 'luminari' => '1.1.0', # Luminari MUD / luminarimud.com 4100
1402 'lusternia' => '1.0.0', # Lusternia / lusternia.com 23
1403 'magica' => '1.0.140', # Materia Magica / materiamagica.com 4000
1404 'medievia' => '1.1.0', # Medievia / medievia.com 4000
1405 'merentha' => '1.0.050', # Merentha / mud.merentha.com 10000
1406 'midnightsun' => '1.1.270', # Midnight Sun / midnightsun2.org 3000
1407 'miriani' => '1.1.050', # Miriani / toastsoft.net 1234
1408 'morgengrauen' => '1.1.0', # MorgenGrauen / mg.mud.de 23
1409 'mud1' => '1.1.0', # MUD1 (British Legends)
1410 # / british-legends.com 27750
1411 'mud2' => '1.1.0', # MUD2 (Canadian server) / mud2.com 23
1412 'mudii' => '1.1.0', # MUD2 (UK server) / mud2.com 23
1413 'mume' => '1.1.050', # MUME / mume.org 23
1414 'nannymud' => '1.1.270', # NannyMUD / mud.lysator.liu.se 2000
1415 'nanvaent' => '1.0.0', # Nanvaent / nanvaent.org 23
1416 'nodeka' => '1.0.275', # Nodeka / nodeka.com 23
1417 'nuclearwar' => '1.0.140', # Nuclear War / nuclearwarmudusa.com 4000
1418 'penultimate' => '1.1.0', # Penultimate Destination
1419 # / penultimatemush.com 9500
1420 'pict' => '1.0.140', # Pict MUD / 136.62.89.155 4200
1421 'ravenmud' => '1.1.138', # RavenMUD / ravenmud.com 6060
1422 'realmsmud' => '1.1.138', # RealmsMUD / realmsmud.org 1501
1423 'reinos' => '1.1.0', # Reinos de Leyenda / rlmud.org 5001
1424 'retromud' => '1.1.0', # RetroMUD / retromud.org 3000
1425 'rodespair' => '1.1.0', # Realms of Despair / realmsofdespair.com 23
1426 'roninmud' => '1.1.050', # RoninMUD / game.roninmud.org 5000
1427 'rowonder' => '1.3.0', # Realms of Wonder / mud.killerpcs.com 8888
1428 'rupert' => '1.0.275', # Rupert / rupert.twyst.org 9040
1429 'slothmud' => '1.0.140', # SlothMUD III / slothmud.org 6101
1430 'stickmud' => '1.1.270', # StickMUD / stickmud.com 7680
1431 'stonia' => '1.0.376', # Stonia / stonia.ttu.ee 4000
1432 'swmud' => '1.1.0', # Star Wars Mud / swmud.org 6666
1433 'tempora' => '1.0.0', # Tempora Heroica / login1.ibiblio.org 2895
1434 'theland' => '1.1.270', # The Land / theland.notroot.com 5000
1435 'threekingdoms' => '1.1.0', # 3Kingdoms / 3k.org 3000
1436 'threescapes' => '1.1.0', # 3Scapes / 3scapes.org 3200
1437 'tilegacy' => '1.1.270', # The Inquisition: Legacy / ti-legacy.org 5050
1438 'torilmud' => '1.1.0', # TorilMUD / torilmud.org 9999
1439 'tsunami' => '1.1.050', # Tsunami / tsunami.thebigwave.net 23
1440 'twotowers' => '1.1.138', # Two Towers / t2tmud.org 9999
1441 'uossmud' => '1.1.270', # Unofficial SquareSoft MUD
1442 # / uossmud.sandwich.net 9000
1443 'valhalla' => '1.0.0', # Valhalla MUD / valhalla.com 4242
1444 'vikingmud' => '1.0.050', # Viking MUD / connect.vikingmud.org 2001
1445 'waterdeep' => '1.1.138', # Waterdeep / waterdeep.org 4200
1446 'wotmud' => '1.1.0', # The Wheel of Time MUD / game.wotmud.org 2224
1447 'zombiemud' => '1.1.0', # ZombieMUD / zombiemud.org 23
1448 # Pre-configured worlds from earlier releases => '1.1.0', now defunct
1449 # 'midkemia' => '1.0.376', # Midkemia Online / closed 2016
1450 # Worlds ready for the next Axmud release
1451 # ...
1452 },
1453 # Constant registry hash of pre-configured world profiles that must be patched (because
1454 # of serious problems, or because the IP/DNS/port has changed), and the most recent
1455 # Axmud version whose saved data requires the patch
1456 constWorldPatchHash => {
1457 'achaea' => '1.2.041',
1458 'aetolia' => '1.2.041',
1459 'alteraeon' => '1.1.270',
1460 'archipelago' => '1.3.0',
1461 'avalonrpg' => '1.1.012',
1462 'darkrealms' => '1.3.0',
1463 'dawn' => '1.3.0',
1464 'discworld' => '1.1.343',
1465 'dsdev' => '1.1.270',
1466 'dslocal' => '1.1.270',
1467 'dsprime' => '1.1.270',
1468 'dunemud' => '1.2.0',
1469 'edmud' => '1.3.0',
1470 'fkingdoms' => '1.3.0',
1471 'forestsedge' => '1.3.0',
1472 'imperian' => '1.2.041',
1473 'icesus' => '1.3.0',
1474 'islands' => '1.2.0',
1475 'kallisti' => '1.2.041',
1476 'luminari' => '1.1.270',
1477 'lusternia' => '1.2.041',
1478 'mud1' => '1.1.270',
1479 'mud2' => '1.1.270',
1480 'mudii' => '1.1.270',
1481 'nanvaent' => '1.1.405',
1482 'pict' => '1.1.174',
1483 'swmud' => '1.1.012',
1484 'threekingdoms' => '1.1.270',
1485 'threescapes' => '1.1.270',
1486 'twotowers' => '1.2.0',
1487 },
1488 # Constant registry list of pre-configured world profiles; all the keys in
1489 # $self->constWorldList, sorted alphabetically
1490 constWorldList => [], # Set below
1491 # The Axmud version found the last time the user ran Axmud. If the user is now using a
1492 # newer version of Axmud, the code uses this IV to decide which new pre-configured
1493 # worlds to insert into Axmud's data directory
1494 # The literal value stored below is the version number of Axmud's first public release.
1495 # This IV was introduced in v1.1.021
1496 prevClientVersion => '1.0.0', # [config]
1497 # List of the user's 'favourite' worlds, which appear at the top of the Connections
1498 # window's list (in the same order they appear here)
1499 favouriteWorldList => [], # [config]
1500 # List of worlds to which Axmud should auto-connect when it starts (unless @ARGV is set,
1501 # meaning the user started Axmud by typing something like 'axmud.pl deathmud 5555'
1502 # Each item in the list should be a string containing one or more words, separated by
1503 # any amount of whitespace. The first (compulsory) word is the world profile name;
1504 # any subsequent words are character profile names. If multiple character profiles are
1505 # specified, Axmud opens a session for all of them. If none are specified, Axmud opens
1506 # a connection without setting a current character
1507 # The list is processed in order. A world can appear multiple times in the list. When
1508 # Axmud starts, if the world profile or a character profile doesn't exist, no
1509 # attemption is connected. Axmud will connect to the same world several times, where
1510 # no character profile exists, but it won't try to connect using the same profile
1511 # twice
1512 # Note that, in Axmud blind mode ($BLIND_MODE_FLAG = TRUE), only one session can be
1513 # opened. Any further items in this list after the first connection are ignored
1514 # Examples items in the list:
1515 # 'deathmud'
1516 # 'deathmud gandalf'
1517 # 'deathmud gandalf bilbo'
1518 autoConnectList => [], # [config]
1519 # As well as the pre-configured worlds, Axmud uses a much larger list of worlds from
1520 # which the user can choose in the Connections window. Basic details for each world
1521 # are stored in a GA::Obj::BasicWorld object
1522 # Registry hash in the form
1523 # $constBasicWorldHash{'name'} = blessed_reference_to_basic_world_object
1524 # ...where 'name' is the string used as the world profile name, if the user connects
1525 # to this world
1526 constBasicWorldHash => {}, # Set by $self->loadBasicWorlds
1527  
1528 # World models
1529 # ------------
1530  
1531 # Constant registry list of room filters in a standard order
1532 constRoomFilterList => [
1533 'markers',
1534 'custom',
1535 'navigation',
1536 'commercial',
1537 'buildings',
1538 'structures',
1539 'terrain',
1540 'objects',
1541 'light',
1542 'guilds',
1543 'quests',
1544 'attacks',
1545 ],
1546 # Parallel list of room filters with keyboard shortcuts, for use in the automapper
1547 # window menu ('R' is not available, and items must be in the same order as the list
1548 # above)
1549 constRoomFilterKeyList => [
1550 '_markers',
1551 '_custom',
1552 '_navigation',
1553 'c_ommercial',
1554 '_buildings',
1555 '_structures',
1556 '_terrain',
1557 'ob_jects',
1558 'l_ight',
1559 '_guilds',
1560 '_quests',
1561 '_attacks',
1562 ],
1563 # Constant registry list of values used to initialise room flags in world models
1564 constRoomFlagList => [
1565 # Markers
1566 # -------
1567 # blocked_room - Set if this room shouldn't be available to pathfinding functions
1568 # (or similar code)
1569 'blocked_room' , 'Bl', 'markers',
1570 '#A6483C', # Dark red
1571 'Room is blocked',
1572 # interesting - Set if this room is marked as interesting
1573 'interesting', 'In', 'markers',
1574 '#EC7171', # Pink
1575 'Room is interesting',
1576 # investigate - Set if this room is marked as worth coming back later to investigate
1577 'investigate', 'Iv', 'markers',
1578 '#F37E1B', # Orange
1579 'Room worth investigating',
1580 # unexplored - Set if this room hasn't been visited yet
1581 'unexplored', 'Ux', 'markers',
1582 '#AE5463', # Dull dark red
1583 'Room not visited yet',
1584 # unspecified - Set if this room has an 'unspecified' room statement
1585 'unspecified', 'Un', 'markers',
1586 '#84885C', # Very pale green
1587 'Unspecified room statement',
1588 # avoid_room - Set if this room is marked as worth avoiding
1589 'avoid_room' , 'Av', 'markers',
1590 '#E15835', # Orange-red
1591 'Room worth avoiding',
1592 # mortal_danger - Set if entering this room will probably get the character killed
1593 'mortal_danger', 'Md', 'markers',
1594 '#FF0000', # Default red
1595 'Room is extremely dangerous',
1596 # danger - Set if entering this room is dangerous
1597 'danger', 'Dg', 'markers',
1598 '#A12C1C', # Dark red
1599 'Room is dangerous',
1600 # dummy_room - Set if this room is not actually accessible
1601 'dummy_room', 'Dr', 'markers',
1602 '#A4A4A4', # Grey
1603 'Inaccessible (dummy) room',
1604 # rent_room - Set if this room is where the character can rent (store stuff)
1605 'rent_room', 'Rt', 'markers',
1606 '#CACA84', # Pale brown/yellow
1607 'Room for renting',
1608 # camp_room - Set if this room is where the character can camp
1609 'camp_room', 'Cm', 'markers',
1610 '#909044', # Darker brown/yellow
1611 'Room for camping',
1612 # stash_room - Set if this room is where you like to leave things temporarily
1613 'stash_room', 'St', 'markers',
1614 '#C1722B', # Dirty orange
1615 'Room for stashing things',
1616 # hide_room - Set if this room is where you like to hide
1617 'hide_room', 'Hd', 'markers',
1618 '#AE8B6A', # Grey-brown
1619 'Room for hiding',
1620 # random_room - Set if this room was randomly generated (by the world)
1621 'random_room', 'Rn', 'markers',
1622 '#A7B455', # Yellow-green
1623 'Randomly-generated room',
1624 # immortal_room - Set if this room is only accessible to admin users
1625 'immortal_room', 'Im', 'markers',
1626 '#FF2161', # Red-purple
1627 'Room not accessible to mortals',
1628  
1629 # Custom
1630 # ------
1631 # (all room flags added by the user are in this filter)
1632  
1633 # Navigation
1634 # ----------
1635 # world_centre - Set if this room has been designated the centre of the world
1636 'world_centre', 'Mc', 'navigation',
1637 '#FB922C', # Orange
1638 'Room is centre of world',
1639 # world_start - Set if this room is the room where new players start
1640 'world_start', 'Ms', 'navigation',
1641 '#57FF6A', # Lilac green
1642 'Start room for new players',
1643 # meet_point - Set if this room has been designated as a meeting point (usually a
1644 # room in the world at the centre of a town, near shops)
1645 'meet_point', 'Mp', 'navigation',
1646 '#D77EC7', # Light purple
1647 'Room is a meetpoint',
1648 # main_route - Set if this is a main route
1649 'main_route', 'Mr', 'navigation',
1650 '#A0959F', # Dark grey
1651 'Room is on a main route',
1652 # minor_route - Set if this is a minor route
1653 'minor_route', 'mr', 'navigation',
1654 '#CDC4CD', # Light grey
1655 'Room is on a minor route',
1656 # cross_route - Set if this is where two or more routes meet
1657 'cross_route', 'Cr', 'navigation',
1658 '#F0B68F', # Light orange
1659 'Room is at an intersection',
1660 # arrow_route - Set if this room leads in the right direction
1661 'arrow_route', 'Aw', 'navigation',
1662 '#ECD24E', # Gold
1663 'Room leads in right direction',
1664 # wrong_route - Set if this room leads in the wrong direction
1665 'wrong_route', 'Br', 'navigation',
1666 '#A55B2A', # Brown
1667 'Room leads in wrong direction',
1668 # portal - Set if this room contains some kind of portal
1669 'portal', 'Pl', 'navigation',
1670 '#88FFE7', # Bright cyan
1671 'Room contains some kind of portal',
1672 # sign_post - Set if this room contains a signpost
1673 'sign_post', 'Sp', 'navigation',
1674 '#B58870', # Pale brown
1675 'Room contains a signpost',
1676 # bus_stop - Set if this room is a stop along a moving vehicle's route
1677 'bus_stop', 'Bs', 'navigation',
1678 '#6F6F6F', # Darker grey
1679 'Room has a bus stop',
1680 # moving_boat - Set if this room is on a (moving) boat
1681 'moving_boat', 'Bt', 'navigation',
1682 '#3CD1C8', # Cyan
1683 'Room is a (moving) boat',
1684 # vehicle - Set if this room is on a (moving) vehicle
1685 'vehicle', 'Vh', 'navigation',
1686 '#869D9B', # Grey-cyan
1687 'Room is a (moving) vehicle',
1688 # fixed_boat - Set if this room is on a (stationary) boat
1689 'fixed_boat', 'Fb', 'navigation',
1690 '#237974', # Darkish blue
1691 'Room is on a (stationary) boat',
1692 # swim_room - Set if this room is in water, so the character needs to swim
1693 'swim_room', 'Sw', 'navigation',
1694 '#2656C6', # Blue
1695 'Character needs to swim here',
1696 # fly_room - Set if this room is in the air, so the character needs to fly
1697 'fly_room', 'Fl', 'navigation',
1698 '3A79F7', # Sky blue
1699 'Character needs to fly here',
1700  
1701 # Commercial
1702 # ----------
1703 # shop_general - Set if this room is a general store
1704 'shop_general', 'Sh', 'commercial',
1705 '#F7FF65', # Light yellow
1706 'Room is a general store',
1707 # shop_weapon - Set if this room is a weapon shop
1708 'shop_weapon', 'Ws', 'commercial',
1709 '#F97F20', # Orange
1710 'Room is a weapon shop',
1711 # shop_armour - Set if this room is an armour shop
1712 'shop_armour', 'Wa', 'commercial',
1713 '#DA440C', # Slightly darker orange
1714 'Room is an armour shop',
1715 # shop_clothes - Set if this room is a clothes shop
1716 'shop_clothes', 'Wc', 'commercial',
1717 '#DAA10C', # Yellow-gold
1718 'Room is a clothes shop',
1719 # shop_player - Set if this room is a player-controlled shop
1720 'shop_player', 'Sy', 'commercial',
1721 '#FFA966', # Light orange
1722 'Room is a player-controlled shop',
1723 # shop_special - Set if this room is some other kind of shop
1724 'shop_special', 'Ss', 'commercial',
1725 '#3AFF34', # Green
1726 'Room is another kind of shop',
1727 # shop_empty - Set if this room is an empty shop
1728 'shop_empty', 'Se', 'commercial',
1729 '#8DFF89', # Pale greeen
1730 'Room is an empty shop',
1731 # smithy - Set if this room is a smithy
1732 'smithy', 'Sm', 'commercial',
1733 '#D58111', # Light brown
1734 'Room is a smithy',
1735 # bank - Set if this room is a bank
1736 'bank', 'Bn', 'commercial',
1737 '#8E0E3F', # Purple
1738 'Room is a bank',
1739 # pub - Set if this room is some kind of pub
1740 'pub', 'Pb', 'commercial',
1741 '#1730F5', # Blue
1742 'Room is a pub',
1743 # cafe - Set if this room is some kind of cafeteria (like a pub, but with non-
1744 # alcoholic drinks)
1745 'cafe', 'Cf', 'commercial',
1746 '#3196CA', # Dark cyan
1747 'Room is a cafeteria',
1748 # restaurant - Set if this room is some kind of restaurant (where the character can
1749 # eat)
1750 'restaurant', 'Re', 'commercial',
1751 '#487F9B', # Murky blue
1752 'Room is a restaurant',
1753 # takeaway - Set if this room is some kind of takeaway (where the character can
1754 # buy food to carry)
1755 'takeaway', 'Ta', 'commercial',
1756 '#A9C1F4', # Very light blue
1757 'Room is a takeaway',
1758 # auction - Set if this room is an auction house
1759 'auction', 'Au', 'commercial',
1760 '#CA1E4D', # Red
1761 'Room is an auction house',
1762 # post_office - Set if this room is a post office
1763 'post_office', 'Po', 'commercial',
1764 '#8CB583', # Dull green
1765 'Room is a post office',
1766  
1767 # Buildings
1768 # ---------
1769 # library - Set if this room is where books, parchments, signs, notice boards and so
1770 # on are available
1771 'library', 'Lb', 'buildings',
1772 '#DEF3CC', # Very pale green
1773 'Room is a library',
1774 # theatre - Set if this room is a theatre or performance venue
1775 'theatre', 'Th', 'buildings',
1776 '#2DD06C', # Turquoise
1777 'Room is a theatre',
1778 # temple - Set if this room is some kind of temple or shrine
1779 'temple', 'Te', 'buildings',
1780 '#7C6365', # Very dull red
1781 'Room is a temple',
1782 # church - Set if this room is a church or cathedral
1783 'church', 'Ch', 'buildings',
1784 '#C17D80', # Pale red
1785 'Room is a church/cathedral',
1786 # hotel - Set if this room is a hotel
1787 'hotel', 'Hl', 'buildings',
1788 '#B0B167', # Dull yellow
1789 'Room is a hotel',
1790 # storage - Set if this room is somewhere you can store things
1791 'storage', 'St', 'buildings',
1792 '#996712', # Green-brown
1793 'Room is a storage facility',
1794 # office - Set if this room is an office
1795 'office', 'Of', 'buildings',
1796 '#A36C6C', # Dull red
1797 'Room is an office',
1798 # jail - Set if this room is a jail or dungeon
1799 'jail', 'Jl', 'buildings',
1800 '#C46F47', # Pale brown
1801 'Room is a jail or dungeon',
1802 # hospital - Set if this room is some kind of hospital
1803 'hospital', 'Ho', 'buildings',
1804 '#ED0C60', # Red-purple
1805 'Room is a hospital',
1806 # stable - Set if this room is a room where animals are stored
1807 'stable', 'St', 'buildings',
1808 '#DF9F4B', # Straw orange
1809 'Room is a stable for animals',
1810 # tent - Set if this room is inside a tent
1811 'tent', 'Tt', 'buildings',
1812 '#D2B380', # Canvas
1813 'Room is a tent',
1814 # house - Set if this room is an ordinary house or home
1815 'house', 'Hs', 'buildings',
1816 '#3B7E55', # Dark green
1817 'Room is a house or home',
1818 # ord_building - Set if this room is an ordinary building
1819 'ord_building', 'Ob', 'buildings',
1820 '#82E1CA', # Light cyan
1821 'Room is an ordinary building',
1822 # bulletin_board - Set if this room contains some kind of bulletin board
1823 'bulletin_board', 'Bb', 'buildings',
1824 '#A47AB8', # Light purple
1825 'Room contains a bulletin board',
1826  
1827 # Structures
1828 # ----------
1829 # building - Set if this is any kind of building
1830 'building', 'Bu', 'structures',
1831 '#B7764F', # Pale brown
1832 'Room is any kind of building',
1833 # gate - Set if this is at (or outside) a city gate
1834 'gate', 'Ga', 'structures',
1835 '#87BDC6', # Pale blue
1836 'Room is at a city gate',
1837 # wall - Set if this is on (or alongside) a city wall
1838 'wall', 'Wl', 'structures',
1839 '#C9D3D5', # Blue-grey
1840 'Room is on/outside a city wall',
1841 # tower - Set if this is on (or inside) a tower
1842 'tower', 'Tw', 'structures',
1843 '#B1A27F', # Dull yellow
1844 'Room is on/inside a tower',
1845 # staircase - Set if this is on a staircase
1846 'staircase', 'Sc', 'structures',
1847 '#FFB47C', # Sandy yellow
1848 'Room is on a staircase',
1849 # tunnel - Set if this is in a tunnel
1850 'tunnel', 'Tu', 'structures',
1851 '#C4897D', # Dull pink
1852 'Room is in a tunnel',
1853 # bridge - Set if this is a on a bridge
1854 'bridge', 'Br', 'structures',
1855 '#A9631F', # Brown
1856 'Room is on a bridge',
1857 # fountain - Set if this room has a fountain
1858 'fountain', 'Fn', 'structures',
1859 '#35BDD8', # Bright blue
1860 'Room contains a fountain',
1861 # well - Set if this is a well or water source
1862 'well', 'We', 'structures',
1863 '#76A1D3', # Light blue
1864 'Room is a well',
1865 # farm - Set if this is a farm
1866 'farm', 'Fa', 'structures',
1867 '#A84100', # Brown
1868 'Room is on a farm',
1869 # field - Set if this is a field
1870 'field', 'Fi', 'structures',
1871 '#75B256', # Paler green
1872 'Room is in a field',
1873 # park - Set if this is a park/garden
1874 'park', 'Pa', 'structures',
1875 '#00FF00', # (Pure) green
1876 'Room is in a garden/park',
1877 # graveyard - Set if this is a graveyard
1878 'graveyard', 'Gy', 'structures',
1879 '#CBA5AE', # Dull pink
1880 'Room is in a graveyard',
1881 # port - Set if this is a port/harbour/jetty
1882 'port', 'Pt', 'structures',
1883 '#117311', # Bottle green
1884 'Room is in a port/harbour/jetty',
1885 # maze - Set if this is a maze
1886 'maze', 'Mz', 'structures',
1887 '#D30027', # Headache red
1888 'Room is in a maze',
1889  
1890 # Terrain
1891 # -------
1892 # forest - Set if this is a forest/wood
1893 'forest', 'Fo', 'terrain',
1894 '#227122', # Dark green
1895 'Room is in a forest/wood',
1896 # clearing - Set if this is a clearing
1897 'clearing', 'Cl', 'terrain',
1898 '#68E568', # Pale green
1899 'Room is a clearing',
1900 # grassland - Set if this is a grassland/plain
1901 'grassland', 'Gl', 'terrain',
1902 '#BFED57', # Yellow-green
1903 'Room is in a grassland/plain',
1904 # swamp - Set if this is a swamp/marsh
1905 'swamp', 'Sw', 'terrain',
1906 '#6F9956', # Dirty green
1907 'Room is in a swamp/marsh',
1908 # desert - Set if this is a desert
1909 'desert', 'De', 'terrain',
1910 '#F5F72B', # Yellow
1911 'Room is in a desert',
1912 # beach - Set if this is a beach/coast
1913 'beach', 'Be', 'terrain',
1914 '#F7922B', # Red-orange
1915 'Room is on a beach/coastline',
1916 # river - Set if this is a river/stream
1917 'river', 'Rv', 'terrain',
1918 '#61C3EB', # Light blue
1919 'Room is in a river/stream',
1920 # lake - Set if this is a lake
1921 'lake', 'Lk', 'terrain',
1922 '#A9E6FF', # Very light blue
1923 'Room is in a lake',
1924 # sea - Set if this is a sea/ocean
1925 'sea', 'Se', 'terrain',
1926 '#216D8C', # Darker blue
1927 'Room is in a sea/ocean',
1928 # cave - Set if this is a cave
1929 'cave', 'Cv', 'terrain',
1930 '#849DAD', # Grey-blue
1931 'Room is in a cave',
1932 # mountain - Set if this is a mountainous area
1933 'mountain', 'Mn', 'terrain',
1934 '#CDDDE7', # Blue-white
1935 'Room is in a mountainous area',
1936 # rocky - Set if this is rocky landscape
1937 'rocky', 'Rc', 'terrain',
1938 '#C5AC95', # Brown-grey
1939 'Room is in a rocky landscape',
1940 # icy - Set if this is icy landscape
1941 'icy', 'Ic', 'terrain',
1942 '#96BFC3', # Very pale blue
1943 'Room is in an icy landscape',
1944 # hill - Set if this is a hill
1945 'hill', 'Hi', 'terrain',
1946 '#7ADA97', # Light green
1947 'Room is on a hill',
1948 # pit - Set if this is next to (or inside) a pit or hole
1949 'pit', 'Pi', 'terrain',
1950 '#A7B179', # Dull yellow-green
1951 'Room is in a pit or contains one',
1952  
1953 # Objects
1954 # -------
1955 # weapon - Set if the room contains a weapon
1956 'weapon', 'Wp', 'objects',
1957 '#A87389', # Pale purple
1958 'Room contains a weapon',
1959 # armour - Set if the room contains an armour
1960 'armour', 'Ar', 'objects',
1961 '#82405C', # Dark pale purple
1962 'Room contains an armour',
1963 # garment - Set if the room contains a garment
1964 'garment', 'Gr', 'objects',
1965 '#FF74AE', # Purple-pink
1966 'Room contains a garment',
1967 # major_npc - Set if the room contains an important NPC
1968 'major_npc', 'Np', 'objects',
1969 '#3BCC2F', # Green
1970 'Room contains an important NPC',
1971 # talk_npc - Set if the room contains a talking NPC
1972 'talk_npc', 'Tn', 'objects',
1973 '#086800', # Dark green
1974 'Room contains a talking NPC',
1975 # npc - Set if the room contains any NPC
1976 'npc', 'Np', 'objects',
1977 '#7FEE75', # Light green
1978 'Room contains an NPC',
1979 # portable - Set if the room contains a portable object
1980 'portable', 'Pr', 'objects',
1981 '#262FD8', # Dark blue
1982 'Room contains a portable object',
1983 # decoration - Set if the room contains a decoration object
1984 'decoration', 'Dc', 'objects',
1985 '#10EBA1', # Light cyan
1986 'Room contains a decoration object',
1987 # money - Set if the room contains money
1988 'money', 'My', 'objects',
1989 '#FFE63B', # Gold
1990 'Room contains money',
1991 # treasure - Set if the room contains a valuable object
1992 'treasure', 'Tr', 'objects',
1993 '#FF673B', # Red-orange
1994 'Room treasure or valuable objects',
1995 # collectable - Set if the room contains a collectable object
1996 'collectable', 'Cl', 'objects',
1997 '#FF9900', # Orange
1998 'Room contains collectable objects',
1999  
2000 # Light
2001 # -----
2002 # outside - Set if this room is outside
2003 'outside', 'Ou', 'light',
2004 '#77C4E4', # Sky blue
2005 'Room is outside',
2006 # inside - Set if this room is inside
2007 'inside', 'In', 'light',
2008 '#D38D36', # Light brown
2009 'Room is inside',
2010 # overground - Set if this room is above ground
2011 'overground', 'Ov', 'light',
2012 '#36D355', # Green
2013 'Room is above ground',
2014 # underground - Set if this room is underground
2015 'underground', 'Un', 'light',
2016 '#CDCDCD', # Grey
2017 'Room is underground',
2018 # torch - Set if average player needs a torch in this room
2019 'torch', 'To', 'light',
2020 '#E1D139', # Yellow
2021 'Room usually needs a torch',
2022 # always_dark - Set if this room is always dark
2023 'always_dark', 'Ad', 'light',
2024 '#977E6A', # Pale brown
2025 'Room is always dark',
2026  
2027 # Guilds
2028 # ------
2029 # guild_entrance - Set if this room is an entrance to a guild (possibly guarded)
2030 'guild_entrance', 'Ge', 'guilds',
2031 '#8F2AF9', # Purple-blue
2032 'Entrance to a guild',
2033 # guild_main - Set if this is a room inside the guild where a character can advance
2034 # skills and/or join the guild
2035 'guild_main', 'Gm', 'guilds',
2036 '#DAA0FB', # Light purple
2037 'Guild room for advancing skills',
2038 # guild_practice - Set if this room is where a character can practice guild skills
2039 'guild_practice', 'Gp', 'guilds',
2040 '#DB0C89', # Red-purple
2041 'Guild room for practicing skills',
2042 # guild_shop - Set if this is a room inside the guild where a character can buy
2043 # guild-specific items
2044 'guild_shop', 'Gs', 'guilds',
2045 '#CE4DF7', # Purple
2046 'Guild room for shopping',
2047 # guild_other - Set if this is a room inside the guild where a character can't
2048 # advance skills or buy guild-specific items
2049 'guild_other', 'Go', 'guilds',
2050 '#89679C', # Grey-purple
2051 'Other kind of guild room',
2052  
2053 # Quests
2054 # ------
2055 # quest_room - Set if this room is important in a quest
2056 'quest_room' , 'Qr', 'quests',
2057 '#F4E637', # Yellow
2058 'Room used in quest',
2059 # quest_begin - Set if this room is the start of a quest
2060 'quest_begin', 'Qb', 'quests',
2061 '#58FF57', # Green
2062 'Quest begins in room',
2063 # quest_end - Set if this room is the end of a quest
2064 'quest_end', 'Qe', 'quests',
2065 '#FF6957', # Red
2066 'Quest ends in room',
2067  
2068 # Attacks
2069 # -------
2070 # peaceful - Set if the world doesn't allow fights in this room
2071 'peaceful', 'Pf', 'attacks',
2072 '#9CE3DD', # Light cyan
2073 'World forbids attacks in room',
2074 # recovery - Set if this room lets the character recover from fights more quickly
2075 'recovery', 'Ry', 'attacks',
2076 '#E9DC3D', # Yellow
2077 'Character recovers quickly in room',
2078 # char_dead - Set if any character has ever died in this room
2079 'char_dead', 'Cd', 'attacks',
2080 '#FF361E', # Red
2081 'Any character has died in room',
2082 # char_pass_out - Set if any character has ever been knocked out in this room
2083 'char_pass_out', 'Cp', 'attacks',
2084 '#ED22BE', # Purple
2085 'Any character has passed out in room',
2086 ],
2087 # Constant registry hash of room flags which mark the room as hazardous; the pathfinding
2088 # functions (or any other code) can avoid these rooms when finding the shortest path
2089 # between two rooms
2090 constRoomHazardHash => {
2091 'blocked_room' => undef,
2092 'avoid_room' => undef,
2093 'danger', => undef,
2094 'mortal_danger' => undef,
2095 'dummy_room' => undef,
2096 },
2097 # Constant registry hash of room flags for which exits should be drawn, when
2098 # GA::Obj::WorldModel->obscuredExitFlag is TRUE
2099 constRoomNoObscuredHash => {
2100 'blocked_room' => undef,
2101 'avoid_room' => undef,
2102 'mortal_danger' => undef,
2103 'danger' => undef,
2104 'world_centre' => undef,
2105 'world_start' => undef,
2106 'meet_point' => undef,
2107 'main_route' => undef,
2108 'minor_route' => undef,
2109 'cross_route' => undef,
2110 'arrow_route' => undef,
2111 'wrong_route' => undef,
2112 'portal' => undef,
2113 'sign_post' => undef,
2114 },
2115  
2116 # Constant hash of valid model object types (all of which inherit from
2117 # GA::Generic::ModelObj; the type matches the object's ->category IV). Hash in the
2118 # form
2119 # $constModelTypeHash{type} = undef;
2120 constModelTypeHash => {
2121 'region' => undef,
2122 'room' => undef,
2123 'weapon' => undef,
2124 'armour' => undef,
2125 'garment' => undef,
2126 'char' => undef,
2127 'minion' => undef,
2128 'sentient' => undef,
2129 'creature' => undef,
2130 'portable' => undef,
2131 'decoration' => undef,
2132 'custom' => undef,
2133 },
2134 # Constant list of standard primary directions, in a fixed order
2135 constPrimaryDirList => [
2136 'north',
2137 'northnortheast',
2138 'northeast',
2139 'eastnortheast',
2140 'east',
2141 'eastsoutheast',
2142 'southeast',
2143 'southsoutheast',
2144 'south',
2145 'southsouthwest',
2146 'southwest',
2147 'westsouthwest',
2148 'west',
2149 'westnorthwest',
2150 'northwest',
2151 'northnorthwest',
2152 'up',
2153 'down',
2154 ],
2155 # Constant list of standard primary directions, but with the secondary-intercardinal
2156 # directions removed
2157 constShortPrimaryDirList => [
2158 'north',
2159 'northeast',
2160 'east',
2161 'southeast',
2162 'south',
2163 'southwest',
2164 'west',
2165 'northwest',
2166 'up',
2167 'down',
2168 ],
2169 # Constant hash of standard primary directions, but with the secondary-intercardinal
2170 # directions removed
2171 constShortPrimaryDirHash => {
2172 'north' => undef,
2173 'northeast' => undef,
2174 'east' => undef,
2175 'southeast' => undef,
2176 'south' => undef,
2177 'southwest' => undef,
2178 'west' => undef,
2179 'northwest' => undef,
2180 'up' => undef,
2181 'down' => undef,
2182 },
2183 # Constant hash of standard primary directions and their opposites (used mostly by the
2184 # automapper functions). Hash in the form
2185 # $constOppDirHash{standard_direction} = opposite_standard_direction
2186 constOppDirHash => {
2187 'north' => 'south',
2188 'northnortheast' => 'southsouthwest',
2189 'northeast' => 'southwest',
2190 'eastnortheast' => 'westsouthwest',
2191 'east' => 'west',
2192 'eastsoutheast' => 'westnorthwest',
2193 'southeast' => 'northwest',
2194 'southsoutheast' => 'northnorthwest',
2195 'south' => 'north',
2196 'southsouthwest' => 'northnortheast',
2197 'southwest' => 'northeast',
2198 'westsouthwest' => 'eastnortheast',
2199 'west' => 'east',
2200 'westnorthwest' => 'eastsoutheast',
2201 'northwest' => 'southeast',
2202 'northnorthwest' => 'southsoutheast',
2203 'up' => 'down',
2204 'down' => 'up',
2205 },
2206 # Constant registry list of room statement component types (matching
2207 # GA::Obj::Component->type)
2208 constComponentTypeList => [
2209 'anchor',
2210 'verb_title', 'verb_descrip', 'verb_exit', 'verb_content', 'verb_special',
2211 'brief_title', 'brief_exit', 'brief_title_exit', 'brief_exit_title',
2212 'brief_content',
2213 'room_cmd',
2214 'mudlib_path',
2215 'weather',
2216 'ignore_line',
2217 'custom',
2218 ],
2219 # Constant hash of exit states (acceptable values for GA::Obj::Exit->exitState)
2220 # NB This hash doesn't include 'ignore', or any custom strings specified by
2221 # GA::Profile::World->exitStateTagHash
2222 # NB For an explanation of what each value means, see the comments in GA::Obj::Exit->new
2223 constExitStateHash => {
2224 'normal' => undef,
2225 'open' => undef,
2226 'closed' => undef,
2227 'locked' => undef,
2228 'secret' => undef,
2229 'secret_open' => undef,
2230 'secret_closed' => undef,
2231 'secret_locked' => undef,
2232 'impass' => undef,
2233 'dark' => undef,
2234 'danger' => undef,
2235 'emphasis' => undef,
2236 'other' => undef,
2237 # 'ignore' => undef,
2238 },
2239 # Object parsing sanity check (in case someone creates a room containing a billion
2240 # hobbits) - maximum number of world model objects created in response by
2241 # GA::Obj::WorldModel->parseObj()
2242 # (The 999 value communicates to the user that the number has been reduced)
2243 constParseObjMax => 999,
2244  
2245 # Cages
2246 # -----
2247  
2248 # 'Cages' are associated with a 'profile'
2249 # For example, the command cage lists common commands at a particular world (the verbs
2250 # for 'kill', 'look', 'inventory', and so on)
2251 # If the cage is associated with the current world profile, those commands are
2252 # considered to be available to all characters. However, if the cage is associated
2253 # with (for example) a guild profile, those commands are considered to be available
2254 # only to members of that guild
2255 # Parts of Axmud code - most usually, tasks and Axbasic scripts - can choose to have
2256 # their commands modified, or 'interpolated', before being sent to the world. For
2257 # example, if a task wants to send the command 'kill', it looks through the command
2258 # cages for each current profile - starting with the highest-priority profile - and
2259 # uses the first 'kill' command it finds
2260 # Besides the command cage, there are standard cage which store each kind of interface
2261 # (triggers, aliases, macros, timers and hooks). It's also possible for the user to
2262 # design their own cages
2263 #
2264 # Constant registry list of cage types (these values never change)
2265 constCageTypeList => [
2266 'cmd',
2267 'trigger',
2268 'alias',
2269 'macro',
2270 'timer',
2271 'hook',
2272 'route',
2273 ],
2274 # Customisable registry list of cage types (max 8 chars)
2275 cageTypeList => [], # Set below
2276  
2277 # Dictionaries
2278 # ------------
2279  
2280 # Axmud Dictionaries contain lists of words so that Axmud can tell apart directions,
2281 # NPCs, weapons, torches, and so on
2282 # If the dictionary object has the same name as a world, it's automatically associated
2283 # with that world. (Dictionaries don't have to be associated with a particular world,
2284 # but they often are)
2285 # Dictionaries are associated with a particular language. The default language is
2286 # English
2287 #
2288 # Registry hash of dictionary objects that have been loaded since the script started,
2289 # in the form
2290 # $dictHash{unique_dictionary_name} = blessed_reference_to_dictionary_object
2291 dictHash => {}, # [dicts]
2292 # As well as dictionaries, Axmud uses a much smaller collection of data, a phrasebook
2293 # object, containing a list of primary directions, articles, conjunctions and basic
2294 # number words in a target language. The data is stored in a GA::Obj::Phrasebook
2295 # object
2296 # Registry hash in the form
2297 # $constPhrasebookHash{'name'} = blessed_reference_to_phrasebook_object
2298 # ...where 'name' is the the language name, rendered in lower-case English
2299 # (e.g. 'french')
2300 constPhrasebookHash => {},
2301  
2302 # Interfaces
2303 # ----------
2304  
2305 # Interfaces are triggers, aliases, macros, timers and hooks
2306 # Interface model objects store default values for each of these interfaces
2307 # Registry hash of interface model objects, in the form
2308 # $interfaceModelHash{interface_type} = blessed_reference_to_interface_model_object
2309 interfaceModelHash => {},
2310  
2311 # Macros use keycodes - ways of naming keys on the keyboard (F1, Escape, grave etc)
2312 # Axmud uses a standard set of keycodes that don't vary from system to system. For
2313 # example, on Linux the ALT-GR key produces the keycode 'ISO_Level3_Shift', but on
2314 # MS Windows, it produces the keycode 'Alt_R'. Axmud's standard keycode is 'alt_gr'
2315 # Note that there are no Axmud standard keycodes for ordinary letters/numbers; Axmud
2316 # assumes that these are needed for typing, so they're not available to macros
2317 #
2318 # Constant registry hash of Axmud standard keycode values, and their Linux equivalents.
2319 # Hash in the form
2320 # $constKeycodeHash{standard_value} = linux_value_string
2321 # ...where 'standard_value' is a value used by Axmud to uniquely identify a key or
2322 # key combination, and 'linux_value_string' is the corresponding keycode returned by
2323 # Linux (when there is more than one corresponding keycode, they are in a single
2324 # string, separated by a space)
2325 constKeycodeHash => {
2326 shift => 'Shift_L Shift_R',
2327 alt => 'Alt_L',
2328 alt_gr => 'ISO_Level3_Shift',
2329 ctrl => 'Control_L Control_R',
2330 num_lock => 'Num_Lock',
2331  
2332 escape => 'Escape',
2333 pause => 'Pause',
2334 break => 'Break',
2335 insert => 'Insert KP_Insert',
2336 delete => 'Delete KP_Delete',
2337 return => 'Return',
2338 backspace => 'BackSpace',
2339 space => 'space',
2340 tab => 'Tab',
2341  
2342 home => 'Home KP_Home',
2343 page_up => 'Page_Up KP_Page_Up',
2344 page_down => 'Page_Down KP_Page_Down',
2345 end => 'End KP_End',
2346  
2347 up => 'Up KP_Up',
2348 down => 'Down KP_Down',
2349 left => 'Left KP_Left',
2350 right => 'Right KP_Right',
2351  
2352 f1 => 'F1',
2353 f2 => 'F2',
2354 f3 => 'F3',
2355 f4 => 'F4',
2356 f5 => 'F5',
2357 f6 => 'F6',
2358 f7 => 'F7',
2359 f8 => 'F8',
2360 f9 => 'F9',
2361 f10 => 'F10',
2362 f11 => 'F11',
2363 f12 => 'F12',
2364  
2365 grave => 'grave', # `
2366 tilde => 'asciitilde', # ~
2367 exclam => 'exclam', # !
2368 at => 'at', # @
2369 number_sign => 'numbersign', # #
2370 dollar => 'dollar', # $
2371 percent => 'percent', # %
2372 ascii_circum => 'asciicircum', # ^
2373 ampersand => 'ampersand', # &
2374 asterisk => 'asterisk', # *
2375 paren_left => 'parenleft', # (
2376 paren_right => 'parenright', # )
2377  
2378 plus => 'plus', # +
2379 minus => 'minus', # -
2380 equal => 'equal', # =
2381 underline => 'underscore', # _
2382  
2383 bracket_left => 'bracketleft', # [
2384 bracket_right => 'bracketright', # ]
2385 brace_left => 'braceleft', # {
2386 brace_right => 'braceright', # }
2387 colon => 'colon', # :
2388 semicolon => 'semicolon', # ;
2389 apostrophe => 'apostrophe', # '
2390 quote => 'quotedbl', # "
2391 slash => 'slash', # /
2392 backslash => 'backslash', # \
2393 pipe => 'bar', # |
2394 comma => 'comma', # ,
2395 full_stop => 'period', # .
2396 less_than => 'less', # <
2397 greater_than => 'greater', # >
2398 question_mark => 'question', # ?
2399  
2400 # Keypad - NUM LOCK on
2401 kp_0 => 'KP_0',
2402 kp_1 => 'KP_1',
2403 kp_2 => 'KP_2',
2404 kp_3 => 'KP_3',
2405 kp_4 => 'KP_4',
2406 kp_5 => 'KP_5',
2407 kp_6 => 'KP_6',
2408 kp_7 => 'KP_7',
2409 kp_8 => 'KP_8',
2410 kp_9 => 'KP_9',
2411 kp_add => 'KP_Add',
2412 kp_subtract => 'KP_Subtract',
2413 kp_multiply => 'KP_Multiply',
2414 kp_divide => 'KP_Divide',
2415 kp_enter => 'KP_Enter',
2416 kp_full_stop => 'KP_Decimal',
2417 },
2418 # We also use a constant registry hash of Axmud standard keycode values and their
2419 # equivalents in MS Windows and in *BSD. Only keycodes which are different to those
2420 # above are listed
2421 constMSWinKeycodeHash => {
2422 alt_gr => 'Alt_R',
2423 ctrl => 'Control_L',
2424 num_lock => '',
2425 },
2426 constBSDKeycodeHash => {
2427 ctrl => 'Control_L',
2428 num_lock => '',
2429 },
2430 # Custom hash of Axmud standard keycodes and their equivalents on the current system
2431 keycodeHash => {}, # Set by $self->setupKeycodes
2432 # The reverse hash of $self->keycodeHash, which therefore contains more keys, e.g.
2433 # $keycodeHash{'up'} = 'Up KP_Up'
2434 # $revKeycodeHash{'Up'} = 'up'
2435 # $revKeycodeHash{'KP_Up'} = 'up'
2436 revKeycodeHash => {}, # Set by $self->setupKeycodes
2437 # Constant registry hash of alternatives to Axmud standard keycode values. Includes
2438 # variants without capitals (e.g. transforms 'backspace' into 'backSpace') and
2439 # American English variants (e.g. transforms 'period' into 'full_stop')
2440 # Hash in the form
2441 # $constAltKeycodeHash{variant_value} = standard_value
2442 # ...where 'standard_value' matches a key in $self->constKeycodeHash
2443 constAltKeycodeHash => {
2444 altgr => 'alt_gr',
2445 pageup => 'page_up',
2446 pagedown => 'page_down',
2447 numbersign => 'number_sign',
2448 asciicircum => 'ascii_circum',
2449 parenleft => 'paren_left',
2450 parenright => 'paren_right',
2451 bracketleft => 'bracket_left',
2452 bracketright => 'bracket_right',
2453 braceleft => 'brace_left',
2454 braceright => 'brace_right',
2455 bar => 'pipe',
2456 fullstop => 'full_stop',
2457 period => 'full_stop',
2458 lessthan => 'less_than',
2459 less => 'less_than',
2460 greaterthan => 'greater_than',
2461 greater => 'greater_than',
2462 questionmark => 'question_mark',
2463 underscore => 'underline',
2464 },
2465 # Constant list of Axmud standard keycode values in a fixed order, each item a key in
2466 # $self->constKeycodeHash
2467 constKeycodeList => [
2468 'shift', 'alt', 'alt_gr', 'ctrl', 'num_lock',
2469 'escape', 'pause', 'break', 'insert', 'delete', 'return', 'backspace', 'space',
2470 'tab',
2471 'home', 'page_up', 'page_down', 'end',
2472 'up', 'down', 'left', 'right',
2473 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'f10', 'f11', 'f12',
2474 'grave', 'tilde', 'exclam', 'at', 'number_sign', 'dollar', 'percent',
2475 'ascii_circum', 'ampersand', 'asterisk', 'paren_left', 'paren_right',
2476 'plus', 'minus', 'equal', 'underline',
2477 'bracket_left', 'bracket_right', 'brace_left', 'brace_right', 'colon', 'semicolon',
2478 'apostrophe', 'quote', 'slash', 'backslash', 'pipe', 'comma', 'full_stop',
2479 'less_than', 'greater_than', 'question_mark',
2480 'kp_0', 'kp_1', 'kp_2', 'kp_3', 'kp_4', 'kp_5', 'kp_6', 'kp_7', 'kp_8', 'kp_9',
2481 'kp_add', 'kp_subtract', 'kp_multiply', 'kp_divide', 'kp_enter',
2482 'kp_full_stop',
2483 ],
2484 # Registry hash of keycodes that are used by any active macro interface in any session
2485 # (used in addition to the session's own registries, because every time a key is
2486 # pressed, we want to know - as quickly as possible - whether we should check it
2487 # against all interactive macros in all sessions). Hash in the form
2488 # $activeKeycodeHash{standard_keycode} = undef
2489 activeKeycodeHash => {},
2490 # When an active macro interface is deleted, $self->activeKeycodeHash needs to be
2491 # reset. If several hundred interfaces are deleted in one go, it would be a bad idea
2492 # to reset the registry several hundred times. Instead, this flag is set to TRUE.
2493 # Whichever GA::Session is the first to have its timer loop spin, is the one to call
2494 # $self->reset_activeKeycodes, which re-compiles the registry
2495 resetKeycodesFlag => FALSE,
2496  
2497 # Tasks
2498 # -----
2499  
2500 # Axmud keeps two lists of the package names for tasks - one for Axmud's built-in tasks,
2501 # and another for all tasks (built-in tasks and those added via a plugin)
2502 #
2503 # The constant registry hash of package names (these values never change). A hash in the
2504 # form
2505 # $constTaskPackageHash{task_standard_name} = package_name
2506 # e.g. task_standard_name = StatusTask->name,
2507 # package_name = 'Games::Axmud::Task::Status'
2508 constTaskPackageHash => {
2509 'advance_task' => 'Games::Axmud::Task::Advance',
2510 'attack_task' => 'Games::Axmud::Task::Attack',
2511 'channels_task' => 'Games::Axmud::Task::Channels',
2512 'chat_task' => 'Games::Axmud::Task::Chat',
2513 'compass_task' => 'Games::Axmud::Task::Compass',
2514 'condition_task' => 'Games::Axmud::Task::Condition',
2515 'connections_task' => 'Games::Axmud::Task::Connections',
2516 'countdown_task' => 'Games::Axmud::Task::Countdown',
2517 'divert_task' => 'Games::Axmud::Task::Divert',
2518 'frame_task' => 'Games::Axmud::Task::Frame',
2519 'inventory_task' => 'Games::Axmud::Task::Inventory',
2520 'launch_task' => 'Games::Axmud::Task::Launch',
2521 'locator_task' => 'Games::Axmud::Task::Locator',
2522 'map_check_task' => 'Games::Axmud::Task::MapCheck',
2523 'notepad_task' => 'Games::Axmud::Task::Notepad',
2524 'raw_text_task' => 'Games::Axmud::Task::RawText',
2525 'raw_token_task' => 'Games::Axmud::Task::RawToken',
2526 'script_task' => 'Games::Axmud::Task::Script',
2527 'status_task' => 'Games::Axmud::Task::Status',
2528 'system_task' => 'Games::Axmud::Task::System',
2529 'tasklist_task' => 'Games::Axmud::Task::TaskList',
2530 'watch_task' => 'Games::Axmud::Task::Watch',
2531 },
2532 # The customisable registry hash of package names, in the form
2533 # $taskPackageHash{task_standard_name} = package_name
2534 # e.g. task_standard_name = $myTask->name,
2535 # package_name = 'Games::Axmud::Task::MyTask',
2536 taskPackageHash => {}, # Set below
2537 #
2538 # Axmud keeps some shorthand forms ('labels') of the standard/external tasks for the
2539 # user to type - one for standard tasks (e.g. 'tasklist', 'stat') and another for all
2540 # tasks (max length 32 characters)
2541 #
2542 # Constant registry hash of task labels (these values never change). A hash in the form
2543 # $constTaskLabelHash{label} = task_standard_name
2544 constTaskLabelHash => {
2545 'adv' => 'advance_task',
2546 'advance' => 'advance_task',
2547 'att' => 'attack_task',
2548 'attack' => 'attack_task',
2549 'chan' => 'channels_task',
2550 'channel' => 'channels_task',
2551 'channels' => 'channels_task',
2552 'chat' => 'chat_task',
2553 'comp' => 'compass_task',
2554 'compass' => 'compass_task',
2555 'cond' => 'condition_task',
2556 'condition' => 'condition_task',
2557 'conn' => 'connections_task',
2558 'connect' => 'connections_task',
2559 'connections' => 'connections_task',
2560 'cd' => 'countdown_task',
2561 'count' => 'countdown_task',
2562 'countdown' => 'countdown_task',
2563 'div' => 'divert_task',
2564 'divert' => 'divert_task',
2565 'frame' => 'frame_task',
2566 'inv' => 'inventory_task',
2567 'invent' => 'inventory_task',
2568 'inventory' => 'inventory_task',
2569 'launch' => 'launch_task',
2570 'launcher' => 'launch_task',
2571 'loc' => 'locator_task',
2572 'locator' => 'locator_task',
2573 'mc' => 'map_check_task',
2574 'map' => 'map_check_task',
2575 'mapcheck' => 'map_check_task',
2576 'note' => 'notepad_task',
2577 'notes' => 'notepad_task',
2578 'notepad' => 'notepad_task',
2579 'raw' => 'raw_text_task',
2580 'rawtext' => 'raw_text_task',
2581 'token' => 'raw_token_task',
2582 'rawtoken' => 'raw_token_task',
2583 'scr' => 'script_task',
2584 'script' => 'script_task',
2585 'stat' => 'status_task',
2586 'status' => 'status_task',
2587 'sys' => 'system_task',
2588 'system' => 'system_task',
2589 'task' => 'tasklist_task',
2590 'tasks' => 'tasklist_task',
2591 'tasklist' => 'tasklist_task',
2592 'watch' => 'watch_task',
2593 },
2594 # Customisable registry hash of task labels, in the form
2595 # $taskLabelHash{label} = task_standard_name
2596 taskLabelHash => {}, # [tasks] Set below
2597 #
2598 # Sometimes one type of task needs to run before, or after, other types of task
2599 # This list of tasks is run before any others. If there are two or more copies of a
2600 # task type running and they appear on the list, they will run together, one after the
2601 # other, before others types of task
2602 # There are two runlists - a list of tasks to run FIRST, and a list of tasks to be
2603 # run LAST. Every item on the runlist must be the task's formal name, ->name
2604 #
2605 # The constant task runlists (these values never change)
2606 constTaskRunFirstList => [
2607 'status_task', # First task on list is the first to be run
2608 'locator_task'
2609 ],
2610 constTaskRunLastList => [
2611 'tasklist_task', # First task on list the last to be run
2612 ],
2613 # User-customisable task runlists
2614 taskRunFirstList => [], # [tasks] Set below
2615 taskRunLastList => [], # [tasks] Set below
2616 #
2617 # Counts used for giving unique names to tasks (not used for custom tasks)
2618 # How many tasks have been started in total, across all sessions. Reset to 0 whenever
2619 # Axmud starts
2620 taskTotal => 0,
2621  
2622 # Registry hash of tasks that start in every session (when the character has logged in)
2623 # - the 'global initial tasklist' (each profile also has its own initial tasklist).
2624 # Hash in the form
2625 # $initTaskHash{unique_task_name} = blessed_reference_to_task_object
2626 initTaskHash => {}, # [tasks]
2627 # The order in which the tasks are started (not very important for tasks unless they
2628 # are Script tasks). List contains all the keys in $self->initTaskHash
2629 initTaskOrderList => [], # [tasks]
2630 # How many (global) initial tasks have been created in total. Reset to 0 only if a
2631 # config file is being created (or if the global initial tasklist becomes empty)
2632 initTaskTotal => 0, # [tasks]
2633  
2634 # Registry hash of customised tasks - the 'custom tasklist'. Each has a unique name
2635 # (max 16 chars, no reserved names) which the user can choose freely
2636 # ->customTaskHash{custom_task_name} = blessed_reference_to_task_object
2637 customTaskHash => {}, # [tasks]
2638  
2639 # Tasks have two types of IV - task settings (standard IVs for all tasks), and task
2640 # parameters (different IVs for all types of task)
2641 # Constant hash of task IVs that are task settings, not task parameters
2642 constTaskSettingsHash => {
2643 'session' => undef,
2644 'name' => undef,
2645 'prettyName' => undef,
2646 'uniqueName' => undef,
2647 'shortName' => undef,
2648 'customName' => undef,
2649 'category' => undef,
2650 'descrip' => undef,
2651 'taskType' => undef,
2652 'profName' => undef,
2653 'profCategory' => undef,
2654 'shortCutIV' => undef,
2655 'jealousyFlag' => undef,
2656 'requireLocatorFlag' => undef,
2657 'profSensitivityFlag' => undef,
2658 'storableFlag' => undef,
2659 'startTime' => undef,
2660 'checkTime' => undef,
2661 'endStatus' => undef,
2662 'endTime' => undef,
2663 'waitForTask' => undef,
2664 'delayTime' => undef,
2665 'shutdownFlag' => undef,
2666 'status' => undef,
2667 'resumeStatus' => undef,
2668 'activeFlag' => undef,
2669 'stage' => undef,
2670 'allowWinFlag' => undef,
2671 'requireWinFlag' => undef,
2672 'startWithWinFlag' => undef,
2673 'winPreferList' => undef,
2674 'winObj' => undef,
2675 'tableObj' => undef,
2676 'taskWinFlag' => undef,
2677 'taskWinEntryFlag' => undef,
2678 'winmap' => undef,
2679 'winUpdateFunc' => undef,
2680 'defaultTabObj' => undef,
2681 'monochromeFlag' => undef,
2682 'noScrollFlag' => undef,
2683 'ttsFlag' => undef,
2684 'ttsConfig' => undef,
2685 'ttsAttribHash' => undef,
2686 'ttsFlagAttribHash' => undef,
2687 'ttsAlertAttribHash' => undef,
2688 },
2689 # Constant hash of permissible values for a task's ->status IV
2690 constTaskStatusHash => {
2691 'no_exist' => undef,
2692 'wait_init' => undef,
2693 'wait_task_exist' => undef,
2694 'wait_task_no_exist' => undef,
2695 'wait_task_start_stop' => undef,
2696 'running' => undef,
2697 'paused' => undef,
2698 'finished' => undef,
2699 'reset' => undef,
2700 },
2701  
2702 # Scripts
2703 # -------
2704  
2705 # Registry hash of directories inside which Axbasic scripts are stored. When an Axbasic
2706 # script needs to be loaded, the '/data/scripts' directory is first checked; then
2707 # every directory in this list is checked, in order. The first directory which
2708 # contains an Axbasic script with the right name is loaded
2709 scriptDirList => [], # [scripts]
2710 # Registry hash of scripts that start in every session (when the character has logged
2711 # in) - the 'global initial scriptlist' (each profile also has its own initial
2712 # scriptlist) Hash in the form
2713 # $initScriptHash{script_name} = mode
2714 # ...where 'script_name' matches the file from which the script is loaded, and 'mode' is
2715 # set to one of the following values:
2716 # 'no_task' - run the script without a task
2717 # 'run_task' - run the script from within a task
2718 # 'run_task_win' - run the script from within a task, in 'forced window' mode
2719 initScriptHash => {}, # [scripts]
2720 # The order in which the scripts are started. List contains all the keys in
2721 # $self->initScriptHash
2722 initScriptOrderList => [], # [scripts]
2723  
2724 # Logging
2725 # -------
2726  
2727 # Axmud can log to several different logfiles, all of which are in the /logs
2728 # directory and its sub-directories (in the Axmud data directory, $DATA_DIR)
2729 #
2730 # Two logfiles are stored in the /logs directory itself:
2731 # 'main' - Logs everything displayed in the 'main' window, across all sessions
2732 # 'errors' - Logs all kinds of system error message (including debug, warning and
2733 # improper argument messages) across all sessions
2734 # Several logfiles are stored in /logs/standard:
2735 # 'system' - Logs every system message (from GA::Obj::TextView->showSystemText)
2736 # across all sessions
2737 # 'error' - Logs every system error message (from GA::Obj::TextView->showError)
2738 # across all sessions
2739 # 'warning' - Logs every system warning message (from
2740 # GA::Obj::TextView->showWarning) across all sessions
2741 # 'debug' - Logs every system debug message (from GA::Obj::TextView->showDebug)
2742 # across all sessions
2743 # 'improper' - Logs every system 'improper arguments' message (from
2744 # GA::Obj::TextView->showImproper) across all sessions
2745 # Several logfiles are stored in /logs/<current_world> by a GA::Session:
2746 # 'receive' - Logs all text received from the world in .../receive. Unlike other
2747 # logfiles, lines of text are not split by splitter triggers or
2748 # recognised command prompts. If $self->logImageFlag is TRUE, the
2749 # text also records processed images
2750 # 'display' - Logs all text received from the world after it's been modified by any
2751 # matching rewriter triggers (if any) in .../display
2752 # 'rooms' - Logs all room statements processed by the Locator task in .../rooms
2753 # 'descrips' - Logs all room descriptions processed by the Locator task in
2754 # .../descrips
2755 # 'contents' - Logs all room contents strings processed by the Locator task in
2756 # .../contents
2757 # 'attack' - Logs all attacks processed by the Attack task in .../attacks
2758 # 'divert' - Logs all text processed by the Divert task in .../divert
2759 # 'chat' - Logs all conversations with chat contacts in ../chat
2760 # Several logfiles are written to /logs/<current_world> by the Status task, when it
2761 # detects certain events:
2762 # 'sleep' - Logs lines leading up to the character falling asleep
2763 # 'passout' - Logs lines leading up to the character passing out
2764 # 'dead' - Logs lines leading up to the character's death
2765 #
2766 # Constant registry hash of the logfiles written by GA::Client, and whether they should
2767 # be written, in the form
2768 # $constLogPrefHash{log_file_type} = TRUE or FALSE
2769 constLogPrefHash => {
2770 'main' => FALSE,
2771 'errors' => TRUE,
2772 'system' => FALSE,
2773 'error' => TRUE,
2774 'warning' => TRUE,
2775 'debug' => TRUE,
2776 'improper' => TRUE,
2777 },
2778 # Registry hash of current log-writing preferences, in the form
2779 # $logPrefHash{type} = TRUE or FALSE
2780 logPrefHash => {}, # [config] Set below
2781 # Constant registry hash of the logfiles written by individual GA::Session objects, and
2782 # whether they should be written, in the form
2783 # $constLogSessionPrefHash{log_file_type} = TRUE or FALSE
2784 # Used to initialise ->logPrefHash in GA::Profile::World
2785 constSessionLogPrefHash => {
2786 'receive' => FALSE,
2787 'display' => TRUE,
2788 'rooms' => TRUE,
2789 'descrips' => TRUE,
2790 'contents' => TRUE,
2791 'attack' => FALSE,
2792 'channels' => TRUE,
2793 'chat' => TRUE,
2794 'divert' => TRUE,
2795 'sleep' => TRUE,
2796 'passout' => TRUE,
2797 'dead' => TRUE,
2798 },
2799 # A list of GA::Session logfiles in a standard order, for use in the world profile's
2800 # 'edit' window
2801 constSessionLogOrderList => [
2802 'receive', 'display', 'rooms', 'descrips','contents', 'attack', 'channels', 'chat',
2803 'divert', 'sleep', 'passout', 'dead',
2804 ],
2805  
2806 # Parallel hash of short descriptions for each type of logfile, for use in the
2807 # client's 'pref' window and the world profile's 'edit' window
2808 constLogDescripHash => {
2809 # GA::Client
2810 'main'
2811 => 'Logs everything displayed in the \'main\' window, across all sessions',
2812 'errors'
2813 => 'Logs all kinds of system error message (including debug/warning, etc)',
2814 'system'
2815 => 'Logs every system message shown in the \'main\' window',
2816 'error'
2817 => 'Logs every system error message shown in the \'main\' window',
2818 'warning'
2819 => 'Logs every system warning message shown in the \'main\' window',
2820 'debug'
2821 => 'Logs every system debug message shown in the \'main\' window',
2822 'improper'
2823 => 'Logs every system \'improper arguments\' message shown in the \'main\''
2824 . ' window',
2825 # GA::Session and its tasks
2826 'receive'
2827 => 'Logs all text received from the world',
2828 'display'
2829 => 'Logs all text received after any modifications from matching triggers',
2830 'rooms'
2831 => 'Logs all room statements processed by the Locator task',
2832 'descrips'
2833 => 'Logs all room descriptions processed by the Locator task',
2834 'contents'
2835 => 'Logs all room contents strings processed by the Locator task',
2836 'attack'
2837 => 'Logs all attacks processed by the Attack task',
2838 'channels'
2839 => 'Logs all text processed by the Channels task',
2840 'chat'
2841 => 'Logs all conversations with chat contacts',
2842 'divert'
2843 => 'Logs all text processed by the Divert task',
2844 'sleep'
2845 => 'Logs lines leading up to the character falling asleep',
2846 'passout'
2847 => 'Logs lines leading up to the character passing out',
2848 'dead'
2849 => 'Logs lines leading up to the character\'s death',
2850 },
2851 # A list of logfiles in a standard order, for use in the client's 'pref' window
2852 constLogOrderList => [
2853 'main', 'errors', 'system', 'error', 'warning', 'debug', 'improper',
2854 ],
2855 # Constant registry hash of paths for each logfile, relative to the Axmud data
2856 # directory, in the form
2857 # $constLogPathHash{type} = path_relative_to_data_directory
2858 constLogPathHash => {
2859 'main' => '/logs/main',
2860 'errors' => '/logs/errors',
2861 'system' => '/logs/standard/system',
2862 'error' => '/logs/standard/error',
2863 'warning' => '/logs/standard/warning',
2864 'debug' => '/logs/standard/debug',
2865 'improper' => '/logs/standard/improper',
2866 },
2867 # Flag set to TRUE if logging is enabled, FALSE if logging is disabled
2868 allowLogsFlag => FALSE, # [config]
2869 # Flag set to TRUE if the logfiles listed above should be deleted whenever the Axmud
2870 # client starts, FALSE if not
2871 deleteStandardLogsFlag => FALSE, # [config]
2872 # Flag set to TRUE if the logfiles relating to a particular world (listed in
2873 # GA::Session) should be deleted whenever the world is a current world
2874 deleteWorldLogsFlag => FALSE, # [config]
2875 #
2876 # The following flags apply to the logfiles listed above, and those specified in
2877 # GA::Session
2878 # Flag set to TRUE if a new logfile should be started on every distinct date, FALSE if
2879 # not
2880 logDayFlag => TRUE, # [config]
2881 # Flag set to TRUE if a new logfile should be started when the Axmud client starts
2882 logClientFlag => TRUE, # [config]
2883 # Flag set to TRUE if every line in a log should be prefixed by the date, FALSE if not
2884 logPrefixDateFlag => TRUE, # [config]
2885 # Flag set to TRUE if every line in a log should be prefixed by the time, FALSE if not
2886 logPrefixTimeFlag => TRUE, # [config]
2887 # Flag set to TRUE if images should be included in 'receive' logfile (only), FALSE if
2888 # not
2889 logImageFlag => FALSE, # [config]
2890 #
2891 # String to add a the beginning of every logfile (for example, to add a copyright
2892 # message, or to identify the user). Can contain one or more strings, as well as empty
2893 # strings (for spacing). If an empty list, a preamble isn't used
2894 logPreambleList => [], # [config]
2895  
2896 # The 'sleep', 'passout' and 'dead' logfiles are written by the Status task, which
2897 # attempts to write lines of text received from the world before and after the event.
2898 # If the value is 0, no lines are written before/after the event. Otherwise, write
2899 # the number of lines specified by the IV (max: 999)
2900 statusEventBeforeCount => 200, # [config]
2901 statusEventAfterCount => 50, # [config]
2902  
2903 # Chat
2904 # ----
2905  
2906 # The Chat task is an instant messenger using the zChat/MudMaster chat protocols. The
2907 # Client stores some IVs used by all chat sessions
2908 #
2909 # The user's chat name. If 'undef', the current character's name is used in chat
2910 # sessions
2911 chatName => undef, # [contacts]
2912 # Chat email, broadcast during sessions using the zChat protocol. If 'undef', not
2913 # broadcast
2914 chatEmail => undef, # [contacts]
2915 # The default port for incoming chat connections (should not be modified)
2916 constChatPort => 4050,
2917 # Should incoming calls be auto-accepted? ('prompt' - no, prompt the user first,
2918 # 'accept_contact' - auto-accept calls from people in your chat contact list,
2919 # 'accept_all' - auto-accept calls from everyone)
2920 chatAcceptMode => 'prompt', # [contacts]
2921 # Registry hash of GA::Obj::ChatContact objects in the form
2922 # $chatContactHash{unique_name} = blessed_reference_to_chat_contact_object
2923 chatContactHash => {}, # [contacts]
2924 #
2925 # Path to the default icon broadcast to chat contacts during chat sessions (relative to
2926 # the Axmud base directory)
2927 constChatIcon => 'icons/system/default_chat.bmp',
2928 # Path to the icon currently broadcast to chat contacts during chat sessions (absolute
2929 # path)
2930 chatIcon => $axmud::SHARE_DIR . '/icons/system/default_chat.bmp',
2931 # [contacts]
2932 # Path to the default icon used if the chat contact does not broadcast their own during
2933 # chat sessions (relative to the Axmud base directory)
2934 constChatContactIcon => 'icons/system/default_contact.bmp',
2935 # Constant registry hash of paths to smiley icons (these values never changes). The
2936 # smileys themselves are strings, not regexes. Hash in the form
2937 # $constChatSmileyHash{smiley} = path_to_file
2938 # NB Maximum smiley size is 8 characters
2939 constChatSmileyHash => {
2940 # Happy
2941 ':)' => $axmud::SHARE_DIR . '/icons/smileys/emotion_smile.bmp',
2942 ':-)' => $axmud::SHARE_DIR . '/icons/smileys/emotion_smile.bmp',
2943 # Laughing
2944 ':D' => $axmud::SHARE_DIR . '/icons/smileys/emotion_haha.bmp',
2945 ':-D' => $axmud::SHARE_DIR . '/icons/smileys/emotion_haha.bmp',
2946 # Sad
2947 ':(' => $axmud::SHARE_DIR . '/icons/smileys/emotion_sad.bmp',
2948 ':-(' => $axmud::SHARE_DIR . '/icons/smileys/emotion_sad.bmp',
2949 # Winky frowny
2950 ';(' => $axmud::SHARE_DIR
2951 . '/icons/smileys/emotion_misdoubt.bmp',
2952 # Angry
2953 ':@' => $axmud::SHARE_DIR . '/icons/smileys/emotion_mad.bmp',
2954 '>:(' => $axmud::SHARE_DIR . '/icons/smileys/emotion_mad.bmp',
2955 # Crying
2956 ":'(" => $axmud::SHARE_DIR . '/icons/smileys/emotion_too_sad.bmp',
2957 ":'-(" => $axmud::SHARE_DIR . '/icons/smileys/emotion_too_sad.bmp',
2958 # Horror
2959 'D:' => $axmud::SHARE_DIR . '/icons/smileys/emotion_horror.bmp',
2960 'D:<' => $axmud::SHARE_DIR . '/icons/smileys/emotion_horror.bmp',
2961 # Shock
2962 ':O' => $axmud::SHARE_DIR . '/icons/smileys/emotion_shocked.bmp',
2963 ':-O' => $axmud::SHARE_DIR . '/icons/smileys/emotion_shocked.bmp',
2964 # Kiss
2965 ':*' => $axmud::SHARE_DIR . '/icons/smileys/emotion_kiss.bmp',
2966 # Wink
2967 ';)' => $axmud::SHARE_DIR . '/icons/smileys/emotion_wink.bmp',
2968 ';-)' => $axmud::SHARE_DIR . '/icons/smileys/emotion_wink.bmp',
2969 # Tongue sticking out
2970 ':P' => $axmud::SHARE_DIR . '/icons/smileys/emotion_tongue.bmp',
2971 ':-P' => $axmud::SHARE_DIR . '/icons/smileys/emotion_tongue.bmp',
2972 # Straight face
2973 ':|' => $axmud::SHARE_DIR . '/icons/smileys/emotion_what.bmp',
2974 ':-|' => $axmud::SHARE_DIR . '/icons/smileys/emotion_what.bmp',
2975 # Embarrassed
2976 ':$' => $axmud::SHARE_DIR . '/icons/smileys/emotion_red.bmp',
2977 # Angel
2978 'O:-)' => $axmud::SHARE_DIR . '/icons/smileys/emotion_angel.bmp',
2979 # Evil
2980 '>:)' => $axmud::SHARE_DIR
2981 . '/icons/smileys/emotion_evilgrin.bmp',
2982 # Devilish
2983 '}:)' => $axmud::SHARE_DIR . '/icons/smileys/emotion_devil.bmp',
2984 '}:-)' => $axmud::SHARE_DIR . '/icons/smileys/emotion_devil.bmp',
2985 # Heart
2986 '<3' => $axmud::SHARE_DIR . '/icons/smileys/emotion_love.bmp',
2987 },
2988 # Registry hash of paths to smiley icons
2989 chatSmileyHash => {}, # [contacts] Set below
2990  
2991 # Colour tags
2992 # -----------
2993  
2994 # Axmud Colour tags - a standard colour scheme which allows Axmud's textviews to use the
2995 # same colour set as other telnet clients
2996 #
2997 # Axmud uses three sets of colour tags:
2998 # - (Standard) colour tags used to show ANSI colours (e.g. 'red', 'BLUE'). To specify
2999 # an underlay colour, precede the string with 'ul_' or 'UL_'
3000 # - Xterm colour tags used to show xterm-256 colours (e.g. 'x0', 'x255'). To specify
3001 # an underlay colour, use a string in the range 'ux0' to 'ux255'. Xterm colour
3002 # tags are case-insensitive, so it's safe to specify 'X0' or 'UX255'
3003 # - RGB colour tags used to show RGB colours (e.g. '#000000', '#FFFFFF'). To specify
3004 # an underlay colour, use a string in the range 'u#000000' to 'u#FFFFFF'. RGB
3005 # colour tags are case-insensitive, so it's safe to specify 'U#00000' or
3006 # 'U#AbCdEf'
3007 # Standard and xterm colour tags are converted into RGB colour tags, before being used
3008 #
3009 # Standard colour tags have all-upper case or all-lower case names. Upper-case names are
3010 # used for bold colours. In addition, each standard tag can be preceded by 'ul_' (or
3011 # 'UL_' for bold colours) to show that the tag is an underlay colour, not a text
3012 # colour.
3013 # e.g. 'BLUE' - bold blue text, 'UL_BLUE' - bold blue underlay text
3014 #
3015 # A constant list of standard (normal) colour tags, in a standard order
3016 # (These values never change, max length: 7 characters; corresponding underlay
3017 # characters have a max length of 10)
3018 constColourTagList => [
3019 'black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white',
3020 ],
3021 # A list of standard (bold) colour tags, in a standard order
3022 # (These values never change, max length: 7 characters; corresponding underlay
3023 # characters have a max length of 10)
3024 constBoldColourTagList => [
3025 'BLACK', 'RED', 'GREEN', 'YELLOW', 'BLUE', 'MAGENTA', 'CYAN', 'WHITE',
3026 ],
3027 #
3028 # A constant hash of standard (normal) colour tags (these values never change). Hash in
3029 # the form
3030 # $constColourTag{standard_colour_tag} = rgb_colour_tag
3031 constColourTagHash => {
3032 'black' => '#000000',
3033 'red' => '#8B0000',
3034 'green' => '#007300',
3035 'yellow' => '#8B6914',
3036 'blue' => '#0000C0',
3037 'magenta' => '#8B008B',
3038 'cyan' => '#008B8B',
3039 'white' => '#BEBEBE',
3040 },
3041 # A constant hash of standard (bold) colour tags (these values never changes). Hash in
3042 # the form
3043 # $constBoldColourTagHash{STANDARD_BOLD_COLOUR_TAG} = rgb_colour_tag
3044 constBoldColourTagHash => {
3045 'BLACK' => '#5F5F5F',
3046 'RED' => '#FF0000',
3047 'GREEN' => '#00FF00',
3048 'YELLOW' => '#FFFF00',
3049 'BLUE' => '#0000FF',
3050 'MAGENTA' => '#FF00FF',
3051 'CYAN' => '#00FFFF',
3052 'WHITE' => '#FFFFFF',
3053 },
3054 # Customisable hash of standard (normal) colour tags, in the form
3055 # $colourTagHash{standard_colour_tag} = rgb_colour_tag
3056 colourTagHash => {}, # [config] Set below
3057 # Customisable hash of standard (bold) colour tags, in the form
3058 # $boldColourTagHash{STANDARD_BOLD_COLOUR_TAG} = rgb_colour_tag
3059 boldColourTagHash => {}, # [config] Set below
3060 #
3061 # A constant hash of background colour tags and suitable text colour tags to use with
3062 # them (for the benefit of tasks, or any other code). Hash in the form
3063 # $constMonochromeHash{background_colour_tag} = text_colour_tag
3064 constMonochromeHash => {
3065 'black' => 'white',
3066 'red' => 'WHITE',
3067 'green' => 'WHITE',
3068 'yellow' => 'white',
3069 'blue' => 'WHITE',
3070 'magenta' => 'WHITE',
3071 'cyan' => 'WHITE',
3072 'white' => 'black',
3073 'BLACK' => 'WHITE',
3074 'RED' => 'black',
3075 'GREEN' => 'black',
3076 'YELLOW' => 'black',
3077 'BLUE' => 'WHITE',
3078 'MAGENTA' => 'black',
3079 'CYAN' => 'black',
3080 'WHITE' => 'black',
3081 },
3082  
3083 # A constant list of 32 rgb colour tags, roughly in rainbow order, for use with the
3084 # winmap/zonemap 'edit' windows (these values never change)
3085 constRainbowColourList => [
3086 '#FF0000', # reds
3087 '#FF7F00', # oranges
3088 '#FFFF00', # yellows
3089 '#00CD00', # greens
3090 '#0000FF', # blues
3091 '#00CDCD', # cyans
3092 '#8B008B', # purples
3093 '#CDCDBA', # greys
3094 '#8B0000', # cycle repeats...
3095 '#8B4500',
3096 '#FFFF7F',
3097 '#008B00',
3098 '#00008B',
3099 '#008B8B',
3100 '#CD00CD',
3101 '#8B8B7E',
3102 '#CD0000',
3103 '#CD6600',
3104 '#D8EE21',
3105 '#00FF00',
3106 '#7F7FFF',
3107 '#3FFFFF',
3108 '#FF00FF',
3109 '#FF7A7A',
3110 '#FFBF7F',
3111 '#EED877',
3112 '#7FFF7F',
3113 '#BFFFFF',
3114 '#C8FFFF',
3115 '#FF7FFF',
3116 '#BACDCD',
3117 '#FFFFFF', # black
3118 ],
3119 # A constant hash of official HTML 4 colour names (in lower-case only), used to
3120 # implement MXP colours, in the form
3121 # $constHtmlColourHash{html_colour_name} = rgb_colour_tag
3122 constHtmlColourHash => {
3123 # Standard HTML colours
3124 'white' => '#FFFFFF',
3125 'silver' => '#C0C0C0',
3126 'gray' => '#808080',
3127 'black' => '#000000',
3128 'red' => '#FF0000',
3129 'maroon' => '#800000',
3130 'yellow' => '#FFFF00',
3131 'olive' => '#808000',
3132 'lime' => '#00FF00',
3133 'green' => '#008000',
3134 'aqua' => '#00FFFF',
3135 'teal' => '#008080',
3136 'blue' => '#0000FF',
3137 'navy' => '#000080',
3138 'fuchsia' => '#FF00FF',
3139 'purple' => '#800080',
3140 # New colours from http://www.gammon.com.au/mushclient/mxpcolours.htm
3141 # (replacing any existing keys from above)
3142 'aliceblue' => '#f0f8ff',
3143 'antiquewhite' => '#FAEBD7',
3144 'aqua' => '#00FFFF',
3145 'aquamarine' => '#7FFFD4',
3146 'azure' => '#F0FFFF',
3147 'beige' => '#F5F5DC',
3148 'bisque' => '#FFE4C4',
3149 'black' => '#000000',
3150 'blanchedalmond' => '#FFEBCD',
3151 'blue' => '#0000FF',
3152 'blueviolet' => '#8A2BE2',
3153 'brown' => '#A52A2A',
3154 'burlywood' => '#DEB887',
3155 'cadetblue' => '#5F9EA0',
3156 'chartreuse' => '#7FFF00',
3157 'chocolate' => '#D2691E',
3158 'coral' => '#FF7F50',
3159 'cornflowerblue' => '#6495ED',
3160 'cornsilk' => '#FFF8DC',
3161 'crimson' => '#DC143C',
3162 'cyan' => '#00FFFF',
3163 'darkblue' => '#00008B',
3164 'darkcyan' => '#008B8B',
3165 'darkgoldenrod' => '#B8860B',
3166 'darkgray' => '#A9A9A9',
3167 'darkgreen' => '#006400',
3168 'darkkhaki' => '#BDB76B',
3169 'darkmagenta' => '#8B008B',
3170 'darkolivegreen' => '#556B2F',
3171 'darkorange' => '#FF8C00',
3172 'darkorchid' => '#9932CC',
3173 'darkred' => '#8B0000',
3174 'darksalmon' => '#E9967A',
3175 'darkseagreen' => '#8DBC8F',
3176 'darkslateblue' => '#483D8B',
3177 'darkslategray' => '#2F4F4F',
3178 'darkturquoise' => '#00DED1',
3179 'darkviolet' => '#9400D3',
3180 'deeppink' => '#FF1493',
3181 'deepskyblue' => '#00BFFF',
3182 'dimgray' => '#696969',
3183 'dodgerblue' => '#1E90FF',
3184 'firebrick' => '#B22222',
3185 'floralwhite' => '#FFFAF0',
3186 'forestgreen' => '#228B22',
3187 'fuchsia' => '#FF00FF',
3188 'gainsboro' => '#DCDCDC',
3189 'ghostwhite' => '#F8F8FF',
3190 'gold' => '#FFD700',
3191 'goldenrod' => '#DAA520',
3192 'gray' => '#808080',
3193 'green' => '#008000',
3194 'greenyellow' => '#ADFF2F',
3195 'honeydew' => '#F0FFF0',
3196 'hotpink' => '#FF69B4',
3197 'indianred' => '#CD5C5C',
3198 'indigo' => '#4B0082',
3199 'ivory' => '#FFFFF0',
3200 'khaki' => '#F0E68C',
3201 'lavender' => '#E6E6FA',
3202 'lavenderblush' => '#FFF0F5',
3203 'lawngreen' => '#7CFC00',
3204 'lemonchiffon' => '#FFFACD',
3205 'lightblue' => '#ADD8E6',
3206 'lightcoral' => '#F08080',
3207 'lightcyan' => '#E0FFFF',
3208 'lightgoldenrodyellow' => '#FAFAD2',
3209 'lightgray' => '#D3D3D3',
3210 'lightgreen' => '#90EE90',
3211 'lightgrey' => '#D3D3D3',
3212 'lightpink' => '#FFB6C1',
3213 'lightsalmon' => '#FFA07A',
3214 'lightseagreen' => '#20B2AA',
3215 'lightskyblue' => '#87CEFA',
3216 'lightslategray' => '#778899',
3217 'lightsteelblue' => '#B0C4DE',
3218 'lightyellow' => '#FFFFE0',
3219 'lime' => '#00FF00',
3220 'limegreen' => '#32CD32',
3221 'linen' => '#FAF0E6',
3222 'magenta' => '#FF00FF',
3223 'maroon' => '#800000',
3224 'mediumaquamarine' => '#66CDAA',
3225 'mediumblue' => '#0000CD',
3226 'mediumorchid' => '#BA55D3',
3227 'mediumpurple' => '#9370DB',
3228 'mediumseagreen' => '#3CB371',
3229 'mediumslateblue' => '#7B68EE',
3230 'mediumspringgreen' => '#00FA9A',
3231 'mediumturquoise' => '#48D1CC',
3232 'mediumvioletred' => '#C71585',
3233 'midnightblue' => '#191970',
3234 'mintcream' => '#F5FFFA',
3235 'mistyrose' => '#FFE4E1',
3236 'moccasin' => '#FFE4B5',
3237 'navajowhite' => '#FFDEAD',
3238 'navy' => '#000080',
3239 'oldlace' => '#FDF5E6',
3240 'olive' => '#808000',
3241 'olivedrab' => '#6B8E23',
3242 'orange' => '#FFA500',
3243 'orangered' => '#FF4500',
3244 'orchid' => '#DA70D6',
3245 'palegoldenrod' => '#EEE8AA',
3246 'palegreen' => '#98FB98',
3247 'paleturquoise' => '#AFEEEE',
3248 'palevioletred' => '#DB7093',
3249 'papayawhip' => '#FFEFD5',
3250 'peachpuff' => '#FFDAB9',
3251 'peru' => '#CD853F',
3252 'pink' => '#FFC8CB',
3253 'plum' => '#DDA0DD',
3254 'powderblue' => '#B0E0E6',
3255 'purple' => '#800080',
3256 'red' => '#FF0000',
3257 'rosybrown' => '#BC8F8F',
3258 'royalblue' => '#4169E1',
3259 'saddlebrown' => '#8B4513',
3260 'salmon' => '#FA8072',
3261 'sandybrown' => '#F4A460',
3262 'seagreen' => '#2E8B57',
3263 'seashell' => '#FFF5EE',
3264 'sienna' => '#A0522D',
3265 'silver' => '#C0C0C0',
3266 'skyblue' => '#87CEEB',
3267 'slateblue' => '#6A5ACD',
3268 'slategray' => '#708090',
3269 'snow' => '#FFFAFA',
3270 'springgreen' => '#00FF7F',
3271 'steelblue' => '#4682B4',
3272 'tan' => '#D2B48C',
3273 'teal' => '#008080',
3274 'thistle' => '#D8BFD8',
3275 'tomato' => '#FF6347',
3276 'turquoise' => '#40E0D0',
3277 'violet' => '#EE82EE',
3278 'wheat' => '#F5DEB3',
3279 'white' => '#FFFFFF',
3280 'whitesmoke' => '#F5F5F5',
3281 'yellow' => '#FFFF00',
3282 'yellowgreen' => '#9ACD32',
3283 },
3284 # For the benefit of MXP gauges (which require three colours - the specified one,
3285 # black for the empty portion of the gauge, and a third colour for the label), a
3286 # partial hash HTML 4 colours, containing only the standard colours as keys, and
3287 # suitable label colours as corresponding values
3288 constHtmlContrastHash => {
3289 # Standard HTML colours
3290 'white' => '#FF0000',
3291 'silver' => '#FF0000',
3292 'gray' => '#FF0000',
3293 'black' => '#FFFFFF',
3294 'red' => '#FFFFFF',
3295 'maroon' => '#FFFFFF',
3296 'yellow' => '#FF0000',
3297 'olive' => '#FFFFFF',
3298 'lime' => '#FFFFFF',
3299 'green' => '#FFFFFF',
3300 'aqua' => '#FFFFFF',
3301 'teal' => '#FFFFFF',
3302 'blue' => '#FFFFFF',
3303 'navy' => '#FFFFFF',
3304 'fuchsia' => '#FFFFFF',
3305 'purple' => '#FFFFFF',
3306 },
3307  
3308 # http://www.gammon.com.au/forum/bbshowpost.php?id=7761&page=4
3309 # To show xterm-256 colours, Axmud supports two colour cubes detailed in the page above:
3310 # the xterm colour cube (the default one) and the netscape colour cube
3311 # Constant hash for the xterm colour cube, converting xterm colour tags (strings in the
3312 # range 'x0' - 'x255') into RGB colour tags (strings in range '#000000' - '#FFFFFFF').
3313 # Hash in the form
3314 # $constXTermColourHash{xterm_colour_tag} = rgb_colour_tag
3315 # NB This hash doesn't include underlay colours represented by strings in the range
3316 # 'ux0' - 'ux255'
3317 constXTermColourHash => {}, # Set below
3318 # Constant hash for the netscape colour cube (in the same form)
3319 constNetscapeColourHash => {},
3320 # Which colour cube is in use at the moment - 'xterm' or 'netscape'
3321 currentColourCube => 'xterm', # [config]
3322 # The hash currently in use (copied from one of the constant hashes above)
3323 xTermColourHash => {},
3324  
3325 # http://www.mudpedia.org/mediawiki/index.php/OSC_color_palette
3326 # A constant hash of colours used in the OSC colour palette, translating a single
3327 # hex character in the range 0-9, A-F into a standard colour tag
3328 constOscPaletteHash => {
3329 '0' => 'black',
3330 '1' => 'red',
3331 '2' => 'green',
3332 '3' => 'yellow',
3333 '4' => 'blue',
3334 '5' => 'magenta',
3335 '6' => 'cyan',
3336 '7' => 'white',
3337 '8' => 'BLACK',
3338 '9' => 'RED',
3339 'A' => 'GREEN',
3340 'B' => 'YELLOW',
3341 'C' => 'BLUE',
3342 'D' => 'MAGENTA',
3343 'E' => 'CYAN',
3344 'F' => 'WHITE',
3345 },
3346 # Flag set to TRUE if using the OSC colour palette is allowed; set to FALSE if OSC
3347 # colour palette escape sequences should be ignored
3348 oscPaletteFlag => TRUE, # [config]
3349  
3350 # Style tags
3351 # ----------
3352  
3353 # A constant list of style tags, in a standard order
3354 # (These values never change, max length: 16 characters)
3355 constStyleTagList => [
3356 'italics', 'italics_off', 'underline', 'underline_off', 'blink_slow', 'blink_fast',
3357 'blink_off', 'strike', 'strike_off', 'link', 'link_off', 'justify_left',
3358 'justify_centre', 'justify_right', 'justify_default',
3359 ],
3360 # A constant list of 'dummy' style tags, in a standard order. 'Dummy' style tags affect
3361 # the text colour and background colour, so they are converted into colour tags
3362 # before the text is displayed on the screen.
3363 # In practice, an 'mxpf_font' tag is always used in a modified form, where 'font' is
3364 # substituted for the actual font that MXP requires, e.g. 'mxpf_monospace_bold_12_p5'.
3365 # However, the 'mxpf_off' tag never changes.
3366 # The modified string typically contains one or more of the following, separated by
3367 # underlines: the font name (e.g. 'monospace'), a font name modifier (e.g. 'bold'),
3368 # the font size (e.g. '12') and the pixel spacing above and below the text (used for
3369 # MXP HTML headings, e.g. 'p5'; when not specified, a spacing of 0 is used)
3370 # Also, an 'mxpm_mode' tag is always used in a modified form, where 'mode' is
3371 # substituted for a value in the range 10-12, 19, 20-99. Since these MXP modes apply
3372 # to a whole single line, there is no 'mxpm_off' tag
3373 # (These values never change, max length: 16 characters)
3374 constDummyTagList => [
3375 'bold', 'bold_off', 'reverse', 'reverse_off', 'conceal', 'conceal_off',
3376 'mxpf_font', 'mxpf_off', 'mxpm_mode', 'attribs_off',
3377 ],
3378  
3379 # A constant hash of style tags (these values never change). Hash in the form
3380 # $constStyleTagHash{tag_name} = undef
3381 constStyleTagHash => {
3382 'italics' => undef,
3383 'italics_off' => undef,
3384 'underline' => undef,
3385 'underline_off' => undef,
3386 'blink_slow' => undef,
3387 'blink_fast' => undef,
3388 'blink_off' => undef,
3389 'strike' => undef,
3390 'strike_off' => undef,
3391 'link' => undef,
3392 'link_off' => undef,
3393 'justify_left' => undef,
3394 'justify_centre' => undef,
3395 'justify_right' => undef,
3396 'justify_default' => undef,
3397 },
3398 # Constant hash of justification style tags for quick lookup
3399 constJustifyTagHash => {
3400 'justify_left' => undef,
3401 'justify_centre' => undef,
3402 'justify_right' => undef,
3403 'justify_default' => undef,
3404 },
3405 # Constant hash of 'dummy' style tags for quick lookup
3406 constDummyTagHash => {
3407 'bold' => undef,
3408 'bold_off' => undef,
3409 'reverse' => undef,
3410 'reverse_off' => undef,
3411 'conceal' => undef,
3412 'conceal_off' => undef,
3413 'mxpf_font' => undef,
3414 'mxpf_off' => undef,
3415 'mxpm_mode' => undef,
3416 'attribs_off' => undef,
3417 },
3418  
3419 # ANSI escape sequences
3420 # ---------------------
3421  
3422 # Constant hashes which help Axmud interpret ANSI escape sequences in text received from
3423 # the world
3424  
3425 # A constant hash of colours, mapping the value in an 'Esc[Value;...;Valuem' escape
3426 # sequence into a standard colour tag
3427 constANSIColourHash => {
3428 30 => 'black',
3429 31 => 'red',
3430 32 => 'green',
3431 33 => 'yellow',
3432 34 => 'blue',
3433 35 => 'magenta',
3434 36 => 'cyan',
3435 37 => 'white',
3436 40 => 'ul_black',
3437 41 => 'ul_red',
3438 42 => 'ul_green',
3439 43 => 'ul_yellow',
3440 44 => 'ul_blue',
3441 45 => 'ul_magenta',
3442 46 => 'ul_cyan',
3443 47 => 'ul_white',
3444 },
3445 # A constant hash of styles, mapping the value in an 'Esc[Value;...;Valuem' escape
3446 # sequence onto a style tag
3447 # NB 1 (bold) and 22 (bold off) are implemented without using (real) style tags, but
3448 # instead with the 'dummy' style tags 'bold' and 'bold_off'
3449 # NB 7 (reverse video on) and 27 (reverse video off) are implemented using the 'dummy'
3450 # style tags 'reverse' and 'reverse_off'
3451 # NB 8 (conceal on) and 28 (conceal off) are implemented using the 'dummy' style tags
3452 # 'conceal' and 'conceal_off'
3453 # NB The style tags 'link_on' and 'link_off' are implemented solely within Axmud and do
3454 # not correspond to an ANSI escape sequence
3455 # NB 39 (default text colour) and 49 (default underlay colour) are implemented by
3456 # converting them into an Axmud colour tag
3457 constANSIStyleHash => {
3458 3 => 'italics',
3459 4 => 'underline',
3460 5 => 'blink_slow',
3461 6 => 'blink_fast',
3462 9 => 'strike', # Actually 'Crossed out'
3463 23 => 'italics_off',
3464 24 => 'underline_off',
3465 25 => 'blink_off',
3466 29 => 'strike_off', # Actually 'Not crossed out'
3467 },
3468  
3469 # A constant list of standard colour/style tags stored in the GA::Buffer::Display
3470 # object for each received line, in a standard order (compiled by
3471 # GA::Session->convertANSISequences)
3472 constColourStyleList => [
3473 'black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white',
3474 'ul_black', 'ul_red', 'ul_green', 'ul_yellow', 'ul_blue', 'ul_magenta', 'ul_cyan',
3475 'ul_white',
3476 'italics', 'italics_off', 'underline', 'underline_off', 'blink_slow', 'blink_fast',
3477 'blink_off', 'strike', 'strike_off', 'link', 'link_off', 'justify_left',
3478 'justify_centre', 'justify_right', 'justify_default',
3479 # 'Dummy' style tags
3480 'bold', 'bold_off', 'reverse', 'reverse_off', 'conceal', 'conceal_off',
3481 'mxpf_font', 'mxpf_off', 'mxpm_mode', 'attribs_off',
3482 ],
3483 # A constant hash of nicer names for standard colour/style tags. The keys are all the
3484 # values in $self->constColourStyleList; the values are more descriptive names for
3485 # them
3486 constPrettyTagHash => {
3487 # Colour tags
3488 'black' => 'Black text',
3489 'red' => 'Red text',
3490 'green' => 'Green text',
3491 'yellow' => 'Yellow text',
3492 'blue' => 'Blue text',
3493 'magenta' => 'Magenta text',
3494 'cyan' => 'Cyan text',
3495 'white' => 'White text',
3496 'ul_black' => 'Black underlay',
3497 'ul_red' => 'Red underlay',
3498 'ul_green' => 'Green underlay',
3499 'ul_yellow' => 'Yellow underlay',
3500 'ul_blue' => 'Blue underlay',
3501 'ul_magenta' => 'Magenta underlay',
3502 'ul_cyan' => 'Cyan underlay',
3503 'ul_white' => 'White underlay',
3504 # Style tags
3505 'italics' => 'Turn on italics',
3506 'italics_off' => 'Turn off italics',
3507 'underline' => 'Turn on underline',
3508 'underline_off' => 'Turn off underline',
3509 'blink_slow' => 'Turn on slow blink',
3510 'blink_fast' => 'Turn on fast blink',
3511 'blink_off' => 'Turn off slow/fast blink',
3512 'strike' => 'Turn on strike-through',
3513 'strike_off' => 'Turn off strike-through',
3514 'link' => 'Clickable link',
3515 'link_off' => 'End of clickable link',
3516 'justify_left' => 'Left justification for text',
3517 'justify_centre' => 'Centre justification for text',
3518 'justify_right' => 'Right justification for text',
3519 'justify_default' => 'Default justification for text',
3520 # Dummy style tags
3521 'bold' => 'Turn on bold colours',
3522 'bold_off' => 'Turn off bold colours',
3523 'reverse' => 'Turn on reverse video',
3524 'reverse_off' => 'Turn off reverse video',
3525 'conceal' => 'Turn on conceal',
3526 'conceal_off' => 'Turn off conceal',
3527 'mxpf_font' => 'Turn on MXP font attributes',
3528 'mxpf_off' => 'Turn off MXP font attributes',
3529 'mxpm_mode' => 'Apply an MXP line mode',
3530 'attribs_off' => 'Turn off all attributes',
3531 },
3532 # 'Set Graphics Mode' ANSI escape sequences in text received from the world apply
3533 # until the next occurence of that sequence. Each GA::Session needs to keep track of
3534 # which graphic modes apply right now in the session's current textview object
3535 # Constant hash of graphics modes (these values never change, and are used to initialise
3536 # comparable hashes in GA::Session and GA::Obj::TextView)
3537 constColourStyleHash => {
3538 # Colour tags - when set to 'undef', the default colours are used. Standard or xterm
3539 # colour tags, but not RGB colour tags
3540 text => undef, # Axmud colour tag, e.g. 'red' or 'x230'
3541 underlay => undef, # Axmud underlay colour tag, e.g. 'ul_white'
3542 # Style tags
3543 italics => FALSE,
3544 underline => FALSE,
3545 blink_slow => FALSE,
3546 blink_fast => FALSE,
3547 strike => FALSE,
3548 link => FALSE,
3549 # MXP font tags (which are dummy style tags)
3550 mxp_font => undef, # e.g. 'mxpf_monospace_bold_12', or 'undef'
3551 # Justification
3552 justify => undef, # 'left', 'right', 'centre' or 'undef' to
3553 # represent style tag 'justify_default'
3554 },
3555  
3556 # Telnet options and mud protocols
3557 # --------------------------------
3558  
3559 # Constant hash of telnet negotiation descriptors
3560 constTelnetHash => {
3561 # TELNET_
3562 'TELNET_IS' => 0,
3563 'TELNET_SEND' => 1,
3564 'TELNET_SE' => 240,
3565 'TELNET_GA' => 249,
3566 'TELNET_SB' => 250,
3567 'TELNET_WILL' => 251,
3568 'TELNET_WONT' => 252,
3569 'TELNET_DO' => 253,
3570 'TELNET_DONT' => 254,
3571 'TELNET_IAC' => 255,
3572 # TELOPT_
3573 'TELOPT_ECHO' => 1,
3574 'TELOPT_SGA' => 3, # Implemented directly by GA::Obj::Telnet
3575 'TELOPT_TTYPE' => 24,
3576 'TELOPT_EOR' => 25,
3577 'TELOPT_NAWS' => 31,
3578 'TELOPT_NEW_ENVIRON' => 39,
3579 'TELOPT_CHARSET' => 42,
3580 'TELOPT_MSDP' => 69,
3581 'TELOPT_MSSP' => 70,
3582 'TELOPT_MCCP1' => 85,
3583 'TELOPT_MCCP2' => 86,
3584 'TELOPT_MSP' => 90,
3585 'TELOPT_MXP' => 91,
3586 'TELOPT_ZMP' => 93,
3587 'TELOPT_AARD102' => 102,
3588 'TELOPT_ATCP' => 200,
3589 'TELOPT_GMCP' => 201,
3590 # MSDP
3591 'MSDP_VAR' => 1,
3592 'MSDP_VAL' => 2,
3593 'MSDP_TABLE_OPEN' => 3,
3594 'MSDP_TABLE_CLOSE' => 4,
3595 'MSDP_ARRAY_OPEN' => 5,
3596 'MSDP_ARRAY_CLOSE' => 6,
3597 # MSSP
3598 'MSSP_VAR' => 1,
3599 'MSSP_VAL' => 2,
3600 },
3601 # Constant hash of telopts
3602 constTeloptHash => {
3603 1 => 'TELOPT_ECHO',
3604 3 => 'TELOPT_SGA',
3605 24 => 'TELOPT_TTYPE',
3606 25 => 'TELOPT_EOR',
3607 31 => 'TELOPT_NAWS',
3608 39 => 'TELOPT_NEW_ENVIRON',
3609 42 => 'TELOPT_CHARSET',
3610 69 => 'TELOPT_MSDP',
3611 70 => 'TELOPT_MSSP',
3612 85 => 'TELOPT_MCCP1',
3613 86 => 'TELOPT_MCCP2',
3614 90 => 'TELOPT_MSP',
3615 91 => 'TELOPT_MXP',
3616 93 => 'TELOPT_ZMP',
3617 102 => 'TELOPT_AARD102',
3618 200 => 'TELOPT_ATCP',
3619 201 => 'TELOPT_GMCP',
3620 },
3621  
3622 # Hashes of HTML heading sizes and spacings, relative to $self->constFontSize,
3623 # corresponding to the HTML tags <H1>...<H6>. Used with both MXP and Pueblo
3624 constHeadingSizeHash => {
3625 1 => 2, # <H1>
3626 2 => 1.5, # <H2>, etc
3627 3 => 1.17,
3628 4 => 1,
3629 5 => 0.83,
3630 6 => 0.67,
3631 },
3632 constHeadingSpacingHash => {
3633 1 => 0.67,
3634 2 => 0.83,
3635 3 => 1,
3636 4 => 1.33,
3637 5 => 1.67,
3638 6 => 2,
3639 },
3640  
3641 # Telnet option negotiations
3642 # Use ECHO (http://www.ietf.org/rfc/rfc857.txt)
3643 useEchoFlag => TRUE, # [config]
3644 # Use SGA (Suppress Go Ahead - http://www.ietf.org/rfc/rfc858.txt)
3645 useSgaFlag => TRUE, # [config]
3646 # Use TTYPE (Terminal type - http://www.ietf.org/rfc/rfc1091.txt)
3647 useTTypeFlag => TRUE, # [config]
3648 # Use EOR (End Of Record - RFC 885, http://www.ietf.org/rfc/rfc885.txt)
3649 useEorFlag => TRUE, # [config]
3650 # Use NAWS (Negotiate About Window Size - RFC 1073, http://www.ietf.org/rfc/rfc1073.txt)
3651 useNawsFlag => TRUE, # [config]
3652 # Use NEW-ENVIRON (New Environment option - RFC 1572,
3653 # http://www.ietf.org/rfc/rfc1572.txt)
3654 useNewEnvironFlag => TRUE, # [config]
3655 # Use CHARSET (Character Set and translation - RFC 1073,
3656 # http://www.ietf.org/rfc/rfc2066.txt)
3657 useCharSetFlag => TRUE, # [config]
3658  
3659 # MUD protocols
3660 # Use MSDP (Mud Server Data Protocol - http://tintin.sourceforge.io/msdp/)
3661 useMsdpFlag => TRUE, # [config]
3662 # Use MSSP (Mud Server Status Protocol - http://tintin.sourceforge.io/mssp/)
3663 useMsspFlag => TRUE, # [config]
3664 # Use MCCP (Mud Client Compression Protocol - http://tintin.sourceforge.io/mccp/). Both
3665 # MCCP1 and MCCP2 are supported
3666 useMccpFlag => TRUE, # [config]
3667 # Use MSP (Mud Sound Protocol - http://www.zuggsoft.com/zmud/msp.htm)
3668 useMspFlag => TRUE, # [config]
3669 # Use MXP (Mud Xtension Protocol - http://www.zuggsoft.com/zmud/mxp.htm)
3670 useMxpFlag => TRUE, # [config]
3671 # Use Pueblo - http://pueblo.sourceforge.io/doc/manual/html_standard_elements.html
3672 # (NB In line with other major MUD clients, Axmud offers only partial Pueblo support)
3673 usePuebloFlag => TRUE, # [config]
3674 # Use ZMP (Zenith Mud Protocol
3675 # - http://discworld.starturtle.net/external/protocols/zmp.html)
3676 useZmpFlag => TRUE, # [config]
3677 # Use AARD102 (Aardwolf 102 channel)
3678 # - http://www.aardwolf.com/blog/2008/07/10/
3679 # telnet-negotiation-control-mud-client-interaction/
3680 useAard102Flag => TRUE, # [config]
3681 # Use ATCP (Achaea Telnet Client Protocol)
3682 # - https://www.ironrealms.com/rapture/manual/files/FeatATCP-txt.html
3683 useAtcpFlag => TRUE, # [config]
3684 # Use GMCP (Generic MUD Communication Protocol) - https://www.gammon.com.au/gmcp
3685 useGmcpFlag => TRUE, # [config]
3686 # Use MTTS (Mud Terminal Type Standard - http://tintin.sourceforge.io/mtts/)
3687 useMttsFlag => TRUE, # [config]
3688 # Use MNES (MUD NEW-ENVIRON STANDARD) - https://tintin.mudhalla.net/protocols/mnes/
3689 useMnesFlag => TRUE, # [config]
3690 # Use MCP (Mud Client Protocol - http://www.moo.mud.org/mcp/). Only MCP version 2.1 is
3691 # supported. Axmud provides the MCP packages 'mcp-negotiate', 'mcp-cord' and
3692 # 'dns-org-mud-moo-simpleedit'
3693 useMcpFlag => TRUE, # [config]
3694  
3695 # Constant hash of official MSSP variables
3696 constMsspVarHash => {}, # Set below
3697 # Constant list of official MSSP variables, in a fixed order; items that begin with
3698 # a # character are not official variables, but subject headings
3699 constMsspVarList => [
3700 '#Required',
3701 'NAME',
3702 'PLAYERS',
3703 'UPTIME',
3704 '#Generic',
3705 'CRAWL DELAY',
3706 'HOSTNAME',
3707 'PORT',
3708 'CODEBASE',
3709 'CONTACT',
3710 'CREATED',
3711 'ICON',
3712 'IP',
3713 'LANGUAGE',
3714 'LOCATION',
3715 'MINIMUM AGE',
3716 'WEBSITE',
3717 '#Categorisation',
3718 'FAMILY',
3719 'GENRE',
3720 'GAMEPLAY',
3721 'STATUS',
3722 'GAMESYSTEM',
3723 'INTERMUD',
3724 'SUBGENRE',
3725 '#World',
3726 'AREAS',
3727 'HELPFILES',
3728 'MOBILES',
3729 'OBJECTS',
3730 'ROOMS',
3731 'CLASSES',
3732 'LEVELS',
3733 'RACES',
3734 'SKILLS',
3735 '#Protocols',
3736 'ANSI',
3737 'GMCP',
3738 'MCCP',
3739 'MCP',
3740 'MSDP',
3741 'MSP',
3742 'MXP',
3743 'PUEBLO',
3744 'UTF-8',
3745 'VT100',
3746 'XTERM 256 COLORS',
3747 '#Commercial',
3748 'PAY TO PLAY',
3749 'PAY FOR PERKS',
3750 '#Hiring',
3751 'HIRING BUILDERS',
3752 'HIRING CODERS',
3753 ],
3754  
3755 # The version of MSP supported by this cleint
3756 constMspVersion => '0.3',
3757 # Flag set to TRUE if Axmud should play several sound triggers at once, FALSE if it
3758 # should stop playing the previous sound trigger, if a new sound trigger arrives
3759 allowMspMultipleFlag => TRUE, # [config]
3760 # Flag set to TRUE if Axmud should allow MSP to download sound files it doesn't already
3761 # have, FALSE if not
3762 allowMspLoadSoundFlag => TRUE, # [config]
3763 # Flag set to TRUE if Axmud should recognise MSP tags in the middle of a line; FALSE if
3764 # it should only recognise MSP tags at the beginning of a line
3765 allowMspFlexibleFlag => FALSE, # [config]
3766  
3767 # The version of MXP supported by this client
3768 constMxpVersion => '1.0',
3769 # Hash of all official MXP tags (i.e. tags which cannot be user-defined)
3770 constMxpOfficialHash => {
3771 'ELEMENT' => undef,
3772 'EL' => undef,
3773 'ATTLIST' => undef,
3774 'AT' => undef,
3775 'ATT' => undef, # The MXP spec uses both <!AT> and <!ATT>
3776 'ENTITY' => undef,
3777 'EN' => undef,
3778 'VAR' => undef,
3779 'V' => undef,
3780 'TAG' => undef,
3781 'BOLD' => undef,
3782 'B' => undef,
3783 'STRONG' => undef,
3784 'ITALIC' => undef,
3785 'I' => undef,
3786 'EM' => undef,
3787 'UNDERLINE' => undef,
3788 'U' => undef,
3789 'STRIKEOUT' => undef,
3790 'S' => undef,
3791 'HIGH' => undef,
3792 'H' => undef,
3793 'COLOR' => undef,
3794 'C' => undef, # Is in MXP spec
3795 'FONT' => undef,
3796 'F' => undef, # Not in MXP spec, but implemented anyway
3797 'NOBR' => undef,
3798 'P' => undef,
3799 'BR' => undef,
3800 'SBR' => undef,
3801 # '&nbsp' => undef,
3802 'A' => undef,
3803 'SEND' => undef,
3804 'EXPIRE' => undef,
3805 'VERSION' => undef,
3806 'SUPPORT' => undef,
3807 'H1' => undef,
3808 'H2' => undef,
3809 'H3' => undef,
3810 'H4' => undef,
3811 'H5' => undef,
3812 'H6' => undef,
3813 'HR' => undef,
3814 'SMALL' => undef,
3815 'TT' => undef,
3816 'SOUND' => undef,
3817 'MUSIC' => undef,
3818 'GAUGE' => undef,
3819 'STAT' => undef,
3820 'FRAME' => undef,
3821 'DESTINATION' => undef,
3822 'DEST' => undef,
3823 'RELOCATE' => undef,
3824 'QUIET' => undef,
3825 'USER' => undef,
3826 'PASSWORD' => undef,
3827 'IMAGE' => undef,
3828 'FILTER' => undef,
3829 # 'SCRIPT => undef, # Deprecated since MXP v0.4
3830 },
3831 # Hash of MXP tags and their attributes (a subset of ->constMxpOfficialHash, omitting
3832 # tags that appear as keys in $self->constMxpConvertHash); used to respond to
3833 # <SUPPORT> requests, so both the element and its list of attributes are in lower-case
3834 constMxpAttribHash => {
3835 # 'element' => undef,
3836 'el' => ['att', 'tag', 'flag', 'open', 'delete', 'empty'],
3837 # 'attlist' => undef,
3838 'at' => undef,
3839 # 'att' => undef,
3840 # 'entity' => undef,
3841 'en' => [
3842 'desc', 'private', 'publish', 'delete', 'add',
3843 'remove',
3844 ],
3845 # 'var' => undef,
3846 'v' => [
3847 'desc', 'private', 'publish', 'delete', 'add',
3848 'remove',
3849 ],
3850 'tag' => [
3851 'windowname', 'fore', 'back', 'gag', 'enable',
3852 'disable',
3853 ],
3854 # 'bold' => undef,
3855 'b' => undef,
3856 # 'italic' => undef,
3857 'i' => undef,
3858 # 'em' => undef,
3859 # 'underline' => undef,
3860 'u' => undef,
3861 # 'strikeout' => undef,
3862 's' => undef,
3863 # 'high' => undef,
3864 'h' => undef,
3865 # 'color' => undef,
3866 'c' => ['fore', 'back'],
3867 # 'font' => undef,
3868 'f' => ['face', 'size', 'color', 'back'],
3869 'nobr' => undef,
3870 'p' => undef,
3871 'br' => undef,
3872 'sbr' => undef,
3873 # '&nbsp' => undef,
3874 'a' => ['href', 'hint', 'expire'],
3875 'send' => ['href', 'hint', 'prompt', 'expire'],
3876 'expire' => undef,
3877 'version' => undef,
3878 'support' => undef,
3879 'h1' => undef,
3880 'h2' => undef,
3881 'h3' => undef,
3882 'h4' => undef,
3883 'h5' => undef,
3884 'h6' => undef,
3885 'small' => undef,
3886 'tt' => undef,
3887 'sound' => ['v', 'l', 'p', 'c', 't', 'u'],
3888 'music' => ['v', 'l', 'p', 'c', 't', 'u'],
3889 'gauge' => ['max', 'caption', 'color'],
3890 'stat' => ['max', 'caption'],
3891 'frame' => [
3892 'name', 'action', 'open', 'close', 'redirect',
3893 'title', 'internal', 'align', 'left', 'top',
3894 'width', 'height', 'scrolling', 'floating',
3895 ],
3896 # 'destination' => undef,
3897 'dest' => ['x', 'y', 'eol', 'eof'],
3898 'relocate' => undef,
3899 'quiet' => undef,
3900 'user' => undef,
3901 'password' => undef,
3902 'image' => [
3903 'fname', 'url', 't', 'h', 'w', 'hspace', 'vspace',
3904 'align', 'ismap',
3905 ],
3906 'filter' => ['src', 'dest', 'name'],
3907 # 'SCRIPT => undef, # Deprecated since MXP v0.4
3908 },
3909 # Hash of MXP tags which are synonyms of other tags, e.g. <B>, <BOLD> and <STRONG>
3910 # are all equivalent
3911 constMxpConvertHash => {
3912 'BOLD' => 'B',
3913 'STRONG' => 'B',
3914 'ITALIC' => 'I',
3915 'EM' => 'I',
3916 'UNDERLINE' => 'U',
3917 'STRIKEOUT' => 'S',
3918 'HIGH' => 'H',
3919 'COLOR' => 'C', # Is in MXP spec
3920 'FONT' => 'F', # Is not in MXP spec, but implemented anyway
3921 'ELEMENT' => 'EL',
3922 'ATTLIST' => 'AT',
3923 'ATT' => 'AT', # The MXP spec uses both <!AT> and <!ATT>
3924 'ENTITY' => 'EN',
3925 'VAR' => 'V',
3926 'DESTINATION' => 'DEST',
3927 },
3928 # Hash of MXP tags that are line-spacing tags that are routed to
3929 # $self->processMxpSpacingTag, not $self->processMxpElement
3930 constMxpLineSpacingHash => {
3931 '<NOBR>' => undef,
3932 '</NOBR>' => undef, # Invalid MXP tag, but still routed to
3933 # ->processMxpSpacingTag
3934 '<P>' => undef,
3935 '</P>' => undef, # Valid MXP tag
3936 '<BR>' => undef,
3937 '</BR>' => undef, # Invalid MXP tag
3938 '<SBR>' => undef,
3939 '</SBR>' => undef, # Invalid MXP tag
3940 '<HR>' => undef, # (Actually an MXP HTML element)
3941 '</HR>' => undef, # Invalid MXP tag
3942 },
3943 # Hash of MXP modal tags, such as <B> and </I>, that can be 'on' or 'off'. These are
3944 # also the only MXP tags that are allowed in open line mode ($self->mxpLineMode = 0)
3945 constMxpModalHash => {
3946 'B' => undef,
3947 'C' => undef,
3948 'F' => undef,
3949 'H' => undef,
3950 'I' => undef,
3951 'S' => undef,
3952 'U' => undef,
3953 },
3954 # Hash for converting some MXP modal tags into keys in
3955 # GA::Obj::TextView->mxpModalStackHash (for quick lookup, when processing an opening
3956 # tag like <B>, but not required when processing a closing tag like </B>)
3957 constMxpStackConvertHash => {
3958 'B' => 'bold_flag', # i.e. <B>
3959 'I' => 'italics_flag',
3960 'U' => 'underline_flag',
3961 'S' => 'strike_flag',
3962 'H' => 'bold_flag', # 'bold' and 'high' implemented same way
3963 },
3964 # Hashes for converting some MXP modal tags into Axmud style tags
3965 constMxpModalOnHash => {
3966 # 'B' => 'bold',
3967 'I' => 'italics', # i.e. <I>
3968 'U' => 'underline',
3969 'S' => 'strike',
3970 'H' => 'bold', # 'bold' and 'high' implemented same way
3971 },
3972 # Image file formats permitted by this implementation of MXP
3973 constMxpFormatHash => {
3974 # Supported in MXP spec
3975 'bmp' => undef,
3976 'gif' => undef,
3977 # Not supported in MXP spec, but supported by Axmud
3978 'jpg' => undef,
3979 'jpeg' => undef,
3980 'png' => undef,
3981 },
3982 # Constant hash of MXP entity names
3983 # (from http://www.gammon.com.au/mushclient/mxpentities.htm)
3984 # NB Does not include entities in the form '&#nnn;' - these are implemented directly by
3985 # GA::Session->extractMxpPuebloEntity and ->processMxpEntity
3986 constMxpEntityHash => {
3987 'Aacute' => chr(193),
3988 'aacute' => chr(225),
3989 'Acirc' => chr(194),
3990 'acirc' => chr(226),
3991 'acute' => chr(180),
3992 'AElig' => chr(198),
3993 'aelig' => chr(230),
3994 'Agrave' => chr(192),
3995 'agrave' => chr(224),
3996 'amp' => chr(38),
3997 'apos' => chr(39),
3998 'Aring' => chr(197),
3999 'aring' => chr(229),
4000 'Atilde' => chr(195),
4001 'atilde' => chr(227),
4002 'Auml' => chr(196),
4003 'auml' => chr(228),
4004 'brvbar' => chr(166),
4005 'Ccedil' => chr(199),
4006 'ccedil' => chr(231),
4007 'cedil' => chr(184),
4008 'cent' => chr(162),
4009 'copy' => chr(169),
4010 'curren' => chr(164),
4011 'deg' => chr(176),
4012 'divide' => chr(247),
4013 'Eacute' => chr(201),
4014 'eacute' => chr(233),
4015 'Ecirc' => chr(202),
4016 'ecirc' => chr(234),
4017 'Egrave' => chr(200),
4018 'egrave' => chr(232),
4019 'ETH' => chr(208),
4020 'eth' => chr(240),
4021 'Euml' => chr(203),
4022 'euml' => chr(235),
4023 'frac12' => chr(189),
4024 'frac14' => chr(188),
4025 'frac34' => chr(190),
4026 'gt' => chr(62),
4027 'Iacute' => chr(205),
4028 'iacute' => chr(237),
4029 'Icirc' => chr(206),
4030 'icirc' => chr(238),
4031 'iexcl' => chr(161),
4032 'Igrave' => chr(204),
4033 'igrave' => chr(236),
4034 'iquest' => chr(191),
4035 'Iuml' => chr(207),
4036 'iuml' => chr(239),
4037 'laquo' => chr(171),
4038 'lt' => chr(60),
4039 'macr' => chr(175),
4040 'micro' => chr(181),
4041 'middot' => chr(183),
4042 'nbsp' => chr(160),
4043 'not' => chr(172),
4044 'Ntilde' => chr(209),
4045 'ntilde' => chr(241),
4046 'Oacute' => chr(211),
4047 'oacute' => chr(243),
4048 'Ocirc' => chr(212),
4049 'ocirc' => chr(244),
4050 'Ograve' => chr(210),
4051 'ograve' => chr(242),
4052 'ordf' => chr(170),
4053 'ordm' => chr(186),
4054 'Oslash' => chr(216),
4055 'oslash' => chr(248),
4056 'Otilde' => chr(213),
4057 'otilde' => chr(245),
4058 'Ouml' => chr(214),
4059 'ouml' => chr(246),
4060 'para' => chr(182),
4061 'plusmn' => chr(177),
4062 'pound' => chr(163),
4063 'quot' => chr(34),
4064 'raquo' => chr(187),
4065 'reg' => chr(174),
4066 'sect' => chr(167),
4067 'shy' => chr(173),
4068 'sup1' => chr(185),
4069 'sup2' => chr(178),
4070 'sup3' => chr(179),
4071 'szlig' => chr(223),
4072 'THORN' => chr(222),
4073 'thorn' => chr(254),
4074 'times' => chr(215),
4075 'Uacute' => chr(218),
4076 'uacute' => chr(250),
4077 'Ucirc' => chr(219),
4078 'ucirc' => chr(251),
4079 'Ugrave' => chr(217),
4080 'ugrave' => chr(249),
4081 'uml' => chr(168),
4082 'Uuml' => chr(220),
4083 'uuml' => chr(252),
4084 'Yacute' => chr(221),
4085 'yacute' => chr(253),
4086 'yen' => chr(165),
4087 },
4088 # Flag set to TRUE if MXP should be allowed to change the font used, set to FALSE
4089 # otherwise
4090 allowMxpFontFlag => TRUE, # [config]
4091 # Flag set to TRUE if MXP should be allowed to display images in textviews, FALSE if
4092 # not
4093 allowMxpImageFlag => TRUE, # [config]
4094 # Flag set to TRUE if MXP should be allowed to download image files it doesn't already
4095 # have, FALSE if not
4096 allowMxpLoadImageFlag => TRUE, # [config]
4097 # Flag set to TRUE if MXP should be allowed to use image files in the world's own
4098 # graphics format (using the <FILTER> tag, FALSE if not
4099 allowMxpFilterImageFlag => TRUE, # [config]
4100 # Flag set to TRUE if MXP should be allowed to play sound/music (if sound is enabled
4101 # generally), set to FALSE otherwise
4102 allowMxpSoundFlag => TRUE, # [config]
4103 # Flag set to TRUE if MXP should be allowed to download sound files it doesn't already
4104 # have, FALSE if not
4105 allowMxpLoadSoundFlag => TRUE, # [config]
4106 # Flag set to TRUE if MXP should be allowed to display gauges/status bars, FALSE if not
4107 allowMxpGaugeFlag => TRUE, # [config]
4108 # Flag set to TRUE if MXP should be allowed to use frames (exterior and interior),
4109 # FALSE if not
4110 allowMxpFrameFlag => TRUE, # [config]
4111 # Flag set to TRUE if MXP should be allowed to use interior frames (when available),
4112 # set to FALSE if only exterior frames should be used (ignored if
4113 # $self->allowMxpFrameFlag is FALSE)
4114 allowMxpInteriorFlag => TRUE, # [config]
4115 # Flag set to TRUE if MXP should be allowed to perform crosslinking operations
4116 # (connect to a new server), FALSE if not
4117 allowMxpCrosslinkFlag => TRUE, # [config]
4118 # Flag set to TRUE if the Locator task should stop looking for room statement anchors
4119 # when it encounters the first MXP 'RoomName', 'RoomDesc', 'RoomExit' or 'RoomNum',
4120 # and to use those exclusively from then on; set to FALSE if the Locator task should
4121 # ignore those MXP tag flags and look for anchor lines as normal
4122 allowMxpRoomFlag => TRUE, # [config]
4123 # Flag set to TRUE if Axmud should recognise some illegal MXP keywords (for example,
4124 # those using hyphens instead of underlines); FALSE if it should only allow legal
4125 # MXP keywords
4126 allowMxpFlexibleFlag => FALSE, # [config]
4127 # Flag set to TRUE if GA::Session should assume that MXP has been negotiated with the
4128 # server (by artificially changing the value of GA::Session->mxpMode from 'no_invite'
4129 # to 'client_agree' once automatic logic is complete); FALSE if Axmud should rely on
4130 # telnet option negoatiation, as normal
4131 # (Can be set to TRUE for IRE MUDs that provide MXP by default, but don't negotiate it
4132 # with the client)
4133 allowMxpPermFlag => FALSE, # [config]
4134 # Flag temporarily set to TRUE when modifying the flags above, if
4135 # $self->set_allowMxpFlag should not issue a new MXP <SUPPORTS> tag, as it normally
4136 # would; usually set to FALSE
4137 mxpPreventSupportFlag => FALSE,
4138  
4139 # Hash of all official Pueblo tags (including those not implemented by Axmud)
4140 constPuebloOfficialHash => {
4141 # http://pueblo.sourceforge.io/doc/manual/html_standard_elements.html
4142 # Document Structure Elements
4143 'BODY' => undef, # partially implemented
4144 'HEAD' => undef, # NOT implemented
4145 'HTML' => undef, # NOT implemented
4146 'TITLE' => undef, # NOT implemented
4147 # Anchor Element
4148 'A' => undef, # partially implemented
4149 # Embed Element
4150 'EMBED' => undef, # NOT implemented
4151 # Image Element
4152 'IMG' => undef, # partially implemented
4153 # Block Formatting Elements
4154 'ADDRESS' => undef, # NOT implemented
4155 'BASEFONT' => undef, # implemented
4156 'BLOCKQUOTE' => undef, # NOT implemented
4157 'BR' => undef, # partially implemented
4158 'CENTER' => undef, # implemented
4159 'H1' => undef, # partially implemented
4160 'H2' => undef, # partially implemented
4161 'H3' => undef, # partially implemented
4162 'H4' => undef, # partially implemented
4163 'H5' => undef, # partially implemented
4164 'H6' => undef, # partially implemented
4165 'HR' => undef, # partially implemented
4166 'LISTING' => undef, # NOT implemented
4167 'P' => undef, # partially implemented
4168 'PLAINTEXT' => undef, # NOT implemented
4169 'PRE' => undef, # partially implemented
4170 'SAMP' => undef, # implemented
4171 'XMP' => undef, # NOT implemented
4172 # Character Formatting Elements
4173 'B' => undef, # implemented
4174 'CITE' => undef, # implemented
4175 'CODE' => undef, # implemented
4176 'EM' => undef, # implemented
4177 'FONT' => undef, # implemented
4178 'I' => undef, # implemented
4179 'STRIKE' => undef, # implemented
4180 'STRONG' => undef, # implemented
4181 'TT' => undef, # implemented
4182 'U' => undef, # implemented
4183 # List Elements
4184 'DL' => undef, # NOT implemented
4185 'DIR' => undef, # NOT implemented
4186 'LI' => undef, # implemented
4187 'MENU' => undef, # NOT implemented
4188 'OL' => undef, # implemented
4189 'UL' => undef, # implemented
4190 # Form Elements
4191 'FORM' => undef, # NOT implemented
4192 'INPUT' => undef, # NOT implemented
4193 'OPTION' => undef, # NOT implemented
4194 'SELECT' => undef, # NOT implemented
4195 'TEXTAREA' => undef, # NOT implemented
4196 # Unsupported HTML elements
4197 'ISINDEX' => undef, # NOT implemented
4198 'KBD' => undef, # NOT implemented
4199 'LINK' => undef, # NOT implemented
4200 'META' => undef, # NOT implemented
4201 'NEXTID' => undef, # NOT implemented
4202 'TABLE' => undef, # NOT implemented
4203 'VAR' => undef, # NOT implemented
4204 # http://pueblo.sourceforge.io/doc/manual/html_pueblo_extensions.html
4205 # Basic extensions to HTML
4206 # 'EVENT' => undef, # an <IMG> attribute, NOT implemented
4207 # 'XCH_HINT' => undef, # an <A> attribute, implemented
4208 'XCH_PAGE' => undef, # partially implemented
4209 'XCH_PANE' => undef, # partially implemented
4210 'XCH_PREFETCH' => undef, # NOT implemented
4211 # 'XCH_PROB' => undef, # <XCH_PREFETCH> attribute, NOT implemented
4212 # Extensions for interactivity
4213 'XCH_CMD' => undef, # an <A> attribute, implemented
4214 # 'XCH_MODE' => undef, # an <IMG> attribute, implemented
4215 'XCH_MUDTEXT' => undef, # implemented
4216 # Extensions for graphics
4217 'XCH_GRAPH' => undef, # NOT implemented
4218 # Extensions for sound
4219 'XCH_SOUND' => undef, # an <IMG> attribute, partially implemented
4220 'XCH_SPEECH' => undef, # NOT implemented
4221 'XCH_VOLUME' => undef, # NOT implemented
4222 'XCH_ALERT' => undef, # implemented
4223 'XCH_DEVICE' => undef, # NOT implemented
4224 # http://pueblo.sourceforge.io/doc/manual/vrml_pueblo_extensions.html
4225 'XCH_CMD_INFO' => undef, # NOT implemented
4226 # http://www.gammon.com.au/forum/?id=281
4227 'COLOR' => undef, # implemented, but not in Pueblo 2.50 spec
4228 'SEND' => undef, # implemented, but not in Pueblo 2.50 spec
4229 },
4230 # Hash of all implemented Pueblo tags (a subset of $self->constPuebloOfficialHash)
4231 constPuebloImplementHash => {
4232 'A' => undef, # partially implemented
4233 'B' => undef,
4234 'BASEFONT' => undef,
4235 'BODY' => undef, # partially implemented
4236 'BR' => undef, # partially implemented
4237 'CENTER' => undef,
4238 'CODE' => undef,
4239 'COLOR' => undef, # implemented, but not in Pueblo 2.50 spec
4240 'EM' => undef,
4241 'FONT' => undef,
4242 'H1' => undef, # partially implemented
4243 'H2' => undef, # partially implemented
4244 'H3' => undef, # partially implemented
4245 'H4' => undef, # partially implemented
4246 'H5' => undef, # partially implemented
4247 'H6' => undef, # partially implemented
4248 'HR' => undef, # partially implemented
4249 'I' => undef,
4250 'IMG' => undef, # partially implemented
4251 'LI' => undef,
4252 'OL' => undef,
4253 'P' => undef, # partially implemented
4254 'PRE' => undef, # partially implemented
4255 'SAMP' => undef, # implemented
4256 'SEND' => undef, # implemented, but not in Pueblo 2.50 spec
4257 'STRIKE' => undef,
4258 'STRONG' => undef,
4259 'TT' => undef,
4260 'U' => undef,
4261 'UL' => undef,
4262 'XCH_ALERT' => undef,
4263 'XCH_MUDTEXT' => undef,
4264 'XCH_PAGE' => undef, # partially implemented
4265 'XCH_PANE' => undef, # partially implemented
4266 },
4267 # Hash of Pueblo tags which are synonyms of other tags, e.g. <B>, <EM> and <STRONG> are
4268 # all equivalent
4269 constPuebloConvertHash => {
4270 'CITE' => 'I',
4271 'EM' => 'B',
4272 'STRONG' => 'B',
4273 },
4274 # Hash of Pueblo modal tags, such as <B> and </I>, that can be 'on' or 'off'
4275 constPuebloModalHash => {
4276 'B' => undef,
4277 'I' => undef,
4278 'STRIKE' => undef,
4279 'U' => undef,
4280 },
4281  
4282 # Hash of ZMP package objects (GA::Obj::Zmp), in the form
4283 # $zmpPackageHash{object_name} = blessed_reference_to_package_object
4284 # ...where 'object_name' is in the form 'PackageName@WorldName' for a ZMP package that
4285 # should be available for any session connected to the world name 'WorldName', or
4286 # 'PackageName@' for a ZMP package that should be available for all sessions
4287 # ZMP package objects should be created by plugins. Creating the object by calling
4288 # GA::Obj::Zmp->new automatically updates this hash
4289 # The hash is not saved in any data file. Package objects cannot be modified once
4290 # created, and must not be removed from this hash once created - you must edit the
4291 # plugin that created and then restart Axmud, instead
4292 zmpPackageHash => {},
4293  
4294 # Constant list of recognised MNES values for CHARSET
4295 # The value used in IVs like $self->charSet, GA::Session->worldCharset and
4296 # GA::Profile::World->worldCharSet is generally provided by the system, and might be
4297 # longer than the values described here (for example, 'koi8-r' instead of the MNES
4298 # value, 'KOI-8')
4299 # Therefore, GA::Session->processNewEnvironData tries to find a close match, rather than
4300 # an exact match, with one of these values. If no match can be found, 'ASCII' is used
4301 # as the default
4302 constMnesCharsetList => [
4303 'ASCII', 'BIG-5', 'ISO-8859-1', 'ISO-8859-2', 'FANSI', 'GB-18030', 'KOI-8', 'UTF-8',
4304 ],
4305 # Flag set to TRUE if MNES should be able to send the user's real IP address (any proxy
4306 # notwithstanding)
4307 allowMnesSendIPFlag => FALSE, # [config]
4308  
4309 # Constant list of MCP packages supported by Axmud by default, and the package versions
4310 # that are supported. List in groups of 4, in the form
4311 # (mcp_package_name, perl_package_name, minimum_version, maximum_version, ...)
4312 # ...where 'minimum_version' and 'maximum_version' refer to the version of the
4313 # package itself, not the version of MCP that Axmud uses (2.1)
4314 constMcpPackageList => [
4315 # Official packages
4316 'mcp-negotiate',
4317 'Games::Axmud::Mcp::NegotiateCan',
4318 '1.0',
4319 '2.0',
4320 'mcp-cord',
4321 'Games::Axmud::Mcp::Cord',
4322 '1.0',
4323 '1.0',
4324 # Non-official packages
4325 'dns-org-mud-moo-simpleedit',
4326 'Games::Axmud::Mcp::SimpleEdit',
4327 '1.0',
4328 '1.0',
4329 ],
4330 # Hash of MCP package objects, inheriting from GA::Generic::MCP. The hash includes
4331 # the packages specified in $self->constMcpPackageList, as well as any MCP package
4332 # pbjects added by plugins (via a call to $self->addPluginMcpPackages)
4333 # When a GA::Session wants to use a plugin, it clones the MCP package object, placing
4334 # the clone into its own ->mcpPackageHash IV
4335 # Hash in the form
4336 # $mcpPackageHash{package_name} = blessed_reference_to_package_object
4337 mcpPackageHash => {},
4338  
4339 # Constant list of terminal types currently supported by Axmud. The first item in the
4340 # list also serves as the 'default' terminal type, if it is needed. The last item in
4341 # the list must be 'unknown', and is sent to the server during telnet option
4342 # negotiations, if the server doesn't recognise anything else
4343 # Axmud supports xterm trucolor (https://tintin.mudhalla.net/info/truecolor/), so the
4344 # 'xterm-truecolor' item communicates this support to the server
4345 # For the 'xterm' item, Axmud does not do full xterm-emulation; it merely recognises
4346 # xterm-256 colours used by some MUDs (as well as OSC colour palette support)
4347 constTermTypeList => [
4348 'ansi', 'vt100', 'xterm-truecolor', 'xterm', 'dumb', 'unknown',
4349 ],
4350 # Which information is sent to the server during TTYPE option negotiations (when
4351 # $self->useMttsFlag is FALSE):
4352 # 'send_nothing' - (Nothing sent - should be set to 0 if ->useTTypeFlag is FALSE)
4353 # 'send_client' - Send the client name, followed by everything in
4354 # ->constTermTypeList (one at a time)
4355 # 'send_client_version'
4356 # - Send the client name and version (as a single string), followed by
4357 # everything in ->constTermTypeList (one at a time)
4358 # 'send_custom_client'
4359 # - Send a customised client name and customised client version,
4360 # followed by everything in ->constTermTypeList (one at a time)
4361 # 'send_default' - Send everything in ->constTermTypeList (one at a time)
4362 # 'send_unknown' - Send 'unknown'
4363 #
4364 # NB For modes 'send_client', 'send_client_version', 'send_custom_client',
4365 # 'send_default', if the current world profile's ->termType is set, that is sent
4366 # first, before everything else
4367 # NB When $self->useMttsFlag is TRUE, ->termTypeMode is ignored. We send the client
4368 # name, followed by either the world profile's ->termType (if set) or 'xterm'
4369 # (if not set), followed by the MTTS message
4370 # NB This IV, as well as ->customClientName and ->customClientVersion, are also used by
4371 # MXP, ZMP and MNES.
4372 termTypeMode => 'send_client', # [config]
4373 # In mode 'send_custom_client' (or when $self->useMttsFlag is TRUE), the customised
4374 # client name to send (if 'undef' or an empty string, it is not sent, instead the
4375 # first item in ->constTermTypeList is sent)
4376 customClientName => '', # [config]
4377 # In mode 'send_custom_client' (or when $self->useMttsFlag is TRUE), the customised
4378 # client version to send (if 'undef', or an empty string, or if ->customClientName is
4379 # 'undef' or an empty string, it is not sent at all)
4380 customClientVersion => '', # [config]
4381  
4382 # Flag set to TRUE if VT100 control sequences should be accepted. If FALSE, they are
4383 # ignored (and 'vt100' is not used in terminal type negotations)
4384 # (Even when FALSE, escape sequences in the form 'ESC [ value ; value m' are still
4385 # accepted
4386 useCtrlSeqFlag => TRUE, # [config]
4387 # Flag set to TRUE if a visible cursor should be displayed in each session's default
4388 # textview (only really useful for VT100 emulation, but available all the time)
4389 useVisibleCursorFlag => FALSE, # [config]
4390 # Flag set to TRUE if a visible cursor should blink quickly; FALSE if it should blink at
4391 # a normal rate. Ignored if ->useVisibleCursorFlag is FALSE
4392 useFastCursorFlag => FALSE, # [config]
4393 # Flag set to TRUE if certain keycodes should be sent directly to the world, FALSE
4394 # otherwise
4395 # In addition, when TRUE and a session's special echo mode is enabled, world commands
4396 # are sent to the world immediately, each character sent as soon as it's typed
4397 # NB In Axmud blind mode, the escape and cursor keys are hijacked for use with TTS.
4398 # Users can use the ';freekeys' command to temporarily release them for use as direct
4399 # keys (or for any other reason)
4400 useDirectKeysFlag => FALSE, # [config]
4401 # Keycodes available in numeric keypad alternate mode (GA::Session->ctrlKeypadMode is
4402 # 'alternate') and cursor key application mode (GA::Session->ctrlCursorMode is
4403 # 'application') (assuming that $self->useDirectKeysFlag is TRUE)
4404 constDirectAppKeysHash => {
4405 'up' => chr(27) . 'OA',
4406 'down' => chr(27) . 'OB',
4407 'right' => chr(27) . 'OC',
4408 'left' => chr(27) . 'OD',
4409 },
4410 # Constant hashes of Axmud keycodes and their corresponding VT100 escape sequences
4411 # Keycodes available in numeric keypad alternate mode (GA::Session->ctrlKeypadMode is
4412 # 'alternate') (assuming that $self->useDirectKeysFlag is TRUE)
4413 constDirectAltKeysHash => {
4414 'kp_enter' => chr(27) . 'OM',
4415 # 'kp_comma' => chr(27) . 'Ol', # This Axmud keycode doesn't exist
4416 'kp_subtract' => chr(27) . 'Om',
4417 'kp_0' => chr(27) . 'Op',
4418 'kp_1' => chr(27) . 'Oq',
4419 'kp_2' => chr(27) . 'Or',
4420 'kp_3' => chr(27) . 'Os',
4421 'kp_4' => chr(27) . 'Ot',
4422 'kp_5' => chr(27) . 'Ou',
4423 'kp_6' => chr(27) . 'Ov',
4424 'kp_7' => chr(27) . 'Ow',
4425 'kp_8' => chr(27) . 'Ox',
4426 'kp_9' => chr(27) . 'Oy',
4427 },
4428 # Keycodes available at all times (assuming that $self->useDirectKeysFlag is TRUE, and
4429 # the previous two hashes take precedence)
4430 constDirectKeysHash => {
4431 'up' => chr(27) . '[A',
4432 'down' => chr(27) . '[B',
4433 'right' => chr(27) . '[C',
4434 'left' => chr(27) . '[D',
4435 'num_lock' => chr(27) . 'OP', # PF1 / not available on MSWin/*BSD
4436 'kp_divide' => chr(27) . 'OQ', # PF2
4437 'kp_multiply' => chr(27) . 'OR', # PF3
4438 'kp_subtract' => chr(27) . 'OS', # PF4
4439 },
4440 # Constant hash of Axmud keycodes which must be intercepted by a ->signal_connect in
4441 # GA::Win::Internal->setKeyPressEvent and sent to the world, whenever a session's
4442 # special echo mode is enabled
4443 constDirectSpecialKeysHash => {
4444 'escape' => chr(27),
4445 'tab' => chr(11),
4446 'backspace' => chr(8),
4447 'delete' => chr(127),
4448 },
4449  
4450 # Debugging flag set to TRUE if invalid escape sequences should be displayed as 'debug'
4451 # messages, FALSE otherwise
4452 debugEscSequenceFlag => FALSE, # [config]
4453 # Debugging flag set to TRUE if incoming option negotiations should be displayed as
4454 # 'debug' messages, FALSE otherwise
4455 debugTelnetFlag => FALSE, # [config]
4456 # Parallel debugging flag set to TRUE if a very short 'debug' message should be
4457 # displayed for incoming option negotiations (ignored if ->debugTelnetFlag is TRUE)
4458 debugTelnetMiniFlag => FALSE, # [config]
4459 # Debugging flag set to TRUE if GA::Obj::Telnet should write its own logfile for
4460 # option negotiations, telopt.log (store in Axmud's base directory)
4461 debugTelnetLogFlag => FALSE, # [config]
4462 # Debugging flag set to TRUE if MSDP data sent to Status/Locator tasks should be
4463 # displayed as 'debug' messages, FALSE otherwise
4464 debugMsdpFlag => FALSE, # [config]
4465 # Debugging flag set to TRUE if MXP errors should be displayed as 'debug' messages,
4466 # FALSE otherwise
4467 debugMxpFlag => FALSE, # [config]
4468 # Debugging flag set to TRUE if MXP comment elements should be displayed as 'debug'
4469 # messages, FALSE otherwise
4470 debugMxpCommentFlag => FALSE, # [config]
4471 # Debugging flag set to TRUE if Pueblo errors should be displayed as 'debug' messages,
4472 # FALSE otherwise
4473 debugPuebloFlag => FALSE, # [config]
4474 # Debugging flag set to TRUE if Pueblo comment elements should be displayed as 'debug'
4475 # messages, FALSE otherwise
4476 debugPuebloCommentFlag => FALSE, # [config]
4477 # Debugging flag set to TRUE if ZMP data should be displayed as 'debug' messages, FALSE
4478 # otherwise
4479 debugZmpFlag => FALSE, # [config]
4480 # Debugging flag set to TRUE if incoming ATCP data should be displayed as 'debug'
4481 # messages, FALSE otherwise
4482 debugAtcpFlag => FALSE, # [config]
4483 # Debugging flag set to TRUE if incoming GMCP data should be displayed as 'debug'
4484 # messages, FALSE otherwise
4485 debugGmcpFlag => FALSE, # [config]
4486 # Debugging flag set to TRUE if MCP errors should be displayed as 'debug' messages,
4487 # FALSE otherwise
4488 debugMcpFlag => FALSE, # [config]
4489  
4490 # Desktop and display settings
4491 # ----------------------------
4492  
4493 # Display variables
4494 # Axmud makes use of a number of windows, both those it creates and 'external' windows
4495 # it doesn't create
4496 # 'grid' windows are permanent (or semi-permanent). Axmud tries to arrange these windows
4497 # so they don't overlap or, if there isn't enough room on the workspace, to make them
4498 # overlap in sensible ways. Axmud tries to take account of the different desktop
4499 # environments in getting the positioning of its windows right. 'grid' windows can
4500 # include 'external' windows, such as media players, so that they don't overlap
4501 # Axmud's own windows (if required)
4502 # 'free' windows are temporary, and are displayed in the middle of the workspace without
4503 # regard for the positioning of any 'grid' windows
4504 # If your system has multiple workspaces available, 'grid' windows can be arranged on
4505 # each one of them. Each workspace can have one or more 'workspace grids' on which
4506 # 'grid' windows for that workspace are arranged
4507 #
4508 # NB Recent Axmud versions can draw task windows and the Automapper window inside the
4509 # 'main' window, as well as in separate 'grid' windows, as before. These are called
4510 # 'pseudo-windows'. Their ->number IV is always -1, and they don't appear in registry
4511 # hashes of windows. This feature is experimental, so in general comments don't
4512 # mention them
4513 #
4514 # There are two modes for handling windows in multiple sessions, according to the
4515 # setting of this flag:
4516 # TRUE (traditional) : All sessions share a single 'main' window. The 'main'
4517 # window's Gtk3::Grid contains one table object, a pane object
4518 # (GA::Table::Pane) which displays text received from each session's world
4519 # in a separate tab. No other widgets are allowed on the table. Other
4520 # 'internal' windows may be visible; on each workspace, they are arranged on
4521 # workspace grids belonging to their session (on every workspace, one
4522 # workspace grid for every session). The current session is the one whose tab
4523 # is visible; only its 'internal' windows are visible; 'internal' windows
4524 # controlled by other sessions are not visible (usually minimised)
4525 # FALSE: All sessions have their own 'main' window. The 'main' window's
4526 # Gtk3::Grid contains at least one pane object, but can also contain other
4527 # table widgets (including other pane objects). Other 'internal' windows are
4528 # arranged on a workspace grid shared by all sessions (one workspace grid for
4529 # every workspace in use). When the current session changes, no windows are
4530 # made visible or invisible (usually minimised or un-minimised)
4531 shareMainWinFlag => TRUE, # [config]
4532 # When the user wants to change the setting of ->shareMainWinFlag, the change can't be
4533 # applied immediately.
4534 # Instead, this IV is set to 'on' or 'off'. When Axmud next starts, if this IV is not
4535 # set to 'default', ->shareMainWinFlag is set to TRUE (for 'on') or FALSE (for 'off');
4536 # ->restartShareMainWinMode is then set back to 'default'
4537 restartShareMainWinMode => 'default', # [config]
4538 # Workspace grids can be available, or not. GA::Obj::Desktop->gridPermitFlag is set to
4539 # FALSE if workspace grids are not available at all (because the desktop is too small,
4540 # because Axmud is running on MS Windows or running in blind mode, etc)
4541 # Independent of that flag is this one, which the user can set with
4542 # ';activategrid' and ';disactivategrid'. When Axmud starts, it tries to create
4543 # workspace grids if this flag and GA::Obj::Desktop->gridPermitFlag are both TRUE
4544 activateGridFlag => TRUE, # [config]
4545 # When workspace grids are not available, Axmud can try to remember the size and
4546 # position of its 'grid' windows. Users can adjust the size/positions manually, and
4547 # have those settings applied in future sessions
4548 # Flag set to TRUE if Axmud should try to remember the size and position of 'grid'
4549 # windows, FALSE if not (can be TRUE even if workspace grids are available)
4550 storeGridPosnFlag => FALSE, # [config]
4551 # When ->storeGridPosnFlag is TRUE, Axmud uses this hash to store the size/position of
4552 # each 'grid' window with a unique ->winName (e.g. 'main', 'status_task', 'map').
4553 # When it's FALSE, this hash is not updated at all
4554 # A key-value pair is created when a 'grid' window is created, if there's not already a
4555 # matching entry in the hash
4556 # If a 'grid' window is created when workspace grids are not available, and if there's
4557 # an entry in this hash with the same ->winName, that entry is used for the size and
4558 # position of the new 'grid' window. If, on the other hand, workspace grids are
4559 # available, then the new window's size and position is set by the workspace grid code
4560 # If a 'grid' window is resized (by code or manually by the user) and it's either the
4561 # only window with the same ->winName open, or the first one of that ->winName that
4562 # was opened, then the entry in this hash is updated
4563 # 'External' windows are never added to this hash
4564 # Hash in the form
4565 # ->storeGridPosnHash{window_name} = list_reference
4566 # ...where 'list_reference' is a reference to a list in the form (x y width height). At
4567 # least one of the four values must be defined. When a 'grid' window is created and
4568 # workspace grids aren't available, the posn is only used if both 'x' and 'y' are
4569 # defined, and the size is only used if both 'width' and 'height' are defined. Those
4570 # are the minimum requirements; in actual use, Axmud's code almost certainly delivers
4571 # an entry with all four values defined
4572 storeGridPosnHash => {}, # [config]
4573 #
4574 # Constant hash of standard 'grid' window types (any type of window that can be put onto
4575 # a workspace grid; includes 'external' windows, but doesn't include the object viewer
4576 # window, 'edit' windows, 'pref' windows, 'dialogue' windows etc)
4577 # NB 'Internal' windows are a sub-class of 'grid' window handled by GA::Win::Internal,
4578 # consisting of the window types 'main', 'protocol' and 'custom'
4579 # Hash in the form
4580 # $constWinTypeHash{window_type} = 'undef'
4581 # ...where 'window_type' matches GA::Generic::GridWin->winType
4582 constGridWinTypeHash => {
4583 # Any 'grid' window used as a 'main' window by any session (can be created only by
4584 # GA::Client or GA::Session)
4585 'main' => undef,
4586 # Any 'grid' window used as an Automapper window (can be created by any code)
4587 'map' => undef,
4588 # Any 'grid' window created by a MUD protocol such as MXP (can be created only by
4589 # GA::Session)
4590 'protocol' => undef,
4591 # Any 'grid' window NOT used as a 'main' window by any session (besides 'map' and
4592 # 'protocol' windows), whose widgets can't be customised (can be created by any
4593 # code)
4594 'fixed' => undef,
4595 # Any 'grid' window NOT used as a 'main' window by any session (besides 'map' and
4596 # 'protocol' windows), whose widgets can be customised (e.g. windows controlled
4597 # by individual tasks; can be created by any code)
4598 'custom' => undef,
4599 # Any 'external' window (not created by Axmud, but which has been placed on a
4600 # workspace grid, such as media players (can be created only by GA::Session)
4601 'external' => undef,
4602 },
4603 # Constant hash of standard 'free' window types (temporary windows that can't be put
4604 # onto a workspace grid)
4605 # Hash in the form
4606 # $constFreeWinTypeHash{window_type} = 'undef'
4607 # ...where 'window_type' matches GA::Generic::FreeWin->winType
4608 constFreeWinTypeHash => {
4609 # The object viewer window
4610 'viewer' => undef,
4611 # All 'edit' windows
4612 'edit' => undef,
4613 # All preference windows (collectively, 'edit' and 'pref' windows are called
4614 # 'config' windows)
4615 'pref' => undef,
4616 # All wizard windows
4617 'wiz' => undef,
4618 # All 'dialogue' windows
4619 'dialogue' => undef,
4620 # Any other kind of temporary window can use this window type
4621 'other' => undef,
4622 },
4623 #
4624 # The layout of 'internal' windows can be customised. The 'plan' for arranging widgets
4625 # in an 'internal' window is called a winmap, and is handled by a GA::Obj::Winmap
4626 # object
4627 # The winmap divides the window's client area into horizontal (by default) or vertical
4628 # strips (conceptually, not using a specific Gtk3 widget)
4629 # The winmap only affects the window when it is first created (or when it is reset).
4630 # The Axmud code is then free to add/remove strips, or add/remove/resizes widgets
4631 # within the Gtk3::Grid, whenever it pleases
4632 # Axmud has several standard winmaps, which can't be modified by the user (but which
4633 # can be cloned, and the clones are modifiable)
4634 # 'main_wait' - The winmap used in the spare 'main' window visible when Axmud starts,
4635 # before the first session is created. From top to bottom, the window will contain
4636 # a menu bar, toolbar, Gtk3::Grid and an entry box. The Gtk3::Grid contains no
4637 # table objects
4638 # 'internal_wait' - The equivalent of 'main_wait' for 'internal' windows other than
4639 # 'main' windows. It's probably not required by anything, but is available
4640 # nonetheless. The window contains only one strip object, the compulsory
4641 # GA::Strip::Table; it contains no table objects
4642 # 'main_fill' - The default winmap for 'main' windows. From top to bottom, the window
4643 # will contain a menu bar, toolbar, Gtk3::Grid, a gauge box, an entry box and an
4644 # info box. The Gtk3::Grid contains a single pane object (GA::Table::Pane, which
4645 # consists of one or two Gtk3::TextViews sharing a single Gtk3::TextBuffer)
4646 # filling the whole table
4647 # 'main_part' - The same as 'main_fill', but the single pane object fills two-thirds
4648 # of the left-hand side of the table, leaving the remaining third empty for other
4649 # widgets
4650 # 'main_empty' - The same as 'main_fill', but the Gtk3::Grid is empty
4651 # 'basic_fill' - The default winmap for 'internal' windows besides 'main' windows.
4652 # Contains only a Gtk3::Grid. The Gtk3::Grid contains a single pane object
4653 # filling the whole table
4654 # 'basic_part' - The same as 'basic_fill', but the single pane object fills only the
4655 # lower quarter of the table, leaving plenty of room for other widgets
4656 # 'basic_empty' - The same as 'basic_fill', but the Gtk3::Grid is empty
4657 # 'entry_fill' - From top to bottom, contains a Gtk3::Grid and an entry box. The
4658 # Gtk3::Grid contains a single pane object filling the whole table
4659 # 'entry_part' - The same as 'entry_fill', but the single pane object fills only the
4660 # lower quarter of the table, leaving plenty of room for other widgets
4661 # 'entry_empty' - The same as 'entry_fill', but the Gtk3::Grid is empty
4662 # Constant registry hash of standard winmap names, in the form
4663 # $constWinmapNameHash->{name} = undef
4664 constWinmapNameHash => {
4665 'main_wait' => undef,
4666 'main_fill' => undef,
4667 'main_part' => undef,
4668 'main_empty' => undef,
4669 'basic_fill' => undef,
4670 'basic_part' => undef,
4671 'basic_empty' => undef,
4672 'entry_fill' => undef,
4673 'entry_part' => undef,
4674 'entry_empty' => undef,
4675 },
4676 # Registry hash of blessed references to all winmap objects. Names have max of 16 chars.
4677 # Hash in the form
4678 # $winmapHash{name} = blessed_reference_to_winmap_object
4679 winmapHash => {}, # [winmaps]
4680 # A hash containing only the 'standard' winmap objects, a subset of
4681 # $self->winmapHash (filled by GA::Obj::Winmap->setupStandardWinmap)
4682 standardWinmapHash => {}, # [winmaps]
4683 # The name of the default winmaps to use when a 'main' window or other 'internal'
4684 # window object is created
4685 # Constant default values for the winmaps (these values never change)
4686 # Default winmap for 'main' windows when workspace grids are enabled
4687 # ($self->activateGridFlag = TRUE)
4688 constDefaultEnabledWinmap => 'main_fill',
4689 # Default winmap for 'main' windows when workspace grids are disabled
4690 # ($self->activateGridFlag = FALSE)
4691 constDefaultDisabledWinmap => 'main_part',
4692 # Default winmap for other 'internal' windows besides 'main' windows
4693 constDefaultInternalWinmap => 'basic_fill',
4694 # Customisable default values for the winmaps
4695 defaultEnabledWinmap => undef, # [winmaps] Set below
4696 defaultDisabledWinmap => undef, # [winmaps] Set below
4697 defaultInternalWinmap => undef, # [winmaps] Set below
4698 #
4699 # A workspace grid is divided into 'gridblocks'. The size of a gridblock can be changed,
4700 # but the default size is 10x10 pixels (min 1, max 100)
4701 # 'Grid' windows are moved and resized to fit on a workspace grid, leaving no partially-
4702 # filled gridblocks, and no gridblocks with more than one window occupying them
4703 # In fact, a workspace grid exists in three dimensions, allowing Axmud to stack windows
4704 # on top of each other when the workspace grid is full. The default number of layers
4705 # is 16 and the layer at the bottom is the default one. (Both of these values can be
4706 # changed.)
4707 # 'Grid' windows are usually placed in the default layer. If there's no room for them
4708 # there, they're placed in the first available layer below; if there are no available
4709 # layers below (which will be the case, if the default layer is at the bottom),
4710 # they're placed in the first available layer above
4711 # Constant default value for a workspace griblock
4712 # (This value never changes; min - 1 pixel, max - 100)
4713 constGridBlockSize => 10,
4714 # Customisable default size for a workspace gridblock
4715 gridBlockSize => undef, # [config] Set below
4716 #
4717 # The 'plan' for a workspace grid is called a zonemap. Zonemaps are 60x60 grids,
4718 # regardless of the size of the workspace.
4719 # A zonemap is filled with zone models. Zone models are a 'plan' for an individual zone
4720 # on a workspace grid
4721 #
4722 # PLAN ACTUAL
4723 # zonemap -> workspace grid
4724 # zone model -> zone
4725 #
4726 # Axmud will try to make the zonemap fit onto the workspace grid as closely as possible,
4727 # but because of the irregular size of some workspaces, zones in the zonemap might not
4728 # be in exactly the same proportions as zones in the gridmap.
4729 # Axmud has several standard zonemaps, which can't be modified by the user (but which
4730 # can be cloned, and the clones are modifiable)
4731 # 'single' - The entire workspace is covered by a single zone. Windows (even 'main'
4732 # windows) use their default sizes. Windows cannot be stacked above each other
4733 # 'single2' - A modified version of 'single', in which windows can be stacked above
4734 # each other
4735 # 'basic' - Intended for use when $self->shareMainWinFlag = TRUE. There are two zones.
4736 # The first zone covers the left-hand 2/3 of the workspace and is reserved for a
4737 # single 'main' window. The other zone covers the right-hand 1/3 of the workspace
4738 # and is available for all 'grid' windows (and only those windows can be stacked
4739 # above each other). The first 'main' window expands to fill the whole of its
4740 # zone. Other windows use their default sizes
4741 # 'extended' - Intended for use when $self->shareMainWinFlag = TRUE. The left-hand 2/3
4742 # of the workspace is reserved for a single 'main' window and the Status and
4743 # Locator task windows. The task windows go above the first 'main' window; the
4744 # Status window is to the left of the Locator window. The right-hand 1/3 of the
4745 # workspace is reserved for a single 'map' window at the top half and any other
4746 # 'grid' windows at the bottom half (and only those windows can be stacked above
4747 # each other)
4748 # 'widescreen' - A modified version of 'extended' for widescreen monitors, with the
4749 # the workspace divided into halves, rather than a 2/3 - 1/3 split
4750 # 'horizontal' - Intended for use when $self->shareMainWinFlag = FALSE. The workspace
4751 # is divided into two halves, left and right, with each half occupied by a single
4752 # session's windows. Inside the half, the 'main' window is at the bottom, and
4753 # other windows are at the top. Windows cannot be stacked above each other
4754 # 'horizontal2' - A modified version of 'horizontal', in which windows can be stacked
4755 # above each other
4756 # 'vertical' - Intended for use when $self->shareMainWinFlag = FALSE. The workspace is
4757 # divided into two halves, top and bottom, with each half occupied by a single
4758 # session's windows. Inside the half, the 'main' window is on the left, and other
4759 # windows are on the right. Windows cannot be stacked above each other
4760 # 'vertical2' - A modified version of 'vertical', in which windows can be stacked
4761 # above each other
4762 # Constant registry hash of standard zonemap names, in the form
4763 # $constZonemapHash->{name} = undef
4764 # $constZonemapHash->{name} = clone_from_standard_zonemap_called_this
4765 constZonemapHash => {
4766 'single' => undef,
4767 'single2' => 'single',
4768 'basic' => undef,
4769 'extended' => undef,
4770 'widescreen' => undef,
4771 'horizontal' => undef,
4772 'horizontal2' => 'horizontal',
4773 'vertical' => undef,
4774 'vertical2' => 'vertical',
4775 },
4776 # Registry hash of blessed references to all zonemap objects. Names have max of 16
4777 # chars. Hash in the form
4778 # $zonemapHash{unique_zonemap_name} = blessed_reference_to_zonemap_object
4779 zonemapHash => {}, # [zonemaps]
4780 # A hash containing only the 'standard' zonemap objects, a subset of
4781 # $self->zonemapHash (filled by GA::Obj::Zonemap->setupStandardZonemap)
4782 standardZonemapHash => {}, # [zonemaps]
4783 # Constant registry hash which specifies how many workspaces to use on startup, and the
4784 # default zonemaps for each one. Hash in the form
4785 # $constInitWorkspaceHash{unique_number} = default_zonemap_name
4786 constInitWorkspaceHash => {
4787 0 => 'basic',
4788 },
4789 # Customisable registry hash of workspaces to use on startup. The default workspace has
4790 # the 'unique_number' 0, and corresponds to the workspace in which Axmud starts. Any
4791 # further workspaces should be numbered consecutively (1, 2, 3...). If a key-value
4792 # pair is removed, subsequent key-value pairs must be renumbered
4793 # This hash is only used on startup; the workspaces currently in use are stored in
4794 # GA::Obj::Desktop->workspaceHash
4795 # Hash in the form
4796 # $initWorkspaceHash{unique_number} = default_zonemap_name
4797 # $initWorkspaceHash{unique_number} = 'undef'
4798 # NB If 'undef' is specified, GA::Obj::Desktop->useWorkspace chooses a zonemap based on
4799 # the current value of $self->shareMainWinFlag
4800 initWorkspaceHash => {}, # [config] Set below
4801 # Constant direction of workspace use. If $self->initWorkspaceHash specifies we should
4802 # use two or more workspaces at startup, this IV specifies in which direction we
4803 # should move, after finding the default workspace:
4804 # 'move_left' - move left from the default workspace until we reach the
4805 # left-most workspace (and then stop)
4806 # 'move_right' - move right from the default workspace until we reach the
4807 # right-most workspace (and then stop)
4808 # 'start_left' - after finding the default workspace, the next workspace
4809 # should be the left-most one, after that move right until we
4810 # reach the right-most workspace (and then stop)
4811 # 'start_right' - after finding the default workspace, the next workspace
4812 # should be the right-most one, after that move left until we
4813 # reach the left-most workspace (and then stop)
4814 constInitWorkspaceDir => 'move_right',
4815 # Customisable direction of workspace use
4816 initWorkspaceDir => undef, # [config] Set below
4817 #
4818 # Sometimes a window almost fills a zone, leaving gaps of just a few gridblocks here and
4819 # there. When a new window is created, GA::Obj::Zone->adjustSingleWin can remedy this
4820 # situation by expanding the window to remove the small gap between it and the edge of
4821 # its zone
4822 # If the zone has a maximum number of windows, then the biggest gap (measured in
4823 # gridblocks) that GA::Obj::Zone->adjustSingleWin can fix is the maximum number of
4824 # windows, minus 1. (A gap that's the same size as the maximum windows shouldn't
4825 # exist)
4826 # Otherwise, the size of the maximum gap is stored in this IV. This IV holds the maximum
4827 # size of the gap between a window and an edge of the grid, in gridblocks, that can be
4828 # removed by the function.
4829 # When gridblocks are their default size (10 pixels), a good value for this IV is 1 or
4830 # 2. 3 would be ok, but 4 is probably too much. When set to 0, gaps will not be
4831 # removed at all.
4832 # Constant default size for the grid gap (this value never changes; min: 0, max: 100)
4833 constGridGapMaxSize => 2,
4834 # Customisable default value for the grid gap
4835 gridGapMaxSize => 2, # [config]
4836 # When there are a larger gaps in a zone, and if the windows in the zone are all the
4837 # same width (or all the same height), GA::Obj::Zone->adjustMultipleWin can adjust
4838 # the size of all of the windows at the same time to either remove the gap (if it is
4839 # small), or to increase the gap to make room for another window (if it is big).
4840 # This flag is set to TRUE if adjustments are allowed, FALSE if not
4841 gridAdjustmentFlag => TRUE, # [config]
4842 # When the available workspace is an arkward size (i.e. not exactly divisible by
4843 # $self->gridBlockSize) there may be a small gap on the right and bottom edges of the
4844 # workspace grid. GA::Obj::WorkspaceGrid->fineTuneWinSize can close the gap, if this
4845 # flag is set to TRUE
4846 gridEdgeCorrectionFlag => TRUE, # [config]
4847 # When a window is deleted in the middle of the zone, the resulting empty space
4848 # doesn't look very attractive. If this flag is TRUE, when a window is deleted, other
4849 # windows are re-shuffled to move them closer to the zone's starting corner, moving
4850 # the gap to the opposite end
4851 gridReshuffleFlag => TRUE, # [config]
4852 # When a GA::Session is no longer a current session, its workspace 'grid' windows must
4853 # be hidden. When it becomes a current session again, those windows must be un-hidden
4854 # (this doesn't apply to the 'main' window, which is always visible)
4855 # If this flag is set to TRUE, the windows become invisible; if the flag is set to
4856 # FALSE, they are merely minimised
4857 gridInvisWinFlag => FALSE, # [config]
4858 #
4859 # The maximum and minimum sizes of workspace that Axmud allows. If the workspace is
4860 # bigger than the maximum, Axmud will use less than the whole workspace. If the
4861 # workspace is smaller than the minimum, Axmud will only allow a single 'grid' window
4862 # (as well as any number of 'free' windows) to open, workspace grids will be disabled
4863 constWorkspaceMaxWidth => 3200,
4864 constWorkspaceMaxHeight => 3200,
4865 constWorkspaceMinWidth => 800,
4866 constWorkspaceMinHeight => 600,
4867 #
4868 # Default window sizes
4869 # Constant default size for windows of the type 'main'. (Any window is allowed to use
4870 # these values. The constant values never change. Min: 100, max:
4871 # ->constWorkspaceMaxWidth / ->constWorkspaceMaxHeight)
4872 constMainWinWidth => 800,
4873 constMainWinHeight => 600,
4874 # Customisable default size for windows of the type 'main'
4875 customMainWinWidth => undef, # [config] Set below
4876 customMainWinHeight => undef, # [config] Set below
4877 # Constant default spacing values for 'main' windows (in pixels)
4878 constMainBorderPixels => 5,
4879 constMainSpacingPixels => 5,
4880 #
4881 # Constant default size for other 'grid' windows besides those of the type 'main'. (Not
4882 # used very often, because GA::Obj::Zone defines its own default window size. Any
4883 # window is allowed to use these values. The constant values never change. Min: 100,
4884 # max: ->constWorkspaceMaxWidth / ->constWorkspaceMaxHeight)
4885 constGridWinWidth => 400,
4886 constGridWinHeight => 300,
4887 # Customisable default size for task windows
4888 customGridWinWidth => undef, # [config] Set below
4889 customGridWinHeight => undef, # [config] Set below
4890 # Constant default spacing values for other 'grid' windows (in pixels)
4891 constGridBorderPixels => 5,
4892 constGridSpacingPixels => 5,
4893 #
4894 # Constant default size for 'free' windows. (Any window is allowed to use these values,
4895 # but 'dialogue' windows usually specify their own size. The constant values never
4896 # change. Min: 100, max: ->constWorkspaceMaxWidth / ->constWorkspaceMaxHeight)
4897 constFreeWinWidth => 700,
4898 constFreeWinHeight => 500,
4899 # Customisable default size for 'free' windows
4900 customFreeWinWidth => undef, # [config] Set below
4901 customFreeWinHeight => undef, # [config] Set below
4902 # Constant default spacing values for 'free' windows (in pixels)
4903 constFreeBorderPixels => 5,
4904 constFreeSpacingPixels => 5,
4905 # Unfortunately, when we display labels in Axmud 'dialogue' windows, we usually have to
4906 # break up the text into separate lines (as Gtk+ no longer handles that)
4907 # The maximum number of characters per line, when that is done
4908 constDialogueLabelSize => 50,
4909 #
4910 # The edges of the workspace may not be available to windows because of panels (called
4911 # 'taskbars' in MS Windows). These IVs hold the sizes, in pixels, of the area
4912 # unavailable on each edge of the workspace. If 0, Axmud assumes windows can be placed
4913 # at the edges (min: 0, max left+right: ->constWorkspaceMaxWidth, max top+bottom:
4914 # ->constWorkspaceMaxHeight)
4915 # Constant size of a workspace panel (this value never changes)
4916 constPanelSize => 0,
4917 # Constant default sizes for panels, used when no panels can be detected at all. We'll
4918 # assume that it's most likely that people have a single panel at the bottom of the
4919 # workspace; let's also assume that it's quite big
4920 constPanelLeftSize => 0,
4921 constPanelRightSize => 0,
4922 constPanelTopSize => 0,
4923 constPanelBottomSize => 50,
4924 # Customisable sizes for panel sizes. Axmud assumes any sizes that are defined here are
4925 # valid for all workspaces. For any sizes that are not defined, Axmud tries to detect
4926 # the sizes for each workspace it uses. If detection fails, Axmud uses the constant
4927 # values just above
4928 customPanelLeftSize => undef, # [config]
4929 customPanelRightSize => undef, # [config]
4930 customPanelTopSize => undef, # [config]
4931 customPanelBottomSize => undef, # [config]
4932 #
4933 # Window controls are the edges of any windows, typically including a border on all
4934 # four sides, and a window name at the top. The sizes of window controls are
4935 # required when moving windows around the workspace, so Axmud tests window controls on
4936 # each workspace it uses. (It's rather unlikely that different workspaces will use
4937 # different window controls, but Axmud checks for that possibility anyway)
4938 # Constant default size for window controls (this value never changes; min: 0 pixels,
4939 # max: 100)
4940 constControlsSize => 0,
4941 # Constant default sizes for window controls, used when the window controls test fails.
4942 # (These values never change; based on Linux Mint 18 using Cinnamon)
4943 constControlsLeftSize => 1,
4944 constControlsRightSize => 1,
4945 constControlsTopSize => 25,
4946 constControlsBottomSize => 1,
4947 # Customisable sizes for window controls. If all four sizes here are defined, Axmud
4948 # uses them for all workspaces. If even one size is not defined, Axmud tries to detect
4949 # window controls sizes in every workspace it uses. If detection fails, Axmud uses the
4950 # constant values just above
4951 customControlsLeftSize => undef, # [config]
4952 customControlsRightSize => undef, # [config]
4953 customControlsTopSize => undef, # [config]
4954 customControlsBottomSize => undef, # [config]
4955 #
4956 # Constant default colour scheme for the pane objects (GA::Table::Pane), each of which
4957 # displays a Gtk3::TextView in an 'internal' windows
4958 # (These values never change; each value MUST be a standard colour tag, not an Xterm or
4959 # RGB colour tag)
4960 constTextColour => 'white',
4961 constUnderlayColour => 'ul_black',
4962 constBackgroundColour => 'black',
4963 constFont => 'monospace',
4964 constFontSize => 10,
4965 # In Pueblo mode, the default colour for clickable links (not used otherwise)
4966 constPuebloLinkColour => 'CYAN',
4967 # Registry hash of colour scheme objects, each of which defines a colour scheme that can
4968 # be used in a Gtk3::TextView
4969 # Colour schemes with the same name as a type of window are used as the default colour
4970 # scheme for that type of window. Those colour scheme objects can be modified, but not
4971 # deleted from the hash. Other colour scheme objects can be added, deleted and
4972 # modified as required
4973 # Hash in the form
4974 # $colourSchemeHash{unique_name} = blessed_reference_to_colour_scheme_object
4975 colourSchemeHash => {}, # [winmaps]
4976 #
4977 # Constant default colours used for particular types of system message
4978 # (These values never changes; each value is a standard colour tag)
4979 constInsertCmdColour => 'green', # [config]
4980 constShowSystemTextColour => 'YELLOW', # [config]
4981 constShowErrorColour => 'cyan', # [config]
4982 constShowWarningColour => 'cyan', # [config]
4983 constShowDebugColour => 'GREEN', # [config]
4984 constShowImproperColour => 'MAGENTA', # [config]
4985 # Customisable default colours used for particular types of system message
4986 customInsertCmdColour => undef, # [config] Set below
4987 customShowSystemTextColour => undef, # [config] Set below
4988 customShowErrorColour => undef, # [config] Set below
4989 customShowWarningColour => undef, # [config] Set below
4990 customShowDebugColour => undef, # [config] Set below
4991 customShowImproperColour => undef, # [config] Set below
4992 #
4993 # When 'black' text is shown on a 'black' background, it is invisible. If this flag is
4994 # set, text that's the same colour as the background is converted to/from bold (i.e.
4995 # 'black' becomes 'BLACK', and 'BLACK' becomes 'black'
4996 convertInvisibleFlag => FALSE, # [config]
4997 # Constant default size for the textviews, corresponding to the number of lines that can
4998 # be stored in any textview object's Gtk3::TextBuffer (when it's full, the earliest
4999 # line is removed to make way for a new line)
5000 # NB If required, text buffers can be set to be of unlimited size; these IVs only apply
5001 # if a maximum size is needed
5002 # NB The absolute minimum/maximum size (when a size is used at all) is taken from the
5003 # IVs for Axmud's display, instruction and world command buffers, ->constMaxBufferSize
5004 # and ->constMinBufferSize
5005 constTextBufferSize => 10000,
5006 # Default maximum number of lines that can be shown in a Gtk3::TextView
5007 customTextBufferSize => undef, # [config] Set below
5008  
5009 # A set of Gtk3::Gdk::Cursors, one for when the mouse is hovering over a normal part of
5010 # a textview, and others when it is hovering over various kinds of clickable link
5011 constNormalCursor => Gtk3::Gdk::Cursor->new('xterm'),
5012 constWWWCursor => Gtk3::Gdk::Cursor->new('hand1'),
5013 constPromptCursor => Gtk3::Gdk::Cursor->new('sb_down_arrow'),
5014 constPopupCursor => Gtk3::Gdk::Cursor->new('target'),
5015 constCmdCursor => Gtk3::Gdk::Cursor->new('mouse'),
5016 constMailCursor => Gtk3::Gdk::Cursor->new('pencil'),
5017 constTelnetCursor => Gtk3::Gdk::Cursor->new('trek'),
5018 # Another set of Gtk3::Gdk::Cursors for the automapper window's free click mode
5019 constMapCursor => Gtk3::Gdk::Cursor->new('arrow'),
5020 constMapAddCursor => Gtk3::Gdk::Cursor->new('plus'),
5021 constMapConnectCursor => Gtk3::Gdk::Cursor->new('crosshair'),
5022 constMapMergeCursor => Gtk3::Gdk::Cursor->new('target'),
5023  
5024 # Icon file paths (relative to the main directory) for the 'internal' window strip
5025 # object, GA::Strip::SearchBox
5026 constUpIconPath => '/icons/search/arrow_up.png',
5027 constDownIconPath => '/icons/search/arrow_down.png',
5028 constResetIconPath => '/icons/search/broom.png',
5029 constCaseIconPath => '/icons/search/capitalization.png',
5030 constRegexIconPath => '/icons/search/token_shortland_character.png',
5031 constDivideIconPath => '/icons/search/application_tile_vertical.png',
5032 # Icon file paths (relative to the main directory) for the 'internal' window strip
5033 # object, GA::Strip::Entry
5034 constWipeIconPath => '/icons/button/broom.png',
5035 constAddIconPath => '/icons/button/textfield_add.png',
5036 constEmptyIconPath => '/icons/button/console.png',
5037 constSystemIconPath => '/icons/button/console_system.png',
5038 constDebugIconPath => '/icons/button/console_debug.png',
5039 constErrorIconPath => '/icons/button/console_error.png',
5040 constMultiIconPath => '/icons/button/toggle_expand.png',
5041 constSearchIconPath => '/icons/button/search.png',
5042 constCancelIconPath => '/icons/button/wall.png',
5043 constSwitchIconPath => '/icons/button/switch_windows.png',
5044 constSplitIconPath => '/icons/button/application_tile_vertical.png',
5045 constRestoreIconPath => '/icons/button/application.png',
5046 constScrollIconPath => '/icons/button/lock_open.png',
5047 constLockIconPath => '/icons/button/lock.png',
5048  
5049 # The sizes of icon provided for Axmud (icon files are in /icons/win/
5050 # Constant list of icon sizes (these values never change; in pixels)
5051 constIconSizeList => [16, 32, 48, 64, 128],
5052  
5053 # Standard shadow type for Gtk3::Frame and Gtk3::ScrolledWindows (possible values are
5054 # 'in', 'out', 'etched-in', 'etched-out' or 'none')
5055 constShadowType => 'in',
5056  
5057 # 'Internal' windows
5058 # ------------------
5059  
5060 # Axmud keeps two lists of strip objects - one for Axmud's built-in strip objects, and
5061 # another for all strip objects (built-in objects and custom objects added via a
5062 # plugin, which should inherit from GA::Strip::Custom)
5063 #
5064 # The constant registry of strip objects (these values never change). A hash in the form
5065 # $constStripHash{package_name} = pretty_name
5066 # NB Both 'package_name' and 'pretty_name' should be unique. To avoid problems, use the
5067 # plugin name in 'pretty_name', e.g. 'Myplugin toolbar'
5068 constStripHash => {
5069 'Games::Axmud::Strip::MenuBar'
5070 => $axmud::SCRIPT . ' menu bar',
5071 'Games::Axmud::Strip::Toolbar'
5072 => $axmud::SCRIPT . ' toolbar',
5073 'Games::Axmud::Strip::Table'
5074 => $axmud::SCRIPT . ' table',
5075 'Games::Axmud::Strip::GaugeBox'
5076 => $axmud::SCRIPT . ' gauge box',
5077 'Games::Axmud::Strip::SearchBox'
5078 => $axmud::SCRIPT . ' search box',
5079 'Games::Axmud::Strip::Entry'
5080 => $axmud::SCRIPT . ' command entry box',
5081 'Games::Axmud::Strip::ConnectInfo'
5082 => $axmud::SCRIPT . ' connection info box',
5083 },
5084 # The customisable registry hash of strip objects, in the form
5085 # $customStripHash{package_name} = description
5086 customStripHash => {}, # Set below
5087  
5088 # Likewise, Axmud keeps two lists of table objects - one for Axmud's built-in table
5089 # objects, and another for all table objects (built-in objects and custom objects
5090 # added via a plugin, which should inherit from GA::Table::Custom)
5091 #
5092 # The constant registry of table objects (these values never change). A hash in the form
5093 # $constTableHash{package_name} = pretty-name
5094 # NB Both 'package_name' and 'pretty_name' should be unique. To avoid problems, use the
5095 # plugin name in 'pretty_name', e.g. 'Myplugin button'
5096 constTableHash => {
5097 'Games::Axmud::Table::Holder'
5098 => $axmud::SCRIPT . ' holder',
5099 'Games::Axmud::Table::Container'
5100 => $axmud::SCRIPT . ' generic container',
5101 'Games::Axmud::Table::MiniTable'
5102 => $axmud::SCRIPT . ' mini-table',
5103 'Games::Axmud::Table::Label'
5104 => $axmud::SCRIPT . ' label',
5105 'Games::Axmud::Table::Button'
5106 => $axmud::SCRIPT . ' button',
5107 'Games::Axmud::Table::CheckButton'
5108 => $axmud::SCRIPT . ' check button',
5109 'Games::Axmud::Table::RadioButton'
5110 => $axmud::SCRIPT . ' radio button',
5111 'Games::Axmud::Table::Entry'
5112 => $axmud::SCRIPT . ' entry box',
5113 'Games::Axmud::Table::ComboBox'
5114 => $axmud::SCRIPT . ' combobox',
5115 'Games::Axmud::Table::SimpleList'
5116 => $axmud::SCRIPT . ' simple list',
5117 'Games::Axmud::Table::TextView'
5118 => $axmud::SCRIPT . ' simple textview',
5119 'Games::Axmud::Table::Pane'
5120 => $axmud::SCRIPT . ' window pane',
5121 'Games::Axmud::Table::PseudoWin'
5122 => $axmud::SCRIPT . ' pseudo-window',
5123 },
5124 # The customisable registry hash of table objects, in the form
5125 # $customTableHash{package_name} = description
5126 customTableHash => {}, # Set below
5127  
5128 # Constant registry list used to initialise the default set of toolbar buttons used in
5129 # 'internal' windows (usually only 'main' windows), when required. List in groups of
5130 # 6, in the form
5131 # name - Unique object name
5132 # descrip - Short description
5133 # iconPath - File path to the icon
5134 # instruct - Instruction to execute
5135 # session_flag - Icon only sensitised when there is a current session
5136 # connect_flag - Icon only sensitised when current session connected to a world
5137 # Separators are in groups of 1
5138 constToolbarList => [
5139 'connect_me',
5140 'Connect to a world',
5141 'phone_vintage.png',
5142 ';connect',
5143 FALSE, # Always available
5144 FALSE, # Doesn't require connection to world
5145 'login_me',
5146 'Mark the character as logged in',
5147 'user_go.png',
5148 ';login',
5149 TRUE, # Requires current session
5150 TRUE, # Requires connection to world
5151 'save_me',
5152 'Save data',
5153 'drive_disk.png',
5154 ';save',
5155 TRUE, # Requires current session
5156 TRUE, # Requires connection to world
5157 # separator
5158 'separator',
5159 'open_map',
5160 'Open Automapper window',
5161 'compass.png',
5162 ';openautomapper',
5163 TRUE, # Requires current session
5164 TRUE, # Requires connection to world
5165 'reset_loc',
5166 'Reset the Locator task',
5167 'roadworks.png',
5168 ';resetlocator',
5169 TRUE, # Requires current session
5170 TRUE, # Requires connection to world
5171 # separator
5172 'separator',
5173 'active_int',
5174 'View active interfaces',
5175 'gear_in.png',
5176 ';editactiveinterface',
5177 TRUE, # Requires current session
5178 TRUE, # Requires connection to world
5179 'edit_trigger',
5180 'Edit world trigger cage',
5181 'gun.png',
5182 ';editcage -t',
5183 TRUE, # Requires current session
5184 TRUE, # Requires connection to world
5185 'edit_alias',
5186 'Edit world alias cage',
5187 'user_detective.png',
5188 ';editcage -a',
5189 TRUE, # Requires current session
5190 TRUE, # Requires connection to world
5191 'edit_macro',
5192 'Edit world macro cage',
5193 'keyboard.png',
5194 ';editcage -m',
5195 TRUE, # Requires current session
5196 TRUE, # Requires connection to world
5197 'edit_timer',
5198 'Edit world timer cage',
5199 'clock_red.png',
5200 ';editcage -i',
5201 TRUE, # Requires current session
5202 TRUE, # Requires connection to world
5203 'edit_hook',
5204 'Edit world hook cage',
5205 'candy_cane.png',
5206 ';editcage -h',
5207 TRUE, # Requires current session
5208 TRUE, # Requires connection to world
5209 'route',
5210 'Edit route cage',
5211 'routing_go_straight_left.png',
5212 ';editcage -r',
5213 TRUE, # Requires current session
5214 TRUE, # Requires connection to world
5215 # separator
5216 'separator',
5217 'edit_quick',
5218 'Set quick preferences',
5219 'book_edit.png',
5220 ';editquick',
5221 TRUE, # Requires current session
5222 TRUE, # Requires connection to world
5223 'edit_client',
5224 'Set Axmud client preferences',
5225 'application_edit.png',
5226 ';editclient',
5227 TRUE, # Requires current session
5228 TRUE, # Requires connection to world
5229 'edit_world',
5230 'Edit current world profile',
5231 'world_edit.png',
5232 ';editworld',
5233 TRUE, # Requires current session
5234 TRUE, # Requires connection to world
5235 'open_viewer',
5236 'Open object viewer window',
5237 'watermark_table.png',
5238 ';openobjectviewer',
5239 TRUE, # Requires current session
5240 TRUE, # Requires connection to world
5241 # separator
5242 'separator',
5243 'speech',
5244 'Turn on text-to-speech',
5245 'ear_listen.png',
5246 ';speech toggle',
5247 FALSE, # Doesn't current session
5248 FALSE, # Doesn't connection to world
5249 'freeze_task',
5250 'Freeze/unfreeze tasks',
5251 'cold.png',
5252 ';freezetask',
5253 TRUE, # Requires current session
5254 TRUE, # Requires connection to world
5255 'disable_int',
5256 'Disable all active interfaces',
5257 'prohibition_button.png',
5258 ';disableactiveinterface',
5259 TRUE, # Requires current session
5260 FALSE, # Doesn't connection to world
5261 # separator
5262 'separator',
5263 'layer_up',
5264 'Move workspace grid up a layer',
5265 'hand_point_090.png',
5266 ';layerup',
5267 TRUE, # Requires current session
5268 TRUE, # Requires connection to world
5269 'layer_down',
5270 'Move workspace grid down a layer',
5271 'hand_point_270.png',
5272 ';layerdown',
5273 TRUE, # Requires current session
5274 TRUE, # Requires connection to world
5275 'help_me',
5276 'Show quick help',
5277 'help.png',
5278 ';openaboutwindow -h',
5279 FALSE, # Always available
5280 FALSE, # Doesn't require connection to world
5281 'quit',
5282 'Stop session or client',
5283 'quit.png',
5284 ';stopsession',
5285 FALSE, # Always available
5286 FALSE, # Doesn't require connection to world
5287 ],
5288 # Registry hash of toolbar button objects which exist, in the form
5289 # $toolbarHash{unique_name} = blessed_reference_to_toolbar_button_object
5290 toolbarHash => {}, # [toolbar]
5291 # Registry list of toolbar button object names, in the order in which they appear in the
5292 # toolbar (and any number of occurences of the word 'separator', which is not a
5293 # toolbar button, but a separator)
5294 toolbarList => [], # [toolbar]
5295  
5296 # External applications
5297 # ---------------------
5298  
5299 # Constant registry list of external application commands for Linux
5300 # NB Any audio package can be used to play MSP sound triggers, but Axmud is only able to
5301 # apply the volume parameter to packages it actively supports. Currently, only the SoX
5302 # package is actively supported
5303 constLinuxCmdList => [
5304 'firefox "%s" &', # Firefox
5305 'thunderbird -compose "to=\'%s\'" &', # Thunderbird
5306 'play -q "%s" &', # play from SoX package
5307 'xed "%s" &', # xed
5308 ],
5309 # Constant registry list of external application commands for MS Windows
5310 constMSWinCmdList => [
5311 'start iexplore.exe %s', # Internet Explorer
5312 'start outlook.exe /c ipm.note /m %s', # Outlook Express
5313 'start wmplayer.exe /play %s', # Windows Media Player
5314 'start notepad.exe /A %s', # Notepad
5315 ],
5316 # Constant registry list of external application commands for *BSD
5317 constBSDCmdList => [
5318 'firefox "%s" &', # Firefox
5319 'thunderbird -compose "to=\'%s\'" &', # Thunderbird
5320 'play -q "%s" &', # play from SoX package
5321 'pluma "%s" &', # Pluma
5322 ],
5323 # The command to run a web browser. %s is substituted for a URL
5324 browserCmd => undef, # [config] set below
5325 # The command to open an email application. %s is subsituted for the email address
5326 # of the person to email
5327 emailCmd => undef, # [config] set below
5328 # The command to run an audio player. %s is substituted for the full file path
5329 # (default value opens sox package on Linux)
5330 audioCmd => undef, # [config] set below
5331 # The command to open a text editor. %s is subsituted for the file to open
5332 textEditCmd => undef, # [config] set below
5333  
5334 # Sound and sound effects
5335 # -----------------------
5336  
5337 # Audio file formats supported by various parts of Axmud (principally by the MSP code)
5338 constSoundFormatHash => {
5339 # Supported in MSP spec
5340 'mid' => undef,
5341 'midi' => undef,
5342 'wav' => undef,
5343 # Not supported in MSP spec, but supported by Axmud
5344 'aac' => undef,
5345 'aiff' => undef,
5346 'alac' => undef,
5347 'flac' => undef,
5348 'mp3' => undef,
5349 'ogg' => undef,
5350 'wma' => undef,
5351 },
5352 # Flag set to TRUE if sound effects are allowed at all, FALSE if not
5353 allowSoundFlag => FALSE, # [config]
5354 # Flag set to TRUE if Axmud should play a 'bell' when GA::Obj::TextView->insertText
5355 # (etc) tries to display an ASCII 7 character (bell), FALSE if not
5356 # Set to TRUE by default so that turning on sound will automatically allow remote beeps
5357 allowAsciiBellFlag => TRUE, # [config]
5358 # Axmud provides two groups of sound effects by default. The first group are used by
5359 # various parts of the Axmud code, and are named for the purpose for which they're
5360 # mostly used
5361 # Constant registry hash of standard sound effects, in the form
5362 # $constStandardSoundHash{effect_name} = file_name
5363 # ...where 'file_name' is the file in /items/sounds
5364 constStandardSoundHash => {
5365 # Text received after going AFK
5366 'afk' => 'afk.mp3',
5367 # Timed alerts
5368 'alert' => 'alert.mp3',
5369 # General alarm
5370 'alarm' => 'alarm.mp3',
5371 # General attack started
5372 'attack' => 'attack.mp3',
5373 # Old-fashioned beep
5374 'beep' => 'beep.mp3',
5375 # Desk bell
5376 'bell' => 'bell.mp3',
5377 # Incoming chat message
5378 'call' => 'call.mp3',
5379 # Character dies
5380 'death' => 'death.mp3',
5381 # Character deposits money into bank
5382 'deposit' => 'deposit.mp3',
5383 # System error/warning/debug/improper arguments messages
5384 'error' => 'error.mp3',
5385 # General arrival
5386 'greeting' => 'greeting.mp3',
5387 # General kill
5388 'kill' => 'kill.mp3',
5389 # Automapper gets lost
5390 'lost' => 'lost.mp3',
5391 # General notification
5392 'notify' => 'notify.mp3',
5393 # Something is ready
5394 'ready' => 'ready.mp3',
5395 # Torch has burnt out
5396 'torch' => 'torch.mp3',
5397 # Character withdraws money from bank
5398 'withdraw' => 'withdraw.mp3',
5399 },
5400 # The second group are named after the sounds that the sound effects contain, and can be
5401 # used for any purpose
5402 # The following registry hash is in the same format as ->constStandardSoundHash, and
5403 # contains both groups of sound effects, representing all the sound files in
5404 # /items/sounds (refreshed every time Axmud runs)
5405 constExtendedSoundHash => {},
5406 # Customisable registry hash of sound effects (the 'sound effects bank') in the form
5407 # $customSoundHash{effect} = full_file_path
5408 # This hash is initially filled with all the sound effects in /items/sounds, and from
5409 # then on can be customised by the user
5410 # If full_file_path is an empty string (or 'undef'), no sound is played
5411 customSoundHash => {}, # [config] Set below
5412  
5413 # Text-to-speech (TTS)
5414 # --------------------
5415  
5416 # There are two flags that turn TTS on and off
5417 # The user can toggle the first one on or off at any time (using the ;speech command),
5418 # and is saved in the config file
5419 # Flag set to TRUE if TTS is allowed at all, FALSE if not
5420 customAllowTTSFlag => FALSE, # [config]
5421 # The second flag is not saved in any file. It is set to TRUE when
5422 # $self->customAllowTTSFlag is TRUE or when the global variable
5423 # $axmud::BLIND_MODE_FLAG is TRUE
5424 # In this way if the user starts Axmud in blind mode, TTS is definitely turned on; if
5425 # the user then restarts Axmud not in blind mode, TTS will be on or off, depending on
5426 # the value of ->customAllowTTSFlag
5427 # (Thus, a single installation of Axmud can be used by two users, one with a visual
5428 # impairment and one without)
5429 systemAllowTTSFlag => FALSE,
5430 # If the user specifies a TTS engine from the command line (e.g. by running
5431 # './axmud.pl festival' or './baxmud.pl deathmud.com 5000 festival'), that engine
5432 # is used exclusively while Axmud is running. This IV stores the engine, if specified
5433 forceTTSEngine => undef,
5434 # Constant list of TTS engines that Axmud currently supports - eSpeak, espeak-ng, Flite,
5435 # Festival, Swift (using Cepstral) and a dummy engine, 'none', which produces no
5436 # speech when specified
5437 constTTSList => [
5438 'espeak', 'esng', 'flite', 'festival', 'swift', 'none',
5439 ],
5440 # Constant list of TTS engines that Axmud supports on this operating system
5441 constTTSCompatList => [], # Set below
5442 # Allow TTS smoothing, which inserts an artificial full stop at the end of lines which
5443 # don't end with one, if the next line begins with a capital letter (makes the voice
5444 # sound more natural)
5445 ttsSmoothFlag => TRUE, # [config]
5446  
5447 # Any part of the code can perform TTS by calling $self->tts. That function produces
5448 # a TTS job (a GA::Obj::TtsJob object). The job stores a single piece of text to
5449 # convert to speech, the engine to use, and any optional parameters
5450 # A list of TTS job objects, usually performed in sequence
5451 ttsJobList => [],
5452 # The maximum size of $self->ttsJobList. When the list is full, we remove the oldest
5453 # job (the first one in the list) to make way for a new job (added to the end of the
5454 # list)
5455 ttsJobMax => 1000,
5456 # A second list of jobs, used for any system messages which are urgent (for example, the
5457 # confirmation message from the ';split' command, when TTS is enabled)
5458 # $self->ttsPerformJobs performs all jobs on this list immediately, before checking
5459 # ->ttsJobList. This list has no maximum size (jobs are removed from the list, as
5460 # soon as they are performed)
5461 ttsUrgentJobList => [],
5462 # The job mode, which defines what happens when ;skip and ;unskip (etc) are used. Set
5463 # to 'default' to read aloud all the text for the job, 'sentence' to read aloud one
5464 # sentence at a time, or 'word' to read aloud one word at a time
5465 ttsJobMode => 'default',
5466 # A pointer, set to an index in $self->ttsJobList. The pointer tells us which job is
5467 # the current one (i.e. the next piece of text to be converted to speech)
5468 # When $self->ttsJobList is empty, set to 0. When every job in $self->ttsJobList has
5469 # been performed, set to -1 (to represent a pointer a the end of the list)
5470 ttsJobPointer => 0,
5471 # A mini-pointer, pointing at a position in a job's ->text string (the first character
5472 # in the string is 0). Set to 0 when ->ttsJobMode is 'default'. When ->ttsJobMode is
5473 # 'sentence' or 'word', points at the character at the beginning of a sentence/word
5474 ttsJobMiniPointer => 0,
5475 # A flag set to TRUE if each job in the list should be performed as soon as the previous
5476 # job has finished, FALSE if not
5477 ttsJobAutoFlag => TRUE,
5478 # A flag set to TRUE if the current job (marked by $self->ttsJobPointer) should be
5479 # performed once, FALSE if it shouldn't be performed right now (ignored when
5480 # $self->ttsJobAutoFlag is TRUE)
5481 ttsJobOnceFlag => TRUE,
5482 # Flag set to TRUE when $self->ttsJobMode changes, and set back to FALSE when any job is
5483 # performed, or when the ';skip' command is used. When TRUE, the ';skip' command
5484 # doesn't advance $self->ttsJobMiniPointer, as it ordinarily would. Thus, the user
5485 # can type ';first' and then ';skip', in order to hear the first sentence or word in
5486 # a job (rather the second
5487 ttsChangeModeFlag => FALSE,
5488 # The IPC::Run harness handling the system process, in which text is currently being
5489 # converted to speech. Reset back to 'undef' as soon as we detect that the system
5490 # process has finished
5491 ttsCurrentHarness => undef,
5492  
5493 # When blind mode is enabled, we can hijack the escape and cursor keys for navigating
5494 # the TTS job list
5495 # Hash of affected keycodes, in the form
5496 # $ttsHijackKeycodeHash{keycode} = client_command_to_call
5497 ttsHijackKeycodeHash => {
5498 'home' => 'split',
5499 'end' => 'prompt',
5500 'right' => 'skip',
5501 'left' => 'unskip',
5502 'page_down' => 'skip more',
5503 'page_up' => 'unskip more',
5504 'up' => 'first',
5505 'down' => 'last',
5506 'tab' => 'resume',
5507 'escape' => 'shutup',
5508 },
5509 # Flag set to TRUE when the keys are hijacked, and FALSE when they are not hijacked.
5510 # This setting is toggled with the ;freekeys command (and is ignored when not in
5511 # blind mode)
5512 ttsHijackFlag => TRUE, # [config]
5513 # Corresponding flag for when blind mode is not enabled
5514 # Flag set to TRUE when the keys are hijacked, and FALSE when they are not hijacked.
5515 # This setting is toggled with the ;hijackkeys command (and is ignored when in blind
5516 # mode)
5517 ttsForceHijackFlag => FALSE, # [config]
5518  
5519 # Constant lists of default TTS settings, used for initialising TTS configuration
5520 # objects, in the form
5521 # (tts_engine, tts_voice, tts_speed, tts_rate, tts_pitch, tts_volume...)
5522 constTtsDefaultList => [
5523 'espeak',
5524 'english_rp', # Male voice
5525 80,
5526 undef,
5527 50,
5528 undef,
5529 'esng',
5530 'en', # Male voice
5531 80,
5532 undef,
5533 50,
5534 80,
5535 'flite',
5536 'slt', # Female voice
5537 undef,
5538 undef,
5539 undef,
5540 undef,
5541 'festival', # Male voice
5542 'voice_kal_diphone',
5543 undef,
5544 33,
5545 undef,
5546 20,
5547 'swift',
5548 'David',
5549 30, # Used on MSWin
5550 50, # Used on Linux/*BSD
5551 50,
5552 80,
5553 'none', # Doesn't actually read anything
5554 undef,
5555 undef,
5556 undef,
5557 undef,
5558 undef,
5559 ],
5560 # Constant hash of TTS configuration objects to be created at startup, in the form
5561 # $constTtsObjHash{unique_name} = which_tts_engine_to_use_by_default
5562 # ...where 'unique_name' is max 16 chars, no reserved names
5563 # For most values, we use 'undef' rather than an engine name. The call to
5564 # $self->ttsCreateStandard then chooses which engine to use: on Linux, 'espeak', and
5565 # on MS Windows, either 'espeak', 'sng' or 'festival', depending on which engines
5566 # are actually installed on the system
5567 constTtsObjHash => {
5568 # Default TTS settings
5569 'espeak' => 'espeak', # Default for each TTS engine
5570 'esng' => 'esng',
5571 'flite' => 'flite',
5572 'festival' => 'festival',
5573 'swift' => 'swift',
5574 'none' => 'espeak', # The 'void' engine - doesn't read anything
5575 'task' => undef, # Default for tasks
5576 'script' => undef, # Default for Axbasic scripts
5577 'default' => undef, # Default for everything else
5578 # Default TTS settings for various parts of Axmud
5579 'receive' => undef, # Text received from world
5580 'system' => undef, # System messages, i.e. ->writeText
5581 'error' => undef, # System error/warning/debug/improper msgs
5582 'command' => undef, # World commands
5583 'dialogue' => undef, # 'Dialogue' windows
5584 # Default TTS settings for various built-in tasks
5585 'attack' => undef,
5586 'chat' => undef,
5587 'channels' => undef,
5588 'divert' => undef,
5589 'locator' => undef,
5590 'status' => undef,
5591 'watch' => undef,
5592 },
5593 # Constant hash of TTS configuration objects which cannot be removed
5594 constTtsPermObjHash => {
5595 'espeak' => undef,
5596 'esng' => undef,
5597 'flite' => undef,
5598 'festival' => undef,
5599 'swift' => undef,
5600 'none' => undef,
5601 'task' => undef,
5602 'script' => undef,
5603 'default' => undef,
5604 },
5605 # Constant hash of TTS configuration objects which cannot be modified, as their IVs are
5606 # used as default values for other configuration object IVs
5607 constTtsFixedObjHash => {
5608 'espeak' => undef,
5609 'esng' => undef,
5610 'flite' => undef,
5611 'festival' => undef,
5612 'swift' => undef,
5613 'none' => undef,
5614 },
5615 # Registry hash of TTS configuration objects (GA::Obj::Tts) in the form
5616 # $ttsObjHash{unique_name} = blessed_reference_to_tts_object
5617 # ...where 'unique_name' is max 16 chars, no reserved names
5618 # When Axmud runs for the first time, TTS configuration objects are created for each of
5619 # the keys in $self->constTtsObjHash
5620 # The configuration objects in $self->constTtsPermObjHash cannot be removed from this
5621 # hash. The configuration objects in ->constTtsFixedObjHash cannot be modified.
5622 # Otherwise, the user and/or code can freely add and remove configuration objects from
5623 # this hash
5624 ttsObjHash => {},
5625  
5626 # Constant hash of TTS (normal) attributes, which allows the ';read' command to interact
5627 # with specific tasks
5628 # Hash in the form
5629 # $constTtsAttribHash{attribute} = name_of_task_which_uses_it
5630 # ...where 'attribute' is a string unique to this hash, preferably a single word in all
5631 # lower-case letters
5632 constTtsAttribHash => {
5633 # Locator task
5634 'title' => 'locator_task', # Reads current room title
5635 'descrip' => 'locator_task', # ...description
5636 'description' => 'locator_task', # ...description
5637 'exit' => 'locator_task', # ...exit list
5638 'exits' => 'locator_task', # ...exit list
5639 'content' => 'locator_task', # ...contents
5640 'contents' => 'locator_task', # ...contents
5641 'command' => 'locator_task', # ...room commands
5642 'cmd' => 'locator_task', # ...room commands
5643 # Status task
5644 'status' => 'status_task', # Read current char's life status
5645 'life' => 'status_task', # ...life and death counts
5646 'lives' => 'status_task', # ...life and death counts
5647 'health' => 'status_task', # ...health points/max health points
5648 'magic' => 'status_task', # ...magic points
5649 'energy' => 'status_task', # ...energy points
5650 'guild' => 'status_task', # ...guild points
5651 'social' => 'status_task', # ...social points
5652 'xp' => 'status_task', # ...xp
5653 'experience' => 'status_task', # ...xp
5654 'level' => 'status_task', # ...level
5655 'align' => 'status_task', # ...alignment
5656 'alignment' => 'status_task', # ...alignment
5657 'age' => 'status_task', # ...age
5658 'time' => 'status_task', # ...game time
5659 'bank' => 'status_task', # ...bank balance
5660 'purse' => 'status_task', # ...purse contents
5661 },
5662 # Hash of TTS (normal) attributes, initially set identical to ->constTtsAttribHash,
5663 # and then modified as plugins add new plugin tasks
5664 # Each GA::Session contains a customisable hash, initially given the same key-value
5665 # pairs as this one, which contains all the TTS attributes used by built-in tasks. If
5666 # the new tasks add attributes already used by built-in tasks, then the key-value
5667 # pairs are overwritten, and the attributes point to the new task, not the built-in
5668 # task
5669 ttsAttribHash => {}, # Set below
5670 # Constant hash of TTS flag attributes, which allows the ';switch' command to
5671 # interact with specific tasks
5672 # Hash in the form
5673 # $constTtsFlagAttribHash{flag_attribute} = name_of_task_which_uses_it
5674 # ...where 'flag_attribute' is a string unique to this hash (not a TRUE or FALSE value),
5675 # preferably a single word in all lower-case letters
5676 # NB Each GA::Session contains a customisable hash, as for $self->constTtsAttribHash
5677 constTtsFlagAttribHash => {
5678 # Attack task
5679 'fight' => 'attack_task', # Turn on/off automatic kill reading
5680 'interact' => 'attack_task', # ...interaction reading
5681 'interaction' => 'attack_task', # ...interaction reading
5682 # Channels task
5683 'channels' => 'channels_task', # Turn on/off reading diverted msgs
5684 # Chat task
5685 'chat' => 'chat_task', # Turns on/off reading all messages
5686 'chatout' => 'chat_task', # ...only sent messages
5687 'chatin' => 'chat_task', # ...only received messages
5688 'chatecho' => 'chat_task', # ...only echoed (group) messages
5689 'chatsystem' => 'chat_task', # ...only local system messages
5690 'chatremote' => 'chat_task', # ...only remote system messages
5691 'chatsnoop' => 'chat_task', # ...only snooping messages
5692 # Divert task
5693 'divert' => 'divert_task', # Turn on/off reading diverted msgs
5694 'tell' => 'divert_task', # ...only tells
5695 'social' => 'divert_task', # ...only socials
5696 'custom' => 'divert_task', # ...only customs
5697 'warning' => 'divert_task', # ...only warnings
5698 # Locator task
5699 'title' => 'locator_task', # Turn on/off room title reading
5700 'descrip' => 'locator_task', # ...description reading
5701 'description' => 'locator_task', # ...description reading
5702 'exit' => 'locator_task', # ...exit list reading
5703 'exits' => 'locator_task', # ...exit list reading
5704 'content' => 'locator_task', # ...contents reading
5705 'contents' => 'locator_task', # ...contents reading
5706 'command' => 'locator_task', # ...room commands
5707 'cmd' => 'locator_task', # ...room commands
5708 # Status task
5709 'life' => 'status_task', # Turn on/off life status reading
5710 # Watch task
5711 'watch' => 'watch_task', # Turn on/off reading watched msgs
5712 },
5713 # Hash of TTS flag attributes, initially set identical to ->constTtsFlagAttribHash,
5714 # and then modified as plugins add new plugin tasks
5715 ttsFlagAttribHash => {}, # Set below
5716 # Constant hash of TTS alert attributes, which allows the ';alert' command to
5717 # interact with specific tasks
5718 # Hash in the form
5719 # $constTtsAlertAttribHash{alert_attribute} = name_of_task_which_uses_it
5720 # ...where 'alert_attribute' is a string unique to this hash, preferably a single word
5721 # in all lower-case letters
5722 # NB Each GA::Session contains a customisable hash, as for $self->constTtsAttribHash
5723 constTtsAlertAttribHash => {
5724 # Status task
5725 'healthup' => 'status_task', # HP recovers to minimum level
5726 'healthdown' => 'status_task', # ...falls to maximum level
5727 'magicup' => 'status_task', # Magic points recover to min level
5728 'magicdown' => 'status_task', # ...falls to maximum level
5729 'energyup' => 'status_task', # Energy points recover to min level
5730 'energydown' => 'status_task', # ...falls to maximum level
5731 'guildup' => 'status_task', # Guild points recover to min level
5732 'guilddown' => 'status_task', # ...falls to maximum level
5733 'socialup' => 'status_task', # Social points recover to min level
5734 'socialdown' => 'status_task', # ...falls to maximum level
5735 # ...
5736 },
5737 # Hash of TTS alert attributes, initially set identical to ->constTtsAlertAttribHash,
5738 # and then modified as plugins add new plugin tasks
5739 ttsAlertAttribHash => {}, # set below
5740  
5741 # IVs that govern what text is converted to speech
5742 # Convert text received from the world (after modification by triggers, etc)
5743 ttsReceiveFlag => TRUE, # [config]
5744 # Don't convert text received from the world before a login is processed (except for
5745 # prompts)
5746 ttsLoginFlag => TRUE, # [config]
5747 # Don't convert text received from the world that matches
5748 # GA::Profile::World->cmdPromptPatternList (after a login)
5749 ttsPromptFlag => TRUE, # [config]
5750 # Convert system messages
5751 ttsSystemFlag => TRUE, # [config]
5752 # Convert system error messages (including warning and debug messages)
5753 ttsSystemErrorFlag => TRUE, # [config]
5754 # Convert world commands
5755 ttsWorldCmdFlag => TRUE, # [config]
5756 # Convert 'dialogue' windows (as far as possible)
5757 ttsDialogueFlag => TRUE, # [config]
5758 # Convert (some) text displayed in (some) task windows
5759 ttsTaskFlag => FALSE, # [config]
5760  
5761 # Regardless of whether $self->ttsPromptFlag is set or not, and whether login has been
5762 # completed or not, $self->tts checks received text against
5763 # GA::Profile::World->cmdPromptPatternList, and stores the most recent matching prompt
5764 # here (so it can be replayed using the ';prompt' command)
5765 ttsLastPrompt => undef,
5766  
5767 # Paths to the binaries for various speech engines on MS Windows (ignored on other
5768 # operating systems). Not that there are two possible paths for eSpeak
5769 msWinPathESpeak => "C:\\Program Files\\espeak\\command_line\\espeak.exe",
5770 msWinAltPathESpeak
5771 => "C:\\Program Files (x86)\\espeak\\command_line\\espeak.exe",
5772 msWinPathESNG => "C:\\Program Files\\eSpeak NG\\espeak-ng.exe",
5773 msWinPathFestival => "C:\\festival\\src\\main\\festival.exe",
5774 msWinPathSwift => "C:\\Program Files\\Cepstral\\bin\\swift.exe",
5775  
5776 # Special IVs for interacting with the Festival server (on MS Windows, we never use the
5777 # server engine, only the command-line engine)
5778 # The default Festival server port
5779 constTtsFestivalServerPort => 1314,
5780 # The actual server port to use, when required. If 'undef' (or an empty string), the
5781 # command-line Festival engine is used
5782 ttsFestivalServerPort => undef,
5783 # Flag set to TRUE, the first time that $self->tts is called to use the Festival engine.
5784 # On that occasion, if $self->ttsFestivalServerPort is set, we try to start the
5785 # Festival server
5786 ttsFestivalFirstFlag => FALSE,
5787 # Festival server mode: 'cmd_line' to send text to the command-line engine, 'server' to
5788 # send it to the server engine
5789 ttsFestivalServerMode => 'cmd_line',
5790 # Festival server connection mode: 'cmd_line' when $self->ttsFestivalMode is 'cmd_line'.
5791 # Otherwise, set to 'waiting' when no connection is established, 'connecting' when
5792 # trying to establish a connection, and 'connected' when a connection has been
5793 # established
5794 ttsFestivalConnectMode => 'cmd_line',
5795 # The IO::Socket::INET object for the connection to the Festival server
5796 ttsFestivalSocket => undef,
5797 # When dealing with the Festival server, we may have to perform several actions, one
5798 # after the other, waiting for one to finish before starting the next
5799 # A list of requested actions. $self->ttsPerformJobs performs them one at a time
5800 # Valid requested actions are 'start', 'connect' and 'disconnect'
5801 ttsFestivalRequestList => [],
5802 # After the requested action 'start', we must give time for the server to initialise,
5803 # before we can give up trying to connect to it. The time (matches $self->clientTime)
5804 # at which we should stop trying to connect to the server. If the value is 'undef',
5805 # we give up after the first failed attempt
5806 ttsFestivalCheckTime => undef,
5807 # The period (in seconds) to wait
5808 ttsFestivalStopTime => 3,
5809 # Axmud must not try to start the server again, if the first attempt fails (unless
5810 # $self->ttsFestivalServerPort has changed). Flag set to TRUE if we could not start
5811 # the server, and set back to FALSE when the port is changed
5812 ttsFestivalFailFlag => FALSE,
5813 # Axmud must not try to start the server again, if a previous attempt succeeded (even if
5814 # the port has changed). Flag set to TRUE if we succeeded in starting the server
5815 ttsFestivalSuccessFlag => FALSE,
5816  
5817 # Other IVs
5818 # ---------
5819  
5820 # Lists of short names for months and days of the week (mainly used with functions like
5821 # ->localTime, ->localClock and ->localDate)
5822 # Registry list of short months (these values never change)
5823 constMonthList => [
5824 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',
5825 ],
5826 # Customisable list of short months (can be changed for other languages)
5827 customMonthList => [], # [config] Set below
5828 # Registry list of short days (these values never change)
5829 constDayList => [
5830 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat',
5831 ],
5832 # Customisable list of short days (can be changed for other languages)
5833 customDayList => [], # [config] Set below
5834 # Hash used by $self->convertRoman to convert integer numbers to Roman numerals, based
5835 # on Text::Roman by Stanislaw Pusep
5836 constRomanHash => {
5837 'I' => 1,
5838 'V' => 5,
5839 'X' => 10,
5840 'L' => 50,
5841 'C' => 100,
5842 'D' => 500,
5843 'M' => 1000,
5844 'IV' => 4,
5845 'IX' => 9,
5846 'XL' => 40,
5847 'XC' => 90,
5848 'CD' => 400,
5849 'CM' => 900,
5850 },
5851  
5852 # Constant list of IP lookup servers that provide the user's IP address (tested
5853 # September 2020)
5854 constIPLookupList => [
5855 'http://ifconfig.me/ip',
5856 'https://ifconfig.co/ip',
5857 'https://api.ipify.org',
5858 'http://icanhazip.com/',
5859 'https://ip.protenus.com/ip',
5860 ],
5861 # Customisable list (in case, in the far future, none of them are available)
5862 ipLookupList => [], # [config] Set below
5863 # The user's current IP address. To prevent unnecessary delays, the user's IP address is
5864 # only detected when required (for example, by the Chat task, or by
5865 # GA::Session->processNewEnvironData). When $self->ipv4Get is called and the user's
5866 # IP address is successfully retrieved, it is stored here. Subsequent calls to to
5867 # ->ipv4Get return this value
5868 # The value is not stored in the config file, so if the user switches to a different IP
5869 # address while Axmud is running, the old IP address continues to be used (unless the
5870 # user invokes the ;forcelookup command)
5871 currentIP => undef,
5872  
5873 # Lines in help files should be longer than 80 characters long
5874 constHelpCharLimit => 80, # [config]
5875  
5876 # The system time, in seconds, at which the client started
5877 startTime => undef,
5878 # The date/time at which the client started
5879 startClock => undef,
5880 startDate => undef,
5881 startClockString => undef,
5882 startDateString => undef,
5883  
5884 # When text is received from the world that doesn't end in a newline character, we wait
5885 # a short time before treating it as a prompt. If nothing else is received in that
5886 # time, it's a prompt.
5887 # Constant default time to wait
5888 constPromptWaitTime => 0.5,
5889 # The time to wait (in seconds, minimum value 0.1, maximum value 5)
5890 promptWaitTime => undef, # [config] Set below
5891 # At the start of a session, how long to wait for the character to login before showing
5892 # a reminder message
5893 # Constant default time to wait
5894 constLoginWarningTime => 60,
5895 # The time to wait (in seconds, minimum value 0 for 'immediately')
5896 loginWarningTime => undef, # [config] Set below
5897  
5898 # Toolbar buttons in the 'main' and automapper windows are created with labels. On most
5899 # Linux systems, the labels are only visible in a drop-down menu if there are too
5900 # many buttons in the toolbar, but on other systems (including MS Windows), the
5901 # labels are displayed beneath the buttons (which we don't want). Users can toggle
5902 # this flag to suit their own system
5903 # Flag set to TRUE if toolbar buttons should have labels, FALSE otherwise
5904 toolbarLabelFlag => undef, # [config] Set below
5905 # Some 'edit'/'pref' windows use the irreversible icon (stored as the file
5906 # /icons/system/irreversible.png) on buttons to show that stored data will be
5907 # modified immediately. However, on some (Linux) systems the icon isn't currently
5908 # visible. Flag set to TRUE if an icon should be drawn, FALSE if an asterisk should be
5909 # drawn instead
5910 irreversibleIconFlag => FALSE, # [config]
5911 # Flag set to TRUE if the popup window created by GA::Generic::Win->showBusyWin should
5912 # not be shown at all; FALSE if it can be shown (when required)
5913 allowBusyWinFlag => TRUE, # [config]
5914 # Flag set to FALSE if system messages should never be displayed in a session's 'main'
5915 # window, but redirected to the Session Console window; TRUE if the session should
5916 # decide for itself which of those to do
5917 mainWinSystemMsgFlag => TRUE, # [config]
5918 # Flag set to TRUE if a session's 'main' window urgency hint should be set, when text
5919 # is received from the world
5920 mainWinUrgencyFlag => FALSE, # [config]
5921 # Flag set to TRUE if tooltips should be shown in session's default tab
5922 mainWinTooltipFlag => TRUE, # [config]
5923  
5924 # Calls to $self->commify can modify a long number like 1000000 into something more
5925 # readable, like 1,000,000 (currently, only used by the Status task, but it's
5926 # available to any code)
5927 # The default mode to use when converting numbers with a call to $self->commify
5928 # 'none' - don't use commas (1000000)
5929 # 'comma' - use commas (1,000,000)
5930 # 'europe' - use European-style full stops/periods (1.000.000)
5931 # 'brit' - use British-style spaces (1 000 000)
5932 # 'underline' - use underlines (1_000_000)
5933 commifyMode => 'none', # [config]
5934  
5935 # Flag set to TRUE if the session's 'main' window urgency hint should be set once, when
5936 # the next text is received from the world; as soon as text is received, the flag is
5937 # set back to FALSE.
5938 tempUrgencyFlag => FALSE,
5939 # Flag set to TRUE if a sound effect should be played, when the next text is received
5940 # from the world; as soon as text is received, the flag is set back to FALSE
5941 tempSoundFlag => FALSE,
5942  
5943 # Regexes used to recognise valid web links
5944 constUrlRegex => $urlRegex,
5945 constShortUrlRegex => $shortRegex,
5946 # Flag set to TRUE if GA::Session->extractClickLinks should use both
5947 # $self->constUrlRegex and ->constShortUrlRegex, set to FALSE if it should only use
5948 # ->constUrlRegex
5949 shortUrlFlag => TRUE,
5950 # Regex used to recognise valid email addresses
5951 constEmailRegex => $emailRegex,
5952  
5953 # IV set briefly by private code (not included in the public release) which creates a
5954 # set of pre-configured worlds in the /items/worlds directory. When set,
5955 # ';exportfiles' and ';exportdata' save a file to a specific sub-directory, not to a
5956 # directory specified by the user. Set to 'undef' at all other times
5957 privConfigAllWorld => undef,
5958  
5959 # Benchmarking IVs
5960 # ----------------
5961  
5962 # Provides on-the-fly benchmarking of Axmud processes
5963 # Call $self->benchMark to set a start time, and $self->stopBenchMark to set a stop
5964 # time. The difference between the two is used to set the list IVs
5965 # The start time (matches the system time); set by $self->benchMark and reset by
5966 # ->stopBenchMark
5967 benchMarkTime => undef,
5968 # The last 10 and 100 benchmark times, used to provide an average (in microseconds),
5969 # which is written to the terminal
5970 benchMarkShortList => [],
5971 benchMarkLongList => [],
5972  
5973 # Debug flags
5974 # -----------
5975  
5976 # Flag set to TRUE if the text received from the world should be displayed in the 'main'
5977 # window with explicit text buffer line numbers (set to FALSE if text should be
5978 # displayed normally)
5979 debugLineNumsFlag => FALSE, # [config]
5980 # Flag set to TRUE if the text received from the world should be displayed in the 'main'
5981 # window with explicit Axmud colour/style tags (set to FALSE if text should be
5982 # displayed normally)
5983 debugLineTagsFlag => FALSE, # [config]
5984 # Flag set to TRUE if the Locator task should display standard debug messages as it
5985 # tries to interpret room statements (set to FALSE if the Locator should behave
5986 # normally)
5987 # Locator task debug messages uses an error code in the range 100-999
5988 debugLocatorFlag => FALSE, # [config]
5989 # Flag set to TRUE if the Locator task should display extensive standard debug messages
5990 # as it tries to interpret room statements (set to FALSE if the Locator should behave
5991 # normally)
5992 debugMaxLocatorFlag => FALSE, # [config]
5993 # Flag set to TRUE if GA::Obj::Exit should display debug messages for an illegal
5994 # exit direction (typically one that's over 64 characters long), FALSE if no debug
5995 # message should be shown
5996 debugExitFlag => FALSE, # [config]
5997 # Flag set to TRUE if the Locator task should display a summary of the contents of its
5998 # ->moveList IV (which contains a list of look/glance and movement commands for which
5999 # it is expecting to receive room statements) in its task window (set to FALSE if the
6000 # Locator's task window should behave normally)
6001 debugMoveListFlag => FALSE, # [config]
6002 # Flag set to TRUE if GA::Obj::WorldModel->parseObj (which converts a string like 'Two
6003 # big guards, a troll and three small torches are here' into a string of non-model
6004 # objects) should display standard debug messages as it parses lines (set to FALSE if
6005 # the function should behave normally)
6006 debugParseObjFlag => FALSE, # [config]
6007 # Flag set to TRUE if GA::Obj::WorldModel->objCompare (which compares a target model
6008 # object against a list of other model objects, to see if any of them seem to match
6009 # the target) should display standard debug messages as it makes comparisons (set to
6010 # FALSE if the function should behave normally)
6011 # (Also used by GA::Obj::WorldModel->objMatch)
6012 debugCompareObjFlag => FALSE, # [config]
6013 # Flag set to TRUE if GA::Client->loadPlugin should display debug messages, when a
6014 # plugin can't be loaded, specifying exactly why (set to FALSE otherwise)
6015 debugExplainPluginFlag => FALSE, # [config]
6016 # Flag set to TRUE if functions in the generic object, Games::Axmud (inherited by all
6017 # other objects) should show a debug message every time some part of the Axmud code
6018 # tries to use an IV which doesn't exist
6019 debugCheckIVFlag => TRUE, # [config]
6020 # Flag set to TRUE if Axmud should show error messages if a table object (inheriting
6021 # from GA::Generic::Table) can't be added or resized within its table strip object
6022 # (GA::Strip::Table)
6023 debugTableFitFlag => FALSE, # [config]
6024 # Flag set to TRUE if Perl errors/warnings should be displayed in the 'main' window
6025 # (set to FALSE if they should be sent to the terminal)
6026 debugTrapErrorFlag => TRUE, # [config]
6027  
6028 # Misc flags
6029 # ----------
6030  
6031 # When Axmud first runs (specifically, when GA::Obj::File->setupConfigFile is called),
6032 # the Setup 'wiz' window (GA::WizWin::Setup) invites the new user to initialise a few
6033 # settings. If required for testing purposes, the window can be blocked by setting
6034 # this flag to FALSE
6035 allowSetupWizWinFlag => TRUE,
6036 # If the flag above is TRUE, GA::Obj::File->setupConfigFile sets this flag to TRUE,
6037 # which is the signal to GA::Client->start to open the Setup 'wiz' window
6038 showSetupWizWinFlag => FALSE,
6039 # Flag that can be set to TRUE by any code (by calling $self->set_blockWorldHintFlag)
6040 # to stop the GA::Session displaying a 'dialogue' window with the world profile's
6041 # ->worldHint, when the session starts
6042 blockWorldHintFlag => FALSE,
6043 };
6044  
6045 # Bless the object into existence
6046 bless $self, $class;
6047  
6048 # Set remaining IVs
6049  
6050 $self->{charSet} = $self->constCharSet;
6051 # Sets ->charSetList
6052 $self->compileCharSets();
6053  
6054 $self->{clientCmdPrettyList} = [$self->constClientCmdPrettyList];
6055  
6056 $self->{cmdSep} = $self->constCmdSep;
6057  
6058 $self->{constWorldList} = [
6059 sort {lc($a) cmp lc($b)}
6060 ($self->ivKeys('constWorldHash'))
6061 ];
6062  
6063 $self->{cageTypeList} = [$self->constCageTypeList];
6064  
6065 $self->{taskPackageHash} = {$self->constTaskPackageHash};
6066 $self->{taskLabelHash} = {$self->constTaskLabelHash};
6067 $self->{taskRunFirstList} = [$self->constTaskRunFirstList];
6068 $self->{taskRunLastList} = [$self->constTaskRunLastList];
6069  
6070 $self->{logPrefHash} = {$self->constLogPrefHash};
6071  
6072 $self->{chatSmileyHash} = {$self->constChatSmileyHash};
6073  
6074 $self->{colourTagHash} = {$self->constColourTagHash};
6075 $self->{boldColourTagHash} = {$self->constBoldColourTagHash};
6076  
6077 # Sets ->constXTermColourHash, ->constNetscapeColourHash
6078 $self->setXTermColours();
6079 if ($self->currentColourCube eq 'netscape') {
6080  
6081 $self->{xTermColourHash} = {$self->constNetscapeColourHash};
6082  
6083 } else {
6084  
6085 # Default
6086 $self->{xTermColourHash} = {$self->constXTermColourHash};
6087 }
6088  
6089 foreach my $item ($self->constMsspVarList) {
6090  
6091 if (substr($item, 0, 1) ne '#') {
6092  
6093 $msspHash{$item} = undef;
6094 }
6095 }
6096  
6097 $self->{constMsspVarHash} = \%msspHash;
6098  
6099 $self->{defaultEnabledWinmap} = $self->constDefaultEnabledWinmap;
6100 $self->{defaultDisabledWinmap} = $self->constDefaultDisabledWinmap;
6101 $self->{defaultInternalWinmap} = $self->constDefaultInternalWinmap;
6102  
6103 $self->{gridBlockSize} = $self->constGridBlockSize;
6104  
6105 $self->{initWorkspaceHash} = {$self->constInitWorkspaceHash};
6106 $self->{initWorkspaceDir} = $self->constInitWorkspaceDir;
6107  
6108 $self->{customMainWinWidth} = $self->constMainWinWidth;
6109 $self->{customMainWinHeight} = $self->constMainWinHeight;
6110 $self->{customGridWinWidth} = $self->constGridWinWidth;
6111 $self->{customGridWinHeight} = $self->constGridWinHeight;
6112 $self->{customFreeWinWidth} = $self->constFreeWinWidth;
6113 $self->{customFreeWinHeight} = $self->constFreeWinHeight;
6114  
6115 $self->{customInsertCmdColour} = $self->constInsertCmdColour;
6116 $self->{customShowSystemTextColour}
6117 = $self->constShowSystemTextColour;
6118 $self->{customShowErrorColour} = $self->constShowErrorColour;
6119 $self->{customShowWarningColour}
6120 = $self->constShowWarningColour;
6121 $self->{customShowDebugColour} = $self->constShowDebugColour;
6122 $self->{customShowImproperColour}
6123 = $self->constShowImproperColour;
6124  
6125 $self->{customTextBufferSize} = $self->constTextBufferSize;
6126  
6127 $self->{customStripHash} = {$self->constStripHash};
6128 $self->{customTableHash} = {$self->constTableHash};
6129  
6130 if ($^O eq 'linux') {
6131 @cmdList = $self->constLinuxCmdList;
6132 } elsif ($^O eq 'MSWin32') {
6133 @cmdList = $self->constMSWinCmdList;
6134 } elsif ($^O =~ m/bsd/i) { # 'freebsd', 'openbsd'
6135 @cmdList = $self->constBSDCmdList;
6136 }
6137  
6138 $self->{customDisplayBufferSize}
6139 = $self->constDisplayBufferSize;
6140 $self->{customInstructBufferSize}
6141 = $self->constInstructBufferSize;
6142 $self->{customCmdBufferSize} = $self->constCmdBufferSize;
6143  
6144 $self->{browserCmd} = shift @cmdList;
6145 $self->{emailCmd} = shift @cmdList;
6146 $self->{audioCmd} = shift @cmdList;
6147 $self->{textEditCmd} = shift @cmdList;
6148  
6149 $self->compileSoundEffects();
6150 foreach my $effect ($self->ivKeys('constExtendedSoundHash')) {
6151  
6152 # Values in ->constExtendedSoundHash are file names relative to /items/sounds; values in
6153 # ->customSoundHash should be full file paths
6154 $soundHash{$effect}
6155 = $axmud::DATA_DIR . '/sounds/' . $self->ivShow('constExtendedSoundHash', $effect);
6156 }
6157  
6158 $self->{customSoundHash} = {%soundHash};
6159  
6160 if ($^O eq 'MSWin32') {
6161 $self->{constTTSCompatList} = ['espeak', 'esng', 'festival', 'swift', 'none'];
6162 } else {
6163 $self->{constTTSCompatList} = [$self->constTTSList];
6164 }
6165  
6166 $self->{ttsAttribHash} = {$self->constTtsAttribHash};
6167 $self->{ttsFlagAttribHash} = {$self->constTtsFlagAttribHash};
6168 $self->{ttsAlertAttribHash} = {$self->constTtsAlertAttribHash};
6169  
6170 $self->{customMonthList} = [$self->constMonthList];
6171 $self->{customDayList} = [$self->constDayList];
6172  
6173 $self->{ipLookupList} = [$self->constIPLookupList];
6174  
6175 $self->{promptWaitTime} = $self->constPromptWaitTime;
6176 $self->{loginWarningTime} = $self->constLoginWarningTime;
6177  
6178 if ($^O eq 'MSWin32') {
6179 $self->{toolbarLabelFlag} = FALSE;
6180 } else {
6181 $self->{toolbarLabelFlag} = TRUE;
6182 }
6183  
6184 return $self;
6185 }
6186  
6187 ##################
6188 # Methods
6189  
6190 # Support functions for ->new
6191  
6192 sub compileCharSets {
6193  
6194 # Called by $self->new to set the contents of $self->charSetList
6195 #
6196 # Expected arguments
6197 # (none besides $self)
6198 #
6199 # Return values
6200 # 'undef' on improper arguments
6201 # 1 otherwise
6202  
6203 my ($self, $check) = @_;
6204  
6205 # Local variables
6206 my (
6207 $latinFlag, $unicodeFlag, $strictFlag, $extendFlag,
6208 @allList, @modList,
6209 );
6210  
6211 # Check for improper arguments
6212 if (defined $check) {
6213  
6214 # Global variable $axmud::CLIENT not set yet, so we'll just have to print the
6215 # improper arguments message
6216 print "IMPROPER ARGUMENTS: Games::Axmud::Client->compileCharSets "
6217 . join(' ', @_) . "\n";
6218 return undef;
6219 }
6220  
6221 # Get the Perl module's list of all charsets
6222 @allList = Encode->encodings(":all");
6223  
6224 # Some encodings are more important for Axmud than others. If the list contains them, move
6225 # them to the top of the list
6226 # (We'll sort the list first, although it should already be sorted)
6227 foreach my $item (sort {lc($a) cmp lc($b)} (@allList)) {
6228  
6229 if ($item eq 'iso-8859-1') {
6230 $latinFlag = TRUE;
6231 } elsif ($item eq 'utf8') {
6232 $unicodeFlag = TRUE;
6233 } elsif ($item eq 'utf-8-strict') {
6234 $strictFlag = TRUE;
6235 } elsif ($item eq 'cp437') {
6236 $extendFlag = TRUE;
6237 } else {
6238 push (@modList, $item);
6239 }
6240 }
6241  
6242 if ($extendFlag) {
6243  
6244 unshift (@modList, 'cp437');
6245 }
6246  
6247 if ($strictFlag) {
6248  
6249 unshift (@modList, 'utf-8-strict');
6250 }
6251  
6252 if ($unicodeFlag) {
6253  
6254 unshift (@modList, 'utf8');
6255 }
6256  
6257 if ($latinFlag) {
6258  
6259 unshift (@modList, 'iso-8859-1');
6260 }
6261  
6262 # Set the IV
6263 $self->{charSetList} = \@modList;
6264  
6265 return 1;
6266 }
6267  
6268 sub setXTermColours {
6269  
6270 # Called by $self->new to set the contents of $self->constXTermColourHash and
6271 # ->constNetscapeColourHash, based on a fixed algorithm borrowed from
6272 # http://www.gammon.com.au/forum/bbshowpost.php?id=7761&page=4
6273 #
6274 # Expected arguments
6275 # (none besides $self)
6276 #
6277 # Return values
6278 # 'undef' on improper arguments
6279 # 1 otherwise
6280  
6281 my ($self, $check) = @_;
6282  
6283 # Local variables
6284 my (%xTermHash, %netscapeHash);
6285  
6286 # Check for improper arguments
6287 if (defined $check) {
6288  
6289 # Global variable $axmud::CLIENT not set yet, so we'll just have to print the
6290 # improper arguments message
6291 print "IMPROPER ARGUMENTS: Games::Axmud::Client->setXTermColours "
6292 . join(' ', @_) . "\n";
6293 return undef;
6294 }
6295  
6296 # Generate the xterm colour cube
6297 %xTermHash = $self->generateColourCube(
6298 0,
6299 95,
6300 135,
6301 175,
6302 215,
6303 255,
6304 );
6305  
6306 $self->{constXTermColourHash} = \%xTermHash;
6307  
6308 # Generate the netscape colour cube
6309 %netscapeHash = $self->generateColourCube(
6310 0,
6311 51,
6312 102,
6313 153,
6314 204,
6315 255,
6316 );
6317  
6318 $self->{constNetscapeColourHash} = \%netscapeHash;
6319  
6320 return 1;
6321 }
6322  
6323 sub generateColourCube {
6324  
6325 # Called by $self->setXTermColours to generate one of the two colour cubes used by Axmud:
6326 # either the xterm colour cube or the netscape colour cube
6327 #
6328 # Expected arguments
6329 # @valueList
6330 # - Set of values that differentiate the two colour cubes
6331 # - Set to (0, 95, 135, 175, 205, 255) for the xterm colour cube
6332 # - Set to (0, 51, 102, 153, 204, 255) for the netscape colour cube
6333 #
6334 # Return values
6335 # An empty hash on improper arguments
6336 # Otherwise returns a hash converting an xterm colour tag (a string in the range 'x0' to
6337 # 'x255') into an RGB colour tag (a string in the range '#000000' to '#FFFFFF')
6338  
6339 my ($self, @valueList) = @_;
6340  
6341 # Local variables
6342 my (
6343 @colourList,
6344 %emptyHash, %returnHash,
6345 );
6346  
6347 # Check for improper arguments
6348 if (! @valueList) {
6349  
6350 # Global variable $axmud::CLIENT not set yet, so we'll just have to print the
6351 # improper arguments message
6352 print "IMPROPER ARGUMENTS: Games::Axmud::Client->generateColourCube "
6353 . join(' ', @_) . "\n";
6354 return %emptyHash;
6355 }
6356  
6357 # Add basic xterm colour tags x0 - x15
6358 push (@colourList,
6359 $self->convertRGB(0, 0, 0), # black
6360 $self->convertRGB(128, 0, 0), # maroon
6361 $self->convertRGB(0, 128, 0), # green
6362 $self->convertRGB(128, 128, 0), # olive
6363 $self->convertRGB(0, 0, 128), # navy
6364 $self->convertRGB(128, 0, 128), # purple
6365 $self->convertRGB(0, 128, 128), # teal
6366 $self->convertRGB(192, 192, 192), # silver
6367  
6368 $self->convertRGB(128, 128, 128), # grey
6369 $self->convertRGB(255, 0, 0), # red
6370 $self->convertRGB(0, 255, 0), # lime
6371 $self->convertRGB(255, 255, 0), # yellow
6372 $self->convertRGB(0, 0, 255), # blue
6373 $self->convertRGB(255, 0, 255), # magenta
6374 $self->convertRGB(0, 255, 255), # cyan
6375 $self->convertRGB(255, 255, 255), # white
6376 );
6377  
6378 # Add extended xterm colour tags x16 - x230
6379 for (my $red = 0; $red < 6; $red++) {
6380  
6381 for (my $green = 0; $green < 6; $green++) {
6382  
6383 for (my $blue = 0; $blue < 6; $blue++) {
6384  
6385 $colourList[(16 + ($red * 36) + ($green * 6) + $blue)]
6386 = $self->convertRGB(
6387 $valueList[$red],
6388 $valueList[$green],
6389 $valueList[$blue],
6390 );
6391 }
6392 }
6393 }
6394  
6395 # Add greyscale xterm colour tags x231-x255
6396 for (my $grey = 0; $grey < 24; $grey++) {
6397  
6398 my $value = 8 + ($grey * 10);
6399  
6400 $colourList[($grey + 232)] = $self->convertRGB($value, $value, $value);
6401 }
6402  
6403 # Prepare the return hash
6404 for (my $index = 0; $index < 256; $index++) {
6405  
6406 $returnHash{'x' . $index} = $colourList[$index];
6407 }
6408  
6409 return %returnHash;
6410 }
6411  
6412 sub convertRGB {
6413  
6414 # Called by $self->generateColourCube, which was in turn called by $self->setXTermColours
6415 # and $self->new
6416 # Converts an xterm-256 colour (using a 6x6x6 colour cube) into an RGB colour tag
6417 #
6418 # Expected arguments
6419 # $red - An integer in the range 0-255
6420 # $green - An integer in the range 0-255
6421 # $blue - An integer in the range 0-255
6422 #
6423 # Return values
6424 # 'undef' on improper arguments
6425 # Otherwise returns an RGB colour tag like '#000000'
6426  
6427 my ($self, $red, $green, $blue, $check) = @_;
6428  
6429 # Check for improper arguments
6430 if (! defined $red || ! defined $green || ! defined $blue || defined $check) {
6431  
6432 # Global variable $axmud::CLIENT not set yet, so we'll just have to print the
6433 # improper arguments message
6434 print "IMPROPER ARGUMENTS: Games::Axmud::Client->convertRGB " . join(' ', @_) . "\n";
6435 return undef;
6436 }
6437  
6438 return ('#' . sprintf('%02X%02X%02X', $red, $green, $blue));
6439 }
6440  
6441 sub compileSoundEffects {
6442  
6443 # Called by $self->new to set the contents of $self->constExtendedSoundHash; one key-value
6444 # pair for every sound file in /items/sounds
6445 #
6446 # Expected arguments
6447 # (none besides $self)
6448 #
6449 # Return values
6450 # 'undef' on improper arguments or if the /items/sounds directory doesn't exist
6451 # 1 otherwise
6452  
6453 my ($self, $check) = @_;
6454  
6455 # Local variables
6456 my (
6457 $dir, $dirHandle, $regex,
6458 @fileList,
6459 %hash,
6460 );
6461  
6462 # Check for improper arguments
6463 if (defined $check) {
6464  
6465 # Global variable $axmud::CLIENT not set yet, so we'll just have to print the
6466 # improper arguments message
6467 print "IMPROPER ARGUMENTS: Games::Axmud::Client->compileSoundEffects "
6468 . join(' ', @_) . "\n";
6469 return undef;
6470 }
6471  
6472 $dir = $axmud::SHARE_DIR . '/items/sounds/';
6473 if (! -e $dir) {
6474  
6475 return undef;
6476 }
6477  
6478 # Get a list of text files in this directory
6479 if (! opendir ($dirHandle, $dir)) {
6480  
6481 return undef;
6482  
6483 } else {
6484  
6485 @fileList = readdir ($dirHandle);
6486 closedir $dirHandle;
6487 }
6488  
6489 # Filter out non-sound files
6490 $regex = '\.(' . join('|', $self->ivKeys('constSoundFormatHash')) . ')$';
6491 foreach my $file (@fileList) {
6492  
6493 my $name;
6494  
6495 if ($file =~ m/$regex/) {
6496  
6497 $name = $file;
6498 $name =~ s/$regex//;
6499  
6500 $hash{$name} = $file;
6501 }
6502 }
6503  
6504 # Set the IV
6505 $self->{constExtendedSoundHash} = \%hash;
6506  
6507 return 1;
6508 }
6509  
6510 # Start / stop
6511  
6512 sub start {
6513  
6514 # Called by axmud.pl on startup, immediately after the call to GA::Client->new
6515 # Starts the client. Opens the first 'main' window, and prompts the user to connect to a
6516 # world
6517 #
6518 # Expected arguments
6519 # (none besides $self)
6520 #
6521 # Return values
6522 # 'undef' on improper arguments or if setup fails
6523 # 1 otherwise
6524  
6525 my ($self, $check) = @_;
6526  
6527 # Local variables
6528 my (
6529 $warningFlag, $roomObj, $exitObj, $desktopObj, $host, $engine, $port, $world, $profObj,
6530 $taskObj, $offlineFlag,
6531 @list,
6532 );
6533  
6534 # Check for improper arguments
6535 if (defined $check) {
6536  
6537 return $axmud::CLIENT->writeImproper($self->_objClass . '->start', @_);
6538 }
6539  
6540 # Set the date/time at which the client started
6541 $self->ivPoke('startTime', $self->localTime());
6542 $self->ivPoke('startClock', $self->localClock());
6543 $self->ivPoke('startDate', $self->localDate());
6544 $self->ivPoke('startClockString', $self->localClockString());
6545 $self->ivPoke('startDateString', $self->localDateString());
6546  
6547 # In Axmud test mode, blind mode is always disabled
6548 if ($axmud::TEST_MODE_FLAG) {
6549  
6550 $axmud::BLIND_MODE_FLAG = FALSE;
6551 }
6552  
6553 # In Axmud blind mode, TTS is always enabled
6554 if ($axmud::BLIND_MODE_FLAG) {
6555  
6556 $self->ivPoke('systemAllowTTSFlag', TRUE);
6557 }
6558  
6559 # Load the basic mudlist, and store the data in GA::Obj::BasicWorld objects. The data
6560 # isn't important, so don't disable loading/saving of data files if the operation fails
6561 if (! $self->loadBasicWorlds()) {
6562  
6563 $warningFlag = TRUE;
6564 $self->writeWarning(
6565 'Could not load basic mudlist (files possible corrupted)',
6566 $self->_objClass . '->start',
6567 );
6568 }
6569  
6570 # Load phrasebooks, and store the data in GA::Obj::PhraseBook objects. The data isn't
6571 # important, so don't disable loading/saving of data files if the operation fails
6572 if (! $self->loadPhrasebooks()) {
6573  
6574 $warningFlag = TRUE;
6575 $self->writeWarning(
6576 'Could not load phrasebooks (files possible corrupted)',
6577 $self->_objClass . '->start',
6578 );
6579 }
6580  
6581 # Create the file objects stored by this GA::Client object
6582 if (! $self->createFileObjs()) {
6583  
6584 $warningFlag = TRUE;
6585 $self->writeWarning(
6586 'Could not create file objects for the client - loading/saving disabled',
6587 $self->_objClass . '->start',
6588 );
6589  
6590 # Disable all loading/saving of data files (the TRUE argument means 'don't prompt the
6591 # user to do an emergency save')
6592 $self->disableAllFileAccess(TRUE);
6593 }
6594  
6595 # Make sure all standard directories exist
6596 if (! $self->createDataDirs()) {
6597  
6598 $warningFlag = TRUE;
6599 $self->writeWarning(
6600 'Could not create standard directories - loading/saving disabled',
6601 $self->_objClass . '->start',
6602 );
6603  
6604 # Disable all loading/saving of data files (the TRUE argument means 'don't prompt the
6605 # user to do an emergency save')
6606 $self->disableAllFileAccess(TRUE);
6607 }
6608  
6609 # Delete everything in the temporary directories
6610 # (The former is for plugins; the latter is for Axmud code)
6611 foreach my $tempDir ($axmud::DATA_DIR . '/tmp/', $axmud::DATA_DIR . '/data/temp/') {
6612  
6613 # Simplest way to empty the directory and all its sub-directories seems to be to
6614 # destroy the directory and make a new one
6615 File::Path::remove_tree($tempDir);
6616 mkdir ($tempDir, 0755);
6617 }
6618  
6619 # Create interface model objects (which store default values for interfaces - triggers,
6620 # aliases, macros, timers and hooks)
6621 @list = ('trigger', 'alias', 'macro', 'timer', 'hook');
6622 foreach my $type (@list) {
6623  
6624 my ($package, $obj);
6625  
6626 $package = 'Games::Axmud::InterfaceModel::' . ucfirst($type);
6627 $obj = $package->new();
6628 if (! $obj) {
6629  
6630 # (Allow writing to something other than GA::Session - there are no sessions yet)
6631 return $self->writeError(
6632 'Could not create interface model objects',
6633 $self->_objClass . '->start',
6634 );
6635  
6636 } else {
6637  
6638 $self->ivAdd('interfaceModelHash', $type, $obj);
6639 }
6640 }
6641  
6642 # Create standard zonemaps
6643 $self->createStandardZonemaps();
6644 # Create standard winmaps
6645 $self->createStandardWinmaps();
6646 # Create standard colour schemes
6647 $self->createStandardColourSchemes();
6648 # Set up supported MCP packages
6649 $self->createSupportedMcpPackages();
6650 # Set up keycodes for the current system
6651 $self->setupKeycodes();
6652 # Create default TTS objects
6653 $self->ttsCreateStandard();
6654  
6655 # Create a room object and an exit object with default values for their IVs, used to supply
6656 # default values for all other room/exit objects
6657 $roomObj = Games::Axmud::ModelObj::Room->new($self, 'default', 'global');
6658 $exitObj = Games::Axmud::Obj::Exit->new($self, 'default', 'global');
6659 if (! $roomObj || ! $exitObj) {
6660  
6661 return $self->writeError(
6662 'Could not initialise the default room and exit objects',
6663 $self->_objClass . '->start',
6664 );
6665  
6666 } else {
6667  
6668 $axmud::DEFAULT_ROOM = $roomObj;
6669 $axmud::DEFAULT_EXIT = $exitObj;
6670 }
6671  
6672 # Load (or create) the config file (if allowed)
6673 if (! $self->configFileObj->setupConfigFile()) {
6674  
6675 $warningFlag = TRUE;
6676 $self->writeWarning(
6677 'Error reading (or creating) the ' . $axmud::SCRIPT . ' config file - loading'
6678 . '/saving disabled',
6679 $self->_objClass . '->start',
6680 );
6681  
6682 # Disable all loading/saving of data files (the TRUE argument means 'don't prompt the
6683 # user to do an emergency save')
6684 $self->disableAllFileAccess(TRUE);
6685 }
6686  
6687 # Any changes to IV values which could not be applied immediately, the last time Axmud was
6688 # running, should be applied now
6689 # (->restartShareMainWinMode is 'default' if no change is required, or 'off' / 'on' if a
6690 # change is required)
6691 if ($self->restartShareMainWinMode ne 'default') {
6692  
6693 if ($self->restartShareMainWinMode eq 'off') {
6694 $self->ivPoke('shareMainWinFlag', FALSE);
6695 } else {
6696 $self->ivPoke('shareMainWinFlag', TRUE);
6697 }
6698  
6699 $self->ivPoke('restartShareMainWinMode', 'default');
6700 }
6701  
6702 # Initialise the default set of toolbar button objects
6703 if (! $self->initialiseToolbar()) {
6704  
6705 return $self->writeError(
6706 'Could not initialise toolbar button objects',
6707 $self->_objClass . '->start',
6708 );
6709 }
6710  
6711 # Create the main desktop object. Set up the default workspace, set up window icons, prepare
6712 # rc-file styles for each kind of window, create the first 'main' window
6713 $desktopObj = Games::Axmud::Obj::Desktop->new();
6714 if (! $desktopObj) {
6715  
6716 return $self->writeError(
6717 'Could not set up the desktop',
6718 $self->_objClass . '->start',
6719 );
6720  
6721 } else {
6722  
6723 $self->ivPoke('desktopObj', $desktopObj);
6724 if (! $desktopObj->start()) {
6725  
6726 return $self->writeError(
6727 'Could not set up the desktop',
6728 $self->_objClass . '->start',
6729 );
6730  
6731 } else {
6732  
6733 # Loading of data files and plugins could take some seconds; make the whole 'main'
6734 # window visible in the meantime
6735 $desktopObj->updateWidgets($self->_objClass . '->start');
6736 }
6737 }
6738  
6739 # Perform an auto-backup of Axmud's data directory, if required
6740 if (
6741 $self->autoBackupMode eq 'all_start'
6742 || (
6743 $self->autoBackupMode eq 'interval_start' && $self->checkBackupInterval()
6744 )
6745 ) {
6746 $self->doAutoBackup();
6747 }
6748  
6749 # Display a 'dialogue' window while loading data files/plugins
6750 if (! $axmud::TEST_MODE_FLAG && ! $axmud::BLIND_MODE_FLAG) {
6751  
6752 $self->mainWin->showBusyWin();
6753 }
6754  
6755 # If the user is using a new version of Axmud, check if there are any new pre-configured
6756 # worlds in this version. If so, insert them into Axmud's data directory
6757 if (
6758 $self->convertVersion($axmud::VERSION) > $self->convertVersion($self->prevClientVersion)
6759 ) {
6760 $self->insertPreConfigWorlds();
6761 # Don't perform this operation again until the next Axmud release
6762 $self->ivPoke('prevClientVersion', $axmud::VERSION);
6763 }
6764  
6765 # Load world profiles, creating a file object for each (if allowed, and if there are any to
6766 # load)
6767 if ($self->loadDataFlag && $self->configWorldProfList && ! $axmud::TEST_PRE_CONFIG_FLAG) {
6768  
6769 if (! $self->loadWorldProfs() ) {
6770  
6771 $warningFlag = TRUE;
6772 $self->writeWarning(
6773 'Error loading the world profiles expected after reading the \'config\''
6774 . ' file',
6775 $self->_objClass . '->start',
6776 );
6777 }
6778 }
6779  
6780 # Load data for the remaining file objects ('tasks', 'scripts', 'contacts', 'dicts',
6781 # 'toolbar', 'usercmds', 'zonemaps', 'winmaps', 'tts')
6782 if ($self->loadDataFlag && ! $self->loadOtherFiles()) {
6783  
6784 $warningFlag = TRUE;
6785 $self->writeWarning(
6786 'Error reading (or creating) data files - loading/saving disabled',
6787 $self->_objClass . '->start',
6788 );
6789  
6790 # Disable all loading/saving of data files (the TRUE argument means 'don't prompt the
6791 # user to do an emergency save')
6792 $self->disableAllFileAccess(TRUE);
6793 }
6794  
6795 # Add remaining workspaces, if any are specified
6796 $desktopObj->setupWorkspaces();
6797  
6798 # Set up client commands
6799 if (! $self->setupCmds()) {
6800  
6801 # (Allow writing to something other than GA::Session - there are no sessions yet)
6802 return $self->writeError(
6803 'Could not initialise ' . $axmud::SCRIPT . ' client commands',
6804 $self->_objClass . '->start',
6805 );
6806 }
6807  
6808 # Delete the contents of log directories (leaving files inside worlds' own log directories
6809 # intact), if the flag is set (but don't delete directories if this function has produced
6810 # any warning messages - so that the messages aren't lost
6811 if ($self->deleteStandardLogsFlag && ! $warningFlag) {
6812  
6813 $self->deleteStandardLogs();
6814 }
6815  
6816 # Load plugins in the /private directory, if it exists (will not exist in any public release
6817 # of Axmud)
6818 if (-e $axmud::SHARE_DIR . '/private') {
6819  
6820 $self->loadPrivatePlugins();
6821 }
6822  
6823 # Load initial plugins
6824 if ($self->initPluginList) {
6825  
6826 foreach my $pluginPath ($self->initPluginList) {
6827  
6828 if (! $self->loadPlugin($pluginPath)) {
6829  
6830 $self->writeWarning(
6831 'Error loading the plugin \'' . $pluginPath . '\'',
6832 $self->_objClass . '->start',
6833 );
6834 }
6835 }
6836 }
6837  
6838 # Close the 'dialogue' window and reset the Client IV that stores it
6839 if ($self->busyWin) {
6840  
6841 $self->mainWin->closeDialogueWin($self->busyWin);
6842 }
6843  
6844 # Start the client loop
6845 if (! $self->startClientLoop()) {
6846  
6847 return $self->writeError(
6848 'Could not start the client loop',
6849 $self->_objClass . '->start',
6850 );
6851 }
6852  
6853 # Prepare to initialise connections
6854 if ($self->showSetupWizWinFlag) {
6855  
6856 # When Axmud runs for the first time (specifically, when there is no Axmud config file)
6857 # this flag will be set to TRUE, instructing us to open the Setup 'wiz' window so the
6858 # new user can initialise a few settings
6859 if ($axmud::TEST_MODE_FLAG) {
6860  
6861 # In Axmud test mode, don't show the Setup window at all; just insert a couple of
6862 # tasks into the global initial tasklist
6863 $self->addGlobalInitTask('status_task');
6864 $self->addGlobalInitTask('locator_task');
6865  
6866 # Don't show the setup window twice
6867 $self->set_showSetupWizWinFlag(FALSE);
6868  
6869 } elsif ($axmud::BLIND_MODE_FLAG) {
6870  
6871 # In Axmud blind mode, don't show the Setup window at all; instead, insert a few
6872 # tasks into the global initial tasklist, and modify a few of their settings
6873 # (specifically, none of them open a task window)
6874 $taskObj = $self->addGlobalInitTask('status_task');
6875 if ($taskObj) {
6876  
6877 $taskObj->set_startWithWinFlag(FALSE);
6878 }
6879  
6880 $taskObj = $self->addGlobalInitTask('locator_task');
6881 if ($taskObj) {
6882  
6883 $taskObj->set_startWithWinFlag(FALSE);
6884 }
6885  
6886 $taskObj = $self->addGlobalInitTask('compass_task');
6887 if ($taskObj) {
6888  
6889 $taskObj->set_startWithWinFlag(FALSE);
6890 }
6891  
6892 $taskObj = $self->addGlobalInitTask('divert_task');
6893 if ($taskObj) {
6894  
6895 $taskObj->set_requireWinFlag(FALSE);
6896 $taskObj->set_startWithWinFlag(FALSE);
6897 # Turn off sound effects, since TTS is used instead
6898 $taskObj->ivUndef('tellAlertSound');
6899 $taskObj->ivUndef('socialAlertSound');
6900 $taskObj->ivUndef('customAlertSound');
6901 $taskObj->ivUndef('warningAlertSound');
6902 $taskObj->ivUndef('otherAlertSound');
6903 }
6904  
6905 # Don't show the setup window twice
6906 $self->set_showSetupWizWinFlag(FALSE);
6907  
6908 } else {
6909  
6910 # Open the setup window. When it closes, it will open the Connections window for us
6911 $self->mainWin->quickFreeWin('Games::Axmud::WizWin::Setup');
6912  
6913 # Disable most main window toolbar/menu items, while the window is open
6914 $self->desktopObj->restrictWidgets();
6915  
6916 # Don't show the setup window twice
6917 $self->set_showSetupWizWinFlag(FALSE);
6918  
6919 return 1;
6920 }
6921 }
6922  
6923 if (@ARGV) {
6924  
6925 # The user started Axmud with arguments, e.g. from a Linux terminal:
6926 # ./axmud.pl deathmud.com 5000
6927 # If the port is not specified, the generic port is used:
6928 # ./axmud.pl deathmud.com (use port 23)
6929 # The user can also specify a world profile name:
6930 # ./axmud.pl deathmud
6931 #
6932 # Any of those formats can use baxmud.pl rather than axmud.pl
6933 # Any of those formats can specify one of Axmud's supported text-to-speech engines,
6934 # after all the other arguments (any of the items in $self->constTTSList, e.g.
6935 # 'festival'). If a recognised speech engine is specified, that engine is used for
6936 # all text-to-speech while Axmud is running
6937 $engine = $ARGV[-1];
6938 if (defined $engine && defined $self->ivFind('constTTSList', $engine)) {
6939  
6940 pop @ARGV;
6941 $self->ivPoke('forceTTSEngine', $engine);
6942 }
6943 }
6944  
6945 if (@ARGV) {
6946  
6947 $host = shift @ARGV;
6948 $port = shift @ARGV;
6949 if (@ARGV) {
6950  
6951 # (Allow writing to something other than GA::Session - there are no sessions yet)
6952 return $self->writeError(
6953 'Invalid command line arguments (try \'<host> <port>\', \'<host>\' or'
6954 . ' \'<world_name>\')',
6955 $self->_objClass . '->start',
6956 );
6957 }
6958  
6959 if (! $port && $self->ivExists('worldProfHash', $host)) {
6960  
6961 # $host is a world profile name
6962 $world = $host;
6963 $profObj = $self->ivShow('worldProfHash', $world);
6964 ($host, $port) = $profObj->getConnectDetails();
6965  
6966 if (! $self->startSession($world, $host, $port)) {
6967  
6968 # (Allow writing to something other than GA::Session - there are no sessions
6969 # yet)
6970 return $self->writeError(
6971 'Could not open a session connecting to \'' . $host . '\'',
6972 $self->_objClass . '->start',
6973 );
6974 }
6975  
6976 } else {
6977  
6978 # $host is a host address. Get a temporary world name
6979 $world = $self->getTempProfName();
6980 if (
6981 ! $world
6982 || ! $self->startSession(
6983 $world,
6984 $host,
6985 $port,
6986 undef, # No character
6987 undef, # No password
6988 undef, # No account
6989 undef, # Default protocol
6990 undef, # No login mode
6991 FALSE, # Not offline mode
6992 TRUE, # Temporary world profile
6993 )
6994 ) {
6995 # (Allow writing to something other than GA::Session - there are no sessions
6996 # yet)
6997 return $self->writeError(
6998 'Could not open a session connecting to \'' . $host . '\'',
6999 $self->_objClass . '->start',
7000 );
7001 }
7002 }
7003  
7004 } elsif ($axmud::BLIND_MODE_FLAG && ! $self->autoConnectList) {
7005  
7006 # In Axmud blind mode, open a series of standard 'dialogue' windows, allowing the
7007 # visually-impaired user to select/create a world and/or character
7008 $self->connectBlind();
7009  
7010 } elsif ($axmud::TEST_MODE_FLAG) {
7011  
7012 # In Axmud test mode, connect to a world which is assumed to be running on the local
7013 # machine
7014 if (! $axmud::TEST_MODE_LOGIN_LIST[5]) {
7015 $offlineFlag = TRUE;
7016 } else {
7017 $offlineFlag = undef;
7018 }
7019  
7020 if (
7021 ! $self->startSession(
7022 $axmud::TEST_MODE_LOGIN_LIST[0], # World
7023 $axmud::TEST_MODE_LOGIN_LIST[1], # Host
7024 $axmud::TEST_MODE_LOGIN_LIST[2], # Post
7025 $axmud::TEST_MODE_LOGIN_LIST[3], # Character
7026 $axmud::TEST_MODE_LOGIN_LIST[4], # Password
7027 undef, # Account
7028 undef, # Default protocol
7029 undef, # No login mode
7030 $offlineFlag,
7031 )
7032 ) {
7033 return undef;
7034 }
7035  
7036 } elsif ($self->autoConnectList) {
7037  
7038 # Connect to all the worlds specified by the auto-connection list
7039 OUTER: foreach my $line ($self->autoConnectList) {
7040  
7041 my (
7042 $worldName, $worldObj, $host, $port, $char, $password, $account,
7043 @list,
7044 );
7045  
7046 # Each line is in the form <world> <optional_char> <optional_char>...
7047 @list = split(/\s+/, $line);
7048 $worldName = shift @list;
7049  
7050 # Check the world exists and, if not, ignore this line
7051 $worldObj = $self->ivShow('worldProfHash', $worldName);
7052 if (! $worldObj) {
7053  
7054 next OUTER;
7055 }
7056  
7057 if (! @list) {
7058  
7059 # Get connection details for this world
7060 ($host, $port) = $worldObj->getConnectDetails();
7061  
7062 # Connect without a character
7063 if (
7064 $self->startSession($worldName, $host, $port)
7065 && $axmud::BLIND_MODE_FLAG
7066 ) {
7067 # In blind mode, stop after the first successful connection
7068 last OUTER;
7069 }
7070  
7071 } else {
7072  
7073 INNER: foreach my $thisChar (@list) {
7074  
7075 # Check that the character profile exists
7076 my $profType = $worldObj->ivShow('profHash', $thisChar);
7077 if (! defined $profType || $profType ne 'char') {
7078  
7079 next INNER;
7080 }
7081  
7082 # Check that a connection has already been initiated for this world/
7083 # character combination
7084 foreach my $session ($self->ivValues('sessionHash')) {
7085  
7086 if (
7087 $session->initWorld eq $worldName
7088 && $session->initChar
7089 && $session->initChar eq $thisChar
7090 ) {
7091 next INNER;
7092 }
7093 }
7094  
7095 # Get connection details for this world
7096 ($host, $port, $char, $password, $account)
7097 = $worldObj->getConnectDetails($thisChar);
7098  
7099 # Connect with a character
7100 if (
7101 $self->startSession(
7102 $worldName,
7103 $host,
7104 $port,
7105 $char,
7106 $password,
7107 $account
7108 )
7109 && $axmud::BLIND_MODE_FLAG
7110 ) {
7111 # In blind mode, stop after the first successful connection
7112 last OUTER;
7113 }
7114 }
7115 }
7116 }
7117  
7118 # During this process, if no connections were actually initialised, open the Connections
7119 # window as normal (except in Axmud blind mode)
7120 if (! $self->sessionHash) {
7121  
7122 if ($axmud::BLIND_MODE_FLAG) {
7123 $self->connectBlind();
7124 } else {
7125 $self->mainWin->quickFreeWin('Games::Axmud::OtherWin::Connect');
7126 }
7127 }
7128  
7129 } else {
7130  
7131 # Open the Connections window. If the user wants to connect to a world, it calls
7132 # GA::Client->startSession
7133 $self->mainWin->quickFreeWin('Games::Axmud::OtherWin::Connect');
7134 }
7135  
7136 return 1;
7137 }
7138  
7139 sub stop {
7140  
7141 # Called by axmud.pl on shutdown
7142 # Also called by $self->stopSession, GA::Cmd::StopClient->do, GA::Cmd::Panic->do,
7143 # GA::Cmd::RestoreWorld->do, GA::Win::Internal->setDeleteEvent and
7144 # GA::Strip::MenuBar->drawWorldColumn
7145 # Stops the client
7146 #
7147 # Expected arguments
7148 # (none besides $self)
7149 #
7150 # Return values
7151 # 'undef' on improper arguments
7152 # 1 otherwise
7153  
7154 my ($self, $check) = @_;
7155  
7156 # Local variables
7157 my $tempDir;
7158  
7159 # Check for improper arguments
7160 if (defined $check) {
7161  
7162 return $axmud::CLIENT->writeImproper($self->_objClass . '->stop', @_);
7163 }
7164  
7165 # The END() function will call this function again, before terminating the script, unless
7166 # we set this flag
7167 # (The TRUE value also gives GA::Obj::WorkspaceGrid->stop to destroy a shared 'main'
7168 # window, rather than just disengaging it)
7169 $self->ivPoke('shutdownFlag', TRUE);
7170  
7171 # This flag prevents multiple concurrent calls to this function if, for example, the user
7172 # is repeatedly clicking the 'main' window's close button
7173 if ($self->terminatingFlag) {
7174  
7175 return undef;
7176  
7177 } else {
7178  
7179 $self->ivPoke('terminatingFlag', TRUE);
7180 }
7181  
7182 # If any text is being convertd to speech right now, interrupt it
7183 $self->ttsInterruptJob();
7184  
7185 # Perform an auto-backup of Axmud's data directory, if required
7186 if (
7187 $self->autoBackupMode eq 'all_stop'
7188 || (
7189 $self->autoBackupMode eq 'interval_stop' && $self->checkBackupInterval()
7190 )
7191 ) {
7192 $self->doAutoBackup();
7193 }
7194  
7195 # Fire any hooks in any session that are using the 'close_disconnect' hook event
7196 foreach my $sessionObj ($self->listSessions()) {
7197  
7198 $sessionObj->checkHooks('close_disconnect');
7199 }
7200  
7201 # Stop every current session
7202 if ($self->sessionHash && ! $self->stopAllSessions()) {
7203  
7204 return $self->writeError(
7205 'Could not stop all sessions',
7206 $self->_objClass . '->stop',
7207 );
7208 }
7209  
7210 # Stop the client loop (if running)
7211 if ($self->clientLoopObj && ! $self->stopClientLoop()) {
7212  
7213 return $self->writeError(
7214 'Could not stop the client loop',
7215 $self->_objClass . '->stop',
7216 );
7217 }
7218  
7219 # Close any remaining 'internal' windows, restore 'external' windows to their original size/
7220 # position, close any remaining 'free' windows
7221 if (! $self->desktopObj->stop()) {
7222  
7223 return $self->writeError(
7224 'Could not stop the desktop object',
7225 $self->_objClass . '->stop',
7226 );
7227 }
7228  
7229 # Delete everything in the temporary directories
7230 # (The former is for plugins; the latter is for Axmud code)
7231 foreach my $tempDir ($axmud::DATA_DIR . '/tmp/', $axmud::DATA_DIR . '/data/temp/') {
7232  
7233 # Simplest way to empty the directory and all its sub-directories seems to be to
7234 # destroy the directory and make a new one
7235 File::Path::remove_tree($tempDir);
7236 mkdir ($tempDir, 0755);
7237 }
7238  
7239 # Halt Gtk3, which halts Axmud
7240 Gtk3->main_quit();
7241  
7242 return 1;
7243 }
7244  
7245 # Setup
7246  
7247 sub loadBasicWorlds {
7248  
7249 # Called by $self->start
7250 # Loads data from the basic mudlist and stores it in GA::Obj::BasicWorld objects, ready for
7251 # the Connections window to display
7252 #
7253 # Expected arguments
7254 # (none besides $self)
7255 #
7256 # Return values
7257 # 'undef' on improper arguments, if the file can't be read or if it appears to be
7258 # corrupted
7259 # 1 on success
7260  
7261 my ($self, $check) = @_;
7262  
7263 # Local variables
7264 my (
7265 $path, $fileHandle, $exitFlag,
7266 @list,
7267 %hash,
7268 );
7269  
7270 # Check for improper arguments
7271 if (defined $check) {
7272  
7273 return $axmud::CLIENT->writeImproper($self->_objClass . '->loadBasicWorlds', @_);
7274 }
7275  
7276 $path = $axmud::SHARE_DIR . '/items/mudlist/mudlist.txt';
7277 if (! -e $path) {
7278  
7279 return undef;
7280 }
7281  
7282 # Open the file for reading
7283 if (! open ($fileHandle, "<$path")) {
7284  
7285 return undef;
7286 }
7287  
7288 # Read the file
7289 do {
7290  
7291 my $line = <$fileHandle>;
7292  
7293 # Without this line, Cyrillic text is read as gibberish
7294 $line = Encode::decode('utf8', $line);
7295  
7296 if (! defined $line) {
7297  
7298 $exitFlag = TRUE;
7299  
7300 # Ignore empty lines and comments
7301 } elsif ($line =~ m/\S/ && ! ($line =~ m/^\s*\#/)) {
7302  
7303 chomp $line;
7304 push (@list, $self->trimWhitespace($line));
7305 }
7306  
7307 } until ($exitFlag);
7308  
7309 close $fileHandle;
7310  
7311 if (! @list) {
7312  
7313 # File is empty
7314 return undef;
7315 }
7316  
7317 # Store the data
7318 do {
7319  
7320 my ($longName, $name, $host, $port, $adultFlag, $language, $obj);
7321  
7322 $longName = shift @list;
7323 $name = shift @list;
7324 $host = shift @list;
7325 $port = shift @list;
7326 $adultFlag = shift @list;
7327 $language = shift @list;
7328  
7329 # Check that a line isn't missing (and that an extra line hasn't been inserted) by
7330 # checking the value of the flag, which can only be 0 or 1, and also by checking that
7331 # $language is defined (which also means missing or additional lines)
7332 if (
7333 (! defined $adultFlag || ($adultFlag ne '1' && $adultFlag ne '0'))
7334 || ! defined $language
7335 ) {
7336 # File corrupted
7337 return undef;
7338 }
7339  
7340 # $adultFlag must be TRUE or FALSE
7341 if (! $adultFlag) {
7342 $adultFlag = FALSE;
7343 } else {
7344 $adultFlag = TRUE;
7345 }
7346  
7347 # Create an object to store basic details for this world
7348 $obj = Games::Axmud::Obj::BasicWorld->new(
7349 $name,
7350 $longName,
7351 $host,
7352 $port,
7353 $adultFlag,
7354 $language,
7355 );
7356  
7357 if (! $obj) {
7358  
7359 # Improper args or $name is invalid
7360 return undef;
7361  
7362 } else {
7363  
7364 $hash{$name} = $obj;
7365 }
7366  
7367 } until (! @list);
7368  
7369 # Data loaded successfully; store it
7370 $self->{constBasicWorldHash} = \%hash;
7371  
7372 # Operation complete
7373 return 1;
7374 }
7375  
7376 sub loadPhrasebooks {
7377  
7378 # Called by $self->start
7379 # Loads data from the phrasebook files and stores it in GA::Obj::Phrasebook objects
7380 #
7381 # Expected arguments
7382 # (none besides $self)
7383 #
7384 # Return values
7385 # 'undef' on improper arguments, if the file can't be read or if it appears to be
7386 # corrupted
7387 # 1 on success
7388  
7389 my ($self, $check) = @_;
7390  
7391 # Local variables
7392 my (
7393 $dirHandle, $dir,
7394 @fileList, @modList,
7395 %hash,
7396 );
7397  
7398 # Check for improper arguments
7399 if (defined $check) {
7400  
7401 return $axmud::CLIENT->writeImproper($self->_objClass . '->loadPhrasebooks', @_);
7402 }
7403  
7404 $dir = $axmud::SHARE_DIR . '/items/phrasebooks/';
7405 if (! -e $dir) {
7406  
7407 return undef;
7408 }
7409  
7410 # Get a list of text files in this directory
7411 if (! opendir ($dirHandle, $dir)) {
7412  
7413 return undef;
7414  
7415 } else {
7416  
7417 @fileList = readdir ($dirHandle);
7418 closedir $dirHandle;
7419 }
7420  
7421 # Filter out the file template (beginning with an underline) and anything that's not a .txt
7422 # file
7423 foreach my $file (@fileList) {
7424  
7425 if ($file =~ m/^[A-Za-z].*\.txt$/) {
7426  
7427 push (@modList, $file);
7428 }
7429 }
7430  
7431 if (! @modList) {
7432  
7433 return undef;
7434 }
7435  
7436 # Read each file in turn, creating a new phrasebook object for each
7437 foreach my $file (@modList) {
7438  
7439 my (
7440 $path, $fileHandle, $pbObj, $exitFlag, $name, $targetName, $nounPosn, $number,
7441 @lineList, @primaryDirList, @primaryAbbrevDirList, @definiteList, @indefiniteList,
7442 @andList, @orList, @numberList,
7443 );
7444  
7445 # Open the file for reading
7446 $path = $dir . $file;
7447 if (! open ($fileHandle, "<$path")) {
7448  
7449 return undef;
7450 }
7451  
7452 # Read the file
7453 do {
7454  
7455 my $line = <$fileHandle>;
7456  
7457 # Without this line, the Russian phrasebook is gibberish
7458 $line = Encode::decode('utf8', $line);
7459  
7460 if (! defined $line) {
7461  
7462 $exitFlag = TRUE;
7463  
7464 } elsif ($line =~ m/^\s*[[:alnum:]]/) {
7465  
7466 # Ignore empty lines and lines starting with a #
7467 chomp $line;
7468 push (@lineList, $self->trimWhitespace($line));
7469 }
7470  
7471 } until ($exitFlag);
7472  
7473 close $fileHandle;
7474  
7475 # Interpret the data
7476 $name = shift @lineList;
7477 $targetName = shift @lineList;
7478 $nounPosn = shift @lineList;
7479  
7480 for (my $count = 0; $count < 18; $count++) {
7481  
7482 push (@primaryDirList, shift @lineList);
7483 }
7484  
7485 for (my $count = 0; $count < 18; $count++) {
7486  
7487 push (@primaryAbbrevDirList, shift @lineList);
7488 }
7489  
7490 $number = shift @lineList;
7491 if (! $self->intCheck($number, 0)) {
7492  
7493 return undef;
7494  
7495 } elsif ($number > 0) {
7496  
7497 for (my $count = 0; $count < $number; $count++) {
7498  
7499 push (@definiteList, shift @lineList);
7500 }
7501 }
7502  
7503 $number = shift @lineList;
7504 if (! $self->intCheck($number, 0)) {
7505  
7506 return undef;
7507  
7508 } elsif ($number > 0) {
7509  
7510 for (my $count = 0; $count < $number; $count++) {
7511  
7512 push (@indefiniteList, shift @lineList);
7513 }
7514 }
7515  
7516 $number = shift @lineList;
7517 if (! $self->intCheck($number, 0)) {
7518  
7519 return undef;
7520  
7521 } elsif ($number > 0) {
7522  
7523 for (my $count = 0; $count < $number; $count++) {
7524  
7525 push (@andList, shift @lineList);
7526 }
7527 }
7528  
7529 $number = shift @lineList;
7530 if (! $self->intCheck($number, 0)) {
7531  
7532 return undef;
7533  
7534 } elsif ($number > 0) {
7535  
7536 for (my $count = 0; $count < $number; $count++) {
7537  
7538 push (@orList, shift @lineList);
7539 }
7540 }
7541  
7542 for (my $count = 0; $count < 10; $count++) {
7543  
7544 push (@numberList, shift @lineList);
7545 }
7546  
7547 # There shouldn't be anything left
7548 if (@lineList) {
7549  
7550 return undef;
7551 }
7552  
7553 # Store the data in a phrasebook object
7554 $pbObj = Games::Axmud::Obj::Phrasebook->new($name, $targetName);
7555 if (! $pbObj) {
7556  
7557 return undef;
7558  
7559 } else {
7560  
7561 if (substr($nounPosn, 0, 1) eq 'n') {
7562 $pbObj->ivPoke('nounPosn', 'noun_adj');
7563 } else {
7564 $pbObj->ivPoke('nounPosn', 'adj_noun');
7565 }
7566  
7567 $pbObj->ivPoke('primaryDirList', @primaryDirList);
7568 $pbObj->ivPoke('primaryAbbrevDirList', @primaryAbbrevDirList);
7569 $pbObj->ivPoke('definiteList', @definiteList);
7570 $pbObj->ivPoke('indefiniteList', @indefiniteList);
7571 $pbObj->ivPoke('andList', @andList);
7572 $pbObj->ivPoke('orList', @orList);
7573 $pbObj->ivPoke('numberList', @numberList);
7574  
7575 $hash{$name} = $pbObj;
7576 }
7577 }
7578  
7579 $self->{constPhrasebookHash} = \%hash;
7580  
7581 # Operation complete
7582 return 1;
7583 }
7584  
7585 sub createFileObjs {
7586  
7587 # Called by $self->start
7588 # Creates the file objects (GA::Obj::File) that are stored in this GA::Client's registry
7589 # (omitting those which are stored in GA::Session's registry)
7590 # NB Does not create any 'worldprof' file objects yet
7591 #
7592 # Expected arguments
7593 # (none besides $self)
7594 #
7595 # Return values
7596 # 'undef' on improper arguments or if any of the file objects can't be created
7597 # 1 on success
7598  
7599 my ($self, $check) = @_;
7600  
7601 # Local variables
7602 my @list;
7603  
7604 # Check for improper arguments
7605 if (defined $check) {
7606  
7607 return $axmud::CLIENT->writeImproper($self->_objClass . '->createFileObjs', @_);
7608 }
7609  
7610 # The list of file object types to create
7611 @list = (
7612 'config', 'tasks', 'scripts', 'contacts', 'dicts', 'toolbar', 'usercmds', 'zonemaps',
7613 'winmaps', 'tts',
7614 );
7615  
7616 # Create the FileObjs
7617 foreach my $type (@list) {
7618  
7619 my $obj = Games::Axmud::Obj::File->new($type);
7620  
7621 if (! $obj) {
7622  
7623 return undef;
7624  
7625 } else {
7626  
7627 # FileObj created
7628 $self->ivAdd('fileObjHash', $type, $obj);
7629 if ($type eq 'config') {
7630  
7631 $self->ivPoke('configFileObj', $obj);
7632 }
7633 }
7634 }
7635  
7636 # All file objects created
7637 return 1;
7638 }
7639  
7640 sub setModifyFlag {
7641  
7642 # Called by anything
7643 # Sets a file object's ->modifyFlag, first checking that the file object actually exists
7644 # (and displaying a warning, if not)
7645 # NB 'otherprof' and 'worldmodel' file objects can't be accessed from here. Use
7646 # GA::Session->setModifyFlag instead
7647 # NB The GA::Session->setModifyFlag can be called for any file object stored in the client's
7648 # registry; it passes requests directly to this function
7649 #
7650 # Expected arguments
7651 # $objName - The unique name of the file object, matching a key in $self->fileObjHash
7652 # ('config', 'tasks', 'scripts', 'contacts', 'dicts', 'toolbar',
7653 # 'usercmds', 'zonemaps', 'winmaps', 'tts' or the name of a world profile)
7654 # $flag - The setting for the flag (TRUE of FALSE)
7655 #
7656 # Optional arguments
7657 # $func - The calling function. Ignored for now, if specified
7658 #
7659 # Return values
7660 # 'undef' on improper arguments
7661 # $flag on success
7662  
7663 my ($self, $objName, $flag, $func, $check) = @_;
7664  
7665 # Check for improper arguments
7666 if (! defined $objName || ! defined $flag || defined $check) {
7667  
7668 return $axmud::CLIENT->writeImproper($self->_objClass . '->setModifyFlag', @_);
7669 }
7670  
7671 # Check the file object exists
7672 if (! $self->ivExists('fileObjHash', $objName)) {
7673  
7674 return $self->writeWarning(
7675 'Missing file object \'' . $objName . '\' - can\'t set its modified data flag',
7676 $self->_objClass . '->setModifyFlag',
7677 );
7678  
7679 } else {
7680  
7681 return $self->ivShow('fileObjHash', $objName)->set_modifyFlag($flag);
7682 }
7683 }
7684  
7685 sub createDataDirs {
7686  
7687 # Called by $self->start and by GA::Obj::File->setupConfigFile
7688 # Creates any standard Axmud data directories that don't already exist
7689 #
7690 # Expected arguments
7691 # (none besides $self)
7692 #
7693 # Return values
7694 # 'undef' on improper arguments
7695 # 1 on success
7696  
7697 my ($self, $check) = @_;
7698  
7699 # Check for improper arguments
7700 if (defined $check) {
7701  
7702 return $axmud::CLIENT->writeImproper($self->_objClass . '->createDataDirs', @_);
7703 }
7704  
7705 # Check for data directories created by previous versions of Axmud (which will have
7706 # different names)
7707 if (! -e $axmud::DATA_DIR) {
7708  
7709 OUTER: foreach my $nameShort (@axmud::COMPAT_DIR_LIST) {
7710  
7711 my ($dataDir, $config);
7712  
7713 # (Ignore the directory we already know doesn't exist)
7714 if ($nameShort ne $axmud::NAME_SHORT) {
7715  
7716 $dataDir = File::HomeDir->my_home . '/' . $nameShort . '-data';
7717 if (-e $dataDir) {
7718  
7719 # Data directory exists; rename it and its config file
7720 if (File::Copy::Recursive::dirmove($dataDir, $axmud::DATA_DIR)) {
7721  
7722 # MSWin uses .ini, everything else uses .conf
7723 $config = $axmud::DATA_DIR . '/' . $nameShort . '.';
7724 if (-e $config . 'ini') {
7725  
7726 File::Copy::move(
7727 $config . 'ini',
7728 $axmud::DATA_DIR . '/' . $axmud::NAME_SHORT . '.ini',
7729 );
7730  
7731 } elsif (-e $config . 'conf') {
7732  
7733 File::Copy::move(
7734 $config . 'conf',
7735 $axmud::DATA_DIR . '/' . $axmud::NAME_SHORT . '.conf',
7736 );
7737 }
7738 }
7739  
7740 last OUTER;
7741 }
7742 }
7743 }
7744 }
7745  
7746 # Create directories
7747 mkdir ($axmud::DATA_DIR, 0755);
7748 mkdir ($axmud::DATA_DIR . '/buffers', 0755);
7749 mkdir ($axmud::DATA_DIR . '/custom', 0755);
7750 mkdir ($axmud::DATA_DIR . '/data', 0755);
7751 mkdir ($axmud::DATA_DIR . '/data/worlds', 0755);
7752 # (Temp directory for use by Axmud code only)
7753 mkdir ($axmud::DATA_DIR . '/data/temp', 0755);
7754 mkdir ($axmud::DATA_DIR . '/logos', 0755);
7755 mkdir ($axmud::DATA_DIR . '/logs', 0755);
7756 mkdir ($axmud::DATA_DIR . '/logs/standard', 0755);
7757 mkdir ($axmud::DATA_DIR . '/msp', 0755);
7758 mkdir ($axmud::DATA_DIR . '/mxp', 0755);
7759 mkdir ($axmud::DATA_DIR . '/plugins', 0755);
7760 mkdir ($axmud::DATA_DIR . '/plugins/help', 0755);
7761 mkdir ($axmud::DATA_DIR . '/plugins/help/cmd', 0755);
7762 mkdir ($axmud::DATA_DIR . '/plugins/help/task', 0755);
7763 mkdir ($axmud::DATA_DIR . '/screenshots', 0755);
7764 mkdir ($axmud::DATA_DIR . '/scripts', 0755);
7765 mkdir ($axmud::DATA_DIR . '/sounds', 0755);
7766 mkdir ($axmud::DATA_DIR . '/store', 0755);
7767 # (Temp directory for use by plugins)
7768 mkdir ($axmud::DATA_DIR . '/tmp', 0755);
7769  
7770 # Make sure the data directory's README file is in place
7771 File::Copy::copy($axmud::SHARE_DIR . '/items/readme/README', $axmud::DATA_DIR);
7772  
7773 return 1;
7774 }
7775  
7776 sub fillDataDirs {
7777  
7778 # Called by GA::Obj::File->setupConfigFile when a new 'config' file is created
7779 # Copies data from Axmud's base sub-directories (default sound effects, icons, etc) into its
7780 # data directories; when the user wants to mess with files, they can modify the files in
7781 # the data directories - not the default copies in Axmud's base directory
7782 #
7783 # Expected arguments
7784 # (none besides $self)
7785 #
7786 # Optional arguments
7787 # $type - The type of files to copy - 'scripts' or 'sounds'. If 'undef', both
7788 # of these files are copied
7789 # $replaceFlag - If set to TRUE, a default file in Axmud's base sub-directories
7790 # replaces the corresponding one in the data directories. If FALSE (or
7791 # 'undef'), only files that are missing in the data directories are
7792 # copied
7793 #
7794 # Return values
7795 # 'undef' on improper arguments
7796 # 1 on success
7797  
7798 my ($self, $type, $replaceFlag, $check) = @_;
7799  
7800 # Local variables
7801 my (
7802 $dir, $dirHandle,
7803 @fileList,
7804 );
7805  
7806 # Check for improper arguments
7807 if (defined $check) {
7808  
7809 return $axmud::CLIENT->writeImproper($self->_objClass . '->fillDataDirs', @_);
7810 }
7811  
7812 # Copy scripts
7813 if (! defined $type || $type eq 'scripts') {
7814  
7815 $dir = $axmud::SHARE_DIR . '/items/scripts';
7816 if (-e $dir) {
7817  
7818 # Open the directory for reading
7819 opendir($dirHandle, $dir);
7820  
7821 # Get a list of files in the directory
7822 @fileList = ();
7823 while (my $file = readdir($dirHandle)) {
7824  
7825 push (@fileList, $file);
7826 }
7827  
7828 # Close the directory handle
7829 closedir($dirHandle);
7830  
7831 # Copy each file into the equivalent data directory
7832 foreach my $file (@fileList) {
7833  
7834 my ($originalPath, $copyPath);
7835  
7836 $originalPath = $dir . '/' . $file;
7837 $copyPath = $axmud::DATA_DIR . '/scripts/' . $file;
7838  
7839 # Copy the file if $replaceFlag forces us to, or if a file with the same path as
7840 # $newPath doesn't already exist
7841 if ($replaceFlag || ! (-e $copyPath)) {
7842  
7843 File::Copy::copy($originalPath, $copyPath);
7844 }
7845 }
7846 }
7847 }
7848  
7849 # Copy sounds
7850 if (! defined $type || $type eq 'sounds') {
7851  
7852 $dir = $axmud::SHARE_DIR . '/items/sounds';
7853 if (-e $dir) {
7854  
7855 # Open the directory for reading
7856 opendir($dirHandle, $dir);
7857  
7858 # Get a list of files in the directory
7859 @fileList = ();
7860 while (my $file = readdir($dirHandle)) {
7861  
7862 push (@fileList, $file);
7863 }
7864  
7865 # Close the directory handle
7866 closedir($dirHandle);
7867  
7868 # Copy each file into the equivalent data directory
7869 foreach my $file (@fileList) {
7870  
7871 my ($originalPath, $copyPath);
7872  
7873 $originalPath = $dir . '/' . $file;
7874 $copyPath = $axmud::DATA_DIR . '/sounds/' . $file;
7875  
7876 # Copy the file if $replaceFlag forces us to, or if a file with the same path as
7877 # $newPath doesn't already exist
7878 if ($replaceFlag || ! (-e $copyPath)) {
7879  
7880 File::Copy::copy($originalPath, $copyPath);
7881 }
7882 }
7883 }
7884 }
7885  
7886 return 1;
7887 }
7888  
7889 sub createStandardZonemaps {
7890  
7891 # Called by $self->start
7892 # Makes sure the standard GA::Obj::Zonemap objects specified by $self->constZonemapHash
7893 # (e.g. 'basic', 'widescreen') exist and, if not, create them
7894 #
7895 # Expected arguments
7896 # (none besides $self)
7897 #
7898 # Return values
7899 # 'undef' on improper arguments or if one of the standard zonemaps doesn't exist and
7900 # can't be created
7901 # 1 otherwise
7902  
7903 my ($self, $check) = @_;
7904  
7905 # Local variables
7906 my (
7907 $modFlag,
7908 %constHash,
7909 );
7910  
7911 # Check for improper arguments
7912 if (defined $check) {
7913  
7914 return $axmud::CLIENT->writeImproper($self->_objClass . '->createStandardZonemaps', @_);
7915 }
7916  
7917 # Import the hash of standard zonemaps (for convenience)
7918 %constHash = $self->constZonemapHash;
7919  
7920 # First create zonemaps that aren't clones
7921 foreach my $zonemapName (keys %constHash) {
7922  
7923 my $zonemapObj;
7924  
7925 # If this standard zonemap hasn't already been created, and doesn't need to be cloned...
7926 if (
7927 ! $self->ivExists('zonemapHash', $zonemapName)
7928 && ! $constHash{$zonemapName}
7929 ) {
7930 # ...then create it
7931 $zonemapObj = Games::Axmud::Obj::Zonemap->new($zonemapName);
7932 if (! $zonemapObj) {
7933  
7934 return $self->writeError(
7935 'Cannot set up the standard \'' . $zonemapName . '\' zonemap',
7936 $self->_objClass . '->createStandardZonemaps',
7937 );
7938  
7939 } else {
7940  
7941 # Add the zonemap to the client's registries
7942 $self->ivAdd('zonemapHash', $zonemapObj->name, $zonemapObj);
7943 $self->ivAdd('standardZonemapHash', $zonemapObj->name, $zonemapObj);
7944  
7945 $modFlag = TRUE;
7946 }
7947 }
7948 }
7949  
7950 # Now create zonemaps that are clones (of zonemap objects we've already created)
7951 foreach my $cloneName (keys %constHash) {
7952  
7953 my ($originalName, $originalObj, $cloneObj);
7954  
7955 $originalName = $constHash{$cloneName};
7956 if ($originalName) {
7957  
7958 $originalObj = $self->ivShow('zonemapHash', $originalName);
7959 }
7960  
7961 # If this standard zonemap hasn't already been created, and does need to be cloned, and
7962 # the original now exists...
7963 if (
7964 $originalObj
7965 && ! $self->ivExists('zonemapHash', $cloneName)
7966 ) {
7967 # ...then create it
7968 $cloneObj = $originalObj->clone($cloneName);
7969 if (! $cloneObj) {
7970  
7971 return $self->writeError(
7972 'Cannot set up the standard \'' . $cloneName . '\' zonemap',
7973 $self->_objClass . '->createStandardZonemaps',
7974 );
7975  
7976 } else {
7977  
7978 # Add the zonemap to the client's registries
7979 $self->ivAdd('zonemapHash', $cloneObj->name, $cloneObj);
7980 $self->ivAdd('standardZonemapHash', $cloneObj->name, $cloneObj);
7981 $modFlag = TRUE;
7982  
7983 # The clone differs from the original in that its zone models should allow
7984 # multiple layers, except for models reserved for 'main' windows
7985 # Apply that change now
7986 $cloneObj->modifyStandardZonemap();
7987 }
7988 }
7989 }
7990  
7991 if ($modFlag) {
7992  
7993 # The data stored in these IVs are saved in the 'zonemaps' file
7994 $self->setModifyFlag('zonemaps', TRUE, $self->_objClass . '->createStandardZonemaps');
7995 }
7996  
7997 return 1;
7998 }
7999  
8000 sub createTempZonemap {
8001  
8002 # Called by GA::Session->processMxpFrameElement
8003 # Creates a 'temporary' zonemap (one that is never saved, and which is destroyed when the
8004 # calling session closes, and which can only be used with the calling session)
8005 #
8006 # Expected arguments
8007 # $session - The calling GA::Session
8008 #
8009 # Return values
8010 # 'undef' on improper arguments or if there's an error
8011 # Otherwise returns the new GA::Obj::Zonemap object
8012  
8013 my ($self, $session, $check) = @_;
8014  
8015 # Local variables
8016 my ($count, $name, $zonemapObj, $modelObj);
8017  
8018 # Check for improper arguments
8019 if (! defined $session || defined $check) {
8020  
8021 return $axmud::CLIENT->writeImproper($self->_objClass . '->createTempZonemap', @_);
8022 }
8023  
8024 # Create a zonemap called 'temp_n', where 'n' is the first available integer number
8025 $count = 0;
8026 do {
8027  
8028 $count++;
8029 if (! $self->ivExists('zonemapHash', 'temp_' . $count)) {
8030  
8031 $name = 'temp_' . $count;
8032 }
8033  
8034 } until ($name);
8035  
8036 # Unlikely in the extreme that we'll ever use a trillion zonemaps, but let's check anyway
8037 if (! $self->nameCheck($name, 16)) {
8038  
8039 return undef;
8040 }
8041  
8042 # Create the temporary zonemap
8043 $zonemapObj = Games::Axmud::Obj::Zonemap->new($name, TRUE, $session);
8044 if (! $zonemapObj) {
8045  
8046 return undef;
8047 }
8048  
8049 # Add the zonemap to the client's registries
8050 $self->ivAdd('zonemapHash', $zonemapObj->name, $zonemapObj);
8051  
8052 # Add a single zone model, covering the whole of the zonemap's internal grid
8053 $modelObj = Games::Axmud::Obj::ZoneModel->new($zonemapObj);
8054 $modelObj->{left} = 0;
8055 $modelObj->{right} = 59;
8056 $modelObj->{top} = 0;
8057 $modelObj->{bottom} = 59;
8058 $modelObj->{width} = 60;
8059 $modelObj->{height} = 60;
8060 $zonemapObj->addZoneModel($modelObj);
8061  
8062 return $zonemapObj;
8063 }
8064  
8065 sub checkCurrentZonemap {
8066  
8067 # Called by GA::EditWin::ZoneModel and GA::Cmd::ModifyZoneModel->do
8068 # Checks whether the specified zonemap is being used by any workspace grid (a
8069 # GA::Obj::WorkspaceGrid object), because a zonemap in use cannot be modified
8070 #
8071 # Expected arguments
8072 # $zonemap - The name of the zonemap to check
8073 #
8074 # Return values
8075 # 'undef' in improper arguments or if $zonemap isn't in use by any workspace grid
8076 # 1 if $zonemap is in use by any workspace grid
8077  
8078 my ($self, $zonemap, $check) = @_;
8079  
8080 # Check for improper arguments
8081 if (! defined $zonemap || defined $check) {
8082  
8083 return $axmud::CLIENT->writeImproper($self->_objClass . '->checkCurrentZonemap', @_);
8084 }
8085  
8086 foreach my $workspaceGridObj ($self->desktopObj->ivValues('gridHash')) {
8087  
8088 if ($workspaceGridObj->zonemap && $workspaceGridObj->zonemap eq $zonemap) {
8089  
8090 return 1;
8091 }
8092 }
8093  
8094 # $zonemap isn't in use by any workspace grid
8095 return undef;
8096 }
8097  
8098 sub createStandardWinmaps {
8099  
8100 # Called by $self->start
8101 # Makes sure the standard GA::Obj::Winmap objects specified by
8102 # $self->constWinmapNameHash (e.g. 'main_fill', 'entry_empty') exist and, if not, create
8103 # them
8104 #
8105 # Expected arguments
8106 # (none besides $self)
8107 #
8108 # Return values
8109 # 'undef' on improper arguments or if one of the standard winmaps doesn't exist and can't
8110 # be created
8111 # 1 otherwise
8112  
8113 my ($self, $check) = @_;
8114  
8115 # Local variables
8116 my $modFlag;
8117  
8118 # Check for improper arguments
8119 if (defined $check) {
8120  
8121 return $axmud::CLIENT->writeImproper($self->_objClass . '->createStandardWinmaps', @_);
8122 }
8123  
8124 foreach my $winmapName ($self->ivKeys('constWinmapNameHash')) {
8125  
8126 my $winmapObj;
8127  
8128 # If this standard winmap hasn't already been created...
8129 if (! $self->ivExists('winmapHash', $winmapName)) {
8130  
8131 # ...then create it
8132 $winmapObj = Games::Axmud::Obj::Winmap->new($winmapName);
8133 if (! $winmapObj) {
8134  
8135 return $self->writeError(
8136 'Cannot set up the standard \'' . $winmapName . '\' winmap',
8137 $self->_objClass . '->createStandardWinmaps',
8138 );
8139  
8140 } else {
8141  
8142 # Add the winmap to the client's registries
8143 $self->ivAdd('winmapHash', $winmapObj->name, $winmapObj);
8144 $self->ivAdd('standardWinmapHash', $winmapObj->name, $winmapObj);
8145  
8146 $modFlag = TRUE;
8147 }
8148 }
8149 }
8150  
8151 if ($modFlag) {
8152  
8153 # The data stored in these IVs are saved in the 'winmaps' file
8154 $self->setModifyFlag('winmaps', TRUE, $self->_objClass . '->createStandardWinmaps');
8155 }
8156  
8157 return 1;
8158 }
8159  
8160 sub createStandardColourSchemes {
8161  
8162 # Called by $self->start
8163 # Makes sure the standard GA::Obj::ColourScheme objects (whose names matches a type of
8164 # 'grid' or 'free' window) exist and, if not, create them
8165 #
8166 # Expected arguments
8167 # (none besides $self)
8168 #
8169 # Return values
8170 # 'undef' on improper arguments or if one of the standard zonemaps doesn't exist and
8171 # can't be created
8172 # 1 otherwise
8173  
8174 my ($self, $check) = @_;
8175  
8176 # Local variables
8177 my (
8178 $modFlag,
8179 @list,
8180 );
8181  
8182 # Check for improper arguments
8183 if (defined $check) {
8184  
8185 return $axmud::CLIENT->writeImproper(
8186 $self->_objClass . '->createStandardColourSchemes',
8187 @_,
8188 );
8189 }
8190  
8191 push (@list, $self->ivKeys('constGridWinTypeHash'), $self->ivKeys('constFreeWinTypeHash'));
8192  
8193 foreach my $winType (@list) {
8194  
8195 if (! $self->ivExists('colourSchemeHash', $winType)) {
8196  
8197 # Doesn't exist, so create it
8198 my $obj = Games::Axmud::Obj::ColourScheme->new($winType);
8199 if (! $obj) {
8200  
8201 return $self->writeError(
8202 'Cannot set up the standard \'' . $winType . '\' colour scheme',
8203 $self->_objClass . '->createStandardColourSchemes',
8204 );
8205  
8206 } else {
8207  
8208 # Add the colour scheme to the client's registry
8209 $self->ivAdd('colourSchemeHash', $obj->name, $obj);
8210 $modFlag = TRUE;
8211 }
8212 }
8213 }
8214  
8215 if ($modFlag) {
8216  
8217 # The data stored in these IVs are saved in the 'winmaps' file
8218 $self->setModifyFlag(
8219 'winmaps',
8220 TRUE,
8221 $self->_objClass . '->createStandardColourSchemes',
8222 );
8223 }
8224  
8225 return 1;
8226 }
8227  
8228 sub createSupportedMcpPackages {
8229  
8230 # Called by $self->start
8231 # Creates MCP package objects (inheriting from Games::Axmud::Generic::Mcp) for all
8232 # MCP packages supported by Axmud (before any initial plugins have defined new ones)
8233 #
8234 # Expected arguments
8235 # (none besides $self)
8236 #
8237 # Return values
8238 # 'undef' on improper arguments or if one of the supported MCP package objects can't be
8239 # created
8240 # 1 otherwise
8241  
8242 my ($self, $check) = @_;
8243  
8244 # Local variables
8245 my @list;
8246  
8247 # Check for improper arguments
8248 if (defined $check) {
8249  
8250 return $axmud::CLIENT->writeImproper(
8251 $self->_objClass . '->createSupportedMcpPackages',
8252 @_,
8253 );
8254 }
8255  
8256 @list = $self->constMcpPackageList;
8257 if (! @list) {
8258  
8259 # No supported packages to add
8260 return 1;
8261 }
8262  
8263 # Create an MCP package object for each supported package
8264 do {
8265  
8266 my ($name, $perlPackage, $min, $max, $obj);
8267  
8268 $name = shift @list;
8269 $perlPackage = shift @list;
8270 $min = shift @list;
8271 $max = shift @list;
8272  
8273 # Obviously we, the authors, aren't going to create duplicate packages, but there's no
8274 # harm in checking
8275 if ($self->ivExists('mcpPackageHash', $name)) {
8276  
8277 return $self->writeError(
8278 'Duplicate supported MCP package \'' . $name . '\'',
8279 $self->_objClass . '->createSupportedMcpPackages',
8280 );
8281 }
8282  
8283 # Create the MCP package object
8284 $obj = $perlPackage->new($name, $min, $max);
8285 if (! $obj) {
8286  
8287 return $self->writeError(
8288 'Cannot set up supported MCP package \'' . $name . '\'',
8289 $self->_objClass . '->createSupportedMcpPackages',
8290 );
8291  
8292 } else {
8293  
8294 $self->ivAdd('mcpPackageHash', $name, $obj);
8295 }
8296  
8297 } until (! @list);
8298  
8299 return 1;
8300 }
8301  
8302 sub setupKeycodes {
8303  
8304 # Called by $self->start
8305 # Sets up keycodes for the current system by populating $self->keycodeHash and
8306 # $self->revKeycodeHash
8307 #
8308 # Expected arguments
8309 # (none besides $self)
8310 #
8311 # Return values
8312 # 'undef' on improper arguments
8313 # 1 otherwise
8314  
8315 my ($self, $check) = @_;
8316  
8317 # Check for improper arguments
8318 if (defined $check) {
8319  
8320 return $axmud::CLIENT->writeImproper($self->_objClass . '->setupKeycodes', @_);
8321 }
8322  
8323 $self->ivPoke('keycodeHash', $self->constKeycodeHash);
8324 if ($^O eq 'MSWin32') {
8325  
8326 foreach my $key ($self->ivKeys('constMSWinKeycodeHash')) {
8327  
8328 $self->ivAdd('keycodeHash', $key, $self->ivShow('constMSWinKeycodeHash', $key));
8329 }
8330  
8331 } elsif ($^O =~ m/bsd/i) {
8332  
8333 foreach my $key ($self->ivKeys('constBSDKeycodeHash')) {
8334  
8335 $self->ivAdd('keycodeHash', $key, $self->ivShow('constBSDKeycodeHash', $key));
8336 }
8337 }
8338  
8339 foreach my $standard ($self->ivKeys('keycodeHash')) {
8340  
8341 my (
8342 $string,
8343 @list,
8344 );
8345  
8346 $string = $self->ivShow('keycodeHash', $standard);
8347  
8348 # $string is a single standard keycode, e.g. 'kp_0', or a set of standard keycodes
8349 # separated by whitespace, e.g. 'up kp_up'
8350 @list = split(/\s+/, $string);
8351  
8352 foreach my $item (@list) {
8353  
8354 $self->ivAdd('revKeycodeHash', $item, $standard);
8355 }
8356 }
8357  
8358 return 1;
8359 }
8360  
8361 sub copyPreConfigWorld {
8362  
8363 # Called by GA::Obj::File->setupConfigFile when a new 'config' file is created
8364 # Also called by $self->insertPreConfigWorlds when the user is using a newer version of
8365 # Axmud
8366 #
8367 # Copies a pre-configured world profile from Axmud's base sub-directories into its data
8368 # directories
8369 # If called by ->setupConfigFile, creates a dummy entry in $self->worldProfHash, ready for
8370 # the file object to create a 'config' file that includes the pre-configured worlds
8371 # If called by ->insertPreConfigWorlds, doesn't create a dummy entry, but otherwise the
8372 # operation is identical
8373 #
8374 # If, by any chance, Axmud's data directories already contain a world profile with the same
8375 # name, don't replace them (but still update $self->worldProfHash)
8376 #
8377 # Expected arguments
8378 # $world - The name of the pre-configured world profile
8379 #
8380 # Optional arguments
8381 # $setupFlag - TRUE if called by GA::Obj::File->setupConfigFile; FALSE (or 'undef') if
8382 # called by anything else
8383 #
8384 # Return values
8385 # 'undef' on improper arguments or if there's a serious error (meaning that no further
8386 # pre-configured worlds can be copied)
8387 # Otherwise returns a string: 'success' if the pre-configured world is succesfully
8388 # copied, 'fail' if the world can't be copied (but it's safe to continue copying
8389 # other worlds)
8390  
8391 my ($self, $world, $setupFlag, $check) = @_;
8392  
8393 # Local variables
8394 my (
8395 $importPath, $extractObj, $tempDir, $newDir, $origLogo, $newLogo, $hashRef, $fileObj,
8396 @fileList,
8397 %fileHash, %loadHash, %dictHash,
8398 );
8399  
8400 # Check for improper arguments
8401 if (! defined $world || defined $check) {
8402  
8403 return $axmud::CLIENT->writeImproper($self->_objClass . '->copyPreConfigWorld', @_);
8404 }
8405  
8406 # Pre-configured world test mode: When preparing for a release, the authors set this flag to
8407 # TRUE to stop Axmud complaining about missing pre-configured worlds
8408 if ($axmud::TEST_PRE_CONFIG_FLAG) {
8409  
8410 return 'success';
8411 }
8412  
8413 # If a directory for the pre-configured world exists and a data directory for a world with
8414 # the same name doesn't exist...
8415 if (
8416 -e $axmud::SHARE_DIR . '/items/worlds/' . $world
8417 && ! (-e $axmud::DATA_DIR . '/data/worlds/' . $world)
8418 ) {
8419 # Copy the pre-configured worlds into the data directories (code adapted from
8420 # GA::Cmd::ImportFiles->do)
8421 $importPath = $axmud::SHARE_DIR . '/items/worlds/' . $world . '/' . $world . '.tgz';
8422 if (! -e $importPath) {
8423  
8424 $self->writeWarning(
8425 'General error importing pre-configured worlds (archive missing for \''
8426 . $world . '\' world)',
8427 $self->_objClass . '->copyPreConfigWorld',
8428 );
8429  
8430 return 'fail';
8431 }
8432  
8433 # Build an Archive::Extract object
8434 $extractObj = Archive::Extract->new(archive => $importPath);
8435 if (! $extractObj) {
8436  
8437 return $self->writeError(
8438 'General error importing pre-configured worlds (archive error)',
8439 $self->_objClass . '->copyPreConfigWorld',
8440 );
8441 }
8442  
8443 # Extract the object to a temporary directory (if it doesn't already exist, create it)
8444 $tempDir = $axmud::DATA_DIR . '/data/temp/import';
8445 if (! $extractObj->extract(to => $tempDir)) {
8446  
8447 return $self->writeError(
8448 'General error importing pre-configured worlds (extraction error)',
8449 $self->_objClass . '->copyPreConfigWorld',
8450 );
8451 }
8452  
8453 # All the files are now in /data/temp/import. Get a list of paths, relative to $tempDir,
8454 # of all the extracted files
8455 @fileList = @{$extractObj->files}; # e.g. export/tasks.axm
8456 # Convert all the paths into absolute paths. Check they are real Axmud files and, if so,
8457 # store them in a hash
8458 foreach my $file (@fileList) {
8459  
8460 my (
8461 $fileType, $filePath,
8462 %headerHash,
8463 );
8464  
8465 $filePath = $tempDir . '/' . $file;
8466  
8467 %headerHash = Games::Axmud::Obj::File->examineDataFile($filePath, 'return_header');
8468 if (! %headerHash) {
8469  
8470 $self->writeWarning(
8471 'General error importing pre-configured worlds (archive contains invalid'
8472 . ' file)',
8473 $self->_objClass . '->copyPreConfigWorld',
8474 );
8475  
8476 return 'fail';
8477  
8478 } else {
8479  
8480 $fileType = $headerHash{'file_type'};
8481 $fileHash{$fileType} = $filePath;
8482 }
8483 }
8484  
8485 # Now we can check that we have the right three files ('worldprof', 'otherprof' and
8486 # 'worldmodel')
8487 if (
8488 ! exists $fileHash{'worldprof'}
8489 || ! exists $fileHash{'otherprof'}
8490 || ! exists $fileHash{'worldmodel'}
8491 || scalar (keys %fileHash) != 3
8492 ) {
8493 $self->writeWarning(
8494 'General error importing pre-configured worlds (incorrect archive for \''
8495 . $world . '\' world)',
8496 $self->_objClass . '->copyPreConfigWorld',
8497 );
8498  
8499 return 'fail';
8500 }
8501  
8502 # Create the data sub-directory
8503 $newDir = $axmud::DATA_DIR . '/data/worlds/' . $world . '/';
8504 if (! mkdir ($newDir, 0755)) {
8505  
8506 $self->writeWarning(
8507 'General error importing pre-configured worlds (could not copy files)',
8508 $self->_objClass . '->copyPreConfigWorld',
8509 );
8510  
8511 return 'fail';
8512 }
8513  
8514 # Copy the files into the sub-directory
8515 foreach my $file (keys %fileHash) {
8516  
8517 my $filePath = $fileHash{$file};
8518  
8519 if (! File::Copy::copy($filePath, $newDir . $file . '.axm')) {
8520  
8521 # Give up importing this pre-configured world; destroy its data sub-directory
8522 File::Path::remove_tree($newDir);
8523  
8524 $self->writeWarning(
8525 'General error importing pre-configured worlds (could not copy files)',
8526 $self->_objClass . '->copyPreConfigWorld',
8527 );
8528  
8529 return 'fail';
8530 }
8531 }
8532  
8533 # When this function was called by GA::Obj::File->setupConfigFile, add a dummy entry to
8534 # the this object's profile registry so the calling function,
8535 # GA::Obj::File->setupConfigFile, can add the world to the 'config' file it's about to
8536 # create (the dummy entry will be removed by that function)
8537 if ($setupFlag) {
8538  
8539 $self->ivAdd('worldProfHash', $world, undef);
8540 }
8541  
8542 # If a logo for this world exists, and if the equivalent logo doesn't exist in the data
8543 # directory, copy it
8544 $origLogo = $axmud::SHARE_DIR . '/items/worlds/' . $world . '/' . $world . '.png';
8545 $newLogo = $axmud::DATA_DIR . '/logos/' . $world . '.png';
8546  
8547 if (-e $origLogo && ! (-e $newLogo)) {
8548  
8549 File::Copy::copy($origLogo, $newLogo);
8550 }
8551  
8552 # Now, try to import the corresponding file containing the world's dictionary
8553 $importPath = $axmud::SHARE_DIR . '/items/worlds/' . $world . '/' . $world . '.amx';
8554 if (! -e $importPath) {
8555  
8556 # Pre-configured dictionary archive missing; so move on to the next world
8557 $self->writeWarning(
8558 'General error importing pre-configured worlds (dictionary archive not found)',
8559 $self->_objClass . '->copyPreConfigWorld',
8560 );
8561  
8562 return 'fail';
8563 }
8564  
8565 # We can't call GA::Obj::File->importDataFile because it expects a GA::Session as an
8566 # argument
8567 # Instead, we'll use a modified version of ->importDataFile and ->extractData
8568  
8569 # Load all the data into an anonymous hash
8570 eval { $hashRef = Storable::lock_retrieve($importPath); };
8571 if (! $hashRef) {
8572  
8573 return $self->writeError(
8574 'General error importing pre-configured worlds (lockfile error)',
8575 $self->_objClass . '->copyPreConfigWorld',
8576 );
8577 }
8578  
8579 # Convert the anonymous hash referenced by $hashRef into a named hash
8580 %loadHash = %{$hashRef};
8581  
8582 # Before v1.0.868, Axmud had a different name. Update all header data
8583 if (
8584 defined $loadHash{'script_version'}
8585 && $self->convertVersion($loadHash{'script_version'}) < 1_000_868
8586 ) {
8587 %loadHash = Games::Axmud::Obj::File->updateHeaderAfterRename(%loadHash);
8588 }
8589  
8590 if (
8591 # Check the header is valid
8592 ! defined $loadHash{'file_type'} || ! defined $loadHash{'script_name'}
8593 || ! defined $loadHash{'script_version'} || ! defined $loadHash{'save_date'}
8594 || ! defined $loadHash{'save_time'} || ! exists $loadHash{'assoc_world_prof'}
8595 # Check it's the right kind of file
8596 || $loadHash{'file_type'} ne 'dicts'
8597 # Check the file was created by a compatible programme
8598 || ! Games::Axmud::Obj::File->checkCompatibility($loadHash{'script_name'})
8599 ) {
8600 $self->writeWarning(
8601 'General error importing pre-configured worlds (dictionary archive invalid)',
8602 $self->_objClass . '->copyPreConfigWorld',
8603 );
8604  
8605 return 'fail';
8606 }
8607  
8608 # Import the dictionary objects stored in the file
8609 %dictHash = %{$loadHash{'dict_hash'}};
8610 if (%dictHash) {
8611  
8612 foreach my $dictObj (values %dictHash) {
8613  
8614 # Before v1.0.868, Axmud had a different name. Update the dictionary object
8615 $dictObj = Games::Axmud::Obj::File->update_obj_dict($dictObj);
8616  
8617 $self->ivAdd('dictHash', $dictObj->name, $dictObj);
8618 }
8619  
8620 # The data stored in this IV is saved in the 'dicts' file
8621 $self->setModifyFlag('dicts', TRUE, $self->_objClass . '->copyPreConfigWorld');
8622 # Because dictionary objects may contain new IVs (or other changes), we need to call
8623 # the file object's ->updateExtractedData (this happens elsewhere, for the
8624 # 'worldprof', 'otherprof' and 'worldmodel' files, but for the 'dicts' file, we
8625 # must do it now)
8626 $fileObj = $self->ivShow('fileObjHash', 'dicts');
8627 $fileObj->updateExtractedData(
8628 $self->convertVersion($loadHash{'script_version'}),
8629 );
8630 }
8631 }
8632  
8633 # Operation complete
8634 return 'success';
8635 }
8636  
8637 sub cleanPreConfigWorlds {
8638  
8639 # Called by GA::Obj::File->setupConfigFile after a call to $self->copyPreConfigWorlds, which
8640 # added a number of dummy entries to $self->worldProfHash
8641 # Removes the dummy entries, adding new entries in $self->configWorldProfList (as if the
8642 # config file had been read, not created)
8643 #
8644 # Expected arguments
8645 # (none besides $self)
8646 #
8647 # Return values
8648 # 'undef' on improper arguments
8649 # 1 otherwise
8650  
8651 my ($self, $check) = @_;
8652  
8653 # Check for improper arguments
8654 if (defined $check) {
8655  
8656 return $axmud::CLIENT->writeImproper($self->_objClass . '->cleanPreConfigWorlds', @_);
8657 }
8658  
8659 foreach my $world ($self->ivKeys('worldProfHash')) {
8660  
8661 my $worldObj = $self->ivShow('worldProfHash', $world);
8662  
8663 if (! defined $worldObj) {
8664  
8665 $self->ivDelete('worldProfHash', $world);
8666 $self->ivPush('configWorldProfList', $world);
8667 }
8668 }
8669  
8670 return 1;
8671 }
8672  
8673 sub insertPreConfigWorlds {
8674  
8675 # Called by $self->start when the user is using a new version of Axmud
8676 # Checks whether any pre-configured worlds have been added since the version of Axmud last
8677 # used by the user (i.e. the version that created the Axmud data directory we're using)
8678 # If any are found, inserts them into Axmud's data directory
8679 #
8680 # Expected arguments
8681 # (none besides $self)
8682 #
8683 # Return values
8684 # 'undef' on improper arguments or if there's a serious error (after which, this function
8685 # gives up inserting pre-configured worlds)
8686 # 1 on success or if there are only minor errors (this function continued trying to
8687 # insert pre-configured worlds after the minor error)
8688  
8689 my ($self, $check) = @_;
8690  
8691 # Local variables
8692 my (
8693 $prevVersion,
8694 %alreadyHash,
8695 );
8696  
8697 # Check for improper arguments
8698 if (defined $check) {
8699  
8700 return $axmud::CLIENT->writeImproper($self->_objClass . '->insertPreConfigWorlds', @_);
8701 }
8702  
8703 # Convert version, e.g. '1.1.0' to '1_001_000'
8704 $prevVersion = $self->convertVersion($self->prevClientVersion);
8705 # Compile a hash of world profiles which (should) already exist (none of which have been
8706 # loaded by $self->start yet)
8707 foreach my $world ($self->configWorldProfList) {
8708  
8709 $alreadyHash{$world} = undef;
8710 }
8711  
8712 # Only insert pre-configured worlds that are newer than the version of Axmud the user was
8713 # using last time
8714 # Also don't import a pre-configured world if a world profile with the same name (created by
8715 # the user) already exists
8716 foreach my $world ($self->constWorldList) {
8717  
8718 my ($worldVersion, $result);
8719  
8720 if (! exists $alreadyHash{$world} && $self->ivExists('constWorldHash', $world)) {
8721  
8722 $worldVersion = $self->convertVersion($self->ivShow('constWorldHash', $world));
8723  
8724 if ($worldVersion > $prevVersion) {
8725  
8726 $result = $self->copyPreConfigWorld($world);
8727 if (! defined $result) {
8728  
8729 # Serious error. Give up inserting pre-configured worlds
8730 return undef;
8731  
8732 } elsif ($result = 'success') {
8733  
8734 # No minor error reported, so tell the calling function to load this world
8735 # profile
8736 $self->ivPush('configWorldProfList', $world);
8737 }
8738 }
8739 }
8740 }
8741  
8742 return 1;
8743 }
8744  
8745 sub loadWorldProfs {
8746  
8747 # Called by $self->start
8748 # $self->configWorldProfList contains a list of world profile names stored in the 'config'
8749 # file. This function loads each of those profiles into memory
8750 #
8751 # Expected arguments
8752 # (none besides $self)
8753 #
8754 # Return values
8755 # 'undef' on improper arguments or if any of the expected world profiles can't be loaded
8756 # (when that happens, this function continues trying to load world profiles before
8757 # returning 'undef')
8758 # 1 on success
8759  
8760 my ($self, $check) = @_;
8761  
8762 # Local variables
8763 my ($worldDir, $failFlag);
8764  
8765 # Check for improper arguments
8766 if (defined $check) {
8767  
8768 return $axmud::CLIENT->writeImproper($self->_objClass . '->loadWorldProfs', @_);
8769 }
8770  
8771 # Set the directory in which world profile-related data is stored
8772 $worldDir = $axmud::DATA_DIR . '/data/worlds';
8773  
8774 # Load each profile in turn
8775 foreach my $world ($self->configWorldProfList) {
8776  
8777 my ($old, $new, $fileObj, $dir, $path, $file);
8778  
8779 # Before v1.0.868, worldprof.axm was called worlddefn.amd, and otherprof.axm was called
8780 # otherdefn.amd. If the old files are present, rename them
8781 $old = $worldDir . '/' . $world . '/worlddefn.amd';
8782 if (-e $old) {
8783  
8784 $new = $worldDir . '/' . $world . '/worldprof.axm';
8785 File::Copy::move($old, $new);
8786 }
8787  
8788 $old = $worldDir . '/' . $world . '/otherdefn.amd';
8789 if (-e $old) {
8790  
8791 $new = $worldDir . '/' . $world . '/otherprof.axm';
8792 File::Copy::move($old, $new);
8793 }
8794  
8795 # Create a file object to store the header information, once loaded.
8796 $fileObj = Games::Axmud::Obj::File->new('worldprof', $world);
8797 if (! $fileObj) {
8798  
8799 return $self->writeError(
8800 'Failed to create a file object for the world profile \'' . $world . '\'',
8801 $self->_objClass . '->loadWorldProfs',
8802 );
8803  
8804 } else {
8805  
8806 # Add the file object to its registry
8807 $self->ivAdd('fileObjHash', $fileObj->assocWorldProf, $fileObj);
8808  
8809 # Load the profile file (in overwrite mode - only the world profile itself is
8810 # overwritten)
8811 $dir = $worldDir . '/' . $world;
8812 $file = $fileObj->standardFileName;
8813 $path = $dir . '/' . $fileObj->standardFileName;
8814  
8815 if (! $fileObj->loadDataFile($file, $path, $dir)) {
8816  
8817 # Try loading the automatic backup, i.e. 'worldprof.axm.bu'
8818 if (! $fileObj->loadDataFile($file, $path, $dir, TRUE)) {
8819  
8820 # Continue loading world profiles, but this function will return 'undef'
8821 $failFlag = TRUE;
8822  
8823 } else {
8824  
8825 # The contents of the backup, now loaded into memory, must be saved at some
8826 # point
8827 $fileObj->set_modifyFlag(TRUE);
8828 # Don't overwrite the existing backup file with the faulty one
8829 $fileObj->set_preserveBackupFlag(TRUE);
8830 }
8831 }
8832 }
8833 }
8834  
8835 if ($failFlag) {
8836 return undef;
8837 } else {
8838 return 1;
8839 }
8840 }
8841  
8842 sub getTempProfName {
8843  
8844 # Called by $self->start, GA::Cmd::Telnet->do, GA::Cmd::SSH->do, GA::Cmd::SSL->do or
8845 # GA::OtherWin::Connect->connectWorldCallback
8846 # All sessions require a current world profile with a defined name. For situations in which
8847 # we want to create a temporary world profile that won't be saved - such as when the
8848 # Connections window starts a new connection, but the user hasn't specified a world name -
8849 # this function returns an available world profile name to use
8850 #
8851 # Expected arguments
8852 # (none besides $self)
8853 #
8854 # Return values
8855 # 'undef' on improper arguments or if there are no available world profile names (an
8856 # exceedingly unlikely situation)
8857 # Otherwise, returns an available world profile name
8858  
8859 my ($self, $check) = @_;
8860  
8861 # Check for improper arguments
8862 if (defined $check) {
8863  
8864 return $axmud::CLIENT->writeImproper($self->_objClass . '->getTempProfName', @_);
8865 }
8866  
8867 for (my $count = 1; $count <= 9999; $count++) {
8868  
8869 if (! $self->ivExists('worldProfHash', 'temp_world_' . $count)) {
8870  
8871 return 'temp_world_' . $count;
8872 }
8873 }
8874  
8875 # No temporary profile names available
8876 return undef;
8877 }
8878  
8879 sub loadOtherFiles {
8880  
8881 # Called by $self->start
8882 # Loads data from the files 'tasks', 'scripts', 'contacts', 'dicts', 'toolbar', 'usercmds',
8883 # 'zonemaps', 'winmaps', 'tts')
8884 # Any of the files which don't yet exist are created
8885 #
8886 # Expected arguments
8887 # (none besides $self)
8888 #
8889 # Return values
8890 # 'undef' on improper arguments or if any of the file objects can't be loaded (or created)
8891 # 1 on success
8892  
8893 my ($self, $check) = @_;
8894  
8895 # Local variables
8896 my @list;
8897  
8898 # Check for improper arguments
8899 if (defined $check) {
8900  
8901 return $axmud::CLIENT->writeImproper($self->_objClass . '->loadOtherFiles', @_);
8902 }
8903  
8904 # The list of file types to load
8905 @list = (
8906 'tasks', 'scripts', 'contacts', 'dicts', 'toolbar', 'usercmds', 'zonemaps', 'winmaps',
8907 'tts',
8908 );
8909  
8910 # Create the FileObjs
8911 foreach my $type (@list) {
8912  
8913 my $obj;
8914  
8915 if (! $self->ivExists('fileObjHash', $type)) {
8916  
8917 # The corresponding file object is missing. This should never happen
8918 return undef;
8919  
8920 } else {
8921  
8922 $obj = $self->ivShow('fileObjHash', $type);
8923 # Load the file
8924 if (! $obj->setupDataFile()) {
8925  
8926 # File not loaded (or created)
8927 return undef;
8928 }
8929 }
8930 }
8931  
8932 # All files loaded
8933 return 1;
8934 }
8935  
8936 sub disableAllFileAccess {
8937  
8938 # Called by $self->start, $self->createFileObjs or by any other code
8939 # Disables loading and saving of files across all sessions
8940 #
8941 # Expected arguments
8942 # (none besides $self)
8943 #
8944 # Optional arguments flag
8945 # $noPromptFlag - If set to TRUE, there's no need to prompt the user for an emergency
8946 # save. If set to FALSE (or 'undef'), prompt the user in the normal
8947 # way, if allowed
8948 #
8949 # Return values
8950 # 'undef' on improper arguments
8951 # 1 on success
8952  
8953 my ($self, $noPromptFlag, $check) = @_;
8954  
8955 # Local variables
8956 my $choice;
8957  
8958 # Check for improper arguments
8959 if (defined $check) {
8960  
8961 return $axmud::CLIENT->writeImproper($self->_objClass . '->createFileObjs', @_);
8962 }
8963  
8964 # Disable loading/saving of the 'config' file for the client
8965 $self->ivPoke('loadConfigFlag', FALSE);
8966 $self->ivPoke('saveConfigFlag', FALSE);
8967 # Disable loading/saving of all other data files by all sessions
8968 $self->ivPoke('loadDataFlag', FALSE);
8969 $self->ivPoke('saveDataFlag', FALSE);
8970  
8971 # The data stored in these IVs is saved in the 'config' file (set the modify flag, even
8972 # though the 'config' file can't be saved)
8973 $self->setModifyFlag('config', TRUE, $self->_objClass . '->disableAllFileAccess');
8974  
8975 # Do an emergency save, if allowed
8976 if ($self->emergencySaveFlag && ! $noPromptFlag) {
8977  
8978 if ($self->mainWin) {
8979  
8980 # Ask the user for permission to do an emergency save
8981 $choice = $self->mainWin->showMsgDialogue(
8982 'Emergency save',
8983 'warning',
8984 'File access is about to be disabled. Would you like to do an emergency save?',
8985 'yes-no',
8986 );
8987  
8988 if ($choice eq 'yes') {
8989  
8990 $self->doEmergencySave();
8991 }
8992  
8993 } else {
8994  
8995 # No 'main' window from which to do open 'dialogue' windows, so go ahead and do the
8996 # emergency save
8997 $self->doEmergencySave();
8998 }
8999 }
9000  
9001 return 1;
9002 }
9003  
9004 sub doEmergencySave {
9005  
9006 # Called by $self->disableAllFileAccess, GA::Cmd::EmergencySave->do or by any other code
9007 # Performs an emergency save, saving all file objects to a location specified by the user
9008 # (which is almost always not the usual Axmud data directory)
9009 #
9010 # Expected arguments
9011 # (none besides $self)
9012 #
9013 # Return values
9014 # 'undef' on improper arguments or if the user cancels the operation
9015 # Otherwise, returns the directory in which the files were saved
9016  
9017 my ($self, $check) = @_;
9018  
9019 # Local variables
9020 my ($dir, $msg, $errorCount);
9021  
9022 # Check for improper arguments
9023 if (defined $check) {
9024  
9025 return $axmud::CLIENT->writeImproper($self->_objClass . '->doEmergencySave', @_);
9026 }
9027  
9028 # Prompt the user for a directory in which to save
9029 if ($self->mainWin) {
9030  
9031 $dir = $self->mainWin->showFileChooser(
9032 'Emergency save location',
9033 'select-folder',
9034 );
9035  
9036 if (! $dir) {
9037  
9038 return undef;
9039 }
9040  
9041 # Create a sub-directory in that directory
9042 # e.g. .../axmud_101218_09_17_12
9043 $dir .= '/' . $axmud::NAME_SHORT . '_' . $self->localDateString() . '_'
9044 . $self->localClockString;
9045  
9046 } else {
9047  
9048 # If there is no 'main' window, save into Axmud's base directory as a fallback
9049 $dir = $axmud::SHARE_DIR . '/EMERGENCY_SAVE/' . $axmud::NAME_SHORT . '_'
9050 . $self->localDateString() . '_' . $self->localClockString;
9051 }
9052  
9053 if (! mkdir ($dir, 0755)) {
9054  
9055 $msg = 'Could not create an emergency save directory (folder); you can try again using'
9056 . ' the \';emergencysave\' command';
9057  
9058 if ($self->mainWin) {
9059  
9060 $self->mainWin->showMsgDialogue(
9061 'Emergency save',
9062 'error',
9063 $msg,
9064 'ok',
9065 );
9066  
9067 } else {
9068  
9069 $self->writeError($msg, $self->_objClass . '->doEmergencySave');
9070 }
9071  
9072 return 1;
9073 }
9074  
9075 # Create a further sub-directory for world-specific files
9076 if (! mkdir ($dir . '/worlds', 0755)) {
9077  
9078 $msg = 'Could not create an emergency save directory (folder); you can try again using'
9079 . ' the \';emergencysave\' command.';
9080  
9081 if ($self->mainWin) {
9082  
9083 $self->mainWin->showMsgDialogue(
9084 'Emergency save',
9085 'error',
9086 $msg,
9087 'ok',
9088 );
9089  
9090 } else {
9091  
9092 $self->writeError($msg, $self->_objClass . '->doEmergencySave');
9093 }
9094  
9095 return 1;
9096 }
9097  
9098 # Save file objects stored in this GA::Client
9099 # (NB 'otherprof' or 'worldmodel' files should only be stored in the GA::Session)
9100 $errorCount = 0;
9101  
9102 foreach my $fileObjName ($self->ivKeys('fileObjHash')) {
9103  
9104 my ($fileObj, $thisDir);
9105  
9106 $fileObj = $self->ivShow('fileObjHash', $fileObjName);
9107  
9108 if ($fileObj->fileType eq 'config') {
9109  
9110 if (
9111 ! $fileObj->saveConfigFile(
9112 $fileObj->actualFileName,
9113 $dir . '/' . $fileObj->actualFileName,
9114 $dir,
9115 # The TRUE flag tells the function that an emergency save is in progress
9116 TRUE,
9117 )
9118 ) {
9119 $errorCount++;
9120 }
9121  
9122 } elsif ($fileObj->fileType eq 'worldprof') {
9123  
9124 # ('worldprof' files are stored in their own directory)
9125 $thisDir = $dir . '/worlds/' . $fileObj->assocWorldProf;
9126  
9127 if (
9128 ! $fileObj->saveDataFile(
9129 $fileObj->actualFileName,
9130 $thisDir . '/' . $fileObj->actualFileName,
9131 $thisDir,
9132 # The TRUE flag tells the function that an emergency save is in progress
9133 TRUE,
9134 )
9135 ) {
9136 $errorCount++;
9137 }
9138  
9139 } else {
9140  
9141 if (
9142 ! $fileObj->saveDataFile(
9143 $fileObj->actualFileName,
9144 $dir . '/' . $fileObj->actualFileName,
9145 $dir,
9146 # The TRUE flag tells the function that an emergency save is in
9147 # progress
9148 TRUE,
9149 )
9150 ) {
9151 $errorCount++;
9152 }
9153 }
9154 }
9155  
9156 # Instruct each session to do an emergency save in their own directory
9157 foreach my $thisSession ($self->listSessions()) {
9158  
9159 if (! $thisSession->sessionEmergencySave($dir)) {
9160  
9161 $errorCount++;
9162 }
9163 }
9164  
9165 # Show a confirmation
9166 if ($errorCount) {
9167  
9168 $msg = 'Emergency save complete (sessions saved: '
9169 . $self->ivPairs('sessionHash') . ', errors: ' . $errorCount
9170 . '; you can try again using the' . ' \';emergencysave\' command)';
9171  
9172 if ($self->mainWin) {
9173  
9174 $self->mainWin->showMsgDialogue(
9175 'Emergency save',
9176 'warning',
9177 $msg,
9178 'ok',
9179 );
9180  
9181 } else {
9182  
9183 $self->writeWarning($msg, $self->_objClass . '->doEmergencySave');
9184 }
9185  
9186 } else {
9187  
9188 $msg = 'Emergency save complete (sessions saved: '
9189 . $self->ivPairs('sessionHash') . ')';
9190  
9191 if ($self->mainWin) {
9192  
9193 $self->mainWin->showMsgDialogue(
9194 'Emergency save',
9195 'info',
9196 $msg,
9197 'ok',
9198 );
9199  
9200 } else {
9201  
9202 $self->writeText($msg);
9203 }
9204 }
9205  
9206 # Operation complete
9207 return $dir;
9208 }
9209  
9210 sub setupCmds {
9211  
9212 # Called by $self->start
9213 # Creates a Perl object for each client command, storing them in the registry
9214 # $self->clientCmdHash. (See also the code in $self->addPluginCmds)
9215 #
9216 # Expected arguments
9217 # (none besides $self)
9218 #
9219 # Return values
9220 # 'undef' on improper arguments
9221 # 1 otherwise
9222  
9223 my ($self, $check) = @_;
9224  
9225 # Check for improper arguments
9226 if (defined $check) {
9227  
9228 return $axmud::CLIENT->writeImproper($self->_objClass . '->setupCmds', @_);
9229 }
9230  
9231 foreach my $string ($self->clientCmdPrettyList) {
9232  
9233 my ($package, $obj);
9234  
9235 # $self->clientCmdPrettyList contains a list of client commands, grouped under headings.
9236 # The headings begin with a '@' character
9237 if (substr ($string, 0, 1) ne '@') {
9238  
9239 # Not a heading. Create a Perl object
9240 $package = 'Games::Axmud::Cmd::' . $string;
9241 $obj = $package->new();
9242 if (! $obj) {
9243  
9244 # (Allow writing to something other than GA::Session - there are no sessions
9245 # yet)
9246 return $self->writeError(
9247 'Could not create client command \'' . $self->cmdSep . lc($string) . '\'',
9248 $self->_objClass . '->setupCmds',
9249 );
9250 }
9251  
9252 # Update IVs
9253 $self->ivAdd('clientCmdHash', lc($string), $obj);
9254 $self->ivPush('clientCmdList', lc($string));
9255  
9256 # Set up user commands corresponding to this client command
9257 foreach my $userCmd ($obj->defaultUserCmdList) {
9258  
9259 # Check the user command isn't already in use by another client command
9260 if ($self->ivExists('constUserCmdHash', lc($userCmd))) {
9261  
9262 # (Allow writing to something other than GA::Session - there are no
9263 # sessions yet)
9264 return $self->writeError(
9265 'Duplicate user command \'' . $userCmd . '\' pointing at client'
9266 . ' command \'' . lc($string) . '\'',
9267 $self->_objClass . '->setupCmds',
9268 );
9269  
9270 } else {
9271  
9272 # Add the user command to GA::Client's hash. It's a constant variable (once
9273 # set by this function), so we can't use ->ivAdd
9274 $self->{'constUserCmdHash'}{lc($userCmd)} = lc($string);
9275 }
9276 }
9277  
9278 # The customisable hash of user commands is, for the time being, identical
9279 $self->ivPoke('userCmdHash', $self->constUserCmdHash);
9280 }
9281 }
9282  
9283 # Setup complete
9284 return 1;
9285 }
9286  
9287 sub initialiseToolbar {
9288  
9289 # Called by $self->start and GA::PrefWin::Client->toolbarTab
9290 # Creates a default set of toolbar button objects and updates the IVs $self->toolbarHash
9291 # and ->toolbarList
9292 #
9293 # Expected arguments
9294 # (none besides $self)
9295 #
9296 # Return values
9297 # 'undef' on improper arguments or if there's an error creating a toolbar button object
9298 # 1 otherwise
9299  
9300 my ($self, $check) = @_;
9301  
9302 # Local variables
9303 my @defaultList;
9304  
9305 # Check for improper arguments
9306 if (defined $check) {
9307  
9308 return $axmud::CLIENT->writeImproper($self->_objClass . '->initialiseToolbar', @_);
9309 }
9310  
9311 # Empty the existing IVs
9312 $self->ivEmpty('toolbarHash');
9313 $self->ivEmpty('toolbarList');
9314  
9315 # The items are in groups of 6, one group for each GA::Obj::Toolbar object to be created.
9316 # However, separators are in groups of 1
9317 @defaultList = $self->constToolbarList;
9318 if (@defaultList) {
9319  
9320 do {
9321  
9322 my ($name, $descrip, $iconPath, $instruct, $sessionFlag, $connectFlag);
9323  
9324 if ($defaultList[0] eq 'separator') {
9325  
9326 shift @defaultList,
9327 $self->ivPush('toolbarList', 'separator');
9328  
9329 } else {
9330  
9331 $name = shift @defaultList;
9332 $descrip = shift @defaultList;
9333 $iconPath = shift @defaultList;
9334 $instruct = shift @defaultList;
9335 $sessionFlag = shift @defaultList;
9336 $connectFlag = shift @defaultList;
9337  
9338 # Check that $name and $descrip are valid
9339 if (! $self->nameCheck($name, 16)) {
9340  
9341 $self->writeWarning(
9342 'Invalid default toolbar button name \'' . $name . '\'',
9343 $self->_objClass . '->initialiseToolbar',
9344 );
9345  
9346 } elsif (length ($descrip) > 32) {
9347  
9348 $self->writeWarning(
9349 'Invalid default toolbar button description (button \'' . $name . '\')',
9350 $self->_objClass . '->initialiseToolbar',
9351 );
9352  
9353 } else {
9354  
9355 # Create a new toolbar button object
9356 my $obj = Games::Axmud::Obj::Toolbar->new(
9357 $name,
9358 $descrip,
9359 FALSE, # Default, not custom, toolbar button
9360 $iconPath,
9361 $instruct,
9362 $sessionFlag,
9363 $connectFlag,
9364 );
9365  
9366 if (! $obj) {
9367  
9368 return undef;
9369  
9370 } else {
9371  
9372 $self->ivAdd('toolbarHash', $obj->name, $obj);
9373 $self->ivPush('toolbarList', $obj->name);
9374 }
9375 }
9376 }
9377  
9378 } until (! @defaultList);
9379 }
9380  
9381 return 1;
9382 }
9383  
9384 sub connectBlind {
9385  
9386 # Called by $self->start in Axmud blind mode
9387 # Open a series of standard 'dialogue' windows, allowing the visually-impaired user to
9388 # select a world and/or character
9389 #
9390 # Expected arguments
9391 # (none besides $self)
9392 #
9393 # Return values
9394 # 'undef' on improper arguments
9395 # 1 on success
9396  
9397 my ($self, $check) = @_;
9398  
9399 # Local variables
9400 my (
9401 $newWorldString, $newCharString, $title, $choice, $connectWorld, $connectWorldObj,
9402 $connectHost, $connectPort, $loginMode, $connectChar, $connectPwd, $connectAccount,
9403 $startFlag,
9404 @faveList, @visitedList, @otherList, @comboList, @comboList2, @comboList3,
9405 %worldHash, %nameHash, %checkHash, %loginHash,
9406 );
9407  
9408 # Check for improper arguments
9409 if (defined $check) {
9410  
9411 return $axmud::CLIENT->writeImproper($self->_objClass . '->connectBlind', @_);
9412 }
9413  
9414 # Make sure the test window for finding desktop panels has been removed
9415 $self->desktopObj->updateWidgets($self->_objClass . '->connectBlind');
9416  
9417 # Get a list of worlds, favourite worlds first, then all visited worlds sorted by number
9418 # of visits, finally unvisited worlds sorted alphabetically
9419 # (Code borrowed from GA::OtherWin::Connect->resetTreeView)
9420  
9421 $newWorldString = 'Create new world';
9422 $newCharString = 'Create new character';
9423  
9424 # For each world, decide which name to use. Create a hash in the form
9425 # $nameHash{profile_name} = displayed_name
9426 # (where 'displayed_name' is the long name, if available, or the profile name, if not
9427 # At the same time, create a parallel hash to check for duplicate long names, in the form
9428 # $checkHash{long_name} = profile_name
9429 # If duplicate long names are found, 'displayed_name' should include both the long name and
9430 # the profile name
9431 %worldHash = $self->worldProfHash;
9432 foreach my $worldObj (values %worldHash) {
9433  
9434 my ($otherWorld, $otherWorldObj);
9435  
9436 if ($worldObj->longName) {
9437  
9438 if ($worldObj->longName eq $newWorldString) {
9439  
9440 $nameHash{$worldObj->name} = $worldObj->longName . ' (' . $worldObj->name . ')';
9441 $checkHash{$worldObj->longName} = $worldObj->name;
9442  
9443 } elsif (exists $checkHash{$worldObj->longName}) {
9444  
9445 # Amend both entries to include the long name and the profile name
9446 $otherWorld = $checkHash{$worldObj->longName};
9447 $otherWorldObj = $worldHash{$otherWorld};
9448  
9449 $nameHash{$worldObj->name} = $worldObj->longName . ' (' . $worldObj->name . ')';
9450 # (There's already an entry in $checkHash matching ->longName)
9451 $nameHash{$otherWorld}
9452 = $otherWorldObj->longName . ' (' . $otherWorldObj->name . ')';
9453  
9454 } else {
9455  
9456 # Not a duplicate, so just display the long name
9457 $nameHash{$worldObj->name} = $worldObj->longName;
9458 $checkHash{$worldObj->longName} = $worldObj->name;
9459 }
9460  
9461 } else {
9462  
9463 # Just display the profile name
9464 $nameHash{$worldObj->name} = $worldObj->name;
9465 }
9466 }
9467  
9468 # Remove all favourite worlds from %worldHash, so they can be displayed first
9469 foreach my $name ($self->favouriteWorldList) {
9470  
9471 if (exists $worldHash{$name}) {
9472  
9473 push (@faveList, $worldHash{$name});
9474 delete $worldHash{$name};
9475 }
9476 }
9477  
9478 # Remove all visited worlds from %worldHash, so they can be displayed next
9479 foreach my $name (keys %worldHash) {
9480  
9481 my $worldObj = $worldHash{$name};
9482  
9483 if ($worldObj->numberConnects) {
9484  
9485 push (@visitedList, $worldObj);
9486 delete $worldHash{$name};
9487 }
9488 }
9489  
9490 # ...and sort that list so the most-visited worlds appear at the top
9491 @visitedList = sort {$a->numberConnects <=> $b->numberConnects} (@visitedList);
9492  
9493 # Now sort the remaining world profiles alphabetically
9494 @otherList = sort {lc($nameHash{$a->name}) cmp lc($nameHash{$b->name})} (values %worldHash);
9495  
9496 # Combine the three lists, replacing the GA::Profile::World objects with a name
9497 foreach my $worldObj (@faveList, @visitedList) {
9498  
9499 push (@comboList, $nameHash{$worldObj->name});
9500 }
9501  
9502 # The 'create new world' goes at the top
9503 push (@comboList, $newWorldString);
9504  
9505 foreach my $worldObj (@otherList) {
9506  
9507 push (@comboList, $nameHash{$worldObj->name});
9508 }
9509  
9510 # Open the 'dialogue' window
9511 $choice = $self->mainWin->showComboDialogue(
9512 'Welcome to ' . $axmud::SCRIPT,
9513 'Please use your cursor or arrow keys to select a world, and your tab and enter keys'
9514 . ' to click OK',
9515 \@comboList,
9516 TRUE, # Show only a single OK button
9517 );
9518  
9519 if (! $choice) {
9520  
9521 return $self->stop();
9522  
9523 } elsif ($choice ne $newWorldString) {
9524  
9525 $connectWorld = $checkHash{$choice};
9526 $connectWorldObj = $self->ivShow('worldProfHash', $connectWorld);
9527 }
9528  
9529 # Branch 1 - new world profile
9530 # ----------------------------
9531  
9532 if ($choice eq $newWorldString) {
9533  
9534 $connectWorld = $self->mainWin->showEntryDialogue(
9535 'New world',
9536 'Enter a name for the new world and press RETURN (maximum 16 characters and no'
9537 . ' spaces)',
9538 16,
9539 undef, undef, undef,
9540 TRUE, # Show only a single OK button
9541 );
9542  
9543 if (! $connectWorld) {
9544  
9545 return $self->stop();
9546  
9547 } elsif ($self->ivExists('worldProfHash', $connectWorld)) {
9548  
9549 $connectWorldObj = $self->ivShow('worldProfHash', $connectWorld);
9550  
9551 } else {
9552  
9553 $connectHost = $self->mainWin->showEntryDialogue(
9554 'Host',
9555 'Enter the DNS or IP address for the world and press RETURN',
9556 256,
9557 undef, undef, undef,
9558 TRUE, # Show only a single OK button
9559 );
9560  
9561 if (! $connectHost) {
9562  
9563 return $self->stop();
9564 }
9565  
9566 $connectPort = $self->mainWin->showEntryDialogue(
9567 'Port',
9568 'Enter the port and press RETURN',
9569 256,
9570 undef, undef, undef,
9571 TRUE, # Show only a single OK button
9572 );
9573  
9574 if (! $connectPort) {
9575  
9576 return $self->stop();
9577 }
9578  
9579 # (A subset of login modes in GA::Profile::World->loginMode)
9580 %loginHash = (
9581 'No automatic login' => 'none',
9582 'LP / Diku / AberMUD style logins' => 'lp',
9583 'TinyMUD style logins' => 'tiny',
9584 'Basic telnet logins' => 'telnet',
9585 );
9586  
9587 @comboList3 = (
9588 'No automatic login',
9589 'LP / Diku / AberMUD style logins',
9590 'TinyMUD style logins',
9591 'Basic telnet logins',
9592 );
9593  
9594 $choice = $self->mainWin->showComboDialogue(
9595 'Automatic login mode',
9596 'What kind of login does this world use? (If you\'re not sure, select \'no'
9597 . ' automatic login\')',
9598 \@comboList3,
9599 TRUE, # Show only a single OK button
9600 );
9601  
9602 if (! $choice) {
9603 $loginMode = 'none';
9604 } else {
9605 $loginMode = $loginHash{$choice};
9606 }
9607  
9608 # (Characters are optional)
9609 $connectChar = $self->mainWin->showEntryDialogue(
9610 'Character',
9611 'Enter a character name and press RETURN',
9612 16,
9613 undef, undef, undef,
9614 TRUE, # Show only a single OK button
9615 );
9616  
9617 if ($connectChar) {
9618  
9619 # (Passwords are optional)
9620 $connectPwd = $self->mainWin->showEntryDialogue(
9621 'Password',
9622 'Enter a password and press RETURN',
9623 undef, # No maximum password length
9624 undef,
9625 TRUE, # Obscure password text
9626 undef,
9627 TRUE, # Show only a single OK button
9628 );
9629 }
9630  
9631 # Ready to start the session
9632 $startFlag = TRUE;
9633 }
9634 }
9635  
9636 # Branch 2 - existing world profile
9637 # ---------------------------------
9638  
9639 if (! $startFlag) {
9640  
9641 # Get a sorted list of player profiles, with the most recently-connected player at the
9642 # top
9643 foreach my $char ($connectWorldObj->ivKeys('passwordHash')) {
9644  
9645 if (
9646 ! $connectWorldObj->lastConnectChar
9647 || $char eq $connectWorldObj->lastConnectChar
9648 ) {
9649 push (@comboList2, $char);
9650 }
9651 }
9652  
9653 # (If there are no characters in the list, skip the next dialogue)
9654 if (@comboList2) {
9655  
9656 push (@comboList2, $newCharString);
9657  
9658 $choice = $self->mainWin->showComboDialogue(
9659 'Select character',
9660 'Use your cursor keys to select a character, and your tab and enter keys to'
9661 . ' click OK',
9662 \@comboList2,
9663 TRUE, # Show only a single OK button
9664 );
9665  
9666 if (! $choice) {
9667  
9668 return $self->stop();
9669  
9670 } elsif ($choice ne $newCharString) {
9671  
9672 $connectChar = $choice;
9673  
9674 ($connectHost, $connectPort, $connectChar, $connectPwd, $connectAccount)
9675 = $connectWorldObj->getConnectDetails($connectChar);
9676 }
9677 }
9678  
9679 if (! $connectChar) {
9680  
9681 # (Characters are optional)
9682 $connectChar = $self->mainWin->showEntryDialogue(
9683 'Character',
9684 'Enter a character name and press RETURN',
9685 16,
9686 undef, undef, undef,
9687 TRUE, # Show only a single OK button
9688 );
9689  
9690 if ($connectChar) {
9691  
9692 # (Passwords are optional)
9693 $connectPwd = $self->mainWin->showEntryDialogue(
9694 'Password',
9695 'Enter a password and press RETURN',
9696 undef, # No maximum password length
9697 undef,
9698 TRUE, # Obscure password text
9699 undef,
9700 TRUE, # Show only a single OK button
9701 );
9702 }
9703  
9704 ($connectHost, $connectPort) = $connectWorldObj->getConnectDetails();
9705 }
9706 }
9707  
9708 # The TTS job list has almost certainly been interrupted. Reset some iVs, so that the we
9709 # can start performing TTS jobs immediately (start reading aloud the session's text
9710 # immediately)
9711 $self->ttsRestart();
9712  
9713 # Start the session
9714 if (
9715 ! $self->startSession(
9716 $connectWorld,
9717 $connectHost,
9718 $connectPort,
9719 $connectChar,
9720 $connectPwd,
9721 $connectAccount,
9722 undef, # Default protocol
9723 $loginMode, # May be 'undef'
9724 )
9725 ) {
9726 # Display a confirmation
9727 $self->mainWin->showMsgDialogue(
9728 'Failed connection',
9729 'error',
9730 'General error while connecting to \'' . $connectWorld . '\'',
9731 'ok',
9732 );
9733  
9734 return $self->stop();
9735  
9736 } else {
9737  
9738 # Operation complete
9739 return 1;
9740 }
9741 }
9742  
9743 sub addGlobalInitTask {
9744  
9745 # Called by $self->start (when no sessions are running) to add a task to the global initial
9746 # tasklist
9747 # (Also called by functions in GA::WizWin::Setup)
9748 #
9749 # Expected arguments
9750 # $taskName - The task's formal name (e.g. 'status_task')
9751 #
9752 # Return values
9753 # 'undef' on improper arguments or if the initial task can't be added
9754 # Otherwise returns the new initial task
9755  
9756 my ($self, $taskName, $check) = @_;
9757  
9758 # Local variables
9759 my ($packageName, $taskObj);
9760  
9761 # Check for improper arguments
9762 if (! defined $taskName || defined $check) {
9763  
9764 return $axmud::CLIENT->writeImproper($self->_objClass . '->addGlobalInitTask', @_);
9765 }
9766  
9767 # Get the package name corresponding to $taskName (e.g. 'Games::Axmud::Task::Status',
9768 # 'Games::Axmud::Task::Divert')
9769 $packageName = $self->ivShow('constTaskPackageHash', $taskName);
9770 if (! $packageName) {
9771  
9772 return undef;
9773 }
9774  
9775 # Create the task object. We have to cheat a bit and name this GA::Client as the parent
9776 # GA::Session (it's not stored as an IV)
9777 $taskObj = $packageName->new($self);
9778 if (! $taskObj) {
9779  
9780 return undef;
9781 }
9782  
9783 # (No need to check plugins, normally done by a call to GA::Generic::Task->checkPlugins -
9784 # only built-in tasks exist in ->constTaskPackageHash)
9785  
9786 # Set the standard IV (normally done by GA::Generic::Task->setParentFileObj)
9787 $taskObj->{_parentFile} = 'tasks';
9788 # Set the task type (normally done in the call to $taskObj->new)
9789 $taskObj->{taskType} = 'initial';
9790  
9791 # Update the global initial tasklist (normally done by GA::Generic::Task->updateTaskLists)
9792 # Give task a unique name within the global initial tasklist
9793 $taskObj->{uniqueName} = $taskObj->{name} . '_' . $self->inc_initTaskTotal();
9794 # Create an entry in the global initial tasklist (this call marks the parent file objects as
9795 # having had its data modified)
9796 $self->add_initTask($taskObj);
9797  
9798 return $taskObj;
9799 }
9800  
9801 # Client and session loop
9802  
9803 sub startClientLoop {
9804  
9805 # Called by $self->start
9806 # Starts the client loop, which calls $self->spinClientLoop whenever the loop spins
9807 #
9808 # Expected arguments
9809 # (none besides $self)
9810 #
9811 # Return values
9812 # 'undef' on improper arguments or if the loop can't be started
9813 # 1 otherwise
9814  
9815 my ($self, $check) = @_;
9816  
9817 # Local variables
9818 my $loopObj;
9819  
9820 # Check for improper arguments
9821 if (defined $check) {
9822  
9823 return $axmud::CLIENT->writeImproper($self->_objClass . '->startClientLoop', @_);
9824 }
9825  
9826 # Create the object that handles the loop
9827 $loopObj = Games::Axmud::Obj::Loop->new(
9828 $self,
9829 'spinClientLoop',
9830 'client',
9831 );
9832  
9833 if (! $loopObj) {
9834  
9835 return undef;
9836  
9837 } else {
9838  
9839 $self->ivPoke('clientLoopObj', $loopObj);
9840 }
9841  
9842 # Start the loop
9843 if (! $loopObj->startLoop($self->clientLoopDelay)) {
9844  
9845 return undef;
9846  
9847 } else {
9848  
9849 # Initialise blinking text in textviews, with text initially visible
9850 $self->ivPoke('blinkSlowCheckTime', $self->clientTime + ($self->blinkSlowTime / 2));
9851 $self->ivPoke('blinkSlowFlag', TRUE);
9852 $self->ivPoke('blinkFastCheckTime', $self->clientTime + ($self->blinkFastTime / 2));
9853 $self->ivPoke('blinkFastFlag', TRUE);
9854  
9855 return 1;
9856 }
9857 }
9858  
9859 sub stopClientLoop {
9860  
9861 # Called by $self->stop
9862 # Stops the client loop
9863 #
9864 # Expected arguments
9865 # (none besides $self)
9866 #
9867 # Return values
9868 # 'undef' on improper arguments, if the loop isn't running or if it can't be stopped
9869 # 1 otherwise
9870  
9871 my ($self, $check) = @_;
9872  
9873 # Local variables
9874 my $result;
9875  
9876 # Check for improper arguments
9877 if (defined $check) {
9878  
9879 return $axmud::CLIENT->writeImproper($self->_objClass . '->stopClientLoop', @_);
9880 }
9881  
9882 if (! $self->clientLoopObj) {
9883  
9884 return undef;
9885 }
9886  
9887 # Stop the loop
9888 $result = $self->clientLoopObj->stopLoop();
9889  
9890 # Update IVs
9891 $self->ivUndef('clientLoopObj');
9892  
9893 return $result;
9894 }
9895  
9896 sub spinClientLoop {
9897  
9898 # Called by $self->clientLoopObj->spinLoop when the client loop spins
9899 # Updates 'internal' windows and some of their strip objects. Makes blinking text in
9900 # Gtk3::Textviews blink on or off. Checks file objects and, if any need to be saved,
9901 # updates the title of 'main' windows
9902 #
9903 # Expected arguments
9904 # $loopObj - The GA::Obj::Loop object handling the client loop
9905 #
9906 # Return values
9907 # 'undef' on improper arguments, if the client loop isn't running or if $loopObj is the
9908 # wrong loop object
9909 # 1 otherwise
9910  
9911 my ($self, $loopObj, $check) = @_;
9912  
9913 # Local variables
9914 my (
9915 $connectInfoFlag, $result,
9916 @bufferList,
9917 );
9918  
9919 # Check for improper arguments
9920 if (! defined $loopObj || defined $check) {
9921  
9922 return $axmud::CLIENT->writeImproper($self->_objClass . '->spinClientLoop', @_);
9923 }
9924  
9925 if (
9926 ! $self->clientLoopObj
9927 || $self->clientLoopObj ne $loopObj
9928 || $self->suspendSessionLoopFlag
9929 ) {
9930 return undef;
9931 }
9932  
9933 # Update IVs
9934 $self->ivPoke('clientTime', $loopObj->spinTime);
9935  
9936 # Update blinkers states for each session
9937 foreach my $session ($self->listSessions()) {
9938  
9939 $session->updateBlinkers();
9940 }
9941  
9942 # Update 'internal' windows
9943 foreach my $winObj ($self->desktopObj->listGridWins()) {
9944  
9945 my (
9946 $stripObj,
9947 %hash,
9948 );
9949  
9950 if (
9951 $winObj->winType eq 'main'
9952 || $winObj->winType eq 'protocol'
9953 || $winObj->winType eq 'custom'
9954 ) {
9955 # If the GA::Strip::GaugeBox strip object's gauge box has been empty for too long,
9956 # remove it
9957 $stripObj = $winObj->ivShow('firstStripHash', 'Games::Axmud::Strip::GaugeBox');
9958 if (
9959 $stripObj
9960 && defined $stripObj->gaugeCheckTime
9961 && $stripObj->gaugeCheckTime < $self->clientTime
9962 ) {
9963 $stripObj->removeGaugeBox();
9964 }
9965  
9966 # If the GA::Strip::Entry strip object's console button is in flashing mode, make
9967 # it flash once
9968 if ($winObj->visibleSession && $winObj->visibleSession->systemMsgCheckTime) {
9969  
9970 $stripObj = $winObj->ivShow('firstStripHash', 'Games::Axmud::Strip::Entry');
9971 if ($stripObj) {
9972  
9973 $stripObj->set_consoleIconFlash();
9974 }
9975 }
9976  
9977 # Update the GA::Strip::ConnectInfo strip object in every 'internal' window
9978 # approximately every second
9979 # (GA::Strip::ConnectInfo are allowed in 'internal' windows besides 'main' windows,
9980 # but they don't display connection data)
9981 if ($winObj->visibleSession) {
9982  
9983 if (
9984 ! $winObj->visibleSession->connectInfoCheckTime
9985 || $winObj->visibleSession->connectInfoCheckTime
9986 < int($winObj->visibleSession->sessionTime)
9987 ) {
9988 $winObj->setTimeLabel($winObj->visibleSession->getTimeLabelText());
9989 }
9990  
9991 } else {
9992  
9993 $winObj->setTimeLabel('');
9994 }
9995  
9996 # Re-draw blinkers in any 'internal' window which uses them, as appropriate
9997 # (GA::Strip::ConnectInfo are allowed in 'internal' windows besides 'main' windows,
9998 # but blinkers are only updated in the session's 'main' window)
9999 if ($winObj->visibleSession) {
10000  
10001 $stripObj
10002 = $winObj->ivShow('firstStripHash', 'Games::Axmud::Strip::ConnectInfo');
10003  
10004 if ($stripObj) {
10005  
10006 # Import the visible session's blinker state hash (for convenience)
10007 %hash = $winObj->visibleSession->blinkerStateHash;
10008  
10009 # Redraw each blinker that is off, but should be on (and vice-versa)
10010 foreach my $blinkerNum (keys %hash) {
10011  
10012 my ($blinkerState, $blinkerObj);
10013  
10014 $blinkerState = $hash{$blinkerNum};
10015 $blinkerObj = $stripObj->ivShow('blinkerHash', $blinkerNum);
10016  
10017 if (
10018 $blinkerObj
10019 && (
10020 (defined $blinkerState && ! $blinkerObj->onFlag)
10021 || (! defined $blinkerState && $blinkerObj->onFlag)
10022 )
10023 ) {
10024 # Redraw this blinker
10025 $stripObj->drawBlinker($blinkerNum, ! ($blinkerObj->onFlag));
10026 }
10027 }
10028 }
10029 }
10030 }
10031 }
10032  
10033 # Get a list of textview buffers which might contain blinking text
10034 foreach my $textViewObj ($self->desktopObj->ivValues('textViewHash')) {
10035  
10036 push (@bufferList, $textViewObj->buffer);
10037 }
10038  
10039 # Update the buffers' text tags (if it's time to do so), making the text appear or disappear
10040 # on cue
10041 if ($self->clientTime > $self->blinkSlowCheckTime) {
10042  
10043 foreach my $buffer (@bufferList) {
10044  
10045 my ($blinkTag, $cursorTag);
10046  
10047 $blinkTag = $buffer->get_tag_table->lookup('blink_slow');
10048 $cursorTag = $buffer->get_tag_table->lookup('cursor');
10049  
10050 if ($blinkTag) {
10051  
10052 $blinkTag->set_property('foreground-set', $self->blinkSlowFlag);
10053 $blinkTag->set_property('background-set', $self->blinkSlowFlag);
10054 }
10055  
10056 # The textview object's cursor is updated at the same time
10057 if ($cursorTag && ! $self->useFastCursorFlag) {
10058  
10059 if ($self->blinkSlowFlag) {
10060 $cursorTag->set_property('underline', 'single');
10061 } else {
10062 $cursorTag->set_property('underline', 'none');
10063 }
10064 }
10065 }
10066  
10067 if ($self->blinkSlowFlag) {
10068 $self->ivPoke('blinkSlowFlag', FALSE);
10069 } else {
10070 $self->ivPoke('blinkSlowFlag', TRUE);
10071 }
10072  
10073 $self->ivPoke('blinkSlowCheckTime', $self->clientTime + ($self->blinkSlowTime / 2));
10074 }
10075  
10076 if ($self->clientTime > $self->blinkFastCheckTime) {
10077  
10078 foreach my $buffer (@bufferList) {
10079  
10080 my ($blinkTag, $cursorTag);
10081  
10082 $blinkTag = $buffer->get_tag_table->lookup('blink_fast');
10083 $cursorTag = $buffer->get_tag_table->lookup('cursor');
10084  
10085 if ($blinkTag) {
10086  
10087 $blinkTag->set_property('foreground-set', $self->blinkFastFlag);
10088 $blinkTag->set_property('background-set', $self->blinkFastFlag);
10089 }
10090  
10091 # The textview object's cursor is updated at the same time
10092 if ($cursorTag && $self->useFastCursorFlag) {
10093  
10094 if ($self->blinkFastFlag) {
10095 $cursorTag->set_property('underline', 'single');
10096 } else {
10097 $cursorTag->set_property('underline', 'none');
10098 }
10099 }
10100 }
10101  
10102 if ($self->blinkFastFlag) {
10103 $self->ivPoke('blinkFastFlag', FALSE);
10104 } else {
10105 $self->ivPoke('blinkFastFlag', TRUE);
10106 }
10107  
10108 $self->ivPoke('blinkFastCheckTime', $self->clientTime + ($self->blinkFastTime / 2));
10109 }
10110  
10111 # Checks all the file objects stored in $self->fileObjHash and change the title of all
10112 # 'main' windows, if necessary (using an asterisk to show that at least one file needs to
10113 # be saved, and no asterisk to show that none of them need to be saved)
10114 $self->checkMainWinTitles();
10115  
10116 # Restore the border size of any pane objects whose border size has been briefly increased
10117 $self->paneRestoreBorder();
10118  
10119 # Perform text-to-speech (TTS) requests and jobs
10120 $self->ttsPerformJobs();
10121  
10122 return 1;
10123 }
10124  
10125 sub haltSessionLoops {
10126  
10127 # Called by $SIG{__DIE__} in axmud.pl
10128 # We don't know which GA::Session caused the Perl error, but we can leave Axmud in a (more
10129 # or less) functional state by halting all client loops and session loops; the user can
10130 # restart them, when ready, with the ';restart' command
10131 #
10132 # Expected arguments
10133 # (none besides $self)
10134 #
10135 # Return values
10136 # 'undef' on improper arguments
10137 # 1 otherwise
10138  
10139 my ($self, $check) = @_;
10140  
10141 # Local variables
10142 my @list;
10143  
10144 # Check for improper arguments
10145 if (defined $check) {
10146  
10147 return $axmud::CLIENT->writeImproper($self->_objClass . '->haltSessionLoops', @_);
10148 }
10149  
10150 $self->ivPoke('suspendSessionLoopFlag', TRUE);
10151  
10152 # The Glib::Timeout might have stopped, or not (depending on what caused the error), so we
10153 # need to formally stop it
10154 foreach my $session ($self->ivValues('sessionHash')) {
10155  
10156 $session->stopSessionLoop();
10157 }
10158  
10159 @list = (
10160 ' ',
10161 'Because of a Perl error, ' . $axmud::SCRIPT . ' internal processes have been'
10162 . ' suspended across all sessions. (This will prevent you from seeing the same'
10163 . ' error message again and again, and will perhaps protect your stored data'
10164 . ' from getting corrupted. If there are several sessions open, the error is'
10165 . ' sometimes visible only in one session.)',
10166 ' ',
10167 'Most errors of this kind are caused by invalid patterns (regular expressions)'
10168 . ' in your interfaces (triggers, aliases, macros, timers and hooks). You can'
10169 . ' often correct them by opening an \'edit\' window and by replacing the'
10170 . ' invalid pattern with a valid one or by deleting it altogether.',
10171 ' ',
10172 );
10173  
10174 if ($self->pluginHash) {
10175  
10176 push (@list,
10177 'If the error was caused by a faulty plugin, the plugin can be disabled with'
10178 . ' the \';disableplugin\' command. Errors with the ' . $axmud::SCRIPT . ' code'
10179 . ' itself should be reported to the authors.',
10180 ' ',
10181 );
10182  
10183 }
10184  
10185 push (@list,
10186 'When you are ready, you can use the \';restart\' command to return '
10187 . $axmud::SCRIPT . ' to a more-or-less functional state.',
10188 ' ',
10189 '---',
10190 ' ',
10191 'Too long, didn\'t read? Just type: ;restart',
10192 ' ',
10193 );
10194  
10195 foreach my $session ($self->ivValues('sessionHash')) {
10196  
10197 foreach my $line (@list) {
10198  
10199 $session->writeText($line);
10200 }
10201 }
10202  
10203 return 1;
10204 }
10205  
10206 sub restoreSessionLoops {
10207  
10208 # Called by GA::Cmd::Restart->do
10209 # Restarts client/session loops stopped by a call to $self->haltSessionLoops
10210 #
10211 # Expected arguments
10212 # (none besides $self)
10213 #
10214 # Return values
10215 # 'undef' on improper arguments
10216 # 1 otherwise
10217  
10218 my ($self, $check) = @_;
10219  
10220 # Check for improper arguments
10221 if (defined $check) {
10222  
10223 return $axmud::CLIENT->writeImproper($self->_objClass . '->restoreSessionLoops', @_);
10224 }
10225  
10226 $self->ivPoke('suspendSessionLoopFlag', FALSE);
10227  
10228 # The Glib::Timeout might have stopped, or not (depending on what caused the error), so we
10229 # need to formally stop it
10230 foreach my $session ($self->ivValues('sessionHash')) {
10231  
10232 $session->startSessionLoop();
10233 }
10234  
10235 return 1;
10236 }
10237  
10238 sub checkMainWinTitles {
10239  
10240 # Called by $self->spinClientLoop
10241 # This titles of all 'main' windows need to be changed from time to time (all 'main' windows
10242 # have the same title, and any changes are performed on all 'main' windows at the same
10243 # time)
10244 # This function checks whether it's necessary to change them and performs the operation, if
10245 # so
10246 #
10247 # Expected arguments
10248 # (none besides $self)
10249 #
10250 # Return values
10251 # 'undef' on improper arguments
10252 # 1 otherwise
10253  
10254 my ($self, $check) = @_;
10255  
10256 # Local variables
10257 my (
10258 $exitFlag,
10259 @winObjList,
10260 );
10261  
10262 # Check for improper arguments
10263 if (defined $check) {
10264  
10265 return $axmud::CLIENT->writeImproper($self->_objClass . '->checkMainWinTitles', @_);
10266 }
10267  
10268 # Get an ordered list of all 'main' windows
10269 @winObjList = $self->desktopObj->listGridWins('main');
10270  
10271 # Check file objects for the client
10272 if ($self->showModFlag) {
10273  
10274 # 'main' window titles contain an asterisk, meaning that some files need to be saved. If
10275 # they have all been saved, we change the titles
10276 OUTER: foreach my $fileObj ($self->ivValues('fileObjHash')) {
10277  
10278 if ($fileObj->modifyFlag) {
10279  
10280 $exitFlag = TRUE;
10281 last OUTER;
10282 }
10283 }
10284  
10285 if (! $exitFlag) {
10286  
10287 # All files already saved; change 'main' windows titles
10288 foreach my $winObj (@winObjList) {
10289  
10290 $winObj->setMainWinTitle(FALSE);
10291 }
10292  
10293 # Update IVs
10294 $self->ivPoke('showModFlag', FALSE);
10295 }
10296  
10297 } else {
10298  
10299 # 'main' window titles don't contain an asterisk, meaning that no files need to be
10300 # saved. If any of them now need to be saved, we change the titles
10301 OUTER: foreach my $fileObj ($self->ivValues('fileObjHash')) {
10302  
10303 if ($fileObj->modifyFlag) {
10304  
10305 $exitFlag = TRUE;
10306 last OUTER;
10307 }
10308 }
10309  
10310 if ($exitFlag) {
10311  
10312 # At least one file needs to be saved; change the label (the window's ->showModFlag
10313 # is automatically updated)
10314 # All files already saved; change 'main' window titles
10315 foreach my $winObj (@winObjList) {
10316  
10317 $winObj->setMainWinTitle(TRUE);
10318 }
10319  
10320 # Update IVs
10321 $self->ivPoke('showModFlag', TRUE);
10322 }
10323 }
10324  
10325 return 1;
10326 }
10327  
10328 sub paneModifyBorder {
10329  
10330 # Called by GA::Strip::Entry->setSwitchSignals
10331 # In 'internal' windows, that strip object includes a switcher button to switch between pane
10332 # objects (GA::Table::Pane); the scroll lock/split screen buttons then apply to the
10333 # selected pane object
10334 # When a pane object is selected, this function is called to briefly increase the pane's
10335 # border size; any other panes in the same window are immediately restored
10336 # The size of this pane is restored to normal by a call to $self->paneRestoreBorder from
10337 # $self->spinClientLoop
10338 #
10339 # Expected arguments
10340 # $paneObj - The selected pane object
10341 #
10342 # Return values
10343 # 'undef' on improper arguments
10344 # 1 otherwise
10345  
10346 my ($self, $paneObj, $check) = @_;
10347  
10348 # Check for improper arguments
10349 if (! defined $paneObj || defined $check) {
10350  
10351 return $axmud::CLIENT->writeImproper($self->_objClass . '->paneModifyBorder', @_);
10352 }
10353  
10354 # Immediately restore the border size of any other pane object in this window
10355 foreach my $time ($self->ivKeys('paneRestoreHash')) {
10356  
10357 my $otherPaneObj = $self->ivShow('paneRestoreHash', $time);
10358  
10359 if ($otherPaneObj->winObj && $otherPaneObj->winObj eq $paneObj->winObj) {
10360  
10361 # Restore this pane object's border size immediately
10362 $otherPaneObj->set_borderWidth(FALSE);
10363 $self->ivDelete('paneRestoreHash', $time);
10364 }
10365 }
10366  
10367 # Modify the pane's border size
10368 $paneObj->set_borderWidth(TRUE);
10369 # Add an entry for this pane object, setting the time at which its border will be restored
10370 # Pane object numbers are not unique to the client, so in this hash we take the unusual
10371 # step of using a system time as a key, matching the time at which the border size
10372 # should be restored
10373 $self->ivAdd('paneRestoreHash', ($self->clientTime + $self->paneDelay), $paneObj);
10374  
10375 return 1;
10376 }
10377  
10378 sub paneRestoreBorder {
10379  
10380 # Called by $self->spinClientLoop
10381 # In 'internal' windows, the strip object GA::Strip::Entry includes a switcher button to
10382 # switch between pane objects (GA::Table::Pane); the scroll lock/split screen buttons
10383 # then apply to the selected pane object
10384 # When a pane object is selected, $self->paneModifyBorder is called to briefly increase the
10385 # pane's border size; the client loop calls this function to check whether it's time to
10386 # restore any border sizes, and to restore them if so
10387 #
10388 # Expected arguments
10389 # (none besides $self)
10390 #
10391 # Return values
10392 # 'undef' on improper arguments
10393 # 1 otherwise
10394  
10395 my ($self, $check) = @_;
10396  
10397 # Check for improper arguments
10398 if (defined $check) {
10399  
10400 return $axmud::CLIENT->writeImproper($self->_objClass . '->paneRestoreBorder', @_);
10401 }
10402  
10403 foreach my $time ($self->ivKeys('paneRestoreHash')) {
10404  
10405 my $paneObj;
10406  
10407 if ($time < $self->clientTime) {
10408  
10409 $paneObj = $self->ivShow('paneRestoreHash', $time);
10410 # Check the pane object and its window still exist (just in case)
10411 if (
10412 $paneObj->winObj
10413 && $self->desktopObj->ivExists('gridWinHash', $paneObj->winObj->number)
10414 ) {
10415 # Restore this pane object's border size immediately
10416 $paneObj->set_borderWidth(FALSE);
10417 $self->ivDelete('paneRestoreHash', $time);
10418 }
10419 }
10420 }
10421  
10422 return 1;
10423 }
10424  
10425 # Session methods
10426  
10427 sub startSession {
10428  
10429 # Called initially by GA::OtherWin::Connect->connectWorldCallback or $self->connectBlind,
10430 # thereafter by GA::Cmd::Connect->do, Reconnect->do, XConnect->do, Telnet->do, SSH->do and
10431 # SSL->do
10432 # Starts a session (managing a single connection to a world)
10433 #
10434 # Expected arguments
10435 # $world - The world's name (matches a world profile name)
10436 #
10437 # Optional arguments
10438 # $host - The world's host address (if 'undef', default host address used)
10439 # $port - The world's port (if 'undef', default host port used)
10440 # $char - A character name (matches a character profile name (if 'undef', no
10441 # character profile used)
10442 # $pass - The corresponding password (if 'undef', the world profile is consulted
10443 # to provide the password, if possible)
10444 # $account - The character's associated account name, for worlds that use both
10445 # (if 'undef', no account name used)
10446 # $protocol - If set to 'telnet', 'ssh' or 'ssl', that protocol is used; if 'undef'
10447 # or an unrecognised value, the world profile's ->protocol is used
10448 # $loginMode - Set when called by $self->connectBlind, when a new world profile is to
10449 # be created, and the user has specified what type of ->loginMode this
10450 # world uses; otherwise set to 'undef'
10451 # $offlineFlag - If TRUE, the session doesn't actually connect to the world, but still
10452 # loads all data and makes some client commands available. If FALSE
10453 # (or 'undef'), the session tries to connect to the world
10454 # $tempFlag - If set to TRUE, the world profile is a temporary world profile,
10455 # created because the user didn't specify a world name. File saving
10456 # in the session will be disabled. Otherwise set to FALSE (or
10457 # 'undef')
10458 #
10459 # Return values
10460 # 'undef' on improper arguments or if the GA::Session object can't be created or started
10461 # The new GA::Session object on success
10462  
10463 my (
10464 $self, $world, $host, $port, $char, $pass, $account, $protocol, $loginMode,
10465 $offlineFlag, $tempFlag, $check,
10466 ) = @_;
10467  
10468 # Local variables
10469 my ($actualCount, $tempName, $successFlag, $worldObj, $newSession, $index);
10470  
10471 # Check for improper arguments
10472 if (! defined $world || defined $check) {
10473  
10474 return $axmud::CLIENT->writeImproper($self->_objClass . '->startSession', @_);
10475 }
10476  
10477 # In blind mode, only one session is allowed. To allow the user to use ';reconnect', and
10478 # so on, terminate the existing session which is not connected to a world before
10479 # creating a new one
10480 if ($axmud::BLIND_MODE_FLAG) {
10481  
10482 foreach my $session ($self->listSessions()) {
10483  
10484 if (
10485 $session->status eq 'waiting'
10486 || $session->status eq 'offline'
10487 || $session->status eq 'disconnected'
10488 ) {
10489 $self->stopSession($session);
10490 }
10491 }
10492 }
10493  
10494 # Count the number of active sessions
10495 $actualCount = $self->ivPairs('sessionHash');
10496  
10497 # Check that we don't already have too many sessions
10498 if ($actualCount >= $self->sessionMax) {
10499  
10500 $self->mainWin->showMsgDialogue(
10501 'Session limit reached',
10502 'error',
10503 'Can\'t open a new session (' . $axmud::SCRIPT . ' has reached its limit of '
10504 . $self->sessionMax . ' sessions - see the help for \';maxsession\')',
10505 'ok',
10506 );
10507  
10508 return undef;
10509  
10510 } elsif ($axmud::BLIND_MODE_FLAG && $actualCount >= 1) {
10511  
10512 $self->mainWin->showMsgDialogue(
10513 'Session limit reached',
10514 'error',
10515 'Can\'t open multiple sessions when ' . $axmud::SCRIPT . ' is running in \'blind\''
10516 . ' mode',
10517 'ok',
10518 );
10519  
10520 return undef;
10521 }
10522  
10523 # Two sessions can have the same current world, but they can't have the same current
10524 # character (unless one of them has their ->status set to 'disconnected')
10525 if ($char && $self->testSessions($world, $char, TRUE)) {
10526  
10527 $self->mainWin->showMsgDialogue(
10528 'Duplicate character',
10529 'error',
10530 'You are already connected to \'' . $world . '\' using the character \'' . $char
10531 . '\'',
10532 'ok',
10533 );
10534  
10535 return undef;
10536 }
10537  
10538 # For temporary profiles, check a world profile with the same name doesn't already exist
10539 # and, if so, rename the temporary profile
10540 if ($tempFlag && $self->ivExists('worldProfHash', $world)) {
10541  
10542 # (Give up after too many renaming attempts)
10543 OUTER: for (my $count = 2; $count < 999; $count++) {
10544  
10545 $tempName = $world . $count; # e.g. 'deathmud2'
10546  
10547 # Max length of a profile is 16 chars
10548 if (length ($tempName) <= 16 && ! $self->ivExists('worldProfHash', $tempName)) {
10549  
10550 $world = $tempName;
10551 $successFlag = TRUE;
10552 last OUTER;
10553 }
10554 }
10555  
10556 if (! $successFlag) {
10557  
10558 $self->mainWin->showMsgDialogue(
10559 'Bad temporary world',
10560 'error',
10561 'Attempted to create a temporary world profile, but a world profile called \''
10562 . $world . '\' already exists, and ' . $axmud::SCRIPT . ' could not find an'
10563 . ' alternative name',
10564 'ok',
10565 );
10566  
10567 return undef;
10568 }
10569 }
10570  
10571 # If $host and/or $port were not specified, use generic values
10572 if (! defined $host) {
10573  
10574 $host = '127.0.0.1';
10575 }
10576  
10577 if (! defined $port) {
10578  
10579 $port = 23;
10580 }
10581  
10582 # If $protocol is not recognised, use a default value
10583 if (
10584 defined $protocol && $protocol ne 'telnet' && $protocol ne 'ssh' && $protocol ne 'ssl'
10585 ) {
10586 # Default is 'telnet'
10587 $protocol = undef;
10588 }
10589  
10590 # Create the GA::Session
10591 $newSession = Games::Axmud::Session->new(
10592 $self->sessionCount,
10593 $world,
10594 $host,
10595 $port,
10596 $char,
10597 $pass,
10598 $account,
10599 $protocol,
10600 $loginMode,
10601 $offlineFlag,
10602 $tempFlag,
10603 );
10604  
10605 if (! $newSession) {
10606  
10607 return undef;
10608 }
10609  
10610 # Session object created. Update IVs
10611 $self->ivIncrement('sessionCount');
10612 $self->ivAdd('sessionHash', $newSession->number, $newSession);
10613  
10614 # Start the session
10615 if (! $newSession->start()) {
10616 return undef;
10617 } else {
10618 return $newSession;
10619 }
10620 }
10621  
10622 sub stopSession {
10623  
10624 # Called by GA::Cmd::StopSession->do, $self->disablePlugin and GA::Session->del_winObj
10625 # Also called by $self->startSession in blind mode, to remove the existing disconnected
10626 # session
10627 #
10628 # Stops a GA::Session
10629 #
10630 # Expected arguments
10631 # $session - The GA::Session object to stop
10632 #
10633 # Return values
10634 # 'undef' on improper arguments, if the session is missing from the registry or if it
10635 # can't be stopped (no error msgs)
10636 # 1 otherwise
10637  
10638 my ($self, $session, $check) = @_;
10639  
10640 # Local variables
10641 my $nextSession;
10642  
10643 # Check for improper arguments
10644 if (! defined $session || defined $check) {
10645  
10646 return $axmud::CLIENT->writeImproper($self->_objClass . '->stopSession', @_);
10647 }
10648  
10649 if (! $self->ivExists('sessionHash', $session->number)) {
10650  
10651 # $session seems to be missing from the registry
10652 return $self->writeError(
10653 'Session #' . $session->number . ' missing from session registry',
10654 $self->_objClass . '->stopSession',
10655 );
10656  
10657 } else {
10658  
10659 # Update IVs
10660 $self->ivDelete('sessionHash', $session->number);
10661  
10662 # Terminate the session
10663 $session->stop();
10664 if ($self->currentSession eq $session) {
10665  
10666 if (! $self->sessionHash) {
10667  
10668 # There are no more sessions left
10669 $self->setCurrentSession();
10670 if (! $self->shareMainWinFlag) {
10671  
10672 # When sessions don't share a 'main' window, close the client when the last
10673 # session terminates
10674 # (If sessions do share a 'main' window, GA::Session->stop has already
10675 # created a spare 'main' window, and the client doesn't stop)
10676 $self->stop();
10677 }
10678  
10679 } else {
10680  
10681 # Decide which session is the new current one. It's the one which was created
10682 # after $session but, if $session was the most recently-created one, it's
10683 # the one created last
10684 # (The TRUE argument means use the last one, rather than the first one, if
10685 # necessary)
10686 $nextSession = $self->getNextSession($session, TRUE);
10687 if ($nextSession) {
10688  
10689 # Make the session's default tab the new visible tab in its pane object
10690 if ($nextSession->defaultTabObj) {
10691  
10692 $nextSession->defaultTabObj->paneObj->setVisibleTab(
10693 $nextSession->defaultTabObj,
10694 );
10695 }
10696  
10697 # If all sessions have their own 'main' window, make sure the new current
10698 # session's 'main' window is visible
10699 if (! $self->shareMainWinFlag) {
10700  
10701 $nextSession->mainWin->restoreFocus();
10702 }
10703 }
10704 }
10705 }
10706  
10707 return 1;
10708 }
10709 }
10710  
10711 sub stopAllSessions {
10712  
10713 # Called by $self->stop
10714 # Stops every GA::Session
10715 #
10716 # Expected arguments
10717 # (none besides $self)
10718 #
10719 # Return values
10720 # 'undef' on improper arguments, if no sessions exist or if a session can't be closed (no
10721 # error msgs)
10722 # 1 otherwise
10723  
10724 my ($self, $check) = @_;
10725  
10726 # Check for improper arguments
10727 if (defined $check) {
10728  
10729 return $axmud::CLIENT->writeImproper($self->_objClass . '->stopAllSessions', @_);
10730 }
10731  
10732 if (! $self->sessionHash) {
10733  
10734 # There are no sessions to stop
10735 return undef;
10736 }
10737  
10738 # Close every session
10739 foreach my $session ($self->listSessions()) {
10740  
10741 # Terminate the session
10742 if (! $session->stop()) {
10743  
10744 # Failed to terminate the session
10745 return undef;
10746 }
10747 }
10748  
10749 # The call we're about to make to ->setCurrentSession requires an empty ->sessionHash
10750 $self->ivEmpty('sessionHash');
10751  
10752 # All sessions terminated
10753 $self->setCurrentSession();
10754  
10755 return 1;
10756 }
10757  
10758 sub setCurrentSession {
10759  
10760 # Called by GA::Win::Internal->setVisibleSession whenever a 'main' window that has focus
10761 # changes its visible session. Also called by $self->stopSession and ->stopAllSessions
10762 # Updates IVs and fires some hooks
10763 #
10764 # Expected arguments
10765 # (none besides $self)
10766 #
10767 # Optional arguments
10768 # $session - The GA::Session that is the new current session. Unless the registry
10769 # $self->sessionHash is empty, there must be a current session at all
10770 # times. If not specified, there is no current session
10771 #
10772 # Return values
10773 # 'undef' on improper arguments or if no new current session is specified when the
10774 # registry is not empty
10775 # 1 otherwise
10776  
10777 my ($self, $session, $check) = @_;
10778  
10779 # Check for improper arguments
10780 if (defined $check) {
10781  
10782 return $axmud::CLIENT->writeImproper($self->_objClass . '->setCurrentSession', @_);
10783 }
10784  
10785 # No current session
10786 if (! defined $session) {
10787  
10788 if ($self->sessionHash) {
10789  
10790 # The registry is not empty, but should be
10791 return $self->writeError(
10792 'Could not set a null session - registry not empty',
10793 $self->_objClass . '->setCurrentSession',
10794 );
10795  
10796 } else {
10797  
10798 $self->ivUndef('currentSession');
10799 $self->ivEmpty('sessionHash');
10800 }
10801  
10802 # New current session
10803 } else {
10804  
10805 if (
10806 $self->currentSession
10807 && $self->currentSession ne $session
10808 && $self->shareMainWinFlag
10809 ) {
10810 # Fire any hooks that are using the 'not_current' hook event
10811 $self->currentSession->checkHooks('not_current', $session->number);
10812 }
10813  
10814 $self->ivPoke('currentSession', $session);
10815 $self->ivPoke('mainWin', $session->mainWin);
10816  
10817 # Fire any hooks that are using the 'current_session' hook event
10818 $session->checkHooks('current_session', undef);
10819 # Fire any hooks that are using the 'change_current' hook event
10820 foreach my $otherSession ($self->listSessions()) {
10821  
10822 if ($otherSession ne $session) {
10823  
10824 $otherSession->checkHooks('change_current', $session->number);
10825 }
10826 }
10827 }
10828  
10829 return 1;
10830 }
10831  
10832 sub getNextSession {
10833  
10834 # Called by $self->stopSession or any other code
10835 # Given a session, find the session which was created after that one. If the specified
10836 # session was the most recently-created one, return either the first or last remaining
10837 # session
10838 #
10839 # Expected arguments
10840 # $session - A GA::Session
10841 #
10842 # Optional arguments
10843 # $lastFlag - If there are no sessions that were created after the specified
10844 # $session, then this function returns the most recently-created other
10845 # session (if $lastFlag is TRUE), or the earliest-created other session
10846 # if ($lastFlag is FALSE or 'undef')
10847 #
10848 # Return values
10849 # 'undef' on improper arguments or if $self->sessionHash is empty
10850 # Otherwise, returns the session described above
10851  
10852 my ($self, $session, $lastFlag, $check) = @_;
10853  
10854 # Local variables
10855 my ($first, $last, $match);
10856  
10857 # Check for improper arguments
10858 if (! defined $session || defined $check) {
10859  
10860 return $axmud::CLIENT->writeImproper($self->_objClass . '->getNextSession', @_);
10861 }
10862  
10863 OUTER: foreach my $otherSession ($self->listSessions()) {
10864  
10865 if ($otherSession ne $session) {
10866  
10867 $last = $otherSession;
10868 if (! defined $first) {
10869  
10870 $first = $otherSession;
10871 }
10872  
10873 if ($otherSession->number > $session->number) {
10874  
10875 $match = $otherSession;
10876 last OUTER;
10877 }
10878 }
10879 }
10880  
10881 if (! $match) {
10882  
10883 if ($lastFlag) {
10884 return $last;
10885 } else {
10886 return $first;
10887 }
10888  
10889 } else {
10890  
10891 return $match;
10892 }
10893 }
10894  
10895 sub listSessions {
10896  
10897 # Convenience function. Returns a list of existing GA::Session objects in the order in
10898 # which they were created
10899 #
10900 # Expected arguments
10901 # (none besides $self)
10902 #
10903 # Optional arguments
10904 # $ignoreSession - If specified, ignore this session
10905 #
10906 # Return values
10907 # An empty list on improper arguments
10908 # Otherwise returns the ordered list of sessions (may be an empty list)
10909  
10910 my ($self, $ignoreSession, $check) = @_;
10911  
10912 # Local variables
10913 my (@sessionList, @returnList, @emptyList);
10914  
10915 # Check for improper arguments
10916 if (defined $check) {
10917  
10918 $axmud::CLIENT->writeImproper($self->_objClass . '->listSessions', @_);
10919 return @emptyList;
10920 }
10921  
10922 if (! $ignoreSession) {
10923  
10924 return (sort {$a->number <=> $b->number} ($self->ivValues('sessionHash')));
10925  
10926 } else {
10927  
10928 @sessionList = sort {$a->number <=> $b->number} ($self->ivValues('sessionHash'));
10929 foreach my $session (@sessionList) {
10930  
10931 if ($session ne $ignoreSession) {
10932  
10933 push (@returnList, $session);
10934 }
10935 }
10936  
10937 return @returnList;
10938 }
10939 }
10940  
10941 sub testSessions {
10942  
10943 # Called by $self->startSession or GA::Generic::Cmd->setProfile
10944 # Given specified world and character profiles, tests other sessions to see if any of them
10945 # are using the same current world and character and returns the number of matching
10946 # sessions
10947 #
10948 # Expected arguments
10949 # $world - Name of a world profile
10950 # $char - Name of a character profile associated with that world
10951 #
10952 # Optional arguments
10953 # $ignoreFlag - Flag set to TRUE when called by $self->startSession; ignores sessions
10954 # whose ->status is 'disconnected'. Otherwise set to FALSE (or
10955 # 'undef'), and all matching session are returned
10956 #
10957 # Return values
10958 # 'undef' on improper arguments
10959 # Otherwise returns the number of matching sessions (may be 0)
10960  
10961 my ($self, $world, $char, $ignoreFlag, $check) = @_;
10962  
10963 # Local variables
10964 my $count;
10965  
10966 # Check for improper arguments
10967 if (! defined $world || ! defined $char || defined $check) {
10968  
10969 return $axmud::CLIENT->writeImproper($self->_objClass . '->testSessions', @_);
10970 }
10971  
10972 $count = 0;
10973 foreach my $session ($self->listSessions()) {
10974  
10975 if (
10976 $session->currentWorld->name eq $world
10977 && $session->currentChar && $session->currentChar->name eq $char
10978 && (
10979 ! $ignoreFlag
10980 || ($ignoreFlag && $session->status ne 'disconnected')
10981 )
10982 ) {
10983 $count++;
10984 }
10985 }
10986  
10987 return $count;
10988 }
10989  
10990 sub findSessions {
10991  
10992 # Called by GA::Session->setupProfiles
10993 # Compiles a list of sessions whose current world matches a specified world, and returns
10994 # the list (in the order in which the sessions were created)
10995 #
10996 # Expected arguments
10997 # $worldName - The name of a world profile
10998 #
10999 # Optional arguments
11000 # $ignoreSession - If specified, ignore this session
11001 #
11002 # Return values
11003 # An empty list on improper arguments or if no session is using $name as its current world
11004 # Otherwise, returns the list of matching sessions
11005  
11006 my ($self, $worldName, $ignoreSession, $check) = @_;
11007  
11008 # Local variables
11009 my (@emptyList, @returnArray);
11010  
11011 # Check for improper arguments
11012 if (defined $check) {
11013  
11014 $axmud::CLIENT->writeImproper($self->_objClass . '->findSessions', @_);
11015 return @emptyList;
11016 }
11017  
11018 foreach my $session ($self->listSessions()) {
11019  
11020 if (
11021 (! $ignoreSession || $ignoreSession ne $session)
11022 && $session->currentWorld
11023 && $session->currentWorld->name eq $worldName
11024 ) {
11025 # This is a matching GA::Session
11026 push (@returnArray, $session);
11027 }
11028 }
11029  
11030 # Return the list of matching sessions (may be empty)
11031 return @returnArray;
11032 }
11033  
11034 sub checkSessions {
11035  
11036 # Called by GA::Strip::MenuBar->drawWorldColumn just before doing the ';stopsession' or
11037 # ';stopclient' commands
11038 # Checks every session to see whether any of them are connected, and whether there are any
11039 # unsaved files at all (if not, the 'main' window doesn't have to prompt the user for
11040 # confirmation, before stopping the session/client).
11041 #
11042 # Expected arguments
11043 # (none besides $self)
11044 #
11045 # Optional arguments
11046 # $session - If specified, ignore other GA::Session objects (but still check the
11047 # client's file objects)
11048 #
11049 # Return values
11050 # 'undef' on improper arguments or if there are any connected sessions or unsaved files
11051 # 1 if there are absolutely no connected sessions or unsaved files
11052  
11053 my ($self, $session, $check) = @_;
11054  
11055 # Check for improper arguments
11056 if (defined $check) {
11057  
11058 return $axmud::CLIENT->writeImproper($self->_objClass . '->checkSessions', @_);
11059 }
11060  
11061 # Check GA::Client file objects
11062 foreach my $fileObj ($self->ivValues('fileObjHash')) {
11063  
11064 if ($fileObj->modifyFlag) {
11065  
11066 return undef;
11067 }
11068 }
11069  
11070 # Check each session in turn
11071 foreach my $otherSession ($self->listSessions()) {
11072  
11073 if ($session && $session ne $otherSession) {
11074  
11075 # Ignore this session
11076 next OUTER;
11077 }
11078  
11079 # Check the session's connection status
11080 if ($otherSession->status ne 'disconnected' && $otherSession->status ne 'offline') {
11081  
11082 return undef;
11083 }
11084  
11085 # Check GA::Session file objects
11086 foreach my $fileObj ($otherSession->ivValues('sessionFileObjHash')) {
11087  
11088 if ($fileObj->modifyFlag) {
11089  
11090 return undef;
11091 }
11092 }
11093 }
11094  
11095 # There are no connected sessions or unsaved files
11096 return 1;
11097 }
11098  
11099 sub broadcastInstruct {
11100  
11101 # Can be called by anything (with great caution!)
11102 # Executes an instruction in every session (optionally, with the exception of a specified
11103 # session)
11104 #
11105 # Expected arguments
11106 # $instruct - The instruction to execute, e.g. 'north', ';about'
11107 #
11108 # Optional arguments
11109 # $excludeSession - The GA::Session to which the instruction should NOT be executed.
11110 # If 'undef', the instruction is executed in every session
11111 #
11112 # Return values
11113 # 'undef' on improper arguments
11114 # 1 otherwise
11115  
11116 my ($self, $instruct, $excludeSession, $check) = @_;
11117  
11118 # Check for improper arguments
11119 if (! defined $instruct || defined $check) {
11120  
11121 return $axmud::CLIENT->writeImproper($self->_objClass . '->broadcastInstruct', @_);
11122 }
11123  
11124 foreach my $session ($self->listSessions()) {
11125  
11126 if (! $excludeSession || ($excludeSession ne $session)) {
11127  
11128 $session->doInstruct($instruct);
11129 }
11130 }
11131  
11132 return 1;
11133 }
11134  
11135 # Buffers
11136  
11137 sub updateInstructBuffer {
11138  
11139 # Called by GA::Session->updateInstructBuffer when an instruction is added to the session's
11140 # buffer registry
11141 # Updates this client's own instruction buffer, creating a separate buffer object (with a
11142 # different ->number than the one created by the calling function)
11143 #
11144 # Expected arguments
11145 # $session - The calling GA::Session
11146 # $instruct - The instruction itself (e.g. ';setworld deathmud' or 'north;kill orc')
11147 # $type - The type of instruction: 'client' for a client command, 'world' for a
11148 # world command, 'perl' for a Perl command and 'echo' for an echo command
11149 #
11150 # Return values
11151 # 'undef' on improper arguments or if the buffer is not updated
11152 # Otherwise returns the buffer object created
11153  
11154 my ($self, $session, $instruct, $type, $check) = @_;
11155  
11156 # Local variables
11157 my $obj;
11158  
11159 # Check for improper arguments
11160 if (! defined $session || ! defined $instruct || ! defined $type || defined $check) {
11161  
11162 return $axmud::CLIENT->writeImproper($self->_objClass . '->updateInstructBuffer', @_);
11163 }
11164  
11165 if (! defined $self->instructBufferFirst) {
11166  
11167 # This the first instruction ever processed
11168 $self->ivPoke('instructBufferFirst', 0);
11169 }
11170  
11171 # Create a new buffer object for this instruction
11172 $obj = Games::Axmud::Buffer::Instruct->new(
11173 $session,
11174 'client',
11175 $self->instructBufferCount,
11176 $instruct,
11177 $type,
11178 $self->clientTime,
11179 );
11180  
11181 if (! $obj) {
11182  
11183 return undef;
11184  
11185 } else {
11186  
11187 # Update the instruction buffer
11188 $self->ivAdd('instructBufferHash', $obj->number, $obj);
11189 $self->ivIncrement('instructBufferCount');
11190 $self->ivPoke('instructBufferLast', ($self->instructBufferCount - 1));
11191  
11192 # If the buffer is full, remove the oldest line
11193 if ($self->instructBufferCount > $self->customInstructBufferSize) {
11194  
11195 $self->ivDelete('instructBufferHash', $self->instructBufferFirst);
11196 $self->ivIncrement('instructBufferFirst');
11197 }
11198  
11199 return $obj;
11200 }
11201 }
11202  
11203 sub updateCmdBuffer {
11204  
11205 # Called by GA::Session->updateCmdBuffer when a world command is added to the session's
11206 # buffer registry
11207 # Updates this client's own world command buffer, creating a separate buffer object (with a
11208 # different ->number than the one created by the calling function)
11209 #
11210 # Expected arguments
11211 # $session - The calling GA::Session
11212 # $cmd - The world command itself (e.g. 'north', 'kill orc')
11213 #
11214 # Return values
11215 # 'undef' on improper arguments or if the buffer can't be updated
11216 # Otherwise returns the buffer object created
11217  
11218 my ($self, $session, $cmd, $check) = @_;
11219  
11220 # Local variables
11221 my $obj;
11222  
11223 # Check for improper arguments
11224 if (! defined $session || ! defined $cmd || defined $check) {
11225  
11226 return $axmud::CLIENT->writeImproper($self->_objClass . '->updateCmdBuffer', @_);
11227 }
11228  
11229 if (! defined $self->cmdBufferFirst) {
11230  
11231 # This the first world command ever processed
11232 $self->ivPoke('cmdBufferFirst', 0);
11233 }
11234  
11235 # Create a new buffer object for this world command
11236 $obj = Games::Axmud::Buffer::Cmd->new(
11237 $session,
11238 'client',
11239 $self->cmdBufferCount,
11240 $cmd,
11241 $self->clientTime,
11242 );
11243  
11244 if (! $obj) {
11245  
11246 return undef;
11247  
11248 } else {
11249  
11250 # Update the world command buffer
11251 $self->ivAdd('cmdBufferHash', $obj->number, $obj);
11252 $self->ivIncrement('cmdBufferCount');
11253 $self->ivPoke('cmdBufferLast', ($self->cmdBufferCount - 1));
11254  
11255 # If the buffer is full, remove the oldest line
11256 if ($self->cmdBufferCount > $self->customCmdBufferSize) {
11257  
11258 $self->ivDelete('cmdBufferHash', $self->cmdBufferFirst);
11259 $self->ivIncrement('cmdBufferFirst');
11260 }
11261  
11262 return $obj;
11263 }
11264 }
11265  
11266 # Plugins
11267  
11268 sub loadPlugin {
11269  
11270 # Called by GA::Session->start, $self->loadPrivatePlugins, GA::Cmd::LoadPlugin->do and
11271 # ->TestPlugin->do
11272 # Attemps to load a Perl module as a plugin. Checks the file exists, that it is a Perl file,
11273 # that it has the right Axmud plugin header and that there are no compile errors, then
11274 # loads the plugin
11275 #
11276 # Axmud plugin headers have a fixed format. If the header is not in this format, the plugin
11277 # is not loaded
11278 # There can be any number of empty lines, or lines containing only comments, after the first
11279 # line. Lines after the package line can appear in any order; duplicate lines replace the
11280 # earlier one (so '#: Author: JRR Tolkien' replaces and earlier '#: Author: JK Rowling')
11281 # The format is case sensitive, except for the lines mentioned just below (so
11282 # '#: author: jk rowling' will not be recognised)
11283 #
11284 # The header is in the format:
11285 # #!/usr/bin/perl
11286 # package NAME;
11287 # #: Version: VERSION
11288 # #: Description: ONE LINE DESCRIPTION
11289 # #: Author: AUTHOR'S NAME (optional)
11290 # #: Copyright: COPYRIGHT MESSAGE (optional)
11291 # #: Require: AXMUD VERSION (optional)
11292 # #: Init: STRING (optional)
11293 #
11294 # NB NAME can't be the name of an existing plugin, or the client name (matching
11295 # $axmud::SCRIPT, case-insensitive)
11296 # NB AXMUD VERSION can be in the form 'v1.0.0' / 'V1.0.0' / '1.0.0'. If it's not a valid
11297 # version number, the plugin is not loaded
11298 # NB STRING is case-insensitive, and should be one of the strings 'enable', 'disable',
11299 # 'enabled' or 'disabled'. If it's not one of those strings, the default behaviour
11300 # (equivalent to 'enable') is used
11301 #
11302 # Expected arguments
11303 # $path - The full file path to the Perl module
11304 #
11305 # Optional arguments
11306 # $testFlag - If set to TRUE, the plugin isn't loaded, just tested. Set to FALSE (or
11307 # 'undef') otherwise
11308 #
11309 # Return values
11310 # 'undef' on improper arguments, if the plugin can't be loaded or if it has already been
11311 # loaded
11312 # Otherwise returns the name of the plugin loaded
11313  
11314 my ($self, $path, $testFlag, $check) = @_;
11315  
11316 # Local variables
11317 my (
11318 $string, $fileHandle, $line, $packageName, $exitFlag, $version, $descrip, $author,
11319 $copyright, $require, $init, $enabledFlag, $result, $obj, $null,
11320 );
11321  
11322 # Check for improper arguments
11323 if (! defined $path || defined $check) {
11324  
11325 return $axmud::CLIENT->writeImproper($self->_objClass . '->loadPlugin', @_);
11326 }
11327  
11328 if (! $testFlag) {
11329 $string = 'load failure';
11330 } else {
11331 $string = 'test failure';
11332 }
11333  
11334 # Check the file exists
11335 if (! -e $path) {
11336  
11337 if ($self->debugExplainPluginFlag) {
11338  
11339 $self->writeDebug('Plugin \'' . $path . '\' ' . $string . ': file doesn\'t exist');
11340 }
11341  
11342 return undef;
11343 }
11344  
11345 # Check the file is a Perl file by reading the first line, which should contain a Perl
11346 # shebang
11347 if (! open ($fileHandle, "<", $path)) {
11348  
11349 if ($self->debugExplainPluginFlag) {
11350  
11351 $self->writeDebug(
11352 'Plugin \'' . $path . '\' ' . $string . ': could not open file',
11353 );
11354 }
11355  
11356 return undef;
11357 }
11358  
11359 # Check the first line contains a Perl shebang
11360 $line = <$fileHandle>;
11361 if (! $line =~ /^#!\s*(.*perl\S*)/) {
11362  
11363 if ($self->debugExplainPluginFlag) {
11364  
11365 $self->writeDebug(
11366 'Plugin \'' . $path . '\' ' . $string . ': line is not Perl shebang',
11367 );
11368 }
11369  
11370 close $fileHandle;
11371  
11372 return undef;
11373 }
11374  
11375 # Read the next non-empty line to get the package name
11376 $line = $self->readPluginLine($fileHandle);
11377 if (! $line || ! ($line =~ m/^package\s+(.+)\;/)) {
11378  
11379 if ($self->debugExplainPluginFlag) {
11380  
11381 $self->writeDebug(
11382 'Plugin \'' . $path . '\' ' . $string . ': missing package name in plugin'
11383 . ' header',
11384 );
11385 }
11386  
11387 close $fileHandle;
11388  
11389 return undef;
11390  
11391 } else {
11392  
11393 $packageName = $1;
11394 }
11395  
11396 # The remaining header lines can occur in any order
11397 do {
11398  
11399 # Read the next non-empty line to get the version
11400 $line = $self->readPluginLine($fileHandle);
11401  
11402 if (! $line) {
11403  
11404 # Header has finished
11405 $exitFlag = TRUE;
11406  
11407 } else {
11408  
11409 if ($line =~ m/^\#\:\s+Version\:\s+/) {
11410  
11411 $line =~ s/^\#\:\s+Version\:\s+//;
11412 $version = $self->trimWhitespace($line);
11413  
11414 } elsif ($line =~ m/^\#\:\s+Description\:\s+/) {
11415  
11416 $line =~ s/^\#\:\s+Description\:\s+//;
11417 $descrip = $self->trimWhitespace($line);
11418  
11419 } elsif ($line =~ m/^\#\:\s+Author\:\s+/) {
11420  
11421 $line =~ s/^\#\:\s+Author\:\s+//;
11422 $author = $self->trimWhitespace($line);
11423  
11424 } elsif ($line =~ m/^\#\:\s+Copyright\:\s+/) {
11425  
11426 $line =~ s/^\#\:\s+Copyright\:\s+//;
11427 $copyright = $self->trimWhitespace($line);
11428  
11429 } elsif ($line =~ m/^\#\:\s+Require\:\s+[vV]?/) {
11430  
11431 $line =~ s/^\#\:\s+Require\:\s+[vV]?//;
11432 $require = $self->trimWhitespace($line);
11433  
11434 } elsif ($line =~ m/^\#\:\s+Init\:\s+/) {
11435  
11436 $line =~ s/^\#\:\s+Init\:\s+//;
11437 $init = lc($self->trimWhitespace($line));
11438  
11439 } else {
11440  
11441 # Header has finished
11442 $exitFlag = TRUE;
11443 }
11444 }
11445  
11446 } until ($exitFlag);
11447  
11448 # (Don't need to read the file any further)
11449 close $fileHandle;
11450  
11451 # Check that the package name is allowed
11452 if (lc($packageName) eq $axmud::NAME_SHORT) {
11453  
11454 if ($self->debugExplainPluginFlag) {
11455  
11456 $self->writeDebug(
11457 'Plugin \'' . $path . '\' ' . $string . ': package name \'' . $packageName
11458 . '\' is not allowed',
11459 );
11460 }
11461  
11462 return undef;
11463 }
11464  
11465 # Check that the compulsory version and description were specified
11466 if (! defined $version) {
11467  
11468 if ($self->debugExplainPluginFlag) {
11469  
11470 $self->writeDebug(
11471 'Plugin \'' . $path . '\' ' . $string . ': missing version in plugin header',
11472 );
11473 }
11474  
11475 return undef;
11476  
11477 } elsif (! defined $descrip) {
11478  
11479 if ($self->debugExplainPluginFlag) {
11480  
11481 $self->writeDebug(
11482 'Plugin \'' . $path . '\' ' . $string . ': missing description in plugin'
11483 . ' header',
11484 );
11485 }
11486  
11487 return undef;
11488 }
11489  
11490 # Check that the minimum Axmud version, if specified, is high enough
11491 if (
11492 defined $require
11493 && $self->convertVersion($require) > $self->convertVersion($axmud::VERSION)
11494 ) {
11495 if ($self->debugExplainPluginFlag) {
11496  
11497 $self->writeDebug(
11498 'Plugin \'' . $path . '\' ' . $string . ': minimum version \'' . $require
11499 . '\' is higher than current ' . $axmud::SCRIPT . ' version \''
11500 . $axmud::VERSION . '\'',
11501 );
11502 }
11503  
11504 return undef;
11505 }
11506  
11507 # Check that the init status, if specified, is a recognised string (and ignore it, if not)
11508 if (
11509 defined $init && $init ne 'enable' && $init ne 'disable' && $init ne 'enabled'
11510 && $init ne 'disabled'
11511 ) {
11512 $init = undef;
11513 }
11514  
11515 # Set whether the plugin starts enabled (default) or disabled
11516 if (! defined $init || $init eq 'enable' || $init eq 'enabled') {
11517 $enabledFlag = TRUE;
11518 } else {
11519 $enabledFlag = FALSE;
11520 }
11521  
11522 # Check that the plugin hasn't already been loaded (but don't bother if we're just testing
11523 # the file)
11524 if (! $testFlag && $self->ivExists('pluginHash', $packageName)) {
11525  
11526 # Plugin called $packageName already loaded
11527 if ($self->debugExplainPluginFlag) {
11528  
11529 $self->writeDebug(
11530 'Plugin \'' . $path . '\' ' . $string . ': plugin called \'' . $packageName
11531 . '\' has already been loaded',
11532 );
11533 }
11534  
11535 return undef;
11536 }
11537  
11538 # Check the file's syntax. System returns 0 on success, something else on failure
11539 if ($^O eq 'MSWin32') {
11540 $null = 'nul';
11541 } else {
11542 $null = '/dev/null';
11543 }
11544  
11545 $result = system("perl -c $path 2>$null >$null");
11546 if ($result ne '0') {
11547  
11548 if ($self->debugExplainPluginFlag) {
11549  
11550 $self->writeDebug(
11551 'Plugin \'' . $path . '\' ' . $string . ': Perl syntax check failed',
11552 );
11553 }
11554  
11555 return undef;
11556 }
11557  
11558 # If $testFlag is set, we don't need to actually load the plugin
11559 if ($testFlag) {
11560  
11561 # Operation complete
11562 return $packageName;
11563 }
11564  
11565 # Create a plugin object to handle the file
11566 $obj = Games::Axmud::Obj::Plugin->new(
11567 $packageName,
11568 $path,
11569 $version,
11570 $descrip,
11571 $enabledFlag,
11572 $author, # May be 'undef'
11573 $copyright, # May be 'undef'
11574 $require, # May be 'undef'
11575 $init, # May be 'undef'
11576 );
11577  
11578 if (! $obj) {
11579  
11580 # (Couldn't create object, error message already displayed)
11581 if ($self->debugExplainPluginFlag) {
11582  
11583 $self->writeDebug(
11584 'Plugin \'' . $path . '\' ' . $string . ': couldn\'t create plugin object',
11585 );
11586 }
11587  
11588 return undef;
11589 }
11590  
11591 # Update IVs
11592 $self->ivAdd('pluginHash', $packageName, $obj);
11593  
11594 # Attempt to load the plugin
11595 eval { Module::Load::load($path); };
11596 if ($@) {
11597  
11598 if ($self->debugExplainPluginFlag) {
11599  
11600 $self->writeDebug(
11601 'Plugin \'' . $path . '\' ' . $string . ': could not load plugin',
11602 );
11603 }
11604  
11605 $self->ivDelete('pluginHash', $packageName);
11606  
11607 return undef;
11608 }
11609  
11610 # Plugin loaded. If it should start disabled, disable it now
11611 if (! $enabledFlag) {
11612  
11613 $self->disablePlugin($packageName);
11614 }
11615  
11616 return $packageName;
11617 }
11618  
11619 sub loadPrivatePlugins {
11620  
11621 # Called by $self->start
11622 # Loads private plugins stored in the /private directory (which doesn't exist in public
11623 # releases of Axmud)
11624 #
11625 # Expected arguments
11626 # (none besides $self)
11627 #
11628 # Return values
11629 # 'undef' on improper arguments
11630 # 1 otherwise
11631  
11632 my ($self, $check) = @_;
11633  
11634 # Local variables
11635 my (@pathList, @modList);
11636  
11637 # Check for improper arguments
11638 if (defined $check) {
11639  
11640 return $axmud::CLIENT->writeImproper($self->_objClass . '->loadPrivatePlugins', @_);
11641 }
11642  
11643 if ($^O eq 'MSWin32') {
11644 @pathList = glob($axmud::SHARE_DIR . '\\private\\*.pm');
11645 } else {
11646 @pathList = glob($axmud::SHARE_DIR . '/private/*.pm');
11647 }
11648  
11649 foreach my $path (@pathList) {
11650  
11651 # Private plugins begin with an alpha-numeric character and end .pm; all other .pm files
11652 # in the directory must begin with an underline character
11653 # Remove all non-plugin files from the list
11654 if ($path =~ m/private[\\\/][[:alnum:]][[:word:]\s]*\.pm$/) {
11655  
11656 push (@modList, $path);
11657 }
11658 }
11659  
11660 # Load each plugin
11661 foreach my $path (@modList) {
11662  
11663 my $plugin = $self->loadPlugin($path);
11664 if (! $plugin) {
11665  
11666 $self->writeWarning(
11667 'Error loading the private plugin \'' . $path . '\'',
11668 $self->_objClass . '->loadPrivatePlugins',
11669 );
11670 }
11671 }
11672  
11673 return 1;
11674 }
11675  
11676 sub readPluginLine {
11677  
11678 # Called by $self->loadPlugin
11679 # Reads lines from an already opened plugin file, looking for the first line which isn't
11680 # empty (or contains only a comment that's not part of the header)
11681 # Returns the first matching line found
11682 #
11683 # Expected arguments
11684 # $fileHandle - The plugin file's filehandle
11685 #
11686 # Return values
11687 # 'undef' on improper arguments or if end-of-file is reached before the line is found
11688 # The first matching line found otherwise
11689  
11690 my ($self, $fileHandle, $check) = @_;
11691  
11692 # Check for improper arguments
11693 if (! defined $fileHandle || defined $check) {
11694  
11695 return $axmud::CLIENT->writeImproper($self->_objClass . '->readPluginLine', @_);
11696 }
11697  
11698 while (<$fileHandle>) {
11699  
11700 my $line = $_;
11701  
11702 chomp $line;
11703  
11704 if (
11705 $line
11706 && ! (
11707 $line =~ m/^\s+$/
11708 || $line =~ m/\s*\#[^\:]/
11709 )
11710 ) {
11711 # This is the line we're looking for
11712 return $line;
11713 }
11714 }
11715  
11716 # No matching line found
11717 return undef;
11718 }
11719  
11720 sub enablePlugin {
11721  
11722 # Called by GA::Cmd::EnablePlugin->do
11723 # Enables a loaded plugin, after an earlier call to $self->disablePlugin disabled it
11724 #
11725 # Expected arguments
11726 # $plugin - The name of the plugin to enable
11727 #
11728 # Return values
11729 # 'undef' on improper arguments or if a plugin called $plugin has not been loaded
11730 # 1 otherwise
11731  
11732 my ($self, $plugin, $check) = @_;
11733  
11734 # Local variables
11735 my ($pluginObj, $listRef);
11736  
11737 # Check for improper arguments
11738 if (! defined $plugin || defined $check) {
11739  
11740 return $axmud::CLIENT->writeImproper($self->_objClass . '->enablePlugin', @_);
11741 }
11742  
11743 # Find the plugin object
11744 $pluginObj = $self->ivShow('pluginHash', $plugin);
11745 if (! $pluginObj) {
11746  
11747 # Plugin not found
11748 return undef;
11749 }
11750  
11751 # Enable the plugin
11752 $pluginObj->set_enabledFlag(TRUE);
11753  
11754 # If any of this plugin's tasks defined text-to-speech attributes (TTS), update the
11755 # our customisable attribute hashes, re-assigning existing attributes to these tasks, if
11756 # necessary
11757 foreach my $taskName ($self->ivKeys('pluginTaskHash')) {
11758  
11759 if ($plugin eq $self->ivShow('pluginTaskHash', $taskName)) {
11760  
11761 $self->ttsAssignAttribs($taskName);
11762 }
11763 }
11764  
11765 # Restore the plugin's client commands. If there are any (built-in) client commands of the
11766 # same name, move them somewhere else, in case this plugin is disabled again at some point
11767 # in the future
11768 foreach my $pluginCmd ($self->ivKeys('pluginCmdHash')) {
11769  
11770 my ($otherPlugin, $pluginCmdObj, $originalCmdObj);
11771  
11772 $otherPlugin = $self->ivShow('pluginCmdHash', $pluginCmd);
11773 if ($otherPlugin eq $plugin) {
11774  
11775 if ($self->ivExists('clientCmdHash', $pluginCmd)) {
11776  
11777 # Restore the plugin command, and move the original to a special IV, so that it
11778 # too can be restored if the plugin is re-disabled at some point
11779 $pluginCmdObj = $self->ivShow('replaceClientCmdHash', $pluginCmd);
11780 $originalCmdObj = $self->ivShow('clientCmdHash', $pluginCmd);
11781 $self->ivAdd('replaceClientCmdHash', $pluginCmd, $originalCmdObj);
11782 $self->ivAdd('clientCmdHash', $pluginCmd, $pluginCmdObj);
11783  
11784 } else {
11785  
11786 # Just restore the plugin command
11787 $pluginCmdObj = $self->ivShow('replaceClientCmdHash', $pluginCmd);
11788 $self->ivAdd('clientCmdHash', $pluginCmd, $pluginCmdObj);
11789 $self->ivDelete('replaceClientCmdHash', $pluginCmd);
11790 }
11791 }
11792 }
11793  
11794 # Also restore the plugin's client commands (along with any group headings) to
11795 # $self->clientCmdPrettyList
11796 if ($self->ivExists('clientCmdReplacePrettyHash', $plugin)) {
11797  
11798 $listRef = $self->ivShow('clientCmdReplacePrettyHash', $plugin);
11799 if (defined $listRef && @$listRef) {
11800  
11801 $self->ivPush('clientCmdPrettyList', @$listRef);
11802 }
11803 }
11804  
11805 # Sensitise/desensitise menu bar/toolbar items, depending on current conditions
11806 $self->desktopObj->restrictWidgets();
11807  
11808 # Operation complete
11809 return 1;
11810 }
11811  
11812 sub disablePlugin {
11813  
11814 # Called by GA::Cmd::DisablePlugin->do
11815 # Disables a loaded plugin. Halts all of the plugin's tasks (new tasks from the plugin
11816 # can't start). Closes any windows of the types added by the plugin. Disables any client
11817 # commands added by the plugin
11818 #
11819 # Expected arguments
11820 # $plugin - The name of the plugin to disable
11821 #
11822 # Return values
11823 # 'undef' on improper arguments or if a plugin called $plugin has not been loaded
11824 # 1 otherwise
11825  
11826 my ($self, $plugin, $check) = @_;
11827  
11828 # Local variables
11829 my ($pluginObj, $listRef, $index, $matchFlag);
11830  
11831 # Check for improper arguments
11832 if (! defined $plugin || defined $check) {
11833  
11834 return $axmud::CLIENT->writeImproper($self->_objClass . '->disablePlugin', @_);
11835 }
11836  
11837 # Find the plugin object
11838 $pluginObj = $self->ivShow('pluginHash', $plugin);
11839 if (! $pluginObj) {
11840  
11841 # Plugin not found
11842 return undef;
11843 }
11844  
11845 # Disable the plugin
11846 $pluginObj->set_enabledFlag(FALSE);
11847  
11848 # If any of this plugin's tasks are running, in any session, halt them
11849 foreach my $session ($self->listSessions()) {
11850  
11851 foreach my $taskObj ($session->ivValues('currentTaskHash')) {
11852  
11853 my $thisPlugin = $self->ivShow('pluginTaskHash', $taskObj->name);
11854  
11855 if (defined $thisPlugin && $thisPlugin eq $plugin) {
11856  
11857 # Halt the task
11858 $session->pseudoCmd('halttask ' . $taskObj->uniqueName);
11859 }
11860 }
11861 }
11862  
11863 # If any of our customisable text-to-speech (TTS) hashes have assigned an attribute to
11864 # this plugin's tasks, re-assign the attributes to a built-in task, if possible, or
11865 # otherwise remove the attributes completely
11866 foreach my $taskName ($self->ivKeys('pluginTaskHash')) {
11867  
11868 if ($plugin eq $self->ivShow('pluginTaskHash', $taskName)) {
11869  
11870 $self->ttsResetAttribs($taskName);
11871 }
11872 }
11873  
11874 # Close any 'free' windows added by the plugin
11875 foreach my $winObj
11876 (sort {$a->number <=> $b->number} ($self->desktopObj->ivValues('freeWinHash')))
11877 {
11878 my $thisPlugin = $self->ivShow('pluginFreeWinHash', $winObj->_objClass);
11879 if (defined $thisPlugin && $thisPlugin eq $plugin) {
11880  
11881 # Close the window
11882 $winObj->winDestroy();
11883 }
11884 }
11885  
11886 # Close any 'grid' windows added by the plugin
11887 foreach my $winObj
11888 (sort {$a->number <=> $b->number} ($self->desktopObj->ivValues('freeWinHash')))
11889 {
11890 my $thisPlugin = $self->ivShow('pluginGridWinHash', $winObj->_objClass);
11891 if (defined $thisPlugin && $thisPlugin eq $plugin) {
11892  
11893 # For 'main' windows, terminate any session using the window
11894 if ($winObj->winType eq 'main') {
11895  
11896 foreach my $session
11897 (sort {$a->number <=> $b->number} ($self->ivValues('sessionHash')))
11898 {
11899 if ($session->mainWin && $session->mainWin eq $winObj) {
11900  
11901 $self->stopSession($session);
11902 }
11903 }
11904 }
11905  
11906 # Close the window
11907 $winObj->winDestroy();
11908 }
11909 }
11910  
11911 # If the plugin loaded any client commands that replaced an existing client command of the
11912 # same name, restore the original. Otherwise, remove the command completely
11913 foreach my $pluginCmd ($self->ivKeys('pluginCmdHash')) {
11914  
11915 my ($otherPlugin, $pluginCmdObj, $originalCmdObj);
11916  
11917 $otherPlugin = $self->ivShow('pluginCmdHash', $pluginCmd);
11918 if ($otherPlugin eq $plugin) {
11919  
11920 if ($self->ivExists('replaceClientCmdHash', $pluginCmd)) {
11921  
11922 # Restore the original, and move the plugin command to a special IV, so that it
11923 # too can be restored if the plugin is re-enabled at some point
11924 $originalCmdObj = $self->ivShow('replaceClientCmdHash', $pluginCmd);
11925 $pluginCmdObj = $self->ivShow('clientCmdHash', $pluginCmd);
11926 $self->ivAdd('replaceClientCmdHash', $pluginCmd, $pluginCmdObj);
11927 $self->ivAdd('clientCmdHash', $pluginCmd, $originalCmdObj);
11928  
11929 } else {
11930  
11931 # Just move the plugin command to a special IV, so that it can be restored if
11932 # the plugin is re-enabled
11933 $pluginCmdObj = $self->ivShow('clientCmdHash', $pluginCmd);
11934 $self->ivAdd('replaceClientCmdHash', $pluginCmd, $pluginCmdObj);
11935 $self->ivDelete('clientCmdHash', $pluginCmd);
11936 }
11937 }
11938 }
11939  
11940 # Any plugin client commands should also have been added to $self->clientCmdPrettyList.
11941 # Attempt to remove them
11942 if ($self->ivExists('clientCmdReplacePrettyHash', $plugin)) {
11943  
11944 $listRef = $self->ivShow('clientCmdReplacePrettyHash', $plugin);
11945 if (defined $listRef && @$listRef) {
11946  
11947 # Search through $self->clientCmdPrettyList, looking for an exact match for the
11948 # contents of the list in $listRef
11949 $index = -1;
11950 do {
11951  
11952 my $failFlag;
11953  
11954 $index++;
11955  
11956 if ($self->ivIndex('clientCmdPrettyList', $index) eq $$listRef[0]) {
11957  
11958 # Found the first item in $listRef; do the rest of the items match?
11959 OUTER: for (my $count = $index; $count < scalar @$listRef; $count++) {
11960  
11961 if (
11962 $self->ivIndex('clientCmdPrettyList', $count) ne $$listRef[$count]
11963 ) {
11964 # Nope! Try again on the next iteration of the do loop
11965 $failFlag = TRUE;
11966 last OUTER;
11967 }
11968 }
11969  
11970 if (! $failFlag) {
11971  
11972 # Found a complete match
11973 $matchFlag = TRUE;
11974 }
11975 }
11976  
11977 } until ($matchFlag || $index == ((scalar $self->clientCmdPrettyList) - 1));
11978  
11979 if ($matchFlag) {
11980  
11981 # Remove the group headings and client commands from this plugin
11982 $self->ivSplice('clientCmdPrettyList', $index, scalar @$listRef);
11983 }
11984 }
11985 }
11986  
11987 # Sensitise/desensitise menu bar/toolbar items, depending on current conditions
11988 $self->desktopObj->restrictWidgets();
11989  
11990 # Operation complete
11991 return 1;
11992 }
11993  
11994 sub addPluginCmds {
11995  
11996 # Called by any Axmud plugin
11997 # Adds client commands defined in the plugin
11998 #
11999 # Expected arguments
12000 # $plugin - The plugin's main package (declared in the file header)
12001 #
12002 # Optional arguments
12003 # @list - A list of client commands, grouped thematically (using the same format as
12004 # $self->clientCmdPrettyList uses). If the list is empty, no commands are
12005 # added
12006 #
12007 # Return values
12008 # 'undef' on improper arguments or if a client command object can't be created
12009 # Otherwise returns the number of client command objects created (may be 0)
12010  
12011 my ($self, $plugin, @list) = @_;
12012  
12013 # Local variables
12014 my (
12015 $pluginObj, $count,
12016 @clientCmdList, @clientCmdPrettyList,
12017 %clientCmdHash, %replaceClientCmdHash, %userCmdHash, %pluginCmdHash,
12018 );
12019  
12020 # Check for improper arguments
12021 if (! defined $plugin) {
12022  
12023 return $axmud::CLIENT->writeImproper($self->_objClass . '->addPluginCmds', @_);
12024 }
12025  
12026 # Find the plugin object
12027 $pluginObj = $self->ivShow('pluginHash', $plugin);
12028 if (! $pluginObj) {
12029  
12030 # Plugin not found - a very unlikely occurrence for this function, but it's worth
12031 # checking anyway
12032 return undef;
12033 }
12034  
12035 # If no commands specified, nothing to add
12036 if (! @list) {
12037  
12038 return 0;
12039 }
12040  
12041 # Import GA::Client IVs; they are only updated if all commands are sucessfully added
12042 %clientCmdHash = $self->clientCmdHash;
12043 %replaceClientCmdHash = $self->replaceClientCmdHash;
12044 @clientCmdList = $self->clientCmdList;
12045 %userCmdHash = $self->userCmdHash;
12046 @clientCmdPrettyList = $self->clientCmdPrettyList;
12047 %pluginCmdHash = $self->pluginCmdHash;
12048  
12049 # (Code adapted from $self->setupCmds)
12050 $count = 0;
12051 foreach my $string (@list) {
12052  
12053 my ($replaceFlag, $package, $obj);
12054  
12055 # @list contains a list of commands, grouped under headings. The headings begin with a
12056 # '@' character
12057 if (substr ($string, 0, 1) ne '@') {
12058  
12059 # Not a heading. If there's an existing command of the same name, remove it
12060 if (exists $clientCmdHash{lc($string)}) {
12061  
12062 # Remove the existing client command, but don't change any user commands; they
12063 # stay the same when the plugin command is loaded
12064 $replaceFlag = TRUE;
12065 $replaceClientCmdHash{lc($string)} = $clientCmdHash{lc($string)};
12066 delete $clientCmdHash{lc($string)};
12067 }
12068  
12069 # Create a Perl object
12070 $package = 'Games::Axmud::Cmd::Plugin::' . $string;
12071 $obj = $package->new();
12072 if (! $obj) {
12073  
12074 return $self->writeError(
12075 'Could not create client command \'' . $self->cmdSep . lc($string) . '\'',
12076 $self->_objClass . '->addPluginCmds',
12077 );
12078 }
12079  
12080 # Set up user commands corresponding to this client command (but not if it's
12081 # replacing an existing command of the same name)
12082 if (! $replaceFlag) {
12083  
12084 foreach my $userCmd ($obj->defaultUserCmdList) {
12085  
12086 # Check the user command isn't already in use by another client command
12087 if (exists $userCmdHash{lc($userCmd)}) {
12088  
12089 # (Allow writing to something other than GA::Session - there are no
12090 # sessions yet)
12091 return $self->writeError(
12092 'Duplicate user command \'' . $userCmd . '\' pointing at client'
12093 . ' command \'' . lc($string) . '\'',
12094 $self->_objClass . '->setupCmds',
12095 );
12096  
12097 } else {
12098  
12099 # Add the user command to the GA::Client's hash
12100 $userCmdHash{lc($userCmd)} = lc($string);
12101 }
12102 }
12103 }
12104  
12105 # Update IVs
12106 $count++;
12107  
12108 $clientCmdHash{lc($string)} = $obj;
12109 push (@clientCmdList, lc($string));
12110 $pluginCmdHash{lc($string)} = $plugin;
12111 }
12112  
12113 # Both headings and command names are added to ->clientCmdPrettyList
12114 push (@clientCmdPrettyList, $string);
12115 }
12116  
12117 # No errors, so we can now update the GA::Client IVs (if any command objects were actually
12118 # added)
12119 if ($count) {
12120  
12121 $self->ivPoke('clientCmdHash', %clientCmdHash);
12122 $self->ivPoke('replaceClientCmdHash', %replaceClientCmdHash);
12123 $self->ivPoke('clientCmdList', @clientCmdList);
12124 $self->ivPoke('userCmdHash', %userCmdHash);
12125 $self->ivPoke('clientCmdPrettyList', @clientCmdPrettyList);
12126 $self->ivPoke('pluginCmdHash', %pluginCmdHash);
12127  
12128 $self->ivAdd('clientCmdReplacePrettyHash', $plugin, \@list);
12129 }
12130  
12131 # Operation complete
12132 return $count;
12133 }
12134  
12135 sub addPluginTasks {
12136  
12137 # Called by any Axmud plugin
12138 # Adds tasks defined in the plugin
12139 #
12140 # Expected arguments
12141 # $plugin - The plugin's main package (declared in the file header)
12142 #
12143 # Optional arguments
12144 # @list - A list containing groups of 3 elements, in the form
12145 # (task_package, task_formal_name, reference_to_task_label_list)
12146 # - ...where 'task_package' is the package name of the Perl object for the
12147 # task (e.g. 'Games::Axmud::Task::MyCoolTask'), 'task_package_name' is
12148 # the task's formal name, stored in ->task (e.g. 'my_cool_task'), and
12149 # 'reference_to_task_label_list' is a list of task labels (e.g.
12150 # 'mct', 'mycool', 'mycooltask'. If the list is empty, no tasks are
12151 # added
12152 #
12153 # Return values
12154 # 'undef' on improper arguments or if a task can't be added
12155 # Otherwise returns the number of tasks added (may be 0)
12156  
12157 my ($self, $plugin, @list) = @_;
12158  
12159 # Local variables
12160 my (
12161 $pluginObj, $count,
12162 @newTaskList,
12163 %taskPackageHash, %taskLabelHash, %pluginTaskHash,
12164 );
12165  
12166 # Check for improper arguments
12167 if (! defined $plugin) {
12168  
12169 return $axmud::CLIENT->writeImproper($self->_objClass . '->addPluginTasks', @_);
12170 }
12171  
12172 # Find the plugin object
12173 $pluginObj = $self->ivShow('pluginHash', $plugin);
12174 if (! $pluginObj) {
12175  
12176 # Plugin not found - a very unlikely occurrence for this function, but it's worth
12177 # checking anyway
12178 return undef;
12179 }
12180  
12181 # Import GA::Client IVs; they are only updated if all tasks are sucessfully added
12182 %taskPackageHash = $self->taskPackageHash;
12183 %taskLabelHash = $self->taskLabelHash;
12184 %pluginTaskHash = $self->pluginTaskHash;
12185  
12186 # (Code adapted from $self->setupCmds)
12187 $count = 0;
12188 if (@list) {
12189  
12190 do {
12191  
12192 my ($packageName, $taskName, $listRef);
12193  
12194 $packageName = shift @list;
12195 $taskName = shift @list;
12196 $listRef = shift @list;
12197  
12198 if (! $packageName) {
12199  
12200 return $self->writeError(
12201 'Could not add task (no package name specified)',
12202 $self->_objClass . '->addPluginTasks',
12203 );
12204  
12205 } elsif (! $taskName || ! defined $listRef) {
12206  
12207 return $self->writeError(
12208 'Could not add task (invalid formal name or undefined label list)',
12209 $self->_objClass . '->addPluginTasks',
12210 );
12211 }
12212  
12213 # (Code adapted from GA::Cmd::AddTaskPackage->do)
12214  
12215 # Check that no tasks of this type are running in any session
12216 foreach my $session ($self->listSessions()) {
12217  
12218 if ($session->ivExists('currentTaskNameHash', $taskName)) {
12219  
12220 return $self->writeError(
12221 'Can\'t change the package name for the task \'' . $taskName
12222 . '\' because the task is running in at least one session (try halting'
12223 . ' the task first)',
12224 $self->_objClass . '->addPluginTasks',
12225 );
12226 }
12227 }
12228  
12229 # Check that $taskName is not too long
12230 if (length $taskName > 16) {
12231  
12232 return $self->writeError(
12233 'Task name \'' . $taskName . '\' is too long (max 16 characters)',
12234 $self->_objClass . '->addPluginTasks',
12235 );
12236 }
12237  
12238 # (Code adapted from GA::Cmd::AddTaskLabel->do)
12239  
12240 # Check that all the labels in $listRef don't already exist, and that the labels are
12241 # allowed
12242 foreach my $label (@$listRef) {
12243  
12244 if (exists $taskLabelHash{$label} && $taskLabelHash{$label} ne $taskName) {
12245  
12246 return $self->writeError(
12247 'The label \'' . $label . '\' already exists (and points to the \''
12248 . $taskLabelHash{$label} . '\' task)',
12249 $self->_objClass . '->addPluginTasks',
12250 );
12251 }
12252  
12253 if (! $self->nameCheck($label, 32)) {
12254  
12255 return $self->writeError(
12256 'Illegal task label name \'' . $label . '\'',
12257 $self->_objClass . '->addPluginTasks',
12258 );
12259 }
12260 }
12261  
12262 # Add the task package name and labels (overwrite identical entries, if they
12263 # already exist)
12264 $count++;
12265 $taskPackageHash{$taskName} = $packageName;
12266 foreach my $label (@$listRef) {
12267  
12268 $taskLabelHash{$label} = $taskName;
12269 }
12270  
12271 # Mark the task as having been added by the plugin
12272 $pluginTaskHash{$taskName} = $plugin;
12273  
12274 # Preserve the new taskname temporarily
12275 push (@newTaskList, $taskName);
12276  
12277 } until (! @list);
12278 }
12279  
12280 # No errors, so we can now update the GA::Client IVs (if any tasks were actually added)
12281 if ($count) {
12282  
12283 $self->ivPoke('taskPackageHash', %taskPackageHash);
12284 $self->ivPoke('taskLabelHash', %taskLabelHash);
12285 $self->ivPoke('pluginTaskHash', %pluginTaskHash);
12286 }
12287  
12288 # We can also update our customisable text-to-speech (TTS) hashes, so that if the same
12289 # TTS attributes are used by multiple tasks, this plugin's tasks take priority
12290 foreach my $taskName (@newTaskList) {
12291  
12292 $self->ttsAssignAttribs($taskName);
12293 }
12294  
12295 # Operation complete
12296 return $count;
12297 }
12298  
12299 sub addPluginGridWins {
12300  
12301 # Called by any Axmud plugin
12302 # Adds 'grid' windows defined in the plugin
12303 #
12304 # Expected arguments
12305 # $plugin - The plugin's main package (declared in the file header)
12306 #
12307 # Optional arguments
12308 # @list - A list of 'grid' window package names (in groups of 1 element). If the
12309 # list is empty, no 'grid' windows are added. Duplicates are not added
12310 #
12311 # Return values
12312 # 'undef' on improper arguments or if a 'grid' window package can't be added
12313 # Otherwise returns the number of 'grid' window packages added (may be 0)
12314  
12315 my ($self, $plugin, @list) = @_;
12316  
12317 # Local variables
12318 my ($pluginObj, $count);
12319  
12320 # Check for improper arguments
12321 if (! defined $plugin) {
12322  
12323 return $axmud::CLIENT->writeImproper($self->_objClass . '->addPluginGridWins', @_);
12324 }
12325  
12326 # Find the plugin object
12327 $pluginObj = $self->ivShow('pluginHash', $plugin);
12328 if (! $pluginObj) {
12329  
12330 # Plugin not found - a very unlikely occurrence for this function, but it's worth
12331 # checking anyway
12332 return undef;
12333 }
12334  
12335 # Don't add duplicates
12336 $count = 0;
12337 foreach my $package (@list) {
12338  
12339 if (! $self->ivExists('pluginGridWinHash', $package)) {
12340  
12341 $self->ivAdd('pluginGridWinHash', $package, $plugin);
12342 $count++;
12343 }
12344 }
12345  
12346 # Operation complete
12347 return $count;
12348 }
12349  
12350 sub addPluginFreeWins {
12351  
12352 # Called by any Axmud plugin
12353 # Adds 'free' windows defined in the plugin
12354 #
12355 # Expected arguments
12356 # $plugin - The plugin's main package (declared in the file header)
12357 #
12358 # Optional arguments
12359 # @list - A list of 'free' window package names (in groups of 1 element); should
12360 # not include any 'dialogue' windows. If the list is empty, no 'free'
12361 # windows are added. Duplicates are not added
12362 #
12363 # Return values
12364 # 'undef' on improper arguments or if a 'free' window package can't be added
12365 # Otherwise returns the number of 'free' window packages added (may be 0)
12366  
12367 my ($self, $plugin, @list) = @_;
12368  
12369 # Local variables
12370 my ($pluginObj, $count);
12371  
12372 # Find the plugin object
12373 $pluginObj = $self->ivShow('pluginHash', $plugin);
12374 if (! $pluginObj) {
12375  
12376 # Plugin not found - a very unlikely occurrence for this function, but it's worth
12377 # checking anyway
12378 return undef;
12379 }
12380  
12381 # Check for improper arguments
12382 if (! defined $plugin) {
12383  
12384 return $axmud::CLIENT->writeImproper($self->_objClass . '->addPluginFreeWins', @_);
12385 }
12386  
12387 # Don't add duplicates
12388 $count = 0;
12389 foreach my $package (@list) {
12390  
12391 if (! $self->ivExists('pluginFreeWinHash', $package)) {
12392  
12393 $self->ivAdd('pluginFreeWinHash', $package, $plugin);
12394 $count++;
12395 }
12396 }
12397  
12398 # Operation complete
12399 return $count;
12400 }
12401  
12402 sub addPluginStripObjs {
12403  
12404 # Called by any Axmud plugin
12405 # Adds strip objects defined in the plugin. Note that if an existing strip object with the
12406 # same package name already exists in $self->customStripHash, it is not replaced, and this
12407 # plugin's strip object does not become available for use
12408 #
12409 # Expected arguments
12410 # $plugin - The plugin's main package (declared in the file header)
12411 # $stripPackage - The package name for the strip object, e.g.
12412 # 'Games::Axmud::Strip::MyObj'
12413 # $descrip - A short description, e.g. 'Test strip object'
12414 #
12415 # Return values
12416 # 'undef' on improper arguments or if the plugin's strip object can't be added
12417 # 1 on success
12418  
12419 my ($self, $plugin, $stripPackage, $descrip, $check) = @_;
12420  
12421 # Local variables
12422 my $pluginObj;
12423  
12424 # Check for improper arguments
12425 if (! defined $plugin || ! defined $stripPackage || ! defined $descrip || defined $check) {
12426  
12427 return $axmud::CLIENT->writeImproper($self->_objClass . '->addPluginStripObjs', @_);
12428 }
12429  
12430 # Find the plugin object
12431 $pluginObj = $self->ivShow('pluginHash', $plugin);
12432 if (! $pluginObj) {
12433  
12434 # Plugin not found - a very unlikely occurrence for this function, but it's worth
12435 # checking anyway
12436 return undef;
12437 }
12438  
12439 # Check that a strip object with the same package name doesn't already exist
12440 if ($self->ivShow('customStripHash', $stripPackage)) {
12441  
12442 return undef;
12443 }
12444  
12445 # Update IVs
12446 $self->ivAdd('customStripHash', $stripPackage, $descrip);
12447 $self->ivAdd('pluginStripObjHash', $stripPackage, $plugin);
12448  
12449 # Operation complete
12450 return 1;
12451 }
12452  
12453 sub addPluginTableObjs {
12454  
12455 # Called by any Axmud plugin
12456 # Adds table objects defined in the plugin. Note that if an existing table object with the
12457 # same package name already exists in $self->customTableHash, it is not replaced, and this
12458 # plugin's table object does not become available for use
12459 #
12460 # Expected arguments
12461 # $plugin - The plugin's main package (declared in the file header)
12462 # $tablePackage - The package name for the table object, e.g.
12463 # 'Games::Axmud::Table::MyObj'
12464 # $descrip - A short description, e.g. 'Test table object'
12465 #
12466 # Return values
12467 # 'undef' on improper arguments or if the plugin's table object can't be added
12468 # 1 on success
12469  
12470 my ($self, $plugin, $tablePackage, $descrip, $check) = @_;
12471  
12472 # Local variables
12473 my $pluginObj;
12474  
12475 # Check for improper arguments
12476 if (! defined $plugin || ! defined $tablePackage || ! defined $descrip || defined $check) {
12477  
12478 return $axmud::CLIENT->writeImproper($self->_objClass . '->addPluginTableObjs', @_);
12479 }
12480  
12481 # Find the plugin object
12482 $pluginObj = $self->ivShow('pluginHash', $plugin);
12483 if (! $pluginObj) {
12484  
12485 # Plugin not found - a very unlikely occurrence for this function, but it's worth
12486 # checking anyway
12487 return undef;
12488 }
12489  
12490 # Check that a table object with the same package name doesn't already exist
12491 if ($self->ivShow('customTableHash', $tablePackage)) {
12492  
12493 return undef;
12494 }
12495  
12496 # Update IVs
12497 $self->ivAdd('customTableHash', $tablePackage, $descrip);
12498 $self->ivAdd('pluginTableObjHash', $tablePackage, $plugin);
12499  
12500 # Operation complete
12501 return 1;
12502 }
12503  
12504 sub addPluginCages {
12505  
12506 # Called by any Axmud plugin
12507 # Adds cages defined in the plugin
12508 #
12509 # Expected arguments
12510 # $plugin - The plugin's main package (declared in the file header)
12511 #
12512 # Optional arguments
12513 # @list - A list containing groups of 3 elements, in the form
12514 # (cage_package, cage_type, edit_win_package)
12515 # - ...where 'cage_package' is the package name of the Perl object for the
12516 # cage (e.g. 'Games::Axmud::Cage::MyCage'), 'cage_type' is the cage's
12517 # type, e.g. 'mycage' (max 8 characters) and 'edit_win_package' is the
12518 # package name of the cage's 'edit' window (or 'undef', if the cage
12519 # doesn't have an 'edit' window). If the list is empty, no cages are added
12520 # - NB Cage 'edit' windows must also be added to this client via a call to
12521 # $self->addPluginFreeWins
12522 #
12523 # Return values
12524 # 'undef' on improper arguments or if a task can't be added
12525 # Otherwise returns the number of cages added (may be 0)
12526  
12527 my ($self, $plugin, @list) = @_;
12528  
12529 # Local variables
12530 my (
12531 $pluginObj, $count,
12532 @cageTypeList,
12533 %pluginCageHash, %pluginCagePackageHash, %pluginCageEditWinHash,
12534 );
12535  
12536 # Check for improper arguments
12537 if (! defined $plugin) {
12538  
12539 return $axmud::CLIENT->writeImproper($self->_objClass . '->addPluginCages', @_);
12540 }
12541  
12542 # Find the plugin object
12543 $pluginObj = $self->ivShow('pluginHash', $plugin);
12544 if (! $pluginObj) {
12545  
12546 # Plugin not found - a very unlikely occurrence for this function, but it's worth
12547 # checking anyway
12548 return undef;
12549 }
12550  
12551 # Import GA::Client IVs; they are only updated if all cages are sucessfully added
12552 @cageTypeList = $self->cageTypeList;
12553 %pluginCageHash = $self->pluginCageHash;
12554 %pluginCagePackageHash = $self->pluginCagePackageHash;
12555 %pluginCageEditWinHash = $self->pluginCageEditWinHash;
12556  
12557 # (Code adapted from $self->setupCmds)
12558 $count = 0;
12559 if (@list) {
12560  
12561 do {
12562  
12563 my ($packageName, $cageType, $editWinPackage);
12564  
12565 $packageName = shift @list;
12566 $cageType = shift @list;
12567 $editWinPackage = shift @list; # Can be 'undef'
12568  
12569 if (! $packageName) {
12570  
12571 return $self->writeError(
12572 'Could not add cage (no package name specified)',
12573 $self->_objClass . '->addPluginCages',
12574 );
12575  
12576 } elsif (! $cageType) {
12577  
12578 return $self->writeError(
12579 'Could not add cage (no cage type specified)',
12580 $self->_objClass . '->addPluginCages',
12581 );
12582 }
12583  
12584 # Check that $cageType is not too long
12585 if (length $cageType > 8) {
12586  
12587 return $self->writeError(
12588 'Cage type \'' . $cageType . '\' is too long (max 8 characters)',
12589 $self->_objClass . '->addPluginCages',
12590 );
12591 }
12592  
12593 # Check that the cage type doesn't already exist
12594 foreach my $item (@cageTypeList) {
12595  
12596 if ($item eq $cageType) {
12597  
12598 return $self->writeError(
12599 'The cage type \'' . $cageType . '\' already exists',
12600 $self->_objClass . '->addPluginCages',
12601 );
12602 }
12603 }
12604  
12605 # Add the cage
12606 $count++;
12607 push (@cageTypeList, $cageType);
12608 $pluginCageHash{$cageType} = $plugin;
12609 $pluginCagePackageHash{$cageType} = $packageName;
12610 $pluginCageEditWinHash{$cageType} = $editWinPackage;
12611  
12612 } until (! @list);
12613 }
12614  
12615 # No errors, so we can now update the GA::Client IVs (if any cages were actually added)
12616 if ($count) {
12617  
12618 $self->ivPoke('cageTypeList', @cageTypeList);
12619 $self->ivPoke('pluginCageHash', %pluginCageHash);
12620 $self->ivPoke('pluginCagePackageHash', %pluginCagePackageHash);
12621 $self->ivPoke('pluginCageEditWinHash', %pluginCageEditWinHash);
12622  
12623 # Update existing profiles
12624 foreach my $session ($self->listSessions()) {
12625  
12626 # The TRUE argument means 'don't display a message for each cage created/destroyed'
12627 $session->updateCages(TRUE);
12628 }
12629 }
12630  
12631 # Operation complete
12632 return $count;
12633 }
12634  
12635 sub addPluginMenus {
12636  
12637 # Called by any Axmud plugin
12638 # Adds menu items defined in the plugin to any menu strip object (GA::Strip::MenuBar)
12639 # displayed in any 'internal' window while the client is running (and the plugin is
12640 # enabled)
12641 #
12642 # Expected arguments
12643 # $plugin - The plugin's main package (declared in the file header)
12644 #
12645 # Optional arguments
12646 # $funcRef - Reference to a function which contain the code to add menu items to a
12647 # Gtk3::Menu widget, pre-existing or created by this function. The
12648 # referenced function must accept the strip object and Gtk3::Menu as
12649 # arguments, and return 'undef' on failure or 1 on success
12650 #
12651 # Return values
12652 # 'undef' on improper arguments or if the menu items can't be added
12653 # 1 otherwise
12654  
12655 my ($self, $plugin, $funcRef, $check) = @_;
12656  
12657 # Local variables
12658 my ($pluginObj, $subMenu);
12659  
12660 # Check for improper arguments
12661 if (! defined $plugin || ! defined $funcRef || defined $check) {
12662  
12663 return $axmud::CLIENT->writeImproper($self->_objClass . '->addPluginWidgets', @_);
12664 }
12665  
12666 # Find the plugin object
12667 $pluginObj = $self->ivShow('pluginHash', $plugin);
12668 if (! $pluginObj) {
12669  
12670 # Plugin not found - a very unlikely occurrence for this function, but it's worth
12671 # checking anyway
12672 return undef;
12673 }
12674  
12675 # Each plugin can only call this function once
12676 if ($self->ivExists('pluginMenuFuncHash', $plugin)) {
12677  
12678 return undef;
12679  
12680 } else {
12681  
12682 $self->ivAdd('pluginMenuFuncHash', $plugin, $funcRef);
12683 }
12684  
12685 # Any 'internal' windows which already exist and which have a menu strip object should add a
12686 # sub-menu for this plugin now; any new 'internal' windows created from now will
12687 # automatically call the referenced function to add their own sub-menus
12688 foreach my $winObj ($self->desktopObj->ivValues('gridWinHash')) {
12689  
12690 my ($stripObj, $subMenu);
12691  
12692 if (
12693 $winObj->winType eq 'main'
12694 || $winObj->winType eq 'protocol'
12695 || $winObj->winType eq 'custom'
12696 ) {
12697 $stripObj = $winObj->ivShow('firstStripHash', 'Games::Axmud::Strip::MenuBar');
12698 if ($stripObj) {
12699  
12700 $subMenu = $stripObj->addPluginWidgets($plugin);
12701 if (! $subMenu) {
12702  
12703 return undef;
12704 }
12705  
12706 # Call the referenced function to add menu items to this sub-menu
12707 if (! &$funcRef($stripObj, $subMenu)) {
12708  
12709 return undef;
12710 }
12711  
12712 # Update the window to show the new menu items
12713 $winObj->winShowAll($self->_objClass . '->addPluginMenus');
12714 }
12715 }
12716 }
12717  
12718 return 1;
12719 }
12720  
12721 sub addPluginMxpFilters {
12722  
12723 # Called by any Axmud plugin
12724 # Adds the plugin function that's used to apply MXP file filters
12725 #
12726 # Expected arguments
12727 # $plugin - The plugin's main package (declared in the file header)
12728 # $funcRef - Reference to the function that does the conversion
12729 #
12730 # Return values
12731 # 'undef' on improper arguments
12732 # 1 otherwise
12733  
12734 my ($self, $plugin, $funcRef, $check) = @_;
12735  
12736 # Local variables
12737 my $pluginObj;
12738  
12739 # Check for improper arguments
12740 if (! defined $plugin || ! defined $funcRef || defined $check) {
12741  
12742 return $axmud::CLIENT->writeImproper($self->_objClass . '->addPluginMxpFilters', @_);
12743 }
12744  
12745 # Find the plugin object
12746 $pluginObj = $self->ivShow('pluginHash', $plugin);
12747 if (! $pluginObj) {
12748  
12749 # Plugin not found - a very unlikely occurrence for this function, but it's worth
12750 # checking anyway
12751 return undef;
12752 }
12753  
12754 # Update IVs
12755 $self->ivAdd('pluginMxpFilterHash', $plugin, $funcRef);
12756  
12757 # Operation complete
12758 return 1;
12759 }
12760  
12761 sub addPluginMcpPackages {
12762  
12763 # Called by any Axmud plugin
12764 # Adds the MCP package object (inheriting from GA::Generic::Mcp) defined by the plugin
12765 #
12766 # Expected arguments
12767 # $plugin - The plugin's main package (declared in the file header)
12768 # $name - The name of the MCP package, e.g. 'mcp-negotiate-can'. Must conform to
12769 # MCP's package name rules (see the MCP spec for more information);
12770 # this function won't allow you to add 'official' MCP packages whose
12771 # name starts 'mcp-'
12772 # $perlPackage - The Perl package for the object, e.g. Games::Axmud::Mcp::MyPackage
12773 # $minVersion - The minimum package version supported (e.g. '1.0', '2.0' etc). Should
12774 # ideally be a string (i.e. '1.0' not 1). If not a valid number (any
12775 # decimal number greater than 0), 1.0 is used
12776 # $maxVersion - The maximum package version supported (e.g. '1.0', '2.0' etc). Should
12777 # ideally be a string (i.e. '1.0' not 1). If not a valid number (any
12778 # decimal number greater than 0), 1.0 is used
12779 #
12780 # Optional arguments
12781 # @supplantList - An optional list of MCP package names for which Axmud should prefer to
12782 # use this MCP package, if the world supports both. Standard MCP
12783 # packages like 'mcp-negotiate' cannot be supplanted (specifically,
12784 # any package whose name begins 'mcp-' cannot be supplanted; the name
12785 # is ignored if present in this list)
12786 #
12787 # Return values
12788 # 'undef' on improper arguments or if the MCP package object can't be added
12789 # 1 otherwise
12790  
12791 my ($self, $plugin, $name, $perlPackage, $minVersion, $maxVersion, @supplantList) = @_;
12792  
12793 # Local variables
12794 my ($pluginObj, $mcpObj);
12795  
12796 # Check for improper arguments
12797 if (
12798 ! defined $plugin || ! defined $name || ! defined $perlPackage || ! defined $minVersion
12799 || ! defined $maxVersion
12800 ) {
12801 return $axmud::CLIENT->writeImproper($self->_objClass . '->addPluginMcpPackages', @_);
12802 }
12803  
12804 # Find the plugin object
12805 $pluginObj = $self->ivShow('pluginHash', $plugin);
12806 if (! $pluginObj) {
12807  
12808 # Plugin not found - a very unlikely occurrence for this function, but it's worth
12809 # checking anyway
12810 return undef;
12811 }
12812  
12813 # Check that an MCP package object with the same name doesn't already exist
12814 if ($self->ivExists('mcpPackageHash', $name)) {
12815  
12816 return $self->writeError(
12817 'Could not create MCP package \'' . $name . '\' - duplicate package name',
12818 $self->_objClass . '->addPluginMcpPackages',
12819 );
12820 }
12821  
12822 # Don't add 'official' MCP packages (those whose names start 'mcp-')
12823 if (substr($name, 0, 4) eq 'mcp-') {
12824  
12825 return $self->writeError(
12826 'Cannot create \'official\' MCP package \'' . $name . '\'',
12827 $self->_objClass . '->addPluginMcpPackages',
12828 );
12829 }
12830  
12831 # Create the MCP package object
12832 $mcpObj = $perlPackage->new($name, $minVersion, $maxVersion, $plugin, @supplantList);
12833 if (! $mcpObj) {
12834  
12835 return $self->writeError(
12836 'Could not create MCP package \'' . $name . '\' - internal error',
12837 $self->_objClass . '->createSupportedMcpPackages',
12838 );
12839 }
12840  
12841 # Update IVs
12842 $self->ivAdd('mcpPackageHash', $name, $mcpObj);
12843  
12844 # Operation complete
12845 return 1;
12846 }
12847  
12848 # Logging
12849  
12850 sub deleteStandardLogs {
12851  
12852 # Called by $self->start, if the ->deleteStandardLogsFlag is set
12853 # Makes sure the /logs and /logs/standard directories are empty (but doesn't interfere with
12854 # each world's own log directory)
12855 #
12856 # Expected arguments
12857 # (none besides $self)
12858 #
12859 # Return values
12860 # 'undef' on improper arguments
12861 # 1 otherwise
12862  
12863 my ($self, $check) = @_;
12864  
12865 # Check for improper arguments
12866 if (defined $check) {
12867  
12868 return $axmud::CLIENT->writeImproper($self->_objClass . '->deleteStandardLogs', @_);
12869 }
12870  
12871 foreach my $path ($self->ivValues('logPrefHash')) {
12872  
12873 if (-e $axmud::DATA_DIR . $path) {
12874  
12875 unlink ($axmud::DATA_DIR . $path);
12876 }
12877 }
12878  
12879 return 1;
12880 }
12881  
12882 sub deleteWorldLogDir {
12883  
12884 # Called by GA::Session->setupProfiles, if the ->deleteWorldLogsFlag is set
12885 # Deletes the logfile directory for the specified world
12886 #
12887 # Expected arguments
12888 # $world - The name of a world profile
12889 #
12890 # Return values
12891 # 'undef' on improper arguments
12892 # 1 otherwise
12893  
12894 my ($self, $world, $check) = @_;
12895  
12896 # Check for improper arguments
12897 if (! defined $world || defined $check) {
12898  
12899 return $axmud::CLIENT->writeImproper($self->_objClass . '->deleteWorldLogDir', @_);
12900 }
12901  
12902 # Delete the dictory...
12903 File::Path::remove_tree($axmud::DATA_DIR . '/logs/' . $world);
12904  
12905 return 1;
12906 }
12907  
12908 sub createWorldLogDir {
12909  
12910 # Called by GA::Session->setupProfiles
12911 # Creates the logfile directory for the specified world
12912 #
12913 # Expected arguments
12914 # $world - The name of a world profile
12915 #
12916 # Return values
12917 # 'undef' on improper arguments
12918 # 1 otherwise
12919  
12920 my ($self, $world, $check) = @_;
12921  
12922 # Local variables
12923 my $dir;
12924  
12925 # Check for improper arguments
12926 if (! defined $world || defined $check) {
12927  
12928 return $axmud::CLIENT->writeImproper($self->_objClass . '->createWorldLogDir', @_);
12929 }
12930  
12931 # Create the dictory (unless it already exists)
12932 $dir = $axmud::DATA_DIR . '/logs/' . $world;
12933 if (! -e $dir) {
12934  
12935 mkdir ($dir, 0755);
12936 }
12937  
12938 return 1;
12939 }
12940  
12941 sub writeLog {
12942  
12943 # Can be called by any function, but mostly called by:
12944 # GA::Obj::TextView->showSystemText, ->showError, ->showWarning, ->showDebug,
12945 # ->showImproper, GA::Session->writeIncomingDataLogs, ->dispatchCmd, ->dispatchPassword
12946 #
12947 # Writes some text to one or more logfiles (if allowed)
12948 #
12949 # Expected arguments
12950 # $session - The GA::Session that generated the message
12951 # $standardflag - Set to TRUE for standard logfiles, so that the session number is
12952 # written to the logfile (so we can tell which session generated the
12953 # text); FALSE otherwise
12954 # $text - The text to be written
12955 # $beforeFlag - TRUE if $text should be preceded by a newline character, FALSE if not
12956 # $afterFlag - TRUE if $text should be followed by a newline character, FALSE if not
12957 #
12958 # Optional arguments
12959 # @fileTypeList - A list of logfile types to which $text must be written. For standard
12960 # logfiles, the types are keys in GA::Client->logPrefHash; otherwise,
12961 # keys in GA::Session->currentWorld->logPrefHash. If an empty list,
12962 # $text is not written to any logfile. If any of the log file types
12963 # are unrecognised, they are simply ignored (no error message is
12964 # generated)
12965 #
12966 # Return values
12967 # 'undef' on improper arguments or if logging is disabled for all sessions
12968 # 1 otherwise
12969  
12970 my ($self, $session, $standardflag, $text, $beforeFlag, $afterFlag, @fileTypeList) = @_;
12971  
12972 # Local variables
12973 my (
12974 $prefix, $preamble,
12975 @argList,
12976 );
12977  
12978 # Check for improper arguments
12979 if (
12980 ! defined $session || ! defined $standardflag || ! defined $text
12981 || ! defined $beforeFlag || ! defined $afterFlag
12982 ) {
12983 # Can't call $self->showImproper, or we'll get an infinite loop, so write something to
12984 # the terminal
12985 # Protect against Perl errors if any of the arguments are undefined
12986 foreach my $arg (@_) {
12987 if (defined $arg) {
12988 push(@argList, $arg);
12989 } else {
12990 push(@argList, '<<undef>>');
12991 }
12992 }
12993  
12994 print "IMPROPER ARGUMENTS: " . $self->_objClass . "->writeLog() " . join (" ", @argList)
12995 . "\n";
12996 return undef;
12997 }
12998  
12999 # If logging is disabled for all sessions, don't write anything
13000 if (! $self->allowLogsFlag) {
13001  
13002 return undef;
13003 }
13004  
13005 # Prefix the date and/or time to the line to be written, if allowed
13006 if ($self->logPrefixDateFlag) {
13007  
13008 $prefix = $self->localDateString();
13009 }
13010  
13011 if ($self->logPrefixTimeFlag) {
13012  
13013 if ($prefix) {
13014 $prefix .= ' ' . $self->localClock();
13015 } else {
13016 $prefix = $self->localClock();
13017 }
13018 }
13019  
13020 # For standard logfiles, add the session number
13021 if ($standardflag) {
13022  
13023 if ($prefix) {
13024 $prefix .= ' [' . $session->number . ']';
13025 } else {
13026 $prefix = '[' . $session->number . ']';
13027 }
13028 }
13029  
13030 # Create the logfile preamble as a single string, if one is set
13031 if (! $self->logPreambleList) {
13032 $preamble = '';
13033 } else {
13034 $preamble = join("\n", $self->logPreambleList) . "\n";
13035 }
13036  
13037 OUTER: foreach my $type (@fileTypeList) {
13038  
13039 my ($path, $fileHandle, $newFileFlag, $thisText, $lastChar);
13040  
13041 # Check that the log $fileType is recognised, and that logging is turned on for it
13042 # If so, set the file's path
13043 if ($standardflag) {
13044  
13045 # Standard logfiles
13046 if (
13047 ! $self->ivExists('logPrefHash', $type)
13048 || ! $self->ivShow('logPrefHash', $type)
13049 ) {
13050 next OUTER;
13051  
13052 } else {
13053  
13054 $path = $axmud::DATA_DIR . $self->ivShow('constLogPathHash', $type)
13055 }
13056  
13057 } else {
13058  
13059 # World-specific logfiles
13060 if (
13061 ! $session->currentWorld->ivExists('logPrefHash', $type)
13062 || ! $session->currentWorld->ivShow('logPrefHash', $type)
13063 ) {
13064 next OUTER;
13065  
13066 } else {
13067  
13068 $path = $axmud::DATA_DIR . '/logs/'
13069 . $session->currentWorld->name . '/' . $type;
13070 }
13071 }
13072  
13073 # If the file name must be unique for every session, or for every distinct date, modify
13074 # its path
13075 if ($self->logClientFlag) {
13076 $path .= '_' . $self->startDateString . '_' . $self->startClockString;
13077 } elsif ($self->logDayFlag) {
13078 $path .= '_' . $self->startDateString;
13079 }
13080  
13081 # Logfiles end with .txt on MS Windows
13082 if ($^O eq 'MSWin32') {
13083  
13084 $path .= '.txt';
13085 }
13086  
13087 # Check whether the file already exists
13088 if (! -e $path) {
13089  
13090 $newFileFlag = TRUE;
13091  
13092 # Add the prefix (if one was set)
13093 if ($prefix) {
13094  
13095 $thisText = $prefix . ' ' . $text;
13096 }
13097  
13098 # For new logfiles, ignore $beforeFlag, but apply $afterFlag
13099 if ($afterFlag) {
13100  
13101 $thisText .= "\n";
13102 }
13103  
13104 } else {
13105  
13106 if (! $beforeFlag) {
13107  
13108 # Test whether the file ends with a newline character, or not
13109 if (! open ($fileHandle, "<$path")) {
13110  
13111 # Could not open file
13112 next OUTER;
13113 }
13114  
13115 # Read the last character
13116 seek $fileHandle, -1, 2; # SEEK_END
13117 $lastChar = getc($fileHandle);
13118 close $fileHandle;
13119 }
13120  
13121 # Apply $beforeFlag and $afterFlag, and if we're writing on a new line, add $prefix
13122 # at the right position
13123 if ($beforeFlag) {
13124 $thisText = "\n";
13125 } else {
13126 $thisText = "";
13127 }
13128  
13129 if ($beforeFlag || $lastChar eq "\n") {
13130  
13131 $thisText .= $prefix;
13132 }
13133  
13134 if ($thisText) {
13135 $thisText .= ' ' . $text;
13136 } else {
13137 $thisText = $text;
13138 }
13139  
13140 if ($afterFlag) {
13141  
13142 $thisText .= "\n";
13143 }
13144 }
13145  
13146 # Open the file for writing, appending $text to anything already there
13147 if (! open ($fileHandle, ">>$path")) {
13148  
13149 # Could not open file
13150 next OUTER;
13151 }
13152  
13153 # This line prevents any nasty 'Wide character in print' errors when (for example)
13154 # receiving UTF8 characters from the world
13155 binmode $fileHandle, ':utf8';
13156  
13157 # If the file didn't already exist, write a header
13158 if ($newFileFlag) {
13159  
13160 print
13161 $fileHandle
13162 $axmud::SCRIPT . ' v' . $axmud::VERSION . ' logfile \'' . $type
13163 . '\' started at ' . $self->localTime() . "\n$preamble";
13164 }
13165  
13166 # Write the line and close the file
13167 print $fileHandle $thisText;
13168 close $fileHandle;
13169 }
13170  
13171 # Logging complete
13172 return 1;
13173 }
13174  
13175 # Colour/style tags
13176  
13177 sub checkColourTags {
13178  
13179 # Can be called by anything
13180 # Checks whether a specified colour tag is standard colour tag, an xterm colour tag or an
13181 # RGB colour tag
13182 #
13183 # Expected arguments
13184 # $tag - The colour tag to check. Standard colour tags are case-sensitive (i.e.
13185 # 'red' and 'RED' are different colours), but xterm and RGB colour tags
13186 # are case-insensitive (i.e. '#ffffff' and '#FFFFFF' are the same colour)
13187 #
13188 # Optional arguments
13189 # $mode - Specifies which tags to check
13190 # 'all' (or 'undef') - check standard, xterm and RGB colour tags
13191 # 'standard' - check only standard colour tags
13192 # 'xterm' - check only xterm colour tags
13193 # 'rgb' - check only RGB colour tags
13194 #
13195 # Return values
13196 # An empty list on improper arguments it it's not a recognised colour tag, or if $mode is
13197 # set to 'standard', 'xterm' or 'rgb' and $tag isn't one of those colour tags, or if
13198 # $mode is an unrecognised value
13199 # Otherwise returns a list identifying $tag, in the form
13200 # (tag_type, underlay_flag)
13201 # ...where 'tag_type' is one of the strings 'standard', 'xterm' or 'rgb', and
13202 # 'underlay_flag' is TRUE if it's an underlay tag, FALSE if not
13203  
13204 my ($self, $tag, $mode, $check) = @_;
13205  
13206 # Local variables
13207 my (
13208 $underlayFlag,
13209 @emptyList,
13210 );
13211  
13212 # Check for improper arguments
13213 if (! defined $tag || defined $check) {
13214  
13215 $axmud::CLIENT->writeImproper($self->_objClass . '->checkColourTags', @_);
13216 return @emptyList;
13217 }
13218  
13219 if (! defined $mode) {
13220  
13221 $mode = 'all';
13222 }
13223  
13224 # Standard colour tags
13225 if ($mode eq 'all' || $mode eq 'standard') {
13226  
13227 # GA::Client->colourTagHash and ->boldColourTagHash both contain 'red', 'BLUE' etc, but
13228 # they don't contain the corresponding underlay tags 'ul_red', 'UL_BLUE', etc
13229 # Since 'red' is the same colour as 'ul_red', we can simply remove the 'ul_' or 'UL_'
13230 # portions
13231 if (substr($tag, 0, 3) eq 'ul_') {
13232  
13233 substr($tag, 0, 3) = '';
13234 if ($self->ivExists('colourTagHash', $tag)) {
13235  
13236 # Valid standard underlay colour tag
13237 return ('standard', TRUE);
13238  
13239 } else {
13240  
13241 # Invalid standard underlay colour tag
13242 return @emptyList;
13243 }
13244  
13245 } elsif (substr($tag, 0, 3) eq 'UL_') {
13246  
13247 substr($tag, 0, 3) = '';
13248 if ($self->ivExists('boldColourTagHash', $tag)) {
13249  
13250 # Valid standard underlay colour tag
13251 return ('standard', TRUE);
13252  
13253 } else {
13254  
13255 # Invalid standard underlay colour tag
13256 return @emptyList;
13257 }
13258  
13259 } elsif (
13260 $self->ivExists('colourTagHash', $tag)
13261 || $self->ivExists('boldColourTagHash', $tag)
13262 ) {
13263 # Valid standard colour tag
13264 return ('standard', FALSE);
13265 }
13266 }
13267  
13268 # xterm and RGB colour tags are case-insensitive (unlike standard colour tags)
13269 $tag = lc($tag);
13270 # Remove the initial 'u' that represents an underlay colour (as opposed to a text colour)
13271 if (substr($tag, 0, 1) eq 'u') {
13272  
13273 substr($tag, 0, 1) = '';
13274 $underlayFlag = TRUE;
13275 }
13276  
13277 # xterm colour tags
13278 if ($mode eq 'all' || $mode eq 'xterm') {
13279  
13280 if ($self->ivExists('xTermColourHash', $tag)) {
13281  
13282 if (! $underlayFlag) {
13283  
13284 # Valid xterm text colour tag
13285 return ('xterm', FALSE);
13286  
13287 } else {
13288  
13289 # Valid xterm underlay colour tag
13290 return ('xterm', TRUE);
13291 }
13292 }
13293 }
13294  
13295 # RGB colour tags
13296 if ($mode eq 'all' || $mode eq 'rgb') {
13297  
13298 if ($tag =~ m/^\#[a-f0-9]{6}$/) {
13299  
13300 if (! $underlayFlag) {
13301  
13302 # Valid RGB text colour tag
13303 return ('rgb', FALSE);
13304  
13305 } else {
13306  
13307 # Valid RGB underlay colour tag
13308 return ('rgb', TRUE);
13309 }
13310 }
13311 }
13312  
13313 # Otherwise it's an invalid colour tag
13314 return @emptyList;
13315 }
13316  
13317 sub checkTextTags {
13318  
13319 # Can be called by anything
13320 # A modified copy of $self->checkColourTags; checks only standard, xterm and RGB text
13321 # colour tags (ignores underlay colour tags)
13322 #
13323 # Expected arguments
13324 # $tag - The colour tag to check. Standard colour tags are case-sensitive (i.e.
13325 # 'red' and 'RED' are different colours), but xterm and RGB colour tags
13326 # are case-insensitive (i.e. '#ffffff' and '#FFFFFF' are the same colour)
13327 #
13328 # Optional arguments
13329 # $mode - Specifies which tags to check
13330 # 'all' (or 'undef') - check standard, xterm and RGB colour tags
13331 # 'standard' - check only standard colour tags
13332 # 'xterm' - check only xterm colour tags
13333 # 'rgb' - check only RGB colour tags
13334 #
13335 # Return values
13336 # 'undef' on improper arguments it it's not a recognised text colour tag (including any
13337 # underlay colour tag), or if $mode is set to 'standard', 'xterm' or 'rgb' and $tag
13338 # isn't one of those colour tags, or if $mode is an unrecognised value
13339 # Otherwise returns a string identifying $tag: 'standard', 'xterm' or 'rgb'
13340  
13341 my ($self, $tag, $mode, $check) = @_;
13342  
13343 # Check for improper arguments
13344 if (! defined $tag || defined $check) {
13345  
13346 return $axmud::CLIENT->writeImproper($self->_objClass . '->checkTextTags', @_);
13347 }
13348  
13349 if (! defined $mode) {
13350  
13351 $mode = 'all';
13352 }
13353  
13354 # Standard text colour tags
13355 if ($mode eq 'all' || $mode eq 'standard') {
13356  
13357 if (
13358 $self->ivExists('colourTagHash', $tag)
13359 || $self->ivExists('boldColourTagHash', $tag)
13360 ) {
13361 # Valid standard colour tag
13362 return 'standard';
13363 }
13364 }
13365  
13366 # xterm and RGB colour tags are case-insensitive (unlike standard colour tags)
13367 $tag = lc($tag);
13368  
13369 # xterm colour tags
13370 if ($mode eq 'all' || $mode eq 'xterm') {
13371  
13372 if ($self->ivExists('xTermColourHash', $tag)) {
13373  
13374 # Valid xterm text colour tag
13375 return 'xterm';
13376 }
13377 }
13378  
13379 # RGB colour tags
13380 if ($mode eq 'all' || $mode eq 'rgb') {
13381  
13382 if ($tag =~ m/^\#[a-f0-9]{6}$/) {
13383  
13384 # Valid RGB text colour tag
13385 return 'rgb';
13386 }
13387 }
13388  
13389 # Otherwise it's either a valid underlay colour tag, or an invalid colour tag
13390 return undef;
13391 }
13392  
13393 sub checkUnderlayTags {
13394  
13395 # Can be called by anything
13396 # A modified copy of $self->checkColourTags; checks only standard, xterm and RGB underlay
13397 # colour tags (ignores text colour tags)
13398 #
13399 # Expected arguments
13400 # $tag - The colour tag to check. Standard colour tags are case-sensitive (i.e.
13401 # 'ul_red' and 'UL_RED' are different colours), but xterm and RGB colour
13402 # tags are case-insensitive (i.e. 'u#ffffff' and 'U#FFFFFF' are the same
13403 # colour)
13404 #
13405 # Optional arguments
13406 # $mode - Specifies which tags to check
13407 # 'all' (or 'undef') - check standard, xterm and RGB colour tags
13408 # 'standard' - check only standard colour tags
13409 # 'xterm' - check only xterm colour tags
13410 # 'rgb' - check only RGB colour tags
13411 #
13412 # Return values
13413 # 'undef' on improper arguments it it's not a recognised underlay colour tag (including
13414 # any text colour tag), or if $mode is set to 'standard', 'xterm' or 'rgb' and $tag
13415 # isn't one of those colour tags, or if $mode is an unrecognised value
13416 # Otherwise returns a string identifying $tag: 'standard', 'xterm' or 'rgb'
13417  
13418 my ($self, $tag, $mode, $check) = @_;
13419  
13420 # Check for improper arguments
13421 if (! defined $tag || defined $check) {
13422  
13423 return $axmud::CLIENT->writeImproper($self->_objClass . '->checkUnderlayTags', @_);
13424 }
13425  
13426 if (! defined $mode) {
13427  
13428 $mode = 'all';
13429 }
13430  
13431 # Standard colour tags
13432 if ($mode eq 'all' || $mode eq 'standard') {
13433  
13434 # GA::Client->colourTagHash and ->boldColourTagHash both contain 'red', 'BLUE' etc, but
13435 # they don't contain the corresponding underlay tags 'ul_red', 'UL_BLUE', etc
13436 # Since 'red' is the same colour as 'ul_red', we can simply remove the 'ul_' or 'UL_'
13437 # portions
13438 if (substr($tag, 0, 3) eq 'ul_') {
13439  
13440 substr($tag, 0, 3) = '';
13441 if ($self->ivExists('colourTagHash', $tag)) {
13442  
13443 # Valid standard underlay colour tag
13444 return 'standard';
13445  
13446 } else {
13447  
13448 # Invalid standard underlay colour tag
13449 return undef;
13450 }
13451  
13452 } elsif (substr($tag, 0, 3) eq 'UL_') {
13453  
13454 substr($tag, 0, 3) = '';
13455 if ($self->ivExists('boldColourTagHash', $tag)) {
13456  
13457 # Valid standard underlay colour tag
13458 return 'standard'
13459  
13460 } else {
13461  
13462 # Invalid standard underlay colour tag
13463 return undef;
13464 }
13465 }
13466 }
13467  
13468 # xterm and RGB colour tags are case-insensitive (unlike standard colour tags)
13469 $tag = lc($tag);
13470 # Remove the initial 'u' that represents an underlay colour (as opposed to a text colour)
13471 if (substr($tag, 0, 1) eq 'u') {
13472  
13473 substr($tag, 0, 1) = '';
13474  
13475 } else {
13476  
13477 # Not a valid xterm or RGB underlay colour flag
13478 return undef;
13479 }
13480  
13481 # xterm colour tags
13482 if ($mode eq 'all' || $mode eq 'xterm') {
13483  
13484 if ($self->ivExists('xTermColourHash', $tag)) {
13485  
13486 # Valid xterm underlay colour tag
13487 return 'xterm';
13488 }
13489 }
13490  
13491 # RGB colour tags
13492 if ($mode eq 'all' || $mode eq 'rgb') {
13493  
13494 if ($tag =~ m/^\#[a-f0-9]{6}$/) {
13495  
13496 # Valid RGB underlay colour tag
13497 return 'rgb';
13498 }
13499 }
13500  
13501 # Otherwise it's either a valid text colour tag, or an invalid colour tag
13502 return undef;
13503 }
13504  
13505 sub checkBoldTags {
13506  
13507 # Can be called by anything
13508 # Checks whether a specified colour tag is bold standard colour tag - either a text tag
13509 # like 'BLUE' or an underlay tag like 'UL_BLUE'
13510 #
13511 # Expected arguments
13512 # $tag - the colour tag to check
13513 #
13514 # Return values
13515 # 'undef' on improper arguments it it's not a bold standard colour tag
13516 # 'text' if it's a bold standard text colour tag (e.g. 'BLUE')
13517 # 'underlay' if it's an bold standard underlay tag (e.g. 'UL_BLUE')
13518  
13519 my ($self, $tag, $check) = @_;
13520  
13521 # Check for improper arguments
13522 if (! defined $tag || defined $check) {
13523  
13524 return $axmud::CLIENT->writeImproper($self->_objClass . '->checkBoldTags', @_);
13525 }
13526  
13527 # ->boldColourTagHash contains 'BLUE' etc, but it doesn't contain the corresponding underlay
13528 # tags 'UL_BLUE', etc
13529 # Since 'BLUE' is the same colour as 'UL_BLUE', we can simply remove 'UL_' portion
13530 if (substr($tag, 0, 3) eq 'UL_') {
13531  
13532 substr($tag, 0, 3) = '';
13533 if ($self->ivExists('boldColourTagHash', $tag)) {
13534  
13535 # Valid bold standard underlay colour tag
13536 return 'underlay';
13537 }
13538  
13539 } elsif ($self->ivExists('boldColourTagHash', $tag)) {
13540  
13541 # Valid bold standard text colour tag
13542 return 'text';
13543 }
13544  
13545 # Not a valid bold standard colour tag
13546 return undef;
13547 }
13548  
13549 sub returnRGBColour {
13550  
13551 # Can be called by anything
13552 # Translate one of the standard colour tags used by Axmud (e.g. 'white') or an xterm colour
13553 # tag (e.g. 'x255') into an RGB colour tag (e.g. '#FFFFFF')
13554 # If an RGB colour tag is supplied, returns it unmodified
13555 # If the standard/xterm colour tag isn't recognised, returns a failsafe RGB tag based on
13556 # either $self->constTextColour or $self->constBackgroundColour
13557 #
13558 # Expected arguments
13559 # $tag - the Axmud colour tag to translate
13560 #
13561 # Return values
13562 # 'undef' on improper arguments
13563 # Otherwise returns an RGB colour in the form #xxxxxx
13564  
13565 my ($self, $tag, $check) = @_;
13566  
13567 # Local variables
13568 my ($defaultText, $defaultBackground);
13569  
13570 # Check for improper arguments
13571 if (! defined $tag || defined $check) {
13572  
13573 return $axmud::CLIENT->writeImproper($self->_objClass . '->returnRGBColour', @_);
13574 }
13575  
13576 # Get some failsafe RGB tags to use in case $tag isn't recognised
13577 $defaultText = $self->ivShow('colourTagHash', $self->constTextColour);
13578 $defaultBackground = $self->ivShow('colourTagHash', $self->constBackgroundColour);
13579  
13580 # If we have been supplied with an RGB colour tag, we must return it unmodified
13581 if ($tag =~ m/^[Uu]?\#[A-Fa-f0-9]{6}$/) {
13582  
13583 return $tag;
13584  
13585 # The tag 'red' should return the same RGB colour as 'ul_red', and the tag 'BLUE' should
13586 # return the same RGB colour as 'UL_BLUE'
13587 } elsif (substr($tag, 0, 3) eq 'ul_') {
13588  
13589 substr($tag, 0, 3) = '';
13590 if ($self->ivExists('colourTagHash', $tag)) {
13591  
13592 # Valid (normal) underlay colour tag
13593 return $self->ivShow('colourTagHash', $tag);
13594  
13595 } else {
13596  
13597 # Invalid (normal) underlay colour tag. Use the default background colour instead
13598 return $defaultBackground;
13599 }
13600  
13601 } elsif (substr($tag, 0, 3) eq 'UL_') {
13602  
13603 substr($tag, 0, 3) = '';
13604 if ($self->ivExists('boldColourTagHash', $tag)) {
13605  
13606 # Valid (bold) underlay colour tag
13607 return $self->ivShow('boldColourTagHash', $tag);
13608  
13609 } else {
13610  
13611 # Invalid (bold) underlay colour tag. Use the default background colour instead
13612 return $defaultBackground;
13613 }
13614  
13615 } elsif ($self->ivExists('colourTagHash', $tag)) {
13616  
13617 # Valid (normal) text colour tag
13618 return $self->ivShow('colourTagHash', $tag);
13619  
13620 } elsif ($self->ivExists('boldColourTagHash', $tag)) {
13621  
13622 # Valid (bold) text colour tag
13623 return $self->ivShow('boldColourTagHash', $tag);
13624  
13625 } elsif ($self->ivExists('xTermColourHash', $tag)) {
13626  
13627 # Valid xterm text colour tag
13628 return $self->ivShow('xTermColourHash', $tag);
13629  
13630 } elsif (
13631 substr($tag, 0, 1) eq 'u'
13632 && $self->ivExists('xTermColourHash', substr($tag, 1))
13633 ) {
13634 # Valid xterm underlay colour tag
13635 return $self->ivShow('xTermColourHash', substr($tag, 1));
13636  
13637 } else {
13638  
13639 # Invalid colour tag. Use the (global) default text colour instead
13640 return $defaultText;
13641 }
13642 }
13643  
13644 sub returnCairoColour {
13645  
13646 # Can be called by anything (but is not currently called by anything)
13647 # Translates any Axmud colour tag (including standard, xterm and RGB tags) into a format
13648 # used for Cairo drawing - a reference to a list containing three values in the range 0-1,
13649 # corresponding to the RGB values Cairo is expecting
13650 #
13651 # Expected arguments
13652 # $tag - the Axmud colour tag to translate
13653 #
13654 # Return values
13655 # 'undef' on improper arguments
13656 # Otherwise returns the list reference described above
13657  
13658 my ($self, $tag, $check) = @_;
13659  
13660 # Local variables
13661 my @list;
13662  
13663 # Check for improper arguments
13664 if (! defined $tag || defined $check) {
13665  
13666 return $axmud::CLIENT->writeImproper($self->_objClass . '->returnCairoColour', @_);
13667 }
13668  
13669 # Convert the colour tag to an RGB tag, in the form '#ABCDEF'
13670 $tag = $self->returnRGBColour($tag);
13671 if (! $tag) {
13672  
13673 return undef;
13674 }
13675  
13676 # Convert the 'AB', 'CD' and 'EF' portions to values in the range 0-1, and return them
13677 @list = (
13678 (hex (substr($tag, -6, 2)) / 255),
13679 (hex (substr($tag, -4, 2)) / 255),
13680 (hex (substr($tag, -2, 2)) / 255),
13681 );
13682  
13683 return \@list;
13684 }
13685  
13686 sub swapColours {
13687  
13688 # Can be called by anything
13689 # Converts a text colour tag into an underlay colour tag, or an underlay colour tag into a
13690 # text colour tag
13691 #
13692 # Expected arguments
13693 # (none besides $self)
13694 #
13695 # Optional arguments
13696 # $tag - A standard colour tag, e.g 'red' or 'UL_BLUE', an xterm colour tag,
13697 # e.g. 'x255' or 'ux255', or an RGB colour tag, e.g. '#FF0000' or
13698 # 'u#FF0000'. If 'undef', then 'undef' is returned
13699 #
13700 # Return values
13701 # 'undef' on improper arguments or if $tag is 'undef'
13702 # Otherwise returns the converted tag
13703  
13704 my ($self, $tag, $check) = @_;
13705  
13706 # Local variables
13707 my ($type, $underlayFlag);
13708  
13709 # Check for improper arguments
13710 if (defined $check) {
13711  
13712 return $axmud::CLIENT->writeImproper($self->_objClass . '->swapColours', @_);
13713 }
13714  
13715 if (! defined $tag) {
13716  
13717 return undef;
13718 }
13719  
13720 ($type, $underlayFlag) = $self->checkColourTags($tag);
13721 if ($type) {
13722  
13723 if ($type eq 'standard') {
13724  
13725 # Standard text colour tags
13726 if (! $underlayFlag) {
13727  
13728 if ($self->ivExists('constColourTagHash', $tag)) {
13729 $tag = 'ul_' . $tag;
13730 } else {
13731 $tag = 'UL_' . $tag;
13732 }
13733  
13734 # Standard underlay colour tags
13735 } else {
13736  
13737 # Remove the initial 'ul_' or 'UL_'
13738 $tag = substr($tag, 3);
13739 }
13740  
13741 # xterm text colour tags
13742 # RGB text colour tags
13743 } elsif (! $underlayFlag) {
13744  
13745 $tag = 'u' . $tag;
13746  
13747 # xterm underlay colour tags
13748 # RGB underlay colour tags
13749 } else {
13750  
13751 # Remove the initial 'u'
13752 $tag = substr($tag, 1);
13753 }
13754 }
13755  
13756 return $tag;
13757 }
13758  
13759 # Text-to-speech (TTS)
13760  
13761 sub tts {
13762  
13763 # Can be called by anything
13764 # Converts a string to audible speech, using one of the supported TTS engines. Never tries
13765 # to convert a string if it contains no alphanumeric characters (because if we send
13766 # unreadable text to the engine, there will be an unwelcome delay)
13767 #
13768 # This function processes its arguments into a standard list, then calls
13769 # $self->ttsAddJob to create a new TTS job. The job is added to a list, and jobs are
13770 # performed in sequence until the user interrupts that sequence (for example, with the
13771 # ';skip' command)
13772 #
13773 # Expected arguments
13774 # (none besides self)
13775 #
13776 # Optional arguments
13777 # $text - The text to convert to audible speech (if an empty string or 'undef', nothing
13778 # happens)
13779 # $type - The type of message to be converted: 'receive' for text received from the
13780 # world, 'system', 'error' for system messages, 'command' (or 'cmd') for a
13781 # world command, 'dialogue' for a 'dialogue' window or 'task' for a task
13782 # message or 'other' for something else (if an empty string or 'undef', the
13783 # type 'other' is used)
13784 # $configuration
13785 # - Name of the TTS configuration object to use, which specifies the engine,
13786 # voice, word speed and word pitch to use (a key in GA::Client->ttsObjHash; if
13787 # set to an empty string or 'undef', or if no TTS configuration object called
13788 # $name exists, the 'default' configuration object is used)
13789 # - If set to the dummy configuration 'none', nothing is read out
13790 # - If $self->forceTTSEngine, that is used as the configuration, overriding any
13791 # setting of $configuration besides 'none'
13792 # $session
13793 # - The calling GA::Session (can be set to 'undef' if there is no calling
13794 # session)
13795 # $engine, $voice, $speed, $rate, $pitch, $volume
13796 # - Set when called by GA::Cmd::Speak->do, in order to override the engine,
13797 # voice, speed and/or pitch of the specified $configuration (any that are set
13798 # to 'undef' are ignored). For $speed, $rate, $pitch and $volume, the values
13799 # (if defined) are in the range 0-100
13800 # $exclFlag
13801 # - Set to TRUE when called by GA::Cmd::Speak->do (or by any similar code),
13802 # meaning that the TTS configuration's exclusive/excluded patterns and the
13803 # world profile's command prompt patterns should not be checked. Set to FALSE
13804 # (or 'undef') if they should be checked as normal
13805 # $overrideFlag
13806 # - Set to TRUE when called by GA::Cmd::Speak->do (or by anything else), meaning
13807 # that the text should be converted even if GA::Client->systemAllowTTSFlag
13808 # is set to FALSE (subject to other checks)
13809 #
13810 # Return values
13811 # 'undef' on improper arguments, if $text contains no alphanumeric characters (or is
13812 # 'undef'), if TTS is disabled generally or if the text-to-speech conversion can't be
13813 # done for any other reason
13814 # 1 otherwise
13815  
13816 my (
13817 $self, $text, $type, $configuration, $session, $engine, $voice, $speed, $rate, $pitch,
13818 $volume, $exclFlag, $overrideFlag, $check,
13819 ) = @_;
13820  
13821 # Local variables
13822 my (
13823 $ttsObj, $cmd, $param, $begin, $end, $rateFlag, $pitchFlag, $volumeFlag, $string,
13824 @lineList, @modList, @finalList, @cmdList, @altCmdList, @promptList,
13825 );
13826  
13827 # Check for improper arguments
13828 if (defined $check) {
13829  
13830 return $axmud::CLIENT->writeImproper($self->_objClass . '->tts', @_);
13831 }
13832  
13833 # If no $text was specified or if TTS is disabled generally, there's nothing to convert
13834 # (We check for alphanumeric characters below)
13835 if (
13836 ! defined $text
13837 || $text eq ''
13838 || (! $self->systemAllowTTSFlag && ! $overrideFlag)
13839 ) {
13840 return undef;
13841 }
13842  
13843 # If the user specified a TTS engine from the command line, it overrides all other TTS
13844 # engines
13845 if (
13846 $self->forceTTSEngine
13847 && (! defined $configuration || $configuration ne 'none')
13848 ) {
13849 if (defined $configuration && $self->forceTTSEngine ne $configuration) {
13850  
13851 # Ignore the voice/speed/rate/pitch/volume specified by the calling function
13852 # GA::Cmd::Speak->do
13853 $voice = $speed = $rate = $pitch = $volume = undef;
13854 }
13855  
13856 $configuration = $self->forceTTSEngine;
13857 }
13858  
13859 # The TTS engine's system commands use " to contain the text portion, so if $text contains
13860 # any double quotes, replace them with single quotes
13861 $text =~ s/\"/\'/g;
13862  
13863 # Set the TTS configuration object (GA::Obj::Tts) to use, which specifies the TTS engine,
13864 # voice, word speed, word rate, word pitch and volume. If no TTS configuration object was
13865 # specified, use the default one
13866 if (
13867 ! $configuration
13868 || ! $self->ivExists('ttsObjHash', $configuration)
13869 ) {
13870 $configuration = 'default';
13871 }
13872  
13873 $ttsObj = $self->ivShow('ttsObjHash', $configuration);
13874  
13875 # Set the type of message, if none was specified (or if an invalid type was specified)
13876 if (
13877 ! $type
13878 || (
13879 $type ne 'receive' && $type ne 'system' && $type ne 'error' && $type ne 'command'
13880 && $type ne 'cmd' && $type ne 'dialogue' && $type ne 'task' && $type ne 'other'
13881  
13882 )
13883 ) {
13884 $type = 'other';
13885  
13886 } elsif ($type eq 'cmd') {
13887  
13888 $type = 'command';
13889 }
13890  
13891 # Set the engine (overriding the TTS configuration object, if necessary)
13892 if (! $engine) {
13893  
13894 $engine = $ttsObj->engine;
13895 }
13896  
13897 # Don't try to do text to speech with the dummy engine 'none', or with an unrecognisd
13898 # engine
13899 if (! $engine || $engine eq 'none' || ! defined $self->ivFind('constTTSList', $engine)) {
13900  
13901 return undef;
13902 }
13903  
13904 # Not all engines are supported all operating systems
13905 if ($^O eq 'MSWin32' && $engine eq 'flite') {
13906  
13907 return undef;
13908 }
13909  
13910 # The first time the Festival engine is specified, try to start the Festival server (but not
13911 # on MS Windows, for which we only support the command-line engine)
13912 if ($engine eq 'festival' && ! $self->ttsFestivalFirstFlag && $^O ne 'MSWin32') {
13913  
13914 $self->ivPoke('ttsFestivalFirstFlag', TRUE);
13915 # Only start the server if a port has been specified
13916 if (
13917 defined $self->ttsFestivalServerPort
13918 && $self->ttsFestivalServerPort ne ''
13919 ) {
13920 # Request that $self->ttsPerformJobs starts the server, and then connects to it
13921 $self->ivPush('ttsFestivalRequestList', 'start');
13922 }
13923 }
13924  
13925 # Set the voice, speed, rate, pitch and volume to use (overriding the TTS configuration
13926 # object, if necessary)
13927 if (! $voice) {
13928  
13929 $voice = $ttsObj->voice; # May still be 'undef'
13930 }
13931  
13932 if (! $speed) {
13933  
13934 $speed = $ttsObj->speed; # May still be 'undef'
13935 }
13936  
13937 if (! $rate) {
13938  
13939 $rate = $ttsObj->rate; # May still be 'undef'
13940 }
13941  
13942 if (! $pitch) {
13943  
13944 $pitch = $ttsObj->pitch; # May still be 'undef'
13945 }
13946  
13947 if (! $volume) {
13948  
13949 $volume = $ttsObj->volume; # May still be 'undef'
13950 }
13951  
13952 # Split $text into separate lines, so we can check each line before re-combining them for
13953 # TTS operations
13954 # Don't attempt to convert any lines which contain no alphanumeric characters
13955 foreach my $line (split("\n", $text)) {
13956  
13957 if ($line =~ m/[[:alnum:]]/) {
13958  
13959 push (@lineList, $line);
13960 }
13961 }
13962  
13963 if (! @lineList) {
13964  
13965 # There is no alphanumeric text to read
13966 return undef;
13967 }
13968  
13969 # For 'receive' text, check each line against the world profile's recognised command prompts
13970 # so the ';prompt' command can retrieve the most recent one
13971 if (! $exclFlag && $type eq 'receive') {
13972  
13973 OUTER: foreach my $line (@lineList) {
13974  
13975 INNER: foreach my $pattern ($session->currentWorld->cmdPromptPatternList) {
13976  
13977 # (To avoid having to check the patterns again below, compile two separate
13978 # lists)
13979 if ($line =~ m/$pattern/i) {
13980  
13981 push (@promptList, $line);
13982 }
13983 }
13984 }
13985  
13986 if (@promptList) {
13987  
13988 $self->ivPoke('ttsLastPrompt', $promptList[-1]);
13989 }
13990 }
13991  
13992 # Check each line of $text against exclusive/excluded patterns (unless the flag is set)
13993 if ($exclFlag) {
13994  
13995 @modList = @lineList;
13996  
13997 } else {
13998  
13999 OUTER: foreach my $line (@lineList) {
14000  
14001 my $matchFlag;
14002  
14003 if ($ttsObj->exclusiveList) {
14004  
14005 INNER: foreach my $pattern ($ttsObj->exclusiveList) {
14006  
14007 if ($line =~ m/$pattern/i) {
14008  
14009 $matchFlag = TRUE;
14010 last INNER;
14011 }
14012 }
14013  
14014 if ($matchFlag) {
14015  
14016 # $line matches an exclusive pattern, so we do convert it to speech
14017 push (@modList, $line);
14018 }
14019  
14020 } elsif ($ttsObj->excludedList) {
14021  
14022 INNER: foreach my $pattern ($ttsObj->excludedList) {
14023  
14024 if ($line =~ m/$pattern/i) {
14025  
14026 $matchFlag = TRUE;
14027 last INNER;
14028 }
14029 }
14030  
14031 if (! $matchFlag) {
14032  
14033 # $line does not match an excluded pattern, so we do convert it to speech
14034 push (@modList, $line);
14035 }
14036  
14037 } elsif ($type eq 'receive' && $self->ttsPromptFlag && $session->loginFlag) {
14038  
14039 INNER: foreach my $promptLine (@promptList) {
14040  
14041 if ($line eq $promptLine) {
14042  
14043 $matchFlag = TRUE;
14044 last INNER;
14045 }
14046 }
14047  
14048 if (! $matchFlag) {
14049  
14050 # $line does not match a recognised command prompt, so we do convert it to
14051 # speech
14052 push (@modList, $line);
14053 }
14054  
14055 } else {
14056  
14057 # No exclusive/excluded patterns to check
14058 push (@modList, $line);
14059 }
14060 }
14061  
14062 if (! @modList) {
14063  
14064 # No readable lines found, so don't perform TTS
14065 return undef;
14066 }
14067 }
14068  
14069 # Recombine the lines into a single string, so that the TTS engine reads them more naturally
14070 if ($type ne 'receive') {
14071  
14072 push (@finalList, join(' ', @modList));
14073  
14074 } else {
14075  
14076 # Text received from the world is handled a little differently
14077 if (! $self->ttsSmoothFlag) {
14078  
14079 # Don't recombine the lines. For most TTS engines, there will be an audible gap
14080 # between each line, but the user can use ';skip' and ';unskip' to replay whole
14081 # lines, exactly as they were received from the world
14082 @finalList = @modList;
14083  
14084 } else {
14085  
14086 # Split the text into artificial lines, ending with a full stop (etc). The user can
14087 # ';skip' and ';unskip' lines that correspond to sentences (as far as possible)
14088 $string = join(' ', @modList);
14089 @finalList = $string =~ m/[^\.\!\?]+[\.\!\?]*/g;
14090 }
14091 }
14092  
14093 # Create new TTS job(s), and add them to the job list
14094 foreach my $line (@finalList) {
14095  
14096 # Create a new TTS job, and add it to the job list
14097 $self->ttsAddJob($line, $engine, $voice, $speed, $rate, $pitch, $volume);
14098 }
14099  
14100 # Inform the calling session (if any) which type of message was most recently converted
14101 # to speech
14102 if ($session) {
14103  
14104 $session->set_ttsLastType($type);
14105 }
14106  
14107 # Operation complete
14108 return 1;
14109 }
14110  
14111 sub ttsCreateStandard {
14112  
14113 # Called by $self->start
14114 # Creates standard TTS configuration objects and stores them in the client registry
14115 #
14116 # Expected arguments
14117 # (none besides $self)s
14118 #
14119 # Return values
14120 # 'undef' on improper arguments, or if one of the standard zonemaps doesn't exist and
14121 # can't be created
14122 # 1 otherwise
14123  
14124 my ($self, $check) = @_;
14125  
14126 # Local variables
14127 my (
14128 $default,
14129 @list,
14130 );
14131  
14132 # Check for improper arguments
14133 if (defined $check) {
14134  
14135 return $axmud::CLIENT->writeImproper($self->_objClass . '->createStandardTTS', @_);
14136 }
14137  
14138 # First create standard TTS configuration objects for each supported TTS engine ('espeak',
14139 # 'esng', 'flite', 'festival', 'swift' and the dummy engine 'none')
14140 @list = $self->constTtsDefaultList;
14141  
14142 do {
14143  
14144 my ($engine, $voice, $speed, $rate, $pitch, $volume, $obj);
14145  
14146 $engine = shift @list;
14147 $voice = shift @list;
14148 $speed = shift @list;
14149 $rate = shift @list;
14150 $pitch = shift @list;
14151 $volume = shift @list;
14152  
14153 $obj = Games::Axmud::Obj::Tts->new(
14154 $engine, # This TTS configuration object has the same name as its engine
14155 $engine,
14156 $voice,
14157 $speed,
14158 $rate,
14159 $pitch,
14160 $volume,
14161 );
14162  
14163 if (! $obj) {
14164  
14165 return $self->writeError(
14166 'Cannot create the standard TTS configuration object \'' . $engine . '\'',
14167 $self->_objClass . '->createStandardTTS',
14168 );
14169  
14170 } else {
14171  
14172 $self->ivAdd('ttsObjHash', $engine, $obj);
14173 }
14174  
14175 } until (! @list);
14176  
14177 # Next create the remaining standard TTS configuration objects, copying settings from one of
14178 # the objects we created above
14179  
14180 # Decide which default engine to use, when $self->ttsObjHash doesn't specify one
14181 if ($^O ne 'MSWin32') {
14182  
14183 $default = 'espeak';
14184  
14185 } else {
14186  
14187 if (defined $self->msWinPathFestival && -e $self->msWinPathFestival) {
14188 $default = 'festival';
14189 } elsif (defined $self->msWinPathESNG && -e $self->msWinPathESNG) {
14190 $default = 'esng';
14191 } else {
14192 $default = 'espeak';
14193 }
14194 }
14195  
14196 # Create the remaining configurations
14197 foreach my $name ($self->ivKeys('constTtsObjHash')) {
14198  
14199 my ($copyName, $copyObj, $newObj);
14200  
14201 # If this TTS configuration object wasn't created above...
14202 if (! $self->ivExists('ttsObjHash', $name)) {
14203  
14204 # Copy settings from this already-created TTS configuration object
14205 $copyName = $self->ivShow('constTtsObjHash', $name);
14206 if (! defined $copyName) {
14207  
14208 $copyName = $default;
14209 }
14210  
14211 $copyObj = $self->ivShow('ttsObjHash', $copyName);
14212  
14213 # Create a new object, using the settings from $copyObj
14214 $newObj = Games::Axmud::Obj::Tts->new(
14215 $name,
14216 $copyObj->engine,
14217 $copyObj->voice,
14218 $copyObj->speed,
14219 $copyObj->rate,
14220 $copyObj->pitch,
14221 $copyObj->volume,
14222 );
14223  
14224 if (! $newObj) {
14225  
14226 return $self->writeError(
14227 'Cannot create the standard TTS configuration object \'' . $name . '\'',
14228 $self->_objClass . '->createStandardTTS',
14229 );
14230  
14231 } else {
14232  
14233 $self->ivAdd('ttsObjHash', $name, $newObj);
14234 }
14235 }
14236 }
14237  
14238 # Operation complete
14239 return 1;
14240 }
14241  
14242 sub ttsAssignAttribs {
14243  
14244 # Called by $self->loadPlugin and ->enablePlugin
14245 # Updates the customisabletext-to-speech (TTS) attribute hashes, to take account of a task
14246 # loaded from a plugin
14247 #
14248 # Expected arguments
14249 # $taskName - The newly-loaded task's standard name
14250 #
14251 # Return values
14252 # 'undef' on improper arguments or if the hashes can't be updated
14253 # 1 otherwise
14254  
14255 my ($self, $taskName, $check) = @_;
14256  
14257 # Local variables
14258 my ($packageName, $taskObj);
14259  
14260 # Check for improper arguments
14261 if (defined $check) {
14262  
14263 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsAssignAttribs', @_);
14264 }
14265  
14266 # Get the package name corresponding to $taskName (e.g. 'Games::Axmud::Task::Status',
14267 # 'Games::Axmud::Task::Divert')
14268 $packageName = Games::Axmud::Generic::Cmd->findTaskPackageName($self, $taskName);
14269 if (! defined $packageName) {
14270  
14271 return undef;
14272 }
14273  
14274 # Create a dummy task, so we can access its IVs
14275 $taskObj = $packageName->new($self);
14276 if (! $taskObj) {
14277  
14278 return undef;
14279 }
14280  
14281 # Update TTS attributes
14282 # # v1.2.036. For unknown reasons, calling Games::Axmud::ivKeys() while loading a plugin from
14283 # # ../share/private causes a stream of Perl errors. Workaround is to fetch the keys from
14284 # # the IV directly
14285 # foreach my $attrib ($taskObj->ivKeys('ttsAttribHash')) {
14286 foreach my $attrib (keys %{$taskObj->{'ttsAttribHash'}}) {
14287  
14288 # In $self->ttsAttribHash, any existing (probably built-in tasks) using the same
14289 # attribute are replaced with the task loaded from the plugin
14290 $self->ivAdd('ttsAttribHash', $attrib, $taskObj->name);
14291 }
14292  
14293 # foreach my $flagAttrib ($taskObj->ivKeys('ttsFlagAttribHash')) {
14294 foreach my $flagAttrib (keys %{$taskObj->{'ttsFlagAttribHash'}}) {
14295  
14296 $self->ivAdd('ttsFlagAttribHash', $flagAttrib, $taskObj->name);
14297 }
14298  
14299 # foreach my $alertAttrib ($taskObj->ivKeys('ttsAlertAttribHash')) {
14300 foreach my $alertAttrib (keys %{$taskObj->{'ttsAlertAttribHash'}}) {
14301  
14302 $self->ivAdd('ttsAlertAttribHash', $alertAttrib, $taskObj->name);
14303 }
14304  
14305 # Operation complete
14306 return 1;
14307 }
14308  
14309 sub ttsResetAttribs {
14310  
14311 # Called by $self->disablePlugin
14312 # Updates the customisable text-to-speech (TTS) attribute hashes, to remove any attributes
14313 # assigned to a task from the disabled plugin
14314 # If those attributes are assigned to one of Axmud's built-in tasks, those attributes are
14315 # re-assigned to the built-in task. Otherwise, they are removed from the attribute hashes
14316 # entirely
14317 # (This doesn't take account of a situation, in which an attribute is used by a built-in
14318 # task and two tasks from two different plugins. If one of the plugins is disabled, the
14319 # attribute is re-assigned to the built-in task, not the other plugin task. Not a perfect
14320 # system, but a practical one.)
14321 #
14322 # Expected arguments
14323 # $taskName - The task's standard name
14324 #
14325 # Return values
14326 # 'undef' on improper arguments or if the hashes can't be updated
14327 # 1 otherwise
14328  
14329 my ($self, $taskName, $check) = @_;
14330  
14331 # Local variables
14332 my ($packageName, $taskObj);
14333  
14334 # Check for improper arguments
14335 if (defined $check) {
14336  
14337 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsResetAttribs', @_);
14338 }
14339  
14340 # Get the package name corresponding to $taskName (e.g. 'Games::Axmud::Task::Status',
14341 # 'Games::Axmud::Task::Divert')
14342 $packageName = Games::Axmud::Generic::Cmd->findTaskPackageName($self, $taskName);
14343 if (! defined $packageName) {
14344  
14345 return undef;
14346 }
14347  
14348 # Create a dummy task, so we can access its IVs
14349 $taskObj = $packageName->new($self);
14350 if (! $taskObj) {
14351  
14352 return undef;
14353 }
14354  
14355 # Update TTS attributes
14356 foreach my $attrib ($taskObj->ivKeys('ttsAttribHash')) {
14357  
14358 if ($self->ivExists('constTtsAttribHash', $attrib)) {
14359  
14360 # Re-assign the attribute to a built-in task
14361 $self->ivAdd(
14362 'ttsAttribHash',
14363 $attrib,
14364 $self->ivShow('constTtsAttribHash', $attrib),
14365 );
14366  
14367 } else {
14368  
14369 # Delete the attribute
14370 $self->ivDelete('ttsAttribHash', $attrib);
14371 }
14372 }
14373  
14374 foreach my $flagAttrib ($taskObj->ivKeys('ttsFlagAttribHash')) {
14375  
14376 if ($self->ivExists('constTtsFlagAttribHash', $flagAttrib)) {
14377  
14378 # Re-assign the flag attribute to a built-in task
14379 $self->ivAdd(
14380 'ttsFlagAttribHash',
14381 $flagAttrib,
14382 $self->ivShow('constTtsFlagAttribHash', $flagAttrib),
14383 );
14384  
14385 } else {
14386  
14387 # Delete the flag attribute
14388 $self->ivDelete('ttsFlagAttribHash', $flagAttrib);
14389 }
14390 }
14391  
14392 foreach my $alertAttrib ($taskObj->ivKeys('ttsAlertAttribHash')) {
14393  
14394 if ($self->ivExists('constTtsAlertAttribHash', $alertAttrib)) {
14395  
14396 # Re-assign the alert attribute to a built-in task
14397 $self->ivAdd(
14398 'ttsAlertAttribHash',
14399 $alertAttrib,
14400 $self->ivShow('constTtsAlertAttribHash', $alertAttrib),
14401 );
14402  
14403 } else {
14404  
14405 # Delete the alert attribute
14406 $self->ivDelete('ttsAlertAttribHash', $alertAttrib);
14407 }
14408 }
14409  
14410 # Operation complete
14411 return 1;
14412 }
14413  
14414 # (TTS jobs)
14415  
14416 sub ttsReset {
14417  
14418 # Called by $self->set_customAllowTTSFlag when TTS has just been disabled
14419 # Interrupts any TTS jobs that might be in progress (halting any speech that the user can
14420 # hear), and resets TTS IVs to their default values
14421 #
14422 # Expected arguments
14423 # (none besides $self)
14424 #
14425 # Return values
14426 # 'undef' on improper arguments
14427 # 1 otherwise
14428  
14429 my ($self, $check) = @_;
14430  
14431 # Check for improper arguments
14432 if (defined $check) {
14433  
14434 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsReset', @_);
14435 }
14436  
14437 # Interrupt any speech being read aloud. The next call to $self->ttsPerformJobs will set
14438 # ->ttsCurrentHarness back to 'undef'
14439 $self->ttsInterruptJob();
14440  
14441 # Disconnect from the Festival server, if connected
14442 $self->ttsFestivalDisconnect();
14443  
14444 # Reset IVs
14445 $self->ivEmpty('ttsJobList');
14446 $self->ivEmpty('ttsUrgentJobList');
14447 $self->ivPoke('ttsJobMode', 'default');
14448 $self->ivPoke('ttsJobPointer', 0);
14449 $self->ivPoke('ttsJobMiniPointer', 0);
14450 $self->ivPoke('ttsJobAutoFlag', TRUE);
14451 $self->ivPoke('ttsJobOnceFlag', TRUE);
14452 $self->ivPoke('ttsChangeModeFlag', FALSE);
14453 # $self->ivUndef('ttsCurrentHarness');
14454  
14455 $self->ivPoke('ttsFestivalServerMode', 'cmd_line');
14456 $self->ivPoke('ttsFestivalConnectMode', 'cmd_line');
14457 $self->ivUndef('ttsFestivalSocket');
14458 $self->ivEmpty('ttsFestivalRequestList');
14459 $self->ivUndef('ttsFestivalCheckTime');
14460 $self->ivPoke('ttsFestivalFailFlag', FALSE);
14461 # (Still don't start the server again, if a previous attempt succeeded)
14462 # $self->ivPoke('ttsFestivalSuccessFlag', FALSE);
14463  
14464 return 1;
14465 }
14466  
14467 sub ttsRestart {
14468  
14469 # Called by $self->connectBlind, just before it calls ->startSession
14470 # The initial dialogue windows have almost certainly interrupted the job list, so when the
14471 # session starts, received text won't be read aloud until the ;skip, ;resume (etc)
14472 # commands are used
14473 # This is a less extreme version of $self->ttsReset. Empties the job list (but not the
14474 # urgent job list or the request list), and resets some IVs, so that the session's text
14475 # can be converted to speech almost immediately (i.e. after the end of any urgent jobs
14476 # created by the initial dialogue windows)
14477 #
14478 # Expected arguments
14479 # (none besides ($self)
14480 #
14481 # Return values
14482 # 'undef' on improper arguments
14483 # 1 otherwise
14484  
14485 my ($self, $check) = @_;
14486  
14487 # Check for improper arguments
14488 if (defined $check) {
14489  
14490 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsRestart', @_);
14491 }
14492  
14493 # Reset IVs
14494 $self->ivEmpty('ttsJobList');
14495 $self->ivPoke('ttsJobMode', 'default');
14496 $self->ivPoke('ttsJobPointer', 0);
14497 $self->ivPoke('ttsJobMiniPointer', 0);
14498 $self->ivPoke('ttsJobAutoFlag', TRUE);
14499 $self->ivPoke('ttsJobOnceFlag', TRUE);
14500 $self->ivPoke('ttsChangeModeFlag', FALSE);
14501  
14502 return 1;
14503 }
14504  
14505 sub ttsAddJob {
14506  
14507 # Called by $self->tts (only)
14508 # Creates a new TTS job, and adds it to the job list (deleting the oldest job, if the list
14509 # is now too long)
14510 #
14511 # Expected arguments
14512 # $text - The text to convert to speech (should not be an empty string)
14513 # $engine - TTS engine to use (must be one of the values in
14514 # GA::CLIENT->constTTSList)
14515 #
14516 # Optional arguments
14517 # $voice - Voice used with the TTS engine (eSpeak, espeak-ng, Flite, Festival server,
14518 # Swift only; ignored when the engine is Festival command line). If an
14519 # empty string or 'undef', the engine's default voice is used
14520 # $speed - Word speed used with the TTS engine (eSpeak and espeak-ng only; ignored
14521 # for other engines). A value in the range 0-100. If an invalid value or
14522 # 'undef', the engine's default speed is used
14523 # $rate - Word rate used with the TTS engine (Festival server and Swift only;
14524 # ignored for other engines, including Festival command line). A value in
14525 # the range 0-100. If an invalid value or 'undef', the engine's default
14526 # rate is used
14527 # $pitch - Word pitch used with the TTS engine (eSpeak and Swift only; ignored for
14528 # other engines). A value in the range 0-100. If an invalid value or
14529 # 'undef', the engine's default pitch is used
14530 # $volume - Volume used with the TTS engine (Festival server and Swift only; ignored
14531 # for other engines, including Festival command line). A value in the
14532 # range 0-100. If an invalid value or 'undef', the engine's default pitch
14533 # is used
14534 # Return values
14535 # 'undef' on improper arguments or if the job can't be created
14536 # 1 otherwise
14537  
14538 my ($self, $text, $engine, $voice, $speed, $rate, $pitch, $volume, $check) = @_;
14539  
14540 # Local variables
14541 my $jobObj;
14542  
14543 # Check for improper arguments
14544 if (! defined $text || ! defined $engine || defined $check) {
14545  
14546 return $axmud::CLIENT->writeImproper($self->_objClass . '->openURL', @_);
14547 }
14548  
14549 # Create the TTS job
14550 $jobObj = Games::Axmud::Obj::TtsJob->new(
14551 $text,
14552 $engine,
14553 $voice,
14554 $speed,
14555 $rate,
14556 $pitch,
14557 $volume,
14558 );
14559  
14560 if (! $jobObj) {
14561  
14562 return undef;
14563  
14564 } else {
14565  
14566 # Add the new job to the list, deleting the oldest job, if the list is now too long
14567 $self->ivPush('ttsJobList', $jobObj);
14568 if ((scalar $self->ttsJobList) > $self->ttsJobMax) {
14569  
14570 $self->ivShift('ttsJobList');
14571 }
14572  
14573 if ($self->ttsJobPointer == -1) {
14574  
14575 $self->ivPoke('ttsJobPointer', ((scalar $self->ttsJobList) - 1));
14576 }
14577  
14578 return 1;
14579 }
14580 }
14581  
14582 sub ttsAddUrgentJob {
14583  
14584 # Can be called by anything to add a job to $self->ttsUrgentJobList. Jobs on this list are
14585 # performed immediately, and before any job in $self->ttsJobList
14586 # Currently used only for system messages that must be read aloud immediately
14587 #
14588 # Expected arguments
14589 # $text - The text to convert to speech (should not be an empty string)
14590 #
14591 # Optional arguments
14592 # $configName - The name of the TTS configuration to use. If 'undef' or an
14593 # unrecognised name, uses the 'system' configuration
14594 # $overrideFlag - If TRUE, the urgent job list is emptied, before this job is added. If
14595 # FALSE (or 'undef'), other urgent jobs are performed first
14596 # $engine, $voice, $speed, $rate, $pitch, $volume
14597 # - Values which, if specified, override those specified by the TTS
14598 # configuration
14599 #
14600 # Return values
14601 # 'undef' on improper arguments or if the job can't be created
14602 # 1 otherwise
14603  
14604 my (
14605 $self, $text, $configName, $overrideFlag, $engine, $voice, $speed, $rate, $pitch,
14606 $volume, $check
14607 ) = @_;
14608  
14609 # Local variables
14610 my ($configObj, $jobObj);
14611  
14612 # Check for improper arguments
14613 if (! defined $text || defined $check) {
14614  
14615 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsAddUrgentJob', @_);
14616 }
14617  
14618 # Set values to use
14619 if (! defined $configName || ! $self->ivExists('ttsObjHash', $configName)) {
14620  
14621 $configName = 'system'
14622 }
14623  
14624 $configObj = $self->ivShow('ttsObjHash', $configName);
14625  
14626 if (! defined $engine) {
14627  
14628 $engine = $configObj->engine;
14629 }
14630  
14631 if (! defined $voice) {
14632  
14633 $voice = $configObj->voice;
14634 }
14635  
14636 if (! defined $speed) {
14637  
14638 $speed = $configObj->speed;
14639 }
14640  
14641 if (! defined $rate) {
14642  
14643 $rate = $configObj->rate;
14644 }
14645  
14646 if (! defined $pitch) {
14647  
14648 $pitch = $configObj->pitch;
14649 }
14650  
14651 if (! defined $volume) {
14652  
14653 $volume = $configObj->volume;
14654 }
14655  
14656 # Create the TTS job
14657 $jobObj = Games::Axmud::Obj::TtsJob->new(
14658 $text,
14659 $engine,
14660 $voice,
14661 $speed,
14662 $rate,
14663 $pitch,
14664 $volume,
14665 TRUE, # This is an urgent job
14666 );
14667  
14668 if (! $jobObj) {
14669  
14670 return undef;
14671  
14672 } else {
14673  
14674 # Add the new job to the urgent list
14675 if ($overrideFlag) {
14676 $self->ivPoke('ttsUrgentJobList', $jobObj);
14677 } else {
14678 $self->ivPush('ttsUrgentJobList', $jobObj);
14679 }
14680  
14681 # Interrupt any ongoing TTS
14682 $self->ttsInterruptJob();
14683 # Update other IVs, as if the user had typed ';shutup' (unless we are alrady at the end
14684 # of the list; in that case, it's better to keep reading aloud new incoming text)
14685 if ($self->ttsJobPointer > -1) {
14686  
14687 $self->ivPoke('ttsJobAutoFlag', FALSE);
14688 $self->ivPoke('ttsJobOnceFlag', FALSE);
14689 }
14690  
14691 return 1;
14692 }
14693 }
14694  
14695 sub ttsPerformJobs {
14696  
14697 # Called by $self->spinClientLoop (only)
14698 # This function does three things on every spin of the client loop:
14699 # 1. TTS requested actions are used to handle Axmud's connection to a Festival server. If
14700 # requested actions have been made, executes the first one and returns, without
14701 # executing any more actions or performing any TTS jobs
14702 # 2. If a previous call to this function has sent text to a TTS engine, checks to see
14703 # whether the TTS conversion has been completed, and updates IVs if so
14704 # 3. A TTS job comprises a piece of text to be converted to speech (by sending the text to
14705 # a TTS engine). The text is sometimes split into pieces (sentences or words), and
14706 # converted to speech one piece at a time. If TTS jobs are waiting to be performed,
14707 # performs the first one. Any 'urgent' TTS jobs take priority over other jobs.
14708 # Performing a job comprises converting the whole text to speech, or just one
14709 # sentence/word of it. (Subsequent jobs are performed in future calls to this
14710 # function)
14711 #
14712 # Expected arguments
14713 # (none besides $self)
14714 #
14715 # Return values
14716 # 'undef' on improper arguments
14717 # 1 otherwise
14718  
14719 my ($self, $check) = @_;
14720  
14721 # Local variables
14722 my (
14723 $request, $jobObj, $urgentFlag,
14724 @cmdList,
14725 );
14726  
14727 # Check for improper arguments
14728 if (defined $check) {
14729  
14730 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsPerformJobs', @_);
14731 }
14732  
14733 # Perform the first requested action for the Festival server
14734 # (Perform only one request per spin of the client loop, giving the Festival server a chance
14735 # to start up, before we try to connect to it. Ignore any invalid requests)
14736 $request = $self->ivShift('ttsFestivalRequestList');
14737 if (defined $request) {
14738  
14739 if ($request eq 'disconnect' && $self->ttsFestivalSocket) {
14740  
14741 # Disconnect from a Festival server
14742 $self->ttsFestivalDisconnect();
14743  
14744 } elsif ($request eq 'start') {
14745  
14746 # Start the Festival server
14747 $self->ttsFestivalStart();
14748  
14749 } elsif ($request eq 'connect' && ! $self->ttsFestivalSocket) {
14750  
14751 # Connect to a Festival server
14752 if (! $self->ttsFestivalConnect()) {
14753  
14754 if (defined $self->ttsFestivalCheckTime) {
14755  
14756 # When the server has just been started, we wait a few seconds before giving
14757 # up trying to connect to it, rather than giving up immediately, as we
14758 # ordinarly would
14759 if ($self->ttsFestivalCheckTime > $self->getTime()) {
14760  
14761 # Process this same request again, on the next spin of the client loop
14762 $self->ivUnshift('ttsFestivalRequestList', $request);
14763  
14764 } else {
14765  
14766 # We have been waiting too long, so give up
14767 $self->ivUndef('ttsFestivalCheckTime');
14768 # Default to using the command-line engine
14769 $self->ivPoke('ttsFestivalServerMode', 'cmd_line');
14770 $self->ivPoke('ttsFestivalConnectMode', 'cmd_line');
14771 }
14772  
14773 } else {
14774  
14775 # Failed once-only connection. Default to using the command-line engine
14776 $self->ivPoke('ttsFestivalServerMode', 'cmd_line');
14777 $self->ivPoke('ttsFestivalConnectMode', 'cmd_line');
14778 }
14779  
14780 } else {
14781  
14782 # Make sure the IV is reset after a successful connection
14783 $self->ivUndef('ttsFestivalCheckTime');
14784 }
14785 }
14786  
14787 # Do not perform any more requests, or any more jobs, until the next spin of the
14788 # client loop. (This gives us time to connect to a Festival server, before doing
14789 # text-to-speech)
14790 return 1;
14791 }
14792  
14793 # If text was being converted to speech during the last spin of the client loop, see if it's
14794 # finished yet
14795 if ($self->ttsCurrentHarness) {
14796  
14797 if ($self->ttsCurrentHarness->pumpable()) {
14798  
14799 # TTS conversion in progress; wait for the next spin of the client loop before
14800 # performing the next job, if any
14801 return 1;
14802  
14803 } else {
14804  
14805 # TTS conversion completed; update the IV
14806 $self->ivUndef('ttsCurrentHarness');
14807 }
14808 }
14809  
14810 # Perform the current TTS job, if it's waiting to be performed
14811 if (
14812 ($self->ttsJobAutoFlag || $self->ttsJobOnceFlag)
14813 || $self->ttsUrgentJobList
14814 ) {
14815 # Get the next job, if any. 'Urgent' jobs take priority over everything else
14816 $jobObj = $self->ivShift('ttsUrgentJobList');
14817 if (! $jobObj) {
14818  
14819 $jobObj = $self->ttsGetNextJob();
14820 if ($jobObj) {
14821  
14822 # Set the value of GA::Obj::TtsJob->currentText which, depending on the value of
14823 # $self->ttsJobMode, will be the whole of its ->text, or just a sentence, or
14824 # just a single word
14825 # (This does not apply to 'urgen't jobs, which are always performed with their
14826 # entire ->text)
14827 $jobObj->prepareText();
14828 }
14829 }
14830  
14831 if ($jobObj) {
14832  
14833 # Retrieve values from the GA::Obj::TtsJob, and convert them into a list of
14834 # parameters to be used in the system command
14835 @cmdList = $self->ttsPrepareSystemCmd($jobObj);
14836 if (@cmdList) {
14837  
14838 # Mark this job's text as having been converted to speech at least once (and
14839 # perhaps only partially)
14840 $jobObj->ivPoke('newFlag', FALSE);
14841  
14842 # Convert text to speech using the Festival engine
14843 if ($jobObj->engine eq 'festival') {
14844  
14845 if (
14846 $self->ttsFestivalConnectMode eq 'connected'
14847 && ($^O ne 'MSWin32')
14848 ) {
14849 # Use the server engine. If the socket has closed,
14850 # $self->ttsFestivalServerMode is updated. We never use the server
14851 # engine on MS windows
14852 $self->ttsFestivalSend($cmdList[0]);
14853 }
14854  
14855 if ($self->ttsFestivalServerMode eq 'cmd_line') {
14856  
14857 # Use the command-line engine
14858 # The first argument in @cmdList is for the server engine, so discard it
14859 shift @cmdList;
14860 # The rest of @cmdList is already in the correct format for
14861 # IPC::Run::start, so we don't need to take out a reference on it,
14862 # as we do for all other engines
14863 if ($^O ne 'MSWin32') {
14864  
14865 eval {
14866 $self->ivPoke('ttsCurrentHarness', IPC::Run::start(@cmdList));
14867 };
14868  
14869 } else {
14870  
14871 # N.B. In order for this to work, the IPC::Run code itself must be
14872 # modified. See the notes in ../axmud/nsis/axmud.install.nsi
14873 eval {
14874 $self->ivPoke(
14875 'ttsCurrentHarness',
14876 IPC::Run::start_festival(@cmdList),
14877 );
14878 };
14879 }
14880 }
14881  
14882 # Convert text to speech using all other supported engines
14883 } else {
14884  
14885 # All engines except Festival
14886 eval { $self->ivPoke('ttsCurrentHarness', IPC::Run::start(\@cmdList)); };
14887 }
14888 }
14889  
14890 # (Urgent jobs do not affect our pointers at all)
14891 if (! $jobObj->urgentFlag) {
14892  
14893 # Move the pointer(s) to the next word, sentence or job, if necessary
14894 if ($self->ttsJobAutoFlag) {
14895  
14896 # On the next spin of the loop, perform the job after this one (if required)
14897 $self->ttsAdvancePointer();
14898  
14899 } elsif ($self->ttsJobOnceFlag) {
14900  
14901 # The job we've just performed is only performed once
14902 $self->ivPoke('ttsJobOnceFlag', FALSE);
14903 }
14904  
14905 # Update the IV which prevents ;skip from going straight to the second sentence/
14906 # word in a job, after a change to $self->ttsJobMode
14907 $self->ivPoke('ttsChangeModeFlag', FALSE);
14908 }
14909 }
14910 }
14911  
14912 # Wait for the next spin of the client loop
14913 return 1;
14914 }
14915  
14916 sub ttsGetNextJob {
14917  
14918 # Called by $self->ttsPerformJobs
14919 # A pointer specifies which TTS job in the job list is the next one to be performed
14920 # Depending on current settings, either return the job, or return 'undef' if there is no job
14921 # to perform
14922 #
14923 # Expected arguments
14924 # (none)
14925 #
14926 # Return values
14927 # 'undef' on improper arguments or if there is no job to perform
14928 # Otherwise, returns the GA::Obj::TTSJob object for the next job to perform
14929  
14930 my ($self, $check) = @_;
14931  
14932 # Check for improper arguments
14933 if (defined $check) {
14934  
14935 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsGetNextJob', @_);
14936 }
14937  
14938 if ($self->ttsJobAutoFlag || $self->ttsJobOnceFlag) {
14939  
14940 if (! $self->ttsJobList || $self->ttsJobPointer == -1) {
14941  
14942 # Job list is empty, or all jobs already performed (so pointer is at the end of the
14943 # list)
14944 return undef;
14945  
14946 } else {
14947  
14948 # A job is waiting to be performed
14949 return $self->ttsReadJob($self->ttsJobPointer);
14950 }
14951 }
14952 }
14953  
14954 sub ttsReadJob {
14955  
14956 # Called by $self->ttsGetNextJob, ->ttsAdvancePointer and ->ttsRegressPointer
14957 # A pointer specifies which TTS job in the job list is the next one to be performed
14958 # Read the next job and return it
14959 #
14960 # Expected arguments
14961 # $pointer - An index in $self->ttsJobList, pointing at a GA::Obj::TtsJob object
14962 #
14963 # Return values
14964 # 'undef' on improper arguments or if there is no job to perform
14965 # Otherwise, returns the GA::Obj::TTSJob object for the next job to perform
14966  
14967 my ($self, $pointer, $check) = @_;
14968  
14969 # Check for improper arguments
14970 if (! defined $pointer || defined $check) {
14971  
14972 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsReadJob', @_);
14973 }
14974  
14975 # (The calling function should have checked that the list contains jobs, and that the
14976 # pointer is not at the end of the list)
14977 if (! $self->ttsJobList || $pointer == -1) {
14978  
14979 return undef;
14980  
14981 } else {
14982  
14983 return $self->ivIndex('ttsJobList', $pointer);
14984 }
14985 }
14986  
14987 sub ttsAdvancePointer {
14988  
14989 # Called by $self->ttsPerformJobs and ->ttsSkipJob
14990 #
14991 # Two pointers specify the next piece of text to be converted to speech
14992 # $self->ttsJobPointer points to an index in $self->ttsJobList, corresponding to a
14993 # GA::Obj::TtsJob object. If the pointer is at the end of the list, its value is -1
14994 # $self->ttsJobMiniPointer points to a position in that job's text (the first character is
14995 # 0)
14996 #
14997 # Move the pointers from their current position, to the next position (the next job, and/or
14998 # the next sentence/word in the current job)
14999 #
15000 # Expected arguments
15001 # (none besides ($self)
15002 #
15003 # Return values
15004 # 'undef' on improper arguments or if there's an error
15005 # 1 otherwise
15006  
15007 my ($self, $check) = @_;
15008  
15009 # Local variables
15010 my ($jobObj, $mode, $result);
15011  
15012 # Check for improper arguments
15013 if (defined $check) {
15014  
15015 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsAdvancePointer', @_);
15016 }
15017  
15018 # (Don't do anything if the job list is empty, or if the pointer is already at the end of
15019 # the list)
15020 if ($self->ttsJobList && $self->ttsJobPointer > -1) {
15021  
15022 $jobObj = $self->ttsReadJob($self->ttsJobPointer);
15023 if (! $jobObj) {
15024  
15025 # Some kind of error. Mark the pointer at the end of the list
15026 $self->ivPoke('ttsJobPointer', -1);
15027 $self->ivPoke('ttsJobMiniPointer', 0);
15028 # When we reach the end of the list, resume auto-reading text
15029 $self->ivPoke('ttsJobAutoFlag', TRUE);
15030  
15031 return undef;
15032 }
15033  
15034 $mode = $self->ttsJobMode;
15035  
15036 if ($mode eq 'sentence' && ! $self->ttsJobAutoFlag) {
15037  
15038 # Advance the pointer(s), one sentence at a time
15039 $result = $jobObj->findNextSentence($self->ttsJobMiniPointer);
15040 if (! defined $result) {
15041  
15042 # The mini-pointer is already pointing to the start of the last sentence.
15043 # Advance the pointer to the beginning of the next line
15044 $mode = 'default';
15045  
15046 } else {
15047  
15048 $self->ivPoke('ttsJobMiniPointer', $result);
15049 }
15050  
15051 } elsif ($mode eq 'word' && ! $self->ttsJobAutoFlag) {
15052  
15053 # Advance the pointer(s), one word at a time
15054 $result = $jobObj->findNextWord($self->ttsJobMiniPointer);
15055 if (! defined $result) {
15056  
15057 # The mini-pointer is already pointing to the start of the last word. Advance
15058 # the pointer to the beginning of the next line
15059 $mode = 'default';
15060  
15061 } else {
15062  
15063 $self->ivPoke('ttsJobMiniPointer', $result);
15064 }
15065 }
15066  
15067 if ($mode eq 'default' || $self->ttsJobAutoFlag) {
15068  
15069 # Advance the main pointer to the next job
15070 if ($self->ttsJobPointer >= ((scalar $self->ttsJobList) - 1)) {
15071  
15072 # Now at the end of the job list
15073 $self->ivPoke('ttsJobPointer', -1);
15074 $self->ivPoke('ttsJobMiniPointer', 0);
15075 # When we reach the end of the list, resume auto-reading text
15076 $self->ivPoke('ttsJobAutoFlag', TRUE);
15077  
15078 } else {
15079  
15080 # Move the pointer to the next job in the list
15081 $self->ivIncrement('ttsJobPointer');
15082 $self->ivPoke('ttsJobMiniPointer', 0);
15083 }
15084 }
15085 }
15086  
15087 return 1;
15088 }
15089  
15090 sub ttsRegressPointer {
15091  
15092 # Called by $self->ttsUnskipJob and ->ttsLastJob
15093 #
15094 # Two pointers specify the next piece of text to be converted to speech
15095 # $self->ttsJobPointer points to an index in $self->ttsJobList, corresponding to a
15096 # GA::Obj::TtsJob object. If the pointer is at the end of the list, its value is -1
15097 # $self->ttsJobMiniPointer points to a position in that job's text (the first character is
15098 # 0)
15099 #
15100 # Move the pointers from their current position, to the previous position (the previous job,
15101 # and/or the previous sentence/word in the current job)
15102 #
15103 # Expected arguments
15104 # (none besides ($self)
15105 #
15106 # Return values
15107 # 'undef' on improper arguments or if there's an error
15108 # 1 otherwise
15109  
15110 my ($self, $check) = @_;
15111  
15112 # Local variables
15113 my ($jobObj, $mode, $result, $updateFlag, $pointer, $newJobObj);
15114  
15115 # Check for improper arguments
15116 if (defined $check) {
15117  
15118 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsRegressPointer', @_);
15119 }
15120  
15121 # (Don't do anything if the job list is empty, or if both pointers are already at the
15122 # beginning of the list)
15123 if ($self->ttsJobList && ($self->ttsJobPointer != 0 || $self->ttsJobMiniPointer != 0)) {
15124  
15125 $mode = $self->ttsJobMode;
15126  
15127 if ($self->ttsJobPointer != -1) {
15128  
15129 $jobObj = $self->ttsReadJob($self->ttsJobPointer);
15130 if (! $jobObj) {
15131  
15132 # Some kind of error. Mark the pointer at the beginning of the list
15133 $self->ivPoke('ttsJobPointer', 0);
15134 $self->ivPoke('ttsJobMiniPointer', 0);
15135  
15136 return undef;
15137 }
15138  
15139 } elsif ($mode eq 'sentence' || $mode eq 'word') {
15140  
15141 # The main pointer is at the end of the list. Allow the code below to regress the
15142 # pointer to the previous job, then the last sentence/word in that job
15143 $mode = 'default';
15144 $updateFlag = TRUE;
15145 }
15146  
15147 if ($mode eq 'sentence') {
15148  
15149 # Regress the pointer(s), one sentence at a time
15150 $result = $jobObj->findPreviousSentence($self->ttsJobMiniPointer);
15151 if (! defined $result) {
15152  
15153 # The mini-pointer is already pointing to the start of the first sentence (or
15154 # there was an error)
15155 # Regress the pointer to the last sentence in the previous line
15156 $mode = 'default';
15157 if ($self->ttsJobPointer != 0) {
15158  
15159 $updateFlag = TRUE;
15160 }
15161  
15162 } else {
15163  
15164 $self->ivPoke('ttsJobMiniPointer', $result);
15165 }
15166  
15167 } elsif ($mode eq 'word') {
15168  
15169 # Regress the pointer(s), one word at a time
15170 $result = $jobObj->findPreviousWord($self->ttsJobMiniPointer);
15171 if (! defined $result) {
15172  
15173 # The mini-pointer is already pointing to the start of the first word (or
15174 # there was an error)
15175 # Regress the pointer to the last word in the previous line
15176 $mode = 'default';
15177 if ($self->ttsJobPointer != 0) {
15178  
15179 $updateFlag = TRUE;
15180 }
15181  
15182 } else {
15183  
15184 $self->ivPoke('ttsJobMiniPointer', $result);
15185 }
15186 }
15187  
15188 if ($mode eq 'default') {
15189  
15190 # Regress the pointer to the previous job
15191 if ($self->ttsJobPointer == -1) {
15192 $pointer = scalar $self->ttsJobList;
15193 } else {
15194 $pointer = $self->ttsJobPointer;
15195 }
15196  
15197 if ($pointer > 0) {
15198  
15199 $pointer--;
15200 }
15201  
15202 $self->ivPoke('ttsJobPointer', $pointer);
15203 $self->ivPoke('ttsJobMiniPointer', 0);
15204  
15205 if ($updateFlag) {
15206  
15207 $newJobObj = $self->ttsReadJob($self->ttsJobPointer);
15208 if ($newJobObj) {
15209  
15210 if ($self->ttsJobMode eq 'sentence') {
15211 $result = $newJobObj->findPreviousSentence(length($newJobObj->text));
15212 } else {
15213 $result = $newJobObj->findPreviousWord(length($newJobObj->text));
15214 }
15215  
15216 if (! defined $result) {
15217  
15218 # The previous job contains only one sentence/word
15219 $self->ivPoke('ttsJobMiniPointer', 0);
15220  
15221 } else {
15222  
15223 # The previous job contains multiple sentences/words
15224 $self->ivPoke('ttsJobMiniPointer', $result);
15225 }
15226 }
15227 }
15228 }
15229 }
15230  
15231 return 1;
15232 }
15233  
15234 sub ttsSkipJob {
15235  
15236 # Can be called by anything (but usually called by GA::Cmd::Skip->do)
15237 # Depending on the value of $self->ttsJobMode, interrupt any text currently being converted
15238 # to speech, and move the pointers to the next job, or the next sentence or word in the
15239 # current job
15240 #
15241 # Expected arguments
15242 # (none besides ($self)
15243 #
15244 # Optional arguments
15245 # $jobCount - If specified, must be an integer, 1 or above. Override the normal
15246 # behaviour by resetting IVs to their default values, then skipping
15247 # the specified number of jobs in the list (or to the last job in the
15248 # list, if there aren't enough jobs)
15249 #
15250 # Return values
15251 # 'undef' on improper arguments
15252 # 1 otherwise
15253  
15254 my ($self, $jobCount, $check) = @_;
15255  
15256 # Check for improper arguments
15257 if ((defined $jobCount && ! $self->intCheck($jobCount, 1)) || defined $check) {
15258  
15259 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsSkipJob', @_);
15260 }
15261  
15262 # Advance the pointer, in order to perform the next job, if necessary
15263 if ($self->ttsJobList) {
15264  
15265 if (! defined $jobCount) {
15266  
15267 if (
15268 # (When this flag is set, the pointer has already been advanced by
15269 # ->ttsPerformJobs)
15270 ! $self->ttsJobAutoFlag
15271 # (When this flag is set, there has been a change in $self->ttsJobMode. Let the
15272 # user hear the first sentence/word in the job, not the second one)
15273 && ! $self->ttsChangeModeFlag
15274 ) {
15275 $self->ttsAdvancePointer();
15276 }
15277  
15278 } else {
15279  
15280 if ($self->ttsJobPointer != -1) {
15281  
15282 $self->ivPoke('ttsJobPointer', ($self->ttsJobPointer + $jobCount));
15283 }
15284  
15285 if ($self->ttsJobPointer >= scalar ($self->ttsJobList)) {
15286  
15287 $self->ivPoke('ttsJobPointer', -1);
15288 }
15289  
15290 $self->ivPoke('ttsJobMiniPointer', 0);
15291 }
15292  
15293 $self->ivPoke('ttsChangeModeFlag', FALSE);
15294 if ($self->ttsJobPointer > -1 && ! $self->ttsJobAutoFlag) {
15295  
15296 $self->ivPoke('ttsJobOnceFlag', TRUE);
15297 }
15298  
15299 # Interrupt any text being converted to speech right now, allowing the next job to
15300 # start as quickly as possible
15301 $self->ttsInterruptJob();
15302 }
15303  
15304 return 1;
15305 }
15306  
15307 sub ttsUnskipJob {
15308  
15309 # Can be called by anything (but usually called by GA::Cmd::Unskip->do)
15310 # Depending on the value of $self->ttsJobMode, interrupt any text currently being converted
15311 # to speech, and move the pointers to the previous job, or the previous sentence or word
15312 # in the current job
15313 #
15314 # Expected arguments
15315 # (none besides ($self)
15316 #
15317 # Optional arguments
15318 # $jobCount - If specified, must be an integer, 1 or above. Override the normal
15319 # behaviour by resetting IVs to their default values, then unskipping
15320 # the specified number of jobs in the list (or to the first job in the
15321 # list, if there aren't enough jobs)
15322 #
15323 # Return values
15324 # 'undef' on improper arguments
15325 # 1 otherwise
15326  
15327 my ($self, $jobCount, $check) = @_;
15328  
15329 # Check for improper arguments
15330 if ((defined $jobCount && ! $self->intCheck($jobCount, 1)) || defined $check) {
15331  
15332 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsUnskipJob', @_);
15333 }
15334  
15335 if ($self->ttsJobList) {
15336  
15337 if (! defined $jobCount) {
15338  
15339 if ($self->ttsJobAutoFlag && $self->ttsCurrentHarness) {
15340  
15341 # A job is being performed right now, and the pointer has already been advanced
15342 # to the next job; therefore, to get the previous line/sentence/word, we need
15343 # to regress the pointer twice
15344 $self->ttsRegressPointer();
15345 }
15346  
15347 # If the pointer is already at the beginning of the list, re-perform the first job
15348 # in the list
15349 # (This doesn't happen when we're at the end of the list, and $self->ttsSkipJob is
15350 # called)
15351 $self->ttsRegressPointer();
15352  
15353 } else {
15354  
15355 if ($self->ttsJobPointer != -1) {
15356  
15357 $self->ivPoke('ttsJobPointer', ($self->ttsJobPointer - $jobCount));
15358 } else {
15359 $self->ivPoke('ttsJobPointer', ((scalar $self->ttsJobList) - $jobCount - 1));
15360 }
15361  
15362 if ($self->ttsJobPointer < 0) {
15363  
15364 $self->ivPoke('ttsJobPointer', 0);
15365 }
15366  
15367 $self->ivPoke('ttsJobMiniPointer', 0);
15368 }
15369  
15370 $self->ivPoke('ttsJobAutoFlag', FALSE);
15371 $self->ivPoke('ttsJobOnceFlag', TRUE);
15372  
15373 # Interrupt any text being converted to speech right now, allowing the next job to
15374 # start as quickly as possible
15375 $self->ttsInterruptJob();
15376 }
15377  
15378 return 1;
15379 }
15380  
15381 sub ttsFirstJob {
15382  
15383 # Can be called by anything (but usually called by GA::Cmd::First->do)
15384 # Depending on the value of $self->ttsJobMode, interrupt any text currently being converted
15385 # to speech, and move the pointers to the first job, or the first sentence or word in the
15386 # current job
15387 #
15388 # Expected arguments
15389 # (none besides ($self)
15390 #
15391 # Return values
15392 # 'undef' on improper arguments
15393 # 1 otherwise
15394  
15395 my ($self, $check) = @_;
15396  
15397 # Check for improper arguments
15398 if (defined $check) {
15399  
15400 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsFirstJob', @_);
15401 }
15402  
15403 if ($self->ttsJobList) {
15404  
15405 if ($self->ttsJobMode eq 'default') {
15406  
15407 # Move the main pointer to the beginning of the job list
15408 $self->ivPoke('ttsJobPointer', 0);
15409 $self->ivPoke('ttsJobMiniPointer', 0);
15410  
15411 } else {
15412  
15413 # Replay the first word/sentence in the current job
15414 $self->ivPoke('ttsJobMiniPointer', 0);
15415 }
15416  
15417 $self->ivPoke('ttsJobAutoFlag', FALSE);
15418 $self->ivPoke('ttsJobOnceFlag', TRUE);
15419  
15420 # Interrupt any text being converted to speech right now, allowing the next job to
15421 # start as quickly as possible
15422 $self->ttsInterruptJob();
15423 }
15424  
15425 return 1;
15426 }
15427  
15428 sub ttsLastJob {
15429  
15430 # Can be called by anything (but usually called by GA::Cmd::Last->do)
15431 # Depending on the value of $self->ttsJobMode, interrupt any text currently being converted
15432 # to speech, and move the pointers to the first job, or the first sentence or word in the
15433 # current job
15434 #
15435 # Expected arguments
15436 # (none besides ($self)
15437 #
15438 # Return values
15439 # 'undef' on improper arguments
15440 # 1 otherwise
15441  
15442 my ($self, $check) = @_;
15443  
15444 # Local variables
15445 my ($jobObj, $result);
15446  
15447 # Check for improper arguments
15448 if (defined $check) {
15449  
15450 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsLastJob', @_);
15451 }
15452  
15453 if ($self->ttsJobList) {
15454  
15455 $jobObj = $self->ttsReadJob($self->ttsJobPointer);
15456  
15457 if (! $jobObj || $self->ttsJobMode eq 'default') {
15458  
15459 # Move the pointer after the last job...
15460 $self->ivPoke('ttsJobPointer', -1);
15461 $self->ivPoke('ttsJobMiniPointer', 0);
15462  
15463 # Then regress the pointer to put it at the beginning of the last job, ready to read
15464 # it out
15465 $self->ttsRegressPointer();
15466  
15467 $self->ivPoke('ttsJobAutoFlag', TRUE);
15468 $self->ivPoke('ttsJobOnceFlag', FALSE);
15469  
15470 } else {
15471  
15472 # Move the mini-pointer to the start of the job's text
15473 $self->ivPoke('ttsJobMiniPointer', 0);
15474  
15475 if ($self->ttsJobMode eq 'sentence') {
15476  
15477 # Then move it to the final sentence, one sentence at a time
15478 do {
15479  
15480 $result = $jobObj->findNextSentence($self->ttsJobMiniPointer);
15481 if (defined $result) {
15482  
15483 $self->ivPoke('ttsJobMiniPointer', $result);
15484 }
15485  
15486 } until (! defined $result);
15487  
15488 } elsif ($self->ttsJobMode eq 'word') {
15489  
15490 # Then move it to the final word, one word at a time
15491 do {
15492  
15493 $result = $jobObj->findNextWord($self->ttsJobMiniPointer);
15494 if (defined $result) {
15495  
15496 $self->ivPoke('ttsJobMiniPointer', $result);
15497 }
15498  
15499 } until (! defined $result);
15500 }
15501  
15502 $self->ivPoke('ttsJobAutoFlag', FALSE);
15503 $self->ivPoke('ttsJobOnceFlag', TRUE);
15504 }
15505  
15506 # Interrupt any text being converted to speech right now, allowing the next job to
15507 # start as quickly as possible
15508 $self->ttsInterruptJob();
15509 }
15510  
15511 return 1;
15512 }
15513  
15514 sub ttsResumeJob {
15515  
15516 # Can be called by anything (but usually called by GA::Cmd::Last->resume)
15517 # Does two things. Usually, it interrupts any text currently being converted to speech,
15518 # switches to performing jobs by line (not by sentence or word), and moves the pointer to
15519 # the first job whose text has never been converted to speech
15520 # If this is already happening, then interrupt any text currently being converted to speech
15521 # and move the pointer to the end of the list (ready to perform the next job that arrives)
15522 #
15523 # Expected arguments
15524 # (none besides ($self)
15525 #
15526 # Return values
15527 # 'undef' on improper arguments
15528 # 1 otherwise
15529  
15530 my ($self, $check) = @_;
15531  
15532 # Local variables
15533 my ($count, $jobObj);
15534  
15535 # Check for improper arguments
15536 if (defined $check) {
15537  
15538 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsResumeJob', @_);
15539 }
15540  
15541 if ($self->ttsJobMode eq 'default' && $self->ttsJobAutoFlag) {
15542  
15543 # Move the pointer to the end of the list
15544 $self->ivPoke('ttsJobPointer', -1);
15545 $self->ivPoke('ttsJobMiniPointer', 0);
15546  
15547 } else {
15548  
15549 $self->ivPoke('ttsJobMode', 'default');
15550 $self->ivPoke('ttsJobAutoFlag', TRUE);
15551 $self->ivPoke('ttsJobOnceFlag', TRUE);
15552  
15553 # Find the first job which has never been converted to speech, even partially
15554 $count = -1;
15555 OUTER: foreach my $otherJobObj ($self->ttsJobList) {
15556  
15557 $count++;
15558 if ($otherJobObj->newFlag) {
15559  
15560 $jobObj = $otherJobObj;
15561 last OUTER;
15562 }
15563 }
15564  
15565 if (! $jobObj) {
15566  
15567 # All jobs performed; move the pointer to the end of the list
15568 $self->ivPoke('ttsJobPointer', -1);
15569 $self->ivPoke('ttsJobMiniPointer', 0);
15570  
15571 } else {
15572  
15573 # Move the pointer to the job
15574 $self->ivPoke('ttsJobPointer', $count);
15575 $self->ivPoke('ttsJobMiniPointer', 0);
15576 }
15577 }
15578  
15579 # Interrupt any text being converted to speech right now, allowing the next job to start as
15580 # quickly as possible
15581 $self->ttsInterruptJob();
15582  
15583 return 1;
15584 }
15585  
15586 sub ttsSilenceJob {
15587  
15588 # Can be called by anything (but usually called by GA::Cmd::Last->shutup)
15589 # If text is being converted to speech right now, interrupts it
15590 # If $self->ttsJobAutoFlag is set, unsets it (so the user can use ;skip, ;unskip and so on
15591 # to replay jobs before and after the current one)
15592 #
15593 # Expected arguments
15594 # (none besides ($self)
15595 #
15596 # Return values
15597 # 'undef' on improper arguments
15598 # 1 otherwise
15599  
15600 my ($self, $check) = @_;
15601  
15602 # Check for improper arguments
15603 if (defined $check) {
15604  
15605 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsSilenceJob', @_);
15606 }
15607  
15608 # Update IVs
15609 $self->ivPoke('ttsJobAutoFlag', FALSE);
15610 $self->ivPoke('ttsJobOnceFlag', FALSE);
15611  
15612 # Interrupt any text being converted to speech right now, allowing the next job to start as
15613 # quickly as possible
15614 $self->ttsInterruptJob();
15615  
15616 return 1;
15617 }
15618  
15619 sub ttsInterruptJob {
15620  
15621 # Can be called by anything, but usually called by GA::Cmd::Shutup->do, or by
15622 # $self->ttsSkipJob, ->ttsUnskipJob, ->ttsFirstJob and ->ttsLastJob
15623 # If text is currently being converted to speech by a speech engine, interrupts it,
15624 # allowing the next job (or sentence/word) to be converted, if one is waiting to be
15625 # converted
15626 #
15627 # Expected arguments
15628 # (none besides ($self)
15629 #
15630 # Return values
15631 # 'undef' on improper arguments
15632 # 1 otherwise
15633  
15634 my ($self, $check) = @_;
15635  
15636 # Check for improper arguments
15637 if (defined $check) {
15638  
15639 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsInterruptJob', @_);
15640 }
15641  
15642 # When this IV is set, text is being converted to speech by a speech engine other than the
15643 # Festival server engine
15644 if ($self->ttsCurrentHarness) {
15645  
15646 if ($self->ttsCurrentHarness->pumpable()) {
15647  
15648 # IPC::Run::kill_kill($self->ttsCurrentHarness, coup_d_grace => "QUIT");
15649 IPC::Run::kill_kill($self->ttsCurrentHarness, grace => 0);
15650 }
15651  
15652 # Interrupt the Festival server engine, if connected
15653 } elsif (
15654 $self->ttsFestivalServerMode eq 'server'
15655 && $self->ttsFestivalConnectMode eq 'connected'
15656 ) {
15657 # !!! DEBUG N.B. For unknown reasons, this should interrupt the Festival server engine,
15658 # but does not
15659 $self->ttsFestivalSend("(audio_mode 'shutup)");
15660 }
15661  
15662 return 1;
15663 }
15664  
15665 sub ttsPrepareSystemCmd {
15666  
15667 # Called by $self->ttsPerformJobs
15668 # Prepares the parameters of a system command for performing the specifed TTS job. The
15669 # parameters depend on the operating system and current conditions, as well as the job
15670 # itself
15671 #
15672 # Expected arguments
15673 # $jobObj - The GA::Obj::TtsJob object
15674 #
15675 # Return values
15676 # An empty list on improper arguments, if the TTS engine is unrecognised or if the job
15677 # can't be performed
15678 # Otherwise returns a list of parameters to use in the system command. For the Festival
15679 # engine, returns a list of two system commands, one for each engine version
15680  
15681 my ($self, $jobObj, $check) = @_;
15682  
15683 # Local variables
15684 my @emptyList;
15685  
15686 # Check for improper arguments
15687 if (! defined $jobObj || defined $check) {
15688  
15689 $axmud::CLIENT->writeImproper($self->_objClass . '->ttsPrepareSystemCmd', @_);
15690 return @emptyList;
15691 }
15692  
15693 if ($jobObj->engine eq 'espeak') {
15694 return $self->ttsConvertESpeak($jobObj);
15695 } elsif ($jobObj->engine eq 'esng') {
15696 return $self->ttsConvertESNG($jobObj);
15697 } elsif ($jobObj->engine eq 'flite') {
15698 return $self->ttsConvertFlite($jobObj);
15699 } elsif ($jobObj->engine eq 'festival') {
15700 return $self->ttsConvertFestival($jobObj);
15701 } elsif ($jobObj->engine eq 'swift') {
15702 return $self->ttsConvertSwift($jobObj);
15703 } else {
15704 # Unrecognised engine
15705 return @emptyList;
15706 }
15707 }
15708  
15709 sub ttsConvertCheck {
15710  
15711 # Called by $self->ttsConvertESpeak, etc
15712 # Checks that values stored in the specified TTS job are valid (in general), before trying
15713 # to prepare a system command. For example, checks that the specified volume is in the
15714 # range 0-100
15715 # Does not check that the values are valid for a particular speech engine; that is handled
15716 # by the calling function
15717 #
15718 # Expected arguments
15719 # $jobObj - The GA::Obj::TtsJob object
15720 #
15721 # Return values
15722 # 'undef' on improper arguments, or if any of the values are valid
15723 # 1 if all values are valid
15724  
15725 my ($self, $jobObj, $check) = @_;
15726  
15727 # Check for improper arguments
15728 if (! defined $jobObj || defined $check) {
15729  
15730 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsConvertCheck', @_);
15731 }
15732  
15733 if (
15734 ! defined $jobObj->currentText
15735 || $jobObj->currentText eq ''
15736 || ! defined $self->ivFind('constTTSCompatList', $jobObj->engine)
15737 ) {
15738 return undef;
15739 }
15740  
15741 foreach my $iv (qw(speed rate pitch volume)) {
15742  
15743 my $value = $jobObj->$iv;
15744  
15745 if (
15746 defined $value
15747 && $value ne ''
15748 && (
15749 ! ($value =~ m/^[-]?\d+(\.\d*)?$/)
15750 || $value < 0
15751 || $value > 100
15752 )
15753 ) {
15754 return undef;
15755 }
15756 }
15757  
15758 # All values valid (in general)
15759 return 1;
15760 }
15761  
15762 sub ttsConvertESpeak {
15763  
15764 # Called by $self->ttsPrepareSystemCmd (only)
15765 # Prepares the parameters of a system command for performing the specifed TTS job, using the
15766 # eSpeak engine
15767 # The parameters depend on the operating system and current conditions, as well as the job
15768 # itself
15769 #
15770 # Expected arguments
15771 # $jobObj - The GA::Obj::TtsJob object
15772 #
15773 # Return values
15774 # An empty list on improper arguments, if the TTS engine is unrecognised or if the job
15775 # can't be performed
15776 # Otherwise returns a list of parameters to use in the system command
15777  
15778 my ($self, $jobObj, $check) = @_;
15779  
15780 # Local variables
15781 my (@emptyList, @cmdList);
15782  
15783 # Check for improper arguments
15784 if (! defined $jobObj || defined $check) {
15785  
15786 $axmud::CLIENT->writeImproper($self->_objClass . '->ttsConvertESpeak', @_);
15787 return @emptyList;
15788 }
15789  
15790 # Check values are valid in general
15791 if (! $self->ttsConvertCheck($jobObj)) {
15792  
15793 return @emptyList;
15794 }
15795  
15796 # Prepare the system command
15797 if ($^O eq 'MSWin32') {
15798  
15799 if (-e $self->msWinPathESpeak) {
15800  
15801 push (@cmdList, $self->msWinPathESpeak);
15802  
15803 } elsif (-e $self->msWinAltPathESpeak) {
15804  
15805 push (@cmdList, $self->msWinAltPathESpeak);
15806  
15807 } else {
15808  
15809 # eSpeak engine not installed
15810 return @emptyList;
15811 }
15812  
15813 } else {
15814  
15815 push (@cmdList, 'espeak');
15816 }
15817  
15818 if ($^O eq 'MSWin32') {
15819 push (@cmdList, $jobObj->currentText);
15820 } else {
15821 push (@cmdList, '"' . $jobObj->currentText . '"');
15822 }
15823  
15824 # With eSpeak, we can set the voice, speed and pitch, but not rate or volume
15825 if (defined $jobObj->voice && $jobObj->voice ne '') {
15826  
15827 push (@cmdList, '-v', $jobObj->voice);
15828 }
15829  
15830 # Speed in the range 10-200
15831 if (defined $jobObj->speed && $jobObj->speed ne '') {
15832  
15833 push (@cmdList, '-s', (int($jobObj->speed * 1.9) + 10));
15834 }
15835  
15836 # Pitch in the range 0-99
15837 if (defined $jobObj->pitch && $jobObj->pitch ne '') {
15838  
15839 if ($jobObj->pitch > 99) {
15840  
15841 $jobObj->pitch = 99;
15842 }
15843  
15844 push (@cmdList, '-p', $jobObj->pitch);
15845 }
15846  
15847 return @cmdList;
15848 }
15849  
15850 sub ttsConvertESNG {
15851  
15852 # Called by $self->ttsPrepareSystemCmd (only)
15853 # Prepares the parameters of a system command for performing the specifed TTS job, using the
15854 # espeak-sng engine
15855 # The parameters depend on the operating system and current conditions, as well as the job
15856 # itself
15857 #
15858 # Expected arguments
15859 # $jobObj - The GA::Obj::TtsJob object
15860 #
15861 # Return values
15862 # An empty list on improper arguments, if the TTS engine is unrecognised or if the job
15863 # can't be performed
15864 # Otherwise returns a list of parameters to use in the system command
15865  
15866 my ($self, $jobObj, $check) = @_;
15867  
15868 # Local variables
15869 my (@emptyList, @cmdList);
15870  
15871 # Check for improper arguments
15872 if (! defined $jobObj || defined $check) {
15873  
15874 $axmud::CLIENT->writeImproper($self->_objClass . '->ttsConvertESNG', @_);
15875 return @emptyList;
15876 }
15877  
15878 # Check values are valid in general
15879 if (! $self->ttsConvertCheck($jobObj)) {
15880  
15881 return @emptyList;
15882 }
15883  
15884 # Prepare the system command
15885 if ($^O eq 'MSWin32') {
15886  
15887 if (-e $self->msWinPathESNG) {
15888  
15889 push (@cmdList, $self->msWinPathESNG);
15890  
15891 } else {
15892  
15893 # espeak-ng engine not installed
15894 return @emptyList;
15895 }
15896  
15897 } else {
15898  
15899 push (@cmdList, 'espeak-ng');
15900 }
15901  
15902 if ($^O eq 'MSWin32') {
15903 push (@cmdList, $jobObj->currentText);
15904 } else {
15905 push (@cmdList, '"' . $jobObj->currentText . '"');
15906 }
15907  
15908 # With espeak-ng, we can set the voice, speed, pitch and volume, but not rate
15909 if (defined $jobObj->voice && $jobObj->voice ne '') {
15910  
15911 push (@cmdList, '-v', $jobObj->voice);
15912 }
15913  
15914 # Speed in the range 10-200
15915 if (defined $jobObj->speed && $jobObj->speed ne '') {
15916  
15917 push (@cmdList, '-s', (int($jobObj->speed * 1.9) + 10));
15918 }
15919  
15920 # Pitch in the range 0-99
15921 if (defined $jobObj->pitch && $jobObj->pitch ne '') {
15922  
15923 if ($jobObj->pitch > 99) {
15924  
15925 $jobObj->pitch = 99;
15926 }
15927  
15928 push (@cmdList, '-p', $jobObj->pitch);
15929 }
15930  
15931 # Volume in the range 0-200
15932 if (defined $jobObj->volume && $jobObj->volume ne '') {
15933  
15934 push (@cmdList, '-a', ($jobObj->volume * 2));
15935 }
15936  
15937 return @cmdList;
15938 }
15939  
15940 sub ttsConvertFlite {
15941  
15942 # Called by $self->ttsPrepareSystemCmd (only)
15943 # Prepares the parameters of a system command for performing the specifed TTS job, using the
15944 # Flite engine
15945 # The parameters depend on the operating system and current conditions, as well as the job
15946 # itself
15947 #
15948 # Expected arguments
15949 # $jobObj - The GA::Obj::TtsJob object
15950 #
15951 # Return values
15952 # An empty list on improper arguments, if the TTS engine is unrecognised or if the job
15953 # can't be performed
15954 # Otherwise returns a list of parameters to use in the system command
15955  
15956 my ($self, $jobObj, $check) = @_;
15957  
15958 # Local variables
15959 my (@emptyList, @cmdList);
15960  
15961 # Check for improper arguments
15962 if (! defined $jobObj || defined $check) {
15963  
15964 $axmud::CLIENT->writeImproper($self->_objClass . '->ttsConvertFlite', @_);
15965 return @emptyList;
15966 }
15967  
15968 # Check values are valid in general
15969 if (! $self->ttsConvertCheck($jobObj)) {
15970  
15971 return @emptyList;
15972 }
15973  
15974 # Prepare the system command
15975 if ($^O eq 'MSWin32') {
15976  
15977 # Not available on MS Windows
15978 return @emptyList;
15979  
15980 } else {
15981  
15982 push (@cmdList, 'flite');
15983 }
15984  
15985 push (@cmdList, '-t', '"' . $jobObj->currentText . '"');
15986  
15987 # With Flite, we can set the voice, but not speed, rate, pitch or volume
15988 if (defined $jobObj->voice && $jobObj->voice ne '') {
15989  
15990 push (@cmdList, '-voice', $jobObj->voice);
15991 }
15992  
15993 return @cmdList;
15994 }
15995  
15996 sub ttsConvertFestival {
15997  
15998 # Called by $self->ttsPrepareSystemCmd (only)
15999 # Prepares the parameters of a system command for performing the specifed TTS job, using the
16000 # Festival engine
16001 # The parameters depend on the operating system and current conditions, as well as the job
16002 # itself
16003 #
16004 # Expected arguments
16005 # $jobObj - The GA::Obj::TtsJob object
16006 #
16007 # Return values
16008 # An empty list on improper arguments, if the TTS engine is unrecognised or if the job
16009 # can't be performed
16010 # Otherwise, returns a list of arguments. The first argument is the command for the
16011 # server engine. The remaining comprise the command for the command-line engine. Thus,
16012 # if $self->ttsPerformJobs tries to use the server engine and fails, it can default
16013 # back to the command-line engine without calling this function a second time
16014  
16015 my ($self, $jobObj, $check) = @_;
16016  
16017 # Local variables
16018 my (
16019 $cmd,
16020 @emptyList, @cmdList,
16021 );
16022  
16023 # Check for improper arguments
16024 if (! defined $jobObj || defined $check) {
16025  
16026 $axmud::CLIENT->writeImproper($self->_objClass . '->ttsConvertFestival', @_);
16027 return @emptyList;
16028 }
16029  
16030 # Check values are valid in general
16031 if (! $self->ttsConvertCheck($jobObj)) {
16032  
16033 return @emptyList;
16034 }
16035  
16036 # Prepare the system command
16037  
16038 # Server engine (never used on MS Windows)
16039 $cmd = "(let ((utt (Utterance Text \"" . $jobObj->currentText . "\")))";
16040 if (defined $jobObj->voice && $jobObj->voice ne '') {
16041  
16042 $cmd .= " (begin (" . $jobObj->voice . ")";
16043  
16044 # Rate in the range 0.5-2
16045 if (defined $jobObj->rate && $jobObj->rate ne '') {
16046  
16047 $cmd .= " (Parameter.set 'Duration_Stretch' " . (($jobObj->rate * 0.015) + 0.5)
16048 . ")";
16049 }
16050  
16051 # Volume in the range 0.33-6
16052 if (defined $jobObj->volume && $jobObj->volume ne '') {
16053  
16054 $cmd .= " (utt.synth utt) (utt.wave.resample utt 8000)"
16055 . " (utt.wave.rescale utt " . (($jobObj->volume * 0.0567) + 0.33)
16056 . ") (utt.play utt)";
16057 }
16058  
16059 $cmd .= ")";
16060 }
16061  
16062 $cmd .= ")\n";
16063  
16064 push (@cmdList, $cmd);
16065  
16066 # Command-line engine (used on all operating systems)
16067 # For system commands using pipes, IPC::Run::start expects a list in this format
16068 if ($^O eq 'MSWin32') {
16069  
16070 if (-e $self->msWinPathFestival) {
16071  
16072 chomp $cmd;
16073 # In MS Windows CMD.exe, need to escape the characters & \ < > ^ | "
16074 $cmd =~ s/([\&\\\<\>\^\|\"])/^$1/g;
16075  
16076 # N.B. In order for this to work, the IPC::Run code itself must be modified. See the
16077 # instructions in ../axmud/nsis/axmud.install.nsi
16078 push (@cmdList,
16079 [ 'CMD', '/C', 'echo', '""' . $cmd . '""', ],
16080 '|',
16081 [ $self->msWinPathFestival ],
16082 );
16083  
16084 } else {
16085  
16086 # Festival engine not installed
16087 return @emptyList;
16088 }
16089  
16090 } else {
16091  
16092 push (@cmdList,
16093 [ 'echo', $cmd, ],
16094 '|',
16095 [ 'festival' ],
16096 );
16097 }
16098  
16099 # Return the server command first, followed by the arguments comprising the command for the
16100 # ommand-line engine
16101 return @cmdList;
16102 }
16103  
16104 sub ttsConvertSwift {
16105  
16106 # Called by $self->ttsPrepareSystemCmd (only)
16107 # Prepares the parameters of a system command for performing the specifed TTS job, using the
16108 # Swift engine
16109 # The parameters depend on the operating system and current conditions, as well as the job
16110 # itself
16111 #
16112 # Expected arguments
16113 # $jobObj - The GA::Obj::TtsJob object
16114 #
16115 # Return values
16116 # An empty list on improper arguments, if the TTS engine is unrecognised or if the job
16117 # can't be performed
16118 # Otherwise returns a list of parameters to use in the system command
16119  
16120 my ($self, $jobObj, $check) = @_;
16121  
16122 # Local variables
16123 my (
16124 $param, $pitch, $begin, $end, $rate, $volume,
16125 @emptyList, @cmdList,
16126 );
16127  
16128 # Check for improper arguments
16129 if (! defined $jobObj || defined $check) {
16130  
16131 $axmud::CLIENT->writeImproper($self->_objClass . '->ttsConvertSwift', @_);
16132 return @emptyList;
16133 }
16134  
16135 # Check values are valid in general
16136 if (! $self->ttsConvertCheck($jobObj)) {
16137  
16138 return @emptyList;
16139 }
16140  
16141 # Prepare the system command
16142 if ($^O eq 'MSWin32') {
16143  
16144 if (-e $self->msWinPathSwift) {
16145  
16146 push (@cmdList, $self->msWinPathSwift);
16147  
16148 } else {
16149  
16150 # Swift engine not installed
16151 return @emptyList;
16152 }
16153  
16154 } else {
16155  
16156 push (@cmdList, 'swift');
16157 }
16158  
16159 # With Swift on MS Windows (using Cepstral), we can set the voice, speed, pitch and volume,
16160 # but not rate
16161 if ($^O eq 'MSWin32') {
16162  
16163 if (defined $jobObj->voice && $jobObj->voice ne '') {
16164  
16165 push (@cmdList, '-n', $jobObj->voice);
16166 }
16167  
16168 # Speed in the range 100-400
16169 if (defined $jobObj->speed && $jobObj->speed ne '') {
16170  
16171 $param = 'speech/rate=' . (($jobObj->speed * 3) + 100);
16172 }
16173  
16174 # Pitch in the range 0.1-5
16175 if (defined $jobObj->pitch && $jobObj->pitch ne '') {
16176  
16177 $pitch = int($jobObj->pitch / 20);
16178 if ($pitch < 0.1) {
16179  
16180 $pitch = 0.1;
16181 }
16182  
16183 if (! $param) {
16184 $param = 'speech/pitch/shift=' . $pitch;
16185 } else {
16186 $param .= ',speech/pitch/shift=' . $pitch;
16187 }
16188 }
16189  
16190 # Volume in the range 0-100
16191 if (defined $jobObj->volume && $jobObj->volume ne '') {
16192  
16193 if (! $param) {
16194 $param = 'audio/volume=' . $jobObj->volume;
16195 } else {
16196 $param .= ',audio/volume=' . $jobObj->volume;
16197 }
16198 }
16199  
16200 # All done
16201 if ($param) {
16202  
16203 push (@cmdList, '-p', $param);
16204 }
16205  
16206 push (@cmdList, $jobObj->currentText);
16207  
16208 # With Swift on Linux (using Cepstral), we can set the voice, rate, pitch and volume, but
16209 # not speed
16210 } else {
16211  
16212 if ($jobObj->voice ne '') {
16213  
16214 $begin = "<voice name=\"" . $jobObj->voice . "\">";
16215 $end = "</voice>";
16216  
16217 } else {
16218  
16219 $begin = '';
16220 $end = '';
16221 }
16222  
16223 # (Rate, pitch and volume all share an element; only create the element if at least one
16224 # valid value is being used)
16225  
16226 # Rate in the range 0.5-2
16227 if (defined $jobObj->rate && $jobObj->rate ne '') {
16228  
16229 $rate = ($jobObj->rate * 0.015) + 0.5;
16230 }
16231  
16232 # Pitch in the range 0.1-5
16233 if (defined $jobObj->pitch && $jobObj->pitch ne '') {
16234  
16235 $pitch = $jobObj->pitch / 20;
16236 if ($pitch < 0.1) {
16237  
16238 $pitch = 0.1;
16239 }
16240 }
16241  
16242 # Volume in the range 0.33-6
16243 if (defined $jobObj->volume && $jobObj->volume ne '') {
16244  
16245 $volume = ($jobObj->volume * 0.0567) + 0.33;
16246 }
16247  
16248 if ($rate ne '' || $pitch ne '' || $volume ne '') {
16249  
16250 $begin .= "<prosody";
16251 if ($rate ne '') {
16252  
16253 $begin .= " rate='$rate'";
16254 }
16255  
16256 if ($pitch ne '') {
16257  
16258 $begin .= " pitch='$pitch'";
16259 }
16260  
16261 if ($volume ne '') {
16262  
16263 $begin .= " volume='$volume'";
16264 }
16265  
16266 $begin .= ">";
16267 $end = "</prosody>" . $end;
16268 }
16269  
16270 push (@cmdList, $begin . $jobObj->currentText . $end);
16271 }
16272  
16273 return @cmdList;
16274 }
16275  
16276 sub ttsFestivalConnect {
16277  
16278 # Called by $self->ttsPerformJobs (only), in response to the TTS action request 'connect'
16279 # Attempts to connect to a Festival server engine
16280 #
16281 # Expected arguments
16282 # (none besides $self)
16283 #
16284 # Return values
16285 # 'undef' on improper arguments or if a connection cannot be establed with the Festival
16286 # server
16287 # 1 if a connection is established
16288  
16289 my ($self, $check) = @_;
16290  
16291 # Local variables
16292 my $socket;
16293  
16294 # Check for improper arguments
16295 if (defined $check) {
16296  
16297 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsFestivalConnect', @_);
16298 }
16299  
16300 # These checks should have been taken care of by the calling code
16301 if (
16302 $self->ttsFestivalServerMode ne 'server'
16303 || $self->ttsFestivalSocket
16304 || $^O eq 'MSWin32'
16305 ) {
16306 return undef;
16307 }
16308  
16309 # Attempt to connect to the Festival server
16310 $self->ivPoke('ttsFestivalConnectMode', 'connecting');
16311  
16312 $socket = IO::Socket::INET->new(
16313 Proto => 'tcp',
16314 PeerAddr => '127.0.0.1',
16315 PeerPort => $self->ttsFestivalServerPort,
16316 );
16317  
16318 if (! $socket) {
16319  
16320 $self->ivPoke('ttsFestivalConnectMode', 'waiting');
16321  
16322 return undef;
16323  
16324 } else {
16325  
16326 $self->ivPoke('ttsFestivalConnectMode', 'connected');
16327 $self->ivPoke('ttsFestivalSocket', $socket);
16328  
16329 return 1;
16330 }
16331 }
16332  
16333 sub ttsFestivalDisconnect {
16334  
16335 # Called by $self->ttsPerformJobs (only), in response to the TTS action request 'disconnect'
16336 # Attempts to disconnect from the Festival server engine
16337 #
16338 # Expected arguments
16339 # (none besides $self)
16340 #
16341 # Return values
16342 # 'undef' on improper arguments
16343 # 1 otherwise
16344  
16345 my ($self, $check) = @_;
16346  
16347 # Check for improper arguments
16348 if (defined $check) {
16349  
16350 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsFestivalDisconnect', @_);
16351 }
16352  
16353 if ($self->ttsFestivalSocket) {
16354  
16355 # Close the socket
16356 close $self->ttsFestivalSocket;
16357 $self->ivUndef('ttsFestivalSocket');
16358  
16359 # Update IVs
16360 if ($self->ttsFestivalServerMode eq 'server') {
16361  
16362 # (...implying, if $FESTIVAL_MODE has not been changed to 'cmd_line'...)
16363 $self->ivPoke('ttsFestivalConnectMode', 'waiting');
16364 }
16365  
16366 $self->ivPoke('ttsFestivalServerMode', 'cmd_line');
16367 $self->ivPoke('ttsFestivalConnectMode', 'cmd_line');
16368 }
16369  
16370 return 1;
16371 }
16372  
16373 sub ttsFestivalStart {
16374  
16375 # Called by $self->ttsPerformJobs (only), in response to the TTS action request 'start'
16376 # Assuming that no Festival server is running on the user's system, attempts to start one
16377 #
16378 # Expected arguments
16379 # (none besides $self)
16380 #
16381 # Return values
16382 # 'undef' if the server cannot be started or, if it is started, a connection cannot be
16383 # established with it
16384 # 1 on success
16385  
16386 my ($self, $check) = @_;
16387  
16388 # Local variables
16389 my $result;
16390  
16391 # Check for improper arguments
16392 if (defined $check) {
16393  
16394 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsFestivalStart', @_);
16395 }
16396  
16397 # Don't try to start the server a second time, unless the port has changed
16398 if (
16399 $self->ttsFestivalFailFlag
16400 || $self->ttsFestivalSuccessFlag
16401 || $^O eq 'MSWin32'
16402 ) {
16403 return undef;
16404 }
16405  
16406 # Update IVs
16407 $self->ivPoke('ttsFestivalServerMode', 'server');
16408 $self->ivPoke('ttsFestivalConnectMode', 'waiting');
16409  
16410 # Start the server
16411 $result = system "festival --server &";
16412 if ($result == -1) {
16413  
16414 # Server not started. Don't try again, unless the Festival port changes
16415 $self->ivPoke('ttsFestivalFailFlag', TRUE);
16416 return undef;
16417  
16418 } else {
16419  
16420 # Server started
16421 # Don't try again under any circumstances. This setting prevents Axmud from starting
16422 # redundant multiple servers
16423 $self->ivPoke('ttsFestivalSuccessFlag', TRUE);
16424  
16425 # On the next spin of the client loop, try to connect to the server
16426 $self->ivPush('ttsFestivalRequestList', 'connect');
16427  
16428 # The server may need time to initialise, before we can connect to it
16429 # Ordinarily we give up after the first failed connection. Set variables that allow
16430 # $self->ttsPerformJobs to keep trying for a few seconds, before giving up
16431 $self->ivPoke('ttsFestivalCheckTime', $self->getTime() + $self->ttsFestivalStopTime);
16432  
16433 return 1;
16434 }
16435 }
16436  
16437 sub ttsFestivalSend {
16438  
16439 # Called by $self->ttsPerformJobs and ->ttsInterruptJob
16440 # Sends a command to the Festival server. If the connection has closed, updates IVs
16441 #
16442 # Expected arguments
16443 # $cmd - The text to send to the server
16444 #
16445 # Return values
16446 # 'undef' on improper arguments, if not connected to the server or if the connection has
16447 # closed
16448 # 1 otherwise
16449  
16450 my ($self, $cmd, $check) = @_;
16451  
16452 # Check for improper arguments
16453 if (! defined $cmd || defined $check) {
16454  
16455 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsFestivalSend', @_);
16456 }
16457  
16458 if (
16459 $self->ttsFestivalServerMode ne 'server'
16460 || $self->ttsFestivalConnectMode ne 'connected'
16461 || ! $self->ttsFestivalSocket
16462 || $^O eq 'MSWin32'
16463 ) {
16464 return undef;
16465  
16466 } elsif (! $self->ttsFestivalSocket->print($cmd)) {
16467  
16468 # Socket has closed; go back to using the command line engine
16469 $self->ivPoke('ttsFestivalServerMode', 'cmd_line');
16470 $self->ivPoke('ttsFestivalConnectMode', 'cmd_line');
16471 $self->ivUndef('ttsFestivalSocket');
16472  
16473 return undef;
16474  
16475 } else {
16476  
16477 return 1;
16478 }
16479 }
16480  
16481 # External applications
16482  
16483 sub openURL {
16484  
16485 # Called by GA::Strip::MenuBar->drawHelpColumn, GA::Obj::TextView->setButtonPressEvent,
16486 # GA::OtherWin::Connect->createTableWidgets or any other function
16487 # Opens a URL link in an external web browser (if allowed)
16488 #
16489 # Expected arguments
16490 # $link - The URL to open
16491 #
16492 # Return values
16493 # 'undef' on improper arguments or if the link can't be opened
16494 # 1 otherwise
16495  
16496 my ($self, $link, $check) = @_;
16497  
16498 # Local variables
16499 my $cmd;
16500  
16501 # Check for improper arguments
16502 if (! defined $link || defined $check) {
16503  
16504 return $axmud::CLIENT->writeImproper($self->_objClass . '->openURL', @_);
16505 }
16506  
16507 if (! $self->browserCmd || ! ($self->browserCmd =~ m/%s/)) {
16508  
16509 # No browser command set, or it doesn't contain a %s (which is substituted for the link)
16510 return undef;
16511  
16512 } else {
16513  
16514 $cmd = $self->browserCmd;
16515 $cmd =~ s/%s/$link/;
16516  
16517 system $cmd;
16518  
16519 return 1;
16520 }
16521 }
16522  
16523 sub openEmail {
16524  
16525 # Called by GA::Obj::TextView->setButtonPressEvent or by any other function
16526 # Opens an email link in an external email application (if allowed)
16527 #
16528 # Expected arguments
16529 # $link - The email address to open
16530 #
16531 # Return values
16532 # 'undef' on improper arguments or if the link can't be opened
16533 # 1 otherwise
16534  
16535 my ($self, $link, $check) = @_;
16536  
16537 # Local variables
16538 my $cmd;
16539  
16540 # Check for improper arguments
16541 if (! defined $link || defined $check) {
16542  
16543 return $axmud::CLIENT->writeImproper($self->_objClass . '->openEmail', @_);
16544 }
16545  
16546 if (! $self->emailCmd || ! ($self->emailCmd =~ m/%s/)) {
16547  
16548 # No email command set, or it doesn't contain a %s (which is substituted for the link)
16549 return undef;
16550  
16551 } else {
16552  
16553 $cmd = $self->emailCmd;
16554 $cmd =~ s/%s/$link/;
16555  
16556 system $cmd;
16557  
16558 return 1;
16559 }
16560 }
16561  
16562 # Sound and sound effects
16563  
16564 sub playSound {
16565  
16566 # Can be called by anything
16567 # Plays a specified sound effect (if allowed, and if the sound effect exists)
16568 #
16569 # Expected arguments
16570 # $sound - The name of the sound effect to play; should match a key in
16571 # $self->customSoundHash
16572 #
16573 # Return values
16574 # 'undef' on improper arguments or if the sound effect can't be played
16575 # 1 otherwise
16576  
16577 my ($self, $sound, $check) = @_;
16578  
16579 # Local variables
16580 my ($file, $cmd);
16581  
16582 # Check for improper arguments
16583 if (! defined $sound || defined $check) {
16584  
16585 return $axmud::CLIENT->writeImproper($self->_objClass . '->playSound', @_);
16586 }
16587  
16588 $file = $self->ivShow('customSoundHash', $sound);
16589  
16590 if (
16591 # Sound not allowed
16592 ! $self->allowSoundFlag
16593 # No external audio player set, or the command to start the audio player doesn't contain
16594 # a %s substitution
16595 || ! $self->audioCmd
16596 || ! ($self->audioCmd =~ m/%s/)
16597 # Sound effect doesn't exist, or no file specified for this sound effect
16598 || ! $file
16599 # File doesn't exist
16600 || ! (-e $file)
16601 ) {
16602 return undef;
16603  
16604 } else {
16605  
16606 # Play the file associated with $sound. GA::Client->audioCmd is a value in the form
16607 # 'play %s &', where %s is substituted for the name of the file to play
16608 $cmd = $self->audioCmd;
16609 $cmd =~ s/%s/$file/;
16610  
16611 system $cmd;
16612  
16613 return 1;
16614 }
16615 }
16616  
16617 sub playSoundFile {
16618  
16619 # Can be called by anything
16620 # Plays a sound file using the specified filepath. Unlike $self->playSound, which plays one
16621 # of Axmud's sound effects, this function can be called to play any sound file on the
16622 # local system
16623 # The optional arguments are designed for playing MSP sound triggers (called by
16624 # GA::Session->processMspSoundTrigger). Other code can specify these arguments too, if
16625 # required
16626 # The $v (volume) argument is only applied when using one of Axmud's supported audio
16627 # packages. At the moment, the only package supported is SoX
16628 #
16629 # Expected arguments
16630 # $session - The calling GA::Session
16631 # $path - The full file path of the sound to play
16632 #
16633 # Optional arguments
16634 # $delFlag - Set to TRUE if the file $path should be deleted, when it has finished
16635 # playing, set to FALSE (or 'undef') otherwise. (Used for MXP sound files
16636 # which are converted from a world-specific file format, and which should
16637 # be deleted after being played)
16638 # $type - The MSP sound trigger type, 'sound' or 'music'. Should be 'undef' (or
16639 # 'other') for non-MSP sounds
16640 # $v - The sound volume. Value in the range 0-100 (if 'undef', no volume applied)
16641 # $l - Number of repeats. Value in the range 1+, or -1 to repeat indefinitely (if
16642 # 'undef', sound played only once)
16643 # $p - Sound priority. Value in the range 0-100. If $p is higher than the
16644 # priority of the sound already playing, the old sound is stopped and this
16645 # sound is played instead; otherwise, this sound is not played at all (if
16646 # 'undef', default priority of 50 is applied by this function)
16647 # - (NB Axmud sound effects played by $self->playSound are independent, and
16648 # not affected by this function)
16649 # $c - Continue flag. Values 0 or 1. If 1, the file should simply continue
16650 # playing if requested again. If 0, the file should restart, if requested
16651 # again.
16652 # - (NB Axmud sound effects played by $self->playSound are independent, and
16653 # not affected by this function)
16654 #
16655 # Return values
16656 # 'undef' on improper arguments or if the sound file can't be played
16657 # 1 otherwise
16658  
16659 my ($self, $session, $path, $delFlag, $type, $v, $l, $p, $c, $check) = @_;
16660  
16661 # Local variables
16662 my (
16663 $cmd, $harness, $soundObj, $num,
16664 @args,
16665 );
16666  
16667 # Check for improper arguments
16668 if (! defined $session || ! defined $path || defined $check) {
16669  
16670 return $axmud::CLIENT->writeImproper($self->_objClass . '->playSoundFile', @_);
16671 }
16672  
16673 if (
16674 # Sound not allowed
16675 ! $self->allowSoundFlag
16676 # No external audio player set, or the command to start the audio player doesn't contain
16677 # a %s substitution
16678 || ! $self->audioCmd
16679 || ! ($self->audioCmd =~ m/%s/)
16680 # File doesn't exist
16681 || ! (-e $path)
16682 ) {
16683 return undef;
16684 }
16685  
16686 # For non-MSP sounds, the $type stored in the GA::Obj::Sound object should be 'other'
16687 if (! defined $type) {
16688  
16689 $type = 'other';
16690 }
16691  
16692 # Use default values for $delFlag, $v, $l, $p and $c, if they were not specified
16693 if (! defined $delFlag) {
16694  
16695 $delFlag = FALSE;
16696 }
16697  
16698 if (! defined $v) {
16699  
16700 $v = 100;
16701 }
16702  
16703 if (! defined $l) {
16704  
16705 $l = 1;
16706 }
16707  
16708 if (! defined $p) {
16709  
16710 $p = 50;
16711 }
16712  
16713 if (! defined $c) {
16714  
16715 $c = 1;
16716 }
16717  
16718 # Prepare the argument list
16719 $cmd = $self->audioCmd;
16720 if (
16721 $^O ne 'MSWin32'
16722 && (substr($cmd, 0, 4) eq 'sox ' || substr($cmd, 0, 5) eq 'play ')
16723 ) {
16724 # Supported audio package, SoX ('-q' for quiet)
16725 @args = ('play', '-q');
16726  
16727 if (defined $v) {
16728  
16729 # $v is in the range 0-100; SoX expects a value in the range 0-1
16730 if ($v) {
16731 push (@args, '-v ' . ($v / 100));
16732 } else {
16733 push (@args, '-v 0');
16734 }
16735 }
16736  
16737 push (@args, $path);
16738  
16739 } else {
16740  
16741 # Unsupported audio package
16742 $cmd =~ s/%s//;
16743 @args = ($cmd, $path);
16744 }
16745  
16746 # Play the sound
16747 $harness = IPC::Run::start(\@args);
16748 # Create a GA::Obj::Sound object to store the harness details, so we can monitor its
16749 # progress
16750 $session->add_soundHarness(
16751 $path,
16752 $harness,
16753 $delFlag,
16754 $type,
16755 $v,
16756 $l,
16757 $p,
16758 $c,
16759 );
16760  
16761 return 1;
16762 }
16763  
16764 sub repeatSoundFile {
16765  
16766 # Called by GA::Session->spinMaintainLoop (only)
16767 # Repeat the playing of a sound file, using details stored in a GA::Obj::Sound object
16768 # (This function complements $self->playSoundFile)
16769 #
16770 # Expected arguments
16771 # $soundObj - The GA::Obj::Sound object
16772 #
16773 # Return values
16774 # 'undef' on improper arguments or if the sound file can't be played
16775 # 1 otherwise
16776  
16777 my ($self, $soundObj, $check) = @_;
16778  
16779 # Local variables
16780 my (
16781 $cmd, $harness,
16782 @args,
16783 );
16784  
16785 # Check for improper arguments
16786 if (! defined $soundObj || defined $check) {
16787  
16788 return $axmud::CLIENT->writeImproper($self->_objClass . '->repeatSoundFile', @_);
16789 }
16790  
16791 if (
16792 # Sound not allowed
16793 ! $self->allowSoundFlag
16794 # No external audio player set, or the command to start the audio player doesn't contain
16795 # a %s substitution
16796 || ! $self->audioCmd
16797 || ! ($self->audioCmd =~ m/%s/)
16798 # File path no longer exists
16799 || ! (-e $soundObj->path)
16800 ) {
16801 return undef;
16802 }
16803  
16804 # Prepare the argument list
16805 $cmd = $self->audioCmd;
16806 if (
16807 $^O ne 'MSWin32'
16808 && (substr($cmd, 0, 4) eq 'sox ' || substr($cmd, 0, 5) eq 'play ')
16809 ) {
16810 # Supported audio package, SoX ('-q' for quiet)
16811 @args = ('play', '-q');
16812  
16813 # $v is in the range 0-100; SoX expects a value in the range 0-1
16814 if ($soundObj->volume) {
16815 push (@args, '-v ' . ($soundObj->volume / 100));
16816 } else {
16817 push (@args, '-v 0');
16818 }
16819  
16820 push (@args, $soundObj->path);
16821  
16822 } else {
16823  
16824 # Unsupported audio package
16825 $cmd =~ s/%s//;
16826 @args = ($cmd, $soundObj->path);
16827 }
16828  
16829 # Play the sound
16830 $harness = IPC::Run::start(\@args);
16831 # Update the GA::Obj::Sound object with the harness for the new sound (the calling function
16832 # should update $soundObj->repeat, if necessary)
16833 $soundObj->ivPoke('harness', $harness);
16834  
16835 return 1;
16836 }
16837  
16838 # Seasonally appropriate logos/icons
16839  
16840 sub getClientLogo {
16841  
16842 # Returns the seasonally-appropriate file path for the client logo, mainly used in the
16843 # Connections window
16844 #
16845 # Expected arguments
16846 # (none besides $self)
16847 #
16848 # Optional arguments
16849 # $adultFlag - If TRUE, show the client logo with an '18' in one corner. If FALSE (or
16850 # 'undef'), show the usual logo
16851 #
16852 # Return values
16853 # 'undef' on improper arguments
16854 # Otherwise returns the file path
16855  
16856 my ($self, $adultFlag, $check) = @_;
16857  
16858 # Local variables
16859 my ($second, $minute, $hour, $dayOfMonth, $month);
16860  
16861 # Check for improper arguments
16862 if (defined $check) {
16863  
16864 return $axmud::CLIENT->writeImproper($self->_objClass . '->getClientLogo', @_);
16865 }
16866  
16867 ($second, $minute, $hour, $dayOfMonth, $month) = localtime();
16868  
16869 # NB $month is in the range 0-11
16870 if (($month == 11 && $dayOfMonth >= 24) || ($month == 0 && $dayOfMonth <= 5)) {
16871  
16872 if (! $adultFlag) {
16873 return $axmud::SHARE_DIR . '/icons/system/client_logo_xmas.png';
16874 } else {
16875 return $axmud::SHARE_DIR . '/icons/system/client_logo_xmas_18.png';
16876 }
16877  
16878 } else {
16879  
16880 if (! $adultFlag) {
16881 return $axmud::SHARE_DIR . '/icons/system/client_logo.png';
16882 } else {
16883 return $axmud::SHARE_DIR . '/icons/system/client_logo_18.png';
16884 }
16885 }
16886 }
16887  
16888 sub getDialogueIcon {
16889  
16890 # Returns the seasonally-appropriate file path for the standard 'dialogue' window icon
16891 #
16892 # Expected arguments
16893 # (none besides $self)
16894 #
16895 # Optional arguments
16896 # $mode - If specified and set to 'large' or 'medium', then the large/medium-size icon
16897 # is used. For any other value (including 'undef'), the standard small icon is
16898 # used
16899 #
16900 # Return values
16901 # 'undef' on improper arguments
16902 # Otherwise returns the file path
16903  
16904 my ($self, $mode, $check) = @_;
16905  
16906 # Local variables
16907 my ($second, $minute, $hour, $dayOfMonth, $month);
16908  
16909 # Check for improper arguments
16910 if (defined $check) {
16911  
16912 return $axmud::CLIENT->writeImproper($self->_objClass . '->getDialogueIcon', @_);
16913 }
16914  
16915 ($second, $minute, $hour, $dayOfMonth, $month) = localtime();
16916  
16917 # NB $month is in the range 0-11
16918 if (($month == 11 && $dayOfMonth >= 24) || ($month == 0 && $dayOfMonth <= 5)) {
16919  
16920 if (defined $mode && $mode eq 'large') {
16921 return $axmud::SHARE_DIR . '/icons/system/dialogue_icon_xmas_large.png';
16922 } elsif (defined $mode && $mode eq 'medium') {
16923 return $axmud::SHARE_DIR . '/icons/system/dialogue_icon_xmas_medium.png';
16924 } else {
16925 return $axmud::SHARE_DIR . '/icons/system/dialogue_icon_xmas.png';
16926 }
16927  
16928 } else {
16929  
16930 if (defined $mode && $mode eq 'large') {
16931 return $axmud::SHARE_DIR . '/icons/system/dialogue_icon_large.png';
16932 } elsif (defined $mode && $mode eq 'medium') {
16933 return $axmud::SHARE_DIR . '/icons/system/dialogue_icon_medium.png';
16934 } else {
16935 return $axmud::SHARE_DIR . '/icons/system/dialogue_icon.png';
16936 }
16937 }
16938 }
16939  
16940 # Auto-backup
16941  
16942 sub checkBackupInterval {
16943  
16944 # Called by $self->start when $self->autoBackupMode is 'interval_start', and by $self->stop
16945 # when $self->autoBackupMode is 'interval_stop'
16946 # Checks whether it is time to perform an auto-backup
16947 #
16948 # Expected arguments
16949 # (none besides $self)
16950 #
16951 # Return values
16952 # 'undef' on improper arguments or if it's not yet time to perform an auto-backup
16953 # 1 if it is time to perform at auto-backup
16954  
16955 my ($self, $check) = @_;
16956  
16957 # Local variables
16958 my ($format, $time, $oldTime, $diff);
16959  
16960 # Check for improper arguments
16961 if (defined $check) {
16962  
16963 return $axmud::CLIENT->writeImproper($self->_objClass . '->checkBackupInterval', @_);
16964 }
16965  
16966 if (! $self->autoBackupInterval) {
16967  
16968 # Don't do auto-backups for the time being
16969 return undef;
16970  
16971 } elsif (! $self->autoBackupDate) {
16972  
16973 # No auto-backup time recorded, so perform an auto-backup now
16974 return 1;
16975  
16976 } else {
16977  
16978 # Otherwise, do the calculation
16979 $format = '%a %b %d, %Y'; # e.g. 'Thu Dec 18, 2010'
16980 $time = Time::Piece->strptime($self->localDate(), $format);
16981 $oldTime = Time::Piece->strptime($self->autoBackupDate, $format);
16982  
16983 $diff = $time->julian_day() - $oldTime->julian_day();
16984  
16985 if ($diff < $self->autoBackupInterval) {
16986 return undef;
16987 } else {
16988 return 1;
16989 }
16990 }
16991 }
16992  
16993 sub doAutoBackup {
16994  
16995 # Called by $self->start or $self->stop when it's time to do an auto-backup
16996 #
16997 # Expected arguments
16998 # (none besides $self)
16999 #
17000 # Return values
17001 # 'undef' on improper arguments or if the auto-backup fails
17002 # 1 on success
17003  
17004 my ($self, $check) = @_;
17005  
17006 # Local variables
17007 my (
17008 $dataDir, $ext, $fileName, $backupPath, $zipObj, $tarObj,
17009 @fileList,
17010 );
17011  
17012 # Check for improper arguments
17013 if (defined $check) {
17014  
17015 return $axmud::CLIENT->writeImproper($self->_objClass . '->doAutoBackup', @_);
17016 }
17017  
17018 # (Code borrowed from GA::Cmd::BackupData, as we don't want client command error messages)
17019  
17020 # Import the Axmud data directory for use in regexes
17021 $dataDir = $axmud::DATA_DIR;
17022  
17023 # In 'default' mode, archive to .zip on MS Windows, and to .tgz on Linux
17024 if ($self->autoBackupFileType eq 'default') {
17025  
17026 if ($^O eq 'MSWin32') {
17027 $ext = 'zip';
17028 } else {
17029 $ext = 'tgz';
17030 }
17031  
17032 } elsif ($self->autoBackupFileType eq 'zip') {
17033 $ext = 'zip';
17034 } else {
17035 $ext = 'tgz';
17036 }
17037  
17038 # Set the filename, appending the time if required
17039 if (! $axmud::CLIENT->autoBackupAppendFlag) {
17040  
17041 $fileName = $axmud::NAME_FILE . '_backup_' . $axmud::CLIENT->localDateString() . '.'
17042 . $ext;
17043  
17044 } else {
17045  
17046 $fileName = $axmud::NAME_FILE . '_backup_' . $axmud::CLIENT->localDateString() . '_'
17047 . $axmud::CLIENT->localClockString() . '.' . $ext;
17048 }
17049  
17050 # If necessary, open a file chooser dialog to decide where to save the exported file
17051 if ($self->autoBackupDir && -e $self->autoBackupDir) {
17052  
17053 $backupPath = $self->autoBackupDir;
17054  
17055 } else {
17056  
17057 $backupPath = $self->mainWin->showFileChooser(
17058 'Backup ' . $axmud::SCRIPT . ' data',
17059 'save',
17060 $fileName,
17061 );
17062 }
17063  
17064 if (! $backupPath) {
17065  
17066 return undef;
17067 }
17068  
17069 # Display a 'dialogue' window while backing up data. The 'undef' argument means 'show the
17070 # standard icon'
17071 if (! $axmud::BLIND_MODE_FLAG) {
17072  
17073 $self->mainWin->showBusyWin(undef, 'Backing up...');
17074 }
17075  
17076 # Get a list of files in the data directory, recursively searching sub-directories
17077 File::Find::find(
17078 sub { push (@fileList, $File::Find::name); },
17079 $dataDir . '/',
17080 );
17081  
17082 # Perform the backup
17083 if ($ext eq 'zip') {
17084  
17085 # Create a zip object
17086 $zipObj = Archive::Zip->new();
17087  
17088 foreach my $file (@fileList) {
17089  
17090 my $modFile;
17091  
17092 if ($file ne $dataDir) {
17093  
17094 $modFile = $file;
17095 $modFile =~ s/$dataDir//;
17096  
17097 # 6 is the default compression level
17098 $zipObj->addFile($file, $modFile, 6);
17099 }
17100 }
17101  
17102 # Save the .zip file. Successful operation returns 0
17103 if ($zipObj->writeToFileNamed($backupPath)) {
17104  
17105 # Close the 'dialogue' window and reset the Client IV that stores it
17106 if ($self->busyWin) {
17107  
17108 $self->mainWin->closeDialogueWin($self->busyWin);
17109 }
17110  
17111 return undef;
17112 }
17113  
17114 } else {
17115  
17116 # Create a tar object
17117 $tarObj = Archive::Tar->new();
17118  
17119 foreach my $file (@fileList) {
17120  
17121 if ($file ne $dataDir) {
17122  
17123 $tarObj->add_files($file);
17124 # Rename each file in the archive to remove the directory structure
17125 $tarObj->rename(substr($file, 1), substr($file, length($dataDir)));
17126 }
17127 }
17128  
17129 # Save the .tgz file
17130 if (
17131 ! $tarObj->write(
17132 $backupPath,
17133 Archive::Tar::COMPRESS_GZIP,
17134 $axmud::NAME_SHORT . '-data',
17135 )
17136 ) {
17137 # Close the 'dialogue' window and reset the Client IV that stores it
17138 if ($self->busyWin) {
17139  
17140 $self->mainWin->closeDialogueWin($self->busyWin);
17141 }
17142  
17143 return undef;
17144 }
17145 }
17146  
17147 # Operation successful. Update IVs so the next scheduled auto-backup occurs on time
17148 if ($self->autoBackupMode eq 'all_start' || $self->autoBackupMode eq 'all_stop') {
17149  
17150 # No scheduled auto-backups; auto-backups occur when Axmud starts/stops
17151 $self->ivUndef('autoBackupDate');
17152  
17153 } else {
17154  
17155 # Scheduled auto-backups
17156 $self->ivPoke('autoBackupDate', $self->localDate());
17157 }
17158  
17159 # Close the 'dialogue' window and reset the Client IV that stores it
17160 if ($self->busyWin) {
17161  
17162 $self->mainWin->closeDialogueWin($self->busyWin);
17163 }
17164  
17165 return 1;
17166 }
17167  
17168 # General-purpose methods
17169  
17170 sub nameCheck {
17171  
17172 # Checks whether a name for a Perl object matches Axmud's naming rules (namely, must be
17173 # between 1 to $maxLength characters, containing letters, numbers and underlines -
17174 # first character can't be a number. International characters, e.g. those in Cyrillic,
17175 # are accepted)
17176 # Also checks that the name doesn't clash with one of Axmud's reserved words
17177 #
17178 # Expected arguments
17179 # $name - the name (string) to be tested
17180 # $maxLength - the maximum string length allowed
17181 #
17182 # Return values
17183 # 'undef' on improper arguments or if $name is not valid, according to Axmud's naming
17184 # rules
17185 # 1 if $name is acceptable
17186  
17187 my ($self, $name, $maxLength, $check) = @_;
17188  
17189 # Check for improper arguments
17190 if (! defined $name || ! defined $maxLength || defined $check) {
17191  
17192 return $axmud::CLIENT->writeImproper($self->_objClass . '->nameCheck', @_);
17193 }
17194  
17195 # Check reserved words
17196 if ($self->ivExists('constReservedHash', lc($name))) {
17197  
17198 return undef;
17199 }
17200  
17201 # Perform the check
17202 $maxLength--;
17203  
17204 if (! ($name =~ m/^[[:alpha:]\_]{1}[[:word:]]{0,$maxLength}$/)) {
17205 return undef;
17206 } else {
17207 return 1;
17208 }
17209 }
17210  
17211 sub intCheck {
17212  
17213 # Checks whether a value is an integer, or not
17214 #
17215 # Expected arguments
17216 # (none besides $self)
17217 #
17218 # Optional arguments
17219 # $num - A value to test. If 'undef' or an empty string, no value is tested (and
17220 # no error message is produced)
17221 # $min - If defined, a minimum value. Can be zero or any floating-point number,
17222 # positive or negative (but will usually be another integer)
17223 # $max - If defined, a maximum value. Can be zero or any floating-point number,
17224 # positive or negative (but will usually be another integer)
17225 #
17226 # Return values
17227 # 'undef' on improper arguments, if $num is not a valid integer, if $min is defined and
17228 # $num is not that value or higher, or if $max is defined and $num is not that value
17229 # or lower
17230 # 1 otherwise
17231  
17232 my ($self, $num, $min, $max, $check) = @_;
17233  
17234 # Check for improper arguments
17235 if (defined $check) {
17236  
17237 return $axmud::CLIENT->writeImproper($self->_objClass . '->intCheck', @_);
17238 }
17239  
17240 if (
17241 ! defined $num
17242 || $num eq ""
17243 || ! ($num =~ m/^[-]?\d+$/)
17244 || (defined $min && $num < $min)
17245 || (defined $max && $num > $max)
17246 ) {
17247 return undef;
17248 } else {
17249 return 1;
17250 }
17251 }
17252  
17253 sub floatCheck {
17254  
17255 # Checks whether a value is a floating-point (decimal) number, or not
17256 #
17257 # NB To check for a floating-point number that is any value above a minimum, do this:
17258 # if (! $axmud::CLIENT->floatCheck($value, $min) || $value == $min) {
17259 #
17260 # Expected arguments
17261 # (none besides $self)
17262 #
17263 # Optional arguments
17264 # $num - A value to test. If 'undef' or an empty string, no value is tested (and
17265 # no error message is produced)
17266 # $min - If defined, a minimum value. Can be zero or any floating-point number,
17267 # positive or negative
17268 # $max - If defined, a maximum value. Can be zero or any floating-point number,
17269 # positive or negative
17270 #
17271 # Return values
17272 # 'undef' on improper arguments, if $num is not a valid floating-point number, if $min is
17273 # defined and $num is not that value or higher, or if $max is defined and $num is not
17274 # that value or lower
17275 # 1 otherwise
17276  
17277 my ($self, $num, $min, $max, $check) = @_;
17278  
17279 # Check for improper arguments
17280 if (defined $check) {
17281  
17282 return $axmud::CLIENT->writeImproper($self->_objClass . '->floatCheck', @_);
17283 }
17284  
17285 if (
17286 ! defined $num
17287 || $num eq ""
17288 || ! ($num =~ m/^[-]?\d+(\.\d*)?$/)
17289 || (defined $min && $num < $min)
17290 || (defined $max && $num > $max)
17291 ) {
17292 return undef;
17293 } else {
17294 return 1;
17295 }
17296 }
17297  
17298 sub ipv4Check {
17299  
17300 # Checks whether a specified string is a valid IPv4 address (using Regexp::IPv4)
17301 #
17302 # Expected arguments
17303 # $string - the string to check
17304 #
17305 # Return values
17306 # 'undef' on improper arguments or if $string is not a valid IPv4 address
17307 # 1 if $string is a valid IPv4 address
17308  
17309 my ($self, $string, $check) = @_;
17310  
17311 # Local variables
17312 my ($digRegex, $regex);
17313  
17314 # Check for improper arguments
17315 if (! defined $string || defined $check) {
17316  
17317 return $axmud::CLIENT->writeImproper($self->_objClass . '->ipv4Check', @_);
17318 }
17319  
17320 # Regexp::IPv4 is not available in Debian, but since it's only three lines of code, we'll
17321 # just import them directly
17322 $digRegex = '(?:25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2})';
17323 $regex = "(?:$digRegex(?:\\.$digRegex){3})";
17324 $regex = qr/$regex/;
17325  
17326 if ($string =~ /^$regex$/) {
17327 return 1;
17328 } else {
17329 return undef;
17330 }
17331 }
17332  
17333 sub ipv6Check {
17334  
17335 # Checks whether a specified string is a valid IPv6 address (using Regexp::IPv6)
17336 #
17337 # Expected arguments
17338 # $string - the string to check
17339 #
17340 # Return values
17341 # 'undef' on improper arguments or if $string is not a valid IPv6 address
17342 # 1 if $string is a valid IPv6 address
17343  
17344 my ($self, $string, $check) = @_;
17345  
17346 # Local variables
17347 my $regex;
17348  
17349 # Check for improper arguments
17350 if (! defined $string || defined $check) {
17351  
17352 return $axmud::CLIENT->writeImproper($self->_objClass . '->ipv6Check', @_);
17353 }
17354  
17355 $regex = $Regexp::IPv6::IPv6_re;
17356  
17357 if ($string =~ /^$regex$/) {
17358 return 1;
17359 } else {
17360 return undef;
17361 }
17362 }
17363  
17364 sub ipv4Get {
17365  
17366 # Contact remote servers to fetch the user's IP address
17367 #
17368 # Expected arguments
17369 # (none besides $self)
17370 #
17371 # Optional arguments
17372 # $forceFlag - The IP address fetched in the first call to this function is stored in
17373 # $self->currentIP. This same value is then returned by each subsequent
17374 # call to this function. However, if this flag is TRUE, the user's IP
17375 # address is fetched again
17376 #
17377 # Return values
17378 # 'undef' on improper arguments or if the IP address can't be fetched
17379 # Otherwise, the user's IP (in the form '101.102.103.104')
17380  
17381 my ($self, $forceFlag, $check) = @_;
17382  
17383 # Check for improper arguments
17384 if (defined $check) {
17385  
17386 return $axmud::CLIENT->writeImproper($self->_objClass . '->ipv4Get', @_);
17387 }
17388  
17389 if ($forceFlag) {
17390  
17391 $self->ivUndef('currentIP');
17392 }
17393  
17394 if ($self->currentIP) {
17395  
17396 return self->currentIP;
17397  
17398 } else {
17399  
17400 # $self->ipLookupList lists several servers, in case one of them isn't available
17401 foreach my $url ($self->ipLookupList) {
17402  
17403 my ($obj, $response);
17404  
17405 # (The default timeout is 60, which is much to long for these purposes, especially
17406 # since we have other URLs to try)
17407 $obj = HTTP::Tiny->new('timeout' => 1);
17408 if ($obj) {
17409  
17410 $response = $obj->get($url);
17411 if ($response->{success} && $response->{content} =~ m/^\d+\.\d+\.\d+\.\d+$/) {
17412  
17413 $self->ivPoke('currentIP', $response->{content});
17414  
17415 return $self->currentIP;
17416 }
17417 }
17418 }
17419 }
17420  
17421 # No IP address found
17422 $self->ivUndef('currentIP');
17423  
17424 return undef;
17425 }
17426  
17427 sub regexCheck {
17428  
17429 # Test that a regex is valid without generating a Perl error/warning message
17430 #
17431 # Expected arguments
17432 # $regex - The regex to test
17433 #
17434 # Return values
17435 # 'undef' on improper arguments or if $regex is a valid regular expression
17436 # Otherwise, returns the error message generated by the invalid regular expression
17437  
17438 my ($self, $regex, $check) = @_;
17439  
17440 # Local variables
17441 my $result;
17442  
17443 # Check for improper arguments
17444 if (! defined $regex || defined $check) {
17445  
17446 return $axmud::CLIENT->writeImproper($self->_objClass . '->regexCheck', @_);
17447 }
17448  
17449 # Set global variables to intercept the Perl error/warning message
17450 $axmud::TEST_REGEX_FLAG = TRUE;
17451 $axmud::TEST_REGEX_ERROR = undef;
17452 # Test the regex
17453 eval { qr/$regex/ };
17454 # The global variable is already set to 'undef' for a valid regex, or the error message
17455 # generated by an invalid regex
17456 $result = $axmud::TEST_REGEX_ERROR;
17457 $axmud::TEST_REGEX_FLAG = FALSE;
17458  
17459 if (! defined $result) {
17460  
17461 return undef;
17462  
17463 } else {
17464  
17465 # Remove the 'at lib/Games/Axmud/Client.pm line xxxxx' portion, which the user
17466 # definitely doesn't want
17467 $result =~ s/at lib.*Client\.pm line \d+.*//;
17468 # Also remove the final newline character
17469 chomp $result;
17470  
17471 return $result;
17472 }
17473 }
17474  
17475 sub commify {
17476  
17477 # Can be called by anything
17478 # Adds commas, full stops/periods, spaces or underlines/underscores to long numbers (e.g.
17479 # converts 1000000 to 1,000,000 / 1.000.000 / 1 000 000 / 1_000_000)
17480 # Returns the modified string
17481 #
17482 # Expected arguments
17483 # (none besides $self)
17484 #
17485 # Optional arguments
17486 # $number - An integer or floating point value, e.g. 1.124. If not defined, then 'undef'
17487 # is returned
17488 # $mode - 'none' to add nothing, 'comma' to add commas, 'europe' to add European-style
17489 # full stops/periods, 'brit' to add British-style spaces, 'underline' to use
17490 # underlines/underscores. If 'undef', $self->commifyMode is used. If an
17491 # unrecognised value is specified, adds nothing
17492 #
17493 # Return values
17494 # 'undef' if no arguments specified
17495 # Otherwise returns the modified string
17496  
17497 my ($self, $number, $mode, $check) = @_;
17498  
17499 # (No check for improper arguments)
17500  
17501 if (! defined $mode) {
17502  
17503 $mode = $self->commifyMode;
17504 }
17505  
17506 if (! defined $number) {
17507  
17508 return undef;
17509  
17510 } elsif ($mode eq 'comma') {
17511  
17512 # (add commas)
17513 1 while $number =~ s/^([-+]?\d+)(\d{3})/$1,$2/;
17514  
17515 } elsif ($mode eq 'europe') {
17516  
17517 # (add European-style full stops/periods)
17518 1 while $number =~ s/^([-+]?\d+)(\d{3})/$1.$2/;
17519  
17520 } elsif ($mode eq 'brit') {
17521  
17522 # (add British-style spaces)
17523 1 while $number =~ s/^([-+]?\d+)(\d{3})/$1 $2/;
17524  
17525 } elsif ($mode eq 'underline') {
17526  
17527 # (add underlines/underscores)
17528 1 while $number =~ s/^([-+]?\d+)(\d{3})/$1_$2/;
17529 }
17530  
17531 return $number;
17532 }
17533  
17534 sub getKeycode {
17535  
17536 # Called by anything
17537 # Given an Axmud standard keycode, or one of the recognised alternative versions of a
17538 # standard keycode, returns the corresponding keycode string (a string containing one or
17539 # more keycodes, separated by spaces)
17540 #
17541 # Expected arguments
17542 # $standard - The standard Axmud keycode type (a key in $self->constKeycodeHash) or the
17543 # alternative version of this type (a key in $self->constAltKeycodeHash)
17544 #
17545 # Return values
17546 # 'undef' on improper arguments or if $standard is an invalid standard/alternative keycode
17547 # 1 otherwise
17548  
17549 my ($self, $standard, $check) = @_;
17550  
17551 # Check for improper arguments
17552 if (! defined $standard || defined $check) {
17553  
17554 return $axmud::CLIENT->writeImproper($self->_objClass . '->getKeycode', @_);
17555 }
17556  
17557 # If $standard is an alternative keycode type, translate it into the standard keycode type
17558 if ($axmud::CLIENT->ivExists('constAltKeycodeHash', $standard)) {
17559  
17560 $standard = $axmud::CLIENT->ivShow('constAltKeycodeHash', $standard);
17561  
17562 # Otherwise, check that $type is a valid standard keycode type
17563 } elsif (! $self->ivExists('constKeycodeHash', $standard)) {
17564  
17565 # (No error message displayed - just return 'undef')
17566 return undef;
17567 }
17568  
17569 # Return the keycode string
17570 return $self->ivShow('keycodeHash', $standard);
17571 }
17572  
17573 sub reverseKeycode {
17574  
17575 # Called by anything
17576 # Converts one of the current system's keycodes (e.g. 'ISO_Level3_Shift' on Linux/*BSD,
17577 # 'Alt_R' on MS Windows) into an Axmud standard keycode
17578 #
17579 # Expected arguments
17580 # $sysKeycode - The system keycode, e.g. 'ISO_Level3_Shift', 'Alt_R'
17581 #
17582 # Return values
17583 # 'undef' on improper arguments
17584 # Otherwise returns the Axmud standard keycode. $self->constKeycodeHash doesn't include
17585 # the keycodes for ordinary letters and numbers, so if $sysKeycode isn't in that
17586 # hash, return $sysKeycode unmodified
17587  
17588 my ($self, $sysKeycode, $check) = @_;
17589  
17590 # Local variables
17591 my $standard;
17592  
17593 # Check for improper arguments
17594 if (! defined $sysKeycode || defined $check) {
17595  
17596 return $axmud::CLIENT->writeImproper($self->_objClass . '->reverseKeycode', @_);
17597 }
17598  
17599 $standard = $axmud::CLIENT->ivShow('revKeycodeHash', $sysKeycode);
17600 if (! $standard) {
17601 return $sysKeycode;
17602 } else {
17603 return $standard;
17604 }
17605 }
17606  
17607 sub convertKeycodeString {
17608  
17609 # Called by GA::Generic::Cmd->addInterface and ->modifyInterface while adding or modifying
17610 # a macro
17611 # The macro's stimulus is one of Axmud's standard keycodes (like 'f5') or a keycode string
17612 # (like 'shift f5' or 'ctrl a')
17613 # Standard keycodes in a keycode string must be in a given order (i.e. 'ctrl shift f5', not
17614 # 'shift ctrl f5' or even 'f5 shift ctrl')
17615 # This function changes the order of words in the keycode string, if necessary, and returns
17616 # the modified string
17617 #
17618 # Expected arguments
17619 # $string - A string containing one or more Axmud standard keycodes
17620 #
17621 # Return values
17622 # 'undef' on improper arguments
17623 # Otherwise returns the modified (or original) keycode string
17624  
17625 my ($self, $string, $check) = @_;
17626  
17627 # Local variables
17628 my (
17629 $ctrlFlag, $shiftFlag, $altFlag, $altGrFlag, $newString,
17630 @list, @modList,
17631 );
17632  
17633 # Check for improper arguments
17634 if (! defined $string || defined $check) {
17635  
17636 return $axmud::CLIENT->writeImproper($self->_objClass . '->convertKeycodeString', @_);
17637 }
17638  
17639 # Split the string into a list of words
17640 @list = split(m/\s+/, $string);
17641  
17642 # Go through @list, removing the 'ctrl', 'shift', 'alt', 'alt_gr' (which we'll put back
17643 # later)
17644 foreach my $keycode (@list) {
17645  
17646 if ($keycode eq 'ctrl') {
17647 $ctrlFlag = TRUE;
17648 } elsif ($keycode eq 'shift') {
17649 $shiftFlag = TRUE;
17650 } elsif ($keycode eq 'alt') {
17651 $altFlag = TRUE;
17652 } elsif ($keycode eq 'alt_gr') {
17653 $altGrFlag = TRUE;
17654 } else {
17655 push (@modList, $keycode);
17656 }
17657 }
17658  
17659 # Now compile a new keycode string
17660 $newString = '';
17661  
17662 if ($ctrlFlag) {
17663  
17664 $newString .= 'ctrl';
17665 }
17666  
17667 if ($shiftFlag) {
17668  
17669 if ($newString) {
17670 $newString .= ' shift';
17671 } else {
17672 $newString .= 'shift';
17673 }
17674 }
17675  
17676 if ($altFlag) {
17677  
17678 if ($newString) {
17679 $newString .= ' alt';
17680 } else {
17681 $newString .= 'alt';
17682 }
17683 }
17684  
17685 if ($altGrFlag) {
17686  
17687 if ($newString) {
17688 $newString .= ' alt_gr';
17689 } else {
17690 $newString .= 'alt_gr';
17691 }
17692 }
17693  
17694 foreach my $keycode (@modList) {
17695  
17696 # Preserve the order of keycodes other than 'ctrl', 'shift', 'alt' or 'alt_gr'
17697 if ($newString) {
17698 $newString .= ' ' . $keycode;
17699 } else {
17700 $newString .= $keycode;
17701 }
17702 }
17703  
17704 return $newString;
17705 }
17706  
17707 sub getTime {
17708  
17709 # Called by several functions which handle the task and incoming data loops
17710 # Returns the system's current time (expressed in seconds since the system epoch, to three
17711 # decimal places), using a call to Time::HiRes->gettimeofday()
17712 #
17713 # Expected arguments
17714 # (none besides $self)
17715 #
17716 # Return values
17717 # 'undef' on improper arguments
17718 # The system time on success
17719  
17720 my ($self, $check) = @_;
17721  
17722 # Local variables
17723 my ($secs, $micros);
17724  
17725 # Check for improper arguments
17726 if (defined $check) {
17727  
17728 return $axmud::CLIENT->writeImproper($self->_objClass . '->getTime', @_);
17729 }
17730  
17731 # Get the system time in seconds and microseconds
17732 ($secs, $micros) = Time::HiRes::gettimeofday();
17733 # Convert to seconds (to three decimal places)
17734 return ($secs + (int($micros / 1000)) / 1000);
17735 }
17736  
17737 sub getCounter {
17738  
17739 # Called by anything, but mostly by GA::Session->getTimeLabelText
17740 # Converts a time in seconds into a string like '35:07' or '4:35:07' (ignores milliseconds,
17741 # so 5.741 seconds is returned as the string '0:05'
17742 #
17743 # Expected arguments
17744 # $time - A time in seconds
17745 #
17746 # Return values
17747 # 'undef' on improper arguments
17748 # If $time is not a valid number (0 or positive), returns 0
17749 # Otherwise, returns a string like '35:07' or '4:35:07'
17750  
17751 my ($self, $time, $check) = @_;
17752  
17753 # Local variables
17754 my ($hours, $mins, $secs);
17755  
17756 # Check for improper arguments
17757 if (! defined $time || defined $check) {
17758  
17759 return $axmud::CLIENT->writeImproper($self->_objClass . '->getCounter', @_);
17760 }
17761  
17762 # Check $time is a valid number
17763 if (! $self->floatCheck($time, 0)) {
17764  
17765 return 0;
17766 }
17767  
17768 # Convert $time
17769 $mins = int ($time / 60);
17770 $secs = $time % 60;
17771  
17772 $hours = int ($mins / 60);
17773 $mins = $mins % 60;
17774  
17775 if (! $hours) {
17776 return $mins . sprintf(':%02d', $secs);
17777 } else {
17778 return $hours . sprintf(':%02d:%02d', $mins, $secs);
17779 }
17780 }
17781  
17782 sub localTime {
17783  
17784 # Converts the output from Perl's localtime() function into the following format:
17785 # e.g. 09:17:12, Thu Dec 18, 2010
17786 #
17787 # Expected arguments
17788 # (none besides $self)
17789 #
17790 # Return values
17791 # 'undef' on improper arguments
17792 # Otherwise the string described above
17793  
17794 my ($self, $check) = @_;
17795  
17796 # Local variables
17797 my (
17798 $second, $minute, $hour, $dayOfMonth, $month, $year, $yearOffset, $dayOfWeek,
17799 $dayOfYear, $daylightSavings,
17800 );
17801  
17802 # Check for improper arguments
17803 if (defined $check) {
17804  
17805 return $axmud::CLIENT->writeImproper($self->_objClass . '->localTime', @_);
17806 }
17807  
17808 (
17809 $second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear,
17810 $daylightSavings,
17811 ) = localtime();
17812  
17813 $year = 1900 + $yearOffset;
17814  
17815 return (
17816 sprintf('%02d:%02d:%02d, ', $hour, $minute, $second)
17817 . $self->ivIndex('customDayList', $dayOfWeek)
17818 . ' ' . $self->ivIndex('customMonthList', $month)
17819 . " $dayOfMonth, $year"
17820 );
17821 }
17822  
17823 sub localClock {
17824  
17825 # Converts the output from Perl's localtime() function into the following format:
17826 # e.g. 09:17:12
17827 #
17828 # Expected arguments
17829 # (none besides $self)
17830 #
17831 # Return values
17832 # 'undef' on improper arguments
17833 # Otherwise the string described above
17834  
17835 my ($self, $check) = @_;
17836  
17837 # Local variables
17838 my ($second, $minute, $hour);
17839  
17840 # Check for improper arguments
17841 if (defined $check) {
17842  
17843 return $axmud::CLIENT->writeImproper($self->_objClass . '->localClock', @_);
17844 }
17845  
17846 ($second, $minute, $hour) = localtime();
17847  
17848 return (sprintf('%02d:%02d:%02d', $hour, $minute, $second));
17849 }
17850  
17851 sub localClockString {
17852  
17853 # Converts the output from Perl's localtime() function into the following format:
17854 # e.g. 09_17_12
17855 #
17856 # Expected arguments
17857 # (none besides $self)
17858 #
17859 # Return values
17860 # 'undef' on improper arguments
17861 # Otherwise the string described above
17862  
17863 my ($self, $check) = @_;
17864  
17865 # Local variables
17866 my ($second, $minute, $hour);
17867  
17868 # Check for improper arguments
17869 if (defined $check) {
17870  
17871 return $axmud::CLIENT->writeImproper($self->_objClass . '->localClock', @_);
17872 }
17873  
17874 ($second, $minute, $hour) = localtime();
17875  
17876 return (sprintf('%.2d_%.2d_%.2d', $hour, $minute, $second));
17877 }
17878  
17879 sub localDate {
17880  
17881 # Converts the output from Perl's localtime() function into the following format:
17882 # e.g. Thu Dec 18, 2010
17883 #
17884 # Expected arguments
17885 # (none besides $self)
17886 #
17887 # Return values
17888 # 'undef' on improper arguments
17889 # Otherwise the string described above
17890  
17891 my ($self, $check) = @_;
17892  
17893 # Local variables
17894 my (
17895 $second, $minute, $hour, $dayOfMonth, $month, $year, $yearOffset, $dayOfWeek,
17896 $dayOfYear, $daylightSavings,
17897 );
17898  
17899 # Check for improper arguments
17900 if (defined $check) {
17901  
17902 return $axmud::CLIENT->writeImproper($self->_objClass . '->localDate', @_);
17903 }
17904  
17905 (
17906 $second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear,
17907 $daylightSavings
17908 ) = localtime();
17909  
17910 $year = 1900 + $yearOffset;
17911  
17912 return $self->ivIndex('customDayList', $dayOfWeek)
17913 . ' ' . $self->ivIndex('customMonthList', $month)
17914 . " $dayOfMonth, $year";
17915 }
17916  
17917 sub localDateString {
17918  
17919 # Converts the output from Perl's localtime() function into the following format:
17920 # e.g. 101218 (in format YYMMDD)
17921 #
17922 # Expected arguments
17923 # (none besides $self)
17924 #
17925 # Return values
17926 # 'undef' on improper arguments
17927 # Otherwise the string described above
17928  
17929 my ($self, $check) = @_;
17930  
17931 # Local variables
17932 my (
17933 $second, $minute, $hour, $dayOfMonth, $month, $year, $yearOffset, $dayOfWeek,
17934 $dayOfYear, $daylightSavings,
17935 );
17936  
17937 # Check for improper arguments
17938 if (defined $check) {
17939  
17940 return $axmud::CLIENT->writeImproper($self->_objClass . '->localDateString', @_);
17941 }
17942  
17943 (
17944 $second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear,
17945 $daylightSavings,
17946 ) = localtime();
17947  
17948 # $month is in the range 0-11
17949 $month++;
17950 $year = 1900 + $yearOffset;
17951  
17952 return (sprintf('%.2d%.2d%.2d', substr($year, 2), $month, $dayOfMonth));
17953 }
17954  
17955 sub convertTime {
17956  
17957 # Alternative to $self->localTime, that converts a specified system time rather than the
17958 # current system time into a string in the following format:
17959 # e.g. 09:17:12, Thu Dec 18, 2010
17960 #
17961 # Expected arguments
17962 # $otherTime - A system time (past, present or future) in seconds
17963 #
17964 # Optional arguments
17965 # $mode - If 'clock', only the clock component (e.g. 09:17:12) is returned. If
17966 # 'date', only the date component (e.g. Thu Dec 18, 2010). If 'undef',
17967 # FALSE or any other value, the full string is returned
17968 #
17969 # Return values
17970 # 'undef' on improper arguments
17971 # Otherwise the string described above
17972  
17973 my ($self, $otherTime, $mode, $check) = @_;
17974  
17975 # Local variables
17976 my (
17977 $second, $minute, $hour, $dayOfMonth, $month, $year, $yearOffset, $dayOfWeek,
17978 $dayOfYear, $daylightSavings,
17979 );
17980  
17981 # Check for improper arguments
17982 if (defined $check) {
17983  
17984 return $axmud::CLIENT->writeImproper($self->_objClass . '->convertTime', @_);
17985 }
17986  
17987 (
17988 $second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear,
17989 $daylightSavings,
17990 ) = localtime($otherTime);
17991  
17992 $year = 1900 + $yearOffset;
17993  
17994 if (defined $mode) {
17995  
17996 if ($mode eq 'clock') {
17997  
17998 return sprintf('%02d:%02d:%02d', $hour, $minute, $second);
17999  
18000 } elsif ($mode eq 'date') {
18001  
18002 return $self->ivIndex('customDayList', $dayOfWeek) . ' '
18003 . $self->ivIndex('customMonthList', $month)
18004 . " $dayOfMonth, $year";
18005 }
18006 }
18007  
18008 # Default - return full string
18009 return (
18010 sprintf('%02d:%02d:%02d, ', $hour, $minute, $second)
18011 . $self->ivIndex('customDayList', $dayOfWeek)
18012 . ' ' . $self->ivIndex('customMonthList', $month)
18013 . " $dayOfMonth, $year"
18014 );
18015 }
18016  
18017 sub trimWhitespace {
18018  
18019 # Can be called anything
18020 # Removes all whitespace at the beginning and end of a string
18021 # e.g. ' You are here. He is there <tab>'
18022 # >> 'You are here. He is there.'
18023 # Optionally replaces space in the middle of the string with a single space character
18024 # e.g. ' You are here. He is there <tab>'
18025 # >> 'You are here. He is there.'
18026 #
18027 # Expected arguments
18028 # $string - The string to trim
18029 #
18030 # Optional arguments
18031 # $flag - If set to TRUE, replaces space in the middle of the string; 'undef' otherwise
18032 #
18033 # Return values
18034 # 'undef' on improper arguments
18035 # Otherwise returns the trimmed string
18036  
18037 my ($self, $string, $flag, $check) = @_;
18038  
18039 # Check for improper arguments
18040 if (! defined $string || defined $check) {
18041  
18042 return $axmud::CLIENT->writeImproper($self->_objClass . '->trimWhitespace', @_);
18043 }
18044  
18045 # Trim whitespace from the beginning of the string
18046 $string =~ s/^\s+//;
18047 # Trim whitespace from the end of the string
18048 $string =~ s/\s+$//;
18049  
18050 if ($flag) {
18051  
18052 # Shorten whitespace in the middle of the string
18053 $string =~ s/\s+/ /g;
18054 }
18055  
18056 return $string;
18057 }
18058  
18059 sub convertVersion {
18060  
18061 # Converts an Axmud version (in the form 1.2.11) into a single integer number (in this case,
18062 # 1,002,011) so that version numbers can be compared
18063 # The string '1.2.11' is made up of three components. The first is converted into a number
18064 # measured in millions, the second a number measured in thousands, the third is not
18065 # converted
18066 # In this case, we have 1,000,000 + 2000 + 11 = 1002011
18067 # We assume that the 2nd and 3rd components aren't larger than 999
18068 #
18069 # Expected arguments
18070 # $string - An Axmud version string in the form 1.2.11 (possibly the value stored in
18071 # $axmud::VERSION)
18072 #
18073 # Return values
18074 # 'undef' on improper arguments
18075 # Otherwise, the converted string in the form of an integer number
18076  
18077 my ($self, $string, $check) = @_;
18078  
18079 # Local variables
18080 my (
18081 $number,
18082 @list,
18083 );
18084  
18085 # Check for improper arguments
18086 if (! defined $string || defined $check) {
18087  
18088 return $axmud::CLIENT->writeImproper($self->_objClass . '->convertVersion', @_);
18089 }
18090  
18091 # Convert the string into its three components
18092 @list = split(/\./, $string);
18093  
18094 # Convert the components into a single number
18095 $number = ($list[0] * 1_000_000) + ($list[1] * 1_000) + $list[2];
18096  
18097 return $number;
18098 }
18099  
18100 sub convertRoman {
18101  
18102 # Converts an integer into Roman numerals (based on code from Text::Roman version by
18103 # Stanislaw Pusep)
18104 #
18105 # Expected arguments
18106 # $value - Integer value between 1 and 3999
18107 #
18108 # Return values
18109 # 'undef' on improper arguments
18110 # An empty string if $value is not an integer between 1 and 3999
18111 # Otherwise returns the equivalent Roman numeral in upper-case letters, e.g. 'XII'
18112  
18113 my ($self, $value, $check) = @_;
18114  
18115 # Local variables
18116 my (
18117 $string,
18118 %reverseHash,
18119 );
18120  
18121 # Check for improper arguments
18122 if (! defined $value || defined $check) {
18123  
18124 return $axmud::CLIENT->writeImproper($self->_objClass . '->convertRoman', @_);
18125 }
18126  
18127 # Check that $value is valid
18128 if (! $self->intCheck($value, 1, 3999)) {
18129  
18130 return '';
18131 }
18132  
18133 # Do the conversion
18134 %reverseHash = reverse $self->constRomanHash;
18135 for (reverse sort { $a <=> $b } $self->ivValues('constRomanHash')) {
18136  
18137 $string .= $reverseHash{$_} x int($value / $_);
18138 $value %= $_;
18139 }
18140  
18141 return $string;
18142 }
18143  
18144 sub splitText {
18145  
18146 # Splits a line of text into a specified number of rows separated by line break characters
18147 # Each line will be no longer than a specified number of characters, but words are not
18148 # split (unless they're longer than the line)
18149 # Discards any extra text and optionally appends an ellipsis if doing so
18150 #
18151 # Expected arguments
18152 # $line - The line of text to split
18153 # $rows - The maximum number of rows. If 0, there is no maximum (and no text is
18154 # discarded)
18155 # $columns - The maximum number of columns per line (minimum 10)
18156 #
18157 # Optional arguments
18158 # $ellipsisFlag - If set to TRUE, an ellipsis is appended if any text is discarded.
18159 # If set to FALSE (or 'undef'), no ellipsis is appended
18160 # $noHyphenFlag - If set to TRUE, no hyphen is added at the end of a word which has
18161 # been split. If FALSE (or 'undef'), no hyphens are ever added
18162 #
18163 # Return values
18164 # The unmodified value of $text on improper arguments, or if $rows and/or $columns are
18165 # invalid values
18166 # Otherwise, returns the modified string
18167  
18168 my ($self, $line, $rows, $columns, $ellipsisFlag, $hyphenFlag, $check) = @_;
18169  
18170 # Local variables
18171 my (
18172 $hyphen, $keep, $newLine,
18173 @array,
18174 );
18175  
18176 # Check for improper arguments
18177 if (! defined $line || ! defined $rows || ! defined $columns || defined $check) {
18178  
18179 $axmud::CLIENT->writeImproper($self->_objClass . '->splitText', @_);
18180 return $line;
18181 }
18182  
18183 # Check for valid values of $rows and $columns
18184 if (! $self->intCheck($rows, 0) || ! $self->intCheck($columns, 10)) {
18185  
18186 return $line;
18187 }
18188  
18189 # Use a hyphen, or not
18190 if (! $hyphenFlag) {
18191 $hyphen = '';
18192 } else {
18193 $hyphen = '-';
18194 }
18195  
18196 # Replace any existing newline characters with spaces
18197 $line =~ s/\n+/ /g;
18198  
18199 # Split the text into distinct lines
18200 do {
18201  
18202 my ($i, $gap);
18203  
18204 $i = 0; # Search the text, character by character
18205 $keep = 0; # If splitting on a forward slash, preserve it
18206  
18207 if (length($line) <= $columns) {
18208  
18209 # No need to split anything (and this is the final iteration)
18210 push(@array, $line);
18211 $line = '';
18212  
18213 } else {
18214  
18215 # The line is going to be split near character number $columns. Find the space (or
18216 # tab, or forward slash) nearest to the end of the line
18217 OUTER: for ($i = $columns; $i > 0; $i--) {
18218  
18219 my $char = substr($line, $i, 1);
18220  
18221 if ($char eq " " || $char eq "\t") {
18222  
18223 last OUTER;
18224  
18225 } elsif ($char eq "/") {
18226  
18227 $keep = 1;
18228 last OUTER;
18229 }
18230 }
18231  
18232 # A space (or tab or forward slash) was found. Split the line there
18233 if ($i > 1) {
18234  
18235 push (@array, substr($line, 0, ($i + $keep)));
18236 $line = substr($line, ($i + 1));
18237  
18238 # There is no space at which the line can be split. Split a word (using a hyphen, if
18239 # allowed)
18240 } else {
18241  
18242 push (@array, substr($line, 0, ($columns)) . $hyphen);
18243 $line = substr($line, $columns);
18244 }
18245 }
18246  
18247 } until ($line eq '' || ($rows && (scalar @array) >= $rows));
18248  
18249 # Join the distinct lines together as a single string, with the lines separated by newline
18250 # characters
18251 $newLine = join("\n", @array);
18252 # If we're discarding extra text, append an ellipsis (if allowed)
18253 if ($line && $ellipsisFlag) {
18254  
18255 $newLine .= '...';
18256 }
18257  
18258 return $newLine;
18259 }
18260  
18261 sub encodeJson {
18262  
18263 # Uses the JSON module to convert a Perl data structure to a UTF-8 encoded binary string
18264 #
18265 # Expected arguments
18266 # $data - The Perl data structure to encode
18267 #
18268 # Return values
18269 # 'undef' on improper arguments or if the conversion fails
18270 # Otherwise returns the binary string
18271  
18272 my ($self, $data, $check) = @_;
18273  
18274 # Local variables
18275 my $obj;
18276  
18277 # Check for improper arguments
18278 if (! defined $data || defined $check) {
18279  
18280 return $axmud::CLIENT->writeImproper($self->_objClass . '->encodeJson', @_);
18281 }
18282  
18283 $obj = JSON->new();
18284 $obj->allow_nonref();
18285 $obj->allow_unknown();
18286 $obj->space_before();
18287 $obj->space_after();
18288  
18289 return $obj->utf8->encode($data);
18290 }
18291  
18292 sub decodeJson {
18293  
18294 # Uses the JSON module to convert a UTF-8 encoded binary string to a Perl data structure
18295 #
18296 # Expected arguments
18297 # $data - The string to decode
18298 #
18299 # Return values
18300 # 'undef' on improper arguments, if $data is an empty string (or contains just space
18301 # characters), or if the conversion fails
18302 # Otherwise returns the Perl data structure
18303  
18304 my ($self, $data, $check) = @_;
18305  
18306 # Local variables
18307 my $obj;
18308  
18309 # Check for improper arguments
18310 if (! defined $data || defined $check) {
18311  
18312 return $axmud::CLIENT->writeImproper($self->_objClass . '->decodeJson', @_);
18313 }
18314  
18315 # (Materia magica presents an ATCP/GMCP packet which produces a $data consisting of a single
18316 # space character, so we need to check for that)
18317 if ($data eq '' || $data =~ m/^\s*$/) {
18318  
18319 return undef;
18320 }
18321  
18322 $obj = JSON->new();
18323 $obj->allow_nonref();
18324 $obj->allow_unknown();
18325  
18326 return $obj->utf8->decode($data);
18327 }
18328  
18329 sub benchMark {
18330  
18331 # Can be called by anything
18332 # Stores the current system time in $self->benchMarkTime
18333 # The subsequent call to $self->stopBenchMark calculates the time that has elapsed between
18334 # the two function calls
18335 #
18336 # Expected arguments
18337 # (none besides $self)
18338 #
18339 # Return values
18340 # 1
18341  
18342 my ($self) = @_;
18343  
18344 # Local variables
18345 my ($secs, $micros);
18346  
18347 # (No improper arguments check for speed)
18348  
18349 # Store the system time to 3dp
18350 ($secs, $micros) = Time::HiRes::gettimeofday();
18351 $self->{benchMarkTime} = ($secs * 1000000) + $micros;
18352  
18353 return 1;
18354 }
18355  
18356 sub stopBenchMark {
18357  
18358 # Can be called by anything
18359 # Works out the time (in microseconds) that has elapsed since the previous call to
18360 # $self->benchMark, and writes it to the terminal, updating averaging IVs at the same time
18361 #
18362 # Expected arguments
18363 # (none besides $self)
18364 #
18365 # Return values
18366 # 1
18367  
18368 my ($self) = @_;
18369  
18370 # Local variable
18371 my ($secs, $micros, $time, $count, $total, $average, $count2, $total2, $average2);
18372  
18373 # (No improper arguments check for speed)
18374  
18375 if (! $self->{benchMarkTime}) {
18376  
18377 # Bad call
18378 return 1;
18379 }
18380  
18381 # Get the system time to 3dp
18382 ($secs, $micros) = Time::HiRes::gettimeofday();
18383 $time = ($secs * 1000000) + $micros - $self->{benchMarkTime};
18384  
18385 # Calculate average of the short list
18386 $self->ivPush('benchMarkShortList', $time);
18387 $count = $self->ivNumber('benchMarkShortList');
18388 if ($count >= 10) {
18389  
18390 $self->ivShift('benchMarkShortList');
18391 $count--;
18392 }
18393  
18394 $total = 0;
18395 foreach my $time ($self->benchMarkShortList) {
18396  
18397 $total += $time;
18398 }
18399  
18400 $average = int($total / $count);
18401  
18402 # Calculate average of the long list
18403 $self->ivPush('benchMarkLongList', $time);
18404 $count2 = $self->ivNumber('benchMarkLongList');
18405 if ($count2 >= 100) {
18406  
18407 $self->ivShift('benchMarkLongList');
18408 $count2--;
18409 }
18410  
18411 $total2 = 0;
18412 foreach my $time ($self->benchMarkLongList) {
18413  
18414 $total2 += $time;
18415 }
18416  
18417 $average2 = int($total2 / $count2);
18418  
18419 print "BENCHMARK: time $time, recent $average, average $average2\n";
18420  
18421 return 1;
18422 }
18423  
18424 ##################
18425 # Accessors - set
18426  
18427 sub set_aboutWin {
18428  
18429 my ($self, $winObj, $check) = @_;
18430  
18431 # Check for improper arguments
18432 if (defined $check) {
18433  
18434 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_aboutWin', @_);
18435 }
18436  
18437 # Update IVs
18438 $self->ivPoke('aboutWin', $winObj);
18439  
18440 return 1;
18441 }
18442  
18443 sub set_activateGridFlag {
18444  
18445 my ($self, $flag, $check) = @_;
18446  
18447 # Check for improper arguments
18448 if (! defined $flag || defined $check) {
18449  
18450 return $axmud::CLIENT->writeImproper(
18451 $self->_objClass . '->set_activateGridFlag',
18452 @_,
18453 );
18454 }
18455  
18456 if ($flag) {
18457 $self->ivPoke('activateGridFlag', TRUE);
18458 } else {
18459 $self->ivPoke('activateGridFlag', FALSE);
18460 }
18461  
18462 # The data stored in this IV is saved in the 'config' file
18463 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_activateGridFlag');
18464  
18465 return 1;
18466 }
18467  
18468 sub add_activeKeycode {
18469  
18470 my ($self, $keycode, $check) = @_;
18471  
18472 # Check for improper arguments
18473 if (! defined $keycode || defined $check) {
18474  
18475 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_activeKeycode', @_);
18476 }
18477  
18478 $self->ivAdd('activeKeycodeHash', $keycode, undef);
18479  
18480 return 1;
18481 }
18482  
18483 sub reset_activeKeycodes {
18484  
18485 my ($self, $check) = @_;
18486  
18487 # Local variables
18488 my %hash;
18489  
18490 # Check for improper arguments
18491 if (defined $check) {
18492  
18493 return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_activeKeycodes', @_);
18494 }
18495  
18496 OUTER: foreach my $session ($self->listSessions()) {
18497  
18498 INNER: foreach my $keycode ($session->ivValues('macroHash')) {
18499  
18500 $hash{$keycode} = undef;
18501 }
18502 }
18503  
18504 $self->ivPoke('activeKeycodeHash', %hash);
18505 $self->ivPoke('resetKeycodesFlag', FALSE);
18506  
18507 return 1;
18508 }
18509  
18510 sub set_allowAsciiBellFlag {
18511  
18512 my ($self, $flag, $check) = @_;
18513  
18514 # Check for improper arguments
18515 if (! defined $flag || defined $check) {
18516  
18517 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_allowAsciiBellFlag', @_);
18518 }
18519  
18520 if ($flag) {
18521 $self->ivPoke('allowAsciiBellFlag', TRUE);
18522 } else {
18523 $self->ivPoke('allowAsciiBellFlag', FALSE);
18524 }
18525  
18526 # The data stored in this IV is saved in the 'config' file
18527 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_allowAsciiBellFlag');
18528  
18529 return 1;
18530 }
18531  
18532 sub set_allowBusyWinFlag {
18533  
18534 my ($self, $flag, $check) = @_;
18535  
18536 # Check for improper arguments
18537 if (! defined $flag || defined $check) {
18538  
18539 return $axmud::CLIENT->writeImproper(
18540 $self->_objClass . '->set_allowBusyWinFlag',
18541 @_,
18542 );
18543 }
18544  
18545 if ($flag) {
18546 $self->ivPoke('allowBusyWinFlag', TRUE);
18547 } else {
18548 $self->ivPoke('allowBusyWinFlag', FALSE);
18549 }
18550  
18551 # The data stored in this IV is saved in the 'config' file
18552 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_allowBusyWinFlag');
18553  
18554 return 1;
18555 }
18556  
18557 sub set_allowModelSplitFlag {
18558  
18559 my ($self, $flag, $check) = @_;
18560  
18561 # Check for improper arguments
18562 if (! defined $flag || defined $check) {
18563  
18564 return $axmud::CLIENT->writeImproper(
18565 $self->_objClass . '->set_allowModelSplitFlag',
18566 @_,
18567 );
18568 }
18569  
18570 if ($flag) {
18571 $self->ivPoke('allowModelSplitFlag', TRUE);
18572 } else {
18573 $self->ivPoke('allowModelSplitFlag', FALSE);
18574 }
18575  
18576 # The data stored in this IV is saved in the 'config' file
18577 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_allowModelSplitFlag');
18578  
18579 return 1;
18580 }
18581  
18582 sub set_allowMxpFlag {
18583  
18584 my ($self, $type, $flag, $check) = @_;
18585  
18586 # Check for improper arguments
18587 if (! defined $flag || defined $check) {
18588  
18589 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_allowMxpFlag', @_);
18590 }
18591  
18592 if (! $flag) {
18593 $flag = FALSE;
18594 } else {
18595 $flag = TRUE;
18596 }
18597  
18598 if ($type eq 'font') {
18599 $self->ivPoke('allowMxpFontFlag', $flag);
18600 } elsif ($type eq 'image') {
18601 $self->ivPoke('allowMxpImageFlag', $flag);
18602 } elsif ($type eq 'load_image') {
18603 $self->ivPoke('allowMxpLoadImageFlag', $flag);
18604 } elsif ($type eq 'filter_image') {
18605 $self->ivPoke('allowMxpFilterImageFlag', $flag);
18606 } elsif ($type eq 'sound') {
18607 $self->ivPoke('allowMxpSoundFlag', $flag);
18608 } elsif ($type eq 'load_sound') {
18609 $self->ivPoke('allowMxpLoadSoundFlag', $flag);
18610 } elsif ($type eq 'gauge') {
18611 $self->ivPoke('allowMxpGaugeFlag', $flag);
18612 } elsif ($type eq 'frame') {
18613 $self->ivPoke('allowMxpFrameFlag', $flag);
18614 } elsif ($type eq 'interior') {
18615 $self->ivPoke('allowMxpInteriorFlag', $flag);
18616 } elsif ($type eq 'crosslink') {
18617 $self->ivPoke('allowMxpCrosslinkFlag', $flag);
18618 } elsif ($type eq 'room') {
18619 $self->ivPoke('allowMxpRoomFlag', $flag);
18620 } elsif ($type eq 'flexible') {
18621 $self->ivPoke('allowMxpFlexibleFlag', $flag);
18622 } elsif ($type eq 'perm') {
18623 $self->ivPoke('allowMxpPermFlag', $flag);
18624 }
18625  
18626 # The data stored in this IV is saved in the 'config' file
18627 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_allowMxpFlag');
18628  
18629 # Any sessions which are connected to a world, and which are using MXP, should re-issue
18630 # their <SUPPORTS> tag (this isn't part of the MXP spec, but it can't do any damage; the
18631 # world will either implement an unsolicited <SUPPORTS> tag, or it won't)
18632 if (! $self->mxpPreventSupportFlag && $type ne 'room') {
18633  
18634 foreach my $session ($self->ivValues('sessionHash')) {
18635  
18636 if ($session->status eq 'connected' && $session->mxpMode eq 'client_agree') {
18637  
18638 # Process a fake <SUPPORT> tag, as if the world had sent one
18639 $session->processMxpSupportElement('<SUPPORT>', 0, 'SUPPORT');
18640 }
18641 }
18642 }
18643  
18644 return 1;
18645 }
18646  
18647 sub set_allowSoundFlag {
18648  
18649 my ($self, $flag, $check) = @_;
18650  
18651 # Check for improper arguments
18652 if (! defined $flag || defined $check) {
18653  
18654 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_allowSoundFlag', @_);
18655 }
18656  
18657 if ($flag) {
18658 $self->ivPoke('allowSoundFlag', TRUE);
18659 } else {
18660 $self->ivPoke('allowSoundFlag', FALSE);
18661 }
18662  
18663 # The data stored in this IV is saved in the 'config' file
18664 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_allowSoundFlag');
18665  
18666 # Any sessions which are connected to a world, and which are using MXP, should re-issue
18667 # their <SUPPORTS> tag (this isn't part of the MXP spec, but it can't do any damage; the
18668 # world will either implement an unsolicited <SUPPORTS> tag, or it won't)
18669 foreach my $session ($self->ivValues('sessionHash')) {
18670  
18671 if ($session->status eq 'connected' && $session->mxpMode eq 'client_agree') {
18672  
18673 # Process a fake <SUPPORT> tag, as if the world had sent one
18674 $session->processMxpSupportElement('<SUPPORT>', 0, 'SUPPORT');
18675 }
18676 }
18677  
18678 return 1;
18679 }
18680  
18681 sub set_audioCmd {
18682  
18683 my ($self, $cmd, $check) = @_;
18684  
18685 # Check for improper arguments
18686 if (! defined $cmd || defined $check) {
18687  
18688 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_audioCmd', @_);
18689 }
18690  
18691 $self->ivPoke('audioCmd', $cmd);
18692  
18693 # The data stored in this IV is saved in the 'config' file
18694 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_audioCmd');
18695  
18696 return 1;
18697 }
18698  
18699 sub set_autoCompleteMode {
18700  
18701 my ($self, $mode, $check) = @_;
18702  
18703 # Check for improper arguments
18704 if (! defined $mode || defined $check) {
18705  
18706 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_autoCompleteMode', @_);
18707 }
18708  
18709 # Update IVs
18710 $self->ivPoke('autoCompleteMode', $mode);
18711 $self->ivUndef('instructBufferPosn');
18712 $self->ivUndef('cmdBufferPosn');
18713  
18714 foreach my $session ($self->listSessions()) {
18715  
18716 $session->set_instructBufferPosn();
18717 $session->set_cmdBufferPosn();
18718 }
18719  
18720 foreach my $winObj ($self->desktopObj->ivValues('gridWinHash')) {
18721  
18722 $winObj->resetEntry();
18723 }
18724  
18725 # The data stored in this IV is saved in the 'config' file
18726 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_autoCompleteMode');
18727  
18728 return 1;
18729 }
18730  
18731 sub set_autoCompleteParent {
18732  
18733 my ($self, $parent, $check) = @_;
18734  
18735 # Check for improper arguments
18736 if (! defined $parent || defined $check) {
18737  
18738 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_autoCompleteParent', @_);
18739 }
18740  
18741 # Update IVs
18742 if ($parent eq 'client') {
18743 $self->ivPoke('autoCompleteParent', 'combined');
18744 } else {
18745 $self->ivPoke('autoCompleteParent', 'session'); # Initial value
18746 }
18747  
18748 $self->ivUndef('instructBufferPosn');
18749 $self->ivUndef('cmdBufferPosn');
18750  
18751 foreach my $session ($self->listSessions()) {
18752  
18753 $session->set_instructBufferPosn();
18754 $session->set_cmdBufferPosn();
18755 }
18756  
18757 foreach my $winObj ($self->desktopObj->ivValues('gridWinHash')) {
18758  
18759 $winObj->resetEntry();
18760 }
18761  
18762 # The data stored in this IV is saved in the 'config' file
18763 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_autoCompleteParent');
18764  
18765 return 1;
18766 }
18767  
18768 sub set_autoCompleteType {
18769  
18770 my ($self, $type, $check) = @_;
18771  
18772 # Check for improper arguments
18773 if (! defined $type || defined $check) {
18774  
18775 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_autoCompleteType', @_);
18776 }
18777  
18778 # Update IVs
18779 if ($type eq 'instruct') {
18780 $self->ivPoke('autoCompleteType', 'instruct');
18781 } else {
18782 $self->ivPoke('autoCompleteType', 'cmd'); # Initial value
18783 }
18784  
18785 $self->ivUndef('instructBufferPosn');
18786 $self->ivUndef('cmdBufferPosn');
18787  
18788 foreach my $session ($self->listSessions()) {
18789  
18790 $session->set_instructBufferPosn();
18791 $session->set_cmdBufferPosn();
18792 }
18793  
18794 foreach my $winObj ($self->desktopObj->ivValues('gridWinHash')) {
18795  
18796 $winObj->resetEntry();
18797 }
18798  
18799 # The data stored in this IV is saved in the 'config' file
18800 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_autoCompleteType');
18801  
18802 return 1;
18803 }
18804  
18805 sub set_autoConnectList {
18806  
18807 my ($self, @args) = @_;
18808  
18809 # (No improper arguments to check; @args can be an empty list)
18810  
18811 $self->ivPoke('autoConnectList', @args);
18812  
18813 # The data stored in this IV is saved in the 'config' file
18814 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_autoConnectList');
18815  
18816 return 1;
18817 }
18818  
18819 sub set_autoRetainFileFlag {
18820  
18821 my ($self, $flag, $check) = @_;
18822  
18823 # Check for improper arguments
18824 if (! defined $flag || defined $check) {
18825  
18826 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_autoRetainFileFlag', @_);
18827 }
18828  
18829 if ($flag) {
18830 $self->ivPoke('autoRetainFileFlag', TRUE);
18831 } else {
18832 $self->ivPoke('autoRetainFileFlag', FALSE);
18833 }
18834  
18835 # The data stored in this IV is saved in the 'config' file
18836 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_autoRetainFileFlag');
18837  
18838 return 1;
18839 }
18840  
18841 sub set_autoSaveFlag {
18842  
18843 my ($self, $flag, $check) = @_;
18844  
18845 # Check for improper arguments
18846 if (! defined $flag || defined $check) {
18847  
18848 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_autoSaveFlag', @_);
18849 }
18850  
18851 if ($flag) {
18852 $self->ivPoke('autoSaveFlag', TRUE);
18853 } else {
18854 $self->ivPoke('autoSaveFlag', FALSE);
18855 }
18856  
18857 # The data stored in this IV is saved in the 'config' file
18858 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_autoSaveFlag');
18859  
18860 return 1;
18861 }
18862  
18863 sub set_autoSaveWaitTime {
18864  
18865 my ($self, $time, $check) = @_;
18866  
18867 # Check for improper arguments
18868 if (! defined $time || defined $check) {
18869  
18870 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_autoSaveWaitTime', @_);
18871 }
18872  
18873 $self->ivPoke('autoSaveWaitTime', $time);
18874  
18875 # The data stored in this IV is saved in the 'config' file
18876 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_autoSaveWaitTime');
18877  
18878 return 1;
18879 }
18880  
18881 sub set_autoBackupAppendFlag {
18882  
18883 my ($self, $flag, $check) = @_;
18884  
18885 # Check for improper arguments
18886 if (! defined $flag || defined $check) {
18887  
18888 return $axmud::CLIENT->writeImproper(
18889 $self->_objClass . '->set_autoBackupAppendFlag',
18890 @_,
18891 );
18892 }
18893  
18894 if ($flag) {
18895 $self->ivPoke('autoBackupAppendFlag', TRUE);
18896 } else {
18897 $self->ivPoke('autoBackupAppendFlag', FALSE);
18898 }
18899  
18900 # The data stored in this IV is saved in the 'config' file
18901 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_autoBackupAppendFlag');
18902  
18903 return 1;
18904 }
18905  
18906 sub set_autoBackupDir {
18907  
18908 my ($self, $dir, $check) = @_;
18909  
18910 # Check for improper arguments
18911 if (defined $check) {
18912  
18913 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_autoBackupDir', @_);
18914 }
18915  
18916 $self->ivPoke('autoBackupDir', $dir);
18917  
18918 # The data stored in this IV is saved in the 'config' file
18919 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_autoBackupDir');
18920  
18921 return 1;
18922 }
18923  
18924 sub set_autoBackupFileType {
18925  
18926 my ($self, $type, $check) = @_;
18927  
18928 # Check for improper arguments
18929 if (
18930 ! defined $type
18931 || ($type ne 'default' && $type ne 'tar' && $type ne 'zip')
18932 || defined $check
18933 ) {
18934 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_autoBackupFileType', @_);
18935 }
18936  
18937 $self->ivPoke('autoBackupFileType', $type);
18938  
18939 # The data stored in this IV is saved in the 'config' file
18940 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_autoBackupFileType');
18941  
18942 return 1;
18943 }
18944  
18945 sub set_autoBackupInterval {
18946  
18947 my ($self, $number, $check) = @_;
18948  
18949 # Check for improper arguments
18950 if (! defined $number || defined $check) {
18951  
18952 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_autoBackupInterval', @_);
18953 }
18954  
18955 $self->ivPoke('autoBackupInterval', $number);
18956  
18957 # The data stored in this IV is saved in the 'config' file
18958 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_autoBackupInterval');
18959  
18960 return 1;
18961 }
18962  
18963 sub set_autoBackupMode {
18964  
18965 my ($self, $mode, $check) = @_;
18966  
18967 # Check for improper arguments
18968 if (
18969 ! defined $mode
18970 || (
18971 $mode ne 'no_backup' && $mode ne 'all_start' && $mode ne 'all_stop'
18972 && $mode ne 'interval_start' && $mode ne 'interval_stop'
18973 ) || defined $check
18974 ) {
18975 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_autoBackupMode', @_);
18976 }
18977  
18978 $self->ivPoke('autoBackupMode', $mode);
18979  
18980 # The data stored in this IV is saved in the 'config' file
18981 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_autoBackupMode');
18982  
18983 return 1;
18984 }
18985  
18986 sub set_blockWorldHintFlag {
18987  
18988 my ($self, $flag, $check) = @_;
18989  
18990 # Check for improper arguments
18991 if (! defined $flag || defined $check) {
18992  
18993 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_blockWorldHintFlag', @_);
18994 }
18995  
18996 if ($flag) {
18997 $self->ivPoke('blockWorldHintFlag', TRUE);
18998 } else {
18999 $self->ivPoke('blockWorldHintFlag', FALSE);
19000 }
19001  
19002 return 1;
19003 }
19004  
19005 sub set_browserCmd {
19006  
19007 my ($self, $cmd, $check) = @_;
19008  
19009 # Check for improper arguments
19010 if (! defined $cmd || defined $check) {
19011  
19012 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_browserCmd', @_);
19013 }
19014  
19015 $self->ivPoke('browserCmd', $cmd);
19016  
19017 # The data stored in this IV is saved in the 'config' file
19018 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_browserCmd');
19019  
19020 return 1;
19021 }
19022  
19023 sub set_busyWin {
19024  
19025 my ($self, $winObj, $check) = @_;
19026  
19027 # Check for improper arguments
19028 if (defined $check) {
19029  
19030 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_busyWin', @_);
19031 }
19032  
19033 # Update IVs
19034 $self->ivPoke('busyWin', $winObj);
19035  
19036 return 1;
19037 }
19038  
19039 sub set_chatAcceptMode {
19040  
19041 my ($self, $mode, $check) = @_;
19042  
19043 # Check for improper arguments
19044 if (
19045 ! defined $mode
19046 || ($mode ne 'prompt' && $mode ne 'accept_contact' && $mode ne 'accept_all')
19047 || defined $check
19048 ) {
19049 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_chatAcceptMode', @_);
19050 }
19051  
19052 $self->ivPoke('chatAcceptMode', $mode);
19053  
19054 # The data stored in this IV is saved in the 'contacts' file
19055 $self->setModifyFlag('contacts', TRUE, $self->_objClass . '->set_chatAcceptMode');
19056  
19057 return 1;
19058 }
19059  
19060 sub add_chatContact {
19061  
19062 my ($self, $name, $obj, $check) = @_;
19063  
19064 # Check for improper arguments
19065 if (! defined $name || ! defined $obj || defined $check) {
19066  
19067 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_chatContact', @_);
19068 }
19069  
19070 $self->ivAdd('chatContactHash', $name, $obj);
19071  
19072 # The data stored in this IV is saved in the 'contacts' file
19073 $self->setModifyFlag('contacts', TRUE, $self->_objClass . '->add_chatContact');
19074  
19075 return 1;
19076 }
19077  
19078 sub del_chatContact {
19079  
19080 my ($self, $name, $check) = @_;
19081  
19082 # Check for improper arguments
19083 if (! defined $name || defined $check) {
19084  
19085 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_chatContact', @_);
19086 }
19087  
19088 $self->ivDelete('chatContactHash', $name);
19089  
19090 # The data stored in this IV is saved in the 'contacts' file
19091 $self->setModifyFlag('contacts', TRUE, $self->_objClass . '->del_chatContact');
19092  
19093 return 1;
19094 }
19095  
19096 sub set_charSet {
19097  
19098 # This function should only be called by GA::Cmd::SetCharSet->do
19099  
19100 my ($self, $charSet, $check) = @_;
19101  
19102 # Check for improper arguments
19103 if (! defined $charSet || defined $check) {
19104  
19105 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_charSet', @_);
19106 }
19107  
19108 $self->ivPoke('charSet', $charSet);
19109  
19110 # The data stored in this IV is saved in the 'config' file
19111 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_charSet');
19112  
19113 return 1;
19114 }
19115  
19116 sub set_chatEmail {
19117  
19118 my ($self, $email, $check) = @_;
19119  
19120 # Check for improper arguments
19121 if (defined $check) {
19122  
19123 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_chatEmail', @_);
19124 }
19125  
19126 $self->ivPoke('chatEmail', $email); # Can be 'undef'
19127  
19128 # The data stored in this IV is saved in the 'contacts' file
19129 $self->setModifyFlag('contacts', TRUE, $self->_objClass . '->set_chatEmail');
19130  
19131 return 1;
19132 }
19133  
19134 sub set_chatIcon {
19135  
19136 my ($self, $path, $check) = @_;
19137  
19138 # Check for improper arguments
19139 if (! defined $path || defined $check) {
19140  
19141 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_chatIcon', @_);
19142 }
19143  
19144 $self->ivPoke('chatIcon', $path); # Can't be 'undef'
19145  
19146 # The data stored in this IV is saved in the 'contacts' file
19147 $self->setModifyFlag('contacts', TRUE, $self->_objClass . '->set_chatIcon');
19148  
19149 return 1;
19150 }
19151  
19152 sub set_chatName {
19153  
19154 my ($self, $name, $check) = @_;
19155  
19156 # Check for improper arguments
19157 if (defined $check) {
19158  
19159 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_chatName', @_);
19160 }
19161  
19162 $self->ivPoke('chatName', $name); # Can be 'undef'
19163  
19164 # The data stored in this IV is saved in the 'contacts' file
19165 $self->setModifyFlag('contacts', TRUE, $self->_objClass . '->set_chatName');
19166  
19167 return 1;
19168 }
19169  
19170 sub add_chatSmiley {
19171  
19172 my ($self, $smiley, $path, $check) = @_;
19173  
19174 # Check for improper arguments
19175 if (! defined $smiley || ! defined $path || defined $check) {
19176  
19177 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_chatSmiley', @_);
19178 }
19179  
19180 $self->ivAdd('chatSmileyHash', $smiley, $path);
19181  
19182 # The data stored in this IV is saved in the 'contacts' file
19183 $self->setModifyFlag('contacts', TRUE, $self->_objClass . '->add_chatSmiley');
19184  
19185 return 1;
19186 }
19187  
19188 sub del_chatSmiley {
19189  
19190 my ($self, $smiley, $check) = @_;
19191  
19192 # Check for improper arguments
19193 if (! defined $smiley || defined $check) {
19194  
19195 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_chatSmiley', @_);
19196 }
19197  
19198 $self->ivDelete('chatSmileyHash', $smiley);
19199  
19200 # The data stored in this IV is saved in the 'contacts' file
19201 $self->setModifyFlag('contacts', TRUE, $self->_objClass . '->del_chatSmiley');
19202  
19203 return 1;
19204 }
19205  
19206 sub set_chatSmileyHash {
19207  
19208 my ($self, %hash) = @_;
19209  
19210 # (Don't check for improper arguments - %hash can be empty)
19211  
19212 $self->ivPoke('chatSmileyHash', %hash);
19213  
19214 # The data stored in these IVs is saved in the 'contacts' file
19215 $self->setModifyFlag('contacts', TRUE, $self->_objClass . '->set_chatSmileyHash');
19216  
19217 return 1;
19218 }
19219  
19220 sub set_cmdBufferPosn {
19221  
19222 my ($self, $posn, $check) = @_;
19223  
19224 # Check for improper arguments
19225 if (defined $check) {
19226  
19227 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_cmdBufferPosn', @_);
19228 }
19229  
19230 # Update IVs
19231 $self->ivPoke('cmdBufferPosn', $posn);
19232  
19233 return 1;
19234 }
19235  
19236 sub set_cmdSep {
19237  
19238 my ($self, $string, $check) = @_;
19239  
19240 # Check for improper arguments
19241 if (! defined $string || defined $check) {
19242  
19243 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_cmdSep', @_);
19244 }
19245  
19246 $self->ivPoke('cmdSep', $string);
19247  
19248 # The data stored in this IV is saved in the 'config' file
19249 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_cmdSep');
19250  
19251 return 1;
19252 }
19253  
19254 sub add_colourScheme {
19255  
19256 my ($self, $obj, $check) = @_;
19257  
19258 # Check for improper arguments
19259 if (! defined $obj || defined $check) {
19260  
19261 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_colourScheme', @_);
19262 }
19263  
19264 # Update IVs
19265 $self->ivAdd('colourSchemeHash', $obj->name, $obj);
19266  
19267 # The data stored in this IV is saved in the 'winmaps' file
19268 $self->setModifyFlag('winmaps', TRUE, $self->_objClass . '->add_colourScheme');
19269  
19270 return 1;
19271 }
19272  
19273 sub del_colourScheme {
19274  
19275 my ($self, $name, $check) = @_;
19276  
19277 # Check for improper arguments
19278 if (! defined $name || defined $check) {
19279  
19280 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_colourScheme', @_);
19281 }
19282  
19283 # Update IVs
19284 $self->ivDelete('colourSchemeHash', $name);
19285  
19286 # The data stored in this IV is saved in the 'winmaps' file
19287 $self->setModifyFlag('winmaps', TRUE, $self->_objClass . '->del_colourScheme');
19288  
19289 return 1;
19290 }
19291  
19292 sub set_commifyMode {
19293  
19294 my ($self, $mode, $check) = @_;
19295  
19296 # Check for improper arguments
19297 if (
19298 ! defined $mode
19299 || (
19300 $mode ne 'comma' && $mode ne 'europe' && $mode ne 'brit' && $mode ne 'underline'
19301 && $mode ne 'none'
19302 )
19303 || defined $check
19304 ) {
19305 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_commifyMode', @_);
19306 }
19307  
19308 $self->ivPoke('commifyMode', $mode);
19309  
19310 # The data stored in this IV is saved in the 'config' file
19311 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_commifyMode');
19312  
19313 return 1;
19314 }
19315  
19316 sub set_configWorldProfList {
19317  
19318 my ($self, @list) = @_;
19319  
19320 # (No improper arguments to check)
19321  
19322 $self->ivPoke('configWorldProfList', @list);
19323  
19324 return 1;
19325 }
19326  
19327 sub set_connectHistoryFlag {
19328  
19329 my ($self, $flag, $check) = @_;
19330  
19331 # Check for improper arguments
19332 if (! defined $flag || defined $check) {
19333  
19334 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_connectHistoryFlag', @_);
19335 }
19336  
19337 if ($flag) {
19338 $self->ivPoke('connectHistoryFlag', TRUE);
19339 } else {
19340 $self->ivPoke('connectHistoryFlag', FALSE);
19341 }
19342  
19343 return 1;
19344 }
19345  
19346 sub set_connectWin {
19347  
19348 my ($self, $winObj, $check) = @_;
19349  
19350 # Check for improper arguments
19351 if (defined $check) {
19352  
19353 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_connectWin', @_);
19354 }
19355  
19356 # Update IVs
19357 $self->ivPoke('connectWin', $winObj);
19358  
19359 return 1;
19360 }
19361  
19362 sub set_consoleWin {
19363  
19364 my ($self, $winObj, $check) = @_;
19365  
19366 # Check for improper arguments
19367 if (defined $check) {
19368  
19369 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_consoleWin', @_);
19370 }
19371  
19372 # Update IVs
19373 $self->ivPoke('consoleWin', $winObj);
19374  
19375 return 1;
19376 }
19377  
19378 sub set_currentColourCube {
19379  
19380 my ($self, $cube, $check) = @_;
19381  
19382 # Check for improper arguments
19383 if (! defined $cube || defined $check) {
19384  
19385 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_currentColourCube', @_);
19386 }
19387  
19388 $self->ivPoke('currentColourCube', $cube);
19389 if ($cube eq 'netscape') {
19390  
19391 $self->ivPoke('xTermColourHash', $self->constNetscapeColourHash);
19392  
19393 } else {
19394  
19395 # Default
19396 $self->ivPoke('xTermColourHash', $self->constXTermColourHash);
19397 }
19398  
19399 # The data stored in this IV is saved in the 'config' file
19400 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_currentColourCube');
19401  
19402 return 1;
19403 }
19404  
19405 sub reset_currentIP {
19406  
19407 my ($self, $check) = @_;
19408  
19409 # Check for improper arguments
19410 if (defined $check) {
19411  
19412 return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_currentIP', @_);
19413 }
19414  
19415 $self->ivUndef('currentIP');
19416  
19417 # The data stored in this IV is saved in the 'config' file
19418 $self->setModifyFlag('config', TRUE, $self->_objClass . '->reset_currentIP');
19419  
19420 return 1;
19421 }
19422  
19423 sub set_customAllowTTSFlag {
19424  
19425 my ($self, $flag, $check) = @_;
19426  
19427 # Check for improper arguments
19428 if (! defined $flag || defined $check) {
19429  
19430 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_customAllowTTSFlag', @_);
19431 }
19432  
19433 if ($flag) {
19434  
19435 $self->ivPoke('customAllowTTSFlag', TRUE);
19436 $self->ivPoke('systemAllowTTSFlag', TRUE);
19437  
19438 } else {
19439  
19440 $self->ivPoke('customAllowTTSFlag', FALSE);
19441 if (! $axmud::BLIND_MODE_FLAG) {
19442  
19443 $self->ivPoke('systemAllowTTSFlag', FALSE);
19444 $self->ivPoke('ttsForceHijackFlag', FALSE);
19445  
19446 } else {
19447  
19448 $self->ivPoke('systemAllowTTSFlag', TRUE);
19449 }
19450 }
19451  
19452 if (! $self->systemAllowTTSFlag) {
19453  
19454 # Interrupt any TTS jobs that might be in progress, and reset TTS IVs to their
19455 # default values
19456 $self->ttsReset();
19457 }
19458  
19459 # The data stored in this IV is saved in the 'config' file
19460 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customAllowTTSFlag');
19461  
19462 return 1;
19463 }
19464  
19465 sub set_customClientName {
19466  
19467 my ($self, $name, $check) = @_;
19468  
19469 # Check for improper arguments
19470 if (defined $check) {
19471  
19472 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_customClientName', @_);
19473 }
19474  
19475 if ($name) {
19476 $self->ivPoke('customClientName', $name);
19477 } else {
19478 $self->ivPoke('customClientName', '');
19479 }
19480  
19481 # The data stored in this IV is saved in the 'config' file
19482 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customClientName');
19483  
19484 return 1;
19485 }
19486  
19487 sub set_customClientVersion {
19488  
19489 my ($self, $version, $check) = @_;
19490  
19491 # Check for improper arguments
19492 if (defined $check) {
19493  
19494 return $axmud::CLIENT->writeImproper(
19495 $self->_objClass . '->set_customClientVersion',
19496 @_,
19497 );
19498 }
19499  
19500 if ($version) {
19501 $self->ivPoke('customClientVersion', $version);
19502 } else {
19503 $self->ivPoke('customClientVersion', '');
19504 }
19505  
19506 # The data stored in this IV is saved in the 'config' file
19507 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customClientVersion');
19508  
19509 return 1;
19510 }
19511  
19512 sub set_customInsertCmdColour {
19513  
19514 my ($self, $value, $check) = @_;
19515  
19516 # Check for improper arguments
19517 if (! defined $value || defined $check) {
19518  
19519 return $axmud::CLIENT->writeImproper(
19520 $self->_objClass . '->set_customInsertCmdColour',
19521 @_,
19522 );
19523 }
19524  
19525 $self->ivPoke('customInsertCmdColour', $value);
19526  
19527 # The data stored in this IV is saved in the 'config' file
19528 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customInsertCmdColour');
19529  
19530 return 1;
19531 }
19532  
19533 sub set_convertInvisibleFlag {
19534  
19535 my ($self, $flag, $check) = @_;
19536  
19537 # Check for improper arguments
19538 if (! defined $flag || defined $check) {
19539  
19540 return $axmud::CLIENT->writeImproper(
19541 $self->_objClass . '->set_convertInvisibleFlag',
19542 @_,
19543 );
19544 }
19545  
19546 if ($flag) {
19547 $self->ivPoke('convertInvisibleFlag', TRUE);
19548 } else {
19549 $self->ivPoke('convertInvisibleFlag', FALSE);
19550 }
19551  
19552 # The data stored in this IV is saved in the 'config' file
19553 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_convertInvisibleFlag');
19554  
19555 return 1;
19556 }
19557  
19558 sub set_customCmdBufferSize {
19559  
19560 my ($self, $size, $check) = @_;
19561  
19562 # Check for improper arguments
19563 if (! defined $size || defined $check) {
19564  
19565 return $axmud::CLIENT->writeImproper(
19566 $self->_objClass . '->set_customCmdBufferSize',
19567 @_,
19568 );
19569 }
19570  
19571 $self->ivPoke('customCmdBufferSize', $size);
19572  
19573 # The data stored in this IV is saved in the 'config' file
19574 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customCmdBufferSize');
19575  
19576 return 1;
19577 }
19578  
19579 sub set_customControlsSize {
19580  
19581 my ($self, $type, $value, $check) = @_;
19582  
19583 # Check for improper arguments
19584 if (
19585 ! defined $type
19586 || ($type ne 'left' && $type ne 'right' && $type ne 'top' && $type ne 'bottom')
19587 || defined $check
19588 ) {
19589 return $axmud::CLIENT->writeImproper(
19590 $self->_objClass . '->set_customControlsSize',
19591 @_,
19592 );
19593 }
19594  
19595 # $value can be 'undef'
19596 $self->ivPoke('customControls' . ucfirst($type) . 'Size', $value);
19597  
19598 # The data stored in this IV is saved in the 'config' file
19599 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customControlsSize');
19600  
19601 return 1;
19602 }
19603  
19604 sub set_customDayList {
19605  
19606 my ($self, @list) = @_;
19607  
19608 # Check for improper arguments
19609 if (! @list || (scalar @list) < 7) {
19610  
19611 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_customDayList', @_);
19612 }
19613  
19614 $self->ivPoke('customDayList', @list);
19615  
19616 # The data stored in these IVs are saved in the 'config' file
19617 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customDayList');
19618  
19619 return 1;
19620 }
19621  
19622 sub reset_customDayList {
19623  
19624 my ($self, $check) = @_;
19625  
19626 # Check for improper arguments
19627 if (defined $check) {
19628  
19629 return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_customDayList', @_);
19630 }
19631  
19632 $self->ivPoke('customDayList', $self->constDayList);
19633  
19634 # The data stored in these IVs are saved in the 'config' file
19635 $self->setModifyFlag('config', TRUE, $self->_objClass . '->reset_customDayList');
19636  
19637 return 1;
19638 }
19639  
19640 sub set_customDisplayBufferSize {
19641  
19642 my ($self, $size, $check) = @_;
19643  
19644 # Check for improper arguments
19645 if (! defined $size || defined $check) {
19646  
19647 return $axmud::CLIENT->writeImproper(
19648 $self->_objClass . '->set_customDisplayBufferSize',
19649 @_,
19650 );
19651 }
19652  
19653 $self->ivPoke('customDisplayBufferSize', $size);
19654  
19655 # The data stored in this IV is saved in the 'config' file
19656 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customDisplayBufferSize');
19657  
19658 return 1;
19659 }
19660  
19661 sub set_customFreeWinSize {
19662  
19663 my ($self, $width, $height, $check) = @_;
19664  
19665 # Check for improper arguments
19666 if (! defined $width || ! defined $height || defined $check) {
19667  
19668 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_customFreeWinSize', @_);
19669 }
19670  
19671 $self->ivPoke('customFreeWinWidth', $width);
19672 $self->ivPoke('customFreeWinHeight', $height);
19673  
19674 # The data stored in this IV is saved in the 'config' file
19675 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customFreeWinSize');
19676  
19677 return 1;
19678 }
19679  
19680 sub set_customGridWinSize {
19681  
19682 my ($self, $width, $height, $check) = @_;
19683  
19684 # Check for improper arguments
19685 if (! defined $width || ! defined $height || defined $check) {
19686  
19687 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_customGridWinSize', @_);
19688 }
19689  
19690 $self->ivPoke('customGridWinWidth', $width);
19691 $self->ivPoke('customGridWinHeight', $height);
19692  
19693 # The data stored in this IV is saved in the 'config' file
19694 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customGridWinSize');
19695  
19696 return 1;
19697 }
19698  
19699 sub set_customInstructBufferSize {
19700  
19701 my ($self, $size, $check) = @_;
19702  
19703 # Check for improper arguments
19704 if (! defined $size || defined $check) {
19705  
19706 return $axmud::CLIENT->writeImproper(
19707 $self->_objClass . '->set_customInstructBufferSize',
19708 @_,
19709 );
19710 }
19711  
19712 $self->ivPoke('customInstructBufferSize', $size);
19713  
19714 # The data stored in this IV is saved in the 'config' file
19715 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customInstructBufferSize');
19716  
19717 return 1;
19718 }
19719  
19720 sub set_customMainWinSize {
19721  
19722 my ($self, $width, $height, $check) = @_;
19723  
19724 # Check for improper arguments
19725 if (! defined $width || ! defined $height || defined $check) {
19726  
19727 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_customMainWinSize', @_);
19728 }
19729  
19730 $self->ivPoke('customMainWinWidth', $width);
19731 $self->ivPoke('customMainWinHeight', $height);
19732  
19733 # The data stored in this IV is saved in the 'config' file
19734 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customMainWinSize');
19735  
19736 return 1;
19737 }
19738  
19739 sub set_customMonthList {
19740  
19741 my ($self, @list) = @_;
19742  
19743 # Check for improper arguments
19744 if (! @list || (scalar @list) < 12) {
19745  
19746 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_customMonthList', @_);
19747 }
19748  
19749 $self->ivPoke('customMonthList', @list);
19750  
19751 # The data stored in these IVs are saved in the 'config' file
19752 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customMonthList');
19753  
19754 return 1;
19755 }
19756  
19757 sub reset_customMonthList {
19758  
19759 my ($self, $check) = @_;
19760  
19761 # Check for improper arguments
19762 if (defined $check) {
19763  
19764 return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_customMonthList', @_);
19765 }
19766  
19767 $self->ivPoke('customMonthList', $self->constMonthList);
19768  
19769 # The data stored in these IVs are saved in the 'config' file
19770 $self->setModifyFlag('config', TRUE, $self->_objClass . '->reset_customMonthList');
19771  
19772 return 1;
19773 }
19774  
19775 sub set_customPanelSize {
19776  
19777 my ($self, $type, $value, $check) = @_;
19778  
19779 # Check for improper arguments
19780 if (
19781 ! defined $type
19782 || ($type ne 'left' && $type ne 'right' && $type ne 'top' && $type ne 'bottom')
19783 || defined $check
19784 ) {
19785 return $axmud::CLIENT->writeImproper(
19786 $self->_objClass . '->set_customPanelSize',
19787 @_,
19788 );
19789 }
19790  
19791 # $value can be 'undef'
19792 $self->ivPoke('customPanel' . ucfirst($type) . 'Size', $value);
19793  
19794 # The data stored in this IV is saved in the 'config' file
19795 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customPanelSize');
19796  
19797 return 1;
19798 }
19799  
19800 sub set_customShowDebugColour {
19801  
19802 my ($self, $value, $check) = @_;
19803  
19804 # Check for improper arguments
19805 if (! defined $value || defined $check) {
19806  
19807 return $axmud::CLIENT->writeImproper(
19808 $self->_objClass . '->set_customShowDebugColour',
19809 @_,
19810 );
19811 }
19812  
19813 $self->ivPoke('customShowDebugColour', $value);
19814  
19815 # The data stored in this IV is saved in the 'config' file
19816 $self->setModifyFlag('config', TRUE, $self->_objClass . '->customShowDebugColour');
19817  
19818 return 1;
19819 }
19820  
19821 sub set_customShowErrorColour {
19822  
19823 my ($self, $value, $check) = @_;
19824  
19825 # Check for improper arguments
19826 if (! defined $value || defined $check) {
19827  
19828 return $axmud::CLIENT->writeImproper(
19829 $self->_objClass . '->set_customShowErrorColour',
19830 @_,
19831 );
19832 }
19833  
19834 $self->ivPoke('customShowErrorColour', $value);
19835  
19836 # The data stored in this IV is saved in the 'config' file
19837 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customShowErrorColour');
19838  
19839 return 1;
19840 }
19841  
19842 sub set_customShowImproperColour {
19843  
19844 my ($self, $value, $check) = @_;
19845  
19846 # Check for improper arguments
19847 if (! defined $value || defined $check) {
19848  
19849 return $axmud::CLIENT->writeImproper(
19850 $self->_objClass . '->set_customShowImproperColour',
19851 @_,
19852 );
19853 }
19854  
19855 $self->ivPoke('customShowImproperColour', $value);
19856  
19857 # The data stored in this IV is saved in the 'config' file
19858 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customShowImproperColour');
19859  
19860 return 1;
19861 }
19862  
19863 sub set_customShowSystemTextColour {
19864  
19865 my ($self, $value, $check) = @_;
19866  
19867 # Check for improper arguments
19868 if (! defined $value || defined $check) {
19869  
19870 return $axmud::CLIENT->writeImproper(
19871 $self->_objClass . '->set_customShowSystemTextColour',
19872 @_,
19873 );
19874 }
19875  
19876 $self->ivPoke('customShowSystemTextColour', $value);
19877  
19878 # The data stored in this IV is saved in the 'config' file
19879 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customShowSystemTextColour');
19880  
19881 return 1;
19882 }
19883  
19884 sub set_customShowWarningColour {
19885  
19886 my ($self, $value, $check) = @_;
19887  
19888 # Check for improper arguments
19889 if (! defined $value || defined $check) {
19890  
19891 return $axmud::CLIENT->writeImproper(
19892 $self->_objClass . '->set_customShowWarningColour',
19893 @_,
19894 );
19895 }
19896  
19897 $self->ivPoke('customShowWarningColour', $value);
19898  
19899 # The data stored in this IV is saved in the 'config' file
19900 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customShowWarningColour');
19901  
19902 return 1;
19903 }
19904  
19905 sub reset_customSoundHash {
19906  
19907 my ($self, $check) = @_;
19908  
19909 # Local variables
19910 my %soundHash;
19911  
19912 # Check for improper arguments
19913 if (defined $check) {
19914  
19915 return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_customSoundHash', @_);
19916 }
19917  
19918 foreach my $effect ($self->ivKeys('constExtendedSoundHash')) {
19919  
19920 # Values in ->constExtendedSoundHash are file names; values in ->customSoundHash should
19921 # be full file paths
19922 $soundHash{$effect}
19923 = $axmud::DATA_DIR . '/sounds/' . $self->ivShow('constExtendedSoundHash', $effect);
19924 }
19925  
19926 $self->ivPoke('customSoundHash', %soundHash);
19927  
19928 # The data stored in this IV is saved in the 'config' file
19929 $self->setModifyFlag('config', TRUE, $self->_objClass . '->reset_customSoundHash');
19930  
19931 return 1;
19932 }
19933  
19934 sub add_customTask {
19935  
19936 my ($self, $obj, $check) = @_;
19937  
19938 # Check for improper arguments
19939 if (! defined $obj || defined $check) {
19940  
19941 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_customTask', @_);
19942 }
19943  
19944 # Update IVs
19945 $self->ivAdd('customTaskHash', $obj->customName, $obj);
19946  
19947 # The data stored in this IV is saved in the 'tasks' file
19948 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->add_customTask');
19949  
19950 return 1;
19951 }
19952  
19953 sub del_customTask {
19954  
19955 my ($self, $obj, $check) = @_;
19956  
19957 # Check for improper arguments
19958 if (! defined $obj || defined $check) {
19959  
19960 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_customTask', @_);
19961 }
19962  
19963 # Update IVs
19964 $self->ivDelete('customTaskHash', $obj->customName);
19965  
19966 # The data stored in this IV is saved in the 'tasks' file
19967 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->del_customTask');
19968  
19969 return 1;
19970 }
19971  
19972 sub reset_customTaskHash {
19973  
19974 my ($self, $check) = @_;
19975  
19976 # Check for improper arguments
19977 if (defined $check) {
19978  
19979 return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_customTaskHash', @_);
19980 }
19981  
19982 $self->ivEmpty('customTaskHash');
19983  
19984 # The data stored in these IVs is saved in the 'tasks' file
19985 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->reset_customTaskHash');
19986  
19987 return 1;
19988 }
19989  
19990 sub set_customTextBufferSize {
19991  
19992 my ($self, $size, $check) = @_;
19993  
19994 # Check for improper arguments
19995 if (! defined $size || defined $check) {
19996  
19997 return $axmud::CLIENT->writeImproper(
19998 $self->_objClass . '->set_customTextBufferSize',
19999 @_,
20000 );
20001 }
20002  
20003 $self->ivPoke('customTextBufferSize', $size);
20004  
20005 # The data stored in this IV is saved in the 'config' file
20006 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customTextBufferSize');
20007  
20008 return 1;
20009 }
20010  
20011 sub set_debugFlag {
20012  
20013 my ($self, $iv, $flag, $check) = @_;
20014  
20015 # Check for improper arguments
20016 if (
20017 ! defined $iv
20018 || (
20019 # Main debug flags
20020 $iv ne 'debugLineNumsFlag'
20021 && $iv ne 'debugLineTagsFlag'
20022 && $iv ne 'debugLocatorFlag'
20023 && $iv ne 'debugMaxLocatorFlag'
20024 && $iv ne 'debugExitFlag'
20025 && $iv ne 'debugMoveListFlag'
20026 && $iv ne 'debugParseObjFlag'
20027 && $iv ne 'debugCompareObjFlag'
20028 && $iv ne 'debugExplainPluginFlag'
20029 && $iv ne 'debugCheckIVFlag'
20030 && $iv ne 'debugTableFitFlag'
20031 && $iv ne 'debugTrapErrorFlag'
20032 # Telnet negotiation debug flags
20033 && $iv ne 'debugEscSequenceFlag'
20034 && $iv ne 'debugTelnetFlag'
20035 && $iv ne 'debugTelnetMiniFlag'
20036 && $iv ne 'debugTelnetLogFlag'
20037 && $iv ne 'debugMsdpFlag'
20038 && $iv ne 'debugMxpFlag'
20039 && $iv ne 'debugMxpCommentFlag'
20040 && $iv ne 'debugPuebloFlag'
20041 && $iv ne 'debugPuebloCommentFlag'
20042 && $iv ne 'debugZmpFlag'
20043 && $iv ne 'debugAtcpFlag'
20044 && $iv ne 'debugGmcpFlag'
20045 && $iv ne 'debugMcpFlag'
20046 )
20047 || ! defined $flag
20048 || defined $check
20049 ) {
20050 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_debugFlag', @_);
20051 }
20052  
20053 if ($flag) {
20054 $self->ivPoke($iv, TRUE);
20055 } else {
20056 $self->ivPoke($iv, FALSE);
20057 }
20058  
20059 # The data stored in this IV is saved in the 'config' file
20060 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_debugFlag');
20061  
20062 return 1;
20063 }
20064  
20065 sub toggle_debugFlag {
20066  
20067 my ($self, $iv, $check) = @_;
20068  
20069 # Check for improper arguments
20070 if (
20071 ! defined $iv
20072 || (
20073 # Main debug flags
20074 $iv ne 'debugLineNumsFlag'
20075 && $iv ne 'debugLineTagsFlag'
20076 && $iv ne 'debugLocatorFlag'
20077 && $iv ne 'debugMaxLocatorFlag'
20078 && $iv ne 'debugExitFlag'
20079 && $iv ne 'debugMoveListFlag'
20080 && $iv ne 'debugParseObjFlag'
20081 && $iv ne 'debugCompareObjFlag'
20082 && $iv ne 'debugExplainPluginFlag'
20083 && $iv ne 'debugCheckIVFlag'
20084 && $iv ne 'debugTableFitFlag'
20085 && $iv ne 'debugTrapErrorFlag'
20086 # Telnet negotiation debug flags
20087 && $iv ne 'debugEscSequenceFlag'
20088 && $iv ne 'debugTelnetFlag'
20089 && $iv ne 'debugTelnetMiniFlag'
20090 && $iv ne 'debugTelnetLogFlag'
20091 && $iv ne 'debugMsdpFlag'
20092 && $iv ne 'debugMxpFlag'
20093 && $iv ne 'debugMxpCommentFlag'
20094 && $iv ne 'debugPuebloFlag'
20095 && $iv ne 'debugPuebloCommentFlag'
20096 && $iv ne 'debugZmpFlag'
20097 && $iv ne 'debugAtcpFlag'
20098 && $iv ne 'debugGmcpFlag'
20099 && $iv ne 'debugMcpFlag'
20100 ) || defined $check
20101 ) {
20102 return $axmud::CLIENT->writeImproper($self->_objClass . '->toggle_debugFlag', @_);
20103 }
20104  
20105 # Special case - disabling ->debugLocatorFlag also disables ->debugMaxLocatorFlag
20106 if (
20107 $iv eq 'debugLocatorFlag'
20108 && $self->debugLocatorFlag
20109 ) {
20110 $self->ivPoke($iv, FALSE);
20111 $self->ivPoke('debugMaxLocatorFlag', FALSE);
20112  
20113 } else {
20114  
20115 if (! $self->$iv) {
20116 $self->ivPoke($iv, TRUE);
20117 } else {
20118 $self->ivPoke($iv, FALSE);
20119 }
20120 }
20121  
20122 # The data stored in this IV is saved in the 'config' file
20123 $self->setModifyFlag('config', TRUE, $self->_objClass . '->toggle_debugFlag');
20124  
20125 return 1;
20126 }
20127  
20128 sub set_defaultDisabledWinmap {
20129  
20130 my ($self, $name, $check) = @_;
20131  
20132 # Check for improper arguments
20133 if (! defined $name || defined $check) {
20134  
20135 return $axmud::CLIENT->writeImproper(
20136 $self->_objClass . '->set_defaultDisabledWinmap',
20137 @_,
20138 );
20139 }
20140  
20141 $self->ivPoke('defaultDisabledWinmap', $name);
20142  
20143 # The data stored in this IV is saved in the 'winmaps' file
20144 $self->setModifyFlag('winmaps', TRUE, $self->_objClass . '->set_defaultDisabledWinmap');
20145  
20146 return 1;
20147 }
20148  
20149 sub set_defaultEnabledWinmap {
20150  
20151 my ($self, $name, $check) = @_;
20152  
20153 # Check for improper arguments
20154 if (! defined $name || defined $check) {
20155  
20156 return $axmud::CLIENT->writeImproper(
20157 $self->_objClass . '->set_defaultEnabledWinmap',
20158 @_,
20159 );
20160 }
20161  
20162 $self->ivPoke('defaultEnabledWinmap', $name);
20163  
20164 # The data stored in this IV is saved in the 'winmaps' file
20165 $self->setModifyFlag('winmaps', TRUE, $self->_objClass . '->set_defaultEnabledWinmap');
20166  
20167 return 1;
20168 }
20169  
20170 sub set_defaultInternalWinmap {
20171  
20172 my ($self, $name, $check) = @_;
20173  
20174 # Check for improper arguments
20175 if (! defined $name || defined $check) {
20176  
20177 return $axmud::CLIENT->writeImproper(
20178 $self->_objClass . '->set_defaultInternalWinmap',
20179 @_,
20180 );
20181 }
20182  
20183 $self->ivPoke('defaultInternalWinmap', $name);
20184  
20185 # The data stored in this IV is saved in the 'winmaps' file
20186 $self->setModifyFlag('winmaps', TRUE, $self->_objClass . '->set_defaultInternalWinmap');
20187  
20188 return 1;
20189 }
20190  
20191 sub add_dict {
20192  
20193 my ($self, $obj, $check) = @_;
20194  
20195 # Check for improper arguments
20196 if (! defined $obj || defined $check) {
20197  
20198 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_dict', @_);
20199 }
20200  
20201 $self->ivAdd('dictHash', $obj->name, $obj);
20202  
20203 # The data stored in this IV is saved in the 'dicts' file
20204 $self->setModifyFlag('dicts', TRUE, $self->_objClass . '->add_dict');
20205  
20206 return 1;
20207 }
20208  
20209 sub del_dict {
20210  
20211 my ($self, $obj, $check) = @_;
20212  
20213 # Check for improper arguments
20214 if (! defined $obj || defined $check) {
20215  
20216 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_dict', @_);
20217 }
20218  
20219 $self->ivDelete('dictHash', $obj->name);
20220  
20221 # The data stored in this IV is saved in the 'dicts' file
20222 $self->setModifyFlag('dicts', TRUE, $self->_objClass . '->del_dict');
20223  
20224 return 1;
20225 }
20226  
20227 sub set_dictHash {
20228  
20229 my ($self, %hash) = @_;
20230  
20231 # (No improper arguments to check - %hash can be empty)
20232  
20233 $self->ivPoke('dictHash', %hash);
20234  
20235 # The data stored in this IV is saved in the 'dicts' file
20236 $self->setModifyFlag('dicts', TRUE, $self->_objClass . '->set_dictHash');
20237  
20238 return 1;
20239 }
20240  
20241 sub set_emailCmd {
20242  
20243 my ($self, $cmd, $check) = @_;
20244  
20245 # Check for improper arguments
20246 if (! defined $cmd || defined $check) {
20247  
20248 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_emailCmd', @_);
20249 }
20250  
20251 $self->ivPoke('emailCmd', $cmd);
20252  
20253 # The data stored in this IV is saved in the 'config' file
20254 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_emailCmd');
20255  
20256 return 1;
20257 }
20258  
20259 sub set_favouriteWorldList {
20260  
20261 my ($self, @args) = @_;
20262  
20263 # (No improper arguments to check; @args can be an empty list)
20264  
20265 $self->ivPoke('favouriteWorldList', @args);
20266  
20267 # The data stored in this IV is saved in the 'config' file
20268 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_favouriteWorldList');
20269  
20270 return 1;
20271 }
20272  
20273 sub set_fileFailFlag {
20274  
20275 my ($self, $flag, $check) = @_;
20276  
20277 # Check for improper arguments
20278 if (! defined $flag || defined $check) {
20279  
20280 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_fileFailFlag', @_);
20281 }
20282  
20283 if ($flag) {
20284 $self->ivPoke('fileFailFlag', TRUE);
20285 } else {
20286 $self->ivPoke('fileFailFlag', FALSE);
20287 }
20288  
20289 return 1;
20290 }
20291  
20292 sub add_fileObj {
20293  
20294 my ($self, $obj, $check) = @_;
20295  
20296 # Check for improper arguments
20297 if (! defined $obj || defined $check) {
20298  
20299 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_fileObj', @_);
20300 }
20301  
20302 $self->ivAdd('fileObjHash', $obj->name, $obj);
20303  
20304 return 1;
20305 }
20306  
20307 sub del_fileObj {
20308  
20309 my ($self, $obj, $check) = @_;
20310  
20311 # Check for improper arguments
20312 if (! defined $obj || defined $check) {
20313  
20314 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_fileObj', @_);
20315 }
20316  
20317 $self->ivDelete('fileObjHash', $obj->name);
20318  
20319 return 1;
20320 }
20321  
20322 sub set_ttsForceHijackFlag {
20323  
20324 my ($self, $flag, $check) = @_;
20325  
20326 # Check for improper arguments
20327 if (! defined $flag || defined $check) {
20328  
20329 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_ttsForceHijackFlag', @_);
20330 }
20331  
20332 if ($flag) {
20333 $self->ivPoke('ttsForceHijackFlag', TRUE);
20334 } else {
20335 $self->ivPoke('ttsForceHijackFlag', FALSE);
20336 }
20337  
20338 # The data stored in this IV is saved in the 'config' file
20339 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_ttsForceHijackFlag');
20340  
20341 return 1;
20342 }
20343  
20344 sub set_gridAdjustmentFlag {
20345  
20346 my ($self, $flag, $check) = @_;
20347  
20348 # Check for improper arguments
20349 if (! defined $flag || defined $check) {
20350  
20351 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_gridAdjustmentFlag', @_);
20352 }
20353  
20354 if ($flag) {
20355 $self->ivPoke('gridAdjustmentFlag', TRUE);
20356 } else {
20357 $self->ivPoke('gridAdjustmentFlag', FALSE);
20358 }
20359  
20360 # The data stored in this IV is saved in the 'config' file
20361 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_gridAdjustmentFlag');
20362  
20363 return 1;
20364 }
20365  
20366 sub set_gridBlockSize {
20367  
20368 my ($self, $size, $check) = @_;
20369  
20370 # Check for improper arguments
20371 if (! defined $size || defined $check) {
20372  
20373 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_gridBlockSize', @_);
20374 }
20375  
20376 $self->ivPoke('gridBlockSize', $size);
20377  
20378 # The data stored in this IV is saved in the 'config' file
20379 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_gridBlockSize');
20380  
20381 return 1;
20382 }
20383  
20384 sub set_gridEdgeCorrectionFlag {
20385  
20386 my ($self, $flag, $check) = @_;
20387  
20388 # Check for improper arguments
20389 if (! defined $flag || defined $check) {
20390  
20391 return $axmud::CLIENT->writeImproper(
20392 $self->_objClass . '->set_gridEdgeCorrectionFlag',
20393 @_,
20394 );
20395 }
20396  
20397 if ($flag) {
20398 $self->ivPoke('gridEdgeCorrectionFlag', TRUE);
20399 } else {
20400 $self->ivPoke('gridEdgeCorrectionFlag', FALSE);
20401 }
20402  
20403 # The data stored in this IV is saved in the 'config' file
20404 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_gridEdgeCorrectionFlag');
20405  
20406 return 1;
20407 }
20408  
20409 sub set_gridGapMaxSize {
20410  
20411 my ($self, $size, $check) = @_;
20412  
20413 # Check for improper arguments
20414 if (! defined $size || defined $check) {
20415  
20416 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_gridGapMaxSize', @_);
20417 }
20418  
20419 $self->ivPoke('gridGapMaxSize', $size);
20420  
20421 # The data stored in this IV is saved in the 'config' file
20422 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_gridGapMaxSize');
20423  
20424 return 1;
20425 }
20426  
20427 sub set_gridInvisWinFlag {
20428  
20429 my ($self, $flag, $check) = @_;
20430  
20431 # Check for improper arguments
20432 if (! defined $flag || defined $check) {
20433  
20434 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_gridInvisWinFlag', @_);
20435 }
20436  
20437 if ($flag) {
20438 $self->ivPoke('gridInvisWinFlag', TRUE);
20439 } else {
20440 $self->ivPoke('gridInvisWinFlag', FALSE);
20441 }
20442  
20443 # The data stored in this IV is saved in the 'config' file
20444 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_gridInvisWinFlag');
20445  
20446 return 1;
20447 }
20448  
20449 sub set_gridReshuffleFlag {
20450  
20451 my ($self, $flag, $check) = @_;
20452  
20453 # Check for improper arguments
20454 if (! defined $flag || defined $check) {
20455  
20456 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_gridReshuffleFlag', @_);
20457 }
20458  
20459 if ($flag) {
20460 $self->ivPoke('gridReshuffleFlag', TRUE);
20461 } else {
20462 $self->ivPoke('gridReshuffleFlag', FALSE);
20463 }
20464  
20465 # The data stored in this IV is saved in the 'config' file
20466 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_gridReshuffleFlag');
20467  
20468 return 1;
20469 }
20470  
20471 sub add_initPlugin {
20472  
20473 my ($self, $pluginPath, $check) = @_;
20474  
20475 # Check for improper arguments
20476 if (! defined $pluginPath || defined $check) {
20477  
20478 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_initPlugin', @_);
20479 }
20480  
20481 $self->ivPush('initPluginList', $pluginPath);
20482  
20483 # The data stored in this IV is saved in the 'config' file
20484 $self->setModifyFlag('config', TRUE, $self->_objClass . '->add_initPlugin');
20485  
20486 return 1;
20487 }
20488  
20489 sub del_initPlugin {
20490  
20491 my ($self, $index, $check) = @_;
20492  
20493 # Check for improper arguments
20494 if (! defined $index || defined $check) {
20495  
20496 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_initPlugin', @_);
20497 }
20498  
20499 if ($self->initPluginList && $index < (scalar $self->initPluginList)) {
20500  
20501 $self->ivSplice('initPluginList', $index, 1);
20502 }
20503  
20504 # The data stored in this IV is saved in the 'config' file
20505 $self->setModifyFlag('config', TRUE, $self->_objClass . '->del_initPlugin');
20506  
20507 return 1;
20508 }
20509  
20510 sub add_initScript {
20511  
20512 my ($self, $scriptName, $mode, $check) = @_;
20513  
20514 # Check for improper arguments
20515 if (
20516 ! defined $scriptName
20517 || ! defined $mode
20518 || ($mode ne 'no_task' && $mode ne 'run_task' && $mode ne 'run_task_win')
20519 || defined $check
20520 ) {
20521 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_initScript', @_);
20522 }
20523  
20524 # See if the script already exists in the initial scriptlist
20525 if (! defined $self->ivFind('initScriptOrderList', $scriptName)) {
20526  
20527 # Not there, so add it
20528 $self->ivPush('initScriptOrderList', $scriptName);
20529 }
20530  
20531 # In either case, update the hash (replacing any previous entry)
20532 $self->ivAdd('initScriptHash', $scriptName, $mode);
20533  
20534 # The data stored in this IV is saved in the 'scripts' file
20535 $self->setModifyFlag('scripts', TRUE, $self->_objClass . '->add_initScript');
20536  
20537 return 1;
20538 }
20539  
20540 sub del_initScript {
20541  
20542 my ($self, $scriptName, $check) = @_;
20543  
20544 # Local variables
20545 my $index;
20546  
20547 # Check for improper arguments
20548 if (! defined $scriptName || defined $check) {
20549  
20550 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_initScript', @_);
20551 }
20552  
20553 # Update IVs
20554 $self->ivDelete('initScriptHash', $scriptName);
20555 $index = $self->ivFind('initScriptOrderList', $scriptName);
20556 if (defined $index) {
20557  
20558 $self->ivSplice('initScriptOrderList', $index, 1);
20559 }
20560  
20561 # The data stored in this IV is saved in the 'scripts' file
20562 $self->setModifyFlag('scripts', TRUE, $self->_objClass . '->del_initScript');
20563  
20564 return 1;
20565 }
20566  
20567 sub set_initScriptOrderList {
20568  
20569 my ($self, @args) = @_;
20570  
20571 # (No improper arguments to check; @args can be an empty list)
20572  
20573 $self->ivPoke('initScriptOrderList', @args);
20574  
20575 # The data stored in this IV is saved in the 'scripts' file
20576 $self->setModifyFlag('scripts', TRUE, $self->_objClass . '->set_initScriptOrderList');
20577  
20578 return 1;
20579 }
20580  
20581 sub add_initTask {
20582  
20583 my ($self, $obj, $check) = @_;
20584  
20585 # Check for improper arguments
20586 if (! defined $obj || defined $check) {
20587  
20588 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_initTask', @_);
20589 }
20590  
20591 # Update IVs
20592 $self->ivAdd('initTaskHash', $obj->uniqueName, $obj);
20593 $self->ivPush('initTaskOrderList', $obj->uniqueName);
20594  
20595 # The data stored in these IVs is saved in the 'tasks' file
20596 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->add_initTask');
20597  
20598 return 1;
20599 }
20600  
20601 sub del_initTask {
20602  
20603 my ($self, $obj, $check) = @_;
20604  
20605 # Local variables
20606 my $index;
20607  
20608 # Check for improper arguments
20609 if (! defined $obj || defined $check) {
20610  
20611 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_initTask', @_);
20612 }
20613  
20614 # Update IVs
20615 $self->ivDelete('initTaskHash', $obj->uniqueName);
20616 $index = $self->ivFind('initTaskOrderList', $obj->uniqueName);
20617 if (defined $index) {
20618  
20619 $self->ivSplice('initTaskOrderList', $index, 1);
20620 }
20621  
20622 # The data stored in these IVs is saved in the 'tasks' file
20623 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->add_initTask');
20624  
20625 return 1;
20626 }
20627  
20628 sub reset_initTaskHash {
20629  
20630 my ($self, $check) = @_;
20631  
20632 # Check for improper arguments
20633 if (defined $check) {
20634  
20635 return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_initTaskHash', @_);
20636 }
20637  
20638 $self->ivEmpty('initTaskHash');
20639 $self->ivEmpty('initTaskOrderList');
20640 $self->ivPoke('initTaskTotal', 0);
20641  
20642 # The data stored in these IVs is saved in the 'tasks' file
20643 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->reset_initTaskHash');
20644  
20645 return 1;
20646 }
20647  
20648 sub set_initTaskOrderList {
20649  
20650 my ($self, @args) = @_;
20651  
20652 # (No improper arguments to check; @args can be an empty list)
20653  
20654 $self->ivPoke('initTaskOrderList', @args);
20655  
20656 # The data stored in this IV is saved in the 'tasks' file
20657 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->set_initTaskOrderList');
20658  
20659 return 1;
20660 }
20661  
20662 sub inc_initTaskTotal {
20663  
20664 my ($self, $check) = @_;
20665  
20666 # Check for improper arguments
20667 if (defined $check) {
20668  
20669 return $axmud::CLIENT->writeImproper($self->_objClass . '->inc_initTaskTotal', @_);
20670 }
20671  
20672 # The data stored in this IV is saved in the 'tasks' file
20673 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->inc_initTaskTotal');
20674  
20675 return $self->ivIncrement('initTaskTotal');
20676 }
20677  
20678 sub reset_initTaskTotal {
20679  
20680 my ($self, $check) = @_;
20681  
20682 # Check for improper arguments
20683 if (defined $check) {
20684  
20685 return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_initTaskTotal', @_);
20686 }
20687  
20688 $self->ivPoke('initTaskTotal', 0);
20689  
20690 # The data stored in this IV is saved in the 'tasks' file
20691 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->reset_initTaskTotal');
20692  
20693 return 1;
20694 }
20695  
20696 sub add_initWorkspace {
20697  
20698 my ($self, $number, $zonemap, $check) = @_;
20699  
20700 # Check for improper arguments
20701 if (! defined $number || defined $check) {
20702  
20703 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_initWorkspace', @_);
20704 }
20705  
20706 $self->ivAdd('initWorkspaceHash', $number, $zonemap);
20707  
20708 # The data stored in this IV is saved in the 'config' file
20709 $self->setModifyFlag('config', TRUE, $self->_objClass . '->add_initWorkspace');
20710  
20711 return 1;
20712 }
20713  
20714 sub del_initWorkspace {
20715  
20716 my ($self, $number, $check) = @_;
20717  
20718 # Local variables
20719 my (
20720 $count,
20721 %modHash,
20722 );
20723  
20724 # Check for improper arguments
20725 if (! defined $number || defined $check) {
20726  
20727 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_initWorkspace', @_);
20728 }
20729  
20730 # Default initial workspace can't be deleted under any circumstances
20731 if ($number eq '0') {
20732  
20733 return undef;
20734  
20735 } else {
20736  
20737 $self->ivDelete('initWorkspaceHash', $number);
20738  
20739 # Remaining initial workspaces must be renumbered
20740 $count = 0;
20741 foreach my $key ($self->ivKeys('initWorkspaceHash')) {
20742  
20743 $modHash{$count} = $self->ivShow('initWorkspaceHash', $key);
20744 $count++;
20745 }
20746  
20747 $self->ivPoke('initWorkspaceHash', %modHash);
20748  
20749 # The data stored in this IV is saved in the 'config' file
20750 $self->setModifyFlag('config', TRUE, $self->_objClass . '->add_initWorkspace');
20751  
20752 return 1;
20753 }
20754 }
20755  
20756 sub set_initWorkspaceDir {
20757  
20758 my ($self, $string, $check) = @_;
20759  
20760 # Check for improper arguments
20761 if (! defined $string || defined $check) {
20762  
20763 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_initWorkspaceDir', @_);
20764 }
20765  
20766 $self->ivPoke('initWorkspaceDir', $string);
20767  
20768 # The data stored in this IV is saved in the 'config' file
20769 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_initWorkspaceDir');
20770  
20771 return 1;
20772 }
20773  
20774 sub set_instructBufferPosn {
20775  
20776 my ($self, $posn, $check) = @_;
20777  
20778 # Check for improper arguments
20779 if (defined $check) {
20780  
20781 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_instructBufferPosn', @_);
20782 }
20783  
20784 # Update IVs
20785 $self->ivPoke('instructBufferPosn', $posn);
20786  
20787 return 1;
20788 }
20789  
20790 sub toggle_instructFlag {
20791  
20792 my ($self, $type, $check) = @_;
20793  
20794 # Local variables
20795 my $iv;
20796  
20797 # Check for improper arguments
20798 if (
20799 ! defined $type
20800 || (
20801 $type ne 'confirm' && $type ne 'convert' && $type ne 'world' && $type ne 'other'
20802 && $type ne 'max'
20803 )
20804 ) {
20805 return $axmud::CLIENT->writeImproper($self->_objClass . '->toggle_instructFlag', @_);
20806 }
20807  
20808 if ($type eq 'confirm') {
20809 $iv = 'confirmWorldCmdFlag';
20810 } elsif ($type eq 'convert') {
20811 $iv = 'convertWorldCmdFlag';
20812 } elsif ($type eq 'world') {
20813 $iv = 'preserveWorldCmdFlag';
20814 } elsif ($type eq 'other') {
20815 $iv = 'preserveOtherCmdFlag';
20816 } elsif ($type eq 'max') {
20817 $iv = 'maxMultiCmdFlag';
20818 }
20819 if ($self->$iv) {
20820 $self->ivPoke($iv, FALSE);
20821 } else {
20822 $self->ivPoke($iv, TRUE);
20823 }
20824  
20825 # The data stored in these IVs are saved in the 'config' file
20826 $self->setModifyFlag('config', TRUE, $self->_objClass . '->toggle_instructFlag');
20827  
20828 return 1;
20829 }
20830  
20831 sub set_ipLookupList {
20832  
20833 my ($self, @args) = @_;
20834  
20835 # (No improper arguments to check; @args can be an empty list)
20836  
20837 $self->ivPoke('ipLookupList', @args);
20838  
20839 # The data stored in this IV is saved in the 'config' file
20840 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_ipLookupList');
20841  
20842 return 1;
20843 }
20844  
20845 sub set_irreversibleIconFlag {
20846  
20847 my ($self, $flag, $check) = @_;
20848  
20849 # Check for improper arguments
20850 if (! defined $flag || defined $check) {
20851  
20852 return $axmud::CLIENT->writeImproper(
20853 $self->_objClass . '->set_irreversibleIconFlag',
20854 @_,
20855 );
20856 }
20857  
20858 if ($flag) {
20859 $self->ivPoke('irreversibleIconFlag', TRUE);
20860 } else {
20861 $self->ivPoke('irreversibleIconFlag', FALSE);
20862 }
20863  
20864 # The data stored in this IV is saved in the 'config' file
20865 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_irreversibleIconFlag');
20866  
20867 return 1;
20868 }
20869  
20870 sub toggle_keysFlag {
20871  
20872 my ($self, $type, $check) = @_;
20873  
20874 # Local variables
20875 my $iv;
20876  
20877 # Check for improper arguments
20878 if (
20879 ! defined $type
20880 || (
20881 $type ne 'scroll' && $type ne 'smooth_scroll' && $type ne 'auto_split'
20882 && $type ne 'auto_complete' && $type ne 'switch_tab'
20883 )
20884 ) {
20885 return $axmud::CLIENT->writeImproper($self->_objClass . '->toggle_keysFlag', @_);
20886 }
20887  
20888 if ($type eq 'scroll') {
20889 $iv = 'useScrollKeysFlag';
20890 } elsif ($type eq 'smooth_scroll') {
20891 $iv = 'smoothScrollKeysFlag';
20892 } elsif ($type eq 'auto_split') {
20893 $iv = 'autoSplitKeysFlag';
20894 } elsif ($type eq 'auto_complete') {
20895 $iv = 'useCompleteKeysFlag';
20896 } elsif ($type eq 'switch_tab') {
20897 $iv = 'useSwitchKeysFlag';
20898 }
20899 if ($self->$iv) {
20900 $self->ivPoke($iv, FALSE);
20901 } else {
20902 $self->ivPoke($iv, TRUE);
20903 }
20904  
20905 # The data stored in these IVs are saved in the 'config' file
20906 $self->setModifyFlag('config', TRUE, $self->_objClass . '->toggle_keysFlag');
20907  
20908 return 1;
20909 }
20910  
20911 sub set_loadConfigFlag {
20912  
20913 my ($self, $flag, $check) = @_;
20914  
20915 # Check for improper arguments
20916 if (! defined $flag || defined $check) {
20917  
20918 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_loadConfigFlag', @_);
20919 }
20920  
20921 if ($flag) {
20922 $self->ivPoke('loadConfigFlag', TRUE);
20923 } else {
20924 $self->ivPoke('loadConfigFlag', FALSE);
20925 }
20926  
20927 # The data stored in this IV is saved in the 'config' file
20928 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_loadConfigFlag');
20929  
20930 return 1;
20931 }
20932  
20933 sub set_loadDataFlag {
20934  
20935 my ($self, $flag, $check) = @_;
20936  
20937 # Check for improper arguments
20938 if (! defined $flag || defined $check) {
20939  
20940 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_loadDataFlag', @_);
20941 }
20942  
20943 if ($flag) {
20944 $self->ivPoke('loadDataFlag', TRUE);
20945 } else {
20946 $self->ivPoke('loadDataFlag', FALSE);
20947 }
20948  
20949 # The data stored in this IV is saved in the 'config' file
20950 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_loadDataFlag');
20951  
20952 return 1;
20953 }
20954  
20955 sub toggle_logFlag {
20956  
20957 my ($self, $type, $check) = @_;
20958  
20959 # Local variables
20960 my $iv;
20961  
20962 # Check for improper arguments
20963 if (
20964 ! defined $type
20965 || (
20966 $type ne 'allow' && $type ne 'del_standard' && $type ne 'del_world'
20967 && $type ne 'new_client' && $type ne 'new_day' && $type ne 'prefix_date'
20968 && $type ne 'prefix_time' && $type ne 'image'
20969 )
20970 ) {
20971 return $axmud::CLIENT->writeImproper($self->_objClass . '->toggle_logFlag', @_);
20972 }
20973  
20974 if ($type eq 'allow') {
20975 $iv = 'allowLogsFlag';
20976 } elsif ($type eq 'del_standard') {
20977 $iv = 'deleteStandardLogsFlag';
20978 } elsif ($type eq 'del_world') {
20979 $iv = 'deleteWorldLogsFlag';
20980 } elsif ($type eq 'new_client') {
20981 $iv = 'logClientFlag';
20982 } elsif ($type eq 'new_day') {
20983 $iv = 'logDayFlag';
20984 } elsif ($type eq 'prefix_date') {
20985 $iv = 'logPrefixDateFlag';
20986 } elsif ($type eq 'prefix_time') {
20987 $iv = 'logPrefixTimeFlag';
20988 } elsif ($type eq 'image') {
20989 $iv = 'logImageFlag';
20990 }
20991  
20992 if ($self->$iv) {
20993 $self->ivPoke($iv, FALSE);
20994 } else {
20995 $self->ivPoke($iv, TRUE);
20996 }
20997  
20998 # The data stored in these IVs are saved in the 'config' file
20999 $self->setModifyFlag('config', TRUE, $self->_objClass . '->toggle_logFlag');
21000  
21001 return 1;
21002 }
21003  
21004 sub set_loginWarningTime {
21005  
21006 my ($self, $interval, $check) = @_;
21007  
21008 # Check for improper arguments
21009 if (! defined $interval || defined $check) {
21010  
21011 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_loginWarningTime', @_);
21012 }
21013  
21014 # Update IVs
21015 $self->ivPoke('loginWarningTime', $interval);
21016  
21017 # The data stored in this IV is saved in the 'config' file
21018 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_loginWarningTime');
21019  
21020 return 1;
21021 }
21022  
21023 sub set_logPreamble {
21024  
21025 my ($self, @list) = @_;
21026  
21027 # (No improper arguments to check)
21028  
21029 $self->ivPoke('logPreambleList', @list);
21030  
21031 # The data stored in this IV is saved in the 'config' file
21032 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_logPreamble');
21033  
21034 return 1;
21035 }
21036  
21037 sub set_logPref {
21038  
21039 my ($self, $logFile, $flag, $check) = @_;
21040  
21041 # Check for improper arguments
21042 if (! defined $logFile || ! defined $flag || defined $check) {
21043  
21044 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_logPref', @_);
21045 }
21046  
21047 if (! $self->ivExists('logPrefHash', $logFile)) {
21048  
21049 return undef;
21050  
21051 } else {
21052  
21053 if ($flag) {
21054 $self->ivAdd('logPrefHash', $logFile, TRUE);
21055 } else {
21056 $self->ivAdd('logPrefHash', $logFile, FALSE);
21057 }
21058  
21059 # The data stored in this IV is saved in the 'config' file
21060 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_logPref');
21061  
21062 return 1;
21063 }
21064 }
21065  
21066 sub set_loopSpinFlag {
21067  
21068 my ($self, $flag, $check) = @_;
21069  
21070 # Check for improper arguments
21071 if (! defined $flag || defined $check) {
21072  
21073 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_loopSpinFlag', @_);
21074 }
21075  
21076 if ($flag) {
21077 $self->ivPoke('clientLoopSpinFlag', TRUE);
21078 } else {
21079 $self->ivPoke('clientLoopSpinFlag', FALSE);
21080 }
21081  
21082 return 1;
21083 }
21084  
21085 sub set_mainWin {
21086  
21087 # Called by GA::Obj::Desktop->start and GA::Session->setMainWin
21088  
21089 my ($self, $winObj, $check) = @_;
21090  
21091 # Check for improper arguments
21092 if (! defined $winObj || defined $check) {
21093  
21094 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_mainWin', @_);
21095 }
21096  
21097 # Update IVs
21098 $self->ivPoke('mainWin', $winObj);
21099  
21100 return 1;
21101 }
21102  
21103 sub reset_mainWin {
21104  
21105 # Called by GA::Obj::Desktop->start and GA::Session->setMainWin
21106  
21107 my ($self, $check) = @_;
21108  
21109 # Check for improper arguments
21110 if (defined $check) {
21111  
21112 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_mainWin', @_);
21113 }
21114  
21115 # Update IVs
21116 $self->ivPoke('mainWin', undef);
21117  
21118 return 1;
21119 }
21120  
21121 sub set_mainWinSystemMsgFlag {
21122  
21123 my ($self, $flag, $check) = @_;
21124  
21125 # Check for improper arguments
21126 if (! defined $flag || defined $check) {
21127  
21128 return $axmud::CLIENT->writeImproper(
21129 $self->_objClass . '->set_mainWinSystemMsgFlag',
21130 @_,
21131 );
21132 }
21133  
21134 if ($flag) {
21135 $self->ivPoke('mainWinSystemMsgFlag', TRUE);
21136 } else {
21137 $self->ivPoke('mainWinSystemMsgFlag', FALSE);
21138 }
21139  
21140 # The data stored in this IV is saved in the 'config' file
21141 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_mainWinSystemMsgFlag');
21142  
21143 return 1;
21144 }
21145  
21146 sub set_mainWinTooltipFlag {
21147  
21148 my ($self, $flag, $check) = @_;
21149  
21150 # Check for improper arguments
21151 if (! defined $flag || defined $check) {
21152  
21153 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_mainWinTooltipFlag', @_);
21154 }
21155  
21156 if ($flag) {
21157 $self->ivPoke('mainWinTooltipFlag', TRUE);
21158 } else {
21159 $self->ivPoke('mainWinTooltipFlag', FALSE);
21160 }
21161  
21162 # The data stored in this IV is saved in the 'config' file
21163 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_mainWinTooltipFlag');
21164  
21165 return 1;
21166 }
21167  
21168 sub set_mainWinUrgencyFlag {
21169  
21170 my ($self, $flag, $check) = @_;
21171  
21172 # Check for improper arguments
21173 if (! defined $flag || defined $check) {
21174  
21175 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_mainWinUrgencyFlag', @_);
21176 }
21177  
21178 if ($flag) {
21179 $self->ivPoke('mainWinUrgencyFlag', TRUE);
21180 } else {
21181 $self->ivPoke('mainWinUrgencyFlag', FALSE);
21182 }
21183  
21184 # The data stored in this IV is saved in the 'config' file
21185 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_mainWinUrgencyFlag');
21186  
21187 return 1;
21188 }
21189  
21190 sub toggle_mnesFlag {
21191  
21192 # $flag is not specified when called by GA::Cmd::MNES->do, but is specified when called by
21193 # GA::PrefWin::Client
21194  
21195 my ($self, $type, $flag, $check) = @_;
21196  
21197 # Local variables
21198 my $iv;
21199  
21200 # Check for improper arguments
21201 if (! defined $type || ($type ne 'send_ip')) {
21202  
21203 return $axmud::CLIENT->writeImproper($self->_objClass . '->toggle_mnesFlag', @_);
21204 }
21205  
21206 # (At the moment, there is only one flag IV for MNES; nevertheless we'll keep the same
21207 # format used by other similar accessor functions)
21208 if ($type eq 'send_ip') {
21209  
21210 $iv = 'allowMnesSendIPFlag';
21211 }
21212  
21213 if (defined $flag) {
21214  
21215 if ($flag) {
21216 $self->ivPoke($iv, TRUE);
21217 } else {
21218 $self->ivPoke($iv, FALSE);
21219 }
21220  
21221 } elsif ($self->$iv) {
21222  
21223 $self->ivPoke($iv, FALSE);
21224  
21225 } else {
21226  
21227 $self->ivPoke($iv, TRUE);
21228 }
21229  
21230 # The data stored in these IVs are saved in the 'config' file
21231 $self->setModifyFlag('config', TRUE, $self->_objClass . '->toggle_mnesFlag');
21232  
21233 return 1;
21234 }
21235  
21236 sub set_modelSplitSize {
21237  
21238 my ($self, $size, $check) = @_;
21239  
21240 # Check for improper arguments
21241 if (! defined $size || defined $check) {
21242  
21243 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_modelSplitSize', @_);
21244 }
21245  
21246 # Update IVs
21247 $self->ivPoke('modelSplitSize', $size);
21248  
21249 # The data stored in this IV is saved in the 'config' file
21250 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_modelSplitSize');
21251  
21252 return 1;
21253 }
21254  
21255 sub toggle_mspFlag {
21256  
21257 # $flag is not specified when called by ;msp, but is specified when called by
21258 # GA::PrefWin::Client
21259  
21260 my ($self, $type, $flag, $check) = @_;
21261  
21262 # Local variables
21263 my $iv;
21264  
21265 # Check for improper arguments
21266 if (
21267 ! defined $type
21268 || ($type ne 'multiple' && $type ne 'load' && $type ne 'flexible')
21269 ) {
21270 return $axmud::CLIENT->writeImproper($self->_objClass . '->toggle_mspFlag', @_);
21271 }
21272  
21273 if ($type eq 'multiple') {
21274 $iv = 'allowMspMultipleFlag';
21275 } elsif ($type eq 'load') {
21276 $iv = 'allowMspLoadSoundFlag';
21277 } elsif ($type eq 'flexible') {
21278 $iv = 'allowMspFlexibleFlag';
21279 }
21280  
21281 if (defined $flag) {
21282  
21283 if ($flag) {
21284 $self->ivPoke($iv, TRUE);
21285 } else {
21286 $self->ivPoke($iv, FALSE);
21287 }
21288  
21289 } elsif ($self->$iv) {
21290  
21291 $self->ivPoke($iv, FALSE);
21292  
21293 } else {
21294  
21295 $self->ivPoke($iv, TRUE);
21296 }
21297  
21298 # The data stored in these IVs are saved in the 'config' file
21299 $self->setModifyFlag('config', TRUE, $self->_objClass . '->toggle_mspFlag');
21300  
21301 return 1;
21302 }
21303  
21304 sub toggle_mudProtocol {
21305  
21306 # $flag is not specified when called by ;setmudprotocol, but is specified when called by
21307 # GA::PrefWin::Client
21308  
21309 my ($self, $protocol, $flag, $check) = @_;
21310  
21311 # Local variables
21312 my $iv;
21313  
21314 # Check for improper arguments
21315 if (
21316 ! defined $protocol
21317 || (
21318 $protocol ne 'msdp' && $protocol ne 'mssp' && $protocol ne 'mccp'
21319 && $protocol ne 'msp' && $protocol ne 'mxp' && $protocol ne 'pueblo'
21320 && $protocol ne 'zmp' && $protocol ne 'aard102' && $protocol ne 'atcp'
21321 && $protocol ne 'gmcp' && $protocol ne 'mtts' && $protocol ne 'mnes'
21322 && $protocol ne 'mcp'
21323 )
21324 ) {
21325 return $axmud::CLIENT->writeImproper($self->_objClass . '->toggle_mudProtocol', @_);
21326 }
21327  
21328 if ($protocol eq 'msdp') {
21329 $iv = 'useMsdpFlag';
21330 } elsif ($protocol eq 'mssp') {
21331 $iv = 'useMsspFlag';
21332 } elsif ($protocol eq 'mccp') {
21333 $iv = 'useMccpFlag';
21334 } elsif ($protocol eq 'msp') {
21335 $iv = 'useMspFlag';
21336 } elsif ($protocol eq 'mxp') {
21337 $iv = 'useMxpFlag';
21338 } elsif ($protocol eq 'pueblo') {
21339 $iv = 'usePuebloFlag';
21340 } elsif ($protocol eq 'zmp') {
21341 $iv = 'useZmpFlag';
21342 } elsif ($protocol eq 'aard102') {
21343 $iv = 'useAard102Flag';
21344 } elsif ($protocol eq 'atcp') {
21345 $iv = 'useAtcpFlag';
21346 } elsif ($protocol eq 'gmcp') {
21347 $iv = 'useGmcpFlag';
21348 } elsif ($protocol eq 'mtts') {
21349 $iv = 'useMttsFlag';
21350 } elsif ($protocol eq 'mnes') {
21351 $iv = 'useMnesFlag';
21352 } elsif ($protocol eq 'mcp') {
21353 $iv = 'useMcpFlag';
21354 }
21355  
21356 if (defined $flag) {
21357  
21358 if ($flag) {
21359 $self->ivPoke($iv, TRUE);
21360 } else {
21361 $self->ivPoke($iv, FALSE);
21362 }
21363  
21364 } elsif ($self->$iv) {
21365  
21366 $self->ivPoke($iv, FALSE);
21367  
21368 } else {
21369  
21370 $self->ivPoke($iv, TRUE);
21371 }
21372  
21373 # If disabling an option, update every session (except for Pueblo and ZMP, which can't be
21374 # turned off mid-session)
21375 if (! $self->$iv && $iv ne 'pueblo' && $iv ne 'zmp') {
21376  
21377 foreach my $session ($self->listSessions()) {
21378  
21379 $session->disableMudProtocol($protocol);
21380 }
21381 }
21382  
21383 # The data stored in these IVs are saved in the 'config' file
21384 $self->setModifyFlag('config', TRUE, $self->_objClass . '->toggle_mudProtocol');
21385  
21386 return 1;
21387 }
21388  
21389 sub set_mxpPreventSupportFlag {
21390  
21391 my ($self, $flag, $check) = @_;
21392  
21393 # Check for improper arguments
21394 if (! defined $flag || defined $check) {
21395  
21396 return $axmud::CLIENT->writeImproper(
21397 $self->_objClass . '->set_mxpPreventSupportFlag',
21398 @_,
21399 );
21400 }
21401  
21402 if ($flag) {
21403 $self->ivPoke('mxpPreventSupportFlag', TRUE);
21404 } else {
21405 $self->ivPoke('mxpPreventSupportFlag', FALSE);
21406 }
21407  
21408 return 1;
21409 }
21410  
21411 sub set_oscPaletteFlag {
21412  
21413 my ($self, $flag, $check) = @_;
21414  
21415 # Check for improper arguments
21416 if (! defined $flag || defined $check) {
21417  
21418 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_oscPaletteFlag', @_);
21419 }
21420  
21421 if ($flag) {
21422 $self->ivPoke('oscPaletteFlag', TRUE);
21423 } else {
21424 $self->ivPoke('oscPaletteFlag', FALSE);
21425 }
21426  
21427 # The data stored in this IV is saved in the 'config' file
21428 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_oscPaletteFlag');
21429  
21430 return 1;
21431 }
21432  
21433 sub set_promptWaitTime {
21434  
21435 my ($self, $interval, $check) = @_;
21436  
21437 # Check for improper arguments
21438 if (! defined $interval || defined $check) {
21439  
21440 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_promptWaitTime', @_);
21441 }
21442  
21443 # Update IVs
21444 $self->ivPoke('promptWaitTime', $interval);
21445  
21446 # The data stored in this IV is saved in the 'config' file
21447 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_promptWaitTime');
21448  
21449 return 1;
21450 }
21451  
21452 sub set_resetKeycodesFlag {
21453  
21454 my ($self, $flag, $check) = @_;
21455  
21456 # Check for improper arguments
21457 if (! defined $flag || defined $check) {
21458  
21459 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_resetKeycodesFlag', @_);
21460 }
21461  
21462 if ($flag) {
21463 $self->ivPoke('resetKeycodesFlag', TRUE);
21464 } else {
21465 $self->ivPoke('resetKeycodesFlag', FALSE);
21466 }
21467  
21468 return 1;
21469 }
21470  
21471 sub set_restartShareMainWinMode {
21472  
21473 my ($self, $flag, $check) = @_;
21474  
21475 # Check for improper arguments
21476 if (! defined $flag || defined $check) {
21477  
21478 return $axmud::CLIENT->writeImproper(
21479 $self->_objClass . '->set_restartShareMainWinMode',
21480 @_,
21481 );
21482 }
21483  
21484 if ($flag) {
21485 $self->ivPoke('restartShareMainWinMode', 'on');
21486 } else {
21487 $self->ivPoke('restartShareMainWinMode', 'off');
21488 }
21489  
21490 # The data stored in this IV is saved in the 'config' file
21491 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_restartShareMainWinMode');
21492  
21493 return 1;
21494 }
21495  
21496 sub reset_runLists {
21497  
21498 my ($self, $check) = @_;
21499  
21500 # Check for improper arguments
21501 if (defined $check) {
21502  
21503 return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_runLists', @_);
21504 }
21505  
21506 $self->ivPoke('taskRunFirstList', $self->constTaskRunFirstList);
21507 $self->ivPoke('taskRunLastList', $self->constTaskRunLastList);
21508  
21509 # The data stored in these IVs is saved in the 'tasks' file
21510 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->reset_runLists');
21511  
21512 return 1;
21513 }
21514  
21515 sub set_saveConfigFlag {
21516  
21517 my ($self, $flag, $check) = @_;
21518  
21519 # Check for improper arguments
21520 if (! defined $flag || defined $check) {
21521  
21522 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_saveConfigFlag', @_);
21523 }
21524  
21525 if ($flag) {
21526 $self->ivPoke('saveConfigFlag', TRUE);
21527 } else {
21528 $self->ivPoke('saveConfigFlag', FALSE);
21529 }
21530  
21531 # The data stored in this IV is saved in the 'config' file
21532 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_saveConfigFlag');
21533  
21534 return 1;
21535 }
21536  
21537 sub set_saveDataFlag {
21538  
21539 my ($self, $flag, $check) = @_;
21540  
21541 # Check for improper arguments
21542 if (! defined $flag || defined $check) {
21543  
21544 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_saveDataFlag', @_);
21545 }
21546  
21547 if ($flag) {
21548 $self->ivPoke('saveDataFlag', TRUE);
21549 } else {
21550 $self->ivPoke('saveDataFlag', FALSE);
21551 }
21552  
21553 # The data stored in this IV is saved in the 'config' file
21554 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_saveDataFlag');
21555  
21556 return 1;
21557 }
21558  
21559 sub add_scriptDir {
21560  
21561 my ($self, $dir, $check) = @_;
21562  
21563 # Check for improper arguments
21564 if (! defined $dir || defined $check) {
21565  
21566 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_scriptDir', @_);
21567 }
21568  
21569 $self->ivPush('scriptDirList', $dir);
21570  
21571 # The data stored in this IV is saved in the 'scripts' file
21572 $self->setModifyFlag('scripts', TRUE, $self->_objClass . '->add_scriptDir');
21573  
21574 return 1;
21575 }
21576  
21577 sub del_scriptDir {
21578  
21579 my ($self, $index, $check) = @_;
21580  
21581 # Check for improper arguments
21582 if (! defined $index || defined $check) {
21583  
21584 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_soundEffect', @_);
21585 }
21586  
21587 $self->ivSplice('scriptDirList', $index, 1);
21588  
21589 # The data stored in this IV is saved in the 'scripts' file
21590 $self->setModifyFlag('scripts', TRUE, $self->_objClass . '->del_soundEffect');
21591  
21592 return 1;
21593 }
21594  
21595 sub inc_sessionCount {
21596  
21597 my ($self, $check) = @_;
21598  
21599 # Check for improper arguments
21600 if (defined $check) {
21601  
21602 return $axmud::CLIENT->writeImproper($self->_objClass . '->inc_sessionCount', @_);
21603 }
21604  
21605 return $self->ivIncrement('sessionCount');
21606 }
21607  
21608 sub set_sessionMax {
21609  
21610 my ($self, $num, $check) = @_;
21611  
21612 # Check for improper arguments
21613 if (
21614 ! defined $num
21615 || $num > $self->constSessionMax
21616 || defined $check
21617 ) {
21618 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_sessionMax', @_);
21619 }
21620  
21621 $self->ivPoke('sessionMax', $num);
21622  
21623 # The data stored in this IV is saved in the 'config' file
21624 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_sessionMax');
21625  
21626 return 1;
21627 }
21628  
21629 sub toggle_sessionFlag {
21630  
21631 my ($self, $type, $check) = @_;
21632  
21633 # Local variables
21634 my $iv;
21635  
21636 # Check for improper arguments
21637 if (
21638 ! defined $type
21639 || (
21640 $type ne 'xterm' && $type ne 'long' && $type ne 'simple' && $type ne 'close_main'
21641 && $type ne 'close_tab' && $type ne 'close_menu' && $type ne 'close_toolbutton'
21642 && $type ne 'switch_offline'
21643 )
21644 ) {
21645 return $axmud::CLIENT->writeImproper($self->_objClass . '->toggle_sessionFlag', @_);
21646 }
21647  
21648 if ($type eq 'xterm') {
21649 $iv = 'xTermTitleFlag';
21650 } elsif ($type eq 'long') {
21651 $iv = 'longTabLabelFlag';
21652 } elsif ($type eq 'simple') {
21653 $iv = 'simpleTabFlag';
21654 } elsif ($type eq 'close_main') {
21655 $iv = 'confirmCloseMainWinFlag';
21656 } elsif ($type eq 'close_tab') {
21657 $iv = 'confirmCloseTabFlag';
21658 } elsif ($type eq 'switch_offline') {
21659 $iv = 'offlineOnDisconnectFlag';
21660 } elsif ($type eq 'close_menu') {
21661 $iv = 'confirmCloseToolButtonFlag';
21662 } elsif ($type eq 'close_toolbutton') {
21663 $iv = 'confirmCloseMenuFlag';
21664 }
21665  
21666 if ($self->$iv) {
21667 $self->ivPoke($iv, FALSE);
21668 } else {
21669 $self->ivPoke($iv, TRUE);
21670 }
21671  
21672 # Redraw the tab title in every session
21673 if ($type ne 'switch_offline') {
21674  
21675 foreach my $session ($self->listSessions()) {
21676  
21677 # The TRUE argument means 'definitely update'
21678 $session->checkTabLabels(TRUE);
21679 }
21680 }
21681  
21682 # The data stored in these IVs are saved in the 'config' file
21683 $self->setModifyFlag('config', TRUE, $self->_objClass . '->toggle_sessionFlag');
21684  
21685 return 1;
21686 }
21687  
21688 sub set_sessionTabMode {
21689  
21690 my ($self, $mode, $check) = @_;
21691  
21692 # Check for improper arguments
21693 if (
21694 defined $check
21695 || ($mode ne 'bracket' && $mode ne 'hyphen' && $mode ne 'world' && $mode ne 'char')
21696 ) {
21697 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_sessionTabMode', @_);
21698 }
21699  
21700 # Update IVs
21701 $self->ivPoke('sessionTabMode', $mode);
21702  
21703 # Redraw the tab title in every session
21704 foreach my $session ($self->listSessions()) {
21705  
21706 # The TRUE argument means 'definitely update'
21707 $session->checkTabLabels(TRUE);
21708 }
21709  
21710 # The data stored in this IV is saved in the 'config' file
21711 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_sessionTabMode');
21712  
21713 return 1;
21714 }
21715  
21716 sub set_shareMainWinFlag {
21717  
21718 # Should only be called by GA::WizWin::Setup->saveChanges. Everything else should call
21719 # $self->set_restartShareMainWinMode
21720  
21721 my ($self, $flag, $check) = @_;
21722  
21723 # Check for improper arguments
21724 if (! defined $flag || defined $check) {
21725  
21726 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_shareMainWinFlag', @_);
21727 }
21728  
21729 if ($flag) {
21730 $self->ivPoke('shareMainWinFlag', TRUE);
21731 } else {
21732 $self->ivPoke('shareMainWinFlag', FALSE);
21733 }
21734  
21735 # The data stored in this IV is saved in the 'config' file
21736 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_shareMainWinFlag');
21737  
21738 return 1;
21739 }
21740  
21741 sub set_shortUrlFlag {
21742  
21743 my ($self, $flag, $check) = @_;
21744  
21745 # Check for improper arguments
21746 if (! defined $flag || defined $check) {
21747  
21748 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_shortUrlFlag', @_);
21749 }
21750  
21751 if ($flag) {
21752 $self->ivPoke('shortUrlFlag', TRUE);
21753 } else {
21754 $self->ivPoke('shortUrlFlag', FALSE);
21755 }
21756  
21757 # The data stored in this IV is saved in the 'config' file
21758 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_shortUrlFlag');
21759  
21760 return 1;
21761 }
21762  
21763 sub set_showSetupWizWinFlag {
21764  
21765 my ($self, $flag, $check) = @_;
21766  
21767 # Check for improper arguments
21768 if (! defined $flag || defined $check) {
21769  
21770 return $axmud::CLIENT->writeImproper(
21771 $self->_objClass . '->set_showSetupWizWinFlag',
21772 @_,
21773 );
21774 }
21775  
21776 if ($flag) {
21777 $self->ivPoke('showSetupWizWinFlag', TRUE);
21778 } else {
21779 $self->ivPoke('showSetupWizWinFlag', FALSE);
21780 }
21781  
21782 return 1;
21783 }
21784  
21785 sub toggle_sigilFlag {
21786  
21787 my ($self, $sigil, $check) = @_;
21788  
21789 # Local variables
21790 my $iv;
21791  
21792 # Check for improper arguments
21793 if (
21794 ! defined $sigil
21795 || (
21796 $sigil ne 'echo' && $sigil ne 'perl' && $sigil ne 'script' && $sigil ne 'multi'
21797 && $sigil ne 'speed' && $sigil ne 'bypass'
21798 )
21799 ) {
21800 return $axmud::CLIENT->writeImproper($self->_objClass . '->toggle_sigilFlag', @_);
21801 }
21802  
21803 $iv = $sigil . 'SigilFlag'; # e.g. ->echoSigilFlag
21804 if ($self->$iv) {
21805 $self->ivPoke($iv, FALSE);
21806 } else {
21807 $self->ivPoke($iv, TRUE);
21808 }
21809  
21810 # The data stored in these IVs are saved in the 'config' file
21811 $self->setModifyFlag('config', TRUE, $self->_objClass . '->toggle_sigilFlag');
21812  
21813 return 1;
21814 }
21815  
21816 sub add_soundEffect {
21817  
21818 my ($self, $sound, $path, $check) = @_;
21819  
21820 # Check for improper arguments
21821 if (! defined $sound || ! defined $path || defined $check) {
21822  
21823 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_soundEffect', @_);
21824 }
21825  
21826 $self->ivAdd('customSoundHash', $sound, $path);
21827  
21828 # The data stored in this IV is saved in the 'config' file
21829 $self->setModifyFlag('config', TRUE, $self->_objClass . '->add_soundEffect');
21830  
21831 return 1;
21832 }
21833  
21834 sub del_soundEffect {
21835  
21836 my ($self, $sound, $check) = @_;
21837  
21838 # Check for improper arguments
21839 if (! defined $sound || defined $check) {
21840  
21841 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_soundEffect', @_);
21842 }
21843  
21844 $self->ivDelete('customSoundHash', $sound);
21845  
21846 # The data stored in this IV is saved in the 'config' file
21847 $self->setModifyFlag('config', TRUE, $self->_objClass . '->del_soundEffect');
21848  
21849 return 1;
21850 }
21851  
21852 sub set_standardColourTag {
21853  
21854 my ($self, $tag, $rgb, $boldFlag, $check) = @_;
21855  
21856 # Check for improper arguments
21857 if (! defined $tag || ! defined $rgb || defined $check) {
21858  
21859 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_standardColourTag', @_);
21860 }
21861  
21862 # Update IVs
21863 if (! $boldFlag) {
21864 $self->ivAdd('colourTagHash', $tag, $rgb);
21865 } else {
21866 $self->ivAdd('boldColourTagHash', $tag, $rgb);
21867 }
21868  
21869 # The data stored in this IV is saved in the 'config' file
21870 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_standardColourTag');
21871  
21872 return 1;
21873 }
21874  
21875 sub add_standardZonemap {
21876  
21877 my ($self, $zonemap, $check) = @_;
21878  
21879 # Check for improper arguments
21880 if (! defined $zonemap || defined $check) {
21881  
21882 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_standardZonemap', @_);
21883 }
21884  
21885 # Update IVs
21886 $self->ivAdd('standardZonemapHash', $zonemap->name, $zonemap);
21887  
21888 # The data stored in this IV is saved in the 'zonemaps' file
21889 $self->setModifyFlag('zonemaps', TRUE, $self->_objClass . '->add_standardZonemap');
21890  
21891 return 1;
21892 }
21893  
21894 sub set_statusEvent {
21895  
21896 my ($self, $type, $number, $check) = @_;
21897  
21898 # Check for improper arguments
21899 if (
21900 ! defined $type || ($type ne 'before' && $type ne 'after') || ! defined $number
21901 || defined $check
21902 ) {
21903 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_statusEvent', @_);
21904 }
21905  
21906 if ($type eq 'before') {
21907 $self->ivPoke('statusEventBeforeCount', $number);
21908 } else {
21909 $self->ivPoke('statusEventAfterCount', $number);
21910 }
21911  
21912 # The data stored in this IV is saved in the 'config' file
21913 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_statusEvent');
21914  
21915 return 1;
21916 }
21917  
21918 sub set_storeGridPosnFlag {
21919  
21920 my ($self, $flag, $check) = @_;
21921  
21922 # Check for improper arguments
21923 if (! defined $flag || defined $check) {
21924  
21925 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_storeGridPosnFlag', @_);
21926 }
21927  
21928 if ($flag) {
21929 $self->ivPoke('storeGridPosnFlag', TRUE);
21930 } else {
21931 $self->ivPoke('storeGridPosnFlag', FALSE);
21932 }
21933  
21934 return 1;
21935 }
21936  
21937 sub add_storeGridPosn {
21938  
21939 # Called by GA::Win::Internal->setConfigureEvent and GA::Win::Map->setConfigureEvent
21940 # Also called by GA::Obj::Workspace->createGridWin and ->createSimpleGridWin
21941  
21942 my ($self, $winObj, $xPos, $yPos, $width, $height, $ignoreFlag, $check) = @_;
21943  
21944 # Check for improper arguments
21945 if (! defined $winObj || defined $check) {
21946  
21947 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_storeGridPosn', @_);
21948 }
21949  
21950 # Do nothing if the storage flag isn't set, if it's not a 'grid' window or if it's an
21951 # 'external' window
21952 # Allow storing of position but not size, or size but not position, but not both
21953 if (
21954 (! $self->storeGridPosnFlag && ! $ignoreFlag)
21955 || $winObj->winCategory ne 'grid'
21956 || $winObj->winType eq 'external'
21957 || (! defined $xPos && ! defined $yPos && ! defined $width && ! defined $height)
21958 ) {
21959 return undef;
21960 }
21961  
21962 # An entry is added/replaced in $self->storeGridPosnHash for any 'grid' window, but if there
21963 # are several windows with the same ->winName open, only the one which was opened first is
21964 # used
21965 foreach my $otherWinObj ($self->desktopObj->ivValues('gridWinHash')) {
21966  
21967 if (
21968 $otherWinObj ne $winObj
21969 && $otherWinObj->winName eq $winObj->winName
21970 && $otherWinObj->number < $winObj->number
21971 ) {
21972 return undef;
21973 }
21974 }
21975  
21976 # Update the hash IV
21977 $self->ivAdd(
21978 'storeGridPosnHash',
21979 $winObj->winName,
21980 [$xPos, $yPos, $width, $height],
21981 );
21982  
21983 # The data stored in this IV is saved in the 'config' file
21984 $self->setModifyFlag('config', TRUE, $self->_objClass . '->add_storeGridPosn');
21985  
21986 return 1;
21987 }
21988  
21989 sub del_storeGridPosn {
21990  
21991 my ($self, $winName, $check) = @_;
21992  
21993 # Check for improper arguments
21994 if (! defined $winName || defined $check) {
21995  
21996 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_storeGridPosn', @_);
21997 }
21998  
21999 $self->ivDelete('storeGridPosnHash', $winName);
22000  
22001 # The data stored in this IV is saved in the 'config' file
22002 $self->setModifyFlag('config', TRUE, $self->_objClass . '->del_storeGridPosn');
22003  
22004 return 1;
22005 }
22006  
22007 sub reset_storeGridPosn {
22008  
22009 my ($self, $check) = @_;
22010  
22011 # Check for improper arguments
22012 if (defined $check) {
22013  
22014 return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_storeGridPosn', @_);
22015 }
22016  
22017 $self->ivEmpty('storeGridPosnHash');
22018  
22019 # The data stored in this IV is saved in the 'config' file
22020 $self->setModifyFlag('config', TRUE, $self->_objClass . '->reset_storeGridPosn');
22021  
22022 return 1;
22023 }
22024  
22025 sub add_systemMsg {
22026  
22027 my ($self, $type, $msg, $check) = @_;
22028  
22029 # Check for improper arguments
22030 if (! defined $type || ! defined $msg || defined $check) {
22031  
22032 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_systemMsg', @_);
22033 }
22034  
22035 # If the Client Console window is actually open, display it there immediately
22036 if ($self->consoleWin) {
22037  
22038 $self->consoleWin->update($type, $msg);
22039  
22040 } else {
22041  
22042 $self->ivPush('systemMsgList', $type, $msg);
22043 # If the Connections window is open, tell it to change the icon on its button, so the
22044 # user can see that a system message has arrived
22045 if ($self->connectWin) {
22046  
22047 $self->connectWin->set_consoleButton(TRUE);
22048 }
22049 }
22050  
22051 return 1;
22052 }
22053  
22054 sub reset_systemMsg {
22055  
22056 my ($self, $check) = @_;
22057  
22058 # Check for improper arguments
22059 if (defined $check) {
22060  
22061 return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_systemMsg', @_);
22062 }
22063  
22064 $self->ivEmpty('systemMsgList');
22065  
22066 # If the Connections window is open, tell it to change the icon on its button
22067 if ($self->connectWin) {
22068  
22069 $self->connectWin->set_consoleButton(FALSE);
22070 }
22071  
22072 return 1;
22073 }
22074  
22075 sub add_taskLabel {
22076  
22077 my ($self, $label, $taskName, $check) = @_;
22078  
22079 # Check for improper arguments
22080 if (! defined $label || ! defined $taskName || defined $check) {
22081  
22082 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_taskLabel', @_);
22083 }
22084  
22085 $self->ivAdd('taskLabelHash', $label, $taskName);
22086  
22087 # The data stored in this IV is saved in the 'tasks' file
22088 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->add_taskLabel');
22089  
22090 return 1;
22091 }
22092  
22093 sub del_taskLabel {
22094  
22095 my ($self, $label, $check) = @_;
22096  
22097 # Check for improper arguments
22098 if (! defined $label || defined $check) {
22099  
22100 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_taskLabel', @_);
22101 }
22102  
22103 $self->ivDelete('taskLabelHash', $label);
22104  
22105 # The data stored in this IV is saved in the 'tasks' file
22106 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->del_taskLabel');
22107  
22108 return 1;
22109 }
22110  
22111 sub reset_taskLabels {
22112  
22113 my ($self, $check) = @_;
22114  
22115 # Check for improper arguments
22116 if (defined $check) {
22117  
22118 return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_taskLabels', @_);
22119 }
22120  
22121 $self->ivPoke('taskLabelHash', $self->constTaskLabelHash);
22122  
22123 # The data stored in this IV is saved in the 'tasks' file
22124 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->reset_taskLabels');
22125  
22126 return 1;
22127 }
22128  
22129 sub add_taskPackageName {
22130  
22131 my ($self, $taskName, $packageName, $check) = @_;
22132  
22133 # Check for improper arguments
22134 if (! defined $taskName || ! defined $packageName || defined $check) {
22135  
22136 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_taskPackageName', @_);
22137 }
22138  
22139 $self->ivAdd('taskPackageHash', $taskName, $packageName);
22140  
22141 return 1;
22142 }
22143  
22144 sub del_taskPackageName {
22145  
22146 my ($self, $taskName, $check) = @_;
22147  
22148 # Check for improper arguments
22149 if (! defined $taskName || defined $check) {
22150  
22151 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_taskPackageName', @_);
22152 }
22153  
22154 $self->ivDelete('taskPackageHash', $taskName);
22155  
22156 return 1;
22157 }
22158  
22159 sub reset_taskPackageNames {
22160  
22161 my ($self, $check) = @_;
22162  
22163 # Check for improper arguments
22164 if (defined $check) {
22165  
22166 return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_taskPackageNames', @_);
22167 }
22168  
22169 $self->ivPoke('taskPackageHash', $self->constTaskPackageHash);
22170  
22171 return 1;
22172 }
22173  
22174 sub set_taskRunFirstList {
22175  
22176 my ($self, @args) = @_;
22177  
22178 # (No improper arguments to check; @args can be an empty list)
22179  
22180 $self->ivPoke('taskRunFirstList', @args);
22181  
22182 # The data stored in this IV is saved in the 'tasks' file
22183 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->set_taskRunFirstList');
22184  
22185 return 1;
22186 }
22187  
22188 sub set_taskRunLastList {
22189  
22190 my ($self, @args) = @_;
22191  
22192 # (No improper arguments to check; @args can be an empty list)
22193  
22194 $self->ivPoke('taskRunLastList', @args);
22195  
22196 # The data stored in this IV is saved in the 'tasks' file
22197 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->set_taskRunLastList');
22198  
22199 return 1;
22200 }
22201  
22202 sub inc_taskTotal {
22203  
22204 my ($self, $check) = @_;
22205  
22206 # Check for improper arguments
22207 if (defined $check) {
22208  
22209 return $axmud::CLIENT->writeImproper($self->_objClass . '->inc_taskTotal', @_);
22210 }
22211  
22212 return $self->ivIncrement('taskTotal');
22213 }
22214  
22215 sub toggle_telnetOption {
22216  
22217 # $flag is not specified when called by ;settelnetoption, but is specified when called by
22218 # GA::PrefWin::Client
22219  
22220 my ($self, $option, $flag, $check) = @_;
22221  
22222 # Local variables
22223 my $iv;
22224  
22225 # Check for improper arguments
22226 if (
22227 ! defined $option
22228 || (
22229 $option ne 'echo' && $option ne 'sga' && $option ne 'ttype' && $option ne 'eor'
22230 && $option ne 'naws' && $option ne 'new_environ' && $option ne 'charset'
22231 )
22232 ) {
22233 return $axmud::CLIENT->writeImproper($self->_objClass . '->toggle_telnetOption', @_);
22234 }
22235  
22236 if ($option eq 'echo') {
22237 $iv = 'useEchoFlag';
22238 } elsif ($option eq 'sga') {
22239 $iv = 'useSgaFlag';
22240 } elsif ($option eq 'ttype') {
22241 $iv = 'useTTypeFlag';
22242 } elsif ($option eq 'eor') {
22243 $iv = 'useEorFlag';
22244 } elsif ($option eq 'naws') {
22245 $iv = 'useNawsFlag';
22246 } elsif ($option eq 'new_environ') {
22247 $iv = 'useNewEnvironFlag';
22248 } elsif ($option eq 'charset') {
22249 $iv = 'useCharSetFlag';
22250 }
22251  
22252 if (defined $flag) {
22253  
22254 if ($flag) {
22255 $self->ivPoke($iv, TRUE);
22256 } else {
22257 $self->ivPoke($iv, FALSE);
22258 }
22259  
22260 } elsif ($self->$iv) {
22261  
22262 $self->ivPoke($iv, FALSE);
22263  
22264 } else {
22265  
22266 $self->ivPoke($iv, TRUE);
22267 }
22268  
22269 # If disabling an option, update every session
22270 if (! $self->$iv) {
22271  
22272 foreach my $session ($self->listSessions()) {
22273  
22274 $session->disableTelnetOption($option);
22275 }
22276 }
22277  
22278 # The data stored in these IVs are saved in the 'config' file
22279 $self->setModifyFlag('config', TRUE, $self->_objClass . '->toggle_telnetOption');
22280  
22281 return 1;
22282 }
22283  
22284 sub set_tempSoundFlag {
22285  
22286 my ($self, $flag, $check) = @_;
22287  
22288 # Check for improper arguments
22289 if (! defined $flag || defined $check) {
22290  
22291 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_tempSoundFlag', @_);
22292 }
22293  
22294 if ($flag) {
22295 $self->ivPoke('tempSoundFlag', TRUE);
22296 } else {
22297 $self->ivPoke('tempSoundFlag', FALSE);
22298 }
22299  
22300 return 1;
22301 }
22302  
22303 sub set_tempUrgencyFlag {
22304  
22305 my ($self, $flag, $check) = @_;
22306  
22307 # Check for improper arguments
22308 if (! defined $flag || defined $check) {
22309  
22310 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_tempUrgencyFlag', @_);
22311 }
22312  
22313 if ($flag) {
22314 $self->ivPoke('tempUrgencyFlag', TRUE);
22315 } else {
22316 $self->ivPoke('tempUrgencyFlag', FALSE);
22317 }
22318  
22319 return 1;
22320 }
22321  
22322 sub toggle_termSetting {
22323  
22324 # $flag is not specified when called by ;configureterminal, but is specified when called by
22325 # GA::PrefWin::Client
22326  
22327 my ($self, $type, $flag, $check) = @_;
22328  
22329 # Local variables
22330 my $iv;
22331  
22332 # Check for improper arguments
22333 if (
22334 ! defined $type
22335 || (
22336 $type ne 'use_ctrl_seq' && $type ne 'show_cursor' && $type ne 'fast_cursor'
22337 && $type ne 'direct_keys'
22338 )
22339 ) {
22340 return $axmud::CLIENT->writeImproper($self->_objClass . '->toggle_termSetting', @_);
22341 }
22342  
22343 if ($type eq 'use_ctrl_seq') {
22344 $iv = 'useCtrlSeqFlag';
22345 } elsif ($type eq 'show_cursor') {
22346 $iv = 'useVisibleCursorFlag';
22347 } elsif ($type eq 'fast_cursor') {
22348 $iv = 'useFastCursorFlag';
22349 } elsif ($type eq 'direct_keys') {
22350 $iv = 'useDirectKeysFlag';
22351 }
22352  
22353 if (defined $flag) {
22354  
22355 if ($flag) {
22356 $self->ivPoke($iv, TRUE);
22357 } else {
22358 $self->ivPoke($iv, FALSE);
22359 }
22360  
22361 } elsif ($self->$iv) {
22362  
22363 $self->ivPoke($iv, FALSE);
22364  
22365 } else {
22366  
22367 $self->ivPoke($iv, TRUE);
22368 }
22369  
22370 # Inform every session that $self->useVisibleCursorFlag or ->useDirectKeysFlag have changed
22371 if ($type eq 'show_cursor') {
22372  
22373 foreach my $session ($self->listSessions()) {
22374  
22375 $session->textViewCursorUpdate();
22376 }
22377  
22378 } elsif ($type eq 'direct_keys') {
22379  
22380 foreach my $session ($self->listSessions()) {
22381  
22382 $session->textViewKeysUpdate();
22383 }
22384 }
22385  
22386 # The data stored in these IVs are saved in the 'config' file
22387 $self->setModifyFlag('config', TRUE, $self->_objClass . '->toggle_termSetting');
22388  
22389 return 1;
22390 }
22391  
22392 sub set_termTypeMode {
22393  
22394 my ($self, $mode, $check) = @_;
22395  
22396 # Check for improper arguments
22397 if (
22398 ! defined $mode
22399 || (
22400 $mode ne 'send_nothing' && $mode ne 'send_client' && $mode ne 'send_client_version'
22401 && $mode ne 'send_custom_client' && $mode ne 'send_default'
22402 && $mode ne 'send_unknown'
22403 )
22404 || defined $check
22405 ) {
22406 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_termTypeMode', @_);
22407 }
22408  
22409 # Update IVs
22410 $self->ivPoke('termTypeMode', $mode);
22411  
22412 # The data stored in this IV is saved in the 'config' file
22413 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_termTypeMode');
22414  
22415 return 1;
22416 }
22417  
22418 sub set_textEditCmd {
22419  
22420 my ($self, $cmd, $check) = @_;
22421  
22422 # Check for improper arguments
22423 if (! defined $cmd || defined $check) {
22424  
22425 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_textEditCmd', @_);
22426 }
22427  
22428 $self->ivPoke('textEditCmd', $cmd);
22429  
22430 # The data stored in this IV is saved in the 'config' file
22431 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_textEditCmd');
22432  
22433 return 1;
22434 }
22435  
22436 sub set_toolbarLabelFlag {
22437  
22438 my ($self, $flag, $check) = @_;
22439  
22440 # Check for improper arguments
22441 if (! defined $flag || defined $check) {
22442  
22443 return $axmud::CLIENT->writeImproper(
22444 $self->_objClass . '->set_toolbarLabelFlag',
22445 @_,
22446 );
22447 }
22448  
22449 if ($flag) {
22450 $self->ivPoke('toolbarLabelFlag', TRUE);
22451 } else {
22452 $self->ivPoke('toolbarLabelFlag', FALSE);
22453 }
22454  
22455 # The data stored in this IV is saved in the 'config' file
22456 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_toolbarLabelFlag');
22457  
22458 return 1;
22459 }
22460  
22461 sub set_toolbarHash {
22462  
22463 my ($self, %hash) = @_;
22464  
22465 # (No improper arguments to check - %hash can be empty)
22466  
22467 $self->ivPoke('toolbarHash', %hash);
22468  
22469 # The data stored in this IV is saved in the 'toolbar' file
22470 $self->setModifyFlag('toolbar', TRUE, $self->_objClass . '->set_toolbarHash');
22471  
22472 return 1;
22473 }
22474  
22475 sub set_toolbarList {
22476  
22477 my ($self, @list) = @_;
22478  
22479 # (No improper arguments to check - @list can be empty)
22480  
22481 $self->ivPoke('toolbarList', @list);
22482  
22483 # The data stored in this IV is saved in the 'toolbar' file
22484 $self->setModifyFlag('toolbar', TRUE, $self->_objClass . '->set_toolbarList');
22485  
22486 return 1;
22487 }
22488  
22489 sub add_ttsObj {
22490  
22491 my ($self, $obj, $check) = @_;
22492  
22493 # Check for improper arguments
22494 if (! defined $obj || defined $check) {
22495  
22496 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_ttsObj', @_);
22497 }
22498  
22499 $self->ivAdd('ttsObjHash', $obj->name, $obj);
22500  
22501 # The data stored in this IV is saved in the 'tts' file
22502 $self->setModifyFlag('tts', TRUE, $self->_objClass . '->add_ttsObj');
22503  
22504 return 1;
22505 }
22506  
22507 sub del_ttsObj {
22508  
22509 my ($self, $obj, $check) = @_;
22510  
22511 # Check for improper arguments
22512 if (! defined $obj || defined $check) {
22513  
22514 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_ttsObj', @_);
22515 }
22516  
22517 # Cannot delete certain standard objects
22518 if ($self->ivExists('constTtsPermObjHash', $obj->name)) {
22519  
22520 return undef;
22521  
22522 } else {
22523  
22524 $self->ivDelete('ttsObjHash', $obj->name);
22525 }
22526  
22527 # The data stored in this IV is saved in the 'tts' file
22528 $self->setModifyFlag('tts', TRUE, $self->_objClass . '->del_ttsObj');
22529  
22530 return 1;
22531 }
22532  
22533 sub set_ttsFestivalServerPort {
22534  
22535 my ($self, $newPort, $check) = @_;
22536  
22537 # Local variables
22538 my $oldPort;
22539  
22540 # Check for improper arguments
22541 if (
22542 defined $check
22543 || (defined $newPort && $newPort ne '' && ($newPort < 0 || $newPort > 65535))
22544 ) {
22545 return $axmud::CLIENT->writeImproper(
22546 $self->_objClass . '->set_ttsFestivalServerPort',
22547 @_,
22548 );
22549 }
22550  
22551 $oldPort = $self->ttsFestivalServerPort;
22552 $self->ivPoke('ttsFestivalServerPort', $newPort); # May be 'undef' or an empty string
22553  
22554 # Update connected IVs
22555 if (
22556 ((defined $oldPort && $oldPort ne '') && (! defined $newPort || $newPort eq ''))
22557 || ((defined $newPort && $newPort ne '') && (! defined $oldPort || $oldPort eq ''))
22558 || (defined $oldPort && defined $newPort && $oldPort ne $newPort)
22559 ) {
22560 # After changing port, we are allowed to attempt to start the server again
22561 $self->ivPoke('ttsFestivalFailFlag', FALSE);
22562  
22563 # If connected to the server, disconnect
22564 if (
22565 $self->ttsFestivalServerMode eq 'server'
22566 && $self->ttsFestivalConnectMode eq 'connected'
22567 ) {
22568 $self->ivPush('ttsFestivalRequestList', 'disconnect');
22569 }
22570  
22571 # If a port is specified, attempt to connect the server, starting it first, if
22572 # necessary
22573 if (defined $newPort && $newPort ne '') {
22574  
22575 if (! $self->ttsFestivalSuccessFlag) {
22576 $self->ivPush('ttsFestivalRequestList', 'start');
22577 } else {
22578 $self->ivPush('ttsFestivalRequestList', 'connect');
22579 }
22580 }
22581 }
22582  
22583 # The data stored in this IV is saved in the 'config' file
22584 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_ttsFestivalServerPort');
22585  
22586 return 1;
22587 }
22588  
22589 sub set_ttsFlag {
22590  
22591 my ($self, $type, $flag, $check) = @_;
22592  
22593 # Local variables
22594 my $iv;
22595  
22596 # Check for improper arguments
22597 if (
22598 ! defined $flag
22599 || (
22600 $type ne 'receive' && $type ne 'login' && $type ne 'prompt' && $type ne 'system'
22601 && $type ne 'error' && $type ne 'command' && $type ne 'cmd' && $type ne 'dialogue'
22602 && $type ne 'task' && $type ne 'smooth'
22603 ) || defined $check
22604 ) {
22605  
22606 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_ttsFlag', @_);
22607 }
22608  
22609 if ($type eq 'receive') {
22610 $iv = 'ttsReceiveFlag';
22611 } elsif ($type eq 'login') {
22612 $iv = 'ttsLoginFlag';
22613 } elsif ($type eq 'prompt') {
22614 $iv = 'ttsPromptFlag';
22615 } elsif ($type eq 'system') {
22616 $iv = 'ttsSystemFlag';
22617 } elsif ($type eq 'error') {
22618 $iv = 'ttsSystemErrorFlag';
22619 } elsif ($type eq 'command' || $type eq 'cmd') {
22620 $iv = 'ttsWorldCmdFlag';
22621 } elsif ($type eq 'dialogue') {
22622 $iv = 'ttsDialogueFlag';
22623 } elsif ($type eq 'task') {
22624 $iv = 'ttsTaskFlag';
22625 } elsif ($type eq 'smooth') {
22626 $iv = 'ttsSmoothFlag';
22627 }
22628  
22629 if ($flag) {
22630 $self->ivPoke($iv, TRUE);
22631 } else {
22632 $self->ivPoke($iv, FALSE);
22633 }
22634  
22635 # The data stored in this IV is saved in the 'config' file
22636 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_ttsFlag');
22637  
22638 return 1;
22639 }
22640  
22641 sub set_ttsHijackFlag {
22642  
22643 my ($self, $flag, $check) = @_;
22644  
22645 # Check for improper arguments
22646 if (! defined $flag || defined $check) {
22647  
22648 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_ttsHijackFlag', @_);
22649 }
22650  
22651 if ($flag) {
22652 $self->ivPoke('ttsHijackFlag', TRUE);
22653 } else {
22654 $self->ivPoke('ttsHijackFlag', FALSE);
22655 }
22656  
22657 # The data stored in this IV is saved in the 'config' file
22658 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_tts_hijack_flag');
22659  
22660 return 1;
22661 }
22662  
22663 sub set_ttsJobMode {
22664  
22665 my ($self, $mode, $check) = @_;
22666  
22667 # Check for improper arguments
22668 if (
22669 ! defined $mode || ($mode ne 'default' && $mode ne 'sentence' && $mode ne 'word')
22670 || defined $check
22671 ) {
22672 return $axmud::CLIENT->writeImproper(
22673 $self->_objClass . '->set_ttsJobMode',
22674 @_,
22675 );
22676 }
22677  
22678 $self->ivPoke('ttsJobMode', $mode);
22679 if ($mode ne 'default') {
22680  
22681 $self->ivPoke('ttsChangeModeFlag', TRUE);
22682 }
22683  
22684 # Interrupt any text being read aloud now
22685 if ($self->ttsCurrentHarness) {
22686  
22687 $axmud::CLIENT->ttsInterruptJob();
22688 }
22689  
22690 return 1;
22691 }
22692  
22693 sub add_userCmd {
22694  
22695 my ($self, $userCmd, $standardCmd, $check) = @_;
22696  
22697 # Check for improper arguments
22698 if (! defined $userCmd || ! defined $standardCmd || defined $check) {
22699  
22700 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_userCmd', @_);
22701 }
22702  
22703 $self->ivAdd('userCmdHash', $userCmd, $standardCmd);
22704  
22705 # The data stored in these IVs is saved in the 'usercmds' file
22706 $self->setModifyFlag('usercmds', TRUE, $self->_objClass . '->add_userCmd');
22707  
22708 return 1;
22709 }
22710  
22711 sub del_userCmd {
22712  
22713 my ($self, $userCmd, $check) = @_;
22714  
22715 # Check for improper arguments
22716 if (! defined $userCmd || defined $check) {
22717  
22718 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_userCmd', @_);
22719 }
22720  
22721 $self->ivDelete('userCmdHash', $userCmd);
22722  
22723 # The data stored in these IVs is saved in the 'usercmds' file
22724 $self->setModifyFlag('usercmds', TRUE, $self->_objClass . '->del_userCmd');
22725  
22726 return 1;
22727 }
22728  
22729 sub reset_userCmd {
22730  
22731 my ($self, $check) = @_;
22732  
22733 # Check for improper arguments
22734 if (defined $check) {
22735  
22736 return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_userCmd', @_);
22737 }
22738  
22739 $self->ivPoke('userCmdHash', $self->constUserCmdHash);
22740  
22741 # The data stored in these IVs is saved in the 'usercmds' file
22742 $self->setModifyFlag('usercmds', TRUE, $self->_objClass . '->reset_userCmd');
22743  
22744 return 1;
22745 }
22746  
22747 sub del_winObj {
22748  
22749 # Called by GA::Win::Generic->winDestroy
22750  
22751 my ($self, $winObj, $check) = @_;
22752  
22753 # Local variables
22754 my $stripObj;
22755  
22756 # Check for improper arguments
22757 if (! defined $winObj || defined $check) {
22758  
22759 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_winObj', @_);
22760 }
22761  
22762 # For pseudo-windows, if the parent table object is still open, close it
22763 if ($winObj->pseudoWinTableObj) {
22764  
22765 $stripObj = $winObj->pseudoWinTableObj->stripObj;
22766 if ($stripObj->ivExists('tableObjHash', $winObj->pseudoWinTableObj->number)) {
22767  
22768 $stripObj->removeTableObj($winObj->pseudoWinTableObj);
22769 }
22770 }
22771  
22772 return 1;
22773 }
22774  
22775 sub add_worldProf {
22776  
22777 my ($self, $obj, $check) = @_;
22778  
22779 # Check for improper arguments
22780 if (! defined $obj || defined $check) {
22781  
22782 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_worldProf', @_);
22783 }
22784  
22785 $self->ivAdd('worldProfHash', $obj->name, $obj);
22786  
22787 # The data stored in this IV is saved in the 'config' and 'worldprof' files
22788 $self->setModifyFlag('config', TRUE, $self->_objClass . '->add_worldProf');
22789 $self->setModifyFlag($obj->name, TRUE, $self->_objClass . '->add_worldProf');
22790  
22791 return 1;
22792 }
22793  
22794 sub del_worldProf {
22795  
22796 my ($self, $obj, $check) = @_;
22797  
22798 # Check for improper arguments
22799 if (! defined $obj || defined $check) {
22800  
22801 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_worldProf', @_);
22802 }
22803  
22804 $self->ivDelete('worldProfHash', $obj->name);
22805  
22806 # The data stored in this IV is saved in the 'config' and 'worldprof' files
22807 $self->setModifyFlag('config', TRUE, $self->_objClass . '->del_worldProf');
22808 $self->setModifyFlag($obj->name, TRUE, $self->_objClass . '->del_worldProf');
22809  
22810 return 1;
22811 }
22812  
22813 sub add_winmap {
22814  
22815 my ($self, $obj, $check) = @_;
22816  
22817 # Check for improper arguments
22818 if (! defined $obj || defined $check) {
22819  
22820 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_winmap', @_);
22821 }
22822  
22823 # Update IVs
22824 $self->ivAdd('winmapHash', $obj->name, $obj);
22825  
22826 # The data stored in this IV is saved in the 'winmaps' file
22827 $self->setModifyFlag('winmaps', TRUE, $self->_objClass . '->add_winmap');
22828  
22829 return 1;
22830 }
22831  
22832 sub del_winmap {
22833  
22834 my ($self, $winmapName, $check) = @_;
22835  
22836 # Check for improper arguments
22837 if (! defined $winmapName || defined $check) {
22838  
22839 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_winmap', @_);
22840 }
22841  
22842 # Update IVs
22843 $self->ivDelete('winmapHash', $winmapName);
22844  
22845 # The data stored in this IV is saved in the 'winmaps' file
22846 $self->setModifyFlag('winmaps', TRUE, $self->_objClass . '->del_winmap');
22847  
22848 return 1;
22849 }
22850  
22851 sub add_zmpPackage {
22852  
22853 my ($self, $obj, $check) = @_;
22854  
22855 # Check for improper arguments
22856 if (! defined $obj || defined $check) {
22857  
22858 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_zmpPackage', @_);
22859 }
22860  
22861 # Can't replace an existing package object using one with the same name
22862 if ($self->ivExists('zmpPackageHash', $obj->name)) {
22863  
22864 return undef;
22865  
22866 } else {
22867  
22868 $self->ivAdd('zmpPackageHash', $obj->name, $obj);
22869  
22870 return $obj;
22871 }
22872 }
22873  
22874 sub add_zonemap {
22875  
22876 my ($self, $obj, $check) = @_;
22877  
22878 # Check for improper arguments
22879 if (! defined $obj || defined $check) {
22880  
22881 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_zonemap', @_);
22882 }
22883  
22884 # Update IVs
22885 $self->ivAdd('zonemapHash', $obj->name, $obj);
22886  
22887 # The data stored in this IV is saved in the 'zonemaps' file
22888 $self->setModifyFlag('zonemaps', TRUE, $self->_objClass . '->add_zonemap');
22889  
22890 return 1;
22891 }
22892  
22893 sub del_zonemap {
22894  
22895 # Called by GA::Cmd::DeleteZonemap->do and, for temporary zonemaps, GA::Session->stop
22896 # (only; if a zonemap in use by a workspace grid is deleted, bad things can happen)
22897  
22898 my ($self, $zonemapName, $check) = @_;
22899  
22900 # Check for improper arguments
22901 if (! defined $zonemapName || defined $check) {
22902  
22903 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_zonemap', @_);
22904 }
22905  
22906 # Update IVs
22907 $self->ivDelete('zonemapHash', $zonemapName);
22908  
22909 # The data stored in this IV is saved in the 'zonemaps' file
22910 $self->setModifyFlag('zonemaps', TRUE, $self->_objClass . '->del_zonemap');
22911  
22912 return 1;
22913 }
22914  
22915 ##################
22916 # Accessors - get
22917  
22918 sub desktopObj
22919 { $_[0]->{desktopObj} }
22920  
22921 sub mainWin
22922 { $_[0]->{mainWin} }
22923  
22924 sub aboutWin
22925 { $_[0]->{aboutWin} }
22926 sub busyWin
22927 { $_[0]->{busyWin} }
22928 sub connectWin
22929 { $_[0]->{connectWin} }
22930 sub consoleWin
22931 { $_[0]->{consoleWin} }
22932  
22933 sub constIVHash
22934 { my $self = shift; return %{$self->{constIVHash}}; }
22935 sub constReservedHash
22936 { my $self = shift; return %{$self->{constReservedHash}}; }
22937  
22938 sub loadConfigFlag
22939 { $_[0]->{loadConfigFlag} }
22940 sub saveConfigFlag
22941 { $_[0]->{saveConfigFlag} }
22942 sub loadDataFlag
22943 { $_[0]->{loadDataFlag} }
22944 sub saveDataFlag
22945 { $_[0]->{saveDataFlag} }
22946 sub deleteFilesAtStartFlag
22947 { $_[0]->{deleteFilesAtStartFlag} }
22948 sub fileFailFlag
22949 { $_[0]->{fileFailFlag} }
22950  
22951 sub emergencySaveFlag
22952 { $_[0]->{emergencySaveFlag} }
22953  
22954 sub autoSaveFlag
22955 { $_[0]->{autoSaveFlag} }
22956 sub autoSaveWaitTime
22957 { $_[0]->{autoSaveWaitTime} }
22958 sub autoRetainFileFlag
22959 { $_[0]->{autoRetainFileFlag} }
22960  
22961 sub autoBackupMode
22962 { $_[0]->{autoBackupMode} }
22963 sub autoBackupDir
22964 { $_[0]->{autoBackupDir} }
22965 sub autoBackupInterval
22966 { $_[0]->{autoBackupInterval} }
22967 sub autoBackupDate
22968 { $_[0]->{autoBackupDate} }
22969 sub autoBackupFileType
22970 { $_[0]->{autoBackupFileType} }
22971 sub autoBackupAppendFlag
22972 { $_[0]->{autoBackupAppendFlag} }
22973  
22974 sub fileObjHash
22975 { my $self = shift; return %{$self->{fileObjHash}}; }
22976 sub configFileObj
22977 { $_[0]->{configFileObj} }
22978 sub configWorldProfList
22979 { my $self = shift; return @{$self->{configWorldProfList}}; }
22980  
22981 sub constLargeFileSize
22982 { $_[0]->{constLargeFileSize} }
22983  
22984 sub allowModelSplitFlag
22985 { $_[0]->{allowModelSplitFlag} }
22986 sub constModelSplitSize
22987 { $_[0]->{constModelSplitSize} }
22988 sub modelSplitSize
22989 { $_[0]->{modelSplitSize} }
22990  
22991 sub initPluginList
22992 { my $self = shift; return @{$self->{initPluginList}}; }
22993 sub pluginHash
22994 { my $self = shift; return %{$self->{pluginHash}}; }
22995 sub pluginCmdHash
22996 { my $self = shift; return %{$self->{pluginCmdHash}}; }
22997 sub pluginTaskHash
22998 { my $self = shift; return %{$self->{pluginTaskHash}}; }
22999 sub pluginGridWinHash
23000 { my $self = shift; return %{$self->{pluginGridWinHash}}; }
23001 sub pluginFreeWinHash
23002 { my $self = shift; return %{$self->{pluginFreeWinHash}}; }
23003 sub pluginStripObjHash
23004 { my $self = shift; return %{$self->{pluginStripObjHash}}; }
23005 sub pluginTableObjHash
23006 { my $self = shift; return %{$self->{pluginTableObjHash}}; }
23007 sub pluginCageHash
23008 { my $self = shift; return %{$self->{pluginCageHash}}; }
23009 sub pluginCagePackageHash
23010 { my $self = shift; return %{$self->{pluginCagePackageHash}}; }
23011 sub pluginCageEditWinHash
23012 { my $self = shift; return %{$self->{pluginCageEditWinHash}}; }
23013 sub pluginMenuFuncHash
23014 { my $self = shift; return %{$self->{pluginMenuFuncHash}}; }
23015 sub pluginMxpFilterHash
23016 { my $self = shift; return %{$self->{pluginMxpFilterHash}}; }
23017  
23018 sub clientTime
23019 { $_[0]->{clientTime} }
23020 sub suspendSessionLoopFlag
23021 { $_[0]->{suspendSessionLoopFlag} }
23022  
23023 sub clientLoopObj
23024 { $_[0]->{clientLoopObj} }
23025 sub clientLoopSpinFlag
23026 { $_[0]->{clientLoopSpinFlag} }
23027 sub clientLoopDelay
23028 { $_[0]->{clientLoopDelay} }
23029  
23030 sub showModFlag
23031 { $_[0]->{showModFlag} }
23032  
23033 sub blinkerDelay
23034 { $_[0]->{blinkerDelay} }
23035  
23036 sub blinkSlowTime
23037 { $_[0]->{blinkSlowTime} }
23038 sub blinkSlowCheckTime
23039 { $_[0]->{blinkSlowCheckTime} }
23040 sub blinkSlowFlag
23041 { $_[0]->{blinkSlowFlag} }
23042 sub blinkFastTime
23043 { $_[0]->{blinkFastTime} }
23044 sub blinkFastCheckTime
23045 { $_[0]->{blinkFastCheckTime} }
23046 sub blinkFastFlag
23047 { $_[0]->{blinkFastFlag} }
23048  
23049 sub paneDelay
23050 { $_[0]->{paneDelay} }
23051 sub paneRestoreHash
23052 { my $self = shift; return %{$self->{paneRestoreHash}}; }
23053  
23054 sub systemMsgList
23055 { my $self = shift; return @{$self->{systemMsgList}}; }
23056  
23057 sub sessionHash
23058 { my $self = shift; return %{$self->{sessionHash}}; }
23059 sub sessionCount
23060 { $_[0]->{sessionCount} }
23061 sub constSessionMax
23062 { $_[0]->{constSessionMax} }
23063 sub sessionMax
23064 { $_[0]->{sessionMax} }
23065 sub currentSession
23066 { $_[0]->{currentSession} }
23067 sub shutdownFlag
23068 { $_[0]->{shutdownFlag} }
23069 sub terminatingFlag
23070 { $_[0]->{terminatingFlag} }
23071 sub offlineOnDisconnectFlag
23072 { $_[0]->{offlineOnDisconnectFlag} }
23073  
23074 sub sessionTabMode
23075 { $_[0]->{sessionTabMode} }
23076 sub xTermTitleFlag
23077 { $_[0]->{xTermTitleFlag} }
23078 sub longTabLabelFlag
23079 { $_[0]->{longTabLabelFlag} }
23080 sub simpleTabFlag
23081 { $_[0]->{simpleTabFlag} }
23082 sub confirmCloseMainWinFlag
23083 { $_[0]->{confirmCloseMainWinFlag} }
23084 sub confirmCloseTabFlag
23085 { $_[0]->{confirmCloseTabFlag} }
23086 sub confirmCloseMenuFlag
23087 { $_[0]->{confirmCloseMenuFlag} }
23088 sub confirmCloseToolButtonFlag
23089 { $_[0]->{confirmCloseToolButtonFlag} }
23090  
23091 sub constCharSet
23092 { $_[0]->{constCharSet} }
23093 sub charSet
23094 { $_[0]->{charSet} }
23095 sub charSetList
23096 { my $self = shift; return @{$self->{charSetList}}; }
23097  
23098 sub connectHistoryFlag
23099 { $_[0]->{connectHistoryFlag} }
23100  
23101 sub clientCmdHash
23102 { my $self = shift; return %{$self->{clientCmdHash}}; }
23103 sub replaceClientCmdHash
23104 { my $self = shift; return %{$self->{replaceClientCmdHash}}; }
23105 sub constClientCmdPrettyList
23106 { my $self = shift; return @{$self->{constClientCmdPrettyList}}; }
23107 sub clientCmdPrettyList
23108 { my $self = shift; return @{$self->{clientCmdPrettyList}}; }
23109 sub clientCmdList
23110 { my $self = shift; return @{$self->{clientCmdList}}; }
23111 sub clientCmdReplacePrettyHash
23112 { my $self = shift; return %{$self->{clientCmdReplacePrettyHash}}; }
23113  
23114 sub constUserCmdHash
23115 { my $self = shift; return %{$self->{constUserCmdHash}}; }
23116 sub userCmdHash
23117 { my $self = shift; return %{$self->{userCmdHash}}; }
23118  
23119 sub constClientSigil
23120 { $_[0]->{constClientSigil} }
23121 sub constForcedSigil
23122 { $_[0]->{constForcedSigil} }
23123 sub constEchoSigil
23124 { $_[0]->{constEchoSigil} }
23125 sub constPerlSigil
23126 { $_[0]->{constPerlSigil} }
23127 sub constScriptSigil
23128 { $_[0]->{constScriptSigil} }
23129 sub constMultiSigil
23130 { $_[0]->{constMultiSigil} }
23131 sub constSpeedSigil
23132 { $_[0]->{constSpeedSigil} }
23133 sub constBypassSigil
23134 { $_[0]->{constBypassSigil} }
23135  
23136 sub echoSigilFlag
23137 { $_[0]->{echoSigilFlag} }
23138 sub perlSigilFlag
23139 { $_[0]->{perlSigilFlag} }
23140 sub scriptSigilFlag
23141 { $_[0]->{scriptSigilFlag} }
23142 sub multiSigilFlag
23143 { $_[0]->{multiSigilFlag} }
23144 sub speedSigilFlag
23145 { $_[0]->{speedSigilFlag} }
23146 sub bypassSigilFlag
23147 { $_[0]->{bypassSigilFlag} }
23148  
23149 sub constCmdSep
23150 { $_[0]->{constCmdSep} }
23151 sub cmdSep
23152 { $_[0]->{cmdSep} }
23153  
23154 sub constDisplayBufferSize
23155 { $_[0]->{constDisplayBufferSize} }
23156 sub constInstructBufferSize
23157 { $_[0]->{constInstructBufferSize} }
23158 sub constCmdBufferSize
23159 { $_[0]->{constCmdBufferSize} }
23160 sub constMinBufferSize
23161 { $_[0]->{constMinBufferSize} }
23162 sub constMaxBufferSize
23163 { $_[0]->{constMaxBufferSize} }
23164 sub customDisplayBufferSize
23165 { $_[0]->{customDisplayBufferSize} }
23166 sub customInstructBufferSize
23167 { $_[0]->{customInstructBufferSize} }
23168 sub customCmdBufferSize
23169 { $_[0]->{customCmdBufferSize} }
23170  
23171 sub confirmWorldCmdFlag
23172 { $_[0]->{confirmWorldCmdFlag} }
23173 sub convertWorldCmdFlag
23174 { $_[0]->{convertWorldCmdFlag} }
23175 sub preserveWorldCmdFlag
23176 { $_[0]->{preserveWorldCmdFlag} }
23177 sub preserveOtherCmdFlag
23178 { $_[0]->{preserveOtherCmdFlag} }
23179 sub maxMultiCmdFlag
23180 { $_[0]->{maxMultiCmdFlag} }
23181  
23182 sub autoCompleteMode
23183 { $_[0]->{autoCompleteMode} }
23184 sub autoCompleteType
23185 { $_[0]->{autoCompleteType} }
23186 sub autoCompleteParent
23187 { $_[0]->{autoCompleteParent} }
23188  
23189 sub useScrollKeysFlag
23190 { $_[0]->{useScrollKeysFlag} }
23191 sub smoothScrollKeysFlag
23192 { $_[0]->{smoothScrollKeysFlag} }
23193 sub autoSplitKeysFlag
23194 { $_[0]->{autoSplitKeysFlag} }
23195 sub useCompleteKeysFlag
23196 { $_[0]->{useCompleteKeysFlag} }
23197 sub useSwitchKeysFlag
23198 { $_[0]->{useSwitchKeysFlag} }
23199  
23200 sub instructBufferHash
23201 { my $self = shift; return %{$self->{instructBufferHash}}; }
23202 sub instructBufferCount
23203 { $_[0]->{instructBufferCount} }
23204 sub instructBufferFirst
23205 { $_[0]->{instructBufferFirst} }
23206 sub instructBufferLast
23207 { $_[0]->{instructBufferLast} }
23208 sub instructBufferPosn
23209 { $_[0]->{instructBufferPosn} }
23210  
23211 sub cmdBufferHash
23212 { my $self = shift; return %{$self->{cmdBufferHash}}; }
23213 sub cmdBufferCount
23214 { $_[0]->{cmdBufferCount} }
23215 sub cmdBufferFirst
23216 { $_[0]->{cmdBufferFirst} }
23217 sub cmdBufferLast
23218 { $_[0]->{cmdBufferLast} }
23219 sub cmdBufferPosn
23220 { $_[0]->{cmdBufferPosn} }
23221  
23222 sub constProfPriorityList
23223 { my $self = shift; return @{$self->{constProfPriorityList}}; }
23224 sub constProfStandardHash
23225 { my $self = shift; return %{$self->{constProfStandardHash}}; }
23226  
23227 sub worldProfHash
23228 { my $self = shift; return %{$self->{worldProfHash}}; }
23229  
23230 sub constWorldHash
23231 { my $self = shift; return %{$self->{constWorldHash}}; }
23232 sub constWorldPatchHash
23233 { my $self = shift; return %{$self->{constWorldPatchHash}}; }
23234 sub constWorldList
23235 { my $self = shift; return @{$self->{constWorldList}}; }
23236 sub prevClientVersion
23237 { $_[0]->{prevClientVersion} }
23238 sub favouriteWorldList
23239 { my $self = shift; return @{$self->{favouriteWorldList}}; }
23240 sub autoConnectList
23241 { my $self = shift; return @{$self->{autoConnectList}}; }
23242 sub constBasicWorldHash
23243 { my $self = shift; return %{$self->{constBasicWorldHash}}; }
23244  
23245 sub constRoomFilterList
23246 { my $self = shift; return @{$self->{constRoomFilterList}}; }
23247 sub constRoomFilterKeyList
23248 { my $self = shift; return @{$self->{constRoomFilterKeyList}}; }
23249 sub constRoomFlagList
23250 { my $self = shift; return @{$self->{constRoomFlagList}}; }
23251 sub constRoomHazardHash
23252 { my $self = shift; return %{$self->{constRoomHazardHash}}; }
23253 sub constRoomNoObscuredHash
23254 { my $self = shift; return %{$self->{constRoomNoObscuredHash}}; }
23255  
23256 sub constModelTypeHash
23257 { my $self = shift; return %{$self->{constModelTypeHash}}; }
23258 sub constPrimaryDirList
23259 { my $self = shift; return @{$self->{constPrimaryDirList}}; }
23260 sub constShortPrimaryDirList
23261 { my $self = shift; return @{$self->{constShortPrimaryDirList}}; }
23262 sub constShortPrimaryDirHash
23263 { my $self = shift; return %{$self->{constShortPrimaryDirHash}}; }
23264 sub constOppDirHash
23265 { my $self = shift; return %{$self->{constOppDirHash}}; }
23266 sub constComponentTypeList
23267 { my $self = shift; return @{$self->{constComponentTypeList}}; }
23268 sub constExitStateHash
23269 { my $self = shift; return %{$self->{constExitStateHash}}; }
23270 sub constParseObjMax
23271 { $_[0]->{constParseObjMax} }
23272  
23273 sub constCageTypeList
23274 { my $self = shift; return @{$self->{constCageTypeList}}; }
23275 sub cageTypeList
23276 { my $self = shift; return @{$self->{cageTypeList}}; }
23277  
23278 sub dictHash
23279 { my $self = shift; return %{$self->{dictHash}}; }
23280 sub phrasebookHash
23281 { my $self = shift; return %{$self->{phrasebookHash}}; }
23282  
23283 sub interfaceModelHash
23284 { my $self = shift; return %{$self->{interfaceModelHash}}; }
23285  
23286 sub constKeycodeHash
23287 { my $self = shift; return %{$self->{constKeycodeHash}}; }
23288 sub constMSWinKeycodeHash
23289 { my $self = shift; return %{$self->{constMSWinKeycodeHash}}; }
23290 sub constBSDKeycodeHash
23291 { my $self = shift; return %{$self->{constBSDKeycodeHash}}; }
23292 sub keycodeHash
23293 { my $self = shift; return %{$self->{keycodeHash}}; }
23294 sub revKeycodeHash
23295 { my $self = shift; return %{$self->{revKeycodeHash}}; }
23296 sub constAltKeycodeHash
23297 { my $self = shift; return %{$self->{constAltKeycodeHash}}; }
23298 sub constKeycodeList
23299 { my $self = shift; return @{$self->{constKeycodeList}}; }
23300 sub activeKeycodeHash
23301 { my $self = shift; return %{$self->{activeKeycodeHash}}; }
23302 sub resetKeycodesFlag
23303 { $_[0]->{resetKeycodesFlag} }
23304  
23305 sub constTaskPackageHash
23306 { my $self = shift; return %{$self->{constTaskPackageHash}}; }
23307 sub taskPackageHash
23308 { my $self = shift; return %{$self->{taskPackageHash}}; }
23309 sub constTaskLabelHash
23310 { my $self = shift; return %{$self->{constTaskLabelHash}}; }
23311 sub taskLabelHash
23312 { my $self = shift; return %{$self->{taskLabelHash}}; }
23313  
23314 sub constTaskRunFirstList
23315 { my $self = shift; return @{$self->{constTaskRunFirstList}}; }
23316 sub constTaskRunLastList
23317 { my $self = shift; return @{$self->{constTaskRunLastList}}; }
23318 sub taskRunFirstList
23319 { my $self = shift; return @{$self->{taskRunFirstList}}; }
23320 sub taskRunLastList
23321 { my $self = shift; return @{$self->{taskRunLastList}}; }
23322  
23323 sub taskTotal
23324 { $_[0]->{taskTotal} }
23325  
23326 sub initTaskHash
23327 { my $self = shift; return %{$self->{initTaskHash}}; }
23328 sub initTaskOrderList
23329 { my $self = shift; return @{$self->{initTaskOrderList}}; }
23330 sub initTaskTotal
23331 { $_[0]->{initTaskTotal} }
23332  
23333 sub customTaskHash
23334 { my $self = shift; return %{$self->{customTaskHash}}; }
23335  
23336 sub constTaskSettingsHash
23337 { my $self = shift; return %{$self->{constTaskSettingsHash}}; }
23338 sub constTaskStatusHash
23339 { my $self = shift; return %{$self->{constTaskStatusHash}}; }
23340  
23341 sub scriptDirList
23342 { my $self = shift; return @{$self->{scriptDirList}}; }
23343 sub initScriptHash
23344 { my $self = shift; return %{$self->{initScriptHash}}; }
23345 sub initScriptOrderList
23346 { my $self = shift; return @{$self->{initScriptOrderList}}; }
23347  
23348 sub constLogPrefHash
23349 { my $self = shift; return %{$self->{constLogPrefHash}}; }
23350 sub logPrefHash
23351 { my $self = shift; return %{$self->{logPrefHash}}; }
23352 sub constSessionLogPrefHash
23353 { my $self = shift; return %{$self->{constSessionLogPrefHash}}; }
23354 sub constSessionLogOrderList
23355 { my $self = shift; return @{$self->{constSessionLogOrderList}}; }
23356  
23357 sub constLogDescripHash
23358 { my $self = shift; return %{$self->{constLogDescripHash}}; }
23359 sub constLogOrderList
23360 { my $self = shift; return @{$self->{constLogOrderList}}; }
23361 sub constLogPathHash
23362 { my $self = shift; return %{$self->{constLogPathHash}}; }
23363 sub allowLogsFlag
23364 { $_[0]->{allowLogsFlag} }
23365 sub deleteStandardLogsFlag
23366 { $_[0]->{deleteStandardLogsFlag} }
23367 sub deleteWorldLogsFlag
23368 { $_[0]->{deleteWorldLogsFlag} }
23369  
23370 sub logDayFlag
23371 { $_[0]->{logDayFlag} }
23372 sub logClientFlag
23373 { $_[0]->{logClientFlag} }
23374 sub logPrefixDateFlag
23375 { $_[0]->{logPrefixDateFlag} }
23376 sub logPrefixTimeFlag
23377 { $_[0]->{logPrefixTimeFlag} }
23378 sub logImageFlag
23379 { $_[0]->{logImageFlag} }
23380 sub logPreambleList
23381 { my $self = shift; return @{$self->{logPreambleList}}; }
23382  
23383 sub statusEventBeforeCount
23384 { $_[0]->{statusEventBeforeCount} }
23385 sub statusEventAfterCount
23386 { $_[0]->{statusEventAfterCount} }
23387  
23388 sub chatName
23389 { $_[0]->{chatName} }
23390 sub chatEmail
23391 { $_[0]->{chatEmail} }
23392 sub constChatPort
23393 { $_[0]->{constChatPort} }
23394 sub chatAcceptMode
23395 { $_[0]->{chatAcceptMode} }
23396 sub chatContactHash
23397 { my $self = shift; return %{$self->{chatContactHash}}; }
23398  
23399 sub constChatIcon
23400 { $_[0]->{constChatIcon} }
23401 sub chatIcon
23402 { $_[0]->{chatIcon} }
23403  
23404 sub constChatContactIcon
23405 { $_[0]->{constChatContactIcon} }
23406 sub constChatSmileyHash
23407 { my $self = shift; return %{$self->{constChatSmileyHash}}; }
23408 sub chatSmileyHash
23409 { my $self = shift; return %{$self->{chatSmileyHash}}; }
23410  
23411 sub constColourTagList
23412 { my $self = shift; return @{$self->{constColourTagList}}; }
23413 sub constBoldColourTagList
23414 { my $self = shift; return @{$self->{constBoldColourTagList}}; }
23415 sub constColourTagHash
23416 { my $self = shift; return %{$self->{constColourTagHash}}; }
23417 sub constBoldColourTagHash
23418 { my $self = shift; return %{$self->{constBoldColourTagHash}}; }
23419 sub colourTagHash
23420 { my $self = shift; return %{$self->{colourTagHash}}; }
23421 sub boldColourTagHash
23422 { my $self = shift; return %{$self->{boldColourTagHash}}; }
23423 sub constMonochromeHash
23424 { my $self = shift; return %{$self->{constMonochromeHash}}; }
23425  
23426 sub constRainbowColourList
23427 { my $self = shift; return @{$self->{constRainbowColourList}}; }
23428 sub constHtmlColourHash
23429 { my $self = shift; return %{$self->{constHtmlColourHash}}; }
23430 sub constHtmlContrastHash
23431 { my $self = shift; return %{$self->{constHtmlContrastHash}}; }
23432  
23433 sub constXTermColourHash
23434 { my $self = shift; return %{$self->{constXTermColourHash}}; }
23435 sub constNetscapeColourHash
23436 { my $self = shift; return %{$self->{constNetscapeColourHash}}; }
23437 sub currentColourCube
23438 { $_[0]->{currentColourCube} }
23439 sub xTermColourHash
23440 { my $self = shift; return %{$self->{xTermColourHash}}; }
23441  
23442 sub constOscPaletteHash
23443 { my $self = shift; return %{$self->{constOscPaletteHash}}; }
23444 sub oscPaletteFlag
23445 { $_[0]->{oscPaletteFlag} }
23446  
23447 sub constStyleTagList
23448 { my $self = shift; return @{$self->{constStyleTagList}}; }
23449 sub constDummyTagList
23450 { my $self = shift; return @{$self->{constDummyTagList}}; }
23451 sub constStyleTagHash
23452 { my $self = shift; return %{$self->{constStyleTagHash}}; }
23453 sub constJustifyTagHash
23454 { my $self = shift; return %{$self->{constJustifyTagHash}}; }
23455 sub constDummyTagHash
23456 { my $self = shift; return %{$self->{constDummyTagHash}}; }
23457  
23458 sub constANSIColourHash
23459 { my $self = shift; return %{$self->{constANSIColourHash}}; }
23460 sub constANSIStyleHash
23461 { my $self = shift; return %{$self->{constANSIStyleHash}}; }
23462 sub constColourStyleList
23463 { my $self = shift; return @{$self->{constColourStyleList}}; }
23464 sub constPrettyTagHash
23465 { my $self = shift; return %{$self->{constPrettyTagHash}}; }
23466 sub constColourStyleHash
23467 { my $self = shift; return %{$self->{constColourStyleHash}}; }
23468  
23469 sub constTelnetHash
23470 { my $self = shift; return %{$self->{constTelnetHash}}; }
23471 sub constTeloptHash
23472 { my $self = shift; return %{$self->{constTeloptHash}}; }
23473  
23474 sub constHeadingSizeHash
23475 { my $self = shift; return %{$self->{constHeadingSizeHash}}; }
23476 sub constHeadingSpacingHash
23477 { my $self = shift; return %{$self->{constHeadingSpacingHash}}; }
23478  
23479 sub useEchoFlag
23480 { $_[0]->{useEchoFlag} }
23481 sub useSgaFlag
23482 { $_[0]->{useSgaFlag} }
23483 sub useTTypeFlag
23484 { $_[0]->{useTTypeFlag} }
23485 sub useEorFlag
23486 { $_[0]->{useEorFlag} }
23487 sub useNawsFlag
23488 { $_[0]->{useNawsFlag} }
23489 sub useNewEnvironFlag
23490 { $_[0]->{useNewEnvironFlag} }
23491 sub useCharSetFlag
23492 { $_[0]->{useCharSetFlag} }
23493  
23494 sub useMsdpFlag
23495 { $_[0]->{useMsdpFlag} }
23496 sub useMsspFlag
23497 { $_[0]->{useMsspFlag} }
23498 sub useMccpFlag
23499 { $_[0]->{useMccpFlag} }
23500 sub useMspFlag
23501 { $_[0]->{useMspFlag} }
23502 sub useMxpFlag
23503 { $_[0]->{useMxpFlag} }
23504 sub usePuebloFlag
23505 { $_[0]->{usePuebloFlag} }
23506 sub useZmpFlag
23507 { $_[0]->{useZmpFlag} }
23508 sub useAard102Flag
23509 { $_[0]->{useAard102Flag} }
23510 sub useAtcpFlag
23511 { $_[0]->{useAtcpFlag} }
23512 sub useGmcpFlag
23513 { $_[0]->{useGmcpFlag} }
23514 sub useMttsFlag
23515 { $_[0]->{useMttsFlag} }
23516 sub useMnesFlag
23517 { $_[0]->{useMnesFlag} }
23518 sub useMcpFlag
23519 { $_[0]->{useMcpFlag} }
23520  
23521 sub constMsspVarHash
23522 { my $self = shift; return %{$self->{constMsspVarHash}}; }
23523 sub constMsspVarList
23524 { my $self = shift; return @{$self->{constMsspVarList}}; }
23525  
23526 sub constMspVersion
23527 { $_[0]->{constMspVersion} }
23528 sub allowMspMultipleFlag
23529 { $_[0]->{allowMspMultipleFlag} }
23530 sub allowMspLoadSoundFlag
23531 { $_[0]->{allowMspLoadSoundFlag} }
23532 sub allowMspFlexibleFlag
23533 { $_[0]->{allowMspFlexibleFlag} }
23534  
23535 sub constMxpVersion
23536 { $_[0]->{constMxpVersion} }
23537 sub constMxpOfficialHash
23538 { my $self = shift; return %{$self->{constMxpOfficialHash}}; }
23539 sub constMxpAttribHash
23540 { my $self = shift; return %{$self->{constMxpAttribHash}}; }
23541 sub constMxpConvertHash
23542 { my $self = shift; return %{$self->{constMxpConvertHash}}; }
23543 sub constMxpLineSpacingHash
23544 { my $self = shift; return %{$self->{constMxpLineSpacingHash}}; }
23545 sub constMxpModalHash
23546 { my $self = shift; return %{$self->{constMxpModalHash}}; }
23547 sub constMxpStackConvertHash
23548 { my $self = shift; return %{$self->{constMxpStackConvertHash}}; }
23549 sub constMxpModalOnHash
23550 { my $self = shift; return %{$self->{constMxpModalOnHash}}; }
23551 sub constMxpFormatHash
23552 { my $self = shift; return %{$self->{constMxpFormatHash}}; }
23553 sub constMxpEntityHash
23554 { my $self = shift; return %{$self->{constMxpEntityHash}}; }
23555 sub allowMxpFontFlag
23556 { $_[0]->{allowMxpFontFlag} }
23557 sub allowMxpImageFlag
23558 { $_[0]->{allowMxpImageFlag} }
23559 sub allowMxpLoadImageFlag
23560 { $_[0]->{allowMxpLoadImageFlag} }
23561 sub allowMxpFilterImageFlag
23562 { $_[0]->{allowMxpFilterImageFlag} }
23563 sub allowMxpSoundFlag
23564 { $_[0]->{allowMxpSoundFlag} }
23565 sub allowMxpLoadSoundFlag
23566 { $_[0]->{allowMxpLoadSoundFlag} }
23567 sub allowMxpGaugeFlag
23568 { $_[0]->{allowMxpGaugeFlag} }
23569 sub allowMxpFrameFlag
23570 { $_[0]->{allowMxpFrameFlag} }
23571 sub allowMxpInteriorFlag
23572 { $_[0]->{allowMxpInteriorFlag} }
23573 sub allowMxpCrosslinkFlag
23574 { $_[0]->{allowMxpCrosslinkFlag} }
23575 sub allowMxpRoomFlag
23576 { $_[0]->{allowMxpRoomFlag} }
23577 sub allowMxpFlexibleFlag
23578 { $_[0]->{allowMxpFlexibleFlag} }
23579 sub allowMxpPermFlag
23580 { $_[0]->{allowMxpPermFlag} }
23581 sub mxpPreventSupportFlag
23582 { $_[0]->{mxpPreventSupportFlag} }
23583  
23584 sub constPuebloOfficialHash
23585 { my $self = shift; return %{$self->{constPuebloOfficialHash}}; }
23586 sub constPuebloImplementHash
23587 { my $self = shift; return %{$self->{constPuebloImplementHash}}; }
23588 sub constPuebloConvertHash
23589 { my $self = shift; return %{$self->{constPuebloConvertHash}}; }
23590 sub constPuebloModalHash
23591 { my $self = shift; return %{$self->{constPuebloModalHash}}; }
23592  
23593 sub zmpPackageHash
23594 { my $self = shift; return %{$self->{zmpPackageHash}}; }
23595  
23596 sub constMnesCharsetList
23597 { my $self = shift; return @{$self->{constMnesCharsetList}}; }
23598 sub allowMnesSendIPFlag
23599 { $_[0]->{allowMnesSendIPFlag} }
23600  
23601 sub constMcpPackageList
23602 { my $self = shift; return @{$self->{constMcpPackageList}}; }
23603 sub mcpPackageHash
23604 { my $self = shift; return %{$self->{mcpPackageHash}}; }
23605  
23606 sub constTermTypeList
23607 { my $self = shift; return @{$self->{constTermTypeList}}; }
23608 sub termTypeMode
23609 { $_[0]->{termTypeMode} }
23610 sub customClientName
23611 { $_[0]->{customClientName} }
23612 sub customClientVersion
23613 { $_[0]->{customClientVersion} }
23614  
23615 sub useCtrlSeqFlag
23616 { $_[0]->{useCtrlSeqFlag} }
23617 sub useVisibleCursorFlag
23618 { $_[0]->{useVisibleCursorFlag} }
23619 sub useFastCursorFlag
23620 { $_[0]->{useFastCursorFlag} }
23621 sub useDirectKeysFlag
23622 { $_[0]->{useDirectKeysFlag} }
23623 sub constDirectAppKeysHash
23624 { my $self = shift; return %{$self->{constDirectAppKeysHash}}; }
23625 sub constDirectAltKeysHash
23626 { my $self = shift; return %{$self->{constDirectAltKeysHash}}; }
23627 sub constDirectKeysHash
23628 { my $self = shift; return %{$self->{constDirectKeysHash}}; }
23629 sub constDirectSpecialKeysHash
23630 { my $self = shift; return %{$self->{constDirectSpecialKeysHash}}; }
23631  
23632 sub debugEscSequenceFlag
23633 { $_[0]->{debugEscSequenceFlag} }
23634 sub debugTelnetFlag
23635 { $_[0]->{debugTelnetFlag} }
23636 sub debugTelnetMiniFlag
23637 { $_[0]->{debugTelnetMiniFlag} }
23638 sub debugTelnetLogFlag
23639 { $_[0]->{debugTelnetLogFlag} }
23640 sub debugMsdpFlag
23641 { $_[0]->{debugMsdpFlag} }
23642 sub debugMxpFlag
23643 { $_[0]->{debugMxpFlag} }
23644 sub debugMxpCommentFlag
23645 { $_[0]->{debugMxpCommentFlag} }
23646 sub debugPuebloFlag
23647 { $_[0]->{debugPuebloFlag} }
23648 sub debugPuebloCommentFlag
23649 { $_[0]->{debugPuebloCommentFlag} }
23650 sub debugZmpFlag
23651 { $_[0]->{debugZmpFlag} }
23652 sub debugAtcpFlag
23653 { $_[0]->{debugAtcpFlag} }
23654 sub debugGmcpFlag
23655 { $_[0]->{debugGmcpFlag} }
23656 sub debugMcpFlag
23657 { $_[0]->{debugMcpFlag} }
23658  
23659 sub shareMainWinFlag
23660 { $_[0]->{shareMainWinFlag} }
23661 sub restartShareMainWinMode
23662 { $_[0]->{restartShareMainWinMode} }
23663 sub activateGridFlag
23664 { $_[0]->{activateGridFlag} }
23665 sub storeGridPosnFlag
23666 { $_[0]->{storeGridPosnFlag} }
23667 sub storeGridPosnHash
23668 { my $self = shift; return %{$self->{storeGridPosnHash}}; }
23669  
23670 sub constGridWinTypeHash
23671 { my $self = shift; return %{$self->{constGridWinTypeHash}}; }
23672 sub constFreeWinTypeHash
23673 { my $self = shift; return %{$self->{constFreeWinTypeHash}}; }
23674  
23675 sub constWinmapNameHash
23676 { my $self = shift; return %{$self->{constWinmapNameHash}}; }
23677 sub winmapHash
23678 { my $self = shift; return %{$self->{winmapHash}}; }
23679 sub standardWinmapHash
23680 { my $self = shift; return %{$self->{standardWinmapHash}}; }
23681 sub constDefaultEnabledWinmap
23682 { $_[0]->{constDefaultEnabledWinmap} }
23683 sub constDefaultDisabledWinmap
23684 { $_[0]->{constDefaultDisabledWinmap} }
23685 sub constDefaultInternalWinmap
23686 { $_[0]->{constDefaultInternalWinmap} }
23687 sub defaultEnabledWinmap
23688 { $_[0]->{defaultEnabledWinmap} }
23689 sub defaultDisabledWinmap
23690 { $_[0]->{defaultDisabledWinmap} }
23691 sub defaultInternalWinmap
23692 { $_[0]->{defaultInternalWinmap} }
23693  
23694 sub constGridBlockSize
23695 { $_[0]->{constGridBlockSize} }
23696 sub gridBlockSize
23697 { $_[0]->{gridBlockSize} }
23698  
23699 sub constZonemapHash
23700 { my $self = shift; return %{$self->{constZonemapHash}}; }
23701 sub zonemapHash
23702 { my $self = shift; return %{$self->{zonemapHash}}; }
23703 sub standardZonemapHash
23704 { my $self = shift; return %{$self->{standardZonemapHash}}; }
23705 sub constInitWorkspaceHash
23706 { my $self = shift; return %{$self->{constInitWorkspaceHash}}; }
23707 sub initWorkspaceHash
23708 { my $self = shift; return %{$self->{initWorkspaceHash}}; }
23709 sub constInitWorkspaceDir
23710 { $_[0]->{constInitWorkspaceDir} }
23711 sub initWorkspaceDir
23712 { $_[0]->{initWorkspaceDir} }
23713  
23714 sub constGridGapMaxSize
23715 { $_[0]->{constGridGapMaxSize} }
23716 sub gridGapMaxSize
23717 { $_[0]->{gridGapMaxSize} }
23718 sub gridAdjustmentFlag
23719 { $_[0]->{gridAdjustmentFlag} }
23720 sub gridEdgeCorrectionFlag
23721 { $_[0]->{gridEdgeCorrectionFlag} }
23722 sub gridReshuffleFlag
23723 { $_[0]->{gridReshuffleFlag} }
23724 sub gridInvisWinFlag
23725 { $_[0]->{gridInvisWinFlag} }
23726  
23727 sub constWorkspaceMaxWidth
23728 { $_[0]->{constWorkspaceMaxWidth} }
23729 sub constWorkspaceMaxHeight
23730 { $_[0]->{constWorkspaceMaxHeight} }
23731 sub constWorkspaceMinWidth
23732 { $_[0]->{constWorkspaceMinWidth} }
23733 sub constWorkspaceMinHeight
23734 { $_[0]->{constWorkspaceMinHeight} }
23735  
23736 sub constMainWinWidth
23737 { $_[0]->{constMainWinWidth} }
23738 sub constMainWinHeight
23739 { $_[0]->{constMainWinHeight} }
23740 sub customMainWinWidth
23741 { $_[0]->{customMainWinWidth} }
23742 sub customMainWinHeight
23743 { $_[0]->{customMainWinHeight} }
23744 sub constMainBorderPixels
23745 { $_[0]->{constMainBorderPixels} }
23746 sub constMainSpacingPixels
23747 { $_[0]->{constMainSpacingPixels} }
23748  
23749 sub constGridWinWidth
23750 { $_[0]->{constGridWinWidth} }
23751 sub constGridWinHeight
23752 { $_[0]->{constGridWinHeight} }
23753 sub customGridWinWidth
23754 { $_[0]->{customGridWinWidth} }
23755 sub customGridWinHeight
23756 { $_[0]->{customGridWinHeight} }
23757 sub constGridBorderPixels
23758 { $_[0]->{constGridBorderPixels} }
23759 sub constGridSpacingPixels
23760 { $_[0]->{constGridSpacingPixels} }
23761  
23762 sub constFreeWinWidth
23763 { $_[0]->{constFreeWinWidth} }
23764 sub constFreeWinHeight
23765 { $_[0]->{constFreeWinHeight} }
23766 sub customFreeWinWidth
23767 { $_[0]->{customFreeWinWidth} }
23768 sub customFreeWinHeight
23769 { $_[0]->{customFreeWinHeight} }
23770 sub constFreeBorderPixels
23771 { $_[0]->{constFreeBorderPixels} }
23772 sub constFreeSpacingPixels
23773 { $_[0]->{constFreeSpacingPixels} }
23774 sub constDialogueLabelSize
23775 { $_[0]->{constDialogueLabelSize} }
23776  
23777 sub constPanelSize
23778 { $_[0]->{constPanelSize} }
23779 sub constPanelLeftSize
23780 { $_[0]->{constPanelLeftSize} }
23781 sub constPanelRightSize
23782 { $_[0]->{constPanelRightSize} }
23783 sub constPanelTopSize
23784 { $_[0]->{constPanelTopSize} }
23785 sub constPanelBottomSize
23786 { $_[0]->{constPanelBottomSize} }
23787 sub customPanelLeftSize
23788 { $_[0]->{customPanelLeftSize} }
23789 sub customPanelRightSize
23790 { $_[0]->{customPanelRightSize} }
23791 sub customPanelTopSize
23792 { $_[0]->{customPanelTopSize} }
23793 sub customPanelBottomSize
23794 { $_[0]->{customPanelBottomSize} }
23795  
23796 sub constControlsSize
23797 { $_[0]->{constControlsSize} }
23798 sub constControlsLeftSize
23799 { $_[0]->{constControlsLeftSize} }
23800 sub constControlsRightSize
23801 { $_[0]->{constControlsRightSize} }
23802 sub constControlsTopSize
23803 { $_[0]->{constControlsTopSize} }
23804 sub constControlsBottomSize
23805 { $_[0]->{constControlsBottomSize} }
23806 sub customControlsLeftSize
23807 { $_[0]->{customControlsLeftSize} }
23808 sub customControlsRightSize
23809 { $_[0]->{customControlsRightSize} }
23810 sub customControlsTopSize
23811 { $_[0]->{customControlsTopSize} }
23812 sub customControlsBottomSize
23813 { $_[0]->{customControlsBottomSize} }
23814  
23815 sub constTextColour
23816 { $_[0]->{constTextColour} }
23817 sub constUnderlayColour
23818 { $_[0]->{constUnderlayColour} }
23819 sub constBackgroundColour
23820 { $_[0]->{constBackgroundColour} }
23821 sub constFont
23822 { $_[0]->{constFont} }
23823 sub constFontSize
23824 { $_[0]->{constFontSize} }
23825 sub constPuebloLinkColour
23826 { $_[0]->{constPuebloLinkColour} }
23827 sub colourSchemeHash
23828 { my $self = shift; return %{$self->{colourSchemeHash}}; }
23829  
23830 sub constInsertCmdColour
23831 { $_[0]->{constInsertCmdColour} }
23832 sub constShowSystemTextColour
23833 { $_[0]->{constShowSystemTextColour} }
23834 sub constShowErrorColour
23835 { $_[0]->{constShowErrorColour} }
23836 sub constShowWarningColour
23837 { $_[0]->{constShowWarningColour} }
23838 sub constShowDebugColour
23839 { $_[0]->{constShowDebugColour} }
23840 sub constShowImproperColour
23841 { $_[0]->{constShowImproperColour} }
23842 sub customInsertCmdColour
23843 { $_[0]->{customInsertCmdColour} }
23844 sub customShowSystemTextColour
23845 { $_[0]->{customShowSystemTextColour} }
23846 sub customShowErrorColour
23847 { $_[0]->{customShowErrorColour} }
23848 sub customShowWarningColour
23849 { $_[0]->{customShowWarningColour} }
23850 sub customShowDebugColour
23851 { $_[0]->{customShowDebugColour} }
23852 sub customShowImproperColour
23853 { $_[0]->{customShowImproperColour} }
23854  
23855 sub convertInvisibleFlag
23856 { $_[0]->{convertInvisibleFlag} }
23857 sub constTextBufferSize
23858 { $_[0]->{constTextBufferSize} }
23859 sub customTextBufferSize
23860 { $_[0]->{customTextBufferSize} }
23861  
23862 sub constNormalCursor
23863 { $_[0]->{constNormalCursor} }
23864 sub constWWWCursor
23865 { $_[0]->{constWWWCursor} }
23866 sub constPromptCursor
23867 { $_[0]->{constPromptCursor} }
23868 sub constPopupCursor
23869 { $_[0]->{constPopupCursor} }
23870 sub constCmdCursor
23871 { $_[0]->{constCmdCursor} }
23872 sub constMailCursor
23873 { $_[0]->{constMailCursor} }
23874 sub constTelnetCursor
23875 { $_[0]->{constTelnetCursor} }
23876 sub constMapCursor
23877 { $_[0]->{constMapCursor} }
23878 sub constMapAddCursor
23879 { $_[0]->{constMapAddCursor} }
23880 sub constMapConnectCursor
23881 { $_[0]->{constMapConnectCursor} }
23882 sub constMapMergeCursor
23883 { $_[0]->{constMapMergeCursor} }
23884  
23885 sub constUpIconPath
23886 { $_[0]->{constUpIconPath} }
23887 sub constDownIconPath
23888 { $_[0]->{constDownIconPath} }
23889 sub constResetIconPath
23890 { $_[0]->{constResetIconPath} }
23891 sub constCaseIconPath
23892 { $_[0]->{constCaseIconPath} }
23893 sub constRegexIconPath
23894 { $_[0]->{constRegexIconPath} }
23895 sub constDivideIconPath
23896 { $_[0]->{constDivideIconPath} }
23897 sub constWipeIconPath
23898 { $_[0]->{constWipeIconPath} }
23899 sub constAddIconPath
23900 { $_[0]->{constAddIconPath} }
23901 sub constEmptyIconPath
23902 { $_[0]->{constEmptyIconPath} }
23903 sub constSystemIconPath
23904 { $_[0]->{constSystemIconPath} }
23905 sub constDebugIconPath
23906 { $_[0]->{constDebugIconPath} }
23907 sub constErrorIconPath
23908 { $_[0]->{constErrorIconPath} }
23909 sub constMultiIconPath
23910 { $_[0]->{constMultiIconPath} }
23911 sub constSearchIconPath
23912 { $_[0]->{constSearchIconPath} }
23913 sub constCancelIconPath
23914 { $_[0]->{constCancelIconPath} }
23915 sub constSwitchIconPath
23916 { $_[0]->{constSwitchIconPath} }
23917 sub constSplitIconPath
23918 { $_[0]->{constSplitIconPath} }
23919 sub constRestoreIconPath
23920 { $_[0]->{constRestoreIconPath} }
23921 sub constScrollIconPath
23922 { $_[0]->{constScrollIconPath} }
23923 sub constLockIconPath
23924 { $_[0]->{constLockIconPath} }
23925  
23926 sub constIconSizeList
23927 { my $self = shift; return @{$self->{constIconSizeList}}; }
23928  
23929 sub constShadowType
23930 { $_[0]->{constShadowType} }
23931  
23932 sub constStripHash
23933 { my $self = shift; return %{$self->{constStripHash}}; }
23934 sub customStripHash
23935 { my $self = shift; return %{$self->{customStripHash}}; }
23936 sub constTableHash
23937 { my $self = shift; return %{$self->{constTableHash}}; }
23938 sub customTableHash
23939 { my $self = shift; return %{$self->{customTableHash}}; }
23940  
23941 sub constToolbarList
23942 { my $self = shift; return @{$self->{constToolbarList}}; }
23943 sub toolbarHash
23944 { my $self = shift; return %{$self->{toolbarHash}}; }
23945 sub toolbarList
23946 { my $self = shift; return @{$self->{toolbarList}}; }
23947  
23948 sub constLinuxCmdList
23949 { my $self = shift; return @{$self->{constLinuxCmdList}}; }
23950 sub constMSWinCmdList
23951 { my $self = shift; return @{$self->{constMSWinCmdList}}; }
23952 sub constBSDCmdList
23953 { my $self = shift; return @{$self->{constBSDCmdList}}; }
23954 sub browserCmd
23955 { $_[0]->{browserCmd} }
23956 sub emailCmd
23957 { $_[0]->{emailCmd} }
23958 sub audioCmd
23959 { $_[0]->{audioCmd} }
23960 sub textEditCmd
23961 { $_[0]->{textEditCmd} }
23962  
23963 sub constSoundFormatHash
23964 { my $self = shift; return %{$self->{constSoundFormatHash}}; }
23965 sub allowSoundFlag
23966 { $_[0]->{allowSoundFlag} }
23967 sub allowAsciiBellFlag
23968 { $_[0]->{allowAsciiBellFlag} }
23969 sub constStandardSoundHash
23970 { my $self = shift; return %{$self->{constStandardSoundHash}}; }
23971 sub constExtendedSoundHash
23972 { my $self = shift; return %{$self->{constExtendedSoundHash}}; }
23973 sub customSoundHash
23974 { my $self = shift; return %{$self->{customSoundHash}}; }
23975  
23976 sub customAllowTTSFlag
23977 { $_[0]->{customAllowTTSFlag} }
23978 sub systemAllowTTSFlag
23979 { $_[0]->{systemAllowTTSFlag} }
23980 sub forceTTSEngine
23981 { $_[0]->{forceTTSEngine} }
23982 sub constTTSList
23983 { my $self = shift; return @{$self->{constTTSList}}; }
23984 sub constTTSCompatList
23985 { my $self = shift; return @{$self->{constTTSCompatList}}; }
23986 sub ttsSmoothFlag
23987 { $_[0]->{ttsSmoothFlag} }
23988  
23989 sub ttsJobList
23990 { my $self = shift; return @{$self->{ttsJobList}}; }
23991 sub ttsJobMax
23992 { $_[0]->{ttsJobMax} }
23993 sub ttsUrgentJobList
23994 { my $self = shift; return @{$self->{ttsUrgentJobList}}; }
23995 sub ttsJobMode
23996 { $_[0]->{ttsJobMode} }
23997 sub ttsJobPointer
23998 { $_[0]->{ttsJobPointer} }
23999 sub ttsJobMiniPointer
24000 { $_[0]->{ttsJobMiniPointer} }
24001 sub ttsJobAutoFlag
24002 { $_[0]->{ttsJobAutoFlag} }
24003 sub ttsJobOnceFlag
24004 { $_[0]->{ttsJobOnceFlag} }
24005 sub ttsChangeModeFlag
24006 { $_[0]->{ttsChangeModeFlag} }
24007 sub ttsCurrentHarness
24008 { $_[0]->{ttsCurrentHarness} }
24009  
24010 sub ttsHijackKeycodeHash
24011 { my $self = shift; return %{$self->{ttsHijackKeycodeHash}}; }
24012 sub ttsHijackFlag
24013 { $_[0]->{ttsHijackFlag} }
24014 sub ttsForceHijackFlag
24015 { $_[0]->{ttsForceHijackFlag} }
24016  
24017 sub constTtsDefaultList
24018 { my $self = shift; return @{$self->{constTtsDefaultList}}; }
24019 sub constTtsObjHash
24020 { my $self = shift; return %{$self->{constTtsObjHash}}; }
24021 sub constTtsPermObjHash
24022 { my $self = shift; return %{$self->{constTtsPermObjHash}}; }
24023 sub constTtsFixedObjHash
24024 { my $self = shift; return %{$self->{constTtsFixedObjHash}}; }
24025 sub ttsObjHash
24026 { my $self = shift; return %{$self->{ttsObjHash}}; }
24027  
24028 sub constTtsAttribHash
24029 { my $self = shift; return %{$self->{constTtsAttribHash}}; }
24030 sub ttsAttribHash
24031 { my $self = shift; return %{$self->{ttsAttribHash}}; }
24032 sub constTtsFlagAttribHash
24033 { my $self = shift; return %{$self->{constTtsFlagAttribHash}}; }
24034 sub ttsFlagAttribHash
24035 { my $self = shift; return %{$self->{ttsFlagAttribHash}}; }
24036 sub constTtsAlertAttribHash
24037 { my $self = shift; return %{$self->{constTtsAlertAttribHash}}; }
24038 sub ttsAlertAttribHash
24039 { my $self = shift; return %{$self->{ttsAlertAttribHash}}; }
24040  
24041 sub ttsReceiveFlag
24042 { $_[0]->{ttsReceiveFlag} }
24043 sub ttsLoginFlag
24044 { $_[0]->{ttsLoginFlag} }
24045 sub ttsPromptFlag
24046 { $_[0]->{ttsPromptFlag} }
24047 sub ttsSystemFlag
24048 { $_[0]->{ttsSystemFlag} }
24049 sub ttsSystemErrorFlag
24050 { $_[0]->{ttsSystemErrorFlag} }
24051 sub ttsWorldCmdFlag
24052 { $_[0]->{ttsWorldCmdFlag} }
24053 sub ttsDialogueFlag
24054 { $_[0]->{ttsDialogueFlag} }
24055 sub ttsTaskFlag
24056 { $_[0]->{ttsTaskFlag} }
24057  
24058 sub ttsLastPrompt
24059 { $_[0]->{ttsLastPrompt} }
24060  
24061 sub msWinPathESpeak
24062 { $_[0]->{msWinPathESpeak} }
24063 sub msWinAltPathESpeak
24064 { $_[0]->{msWinAltPathESpeak} }
24065 sub msWinPathESNG
24066 { $_[0]->{msWinPathESNG} }
24067 sub msWinPathFestival
24068 { $_[0]->{msWinPathFestival} }
24069 sub msWinPathSwift
24070 { $_[0]->{msWinPathSwift} }
24071  
24072 sub constTtsFestivalServerPort
24073 { $_[0]->{constTtsFestivalServerPort} }
24074 sub ttsFestivalServerPort
24075 { $_[0]->{ttsFestivalServerPort} }
24076 sub ttsFestivalFirstFlag
24077 { $_[0]->{ttsFestivalFirstFlag} }
24078 sub ttsFestivalServerMode
24079 { $_[0]->{ttsFestivalServerMode} }
24080 sub ttsFestivalConnectMode
24081 { $_[0]->{ttsFestivalConnectMode} }
24082 sub ttsFestivalSocket
24083 { $_[0]->{ttsFestivalSocket} }
24084 sub ttsFestivalRequestList
24085 { my $self = shift; return @{$self->{ttsFestivalRequestList}}; }
24086 sub ttsFestivalCheckTime
24087 { $_[0]->{ttsFestivalCheckTime} }
24088 sub ttsFestivalStopTime
24089 { $_[0]->{ttsFestivalStopTime} }
24090 sub ttsFestivalFailFlag
24091 { $_[0]->{ttsFestivalFailFlag} }
24092 sub ttsFestivalSuccessFlag
24093 { $_[0]->{ttsFestivalSuccessFlag} }
24094  
24095 sub constMonthList
24096 { my $self = shift; return @{$self->{constMonthList}}; }
24097 sub customMonthList
24098 { my $self = shift; return @{$self->{customMonthList}}; }
24099 sub constDayList
24100 { my $self = shift; return @{$self->{constDayList}}; }
24101 sub customDayList
24102 { my $self = shift; return @{$self->{customDayList}}; }
24103 sub constRomanHash
24104 { my $self = shift; return %{$self->{constRomanHash}}; }
24105  
24106 sub constIPLookupList
24107 { my $self = shift; return @{$self->{constIPLookupList}}; }
24108 sub ipLookupList
24109 { my $self = shift; return @{$self->{ipLookupList}}; }
24110 sub currentIP
24111 { $_[0]->{currentIP} }
24112  
24113 sub constHelpCharLimit
24114 { $_[0]->{constHelpCharLimit} }
24115  
24116 sub startTime
24117 { $_[0]->{startTime} }
24118 sub startClock
24119 { $_[0]->{startClock} }
24120 sub startDate
24121 { $_[0]->{startDate} }
24122 sub startClockString
24123 { $_[0]->{startClockString} }
24124 sub startDateString
24125 { $_[0]->{startDateString} }
24126  
24127 sub constPromptWaitTime
24128 { $_[0]->{constPromptWaitTime} }
24129 sub promptWaitTime
24130 { $_[0]->{promptWaitTime} }
24131 sub constLoginWarningTime
24132 { $_[0]->{constLoginWarningTime} }
24133 sub loginWarningTime
24134 { $_[0]->{loginWarningTime} }
24135  
24136 sub toolbarLabelFlag
24137 { $_[0]->{toolbarLabelFlag} }
24138 sub irreversibleIconFlag
24139 { $_[0]->{irreversibleIconFlag} }
24140 sub allowBusyWinFlag
24141 { $_[0]->{allowBusyWinFlag} }
24142 sub mainWinSystemMsgFlag
24143 { $_[0]->{mainWinSystemMsgFlag} }
24144 sub mainWinUrgencyFlag
24145 { $_[0]->{mainWinUrgencyFlag} }
24146 sub mainWinTooltipFlag
24147 { $_[0]->{mainWinTooltipFlag} }
24148  
24149 sub commifyMode
24150 { $_[0]->{commifyMode} }
24151  
24152 sub tempUrgencyFlag
24153 { $_[0]->{tempUrgencyFlag} }
24154 sub tempSoundFlag
24155 { $_[0]->{tempSoundFlag} }
24156  
24157 sub constUrlRegex
24158 { $_[0]->{constUrlRegex} }
24159 sub constShortUrlRegex
24160 { $_[0]->{constShortUrlRegex} }
24161 sub shortUrlFlag
24162 { $_[0]->{shortUrlFlag} }
24163 sub constEmailRegex
24164 { $_[0]->{constEmailRegex} }
24165  
24166 sub privConfigAllWorld
24167 { $_[0]->{privConfigAllWorld} }
24168  
24169 sub benchMarkTime
24170 { $_[0]->{benchMarkTime} }
24171 sub benchMarkShortList
24172 { my $self = shift; return @{$self->{benchMarkShortList}}; }
24173 sub benchMarkLongList
24174 { my $self = shift; return @{$self->{benchMarkLongList}}; }
24175  
24176 sub debugLineNumsFlag
24177 { $_[0]->{debugLineNumsFlag} }
24178 sub debugLineTagsFlag
24179 { $_[0]->{debugLineTagsFlag} }
24180 sub debugLocatorFlag
24181 { $_[0]->{debugLocatorFlag} }
24182 sub debugExitFlag
24183 { $_[0]->{debugExitFlag} }
24184 sub debugMaxLocatorFlag
24185 { $_[0]->{debugMaxLocatorFlag} }
24186 sub debugMoveListFlag
24187 { $_[0]->{debugMoveListFlag} }
24188 sub debugParseObjFlag
24189 { $_[0]->{debugParseObjFlag} }
24190 sub debugCompareObjFlag
24191 { $_[0]->{debugCompareObjFlag} }
24192 sub debugExplainPluginFlag
24193 { $_[0]->{debugExplainPluginFlag} }
24194 sub debugCheckIVFlag
24195 { $_[0]->{debugCheckIVFlag} }
24196 sub debugTableFitFlag
24197 { $_[0]->{debugTableFitFlag} }
24198 sub debugTrapErrorFlag
24199 { $_[0]->{debugTrapErrorFlag} }
24200  
24201 sub allowSetupWizWinFlag
24202 { $_[0]->{allowSetupWizWinFlag} }
24203 sub showSetupWizWinFlag
24204 { $_[0]->{showSetupWizWinFlag} }
24205 sub blockWorldHintFlag
24206 { $_[0]->{blockWorldHintFlag} }
24207 }
24208  
24209 # Package must return a true value
24210 1