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

filter: Statementstmt 0.0% 0 / 5979 Branchbran 0.0% 0 / 2580 Conditioncond 0.0% 0 / 2103 MC/DCmcdc 0.0% 0 / 1168 Subroutinesub 0.0% 0 / 942 Podpod 0.0% 0 / 938 totaltotal 0.0% 0 / 13710 CC 1291 SCAR 53.8
CC
1291
Cov
0%
start
3192.0
loadPlugin
1560.0
tts
1406.0
CRAP 216.2
1 # Copyright (C) 2011-2024 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', 'Blind', '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 'OpenDataViewer', 'CloseDataViewer',
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 'ClearClipboard', 'ListClipboard',
834 'AddTrigger', 'ModifyTrigger', 'ExportTrigger', 'ImportTrigger',
835 'DeleteTrigger', 'ListTrigger',
836 'AddAlias', 'ModifyAlias', 'ExportAlias', 'ImportAlias', 'DeleteAlias',
837 'ListAlias',
838 'AddMacro', 'QuickMacro', 'ModifyMacro', 'ExportMacro', 'ImportMacro',
839 'DeleteMacro', 'ListMacro',
840 'AddTimer', 'ModifyTimer', 'ExportTimer', 'ImportTimer', 'DeleteTimer',
841 'ListTimer',
842 'AddHook', 'ModifyHook', 'ExportHook', 'ImportHook', 'DeleteHook', 'ListHook',
843 '@Keycodes',
844 'ListKeycode', 'ListKeycodeAlternative',
845 '@Task package names',
846 'AddTaskPackage', 'DeleteTaskPackage', 'ResetTaskPackage', 'ListTaskPackage',
847 '@Task labels',
848 'AddTaskLabel', 'DeleteTaskLabel', 'ResetTaskLabel', 'ListTaskLabel',
849 '@Current tasks',
850 'TaskHelp', 'StartTask', 'HaltTask', 'KillTask', 'PauseTask', 'ResumeTask',
851 'ResetTask', 'FreezeTask', 'EditTask', 'ListTask', 'SetRunList',
852 '@Initial tasks',
853 'AddInitialTask', 'EditInitialTask', 'DeleteInitialTask', 'ListInitialTask',
854 '@Custom tasks',
855 'AddCustomTask', 'EditCustomTask', 'DeleteCustomTask', 'ListCustomTask',
856 'StartCustomTask',
857 '@Initial scripts',
858 'AddInitialScript', 'DeleteInitialScript', 'ListInitialScript',
859 '@Axbasic commands',
860 'EditScript', 'CheckScript', 'RunScript', 'RunScriptTask', 'AxbasicHelp',
861 'AddDirectory', 'DeleteDirectory', 'ListDirectory',
862 '@Workspaces',
863 'UseWorkspace', 'EditWorkspace', 'RemoveWorkspace', 'ListWorkspace',
864 'SetWorkspaceDirection',
865 'AddInitialWorkspace', 'ModifyInitialWorkspace', 'DeleteInitialWorkspace',
866 'ListInitialWorkspace',
867 'SetWindowSize',
868 'TestWindowControls', 'SetWindowControls', 'ListWindowControls',
869 'TestPanel', 'SetPanel', 'ListPanel',
870 '@Workspace grids',
871 'ActivateGrid', 'DisactivateGrid', 'SetGrid', 'ResetGrid', 'EditGrid',
872 'ListGrid',
873 'SetLayer', 'LayerUp', 'LayerDown',
874 'ToggleWindowStorage', 'ApplyWindowStorage', 'ClearWindowStorage',
875 'DumpWindowStorage',
876 '@Winmaps and winzones',
877 'AddWinmap', 'CloneWinmap', 'EditWinmap', 'ModifyWinmap', 'DeleteWinmap',
878 'ResetWinmap', 'SetDefaultWinmap', 'ListWinmap',
879 'AddWinzone', 'EditWinzone', 'ModifyWinzone', 'DeleteWinzone', 'ListWinzone',
880 '@Zonemaps and zone models',
881 'AddZonemap', 'CloneZonemap', 'EditZonemap', 'DeleteZonemap', 'ResetZonemap',
882 'ListZonemap',
883 'AddZoneModel', 'EditZoneModel', 'ModifyZoneModel', 'DeleteZoneModel',
884 'ListZoneModel',
885 '@\'Grid\' windows',
886 'ToggleShare', 'SwapWindow', 'MoveWindow', 'RestoreWindow', 'GrabWindow',
887 'BanishWindow', 'FixWindow', 'FlashWindow', 'UnflashWindow', 'CloseWindow',
888 'EditWindow', 'ListWindow',
889 '@\'Internal\' windows',
890 'EditWindowStrip', 'ListWindowStrip', 'EditWindowTable', 'ListWindowTable',
891 'OpenTaskWindow', 'CloseTaskWindow',
892 'EditToolbar', 'ListToolbar',
893 '@\'Free\' windows',
894 'EditFreeWindow', 'CloseFreeWindow', 'ListFreeWindow',
895 '@Textviews',
896 'ScrollLock', 'SplitScreen', 'ClearTextView', 'SetTextView', 'ListTextView',
897 'FindText', 'FindReset', 'ConvertText',
898 'SetColour', 'ListColour',
899 'SetSystemColour', 'ListSystemColour',
900 'SetXTerm', 'TogglePalette',
901 'AddColourScheme', 'EditColourScheme', 'ModifyColourScheme',
902 'UpdateColourScheme', 'ApplyColourScheme', 'DeleteColourScheme',
903 'ListColourScheme',
904 '@Recordings, missions, quests and routes',
905 'Record', 'PauseRecording', 'WorldCommand', 'ClientCommand', 'SpeedWalkCommand',
906 'Comment', 'Break',
907 'InsertRecording', 'DeleteRecording', 'ListRecording', 'CopyRecording',
908 'StartMission', 'Mission', 'NudgeMission', 'HaltMission',
909 'RepeatComment', 'RepeatMission',
910 'AddMission', 'CloneMission', 'EditMission', 'DeleteMission', 'ListMission',
911 'PresentMission',
912 'AddQuest', 'CloneQuest', 'EditQuest', 'ModifyQuest', 'FinishQuest',
913 'DeleteQuest', 'ListQuest',
914 'AddRoute', 'EditRoute', 'DeleteRoute', 'ListRoute',
915 'Go', 'Drive', 'Road', 'Quick', 'Circuit',
916 '@Advance task',
917 'ResetGuildSkills', 'ListGuildSkills', 'Advance', 'SkipAdvance', 'ListAdvance',
918 'ListAdvanceHistory',
919 '@Attack task',
920 'Kill', 'KKill', 'KillAll', 'KillMall', 'Interact', 'IInteract', 'InteractAll',
921 'InteractMall',
922 '@Channels and Divert tasks',
923 'AddChannelPattern', 'DeleteChannelPattern', 'ListChannelPattern',
924 'EmptyChannelsWindow', 'EmptyDivertWindow',
925 '@Chat task',
926 'GetIP', 'ChatListen', 'ChatIgnore', 'AddContact', 'EditContact',
927 'DeleteContact', 'ListContact',
928 'ChatCall', 'ChatMCall', 'ChatZCall', 'Chat', 'Emote', 'ChatGroup',
929 'EmoteGroup', 'ChatAll', 'EmoteAll', 'ChatPing', 'ChatDND', 'ChatSubmit',
930 'ChatEscape', 'ChatCommand', 'ChatSendFile', 'ChatStopFile', 'ChatSnoop',
931 'ChatHangUp', 'ChatPeek', 'ChatRequest', 'ChatInfo', 'ChatSet',
932 'ChatSetName', 'ChatSetGroup', 'ChatSetEmail', 'ChatSetSmiley',
933 'ChatSetIcon',
934 'AddSmiley', 'DeleteSmiley', 'ListSmiley', 'ResetSmiley',
935 '@Compass task',
936 'Compass', 'PermCompass', 'WorldCompass',
937 '@Inventory / Condition tasks',
938 'ActivateInventory', 'DisactivateInventory',
939 'ProtectObject', 'UnprotectObject', 'ListProtectObject',
940 'MonitorObject', 'UnmonitorObject', 'ListMonitorObject',
941 'SellAll', 'DropAll', 'UseAll',
942 '@Locator task',
943 'MoveDirection', 'RelayDirection', 'Teleport', 'AddTeleport', 'DeleteTeleport',
944 'ListTeleport', 'InsertLook', 'InsertFailedExit', 'ResetLocatorTask',
945 'SetFacing',
946 'AddExitPattern', 'DeleteExitPattern', 'ListExitPattern',
947 'CollectUnknownWords', 'EmptyUnknownWords', 'ListUnknownWords',
948 'CollectContentsLines', 'EmptyContentsLines', 'ListContentsLines',
949 '@Status task',
950 'ActivateStatusTask', 'DisactivateStatusTask', 'ResetCounter',
951 'AddStatusCommand', 'DeleteStatusCommand', 'ListStatusCommand', 'SetWimpy',
952 'SetLife', 'SetStatusEvent', 'ShowStatusGauge',
953 '@System task',
954 'SetSystemMode',
955 '@Watch task',
956 'EmptyWatchWindow',
957 '@World model commands',
958 'AddRegion', 'AddRoom', 'AddModelObject', 'SetModelParent', 'EditModelObject',
959 'EditRegionmap', 'EmptyRegion', 'DeleteRegion', 'DeleteTemporaryRegion',
960 'DeleteRoom', 'DeleteModelObject', 'ListModel', 'ListOrphan', 'DumpModel',
961 'SplitModel', 'EditModel', 'MergeModel', 'UpdateModel', 'CompressModel',
962 'ModelReport', 'ListSourceCode',
963 'AddRegionScheme', 'EditRegionScheme', 'RenameRegionScheme',
964 'DeleteRegionScheme', 'ListRegionScheme',
965 'AddLabelStyle', 'EditLabelStyle', 'RenameLabelStyle', 'DeleteLabelStyle',
966 'ListLabelStyle',
967 'QuickLabelDelete',
968 'AddPlayerCharacter', 'DeletePlayerCharacter', 'ListPlayerCharacter',
969 'AddMinionString', 'DeleteMinionString', 'ListMinionString',
970 'SetLightList', 'ResetLightList', 'SetLightStatus',
971 'SetRoom', 'ResetRoom', 'SetOfflineRoom', 'LocateRoom',
972 'EditRoomComponent', 'ListRoomComponent',
973 'EditPainter',
974 'SetAssistedMoves', 'SetProtectedMoves',
975 'RoomCommand', 'IgnoreRoomCommand', 'NoticeRoomCommand', 'ListRoomCommand',
976 '@Exit model commands',
977 'AddExit', 'EditExit', 'DeleteExit', 'ListExitModel', 'DumpExitModel',
978 'AllocateExit', 'AlternativeExit',
979 ],
980 # An ordered list of commands, initially set to $self->constClientCmdPrettyList, and
981 # modified when plugins are loaded, enabled or disabled in order to show (or remove)
982 # any plugin client commands
983 clientCmdPrettyList => [], # set below
984 # An ordered list of commands - initially set to $self->constClientCmdPrettyList but
985 # with the headings removed, and all in lower-case (e.g. 'AddChar' becomes 'addchar')
986 clientCmdList => [],
987 # When plugins are loaded, anything to be added to ->clientCmdPrettyList is also added
988 # to this hash. Then, when the plugin is disabled and/or re-enabled,
989 # ->clientCmdPrettyList can be updated
990 # Hash in the form
991 # $clientCmdReplacePrettyHash{plugin_name}
992 # = reference_to_list_of_group_headings_and_client_commands
993 clientCmdReplacePrettyHash => {},
994 #
995 # Each client command has one or more corresponding 'user commands'. Most user commands
996 # are abbreviations; for example, the client command 'addchar' has the user commands
997 # 'ach' and 'addchar'
998 # When the user types a client command in the 'main' window, what they're actually
999 # typing is a user command. Axmud translates the user command into the corresponding
1000 # client command before executing it
1001 # Both client and user commands have a maximum length of 32 characters
1002 #
1003 # The constant hash of user commands (these values never change). A hash in the form
1004 # $constUserCmdHash{user_command} = standard_command
1005 # e.g. $constUserCmdHash{'ab'} = 'about'
1006 # The hash is set up by a call to $self->setupCmds
1007 constUserCmdHash => {},
1008 # The customisable hash of user commands, in the form
1009 # $userCmdHash{user_command} = standard_command
1010 userCmdHash => {}, # [usercmds]
1011 # e.g. ->constUserCmdHash{'my_custom_about'} = 'about'
1012  
1013 # Instructions
1014 # ------------
1015  
1016 # Axmud offers several different kinds of instructions. Instructions are usually typed
1017 # in the 'main' window's command entry box, but any part of the Axmud code can
1018 # generate its own instructions
1019 # For example, most interfaces (triggers, aliases, macros, timers and hooks) generate an
1020 # instruction as their response to a stimulus, and that instruction is executed as if
1021 # it had been typed in the 'main' window's command entry box
1022 # Instructions can beging with one of Axmud's instruction sigils. The sigil specifies
1023 # what kind of instruction it is
1024 # Some sigils are invariable (cannot be disabled, but others can be enabled or disabled
1025 # according to the user's requirements
1026 # If an instruction doesn't begin with a recognised instruction sigil, or if it begins
1027 # with an instruction sigil that's currently disabled, it is executed as an ordinary
1028 # world command (sent to the current world)
1029 #
1030 # The following sigils can be enabled/disabled (but are disabled by default):
1031 #
1032 # The " (double quote) character indicates an 'echo command'. Echo commands are
1033 # displayed in the current session's 'main' window in the same colour used by Axmud
1034 # system messages
1035 #
1036 # e.g. "hello world
1037 # - Displays a 'hello world' message in the session's 'main' window
1038 #
1039 # The / (forward slash) character indicates a 'Perl command'. Perl commands are run as
1040 # a mini-Perl programme. The programme's return value is then executed as an
1041 # instruction. For security, the programme has limited functionality (for example,
1042 # it's not possible to accidentally run 'rm *' )
1043 #
1044 # e.g. /$a = 5; $b = 2; $a * $b;
1045 # - Evaluates the programme, which returns a value of 10, which is executed as a
1046 # world command
1047 #
1048 # The & (ampersand) character indicates a 'script command'. Script commands cause an
1049 # Axbasic script to run. Note that, unlike Perl programmes, Axbasic scripts don't have
1050 # a return value, so no instruction is executed when the script terminates
1051 #
1052 # e.g. &wumpus
1053 # - Runs the wumpus.bas script; it's the equivalent of ';runscript wumpus'
1054 #
1055 # The : (colon) character indicates a 'multi command'. Multi commands are executed in
1056 # multiple sessions - either in sessions connected to the same world as the session
1057 # executing the command, or in all sessions (depending on the value of
1058 # $self->maxMultiCmdFlag) - as a forced world command
1059 #
1060 # e.g. :shout I'm going for lunch
1061 # - Executes the forced world command in multiple sessions
1062 #
1063 # The . (full stop) character indicates a 'speedwalk command'. Speedwalk commands are
1064 # strings like '3nw2e' which resolved to a series of world commands. For special
1065 # features of speedwalk commands, see the comments in GA::Session->speedWalkCmd
1066 #
1067 # e.g. .3nw2s
1068 # - The equivalent of 'north;north;north;west;south;south'
1069 #
1070 # The > (greater than) character indicates a 'bypass command'. Bypass commands are
1071 # ordinary world commands that are executed immediately, ahead of any stored excess
1072 # commands (if the world profile's slowwalking settings specify a command limit, or if
1073 # the session is in crawl mode)
1074 #
1075 # e.g. >drink water
1076 # - Executes the world command immediately, perhaps to drink in order to increase
1077 # the character's energy points before they run out, and while still moving
1078 # along a path (specifically, bypasses a queue of unsent world commands
1079 # created in slowwalking or crawl mode)
1080 #
1081 # The following sigils are always enabled:
1082 #
1083 # The ; (semicolon) character indicates a 'client command'. Axmud provides several
1084 # hundred client commands so that its internal data can be accessed and modified
1085 # from the command line
1086 #
1087 # e.g. ;help
1088 # - Displays Axmud help
1089 #
1090 # The ,, (two commas) sequence indicates a 'forced world command'. Everything following
1091 # the commas is executed as a world command, even if the rest of the command starts
1092 # with a different instruction sigil
1093 #
1094 # e.g. ,,/connect
1095 # - Executes '/connect/ as a world command, rather than as a Perl command
1096 #
1097 # If an instruction doesn't begin with a recognised instruction sigil (or if it does,
1098 # but the sigil is disabled), the instruction is executed as an ordinary world command
1099 # (not a forced world command)
1100 #
1101 # World commands can be modified in some circumstances
1102 # - They can be intercepted by aliases, and either modified or diverted to some part
1103 # of the Axmud code
1104 # - Primary directions like 'north' can be modified if 'redirect' mode is on, or if
1105 # the automapper's assisted moves are on
1106 # - The instruction might be split into two or more world commands, if the command
1107 # separator (a semicolon by default) occurs in the command
1108 # - commands typed in upper-case letters (only) can be converted to lower-case letters
1109 # if $self->convertWorldCmdFlag is set
1110 # However, none of these apply to forced world commands, which are never modified before
1111 # being sent to the world
1112 #
1113 # The instruction sigils. Modifying the values of these IVs is strongly discouraged
1114 # If you do modify them, do not use empty strings or strings containing whitespace. Make
1115 # sure each sigil starts with a different character (i.e. don't set the client command
1116 # sigil to '@1' and the echo command sigil to '@2', or something like that)
1117 # Axmud system messages do not consult these IVs; they generally assume that the sigils
1118 # have not been modified. Changing these sigils will not affect the way missions or
1119 # the Chat task operate
1120 constClientSigil => ';',
1121 constForcedSigil => ',,',
1122 constEchoSigil => '"',
1123 constPerlSigil => '/',
1124 constScriptSigil => '&',
1125 constMultiSigil => ':',
1126 constSpeedSigil => '.',
1127 constBypassSigil => '>',
1128 # Flags to enable (TRUE) or disable (FALSE) some instruction sigils
1129 echoSigilFlag => FALSE,
1130 perlSigilFlag => FALSE,
1131 scriptSigilFlag => FALSE,
1132 multiSigilFlag => FALSE,
1133 speedSigilFlag => FALSE,
1134 bypassSigilFlag => FALSE,
1135 #
1136 # The default character (or string) used to separate commands in a string (maximum 4
1137 # characters)
1138 constCmdSep => ';',
1139 # The current character (or string) used
1140 cmdSep => undef, # [config] Set below
1141  
1142 # Constant default sizes for display, instruction and world command buffers (any
1143 # registry which stores GA::Buffer::Display, GA::Buffer::Instruct or
1144 # GA::Buffer::Cmd objects)
1145 constDisplayBufferSize => 10000,
1146 constInstructBufferSize => 1000,
1147 constCmdBufferSize => 1000,
1148 # Constant minimum/maximum buffer sizes
1149 constMinBufferSize => 10,
1150 constMaxBufferSize => 1000000,
1151 # Custom sizes for display, instruction and world command buffers. Minimum 10,
1152 # maximum 1000000
1153 customDisplayBufferSize => undef, # [config] set below
1154 customInstructBufferSize => undef, # [config]
1155 customCmdBufferSize => undef, # [config]
1156  
1157 # Flag set to TRUE if world commands should be confirmed (also displayed) in the
1158 # session's default textview object, after being sent to the world; set to FALSE
1159 # otherwise
1160 confirmWorldCmdFlag => TRUE, # [config]
1161 # Flag set to TRUE if single-word world commands that are in ALL CAPITAL LETTERS
1162 # (usually after typing all-caps elsewhere, perhaps the text for a label in the
1163 # automapper window) should be converted to lower-case letters, before being processed
1164 convertWorldCmdFlag => TRUE, # [config]
1165 # Flag set to TRUE if the last world command typed in the 'main' window's command entry
1166 # box should be preserved after the user types RETURN; set to FALSE otherwise (also
1167 # applies to multi commands, speedwalk commands and bypass commands)
1168 preserveWorldCmdFlag => TRUE, # [config]
1169 # Flag set to TRUE if the last instruction (besides world, multi, speedwalk and bypass
1170 # commands commands) typed in the 'main' window's command entry box should be
1171 # preserved after the user types RETURN, set to FALSE otherwise
1172 preserveOtherCmdFlag => FALSE, # [config]
1173 # Flag set to TRUE if multi commands (those beginning with the instruction sigil ':')
1174 # should be executed as world commands in all sessions, FALSE if they should be
1175 # executed as world commands only in sessions with the same current world
1176 maxMultiCmdFlag => TRUE, # [config]
1177  
1178 # Auto-complete mode - what to do when an 'internal' window's command entry box is in
1179 # focus, and the user presses the up/down arrow keys
1180 # 'none' - Do nothing
1181 # 'auto' - Auto-complete the command using the 'tab' key, or navigate through
1182 # instructions/world commands using the 'up'/'down' keys
1183 autoCompleteMode => 'auto', # [config]
1184 # Auto-complete type - navigate through an instruction buffer ('instruct') or through a
1185 # world command buffer ('cmd')
1186 autoCompleteType => 'cmd', # [config]
1187 # Auto-complete registry location. Registries to store display, instruction and world
1188 # command buffers exist in GA::Client and GA::Session. Which registry to use:
1189 # 'combined' or 'session'
1190 autoCompleteParent => 'session', # [config]
1191  
1192 # Flag set to TRUE if the page up/page down/home/end keys should cause the a textview in
1193 # the active 'internal' window to scroll up and down; set to FALSE otherwise
1194 useScrollKeysFlag => TRUE, # [config]
1195 # Flag set to FALSE if the page up/page down keys should scroll the size of a page (so
1196 # that no text from the previous page is visible), TRUE if the keys should scroll the
1197 # size of a page increment (which is a little smaller, so that text from the top or
1198 # bottom is still visible)
1199 smoothScrollKeysFlag => TRUE, # [config]
1200 # Flag set to TRUE if the page up/home keys should cause a textview object to engage
1201 # split screen mode (if it's not engaged already), and the page down/end keys should
1202 # cause a textview object to disengage split screen mode
1203 autoSplitKeysFlag => TRUE, # [config]
1204 # Flag set to TRUE if the tab/cursor up/cursor down should autocomplete text in the
1205 # active 'internal' window's command entry box; set to FALSE otherwise
1206 # (NB GA::Client->autoCompleteMode must also be set to 'auto')
1207 useCompleteKeysFlag => TRUE, # [config]
1208 # Flag set to TRUE if the TAB key should switch between tabs in a pane object
1209 # (GA::Table::Pane) in the active 'internal' window; set to FALSE otherwise
1210 # If the window contains an entry strip object (GA::Strip::Entry), the TAB key is used
1211 # in auto-completion, so CTRL+TAB is required to switch tabs. If there's no entry
1212 # strip object, TAB will do the job
1213 useSwitchKeysFlag => TRUE, # [config]
1214  
1215 # The instruction buffer for the client. Every instruction processed by any session is
1216 # assigned its own GA::Buffer::Instruct object in that session's registry, as well as
1217 # a separate GA::Buffer:Instruct object in this registry
1218 # Instructions includes client commands like ';setworld deathmud', Perl commands, echo
1219 # commands as well as world commands
1220 # In addition, if the user types 'north;kill troll;eat corpse', that chain of world
1221 # commands is stored as a single GA::Buffer::Instruct (and also as three separate
1222 # GA::Buffer::Cmd objects in the world command buffer)
1223 # When the buffer is full, adding an instruction to the buffer also deletes the oldest
1224 # existing one
1225 # Hash in the form
1226 # $instructBufferHash{number} = blessed_reference_to_buffer_object
1227 instructBufferHash => {},
1228 # How many instructions have been processed altogether (used to give every
1229 # GA::Buffer::Instruct object a unique number)
1230 instructBufferCount => 0,
1231 # The ->number of the earliest surviving GA::Buffer::Instruct object in the buffer,
1232 # deleted when the buffer is full and a new object is added
1233 instructBufferFirst => undef,
1234 # The ->number of the most recently-created GA::Buffer::Instruct object in the buffer
1235 # (when set, always one less than $self->instructBufferCount)
1236 instructBufferLast => undef,
1237 # When the user navigates through instructions in an 'internal' window's command entry
1238 # box by pressing the up/down arrow keys, the number of the buffer object whose
1239 # instruction is currently used (matches a key in ->instructBufferHash)
1240 # Set on the first such key press in the window. Reset back to 'undef' when the current
1241 # session changes or an instruction is processed by the visible session (even if it's
1242 # a GA::Session->pseudoCmd call)
1243 instructBufferPosn => undef,
1244  
1245 # The world command buffer for the client. Every world command processed by any session
1246 # is assigned its own GA::Buffer::Cmd object in that session's registry, as well as a
1247 # separate GA::Buffer:Cmd object in this registry
1248 # If the user types 'north;kill troll;eat corpse', three world commands are processed
1249 # and three GA::Buffer:Cmd objects are added
1250 # When the buffer is full, adding an instruction to the buffer also deletes the oldest
1251 # existing one
1252 # Hash in the form
1253 # $cmdBufferHash{number} = blessed_reference_to_buffer_object
1254 cmdBufferHash => {},
1255 # How many world commands have been processed altogether (used to give every
1256 # GA::Buffer::Cmd object a unique number)
1257 cmdBufferCount => 0,
1258 # The ->number of the earliest surviving GA::Buffer::Cmd object in the buffer,
1259 # deleted when the buffer is full and a new object is added
1260 cmdBufferFirst => undef,
1261 # The ->number of the most recently-created GA::Buffer::Cmd object in the buffer
1262 # (when set, always one less than $self->cmdBufferCount)
1263 cmdBufferLast => undef,
1264 # When the user navigates through world commands in an 'internal' window's command entry
1265 # box by pressing the up/down arrow keys, the number of the buffer object whose
1266 # world command is currently used (matches a key in ->cmdBufferHash)
1267 # Set on the first such key press in the window. Reset back to 'undef' when the current
1268 # session changes or an instruction is processed by the visible session (even if it's
1269 # a GA::Session->pseudoCmd call)
1270 cmdBufferPosn => undef,
1271  
1272 # Profiles
1273 # --------
1274  
1275 # 'Profiles' are Perl objects describing the properties of things like worlds, guilds,
1276 # races and characters. All profiles are associated with a particular world. For every
1277 # single world profile, there can be any number of associated guild, race and
1278 # character profiles. The profiles for each world have a unique name, so you can't
1279 # have a character and a race profile both called 'wolf' (but you can have two
1280 # character profiles, both called 'Gandalf', associated with different worlds)
1281 # Other data can be represented by profiles - for example, it's possible for the user to
1282 # create 'faction', 'gang' or 'house' profiles
1283 # At the start of the session, Axmud loads from file (or creates) all the profiles
1284 # associated with that world. One profile of each category can be marked as 'current'.
1285 # There doesn't have to be a current profile from each category, but there is always a
1286 # current 'world' profile (and usually a current 'character' profile)
1287 # A 'profile template' is a blueprint for a new category of profile. The template can
1288 # spawn copies of itself which are profiles in their own right
1289 #
1290 # Profiles serve two purposes. Firstly, they allow us to store data about the world,
1291 # secondly, they allow us to attach Axmud interfaces to a subset of characters on the
1292 # world. (Interfaces are triggers, aliases, macros, timers and hooks)
1293 # In short, when a player logs in to Deathmud with the character Gandalf, Axmud is able
1294 # to activate only the relevant interfaces, disactivating all the others. For example,
1295 # if we have three aliases called 'shopping' (one for wizards, one for warriors and
1296 # one for thieves), only the 'shopping' alias for wizards will be activated
1297 #
1298 # Profiles categories have a priority order, with the highest priority on the left of
1299 # the list. The default priority order is character > race > guild > world
1300 # The priority order can be changed, but with a few restrictions: it must contain at
1301 # least 'world' and 'char', and 'world' always has the lowest priority (is the last
1302 # item on the list)
1303 # If we have two aliases called 'shopping', one for Gandalf only and one for wizards in
1304 # general, the Gandalf alias is the active one because characters take priority over
1305 # guilds (by default)
1306 #
1307 # Constant registry list of profile priorities (these values never change)
1308 constProfPriorityList => ['char', 'race', 'guild', 'world'],
1309 # Constant registry hash of profile IVs that are used with every category of profile,
1310 # and which therefore can't be changed or removed in profile templates or custom
1311 # profiles
1312 constProfStandardHash => {
1313 name => undef,
1314 category => undef,
1315 parentWorld => undef,
1316 initTaskHash => undef,
1317 initTaskOrderList => undef,
1318 initTaskTotal => undef,
1319 initScriptHash => undef,
1320 initScriptOrderList => undef,
1321 initMission => undef,
1322 initCmdList => undef,
1323 setupCompleteFlag => undef,
1324 notepadList => undef,
1325 privateHash => undef,
1326 # Also, the IVs used by profile templates, but not built-in profiles
1327 constFixedFlag => undef,
1328 # Also, constant IVs specified by $self->constIVHash
1329 _objName => undef,
1330 _objClass => undef,
1331 _parentFile => undef,
1332 _parentWorld => undef,
1333 _privFlag => undef,
1334 },
1335 #
1336 # Registry hash of all world profile objects, in the form
1337 # $worldProfHash{unique_string_name} = blessed_reference_to_profile_object
1338 worldProfHash => {}, # [config] [worldprof]
1339 #
1340 # Axmud comes with some pre-configured world profiles. A constant registry hash of those
1341 # world profiles, and the Axmud version in which they were introduced
1342 # If the user is using a newer version of Axmud, this IV is consulted and any new
1343 # pre-configured worlds are imported into Axmud's data directories
1344 constWorldHash => {
1345 'aardwolf' => '1.0.140', # Aardwolf MUD / aardmud.org 40000
1346 'achaea' => '1.0.050', # Achaea / achaea.com 23
1347 'advun' => '1.1.138', # Adventures Unlimited / tharel.net 5005
1348 'aetolia' => '1.0.376', # Aetolia / aetolia.com 23
1349 'alteraeon' => '1.0.140', # Alter Aeon / alteraeon.com 3000
1350 'anguish' => '1.0.050', # Ancient Anguish / ancient.anguish.org 2222
1351 'aochaos' => '1.1.050', # Age of Chaos / aoc.pandapub.com 4000
1352 'archipelago' => '1.0.140', # Archipelago MUD / the-firebird.net 8000
1353 'arctic' => '1.1.0', # ArcticMud / mud.arctic.org 2700
1354 'ateraan' => '1.1.0', # New Worlds: Ateraan / www.ateraan.com 4002
1355 'avalonmud' => '1.1.050', # Avalon (Germany) / avalon.mud.de 7777
1356 'avalonrpg' => '1.1.0', # Avalon; The Legend Lives / avalon-rpg.com 23
1357 'avatarmud' => '1.1.0', # Avatar MUD / avatar.outland.org 3000
1358 'batmud' => '1.0.140', # BatMUD / batmud.bat.org 23
1359 'bedlam' => '1.0.140', # Bedlam / mud.playbedlam.com 9000
1360 'burningmud' => '1.1.0', # Burning MUD / burningmud.com 4000
1361 'bylins' => '1.1.138', # Bylins MUD / bylins.su 4000
1362 'carrion' => '1.1.050', # Carrion Fields / carrionfields.net 4449
1363 'clessidra' => '1.1.138', # Clessidra MUD / mud.clessidra.it 4000
1364 'clok' => '1.0.275', # CLOK / clok.contrarium.net 4000
1365 'coffeemud' => '1.1.0', # CoffeeMud / coffeemud.net 23
1366 'cryosphere' => '1.0.376', # Cryosphere / cryosphere.org 6666
1367 'cyberassault' => '1.1.050', # CyberASSAULT / cyberassault.org 11111
1368 'darkrealms' => '1.1.0', # Dark Realms: City of Syne / 64.227.89.30 1138
1369 'dartmud' => '1.1.0', # DartMUD / dartmud.com 2525
1370 'dawn' => '1.1.0', # Dawn / dawnmud.com 3000
1371 'discworld' => '1.0.140', # Discworld MUD / discworld.starturtle.net 23
1372 'dragonstone' => '1.1.138', # DragonStone / dragonstone.mudmagic.com 2345
1373 'dsdev' => '1.0.0', # Dead Souls development mud / dead-souls.net 8000
1374 'dslands' => '1.0.0', # Dark and Shattered Lands / dsl-mud.org 4000
1375 'dslocal' => '1.0.0', # Local installation of Dead Souls mudlib
1376 # / localhost 6666
1377 'dsprime' => '1.0.0', # Dead Souls game mud / dead-souls.net 6666
1378 'dswords' => '1.1.270', # Dragon Swords / dragonswordsmud.com 1234
1379 'dunemud' => '1.1.0', # DuneMUD / dunemud.net 6789
1380 'duris' => '1.0.0', # Duris: Land of BloodLust / mud.durismud.com 7777
1381 'edmud' => '1.1.138', # Eternal Darkness / eternaldarkness.net 9700
1382 'elephantmud' => '1.1.0', # Elephant MUD / elephant.org 23
1383 'elysium' => '1.1.050', # Elysium RPG / elysium-rpg.com 7777
1384 'empire' => '1.1.0', # EmpireMUD 2.0 / empiremud.net 4000
1385 'eotl' => '1.1.0', # End of the Line / eotl.org 2010
1386 'fkingdoms' => '1.1.270', # Forgotten Kingdoms / forgottenkingdoms.org 4000
1387 'fourdims' => '1.0.050', # 4Dimensions / 4dimensions.org 6000
1388 'forestsedge' => '1.1.270', # Forest's Edge / mud.theforestsedge.com 4000
1389 'genesis' => '1.0.0', # Genesis / mud.genesismud.org 3011
1390 'greatermud' => '1.1.270', # GreaterMUD / greatermud.com 23
1391 'gwapoc' => '1.3.0', # Godwars: Rebirth of Apocalypse
1392 # / apoc.godwars.net 6660
1393 'hellmoo' => '1.1.050', # HellMOO / hellmoo.org 7777
1394 'hexonyx' => '1.1.138', # HexOnyx / mud.hexonyx.com 7777
1395 'holyquest' => '1.1.0', # HolyQuest / holyquest.org 8080
1396 'iberia' => '1.0.0', # Iberia MUD / iberiamud.com 5900
1397 'icesus' => '1.1.0', # Icesus / naga.icesus.org 4000
1398 'ifmud' => '1.0.275', # ifMUD / ifmud.port4000.com 4000
1399 'imperian' => '1.0.376', # Imperian: Sundered Heavens / imperian.com 23
1400 'islands' => '1.1.0', # Islands / play.islands-game.live 3000
1401 'kallisti' => '1.1.0', # Legends of Kallisti / legendsofkallisti.com 4000
1402 'lambda' => '1.1.0', # LambdaMOO / lambda.moo.mud.org 8888
1403 'legendmud' => '1.0.275', # LegendMUD / mud.legendmud.org 9999
1404 'lostsouls' => '1.1.0', # Lost Souls / lostsouls.org 23
1405 'lowlands' => '1.3.0', # Lowlands / lolamud.net 6969
1406 'luminari' => '1.1.0', # Luminari MUD / luminarimud.com 4100
1407 'lusternia' => '1.0.0', # Lusternia / lusternia.com 23
1408 'magica' => '1.0.140', # Materia Magica / materiamagica.com 4000
1409 'medievia' => '1.1.0', # Medievia / medievia.com 4000
1410 'merentha' => '1.0.050', # Merentha / mud.merentha.com 10000
1411 'midnightsun' => '1.1.270', # Midnight Sun / midnightsun2.org 3000
1412 'miriani' => '1.1.050', # Miriani / toastsoft.net 1234
1413 'morgengrauen' => '1.1.0', # MorgenGrauen / mg.mud.de 23
1414 'mud1' => '1.1.0', # MUD1 (British Legends)
1415 # / british-legends.com 27750
1416 'mud2' => '1.1.0', # MUD2 (Canadian server) / mud2.com 23
1417 'mudii' => '1.1.0', # MUD2 (UK server) / mud2.com 23
1418 'mume' => '1.1.050', # MUME / mume.org 23
1419 'nannymud' => '1.1.270', # NannyMUD / mud.lysator.liu.se 2000
1420 'nanvaent' => '1.0.0', # Nanvaent / nanvaent.org 23
1421 'nodeka' => '1.0.275', # Nodeka / nodeka.com 23
1422 'nuclearwar' => '1.0.140', # Nuclear War / nuclearwarmudusa.com 4000
1423 'penultimate' => '1.1.0', # Penultimate Destination
1424 # / penultimatemush.com 9500
1425 'pict' => '1.0.140', # Pict MUD / 136.62.89.155 4200
1426 'ravenmud' => '1.1.138', # RavenMUD / ravenmud.com 6060
1427 'realmsmud' => '1.1.138', # RealmsMUD / realmsmud.org 1501
1428 'reinos' => '1.1.0', # Reinos de Leyenda / rlmud.org 5001
1429 'retromud' => '1.1.0', # RetroMUD / retromud.org 3000
1430 'rodespair' => '1.1.0', # Realms of Despair / realmsofdespair.com 23
1431 'roninmud' => '1.1.050', # RoninMUD / game.roninmud.org 5000
1432 'rowonder' => '1.3.0', # Realms of Wonder / mud.killerpcs.com 8888
1433 'rupert' => '1.0.275', # Rupert / rupert.twyst.org 9040
1434 'slothmud' => '1.0.140', # SlothMUD III / slothmud.org 6101
1435 'stickmud' => '1.1.270', # StickMUD / stickmud.com 7680
1436 'stonia' => '1.0.376', # Stonia / stonia.ttu.ee 4000
1437 'swmud' => '1.1.0', # Star Wars Mud / swmud.org 6666
1438 'tempora' => '1.0.0', # Tempora Heroica / login1.ibiblio.org 2895
1439 'theland' => '1.1.270', # The Land / theland.notroot.com 5000
1440 'threekingdoms' => '1.1.0', # 3Kingdoms / 3k.org 3000
1441 'threescapes' => '1.1.0', # 3Scapes / 3scapes.org 3200
1442 'tilegacy' => '1.1.270', # The Inquisition: Legacy / ti-legacy.org 5050
1443 'torilmud' => '1.1.0', # TorilMUD / torilmud.org 9999
1444 'tsunami' => '1.1.050', # Tsunami / tsunami.thebigwave.net 23
1445 'twotowers' => '1.1.138', # Two Towers / t2tmud.org 9999
1446 'uossmud' => '1.1.270', # Unofficial SquareSoft MUD
1447 # / uossmud.sandwich.net 9000
1448 'valhalla' => '1.0.0', # Valhalla MUD / valhalla.com 4242
1449 'vikingmud' => '1.0.050', # Viking MUD / connect.vikingmud.org 2001
1450 'waterdeep' => '1.1.138', # Waterdeep / waterdeep.org 4200
1451 'wotmud' => '1.1.0', # The Wheel of Time MUD / game.wotmud.org 2224
1452 'zombiemud' => '1.1.0', # ZombieMUD / zombiemud.org 23
1453 # Pre-configured worlds from earlier releases => '1.1.0', now defunct
1454 # 'midkemia' => '1.0.376', # Midkemia Online / closed 2016
1455 # Worlds ready for the next Axmud release
1456 # ...
1457 },
1458 # Constant registry hash of pre-configured world profiles that must be patched (because
1459 # of serious problems, or because the IP/DNS/port has changed), and the most recent
1460 # Axmud version whose saved data requires the patch
1461 constWorldPatchHash => {
1462 'achaea' => '1.2.041',
1463 'aetolia' => '1.2.041',
1464 'alteraeon' => '1.1.270',
1465 'archipelago' => '1.3.0',
1466 'avalonrpg' => '1.1.012',
1467 'darkrealms' => '1.3.0',
1468 'dawn' => '1.3.0',
1469 'discworld' => '1.1.343',
1470 'dsdev' => '1.1.270',
1471 'dslocal' => '1.1.270',
1472 'dsprime' => '1.1.270',
1473 'dunemud' => '1.2.0',
1474 'edmud' => '1.3.0',
1475 'fkingdoms' => '1.3.0',
1476 'forestsedge' => '1.3.0',
1477 'imperian' => '1.2.041',
1478 'icesus' => '1.3.0',
1479 'islands' => '1.2.0',
1480 'kallisti' => '1.2.041',
1481 'luminari' => '1.1.270',
1482 'lusternia' => '1.2.041',
1483 'mud1' => '1.1.270',
1484 'mud2' => '1.1.270',
1485 'mudii' => '1.1.270',
1486 'nanvaent' => '1.1.405',
1487 'pict' => '1.1.174',
1488 'swmud' => '1.1.012',
1489 'threekingdoms' => '1.1.270',
1490 'threescapes' => '1.1.270',
1491 'twotowers' => '1.2.0',
1492 },
1493 # Constant registry list of pre-configured world profiles; all the keys in
1494 # $self->constWorldList, sorted alphabetically
1495 constWorldList => [], # Set below
1496 # The Axmud version found the last time the user ran Axmud. If the user is now using a
1497 # newer version of Axmud, the code uses this IV to decide which new pre-configured
1498 # worlds to insert into Axmud's data directory
1499 # The literal value stored below is the version number of Axmud's first public release.
1500 # This IV was introduced in v1.1.021
1501 prevClientVersion => '1.0.0', # [config]
1502 # List of the user's 'favourite' worlds, which appear at the top of the Connections
1503 # window's list (in the same order they appear here)
1504 favouriteWorldList => [], # [config]
1505 # List of worlds to which Axmud should auto-connect when it starts (unless @ARGV is set,
1506 # meaning the user started Axmud by typing something like 'axmud.pl deathmud 5555'
1507 # Each item in the list should be a string containing one or more words, separated by
1508 # any amount of whitespace. The first (compulsory) word is the world profile name;
1509 # any subsequent words are character profile names. If multiple character profiles are
1510 # specified, Axmud opens a session for all of them. If none are specified, Axmud opens
1511 # a connection without setting a current character
1512 # The list is processed in order. A world can appear multiple times in the list. When
1513 # Axmud starts, if the world profile or a character profile doesn't exist, no
1514 # attemption is connected. Axmud will connect to the same world several times, where
1515 # no character profile exists, but it won't try to connect using the same profile
1516 # twice
1517 # Note that, in Axmud blind mode ($BLIND_MODE_FLAG = TRUE), only one session can be
1518 # opened. Any further items in this list after the first connection are ignored
1519 # Examples items in the list:
1520 # 'deathmud'
1521 # 'deathmud gandalf'
1522 # 'deathmud gandalf bilbo'
1523 autoConnectList => [], # [config]
1524 # As well as the pre-configured worlds, Axmud uses a much larger list of worlds from
1525 # which the user can choose in the Connections window. Basic details for each world
1526 # are stored in a GA::Obj::BasicWorld object
1527 # Registry hash in the form
1528 # $constBasicWorldHash{'name'} = blessed_reference_to_basic_world_object
1529 # ...where 'name' is the string used as the world profile name, if the user connects
1530 # to this world
1531 constBasicWorldHash => {}, # Set by $self->loadBasicWorlds
1532  
1533 # World models
1534 # ------------
1535  
1536 # Constant registry list of room filters in a standard order
1537 constRoomFilterList => [
1538 'markers',
1539 'custom',
1540 'navigation',
1541 'commercial',
1542 'buildings',
1543 'structures',
1544 'terrain',
1545 'objects',
1546 'light',
1547 'guilds',
1548 'quests',
1549 'attacks',
1550 ],
1551 # Parallel list of room filters with keyboard shortcuts, for use in the automapper
1552 # window menu ('R' is not available, and items must be in the same order as the list
1553 # above)
1554 constRoomFilterKeyList => [
1555 '_markers',
1556 '_custom',
1557 '_navigation',
1558 'c_ommercial',
1559 '_buildings',
1560 '_structures',
1561 '_terrain',
1562 'ob_jects',
1563 'l_ight',
1564 '_guilds',
1565 '_quests',
1566 '_attacks',
1567 ],
1568 # Constant registry list of values used to initialise room flags in world models
1569 constRoomFlagList => [
1570 # Markers
1571 # -------
1572 # blocked_room - Set if this room shouldn't be available to pathfinding functions
1573 # (or similar code)
1574 'blocked_room' , 'Bl', 'markers',
1575 '#A6483C', # Dark red
1576 'Room is blocked',
1577 # interesting - Set if this room is marked as interesting
1578 'interesting', 'In', 'markers',
1579 '#EC7171', # Pink
1580 'Room is interesting',
1581 # investigate - Set if this room is marked as worth coming back later to investigate
1582 'investigate', 'Iv', 'markers',
1583 '#F37E1B', # Orange
1584 'Room worth investigating',
1585 # unexplored - Set if this room hasn't been visited yet
1586 'unexplored', 'Ux', 'markers',
1587 '#AE5463', # Dull dark red
1588 'Room not visited yet',
1589 # unspecified - Set if this room has an 'unspecified' room statement
1590 'unspecified', 'Un', 'markers',
1591 '#84885C', # Very pale green
1592 'Unspecified room statement',
1593 # avoid_room - Set if this room is marked as worth avoiding
1594 'avoid_room' , 'Av', 'markers',
1595 '#E15835', # Orange-red
1596 'Room worth avoiding',
1597 # mortal_danger - Set if entering this room will probably get the character killed
1598 'mortal_danger', 'Md', 'markers',
1599 '#FF0000', # Default red
1600 'Room is extremely dangerous',
1601 # danger - Set if entering this room is dangerous
1602 'danger', 'Dg', 'markers',
1603 '#A12C1C', # Dark red
1604 'Room is dangerous',
1605 # dummy_room - Set if this room is not actually accessible
1606 'dummy_room', 'Dr', 'markers',
1607 '#A4A4A4', # Grey
1608 'Inaccessible (dummy) room',
1609 # rent_room - Set if this room is where the character can rent (store stuff)
1610 'rent_room', 'Rt', 'markers',
1611 '#CACA84', # Pale brown/yellow
1612 'Room for renting',
1613 # camp_room - Set if this room is where the character can camp
1614 'camp_room', 'Cm', 'markers',
1615 '#909044', # Darker brown/yellow
1616 'Room for camping',
1617 # stash_room - Set if this room is where you like to leave things temporarily
1618 'stash_room', 'St', 'markers',
1619 '#C1722B', # Dirty orange
1620 'Room for stashing things',
1621 # hide_room - Set if this room is where you like to hide
1622 'hide_room', 'Hd', 'markers',
1623 '#AE8B6A', # Grey-brown
1624 'Room for hiding',
1625 # random_room - Set if this room was randomly generated (by the world)
1626 'random_room', 'Rn', 'markers',
1627 '#A7B455', # Yellow-green
1628 'Randomly-generated room',
1629 # immortal_room - Set if this room is only accessible to admin users
1630 'immortal_room', 'Im', 'markers',
1631 '#FF2161', # Red-purple
1632 'Room not accessible to mortals',
1633  
1634 # Custom
1635 # ------
1636 # (all room flags added by the user are in this filter)
1637  
1638 # Navigation
1639 # ----------
1640 # world_centre - Set if this room has been designated the centre of the world
1641 'world_centre', 'Mc', 'navigation',
1642 '#FB922C', # Orange
1643 'Room is centre of world',
1644 # world_start - Set if this room is the room where new players start
1645 'world_start', 'Ms', 'navigation',
1646 '#57FF6A', # Lilac green
1647 'Start room for new players',
1648 # meet_point - Set if this room has been designated as a meeting point (usually a
1649 # room in the world at the centre of a town, near shops)
1650 'meet_point', 'Mp', 'navigation',
1651 '#D77EC7', # Light purple
1652 'Room is a meetpoint',
1653 # main_route - Set if this is a main route
1654 'main_route', 'Mr', 'navigation',
1655 '#A0959F', # Dark grey
1656 'Room is on a main route',
1657 # minor_route - Set if this is a minor route
1658 'minor_route', 'mr', 'navigation',
1659 '#CDC4CD', # Light grey
1660 'Room is on a minor route',
1661 # cross_route - Set if this is where two or more routes meet
1662 'cross_route', 'Cr', 'navigation',
1663 '#F0B68F', # Light orange
1664 'Room is at an intersection',
1665 # arrow_route - Set if this room leads in the right direction
1666 'arrow_route', 'Aw', 'navigation',
1667 '#ECD24E', # Gold
1668 'Room leads in right direction',
1669 # wrong_route - Set if this room leads in the wrong direction
1670 'wrong_route', 'Br', 'navigation',
1671 '#A55B2A', # Brown
1672 'Room leads in wrong direction',
1673 # portal - Set if this room contains some kind of portal
1674 'portal', 'Pl', 'navigation',
1675 '#88FFE7', # Bright cyan
1676 'Room contains some kind of portal',
1677 # sign_post - Set if this room contains a signpost
1678 'sign_post', 'Sp', 'navigation',
1679 '#B58870', # Pale brown
1680 'Room contains a signpost',
1681 # bus_stop - Set if this room is a stop along a moving vehicle's route
1682 'bus_stop', 'Bs', 'navigation',
1683 '#6F6F6F', # Darker grey
1684 'Room has a bus stop',
1685 # moving_boat - Set if this room is on a (moving) boat
1686 'moving_boat', 'Bt', 'navigation',
1687 '#3CD1C8', # Cyan
1688 'Room is a (moving) boat',
1689 # vehicle - Set if this room is on a (moving) vehicle
1690 'vehicle', 'Vh', 'navigation',
1691 '#869D9B', # Grey-cyan
1692 'Room is a (moving) vehicle',
1693 # fixed_boat - Set if this room is on a (stationary) boat
1694 'fixed_boat', 'Fb', 'navigation',
1695 '#237974', # Darkish blue
1696 'Room is on a (stationary) boat',
1697 # swim_room - Set if this room is in water, so the character needs to swim
1698 'swim_room', 'Sw', 'navigation',
1699 '#2656C6', # Blue
1700 'Character needs to swim here',
1701 # fly_room - Set if this room is in the air, so the character needs to fly
1702 'fly_room', 'Fl', 'navigation',
1703 '3A79F7', # Sky blue
1704 'Character needs to fly here',
1705  
1706 # Commercial
1707 # ----------
1708 # shop_general - Set if this room is a general store
1709 'shop_general', 'Sh', 'commercial',
1710 '#F7FF65', # Light yellow
1711 'Room is a general store',
1712 # shop_weapon - Set if this room is a weapon shop
1713 'shop_weapon', 'Ws', 'commercial',
1714 '#F97F20', # Orange
1715 'Room is a weapon shop',
1716 # shop_armour - Set if this room is an armour shop
1717 'shop_armour', 'Wa', 'commercial',
1718 '#DA440C', # Slightly darker orange
1719 'Room is an armour shop',
1720 # shop_clothes - Set if this room is a clothes shop
1721 'shop_clothes', 'Wc', 'commercial',
1722 '#DAA10C', # Yellow-gold
1723 'Room is a clothes shop',
1724 # shop_player - Set if this room is a player-controlled shop
1725 'shop_player', 'Sy', 'commercial',
1726 '#FFA966', # Light orange
1727 'Room is a player-controlled shop',
1728 # shop_special - Set if this room is some other kind of shop
1729 'shop_special', 'Ss', 'commercial',
1730 '#3AFF34', # Green
1731 'Room is another kind of shop',
1732 # shop_empty - Set if this room is an empty shop
1733 'shop_empty', 'Se', 'commercial',
1734 '#8DFF89', # Pale greeen
1735 'Room is an empty shop',
1736 # smithy - Set if this room is a smithy
1737 'smithy', 'Sm', 'commercial',
1738 '#D58111', # Light brown
1739 'Room is a smithy',
1740 # bank - Set if this room is a bank
1741 'bank', 'Bn', 'commercial',
1742 '#8E0E3F', # Purple
1743 'Room is a bank',
1744 # pub - Set if this room is some kind of pub
1745 'pub', 'Pb', 'commercial',
1746 '#1730F5', # Blue
1747 'Room is a pub',
1748 # cafe - Set if this room is some kind of cafeteria (like a pub, but with non-
1749 # alcoholic drinks)
1750 'cafe', 'Cf', 'commercial',
1751 '#3196CA', # Dark cyan
1752 'Room is a cafeteria',
1753 # restaurant - Set if this room is some kind of restaurant (where the character can
1754 # eat)
1755 'restaurant', 'Re', 'commercial',
1756 '#487F9B', # Murky blue
1757 'Room is a restaurant',
1758 # takeaway - Set if this room is some kind of takeaway (where the character can
1759 # buy food to carry)
1760 'takeaway', 'Ta', 'commercial',
1761 '#A9C1F4', # Very light blue
1762 'Room is a takeaway',
1763 # auction - Set if this room is an auction house
1764 'auction', 'Au', 'commercial',
1765 '#CA1E4D', # Red
1766 'Room is an auction house',
1767 # post_office - Set if this room is a post office
1768 'post_office', 'Po', 'commercial',
1769 '#8CB583', # Dull green
1770 'Room is a post office',
1771  
1772 # Buildings
1773 # ---------
1774 # library - Set if this room is where books, parchments, signs, notice boards and so
1775 # on are available
1776 'library', 'Lb', 'buildings',
1777 '#DEF3CC', # Very pale green
1778 'Room is a library',
1779 # theatre - Set if this room is a theatre or performance venue
1780 'theatre', 'Th', 'buildings',
1781 '#2DD06C', # Turquoise
1782 'Room is a theatre',
1783 # temple - Set if this room is some kind of temple or shrine
1784 'temple', 'Te', 'buildings',
1785 '#7C6365', # Very dull red
1786 'Room is a temple',
1787 # church - Set if this room is a church or cathedral
1788 'church', 'Ch', 'buildings',
1789 '#C17D80', # Pale red
1790 'Room is a church/cathedral',
1791 # hotel - Set if this room is a hotel
1792 'hotel', 'Hl', 'buildings',
1793 '#B0B167', # Dull yellow
1794 'Room is a hotel',
1795 # storage - Set if this room is somewhere you can store things
1796 'storage', 'St', 'buildings',
1797 '#996712', # Green-brown
1798 'Room is a storage facility',
1799 # office - Set if this room is an office
1800 'office', 'Of', 'buildings',
1801 '#A36C6C', # Dull red
1802 'Room is an office',
1803 # jail - Set if this room is a jail or dungeon
1804 'jail', 'Jl', 'buildings',
1805 '#C46F47', # Pale brown
1806 'Room is a jail or dungeon',
1807 # hospital - Set if this room is some kind of hospital
1808 'hospital', 'Ho', 'buildings',
1809 '#ED0C60', # Red-purple
1810 'Room is a hospital',
1811 # stable - Set if this room is a room where animals are stored
1812 'stable', 'St', 'buildings',
1813 '#DF9F4B', # Straw orange
1814 'Room is a stable for animals',
1815 # tent - Set if this room is inside a tent
1816 'tent', 'Tt', 'buildings',
1817 '#D2B380', # Canvas
1818 'Room is a tent',
1819 # house - Set if this room is an ordinary house or home
1820 'house', 'Hs', 'buildings',
1821 '#3B7E55', # Dark green
1822 'Room is a house or home',
1823 # ord_building - Set if this room is an ordinary building
1824 'ord_building', 'Ob', 'buildings',
1825 '#82E1CA', # Light cyan
1826 'Room is an ordinary building',
1827 # bulletin_board - Set if this room contains some kind of bulletin board
1828 'bulletin_board', 'Bb', 'buildings',
1829 '#A47AB8', # Light purple
1830 'Room contains a bulletin board',
1831  
1832 # Structures
1833 # ----------
1834 # building - Set if this is any kind of building
1835 'building', 'Bu', 'structures',
1836 '#B7764F', # Pale brown
1837 'Room is any kind of building',
1838 # gate - Set if this is at (or outside) a city gate
1839 'gate', 'Ga', 'structures',
1840 '#87BDC6', # Pale blue
1841 'Room is at a city gate',
1842 # wall - Set if this is on (or alongside) a city wall
1843 'wall', 'Wl', 'structures',
1844 '#C9D3D5', # Blue-grey
1845 'Room is on/outside a city wall',
1846 # tower - Set if this is on (or inside) a tower
1847 'tower', 'Tw', 'structures',
1848 '#B1A27F', # Dull yellow
1849 'Room is on/inside a tower',
1850 # staircase - Set if this is on a staircase
1851 'staircase', 'Sc', 'structures',
1852 '#FFB47C', # Sandy yellow
1853 'Room is on a staircase',
1854 # tunnel - Set if this is in a tunnel
1855 'tunnel', 'Tu', 'structures',
1856 '#C4897D', # Dull pink
1857 'Room is in a tunnel',
1858 # bridge - Set if this is a on a bridge
1859 'bridge', 'Br', 'structures',
1860 '#A9631F', # Brown
1861 'Room is on a bridge',
1862 # fountain - Set if this room has a fountain
1863 'fountain', 'Fn', 'structures',
1864 '#35BDD8', # Bright blue
1865 'Room contains a fountain',
1866 # well - Set if this is a well or water source
1867 'well', 'We', 'structures',
1868 '#76A1D3', # Light blue
1869 'Room is a well',
1870 # farm - Set if this is a farm
1871 'farm', 'Fa', 'structures',
1872 '#A84100', # Brown
1873 'Room is on a farm',
1874 # field - Set if this is a field
1875 'field', 'Fi', 'structures',
1876 '#75B256', # Paler green
1877 'Room is in a field',
1878 # park - Set if this is a park/garden
1879 'park', 'Pa', 'structures',
1880 '#00FF00', # (Pure) green
1881 'Room is in a garden/park',
1882 # graveyard - Set if this is a graveyard
1883 'graveyard', 'Gy', 'structures',
1884 '#CBA5AE', # Dull pink
1885 'Room is in a graveyard',
1886 # port - Set if this is a port/harbour/jetty
1887 'port', 'Pt', 'structures',
1888 '#117311', # Bottle green
1889 'Room is in a port/harbour/jetty',
1890 # maze - Set if this is a maze
1891 'maze', 'Mz', 'structures',
1892 '#D30027', # Headache red
1893 'Room is in a maze',
1894  
1895 # Terrain
1896 # -------
1897 # forest - Set if this is a forest/wood
1898 'forest', 'Fo', 'terrain',
1899 '#227122', # Dark green
1900 'Room is in a forest/wood',
1901 # clearing - Set if this is a clearing
1902 'clearing', 'Cl', 'terrain',
1903 '#68E568', # Pale green
1904 'Room is a clearing',
1905 # grassland - Set if this is a grassland/plain
1906 'grassland', 'Gl', 'terrain',
1907 '#BFED57', # Yellow-green
1908 'Room is in a grassland/plain',
1909 # swamp - Set if this is a swamp/marsh
1910 'swamp', 'Sw', 'terrain',
1911 '#6F9956', # Dirty green
1912 'Room is in a swamp/marsh',
1913 # desert - Set if this is a desert
1914 'desert', 'De', 'terrain',
1915 '#F5F72B', # Yellow
1916 'Room is in a desert',
1917 # beach - Set if this is a beach/coast
1918 'beach', 'Be', 'terrain',
1919 '#F7922B', # Red-orange
1920 'Room is on a beach/coastline',
1921 # river - Set if this is a river/stream
1922 'river', 'Rv', 'terrain',
1923 '#61C3EB', # Light blue
1924 'Room is in a river/stream',
1925 # lake - Set if this is a lake
1926 'lake', 'Lk', 'terrain',
1927 '#A9E6FF', # Very light blue
1928 'Room is in a lake',
1929 # sea - Set if this is a sea/ocean
1930 'sea', 'Se', 'terrain',
1931 '#216D8C', # Darker blue
1932 'Room is in a sea/ocean',
1933 # cave - Set if this is a cave
1934 'cave', 'Cv', 'terrain',
1935 '#849DAD', # Grey-blue
1936 'Room is in a cave',
1937 # mountain - Set if this is a mountainous area
1938 'mountain', 'Mn', 'terrain',
1939 '#CDDDE7', # Blue-white
1940 'Room is in a mountainous area',
1941 # rocky - Set if this is rocky landscape
1942 'rocky', 'Rc', 'terrain',
1943 '#C5AC95', # Brown-grey
1944 'Room is in a rocky landscape',
1945 # icy - Set if this is icy landscape
1946 'icy', 'Ic', 'terrain',
1947 '#96BFC3', # Very pale blue
1948 'Room is in an icy landscape',
1949 # hill - Set if this is a hill
1950 'hill', 'Hi', 'terrain',
1951 '#7ADA97', # Light green
1952 'Room is on a hill',
1953 # pit - Set if this is next to (or inside) a pit or hole
1954 'pit', 'Pi', 'terrain',
1955 '#A7B179', # Dull yellow-green
1956 'Room is in a pit or contains one',
1957  
1958 # Objects
1959 # -------
1960 # weapon - Set if the room contains a weapon
1961 'weapon', 'Wp', 'objects',
1962 '#A87389', # Pale purple
1963 'Room contains a weapon',
1964 # armour - Set if the room contains an armour
1965 'armour', 'Ar', 'objects',
1966 '#82405C', # Dark pale purple
1967 'Room contains an armour',
1968 # garment - Set if the room contains a garment
1969 'garment', 'Gr', 'objects',
1970 '#FF74AE', # Purple-pink
1971 'Room contains a garment',
1972 # major_npc - Set if the room contains an important NPC
1973 'major_npc', 'Np', 'objects',
1974 '#3BCC2F', # Green
1975 'Room contains an important NPC',
1976 # talk_npc - Set if the room contains a talking NPC
1977 'talk_npc', 'Tn', 'objects',
1978 '#086800', # Dark green
1979 'Room contains a talking NPC',
1980 # npc - Set if the room contains any NPC
1981 'npc', 'Np', 'objects',
1982 '#7FEE75', # Light green
1983 'Room contains an NPC',
1984 # portable - Set if the room contains a portable object
1985 'portable', 'Pr', 'objects',
1986 '#262FD8', # Dark blue
1987 'Room contains a portable object',
1988 # decoration - Set if the room contains a decoration object
1989 'decoration', 'Dc', 'objects',
1990 '#10EBA1', # Light cyan
1991 'Room contains a decoration object',
1992 # money - Set if the room contains money
1993 'money', 'My', 'objects',
1994 '#FFE63B', # Gold
1995 'Room contains money',
1996 # treasure - Set if the room contains a valuable object
1997 'treasure', 'Tr', 'objects',
1998 '#FF673B', # Red-orange
1999 'Room treasure or valuable objects',
2000 # collectable - Set if the room contains a collectable object
2001 'collectable', 'Cl', 'objects',
2002 '#FF9900', # Orange
2003 'Room contains collectable objects',
2004  
2005 # Light
2006 # -----
2007 # outside - Set if this room is outside
2008 'outside', 'Ou', 'light',
2009 '#77C4E4', # Sky blue
2010 'Room is outside',
2011 # inside - Set if this room is inside
2012 'inside', 'In', 'light',
2013 '#D38D36', # Light brown
2014 'Room is inside',
2015 # overground - Set if this room is above ground
2016 'overground', 'Ov', 'light',
2017 '#36D355', # Green
2018 'Room is above ground',
2019 # underground - Set if this room is underground
2020 'underground', 'Un', 'light',
2021 '#CDCDCD', # Grey
2022 'Room is underground',
2023 # torch - Set if average player needs a torch in this room
2024 'torch', 'To', 'light',
2025 '#E1D139', # Yellow
2026 'Room usually needs a torch',
2027 # always_dark - Set if this room is always dark
2028 'always_dark', 'Ad', 'light',
2029 '#977E6A', # Pale brown
2030 'Room is always dark',
2031  
2032 # Guilds
2033 # ------
2034 # guild_entrance - Set if this room is an entrance to a guild (possibly guarded)
2035 'guild_entrance', 'Ge', 'guilds',
2036 '#8F2AF9', # Purple-blue
2037 'Entrance to a guild',
2038 # guild_main - Set if this is a room inside the guild where a character can advance
2039 # skills and/or join the guild
2040 'guild_main', 'Gm', 'guilds',
2041 '#DAA0FB', # Light purple
2042 'Guild room for advancing skills',
2043 # guild_practice - Set if this room is where a character can practice guild skills
2044 'guild_practice', 'Gp', 'guilds',
2045 '#DB0C89', # Red-purple
2046 'Guild room for practicing skills',
2047 # guild_shop - Set if this is a room inside the guild where a character can buy
2048 # guild-specific items
2049 'guild_shop', 'Gs', 'guilds',
2050 '#CE4DF7', # Purple
2051 'Guild room for shopping',
2052 # guild_other - Set if this is a room inside the guild where a character can't
2053 # advance skills or buy guild-specific items
2054 'guild_other', 'Go', 'guilds',
2055 '#89679C', # Grey-purple
2056 'Other kind of guild room',
2057  
2058 # Quests
2059 # ------
2060 # quest_room - Set if this room is important in a quest
2061 'quest_room' , 'Qr', 'quests',
2062 '#F4E637', # Yellow
2063 'Room used in quest',
2064 # quest_begin - Set if this room is the start of a quest
2065 'quest_begin', 'Qb', 'quests',
2066 '#58FF57', # Green
2067 'Quest begins in room',
2068 # quest_end - Set if this room is the end of a quest
2069 'quest_end', 'Qe', 'quests',
2070 '#FF6957', # Red
2071 'Quest ends in room',
2072  
2073 # Attacks
2074 # -------
2075 # peaceful - Set if the world doesn't allow fights in this room
2076 'peaceful', 'Pf', 'attacks',
2077 '#9CE3DD', # Light cyan
2078 'World forbids attacks in room',
2079 # recovery - Set if this room lets the character recover from fights more quickly
2080 'recovery', 'Ry', 'attacks',
2081 '#E9DC3D', # Yellow
2082 'Character recovers quickly in room',
2083 # char_dead - Set if any character has ever died in this room
2084 'char_dead', 'Cd', 'attacks',
2085 '#FF361E', # Red
2086 'Any character has died in room',
2087 # char_pass_out - Set if any character has ever been knocked out in this room
2088 'char_pass_out', 'Cp', 'attacks',
2089 '#ED22BE', # Purple
2090 'Any character has passed out in room',
2091 ],
2092 # Constant registry hash of room flags which mark the room as hazardous; the pathfinding
2093 # functions (or any other code) can avoid these rooms when finding the shortest path
2094 # between two rooms
2095 constRoomHazardHash => {
2096 'blocked_room' => undef,
2097 'avoid_room' => undef,
2098 'danger', => undef,
2099 'mortal_danger' => undef,
2100 'dummy_room' => undef,
2101 },
2102 # Constant registry hash of room flags for which exits should be drawn, when
2103 # GA::Obj::WorldModel->obscuredExitFlag is TRUE
2104 constRoomNoObscuredHash => {
2105 'blocked_room' => undef,
2106 'avoid_room' => undef,
2107 'mortal_danger' => undef,
2108 'danger' => undef,
2109 'world_centre' => undef,
2110 'world_start' => undef,
2111 'meet_point' => undef,
2112 'main_route' => undef,
2113 'minor_route' => undef,
2114 'cross_route' => undef,
2115 'arrow_route' => undef,
2116 'wrong_route' => undef,
2117 'portal' => undef,
2118 'sign_post' => undef,
2119 },
2120  
2121 # Constant hash of valid model object types (all of which inherit from
2122 # GA::Generic::ModelObj; the type matches the object's ->category IV). Hash in the
2123 # form
2124 # $constModelTypeHash{type} = undef;
2125 constModelTypeHash => {
2126 'region' => undef,
2127 'room' => undef,
2128 'weapon' => undef,
2129 'armour' => undef,
2130 'garment' => undef,
2131 'char' => undef,
2132 'minion' => undef,
2133 'sentient' => undef,
2134 'creature' => undef,
2135 'portable' => undef,
2136 'decoration' => undef,
2137 'custom' => undef,
2138 },
2139 # Constant list of standard primary directions, in a fixed order
2140 constPrimaryDirList => [
2141 'north',
2142 'northnortheast',
2143 'northeast',
2144 'eastnortheast',
2145 'east',
2146 'eastsoutheast',
2147 'southeast',
2148 'southsoutheast',
2149 'south',
2150 'southsouthwest',
2151 'southwest',
2152 'westsouthwest',
2153 'west',
2154 'westnorthwest',
2155 'northwest',
2156 'northnorthwest',
2157 'up',
2158 'down',
2159 ],
2160 # Constant list of standard primary directions, but with the secondary-intercardinal
2161 # directions removed
2162 constShortPrimaryDirList => [
2163 'north',
2164 'northeast',
2165 'east',
2166 'southeast',
2167 'south',
2168 'southwest',
2169 'west',
2170 'northwest',
2171 'up',
2172 'down',
2173 ],
2174 # Constant hash of standard primary directions, but with the secondary-intercardinal
2175 # directions removed
2176 constShortPrimaryDirHash => {
2177 'north' => undef,
2178 'northeast' => undef,
2179 'east' => undef,
2180 'southeast' => undef,
2181 'south' => undef,
2182 'southwest' => undef,
2183 'west' => undef,
2184 'northwest' => undef,
2185 'up' => undef,
2186 'down' => undef,
2187 },
2188 # Constant hash of standard primary directions and their opposites (used mostly by the
2189 # automapper functions). Hash in the form
2190 # $constOppDirHash{standard_direction} = opposite_standard_direction
2191 constOppDirHash => {
2192 'north' => 'south',
2193 'northnortheast' => 'southsouthwest',
2194 'northeast' => 'southwest',
2195 'eastnortheast' => 'westsouthwest',
2196 'east' => 'west',
2197 'eastsoutheast' => 'westnorthwest',
2198 'southeast' => 'northwest',
2199 'southsoutheast' => 'northnorthwest',
2200 'south' => 'north',
2201 'southsouthwest' => 'northnortheast',
2202 'southwest' => 'northeast',
2203 'westsouthwest' => 'eastnortheast',
2204 'west' => 'east',
2205 'westnorthwest' => 'eastsoutheast',
2206 'northwest' => 'southeast',
2207 'northnorthwest' => 'southsoutheast',
2208 'up' => 'down',
2209 'down' => 'up',
2210 },
2211 # Constant registry list of room statement component types (matching
2212 # GA::Obj::Component->type)
2213 constComponentTypeList => [
2214 'anchor',
2215 'verb_title', 'verb_descrip', 'verb_exit', 'verb_content', 'verb_special',
2216 'brief_title', 'brief_exit', 'brief_title_exit', 'brief_exit_title',
2217 'brief_content',
2218 'room_cmd',
2219 'mudlib_path',
2220 'weather',
2221 'ignore_line',
2222 'custom',
2223 ],
2224 # Constant hash of exit states (acceptable values for GA::Obj::Exit->exitState)
2225 # NB This hash doesn't include 'ignore', or any custom strings specified by
2226 # GA::Profile::World->exitStateTagHash
2227 # NB For an explanation of what each value means, see the comments in GA::Obj::Exit->new
2228 constExitStateHash => {
2229 'normal' => undef,
2230 'open' => undef,
2231 'closed' => undef,
2232 'locked' => undef,
2233 'secret' => undef,
2234 'secret_open' => undef,
2235 'secret_closed' => undef,
2236 'secret_locked' => undef,
2237 'impass' => undef,
2238 'dark' => undef,
2239 'danger' => undef,
2240 'emphasis' => undef,
2241 'other' => undef,
2242 # 'ignore' => undef,
2243 },
2244 # Object parsing sanity check (in case someone creates a room containing a billion
2245 # hobbits) - maximum number of world model objects created in response by
2246 # GA::Obj::WorldModel->parseObj()
2247 # (The 999 value communicates to the user that the number has been reduced)
2248 constParseObjMax => 999,
2249  
2250 # Cages
2251 # -----
2252  
2253 # 'Cages' are associated with a 'profile'
2254 # For example, the command cage lists common commands at a particular world (the verbs
2255 # for 'kill', 'look', 'inventory', and so on)
2256 # If the cage is associated with the current world profile, those commands are
2257 # considered to be available to all characters. However, if the cage is associated
2258 # with (for example) a guild profile, those commands are considered to be available
2259 # only to members of that guild
2260 # Parts of Axmud code - most usually, tasks and Axbasic scripts - can choose to have
2261 # their commands modified, or 'interpolated', before being sent to the world. For
2262 # example, if a task wants to send the command 'kill', it looks through the command
2263 # cages for each current profile - starting with the highest-priority profile - and
2264 # uses the first 'kill' command it finds
2265 # Besides the command cage, there are standard cage which store each kind of interface
2266 # (triggers, aliases, macros, timers and hooks). It's also possible for the user to
2267 # design their own cages
2268 #
2269 # Constant registry list of cage types (these values never change)
2270 constCageTypeList => [
2271 'cmd',
2272 'trigger',
2273 'alias',
2274 'macro',
2275 'timer',
2276 'hook',
2277 'route',
2278 ],
2279 # Customisable registry list of cage types (max 8 chars)
2280 cageTypeList => [], # Set below
2281  
2282 # Dictionaries
2283 # ------------
2284  
2285 # Axmud Dictionaries contain lists of words so that Axmud can tell apart directions,
2286 # NPCs, weapons, torches, and so on
2287 # If the dictionary object has the same name as a world, it's automatically associated
2288 # with that world. (Dictionaries don't have to be associated with a particular world,
2289 # but they often are)
2290 # Dictionaries are associated with a particular language. The default language is
2291 # English
2292 #
2293 # Registry hash of dictionary objects that have been loaded since the script started,
2294 # in the form
2295 # $dictHash{unique_dictionary_name} = blessed_reference_to_dictionary_object
2296 dictHash => {}, # [dicts]
2297 # As well as dictionaries, Axmud uses a much smaller collection of data, a phrasebook
2298 # object, containing a list of primary directions, articles, conjunctions and basic
2299 # number words in a target language. The data is stored in a GA::Obj::Phrasebook
2300 # object
2301 # Registry hash in the form
2302 # $constPhrasebookHash{'name'} = blessed_reference_to_phrasebook_object
2303 # ...where 'name' is the the language name, rendered in lower-case English
2304 # (e.g. 'french')
2305 constPhrasebookHash => {},
2306  
2307 # Interfaces
2308 # ----------
2309  
2310 # Interfaces are triggers, aliases, macros, timers and hooks
2311 # Interface model objects store default values for each of these interfaces
2312 # Registry hash of interface model objects, in the form
2313 # $interfaceModelHash{interface_type} = blessed_reference_to_interface_model_object
2314 interfaceModelHash => {},
2315  
2316 # A 'clipboard' into which interfaces can be exported, and from which they can be
2317 # imported. This allows the user to easily copy interfaces from (for example) one
2318 # world to another, when sessions are open for both
2319 # A list of GA::Interface::Trigger, GA::Interface::Alias, GA::Interface::Macro,
2320 # GA::Interface::Timer and/or GA::Interface::Hook objects currently stored in the
2321 # 'clipboard'
2322 interfaceClipboardList => [],
2323  
2324 # Macros use keycodes - ways of naming keys on the keyboard (F1, Escape, grave etc)
2325 # Axmud uses a standard set of keycodes that don't vary from system to system. For
2326 # example, on Linux the ALT-GR key produces the keycode 'ISO_Level3_Shift', but on
2327 # MS Windows, it produces the keycode 'Alt_R'. Axmud's standard keycode is 'alt_gr'
2328 # Note that there are no Axmud standard keycodes for ordinary letters/numbers; Axmud
2329 # assumes that these are needed for typing, so they're not available to macros
2330 #
2331 # Constant registry hash of Axmud standard keycode values, and their Linux equivalents.
2332 # Hash in the form
2333 # $constKeycodeHash{standard_value} = linux_value_string
2334 # ...where 'standard_value' is a value used by Axmud to uniquely identify a key or
2335 # key combination, and 'linux_value_string' is the corresponding keycode returned by
2336 # Linux (when there is more than one corresponding keycode, they are in a single
2337 # string, separated by a space)
2338 constKeycodeHash => {
2339 shift => 'Shift_L Shift_R',
2340 alt => 'Alt_L',
2341 alt_gr => 'ISO_Level3_Shift',
2342 ctrl => 'Control_L Control_R',
2343 num_lock => 'Num_Lock',
2344  
2345 escape => 'Escape',
2346 pause => 'Pause',
2347 break => 'Break',
2348 insert => 'Insert KP_Insert',
2349 delete => 'Delete KP_Delete',
2350 return => 'Return',
2351 backspace => 'BackSpace',
2352 space => 'space',
2353 tab => 'Tab',
2354  
2355 home => 'Home KP_Home',
2356 page_up => 'Page_Up KP_Page_Up',
2357 page_down => 'Page_Down KP_Page_Down',
2358 end => 'End KP_End',
2359  
2360 up => 'Up KP_Up',
2361 down => 'Down KP_Down',
2362 left => 'Left KP_Left',
2363 right => 'Right KP_Right',
2364  
2365 f1 => 'F1',
2366 f2 => 'F2',
2367 f3 => 'F3',
2368 f4 => 'F4',
2369 f5 => 'F5',
2370 f6 => 'F6',
2371 f7 => 'F7',
2372 f8 => 'F8',
2373 f9 => 'F9',
2374 f10 => 'F10',
2375 f11 => 'F11',
2376 f12 => 'F12',
2377  
2378 grave => 'grave', # `
2379 tilde => 'asciitilde', # ~
2380 exclam => 'exclam', # !
2381 at => 'at', # @
2382 number_sign => 'numbersign', # #
2383 dollar => 'dollar', # $
2384 percent => 'percent', # %
2385 ascii_circum => 'asciicircum', # ^
2386 ampersand => 'ampersand', # &
2387 asterisk => 'asterisk', # *
2388 paren_left => 'parenleft', # (
2389 paren_right => 'parenright', # )
2390  
2391 plus => 'plus', # +
2392 minus => 'minus', # -
2393 equal => 'equal', # =
2394 underline => 'underscore', # _
2395  
2396 bracket_left => 'bracketleft', # [
2397 bracket_right => 'bracketright', # ]
2398 brace_left => 'braceleft', # {
2399 brace_right => 'braceright', # }
2400 colon => 'colon', # :
2401 semicolon => 'semicolon', # ;
2402 apostrophe => 'apostrophe', # '
2403 quote => 'quotedbl', # "
2404 slash => 'slash', # /
2405 backslash => 'backslash', # \
2406 pipe => 'bar', # |
2407 comma => 'comma', # ,
2408 full_stop => 'period', # .
2409 less_than => 'less', # <
2410 greater_than => 'greater', # >
2411 question_mark => 'question', # ?
2412  
2413 # Keypad - NUM LOCK on
2414 kp_0 => 'KP_0',
2415 kp_1 => 'KP_1',
2416 kp_2 => 'KP_2',
2417 kp_3 => 'KP_3',
2418 kp_4 => 'KP_4',
2419 kp_5 => 'KP_5',
2420 kp_6 => 'KP_6',
2421 kp_7 => 'KP_7',
2422 kp_8 => 'KP_8',
2423 kp_9 => 'KP_9',
2424 kp_add => 'KP_Add',
2425 kp_subtract => 'KP_Subtract',
2426 kp_multiply => 'KP_Multiply',
2427 kp_divide => 'KP_Divide',
2428 kp_enter => 'KP_Enter',
2429 kp_full_stop => 'KP_Decimal',
2430 },
2431 # We also use a constant registry hash of Axmud standard keycode values and their
2432 # equivalents in MS Windows and in *BSD. Only keycodes which are different to those
2433 # above are listed
2434 constMSWinKeycodeHash => {
2435 alt_gr => 'Alt_R',
2436 ctrl => 'Control_L',
2437 num_lock => '',
2438 },
2439 constBSDKeycodeHash => {
2440 ctrl => 'Control_L',
2441 num_lock => '',
2442 },
2443 # Custom hash of Axmud standard keycodes and their equivalents on the current system
2444 keycodeHash => {}, # Set by $self->setupKeycodes
2445 # The reverse hash of $self->keycodeHash, which therefore contains more keys, e.g.
2446 # $keycodeHash{'up'} = 'Up KP_Up'
2447 # $revKeycodeHash{'Up'} = 'up'
2448 # $revKeycodeHash{'KP_Up'} = 'up'
2449 revKeycodeHash => {}, # Set by $self->setupKeycodes
2450 # Constant registry hash of alternatives to Axmud standard keycode values. Includes
2451 # variants without capitals (e.g. transforms 'backspace' into 'backSpace') and
2452 # American English variants (e.g. transforms 'period' into 'full_stop')
2453 # Hash in the form
2454 # $constAltKeycodeHash{variant_value} = standard_value
2455 # ...where 'standard_value' matches a key in $self->constKeycodeHash
2456 constAltKeycodeHash => {
2457 altgr => 'alt_gr',
2458 pageup => 'page_up',
2459 pagedown => 'page_down',
2460 numbersign => 'number_sign',
2461 asciicircum => 'ascii_circum',
2462 parenleft => 'paren_left',
2463 parenright => 'paren_right',
2464 bracketleft => 'bracket_left',
2465 bracketright => 'bracket_right',
2466 braceleft => 'brace_left',
2467 braceright => 'brace_right',
2468 bar => 'pipe',
2469 fullstop => 'full_stop',
2470 period => 'full_stop',
2471 lessthan => 'less_than',
2472 less => 'less_than',
2473 greaterthan => 'greater_than',
2474 greater => 'greater_than',
2475 questionmark => 'question_mark',
2476 underscore => 'underline',
2477 },
2478 # Constant list of Axmud standard keycode values in a fixed order, each item a key in
2479 # $self->constKeycodeHash
2480 constKeycodeList => [
2481 'shift', 'alt', 'alt_gr', 'ctrl', 'num_lock',
2482 'escape', 'pause', 'break', 'insert', 'delete', 'return', 'backspace', 'space',
2483 'tab',
2484 'home', 'page_up', 'page_down', 'end',
2485 'up', 'down', 'left', 'right',
2486 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'f10', 'f11', 'f12',
2487 'grave', 'tilde', 'exclam', 'at', 'number_sign', 'dollar', 'percent',
2488 'ascii_circum', 'ampersand', 'asterisk', 'paren_left', 'paren_right',
2489 'plus', 'minus', 'equal', 'underline',
2490 'bracket_left', 'bracket_right', 'brace_left', 'brace_right', 'colon', 'semicolon',
2491 'apostrophe', 'quote', 'slash', 'backslash', 'pipe', 'comma', 'full_stop',
2492 'less_than', 'greater_than', 'question_mark',
2493 'kp_0', 'kp_1', 'kp_2', 'kp_3', 'kp_4', 'kp_5', 'kp_6', 'kp_7', 'kp_8', 'kp_9',
2494 'kp_add', 'kp_subtract', 'kp_multiply', 'kp_divide', 'kp_enter',
2495 'kp_full_stop',
2496 ],
2497 # Registry hash of keycodes that are used by any active macro interface in any session
2498 # (used in addition to the session's own registries, because every time a key is
2499 # pressed, we want to know - as quickly as possible - whether we should check it
2500 # against all interactive macros in all sessions). Hash in the form
2501 # $activeKeycodeHash{standard_keycode} = undef
2502 activeKeycodeHash => {},
2503 # When an active macro interface is deleted, $self->activeKeycodeHash needs to be
2504 # reset. If several hundred interfaces are deleted in one go, it would be a bad idea
2505 # to reset the registry several hundred times. Instead, this flag is set to TRUE.
2506 # Whichever GA::Session is the first to have its timer loop spin, is the one to call
2507 # $self->reset_activeKeycodes, which re-compiles the registry
2508 resetKeycodesFlag => FALSE,
2509  
2510 # Tasks
2511 # -----
2512  
2513 # Axmud keeps two lists of the package names for tasks - one for Axmud's built-in tasks,
2514 # and another for all tasks (built-in tasks and those added via a plugin)
2515 #
2516 # The constant registry hash of package names (these values never change). A hash in the
2517 # form
2518 # $constTaskPackageHash{task_standard_name} = package_name
2519 # e.g. task_standard_name = StatusTask->name,
2520 # package_name = 'Games::Axmud::Task::Status'
2521 constTaskPackageHash => {
2522 'advance_task' => 'Games::Axmud::Task::Advance',
2523 'attack_task' => 'Games::Axmud::Task::Attack',
2524 'channels_task' => 'Games::Axmud::Task::Channels',
2525 'chat_task' => 'Games::Axmud::Task::Chat',
2526 'compass_task' => 'Games::Axmud::Task::Compass',
2527 'condition_task' => 'Games::Axmud::Task::Condition',
2528 'connections_task' => 'Games::Axmud::Task::Connections',
2529 'countdown_task' => 'Games::Axmud::Task::Countdown',
2530 'divert_task' => 'Games::Axmud::Task::Divert',
2531 'frame_task' => 'Games::Axmud::Task::Frame',
2532 'inventory_task' => 'Games::Axmud::Task::Inventory',
2533 'launch_task' => 'Games::Axmud::Task::Launch',
2534 'locator_task' => 'Games::Axmud::Task::Locator',
2535 'map_check_task' => 'Games::Axmud::Task::MapCheck',
2536 'notepad_task' => 'Games::Axmud::Task::Notepad',
2537 'raw_text_task' => 'Games::Axmud::Task::RawText',
2538 'raw_token_task' => 'Games::Axmud::Task::RawToken',
2539 'script_task' => 'Games::Axmud::Task::Script',
2540 'status_task' => 'Games::Axmud::Task::Status',
2541 'system_task' => 'Games::Axmud::Task::System',
2542 'tasklist_task' => 'Games::Axmud::Task::TaskList',
2543 'watch_task' => 'Games::Axmud::Task::Watch',
2544 },
2545 # The customisable registry hash of package names, in the form
2546 # $taskPackageHash{task_standard_name} = package_name
2547 # e.g. task_standard_name = $myTask->name,
2548 # package_name = 'Games::Axmud::Task::MyTask',
2549 taskPackageHash => {}, # Set below
2550 #
2551 # Axmud keeps some shorthand forms ('labels') of the standard/external tasks for the
2552 # user to type - one for standard tasks (e.g. 'tasklist', 'stat') and another for all
2553 # tasks (max length 32 characters)
2554 #
2555 # Constant registry hash of task labels (these values never change). A hash in the form
2556 # $constTaskLabelHash{label} = task_standard_name
2557 constTaskLabelHash => {
2558 'adv' => 'advance_task',
2559 'advance' => 'advance_task',
2560 'att' => 'attack_task',
2561 'attack' => 'attack_task',
2562 'chan' => 'channels_task',
2563 'channel' => 'channels_task',
2564 'channels' => 'channels_task',
2565 'chat' => 'chat_task',
2566 'comp' => 'compass_task',
2567 'compass' => 'compass_task',
2568 'cond' => 'condition_task',
2569 'condition' => 'condition_task',
2570 'conn' => 'connections_task',
2571 'connect' => 'connections_task',
2572 'connections' => 'connections_task',
2573 'cd' => 'countdown_task',
2574 'count' => 'countdown_task',
2575 'countdown' => 'countdown_task',
2576 'div' => 'divert_task',
2577 'divert' => 'divert_task',
2578 'frame' => 'frame_task',
2579 'inv' => 'inventory_task',
2580 'invent' => 'inventory_task',
2581 'inventory' => 'inventory_task',
2582 'launch' => 'launch_task',
2583 'launcher' => 'launch_task',
2584 'loc' => 'locator_task',
2585 'locator' => 'locator_task',
2586 'mc' => 'map_check_task',
2587 'map' => 'map_check_task',
2588 'mapcheck' => 'map_check_task',
2589 'note' => 'notepad_task',
2590 'notes' => 'notepad_task',
2591 'notepad' => 'notepad_task',
2592 'raw' => 'raw_text_task',
2593 'rawtext' => 'raw_text_task',
2594 'token' => 'raw_token_task',
2595 'rawtoken' => 'raw_token_task',
2596 'scr' => 'script_task',
2597 'script' => 'script_task',
2598 'stat' => 'status_task',
2599 'status' => 'status_task',
2600 'sys' => 'system_task',
2601 'system' => 'system_task',
2602 'task' => 'tasklist_task',
2603 'tasks' => 'tasklist_task',
2604 'tasklist' => 'tasklist_task',
2605 'watch' => 'watch_task',
2606 },
2607 # Customisable registry hash of task labels, in the form
2608 # $taskLabelHash{label} = task_standard_name
2609 taskLabelHash => {}, # [tasks] Set below
2610 #
2611 # Sometimes one type of task needs to run before, or after, other types of task
2612 # This list of tasks is run before any others. If there are two or more copies of a
2613 # task type running and they appear on the list, they will run together, one after the
2614 # other, before others types of task
2615 # There are two runlists - a list of tasks to run FIRST, and a list of tasks to be
2616 # run LAST. Every item on the runlist must be the task's formal name, ->name
2617 #
2618 # The constant task runlists (these values never change)
2619 constTaskRunFirstList => [
2620 'status_task', # First task on list is the first to be run
2621 'locator_task'
2622 ],
2623 constTaskRunLastList => [
2624 'tasklist_task', # First task on list the last to be run
2625 ],
2626 # User-customisable task runlists
2627 taskRunFirstList => [], # [tasks] Set below
2628 taskRunLastList => [], # [tasks] Set below
2629 #
2630 # Counts used for giving unique names to tasks (not used for custom tasks)
2631 # How many tasks have been started in total, across all sessions. Reset to 0 whenever
2632 # Axmud starts
2633 taskTotal => 0,
2634  
2635 # Registry hash of tasks that start in every session (when the character has logged in)
2636 # - the 'global initial tasklist' (each profile also has its own initial tasklist).
2637 # Hash in the form
2638 # $initTaskHash{unique_task_name} = blessed_reference_to_task_object
2639 initTaskHash => {}, # [tasks]
2640 # The order in which the tasks are started (not very important for tasks unless they
2641 # are Script tasks). List contains all the keys in $self->initTaskHash
2642 initTaskOrderList => [], # [tasks]
2643 # How many (global) initial tasks have been created in total. Reset to 0 only if a
2644 # config file is being created (or if the global initial tasklist becomes empty)
2645 initTaskTotal => 0, # [tasks]
2646  
2647 # Registry hash of customised tasks - the 'custom tasklist'. Each has a unique name
2648 # (max 16 chars, no reserved names) which the user can choose freely
2649 # ->customTaskHash{custom_task_name} = blessed_reference_to_task_object
2650 customTaskHash => {}, # [tasks]
2651  
2652 # Tasks have two types of IV - task settings (standard IVs for all tasks), and task
2653 # parameters (different IVs for all types of task)
2654 # Constant hash of task IVs that are task settings, not task parameters
2655 constTaskSettingsHash => {
2656 'session' => undef,
2657 'name' => undef,
2658 'prettyName' => undef,
2659 'uniqueName' => undef,
2660 'shortName' => undef,
2661 'customName' => undef,
2662 'category' => undef,
2663 'descrip' => undef,
2664 'taskType' => undef,
2665 'profName' => undef,
2666 'profCategory' => undef,
2667 'shortCutIV' => undef,
2668 'jealousyFlag' => undef,
2669 'requireLocatorFlag' => undef,
2670 'profSensitivityFlag' => undef,
2671 'storableFlag' => undef,
2672 'startTime' => undef,
2673 'checkTime' => undef,
2674 'endStatus' => undef,
2675 'endTime' => undef,
2676 'waitForTask' => undef,
2677 'delayTime' => undef,
2678 'shutdownFlag' => undef,
2679 'status' => undef,
2680 'resumeStatus' => undef,
2681 'activeFlag' => undef,
2682 'stage' => undef,
2683 'allowWinFlag' => undef,
2684 'requireWinFlag' => undef,
2685 'startWithWinFlag' => undef,
2686 'winPreferList' => undef,
2687 'winObj' => undef,
2688 'tableObj' => undef,
2689 'taskWinFlag' => undef,
2690 'taskWinEntryFlag' => undef,
2691 'winmap' => undef,
2692 'winUpdateFunc' => undef,
2693 'defaultTabObj' => undef,
2694 'monochromeFlag' => undef,
2695 'noScrollFlag' => undef,
2696 'ttsFlag' => undef,
2697 'ttsConfig' => undef,
2698 'ttsAttribHash' => undef,
2699 'ttsFlagAttribHash' => undef,
2700 'ttsAlertAttribHash' => undef,
2701 },
2702 # Constant hash of permissible values for a task's ->status IV
2703 constTaskStatusHash => {
2704 'no_exist' => undef,
2705 'wait_init' => undef,
2706 'wait_task_exist' => undef,
2707 'wait_task_no_exist' => undef,
2708 'wait_task_start_stop' => undef,
2709 'running' => undef,
2710 'paused' => undef,
2711 'finished' => undef,
2712 'reset' => undef,
2713 },
2714  
2715 # Scripts
2716 # -------
2717  
2718 # Registry hash of directories inside which Axbasic scripts are stored. When an Axbasic
2719 # script needs to be loaded, the '/data/scripts' directory is first checked; then
2720 # every directory in this list is checked, in order. The first directory which
2721 # contains an Axbasic script with the right name is loaded
2722 scriptDirList => [], # [scripts]
2723 # Registry hash of scripts that start in every session (when the character has logged
2724 # in) - the 'global initial scriptlist' (each profile also has its own initial
2725 # scriptlist) Hash in the form
2726 # $initScriptHash{script_name} = mode
2727 # ...where 'script_name' matches the file from which the script is loaded, and 'mode' is
2728 # set to one of the following values:
2729 # 'no_task' - run the script without a task
2730 # 'run_task' - run the script from within a task
2731 # 'run_task_win' - run the script from within a task, in 'forced window' mode
2732 initScriptHash => {}, # [scripts]
2733 # The order in which the scripts are started. List contains all the keys in
2734 # $self->initScriptHash
2735 initScriptOrderList => [], # [scripts]
2736  
2737 # Logging
2738 # -------
2739  
2740 # Axmud can log to several different logfiles, all of which are in the /logs
2741 # directory and its sub-directories (in the Axmud data directory, $DATA_DIR)
2742 #
2743 # Two logfiles are stored in the /logs directory itself:
2744 # 'main' - Logs everything displayed in the 'main' window, across all sessions
2745 # 'errors' - Logs all kinds of system error message (including debug, warning and
2746 # improper argument messages) across all sessions
2747 # Several logfiles are stored in /logs/standard:
2748 # 'system' - Logs every system message (from GA::Obj::TextView->showSystemText)
2749 # across all sessions
2750 # 'error' - Logs every system error message (from GA::Obj::TextView->showError)
2751 # across all sessions
2752 # 'warning' - Logs every system warning message (from
2753 # GA::Obj::TextView->showWarning) across all sessions
2754 # 'debug' - Logs every system debug message (from GA::Obj::TextView->showDebug)
2755 # across all sessions
2756 # 'improper' - Logs every system 'improper arguments' message (from
2757 # GA::Obj::TextView->showImproper) across all sessions
2758 # Several logfiles are stored in /logs/<current_world> by a GA::Session:
2759 # 'receive' - Logs all text received from the world in .../receive. Unlike other
2760 # logfiles, lines of text are not split by splitter triggers or
2761 # recognised command prompts. If $self->logImageFlag is TRUE, the
2762 # text also records processed images
2763 # 'display' - Logs all text received from the world after it's been modified by any
2764 # matching rewriter triggers (if any) in .../display
2765 # 'rooms' - Logs all room statements processed by the Locator task in .../rooms
2766 # 'descrips' - Logs all room descriptions processed by the Locator task in
2767 # .../descrips
2768 # 'contents' - Logs all room contents strings processed by the Locator task in
2769 # .../contents
2770 # 'attack' - Logs all attacks processed by the Attack task in .../attacks
2771 # 'divert' - Logs all text processed by the Divert task in .../divert
2772 # 'chat' - Logs all conversations with chat contacts in ../chat
2773 # Several logfiles are written to /logs/<current_world> by the Status task, when it
2774 # detects certain events:
2775 # 'sleep' - Logs lines leading up to the character falling asleep
2776 # 'passout' - Logs lines leading up to the character passing out
2777 # 'dead' - Logs lines leading up to the character's death
2778 #
2779 # Constant registry hash of the logfiles written by GA::Client, and whether they should
2780 # be written, in the form
2781 # $constLogPrefHash{log_file_type} = TRUE or FALSE
2782 constLogPrefHash => {
2783 'main' => FALSE,
2784 'errors' => TRUE,
2785 'system' => FALSE,
2786 'error' => TRUE,
2787 'warning' => TRUE,
2788 'debug' => TRUE,
2789 'improper' => TRUE,
2790 },
2791 # Registry hash of current log-writing preferences, in the form
2792 # $logPrefHash{type} = TRUE or FALSE
2793 logPrefHash => {}, # [config] Set below
2794 # Constant registry hash of the logfiles written by individual GA::Session objects, and
2795 # whether they should be written, in the form
2796 # $constLogSessionPrefHash{log_file_type} = TRUE or FALSE
2797 # Used to initialise ->logPrefHash in GA::Profile::World
2798 constSessionLogPrefHash => {
2799 'receive' => FALSE,
2800 'display' => TRUE,
2801 'rooms' => TRUE,
2802 'descrips' => TRUE,
2803 'contents' => TRUE,
2804 'attack' => FALSE,
2805 'channels' => TRUE,
2806 'chat' => TRUE,
2807 'divert' => TRUE,
2808 'sleep' => TRUE,
2809 'passout' => TRUE,
2810 'dead' => TRUE,
2811 },
2812 # A list of GA::Session logfiles in a standard order, for use in the world profile's
2813 # 'edit' window
2814 constSessionLogOrderList => [
2815 'receive', 'display', 'rooms', 'descrips','contents', 'attack', 'channels', 'chat',
2816 'divert', 'sleep', 'passout', 'dead',
2817 ],
2818  
2819 # Parallel hash of short descriptions for each type of logfile, for use in the
2820 # client's 'pref' window and the world profile's 'edit' window
2821 constLogDescripHash => {
2822 # GA::Client
2823 'main'
2824 => 'Logs everything displayed in the \'main\' window, across all sessions',
2825 'errors'
2826 => 'Logs all kinds of system error message (including debug/warning, etc)',
2827 'system'
2828 => 'Logs every system message shown in the \'main\' window',
2829 'error'
2830 => 'Logs every system error message shown in the \'main\' window',
2831 'warning'
2832 => 'Logs every system warning message shown in the \'main\' window',
2833 'debug'
2834 => 'Logs every system debug message shown in the \'main\' window',
2835 'improper'
2836 => 'Logs every system \'improper arguments\' message shown in the \'main\''
2837 . ' window',
2838 # GA::Session and its tasks
2839 'receive'
2840 => 'Logs all text received from the world',
2841 'display'
2842 => 'Logs all text received after any modifications from matching triggers',
2843 'rooms'
2844 => 'Logs all room statements processed by the Locator task',
2845 'descrips'
2846 => 'Logs all room descriptions processed by the Locator task',
2847 'contents'
2848 => 'Logs all room contents strings processed by the Locator task',
2849 'attack'
2850 => 'Logs all attacks processed by the Attack task',
2851 'channels'
2852 => 'Logs all text processed by the Channels task',
2853 'chat'
2854 => 'Logs all conversations with chat contacts',
2855 'divert'
2856 => 'Logs all text processed by the Divert task',
2857 'sleep'
2858 => 'Logs lines leading up to the character falling asleep',
2859 'passout'
2860 => 'Logs lines leading up to the character passing out',
2861 'dead'
2862 => 'Logs lines leading up to the character\'s death',
2863 },
2864 # A list of logfiles in a standard order, for use in the client's 'pref' window
2865 constLogOrderList => [
2866 'main', 'errors', 'system', 'error', 'warning', 'debug', 'improper',
2867 ],
2868 # Constant registry hash of paths for each logfile, relative to the Axmud data
2869 # directory, in the form
2870 # $constLogPathHash{type} = path_relative_to_data_directory
2871 constLogPathHash => {
2872 'main' => '/logs/main',
2873 'errors' => '/logs/errors',
2874 'system' => '/logs/standard/system',
2875 'error' => '/logs/standard/error',
2876 'warning' => '/logs/standard/warning',
2877 'debug' => '/logs/standard/debug',
2878 'improper' => '/logs/standard/improper',
2879 },
2880 # Flag set to TRUE if logging is enabled, FALSE if logging is disabled
2881 allowLogsFlag => FALSE, # [config]
2882 # Flag set to TRUE if the logfiles listed above should be deleted whenever the Axmud
2883 # client starts, FALSE if not
2884 deleteStandardLogsFlag => FALSE, # [config]
2885 # Flag set to TRUE if the logfiles relating to a particular world (listed in
2886 # GA::Session) should be deleted whenever the world is a current world
2887 deleteWorldLogsFlag => FALSE, # [config]
2888 #
2889 # The following flags apply to the logfiles listed above, and those specified in
2890 # GA::Session
2891 # Flag set to TRUE if a new logfile should be started on every distinct date, FALSE if
2892 # not
2893 logDayFlag => TRUE, # [config]
2894 # Flag set to TRUE if a new logfile should be started when the Axmud client starts
2895 logClientFlag => TRUE, # [config]
2896 # Flag set to TRUE if every line in a log should be prefixed by the date, FALSE if not
2897 logPrefixDateFlag => TRUE, # [config]
2898 # Flag set to TRUE if every line in a log should be prefixed by the time, FALSE if not
2899 logPrefixTimeFlag => TRUE, # [config]
2900 # Flag set to TRUE if images should be included in 'receive' logfile (only), FALSE if
2901 # not
2902 logImageFlag => FALSE, # [config]
2903 #
2904 # String to add a the beginning of every logfile (for example, to add a copyright
2905 # message, or to identify the user). Can contain one or more strings, as well as empty
2906 # strings (for spacing). If an empty list, a preamble isn't used
2907 logPreambleList => [], # [config]
2908  
2909 # The 'sleep', 'passout' and 'dead' logfiles are written by the Status task, which
2910 # attempts to write lines of text received from the world before and after the event.
2911 # If the value is 0, no lines are written before/after the event. Otherwise, write
2912 # the number of lines specified by the IV (max: 999)
2913 statusEventBeforeCount => 200, # [config]
2914 statusEventAfterCount => 50, # [config]
2915  
2916 # Chat
2917 # ----
2918  
2919 # The Chat task is an instant messenger using the zChat/MudMaster chat protocols. The
2920 # Client stores some IVs used by all chat sessions
2921 #
2922 # The user's chat name. If 'undef', the current character's name is used in chat
2923 # sessions
2924 chatName => undef, # [contacts]
2925 # Chat email, broadcast during sessions using the zChat protocol. If 'undef', not
2926 # broadcast
2927 chatEmail => undef, # [contacts]
2928 # The default port for incoming chat connections (should not be modified)
2929 constChatPort => 4050,
2930 # Should incoming calls be auto-accepted? ('prompt' - no, prompt the user first,
2931 # 'accept_contact' - auto-accept calls from people in your chat contact list,
2932 # 'accept_all' - auto-accept calls from everyone)
2933 chatAcceptMode => 'prompt', # [contacts]
2934 # Registry hash of GA::Obj::ChatContact objects in the form
2935 # $chatContactHash{unique_name} = blessed_reference_to_chat_contact_object
2936 chatContactHash => {}, # [contacts]
2937 #
2938 # Path to the default icon broadcast to chat contacts during chat sessions (relative to
2939 # the Axmud base directory)
2940 constChatIcon => 'icons/system/default_chat.bmp',
2941 # Path to the icon currently broadcast to chat contacts during chat sessions (absolute
2942 # path)
2943 chatIcon => $axmud::SHARE_DIR . '/icons/system/default_chat.bmp',
2944 # [contacts]
2945 # Path to the default icon used if the chat contact does not broadcast their own during
2946 # chat sessions (relative to the Axmud base directory)
2947 constChatContactIcon => 'icons/system/default_contact.bmp',
2948 # Constant registry hash of paths to smiley icons (these values never changes). The
2949 # smileys themselves are strings, not regexes. Hash in the form
2950 # $constChatSmileyHash{smiley} = path_to_file
2951 # NB Maximum smiley size is 8 characters
2952 constChatSmileyHash => {
2953 # Happy
2954 ':)' => $axmud::SHARE_DIR . '/icons/smileys/emotion_smile.bmp',
2955 ':-)' => $axmud::SHARE_DIR . '/icons/smileys/emotion_smile.bmp',
2956 # Laughing
2957 ':D' => $axmud::SHARE_DIR . '/icons/smileys/emotion_haha.bmp',
2958 ':-D' => $axmud::SHARE_DIR . '/icons/smileys/emotion_haha.bmp',
2959 # Sad
2960 ':(' => $axmud::SHARE_DIR . '/icons/smileys/emotion_sad.bmp',
2961 ':-(' => $axmud::SHARE_DIR . '/icons/smileys/emotion_sad.bmp',
2962 # Winky frowny
2963 ';(' => $axmud::SHARE_DIR
2964 . '/icons/smileys/emotion_misdoubt.bmp',
2965 # Angry
2966 ':@' => $axmud::SHARE_DIR . '/icons/smileys/emotion_mad.bmp',
2967 '>:(' => $axmud::SHARE_DIR . '/icons/smileys/emotion_mad.bmp',
2968 # Crying
2969 ":'(" => $axmud::SHARE_DIR . '/icons/smileys/emotion_too_sad.bmp',
2970 ":'-(" => $axmud::SHARE_DIR . '/icons/smileys/emotion_too_sad.bmp',
2971 # Horror
2972 'D:' => $axmud::SHARE_DIR . '/icons/smileys/emotion_horror.bmp',
2973 'D:<' => $axmud::SHARE_DIR . '/icons/smileys/emotion_horror.bmp',
2974 # Shock
2975 ':O' => $axmud::SHARE_DIR . '/icons/smileys/emotion_shocked.bmp',
2976 ':-O' => $axmud::SHARE_DIR . '/icons/smileys/emotion_shocked.bmp',
2977 # Kiss
2978 ':*' => $axmud::SHARE_DIR . '/icons/smileys/emotion_kiss.bmp',
2979 # Wink
2980 ';)' => $axmud::SHARE_DIR . '/icons/smileys/emotion_wink.bmp',
2981 ';-)' => $axmud::SHARE_DIR . '/icons/smileys/emotion_wink.bmp',
2982 # Tongue sticking out
2983 ':P' => $axmud::SHARE_DIR . '/icons/smileys/emotion_tongue.bmp',
2984 ':-P' => $axmud::SHARE_DIR . '/icons/smileys/emotion_tongue.bmp',
2985 # Straight face
2986 ':|' => $axmud::SHARE_DIR . '/icons/smileys/emotion_what.bmp',
2987 ':-|' => $axmud::SHARE_DIR . '/icons/smileys/emotion_what.bmp',
2988 # Embarrassed
2989 ':$' => $axmud::SHARE_DIR . '/icons/smileys/emotion_red.bmp',
2990 # Angel
2991 'O:-)' => $axmud::SHARE_DIR . '/icons/smileys/emotion_angel.bmp',
2992 # Evil
2993 '>:)' => $axmud::SHARE_DIR
2994 . '/icons/smileys/emotion_evilgrin.bmp',
2995 # Devilish
2996 '}:)' => $axmud::SHARE_DIR . '/icons/smileys/emotion_devil.bmp',
2997 '}:-)' => $axmud::SHARE_DIR . '/icons/smileys/emotion_devil.bmp',
2998 # Heart
2999 '<3' => $axmud::SHARE_DIR . '/icons/smileys/emotion_love.bmp',
3000 },
3001 # Registry hash of paths to smiley icons
3002 chatSmileyHash => {}, # [contacts] Set below
3003  
3004 # Colour tags
3005 # -----------
3006  
3007 # Axmud Colour tags - a standard colour scheme which allows Axmud's textviews to use the
3008 # same colour set as other telnet clients
3009 #
3010 # Axmud uses three sets of colour tags:
3011 # - (Standard) colour tags used to show ANSI colours (e.g. 'red', 'BLUE'). To specify
3012 # an underlay colour, precede the string with 'ul_' or 'UL_'
3013 # - Xterm colour tags used to show xterm-256 colours (e.g. 'x0', 'x255'). To specify
3014 # an underlay colour, use a string in the range 'ux0' to 'ux255'. Xterm colour
3015 # tags are case-insensitive, so it's safe to specify 'X0' or 'UX255'
3016 # - RGB colour tags used to show RGB colours (e.g. '#000000', '#FFFFFF'). To specify
3017 # an underlay colour, use a string in the range 'u#000000' to 'u#FFFFFF'. RGB
3018 # colour tags are case-insensitive, so it's safe to specify 'U#00000' or
3019 # 'U#AbCdEf'
3020 # Standard and xterm colour tags are converted into RGB colour tags, before being used
3021 #
3022 # Standard colour tags have all-upper case or all-lower case names. Upper-case names are
3023 # used for bold colours. In addition, each standard tag can be preceded by 'ul_' (or
3024 # 'UL_' for bold colours) to show that the tag is an underlay colour, not a text
3025 # colour.
3026 # e.g. 'BLUE' - bold blue text, 'UL_BLUE' - bold blue underlay text
3027 #
3028 # A constant list of standard (normal) colour tags, in a standard order
3029 # (These values never change, max length: 7 characters; corresponding underlay
3030 # characters have a max length of 10)
3031 constColourTagList => [
3032 'black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white',
3033 ],
3034 # A list of standard (bold) colour tags, in a standard order
3035 # (These values never change, max length: 7 characters; corresponding underlay
3036 # characters have a max length of 10)
3037 constBoldColourTagList => [
3038 'BLACK', 'RED', 'GREEN', 'YELLOW', 'BLUE', 'MAGENTA', 'CYAN', 'WHITE',
3039 ],
3040 #
3041 # A constant hash of standard (normal) colour tags (these values never change). Hash in
3042 # the form
3043 # $constColourTag{standard_colour_tag} = rgb_colour_tag
3044 constColourTagHash => {
3045 'black' => '#000000',
3046 'red' => '#8B0000',
3047 'green' => '#007300',
3048 'yellow' => '#8B6914',
3049 'blue' => '#0000C0',
3050 'magenta' => '#8B008B',
3051 'cyan' => '#008B8B',
3052 'white' => '#BEBEBE',
3053 },
3054 # A constant hash of standard (bold) colour tags (these values never changes). Hash in
3055 # the form
3056 # $constBoldColourTagHash{STANDARD_BOLD_COLOUR_TAG} = rgb_colour_tag
3057 constBoldColourTagHash => {
3058 'BLACK' => '#5F5F5F',
3059 'RED' => '#FF0000',
3060 'GREEN' => '#00FF00',
3061 'YELLOW' => '#FFFF00',
3062 'BLUE' => '#0000FF',
3063 'MAGENTA' => '#FF00FF',
3064 'CYAN' => '#00FFFF',
3065 'WHITE' => '#FFFFFF',
3066 },
3067 # Customisable hash of standard (normal) colour tags, in the form
3068 # $colourTagHash{standard_colour_tag} = rgb_colour_tag
3069 colourTagHash => {}, # [config] Set below
3070 # Customisable hash of standard (bold) colour tags, in the form
3071 # $boldColourTagHash{STANDARD_BOLD_COLOUR_TAG} = rgb_colour_tag
3072 boldColourTagHash => {}, # [config] Set below
3073 #
3074 # A constant hash of background colour tags and suitable text colour tags to use with
3075 # them (for the benefit of tasks, or any other code). Hash in the form
3076 # $constMonochromeHash{background_colour_tag} = text_colour_tag
3077 constMonochromeHash => {
3078 'black' => 'white',
3079 'red' => 'WHITE',
3080 'green' => 'WHITE',
3081 'yellow' => 'white',
3082 'blue' => 'WHITE',
3083 'magenta' => 'WHITE',
3084 'cyan' => 'WHITE',
3085 'white' => 'black',
3086 'BLACK' => 'WHITE',
3087 'RED' => 'black',
3088 'GREEN' => 'black',
3089 'YELLOW' => 'black',
3090 'BLUE' => 'WHITE',
3091 'MAGENTA' => 'black',
3092 'CYAN' => 'black',
3093 'WHITE' => 'black',
3094 },
3095  
3096 # A constant list of 32 rgb colour tags, roughly in rainbow order, for use with the
3097 # winmap/zonemap 'edit' windows (these values never change)
3098 constRainbowColourList => [
3099 '#FF0000', # reds
3100 '#FF7F00', # oranges
3101 '#FFFF00', # yellows
3102 '#00CD00', # greens
3103 '#0000FF', # blues
3104 '#00CDCD', # cyans
3105 '#8B008B', # purples
3106 '#CDCDBA', # greys
3107 '#8B0000', # cycle repeats...
3108 '#8B4500',
3109 '#FFFF7F',
3110 '#008B00',
3111 '#00008B',
3112 '#008B8B',
3113 '#CD00CD',
3114 '#8B8B7E',
3115 '#CD0000',
3116 '#CD6600',
3117 '#D8EE21',
3118 '#00FF00',
3119 '#7F7FFF',
3120 '#3FFFFF',
3121 '#FF00FF',
3122 '#FF7A7A',
3123 '#FFBF7F',
3124 '#EED877',
3125 '#7FFF7F',
3126 '#BFFFFF',
3127 '#C8FFFF',
3128 '#FF7FFF',
3129 '#BACDCD',
3130 '#FFFFFF', # black
3131 ],
3132 # A constant hash of official HTML 4 colour names (in lower-case only), used to
3133 # implement MXP colours, in the form
3134 # $constHtmlColourHash{html_colour_name} = rgb_colour_tag
3135 constHtmlColourHash => {
3136 # Standard HTML colours
3137 'white' => '#FFFFFF',
3138 'silver' => '#C0C0C0',
3139 'gray' => '#808080',
3140 'black' => '#000000',
3141 'red' => '#FF0000',
3142 'maroon' => '#800000',
3143 'yellow' => '#FFFF00',
3144 'olive' => '#808000',
3145 'lime' => '#00FF00',
3146 'green' => '#008000',
3147 'aqua' => '#00FFFF',
3148 'teal' => '#008080',
3149 'blue' => '#0000FF',
3150 'navy' => '#000080',
3151 'fuchsia' => '#FF00FF',
3152 'purple' => '#800080',
3153 # New colours from http://www.gammon.com.au/mushclient/mxpcolours.htm
3154 # (replacing any existing keys from above)
3155 'aliceblue' => '#f0f8ff',
3156 'antiquewhite' => '#FAEBD7',
3157 'aqua' => '#00FFFF',
3158 'aquamarine' => '#7FFFD4',
3159 'azure' => '#F0FFFF',
3160 'beige' => '#F5F5DC',
3161 'bisque' => '#FFE4C4',
3162 'black' => '#000000',
3163 'blanchedalmond' => '#FFEBCD',
3164 'blue' => '#0000FF',
3165 'blueviolet' => '#8A2BE2',
3166 'brown' => '#A52A2A',
3167 'burlywood' => '#DEB887',
3168 'cadetblue' => '#5F9EA0',
3169 'chartreuse' => '#7FFF00',
3170 'chocolate' => '#D2691E',
3171 'coral' => '#FF7F50',
3172 'cornflowerblue' => '#6495ED',
3173 'cornsilk' => '#FFF8DC',
3174 'crimson' => '#DC143C',
3175 'cyan' => '#00FFFF',
3176 'darkblue' => '#00008B',
3177 'darkcyan' => '#008B8B',
3178 'darkgoldenrod' => '#B8860B',
3179 'darkgray' => '#A9A9A9',
3180 'darkgreen' => '#006400',
3181 'darkkhaki' => '#BDB76B',
3182 'darkmagenta' => '#8B008B',
3183 'darkolivegreen' => '#556B2F',
3184 'darkorange' => '#FF8C00',
3185 'darkorchid' => '#9932CC',
3186 'darkred' => '#8B0000',
3187 'darksalmon' => '#E9967A',
3188 'darkseagreen' => '#8DBC8F',
3189 'darkslateblue' => '#483D8B',
3190 'darkslategray' => '#2F4F4F',
3191 'darkturquoise' => '#00DED1',
3192 'darkviolet' => '#9400D3',
3193 'deeppink' => '#FF1493',
3194 'deepskyblue' => '#00BFFF',
3195 'dimgray' => '#696969',
3196 'dodgerblue' => '#1E90FF',
3197 'firebrick' => '#B22222',
3198 'floralwhite' => '#FFFAF0',
3199 'forestgreen' => '#228B22',
3200 'fuchsia' => '#FF00FF',
3201 'gainsboro' => '#DCDCDC',
3202 'ghostwhite' => '#F8F8FF',
3203 'gold' => '#FFD700',
3204 'goldenrod' => '#DAA520',
3205 'gray' => '#808080',
3206 'green' => '#008000',
3207 'greenyellow' => '#ADFF2F',
3208 'honeydew' => '#F0FFF0',
3209 'hotpink' => '#FF69B4',
3210 'indianred' => '#CD5C5C',
3211 'indigo' => '#4B0082',
3212 'ivory' => '#FFFFF0',
3213 'khaki' => '#F0E68C',
3214 'lavender' => '#E6E6FA',
3215 'lavenderblush' => '#FFF0F5',
3216 'lawngreen' => '#7CFC00',
3217 'lemonchiffon' => '#FFFACD',
3218 'lightblue' => '#ADD8E6',
3219 'lightcoral' => '#F08080',
3220 'lightcyan' => '#E0FFFF',
3221 'lightgoldenrodyellow' => '#FAFAD2',
3222 'lightgray' => '#D3D3D3',
3223 'lightgreen' => '#90EE90',
3224 'lightgrey' => '#D3D3D3',
3225 'lightpink' => '#FFB6C1',
3226 'lightsalmon' => '#FFA07A',
3227 'lightseagreen' => '#20B2AA',
3228 'lightskyblue' => '#87CEFA',
3229 'lightslategray' => '#778899',
3230 'lightsteelblue' => '#B0C4DE',
3231 'lightyellow' => '#FFFFE0',
3232 'lime' => '#00FF00',
3233 'limegreen' => '#32CD32',
3234 'linen' => '#FAF0E6',
3235 'magenta' => '#FF00FF',
3236 'maroon' => '#800000',
3237 'mediumaquamarine' => '#66CDAA',
3238 'mediumblue' => '#0000CD',
3239 'mediumorchid' => '#BA55D3',
3240 'mediumpurple' => '#9370DB',
3241 'mediumseagreen' => '#3CB371',
3242 'mediumslateblue' => '#7B68EE',
3243 'mediumspringgreen' => '#00FA9A',
3244 'mediumturquoise' => '#48D1CC',
3245 'mediumvioletred' => '#C71585',
3246 'midnightblue' => '#191970',
3247 'mintcream' => '#F5FFFA',
3248 'mistyrose' => '#FFE4E1',
3249 'moccasin' => '#FFE4B5',
3250 'navajowhite' => '#FFDEAD',
3251 'navy' => '#000080',
3252 'oldlace' => '#FDF5E6',
3253 'olive' => '#808000',
3254 'olivedrab' => '#6B8E23',
3255 'orange' => '#FFA500',
3256 'orangered' => '#FF4500',
3257 'orchid' => '#DA70D6',
3258 'palegoldenrod' => '#EEE8AA',
3259 'palegreen' => '#98FB98',
3260 'paleturquoise' => '#AFEEEE',
3261 'palevioletred' => '#DB7093',
3262 'papayawhip' => '#FFEFD5',
3263 'peachpuff' => '#FFDAB9',
3264 'peru' => '#CD853F',
3265 'pink' => '#FFC8CB',
3266 'plum' => '#DDA0DD',
3267 'powderblue' => '#B0E0E6',
3268 'purple' => '#800080',
3269 'red' => '#FF0000',
3270 'rosybrown' => '#BC8F8F',
3271 'royalblue' => '#4169E1',
3272 'saddlebrown' => '#8B4513',
3273 'salmon' => '#FA8072',
3274 'sandybrown' => '#F4A460',
3275 'seagreen' => '#2E8B57',
3276 'seashell' => '#FFF5EE',
3277 'sienna' => '#A0522D',
3278 'silver' => '#C0C0C0',
3279 'skyblue' => '#87CEEB',
3280 'slateblue' => '#6A5ACD',
3281 'slategray' => '#708090',
3282 'snow' => '#FFFAFA',
3283 'springgreen' => '#00FF7F',
3284 'steelblue' => '#4682B4',
3285 'tan' => '#D2B48C',
3286 'teal' => '#008080',
3287 'thistle' => '#D8BFD8',
3288 'tomato' => '#FF6347',
3289 'turquoise' => '#40E0D0',
3290 'violet' => '#EE82EE',
3291 'wheat' => '#F5DEB3',
3292 'white' => '#FFFFFF',
3293 'whitesmoke' => '#F5F5F5',
3294 'yellow' => '#FFFF00',
3295 'yellowgreen' => '#9ACD32',
3296 },
3297 # For the benefit of MXP gauges (which require three colours - the specified one,
3298 # black for the empty portion of the gauge, and a third colour for the label), a
3299 # partial hash HTML 4 colours, containing only the standard colours as keys, and
3300 # suitable label colours as corresponding values
3301 constHtmlContrastHash => {
3302 # Standard HTML colours
3303 'white' => '#FF0000',
3304 'silver' => '#FF0000',
3305 'gray' => '#FF0000',
3306 'black' => '#FFFFFF',
3307 'red' => '#FFFFFF',
3308 'maroon' => '#FFFFFF',
3309 'yellow' => '#FF0000',
3310 'olive' => '#FFFFFF',
3311 'lime' => '#FFFFFF',
3312 'green' => '#FFFFFF',
3313 'aqua' => '#FFFFFF',
3314 'teal' => '#FFFFFF',
3315 'blue' => '#FFFFFF',
3316 'navy' => '#FFFFFF',
3317 'fuchsia' => '#FFFFFF',
3318 'purple' => '#FFFFFF',
3319 },
3320  
3321 # http://www.gammon.com.au/forum/bbshowpost.php?id=7761&page=4
3322 # To show xterm-256 colours, Axmud supports two colour cubes detailed in the page above:
3323 # the xterm colour cube (the default one) and the netscape colour cube
3324 # Constant hash for the xterm colour cube, converting xterm colour tags (strings in the
3325 # range 'x0' - 'x255') into RGB colour tags (strings in range '#000000' - '#FFFFFFF').
3326 # Hash in the form
3327 # $constXTermColourHash{xterm_colour_tag} = rgb_colour_tag
3328 # NB This hash doesn't include underlay colours represented by strings in the range
3329 # 'ux0' - 'ux255'
3330 constXTermColourHash => {}, # Set below
3331 # Constant hash for the netscape colour cube (in the same form)
3332 constNetscapeColourHash => {},
3333 # Which colour cube is in use at the moment - 'xterm' or 'netscape'
3334 currentColourCube => 'xterm', # [config]
3335 # The hash currently in use (copied from one of the constant hashes above)
3336 xTermColourHash => {},
3337  
3338 # http://www.mudpedia.org/mediawiki/index.php/OSC_color_palette
3339 # A constant hash of colours used in the OSC colour palette, translating a single
3340 # hex character in the range 0-9, A-F into a standard colour tag
3341 constOscPaletteHash => {
3342 '0' => 'black',
3343 '1' => 'red',
3344 '2' => 'green',
3345 '3' => 'yellow',
3346 '4' => 'blue',
3347 '5' => 'magenta',
3348 '6' => 'cyan',
3349 '7' => 'white',
3350 '8' => 'BLACK',
3351 '9' => 'RED',
3352 'A' => 'GREEN',
3353 'B' => 'YELLOW',
3354 'C' => 'BLUE',
3355 'D' => 'MAGENTA',
3356 'E' => 'CYAN',
3357 'F' => 'WHITE',
3358 },
3359 # Flag set to TRUE if using the OSC colour palette is allowed; set to FALSE if OSC
3360 # colour palette escape sequences should be ignored
3361 oscPaletteFlag => TRUE, # [config]
3362  
3363 # Style tags
3364 # ----------
3365  
3366 # A constant list of style tags, in a standard order
3367 # (These values never change, max length: 16 characters)
3368 constStyleTagList => [
3369 'italics', 'italics_off', 'underline', 'underline_off', 'blink_slow', 'blink_fast',
3370 'blink_off', 'strike', 'strike_off', 'link', 'link_off', 'justify_left',
3371 'justify_centre', 'justify_right', 'justify_default',
3372 ],
3373 # A constant list of 'dummy' style tags, in a standard order. 'Dummy' style tags affect
3374 # the text colour and background colour, so they are converted into colour tags
3375 # before the text is displayed on the screen.
3376 # In practice, an 'mxpf_font' tag is always used in a modified form, where 'font' is
3377 # substituted for the actual font that MXP requires, e.g. 'mxpf_monospace_bold_12_p5'.
3378 # However, the 'mxpf_off' tag never changes.
3379 # The modified string typically contains one or more of the following, separated by
3380 # underlines: the font name (e.g. 'monospace'), a font name modifier (e.g. 'bold'),
3381 # the font size (e.g. '12') and the pixel spacing above and below the text (used for
3382 # MXP HTML headings, e.g. 'p5'; when not specified, a spacing of 0 is used)
3383 # Also, an 'mxpm_mode' tag is always used in a modified form, where 'mode' is
3384 # substituted for a value in the range 10-12, 19, 20-99. Since these MXP modes apply
3385 # to a whole single line, there is no 'mxpm_off' tag
3386 # (These values never change, max length: 16 characters)
3387 constDummyTagList => [
3388 'bold', 'bold_off', 'reverse', 'reverse_off', 'conceal', 'conceal_off',
3389 'mxpf_font', 'mxpf_off', 'mxpm_mode', 'attribs_off',
3390 ],
3391  
3392 # A constant hash of style tags (these values never change). Hash in the form
3393 # $constStyleTagHash{tag_name} = undef
3394 constStyleTagHash => {
3395 'italics' => undef,
3396 'italics_off' => undef,
3397 'underline' => undef,
3398 'underline_off' => undef,
3399 'blink_slow' => undef,
3400 'blink_fast' => undef,
3401 'blink_off' => undef,
3402 'strike' => undef,
3403 'strike_off' => undef,
3404 'link' => undef,
3405 'link_off' => undef,
3406 'justify_left' => undef,
3407 'justify_centre' => undef,
3408 'justify_right' => undef,
3409 'justify_default' => undef,
3410 },
3411 # Constant hash of justification style tags for quick lookup
3412 constJustifyTagHash => {
3413 'justify_left' => undef,
3414 'justify_centre' => undef,
3415 'justify_right' => undef,
3416 'justify_default' => undef,
3417 },
3418 # Constant hash of 'dummy' style tags for quick lookup
3419 constDummyTagHash => {
3420 'bold' => undef,
3421 'bold_off' => undef,
3422 'reverse' => undef,
3423 'reverse_off' => undef,
3424 'conceal' => undef,
3425 'conceal_off' => undef,
3426 'mxpf_font' => undef,
3427 'mxpf_off' => undef,
3428 'mxpm_mode' => undef,
3429 'attribs_off' => undef,
3430 },
3431  
3432 # ANSI escape sequences
3433 # ---------------------
3434  
3435 # Constant hashes which help Axmud interpret ANSI escape sequences in text received from
3436 # the world
3437  
3438 # A constant hash of colours, mapping the value in an 'Esc[Value;...;Valuem' escape
3439 # sequence into a standard colour tag
3440 constANSIColourHash => {
3441 30 => 'black',
3442 31 => 'red',
3443 32 => 'green',
3444 33 => 'yellow',
3445 34 => 'blue',
3446 35 => 'magenta',
3447 36 => 'cyan',
3448 37 => 'white',
3449 40 => 'ul_black',
3450 41 => 'ul_red',
3451 42 => 'ul_green',
3452 43 => 'ul_yellow',
3453 44 => 'ul_blue',
3454 45 => 'ul_magenta',
3455 46 => 'ul_cyan',
3456 47 => 'ul_white',
3457 },
3458 # A constant hash of styles, mapping the value in an 'Esc[Value;...;Valuem' escape
3459 # sequence onto a style tag
3460 # NB 1 (bold) and 22 (bold off) are implemented without using (real) style tags, but
3461 # instead with the 'dummy' style tags 'bold' and 'bold_off'
3462 # NB 7 (reverse video on) and 27 (reverse video off) are implemented using the 'dummy'
3463 # style tags 'reverse' and 'reverse_off'
3464 # NB 8 (conceal on) and 28 (conceal off) are implemented using the 'dummy' style tags
3465 # 'conceal' and 'conceal_off'
3466 # NB The style tags 'link_on' and 'link_off' are implemented solely within Axmud and do
3467 # not correspond to an ANSI escape sequence
3468 # NB 39 (default text colour) and 49 (default underlay colour) are implemented by
3469 # converting them into an Axmud colour tag
3470 constANSIStyleHash => {
3471 3 => 'italics',
3472 4 => 'underline',
3473 5 => 'blink_slow',
3474 6 => 'blink_fast',
3475 9 => 'strike', # Actually 'Crossed out'
3476 23 => 'italics_off',
3477 24 => 'underline_off',
3478 25 => 'blink_off',
3479 29 => 'strike_off', # Actually 'Not crossed out'
3480 },
3481  
3482 # A constant list of standard colour/style tags stored in the GA::Buffer::Display
3483 # object for each received line, in a standard order (compiled by
3484 # GA::Session->convertANSISequences)
3485 constColourStyleList => [
3486 'black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white',
3487 'ul_black', 'ul_red', 'ul_green', 'ul_yellow', 'ul_blue', 'ul_magenta', 'ul_cyan',
3488 'ul_white',
3489 'italics', 'italics_off', 'underline', 'underline_off', 'blink_slow', 'blink_fast',
3490 'blink_off', 'strike', 'strike_off', 'link', 'link_off', 'justify_left',
3491 'justify_centre', 'justify_right', 'justify_default',
3492 # 'Dummy' style tags
3493 'bold', 'bold_off', 'reverse', 'reverse_off', 'conceal', 'conceal_off',
3494 'mxpf_font', 'mxpf_off', 'mxpm_mode', 'attribs_off',
3495 ],
3496 # A constant hash of nicer names for standard colour/style tags. The keys are all the
3497 # values in $self->constColourStyleList; the values are more descriptive names for
3498 # them
3499 constPrettyTagHash => {
3500 # Colour tags
3501 'black' => 'Black text',
3502 'red' => 'Red text',
3503 'green' => 'Green text',
3504 'yellow' => 'Yellow text',
3505 'blue' => 'Blue text',
3506 'magenta' => 'Magenta text',
3507 'cyan' => 'Cyan text',
3508 'white' => 'White text',
3509 'ul_black' => 'Black underlay',
3510 'ul_red' => 'Red underlay',
3511 'ul_green' => 'Green underlay',
3512 'ul_yellow' => 'Yellow underlay',
3513 'ul_blue' => 'Blue underlay',
3514 'ul_magenta' => 'Magenta underlay',
3515 'ul_cyan' => 'Cyan underlay',
3516 'ul_white' => 'White underlay',
3517 # Style tags
3518 'italics' => 'Turn on italics',
3519 'italics_off' => 'Turn off italics',
3520 'underline' => 'Turn on underline',
3521 'underline_off' => 'Turn off underline',
3522 'blink_slow' => 'Turn on slow blink',
3523 'blink_fast' => 'Turn on fast blink',
3524 'blink_off' => 'Turn off slow/fast blink',
3525 'strike' => 'Turn on strike-through',
3526 'strike_off' => 'Turn off strike-through',
3527 'link' => 'Clickable link',
3528 'link_off' => 'End of clickable link',
3529 'justify_left' => 'Left justification for text',
3530 'justify_centre' => 'Centre justification for text',
3531 'justify_right' => 'Right justification for text',
3532 'justify_default' => 'Default justification for text',
3533 # Dummy style tags
3534 'bold' => 'Turn on bold colours',
3535 'bold_off' => 'Turn off bold colours',
3536 'reverse' => 'Turn on reverse video',
3537 'reverse_off' => 'Turn off reverse video',
3538 'conceal' => 'Turn on conceal',
3539 'conceal_off' => 'Turn off conceal',
3540 'mxpf_font' => 'Turn on MXP font attributes',
3541 'mxpf_off' => 'Turn off MXP font attributes',
3542 'mxpm_mode' => 'Apply an MXP line mode',
3543 'attribs_off' => 'Turn off all attributes',
3544 },
3545 # 'Set Graphics Mode' ANSI escape sequences in text received from the world apply
3546 # until the next occurence of that sequence. Each GA::Session needs to keep track of
3547 # which graphic modes apply right now in the session's current textview object
3548 # Constant hash of graphics modes (these values never change, and are used to initialise
3549 # comparable hashes in GA::Session and GA::Obj::TextView)
3550 constColourStyleHash => {
3551 # Colour tags - when set to 'undef', the default colours are used. Standard or xterm
3552 # colour tags, but not RGB colour tags
3553 text => undef, # Axmud colour tag, e.g. 'red' or 'x230'
3554 underlay => undef, # Axmud underlay colour tag, e.g. 'ul_white'
3555 # Style tags
3556 italics => FALSE,
3557 underline => FALSE,
3558 blink_slow => FALSE,
3559 blink_fast => FALSE,
3560 strike => FALSE,
3561 link => FALSE,
3562 # MXP font tags (which are dummy style tags)
3563 mxp_font => undef, # e.g. 'mxpf_monospace_bold_12', or 'undef'
3564 # Justification
3565 justify => undef, # 'left', 'right', 'centre' or 'undef' to
3566 # represent style tag 'justify_default'
3567 },
3568  
3569 # Telnet options and mud protocols
3570 # --------------------------------
3571  
3572 # Constant hash of telnet negotiation descriptors
3573 constTelnetHash => {
3574 # TELNET_
3575 'TELNET_IS' => 0,
3576 'TELNET_SEND' => 1,
3577 'TELNET_SE' => 240,
3578 'TELNET_GA' => 249,
3579 'TELNET_SB' => 250,
3580 'TELNET_WILL' => 251,
3581 'TELNET_WONT' => 252,
3582 'TELNET_DO' => 253,
3583 'TELNET_DONT' => 254,
3584 'TELNET_IAC' => 255,
3585 # TELOPT_
3586 'TELOPT_ECHO' => 1,
3587 'TELOPT_SGA' => 3, # Implemented directly by GA::Obj::Telnet
3588 'TELOPT_TTYPE' => 24,
3589 'TELOPT_EOR' => 25,
3590 'TELOPT_NAWS' => 31,
3591 'TELOPT_NEW_ENVIRON' => 39,
3592 'TELOPT_CHARSET' => 42,
3593 'TELOPT_MSDP' => 69,
3594 'TELOPT_MSSP' => 70,
3595 'TELOPT_MCCP1' => 85,
3596 'TELOPT_MCCP2' => 86,
3597 'TELOPT_MSP' => 90,
3598 'TELOPT_MXP' => 91,
3599 'TELOPT_ZMP' => 93,
3600 'TELOPT_AARD102' => 102,
3601 'TELOPT_ATCP' => 200,
3602 'TELOPT_GMCP' => 201,
3603 # MSDP
3604 'MSDP_VAR' => 1,
3605 'MSDP_VAL' => 2,
3606 'MSDP_TABLE_OPEN' => 3,
3607 'MSDP_TABLE_CLOSE' => 4,
3608 'MSDP_ARRAY_OPEN' => 5,
3609 'MSDP_ARRAY_CLOSE' => 6,
3610 # MSSP
3611 'MSSP_VAR' => 1,
3612 'MSSP_VAL' => 2,
3613 },
3614 # Constant hash of telopts
3615 constTeloptHash => {
3616 1 => 'TELOPT_ECHO',
3617 3 => 'TELOPT_SGA',
3618 24 => 'TELOPT_TTYPE',
3619 25 => 'TELOPT_EOR',
3620 31 => 'TELOPT_NAWS',
3621 39 => 'TELOPT_NEW_ENVIRON',
3622 42 => 'TELOPT_CHARSET',
3623 69 => 'TELOPT_MSDP',
3624 70 => 'TELOPT_MSSP',
3625 85 => 'TELOPT_MCCP1',
3626 86 => 'TELOPT_MCCP2',
3627 90 => 'TELOPT_MSP',
3628 91 => 'TELOPT_MXP',
3629 93 => 'TELOPT_ZMP',
3630 102 => 'TELOPT_AARD102',
3631 200 => 'TELOPT_ATCP',
3632 201 => 'TELOPT_GMCP',
3633 },
3634  
3635 # Hashes of HTML heading sizes and spacings, relative to $self->constFontSize,
3636 # corresponding to the HTML tags <H1>...<H6>. Used with both MXP and Pueblo
3637 constHeadingSizeHash => {
3638 1 => 2, # <H1>
3639 2 => 1.5, # <H2>, etc
3640 3 => 1.17,
3641 4 => 1,
3642 5 => 0.83,
3643 6 => 0.67,
3644 },
3645 constHeadingSpacingHash => {
3646 1 => 0.67,
3647 2 => 0.83,
3648 3 => 1,
3649 4 => 1.33,
3650 5 => 1.67,
3651 6 => 2,
3652 },
3653  
3654 # Telnet option negotiations
3655 # Use ECHO (http://www.ietf.org/rfc/rfc857.txt)
3656 useEchoFlag => TRUE, # [config]
3657 # Use SGA (Suppress Go Ahead - http://www.ietf.org/rfc/rfc858.txt)
3658 useSgaFlag => TRUE, # [config]
3659 # Use TTYPE (Terminal type - http://www.ietf.org/rfc/rfc1091.txt)
3660 useTTypeFlag => TRUE, # [config]
3661 # Use EOR (End Of Record - RFC 885, http://www.ietf.org/rfc/rfc885.txt)
3662 useEorFlag => TRUE, # [config]
3663 # Use NAWS (Negotiate About Window Size - RFC 1073, http://www.ietf.org/rfc/rfc1073.txt)
3664 useNawsFlag => TRUE, # [config]
3665 # Use NEW-ENVIRON (New Environment option - RFC 1572,
3666 # http://www.ietf.org/rfc/rfc1572.txt)
3667 useNewEnvironFlag => TRUE, # [config]
3668 # Use CHARSET (Character Set and translation - RFC 1073,
3669 # http://www.ietf.org/rfc/rfc2066.txt)
3670 useCharSetFlag => TRUE, # [config]
3671  
3672 # MUD protocols
3673 # Use MSDP (Mud Server Data Protocol - http://tintin.sourceforge.io/msdp/)
3674 useMsdpFlag => TRUE, # [config]
3675 # Use MSSP (Mud Server Status Protocol - http://tintin.sourceforge.io/mssp/)
3676 useMsspFlag => TRUE, # [config]
3677 # Use MCCP (Mud Client Compression Protocol - http://tintin.sourceforge.io/mccp/). Both
3678 # MCCP1 and MCCP2 are supported
3679 useMccpFlag => TRUE, # [config]
3680 # Use MSP (Mud Sound Protocol - http://www.zuggsoft.com/zmud/msp.htm)
3681 useMspFlag => TRUE, # [config]
3682 # Use MXP (Mud Xtension Protocol - http://www.zuggsoft.com/zmud/mxp.htm)
3683 useMxpFlag => TRUE, # [config]
3684 # Use Pueblo - http://pueblo.sourceforge.io/doc/manual/html_standard_elements.html
3685 # (NB In line with other major MUD clients, Axmud offers only partial Pueblo support)
3686 usePuebloFlag => TRUE, # [config]
3687 # Use ZMP (Zenith Mud Protocol
3688 # - http://discworld.starturtle.net/external/protocols/zmp.html)
3689 useZmpFlag => TRUE, # [config]
3690 # Use AARD102 (Aardwolf 102 channel)
3691 # - http://www.aardwolf.com/blog/2008/07/10/
3692 # telnet-negotiation-control-mud-client-interaction/
3693 useAard102Flag => TRUE, # [config]
3694 # Use ATCP (Achaea Telnet Client Protocol)
3695 # - https://www.ironrealms.com/rapture/manual/files/FeatATCP-txt.html
3696 useAtcpFlag => TRUE, # [config]
3697 # Use GMCP (Generic MUD Communication Protocol) - https://www.gammon.com.au/gmcp
3698 useGmcpFlag => TRUE, # [config]
3699 # Use MTTS (Mud Terminal Type Standard - http://tintin.sourceforge.io/mtts/)
3700 useMttsFlag => TRUE, # [config]
3701 # Use MNES (MUD NEW-ENVIRON STANDARD) - https://tintin.mudhalla.net/protocols/mnes/
3702 useMnesFlag => TRUE, # [config]
3703 # Use MCP (Mud Client Protocol - http://www.moo.mud.org/mcp/). Only MCP version 2.1 is
3704 # supported. Axmud provides the MCP packages 'mcp-negotiate', 'mcp-cord' and
3705 # 'dns-org-mud-moo-simpleedit'
3706 useMcpFlag => TRUE, # [config]
3707  
3708 # Constant hash of official MSSP variables
3709 constMsspVarHash => {}, # Set below
3710 # Constant list of official MSSP variables, in a fixed order; items that begin with
3711 # a # character are not official variables, but subject headings
3712 constMsspVarList => [
3713 '#Required',
3714 'NAME',
3715 'PLAYERS',
3716 'UPTIME',
3717 '#Generic',
3718 'CRAWL DELAY',
3719 'HOSTNAME',
3720 'PORT',
3721 'CODEBASE',
3722 'CONTACT',
3723 'CREATED',
3724 'ICON',
3725 'IP',
3726 'LANGUAGE',
3727 'LOCATION',
3728 'MINIMUM AGE',
3729 'WEBSITE',
3730 '#Categorisation',
3731 'FAMILY',
3732 'GENRE',
3733 'GAMEPLAY',
3734 'STATUS',
3735 'GAMESYSTEM',
3736 'INTERMUD',
3737 'SUBGENRE',
3738 '#World',
3739 'AREAS',
3740 'HELPFILES',
3741 'MOBILES',
3742 'OBJECTS',
3743 'ROOMS',
3744 'CLASSES',
3745 'LEVELS',
3746 'RACES',
3747 'SKILLS',
3748 '#Protocols',
3749 'ANSI',
3750 'GMCP',
3751 'MCCP',
3752 'MCP',
3753 'MSDP',
3754 'MSP',
3755 'MXP',
3756 'PUEBLO',
3757 'UTF-8',
3758 'VT100',
3759 'XTERM 256 COLORS',
3760 '#Commercial',
3761 'PAY TO PLAY',
3762 'PAY FOR PERKS',
3763 '#Hiring',
3764 'HIRING BUILDERS',
3765 'HIRING CODERS',
3766 ],
3767  
3768 # The version of MSP supported by this cleint
3769 constMspVersion => '0.3',
3770 # Flag set to TRUE if Axmud should play several sound triggers at once, FALSE if it
3771 # should stop playing the previous sound trigger, if a new sound trigger arrives
3772 allowMspMultipleFlag => TRUE, # [config]
3773 # Flag set to TRUE if Axmud should allow MSP to download sound files it doesn't already
3774 # have, FALSE if not
3775 allowMspLoadSoundFlag => TRUE, # [config]
3776 # Flag set to TRUE if Axmud should recognise MSP tags in the middle of a line; FALSE if
3777 # it should only recognise MSP tags at the beginning of a line
3778 allowMspFlexibleFlag => FALSE, # [config]
3779  
3780 # The version of MXP supported by this client
3781 constMxpVersion => '1.0',
3782 # Hash of all official MXP tags (i.e. tags which cannot be user-defined)
3783 constMxpOfficialHash => {
3784 'ELEMENT' => undef,
3785 'EL' => undef,
3786 'ATTLIST' => undef,
3787 'AT' => undef,
3788 'ATT' => undef, # The MXP spec uses both <!AT> and <!ATT>
3789 'ENTITY' => undef,
3790 'EN' => undef,
3791 'VAR' => undef,
3792 'V' => undef,
3793 'TAG' => undef,
3794 'BOLD' => undef,
3795 'B' => undef,
3796 'STRONG' => undef,
3797 'ITALIC' => undef,
3798 'I' => undef,
3799 'EM' => undef,
3800 'UNDERLINE' => undef,
3801 'U' => undef,
3802 'STRIKEOUT' => undef,
3803 'S' => undef,
3804 'HIGH' => undef,
3805 'H' => undef,
3806 'COLOR' => undef,
3807 'C' => undef, # Is in MXP spec
3808 'FONT' => undef,
3809 'F' => undef, # Not in MXP spec, but implemented anyway
3810 'NOBR' => undef,
3811 'P' => undef,
3812 'BR' => undef,
3813 'SBR' => undef,
3814 # '&nbsp' => undef,
3815 'A' => undef,
3816 'SEND' => undef,
3817 'EXPIRE' => undef,
3818 'VERSION' => undef,
3819 'SUPPORT' => undef,
3820 'H1' => undef,
3821 'H2' => undef,
3822 'H3' => undef,
3823 'H4' => undef,
3824 'H5' => undef,
3825 'H6' => undef,
3826 'HR' => undef,
3827 'SMALL' => undef,
3828 'TT' => undef,
3829 'SOUND' => undef,
3830 'MUSIC' => undef,
3831 'GAUGE' => undef,
3832 'STAT' => undef,
3833 'FRAME' => undef,
3834 'DESTINATION' => undef,
3835 'DEST' => undef,
3836 'RELOCATE' => undef,
3837 'QUIET' => undef,
3838 'USER' => undef,
3839 'PASSWORD' => undef,
3840 'IMAGE' => undef,
3841 'FILTER' => undef,
3842 # 'SCRIPT => undef, # Deprecated since MXP v0.4
3843 },
3844 # Hash of MXP tags and their attributes (a subset of ->constMxpOfficialHash, omitting
3845 # tags that appear as keys in $self->constMxpConvertHash); used to respond to
3846 # <SUPPORT> requests, so both the element and its list of attributes are in lower-case
3847 constMxpAttribHash => {
3848 # 'element' => undef,
3849 'el' => ['att', 'tag', 'flag', 'open', 'delete', 'empty'],
3850 # 'attlist' => undef,
3851 'at' => undef,
3852 # 'att' => undef,
3853 # 'entity' => undef,
3854 'en' => [
3855 'desc', 'private', 'publish', 'delete', 'add',
3856 'remove',
3857 ],
3858 # 'var' => undef,
3859 'v' => [
3860 'desc', 'private', 'publish', 'delete', 'add',
3861 'remove',
3862 ],
3863 'tag' => [
3864 'windowname', 'fore', 'back', 'gag', 'enable',
3865 'disable',
3866 ],
3867 # 'bold' => undef,
3868 'b' => undef,
3869 # 'italic' => undef,
3870 'i' => undef,
3871 # 'em' => undef,
3872 # 'underline' => undef,
3873 'u' => undef,
3874 # 'strikeout' => undef,
3875 's' => undef,
3876 # 'high' => undef,
3877 'h' => undef,
3878 # 'color' => undef,
3879 'c' => ['fore', 'back'],
3880 # 'font' => undef,
3881 'f' => ['face', 'size', 'color', 'back'],
3882 'nobr' => undef,
3883 'p' => undef,
3884 'br' => undef,
3885 'sbr' => undef,
3886 # '&nbsp' => undef,
3887 'a' => ['href', 'hint', 'expire'],
3888 'send' => ['href', 'hint', 'prompt', 'expire'],
3889 'expire' => undef,
3890 'version' => undef,
3891 'support' => undef,
3892 'h1' => undef,
3893 'h2' => undef,
3894 'h3' => undef,
3895 'h4' => undef,
3896 'h5' => undef,
3897 'h6' => undef,
3898 'small' => undef,
3899 'tt' => undef,
3900 'sound' => ['v', 'l', 'p', 'c', 't', 'u'],
3901 'music' => ['v', 'l', 'p', 'c', 't', 'u'],
3902 'gauge' => ['max', 'caption', 'color'],
3903 'stat' => ['max', 'caption'],
3904 'frame' => [
3905 'name', 'action', 'open', 'close', 'redirect',
3906 'title', 'internal', 'align', 'left', 'top',
3907 'width', 'height', 'scrolling', 'floating',
3908 ],
3909 # 'destination' => undef,
3910 'dest' => ['x', 'y', 'eol', 'eof'],
3911 'relocate' => undef,
3912 'quiet' => undef,
3913 'user' => undef,
3914 'password' => undef,
3915 'image' => [
3916 'fname', 'url', 't', 'h', 'w', 'hspace', 'vspace',
3917 'align', 'ismap',
3918 ],
3919 'filter' => ['src', 'dest', 'name'],
3920 # 'SCRIPT => undef, # Deprecated since MXP v0.4
3921 },
3922 # Hash of MXP tags which are synonyms of other tags, e.g. <B>, <BOLD> and <STRONG>
3923 # are all equivalent
3924 constMxpConvertHash => {
3925 'BOLD' => 'B',
3926 'STRONG' => 'B',
3927 'ITALIC' => 'I',
3928 'EM' => 'I',
3929 'UNDERLINE' => 'U',
3930 'STRIKEOUT' => 'S',
3931 'HIGH' => 'H',
3932 'COLOR' => 'C', # Is in MXP spec
3933 'FONT' => 'F', # Is not in MXP spec, but implemented anyway
3934 'ELEMENT' => 'EL',
3935 'ATTLIST' => 'AT',
3936 'ATT' => 'AT', # The MXP spec uses both <!AT> and <!ATT>
3937 'ENTITY' => 'EN',
3938 'VAR' => 'V',
3939 'DESTINATION' => 'DEST',
3940 },
3941 # Hash of MXP tags that are line-spacing tags that are routed to
3942 # $self->processMxpSpacingTag, not $self->processMxpElement
3943 constMxpLineSpacingHash => {
3944 '<NOBR>' => undef,
3945 '</NOBR>' => undef, # Invalid MXP tag, but still routed to
3946 # ->processMxpSpacingTag
3947 '<P>' => undef,
3948 '</P>' => undef, # Valid MXP tag
3949 '<BR>' => undef,
3950 '</BR>' => undef, # Invalid MXP tag
3951 '<SBR>' => undef,
3952 '</SBR>' => undef, # Invalid MXP tag
3953 '<HR>' => undef, # (Actually an MXP HTML element)
3954 '</HR>' => undef, # Invalid MXP tag
3955 },
3956 # Hash of MXP modal tags, such as <B> and </I>, that can be 'on' or 'off'. These are
3957 # also the only MXP tags that are allowed in open line mode ($self->mxpLineMode = 0)
3958 constMxpModalHash => {
3959 'B' => undef,
3960 'C' => undef,
3961 'F' => undef,
3962 'H' => undef,
3963 'I' => undef,
3964 'S' => undef,
3965 'U' => undef,
3966 },
3967 # Hash for converting some MXP modal tags into keys in
3968 # GA::Obj::TextView->mxpModalStackHash (for quick lookup, when processing an opening
3969 # tag like <B>, but not required when processing a closing tag like </B>)
3970 constMxpStackConvertHash => {
3971 'B' => 'bold_flag', # i.e. <B>
3972 'I' => 'italics_flag',
3973 'U' => 'underline_flag',
3974 'S' => 'strike_flag',
3975 'H' => 'bold_flag', # 'bold' and 'high' implemented same way
3976 },
3977 # Hashes for converting some MXP modal tags into Axmud style tags
3978 constMxpModalOnHash => {
3979 # 'B' => 'bold',
3980 'I' => 'italics', # i.e. <I>
3981 'U' => 'underline',
3982 'S' => 'strike',
3983 'H' => 'bold', # 'bold' and 'high' implemented same way
3984 },
3985 # Image file formats permitted by this implementation of MXP
3986 constMxpFormatHash => {
3987 # Supported in MXP spec
3988 'bmp' => undef,
3989 'gif' => undef,
3990 # Not supported in MXP spec, but supported by Axmud
3991 'jpg' => undef,
3992 'jpeg' => undef,
3993 'png' => undef,
3994 },
3995 # Constant hash of MXP entity names
3996 # (from http://www.gammon.com.au/mushclient/mxpentities.htm)
3997 # NB Does not include entities in the form '&#nnn;' - these are implemented directly by
3998 # GA::Session->extractMxpPuebloEntity and ->processMxpEntity
3999 constMxpEntityHash => {
4000 'Aacute' => chr(193),
4001 'aacute' => chr(225),
4002 'Acirc' => chr(194),
4003 'acirc' => chr(226),
4004 'acute' => chr(180),
4005 'AElig' => chr(198),
4006 'aelig' => chr(230),
4007 'Agrave' => chr(192),
4008 'agrave' => chr(224),
4009 'amp' => chr(38),
4010 'apos' => chr(39),
4011 'Aring' => chr(197),
4012 'aring' => chr(229),
4013 'Atilde' => chr(195),
4014 'atilde' => chr(227),
4015 'Auml' => chr(196),
4016 'auml' => chr(228),
4017 'brvbar' => chr(166),
4018 'Ccedil' => chr(199),
4019 'ccedil' => chr(231),
4020 'cedil' => chr(184),
4021 'cent' => chr(162),
4022 'copy' => chr(169),
4023 'curren' => chr(164),
4024 'deg' => chr(176),
4025 'divide' => chr(247),
4026 'Eacute' => chr(201),
4027 'eacute' => chr(233),
4028 'Ecirc' => chr(202),
4029 'ecirc' => chr(234),
4030 'Egrave' => chr(200),
4031 'egrave' => chr(232),
4032 'ETH' => chr(208),
4033 'eth' => chr(240),
4034 'Euml' => chr(203),
4035 'euml' => chr(235),
4036 'frac12' => chr(189),
4037 'frac14' => chr(188),
4038 'frac34' => chr(190),
4039 'gt' => chr(62),
4040 'Iacute' => chr(205),
4041 'iacute' => chr(237),
4042 'Icirc' => chr(206),
4043 'icirc' => chr(238),
4044 'iexcl' => chr(161),
4045 'Igrave' => chr(204),
4046 'igrave' => chr(236),
4047 'iquest' => chr(191),
4048 'Iuml' => chr(207),
4049 'iuml' => chr(239),
4050 'laquo' => chr(171),
4051 'lt' => chr(60),
4052 'macr' => chr(175),
4053 'micro' => chr(181),
4054 'middot' => chr(183),
4055 'nbsp' => chr(160),
4056 'not' => chr(172),
4057 'Ntilde' => chr(209),
4058 'ntilde' => chr(241),
4059 'Oacute' => chr(211),
4060 'oacute' => chr(243),
4061 'Ocirc' => chr(212),
4062 'ocirc' => chr(244),
4063 'Ograve' => chr(210),
4064 'ograve' => chr(242),
4065 'ordf' => chr(170),
4066 'ordm' => chr(186),
4067 'Oslash' => chr(216),
4068 'oslash' => chr(248),
4069 'Otilde' => chr(213),
4070 'otilde' => chr(245),
4071 'Ouml' => chr(214),
4072 'ouml' => chr(246),
4073 'para' => chr(182),
4074 'plusmn' => chr(177),
4075 'pound' => chr(163),
4076 'quot' => chr(34),
4077 'raquo' => chr(187),
4078 'reg' => chr(174),
4079 'sect' => chr(167),
4080 'shy' => chr(173),
4081 'sup1' => chr(185),
4082 'sup2' => chr(178),
4083 'sup3' => chr(179),
4084 'szlig' => chr(223),
4085 'THORN' => chr(222),
4086 'thorn' => chr(254),
4087 'times' => chr(215),
4088 'Uacute' => chr(218),
4089 'uacute' => chr(250),
4090 'Ucirc' => chr(219),
4091 'ucirc' => chr(251),
4092 'Ugrave' => chr(217),
4093 'ugrave' => chr(249),
4094 'uml' => chr(168),
4095 'Uuml' => chr(220),
4096 'uuml' => chr(252),
4097 'Yacute' => chr(221),
4098 'yacute' => chr(253),
4099 'yen' => chr(165),
4100 },
4101 # Flag set to TRUE if MXP should be allowed to change the font used, set to FALSE
4102 # otherwise
4103 allowMxpFontFlag => TRUE, # [config]
4104 # Flag set to TRUE if MXP should be allowed to display images in textviews, FALSE if
4105 # not
4106 allowMxpImageFlag => TRUE, # [config]
4107 # Flag set to TRUE if MXP should be allowed to download image files it doesn't already
4108 # have, FALSE if not
4109 allowMxpLoadImageFlag => TRUE, # [config]
4110 # Flag set to TRUE if MXP should be allowed to use image files in the world's own
4111 # graphics format (using the <FILTER> tag, FALSE if not
4112 allowMxpFilterImageFlag => TRUE, # [config]
4113 # Flag set to TRUE if MXP should be allowed to play sound/music (if sound is enabled
4114 # generally), set to FALSE otherwise
4115 allowMxpSoundFlag => TRUE, # [config]
4116 # Flag set to TRUE if MXP should be allowed to download sound files it doesn't already
4117 # have, FALSE if not
4118 allowMxpLoadSoundFlag => TRUE, # [config]
4119 # Flag set to TRUE if MXP should be allowed to display gauges/status bars, FALSE if not
4120 allowMxpGaugeFlag => TRUE, # [config]
4121 # Flag set to TRUE if MXP should be allowed to use frames (exterior and interior),
4122 # FALSE if not
4123 allowMxpFrameFlag => TRUE, # [config]
4124 # Flag set to TRUE if MXP should be allowed to use interior frames (when available),
4125 # set to FALSE if only exterior frames should be used (ignored if
4126 # $self->allowMxpFrameFlag is FALSE)
4127 allowMxpInteriorFlag => TRUE, # [config]
4128 # Flag set to TRUE if MXP should be allowed to perform crosslinking operations
4129 # (connect to a new server), FALSE if not
4130 allowMxpCrosslinkFlag => TRUE, # [config]
4131 # Flag set to TRUE if the Locator task should stop looking for room statement anchors
4132 # when it encounters the first MXP 'RoomName', 'RoomDesc', 'RoomExit' or 'RoomNum',
4133 # and to use those exclusively from then on; set to FALSE if the Locator task should
4134 # ignore those MXP tag flags and look for anchor lines as normal
4135 allowMxpRoomFlag => TRUE, # [config]
4136 # Flag set to TRUE if Axmud should recognise some illegal MXP keywords (for example,
4137 # those using hyphens instead of underlines); FALSE if it should only allow legal
4138 # MXP keywords
4139 allowMxpFlexibleFlag => FALSE, # [config]
4140 # Flag set to TRUE if GA::Session should assume that MXP has been negotiated with the
4141 # server (by artificially changing the value of GA::Session->mxpMode from 'no_invite'
4142 # to 'client_agree' once automatic logic is complete); FALSE if Axmud should rely on
4143 # telnet option negoatiation, as normal
4144 # (Can be set to TRUE for IRE MUDs that provide MXP by default, but don't negotiate it
4145 # with the client)
4146 allowMxpPermFlag => FALSE, # [config]
4147 # Flag temporarily set to TRUE when modifying the flags above, if
4148 # $self->set_allowMxpFlag should not issue a new MXP <SUPPORTS> tag, as it normally
4149 # would; usually set to FALSE
4150 mxpPreventSupportFlag => FALSE,
4151  
4152 # Hash of all official Pueblo tags (including those not implemented by Axmud)
4153 constPuebloOfficialHash => {
4154 # http://pueblo.sourceforge.io/doc/manual/html_standard_elements.html
4155 # Document Structure Elements
4156 'BODY' => undef, # partially implemented
4157 'HEAD' => undef, # NOT implemented
4158 'HTML' => undef, # NOT implemented
4159 'TITLE' => undef, # NOT implemented
4160 # Anchor Element
4161 'A' => undef, # partially implemented
4162 # Embed Element
4163 'EMBED' => undef, # NOT implemented
4164 # Image Element
4165 'IMG' => undef, # partially implemented
4166 # Block Formatting Elements
4167 'ADDRESS' => undef, # NOT implemented
4168 'BASEFONT' => undef, # implemented
4169 'BLOCKQUOTE' => undef, # NOT implemented
4170 'BR' => undef, # partially implemented
4171 'CENTER' => undef, # implemented
4172 'H1' => undef, # partially implemented
4173 'H2' => undef, # partially implemented
4174 'H3' => undef, # partially implemented
4175 'H4' => undef, # partially implemented
4176 'H5' => undef, # partially implemented
4177 'H6' => undef, # partially implemented
4178 'HR' => undef, # partially implemented
4179 'LISTING' => undef, # NOT implemented
4180 'P' => undef, # partially implemented
4181 'PLAINTEXT' => undef, # NOT implemented
4182 'PRE' => undef, # partially implemented
4183 'SAMP' => undef, # implemented
4184 'XMP' => undef, # NOT implemented
4185 # Character Formatting Elements
4186 'B' => undef, # implemented
4187 'CITE' => undef, # implemented
4188 'CODE' => undef, # implemented
4189 'EM' => undef, # implemented
4190 'FONT' => undef, # implemented
4191 'I' => undef, # implemented
4192 'STRIKE' => undef, # implemented
4193 'STRONG' => undef, # implemented
4194 'TT' => undef, # implemented
4195 'U' => undef, # implemented
4196 # List Elements
4197 'DL' => undef, # NOT implemented
4198 'DIR' => undef, # NOT implemented
4199 'LI' => undef, # implemented
4200 'MENU' => undef, # NOT implemented
4201 'OL' => undef, # implemented
4202 'UL' => undef, # implemented
4203 # Form Elements
4204 'FORM' => undef, # NOT implemented
4205 'INPUT' => undef, # NOT implemented
4206 'OPTION' => undef, # NOT implemented
4207 'SELECT' => undef, # NOT implemented
4208 'TEXTAREA' => undef, # NOT implemented
4209 # Unsupported HTML elements
4210 'ISINDEX' => undef, # NOT implemented
4211 'KBD' => undef, # NOT implemented
4212 'LINK' => undef, # NOT implemented
4213 'META' => undef, # NOT implemented
4214 'NEXTID' => undef, # NOT implemented
4215 'TABLE' => undef, # NOT implemented
4216 'VAR' => undef, # NOT implemented
4217 # http://pueblo.sourceforge.io/doc/manual/html_pueblo_extensions.html
4218 # Basic extensions to HTML
4219 # 'EVENT' => undef, # an <IMG> attribute, NOT implemented
4220 # 'XCH_HINT' => undef, # an <A> attribute, implemented
4221 'XCH_PAGE' => undef, # partially implemented
4222 'XCH_PANE' => undef, # partially implemented
4223 'XCH_PREFETCH' => undef, # NOT implemented
4224 # 'XCH_PROB' => undef, # <XCH_PREFETCH> attribute, NOT implemented
4225 # Extensions for interactivity
4226 'XCH_CMD' => undef, # an <A> attribute, implemented
4227 # 'XCH_MODE' => undef, # an <IMG> attribute, implemented
4228 'XCH_MUDTEXT' => undef, # implemented
4229 # Extensions for graphics
4230 'XCH_GRAPH' => undef, # NOT implemented
4231 # Extensions for sound
4232 'XCH_SOUND' => undef, # an <IMG> attribute, partially implemented
4233 'XCH_SPEECH' => undef, # NOT implemented
4234 'XCH_VOLUME' => undef, # NOT implemented
4235 'XCH_ALERT' => undef, # implemented
4236 'XCH_DEVICE' => undef, # NOT implemented
4237 # http://pueblo.sourceforge.io/doc/manual/vrml_pueblo_extensions.html
4238 'XCH_CMD_INFO' => undef, # NOT implemented
4239 # http://www.gammon.com.au/forum/?id=281
4240 'COLOR' => undef, # implemented, but not in Pueblo 2.50 spec
4241 'SEND' => undef, # implemented, but not in Pueblo 2.50 spec
4242 },
4243 # Hash of all implemented Pueblo tags (a subset of $self->constPuebloOfficialHash)
4244 constPuebloImplementHash => {
4245 'A' => undef, # partially implemented
4246 'B' => undef,
4247 'BASEFONT' => undef,
4248 'BODY' => undef, # partially implemented
4249 'BR' => undef, # partially implemented
4250 'CENTER' => undef,
4251 'CODE' => undef,
4252 'COLOR' => undef, # implemented, but not in Pueblo 2.50 spec
4253 'EM' => undef,
4254 'FONT' => undef,
4255 'H1' => undef, # partially implemented
4256 'H2' => undef, # partially implemented
4257 'H3' => undef, # partially implemented
4258 'H4' => undef, # partially implemented
4259 'H5' => undef, # partially implemented
4260 'H6' => undef, # partially implemented
4261 'HR' => undef, # partially implemented
4262 'I' => undef,
4263 'IMG' => undef, # partially implemented
4264 'LI' => undef,
4265 'OL' => undef,
4266 'P' => undef, # partially implemented
4267 'PRE' => undef, # partially implemented
4268 'SAMP' => undef, # implemented
4269 'SEND' => undef, # implemented, but not in Pueblo 2.50 spec
4270 'STRIKE' => undef,
4271 'STRONG' => undef,
4272 'TT' => undef,
4273 'U' => undef,
4274 'UL' => undef,
4275 'XCH_ALERT' => undef,
4276 'XCH_MUDTEXT' => undef,
4277 'XCH_PAGE' => undef, # partially implemented
4278 'XCH_PANE' => undef, # partially implemented
4279 },
4280 # Hash of Pueblo tags which are synonyms of other tags, e.g. <B>, <EM> and <STRONG> are
4281 # all equivalent
4282 constPuebloConvertHash => {
4283 'CITE' => 'I',
4284 'EM' => 'B',
4285 'STRONG' => 'B',
4286 },
4287 # Hash of Pueblo modal tags, such as <B> and </I>, that can be 'on' or 'off'
4288 constPuebloModalHash => {
4289 'B' => undef,
4290 'I' => undef,
4291 'STRIKE' => undef,
4292 'U' => undef,
4293 },
4294  
4295 # Hash of ZMP package objects (GA::Obj::Zmp), in the form
4296 # $zmpPackageHash{object_name} = blessed_reference_to_package_object
4297 # ...where 'object_name' is in the form 'PackageName@WorldName' for a ZMP package that
4298 # should be available for any session connected to the world name 'WorldName', or
4299 # 'PackageName@' for a ZMP package that should be available for all sessions
4300 # ZMP package objects should be created by plugins. Creating the object by calling
4301 # GA::Obj::Zmp->new automatically updates this hash
4302 # The hash is not saved in any data file. Package objects cannot be modified once
4303 # created, and must not be removed from this hash once created - you must edit the
4304 # plugin that created and then restart Axmud, instead
4305 zmpPackageHash => {},
4306  
4307 # Constant list of recognised MNES values for CHARSET
4308 # The value used in IVs like $self->charSet, GA::Session->worldCharset and
4309 # GA::Profile::World->worldCharSet is generally provided by the system, and might be
4310 # longer than the values described here (for example, 'koi8-r' instead of the MNES
4311 # value, 'KOI-8')
4312 # Therefore, GA::Session->processNewEnvironData tries to find a close match, rather than
4313 # an exact match, with one of these values. If no match can be found, 'ASCII' is used
4314 # as the default
4315 constMnesCharsetList => [
4316 'ASCII', 'BIG-5', 'ISO-8859-1', 'ISO-8859-2', 'FANSI', 'GB-18030', 'KOI-8', 'UTF-8',
4317 ],
4318 # Flag set to TRUE if MNES should be able to send the user's real IP address (any proxy
4319 # notwithstanding)
4320 allowMnesSendIPFlag => FALSE, # [config]
4321  
4322 # Constant list of MCP packages supported by Axmud by default, and the package versions
4323 # that are supported. List in groups of 4, in the form
4324 # (mcp_package_name, perl_package_name, minimum_version, maximum_version, ...)
4325 # ...where 'minimum_version' and 'maximum_version' refer to the version of the
4326 # package itself, not the version of MCP that Axmud uses (2.1)
4327 constMcpPackageList => [
4328 # Official packages
4329 'mcp-negotiate',
4330 'Games::Axmud::Mcp::NegotiateCan',
4331 '1.0',
4332 '2.0',
4333 'mcp-cord',
4334 'Games::Axmud::Mcp::Cord',
4335 '1.0',
4336 '1.0',
4337 # Non-official packages
4338 'dns-org-mud-moo-simpleedit',
4339 'Games::Axmud::Mcp::SimpleEdit',
4340 '1.0',
4341 '1.0',
4342 ],
4343 # Hash of MCP package objects, inheriting from GA::Generic::MCP. The hash includes
4344 # the packages specified in $self->constMcpPackageList, as well as any MCP package
4345 # pbjects added by plugins (via a call to $self->addPluginMcpPackages)
4346 # When a GA::Session wants to use a plugin, it clones the MCP package object, placing
4347 # the clone into its own ->mcpPackageHash IV
4348 # Hash in the form
4349 # $mcpPackageHash{package_name} = blessed_reference_to_package_object
4350 mcpPackageHash => {},
4351  
4352 # Constant list of terminal types currently supported by Axmud. The first item in the
4353 # list also serves as the 'default' terminal type, if it is needed. The last item in
4354 # the list must be 'unknown', and is sent to the server during telnet option
4355 # negotiations, if the server doesn't recognise anything else
4356 # Axmud supports xterm trucolor (https://tintin.mudhalla.net/info/truecolor/), so the
4357 # 'xterm-truecolor' item communicates this support to the server
4358 # For the 'xterm' item, Axmud does not do full xterm-emulation; it merely recognises
4359 # xterm-256 colours used by some MUDs (as well as OSC colour palette support)
4360 constTermTypeList => [
4361 'ansi', 'vt100', 'xterm-truecolor', 'xterm', 'dumb', 'unknown',
4362 ],
4363 # Which information is sent to the server during TTYPE option negotiations (when
4364 # $self->useMttsFlag is FALSE):
4365 # 'send_nothing' - (Nothing sent - should be set to 0 if ->useTTypeFlag is FALSE)
4366 # 'send_client' - Send the client name, followed by everything in
4367 # ->constTermTypeList (one at a time)
4368 # 'send_client_version'
4369 # - Send the client name and version (as a single string), followed by
4370 # everything in ->constTermTypeList (one at a time)
4371 # 'send_custom_client'
4372 # - Send a customised client name and customised client version,
4373 # followed by everything in ->constTermTypeList (one at a time)
4374 # 'send_default' - Send everything in ->constTermTypeList (one at a time)
4375 # 'send_unknown' - Send 'unknown'
4376 #
4377 # NB For modes 'send_client', 'send_client_version', 'send_custom_client',
4378 # 'send_default', if the current world profile's ->termType is set, that is sent
4379 # first, before everything else
4380 # NB When $self->useMttsFlag is TRUE, ->termTypeMode is ignored. We send the client
4381 # name, followed by either the world profile's ->termType (if set) or 'xterm'
4382 # (if not set), followed by the MTTS message
4383 # NB This IV, as well as ->customClientName and ->customClientVersion, are also used by
4384 # MXP, ZMP and MNES.
4385 termTypeMode => 'send_client', # [config]
4386 # In mode 'send_custom_client' (or when $self->useMttsFlag is TRUE), the customised
4387 # client name to send (if 'undef' or an empty string, it is not sent, instead the
4388 # first item in ->constTermTypeList is sent)
4389 customClientName => '', # [config]
4390 # In mode 'send_custom_client' (or when $self->useMttsFlag is TRUE), the customised
4391 # client version to send (if 'undef', or an empty string, or if ->customClientName is
4392 # 'undef' or an empty string, it is not sent at all)
4393 customClientVersion => '', # [config]
4394  
4395 # Flag set to TRUE if VT100 control sequences should be accepted. If FALSE, they are
4396 # ignored (and 'vt100' is not used in terminal type negotations)
4397 # (Even when FALSE, escape sequences in the form 'ESC [ value ; value m' are still
4398 # accepted
4399 useCtrlSeqFlag => TRUE, # [config]
4400 # Flag set to TRUE if a visible cursor should be displayed in each session's default
4401 # textview (only really useful for VT100 emulation, but available all the time)
4402 useVisibleCursorFlag => FALSE, # [config]
4403 # Flag set to TRUE if a visible cursor should blink quickly; FALSE if it should blink at
4404 # a normal rate. Ignored if ->useVisibleCursorFlag is FALSE
4405 useFastCursorFlag => FALSE, # [config]
4406 # Flag set to TRUE if certain keycodes should be sent directly to the world, FALSE
4407 # otherwise
4408 # In addition, when TRUE and a session's special echo mode is enabled, world commands
4409 # are sent to the world immediately, each character sent as soon as it's typed
4410 # NB In Axmud blind mode, the escape and cursor keys are hijacked for use with TTS.
4411 # Users can use the ';freekeys' command to temporarily release them for use as direct
4412 # keys (or for any other reason)
4413 useDirectKeysFlag => FALSE, # [config]
4414 # Keycodes available in numeric keypad alternate mode (GA::Session->ctrlKeypadMode is
4415 # 'alternate') and cursor key application mode (GA::Session->ctrlCursorMode is
4416 # 'application') (assuming that $self->useDirectKeysFlag is TRUE)
4417 constDirectAppKeysHash => {
4418 'up' => chr(27) . 'OA',
4419 'down' => chr(27) . 'OB',
4420 'right' => chr(27) . 'OC',
4421 'left' => chr(27) . 'OD',
4422 },
4423 # Constant hashes of Axmud keycodes and their corresponding VT100 escape sequences
4424 # Keycodes available in numeric keypad alternate mode (GA::Session->ctrlKeypadMode is
4425 # 'alternate') (assuming that $self->useDirectKeysFlag is TRUE)
4426 constDirectAltKeysHash => {
4427 'kp_enter' => chr(27) . 'OM',
4428 # 'kp_comma' => chr(27) . 'Ol', # This Axmud keycode doesn't exist
4429 'kp_subtract' => chr(27) . 'Om',
4430 'kp_0' => chr(27) . 'Op',
4431 'kp_1' => chr(27) . 'Oq',
4432 'kp_2' => chr(27) . 'Or',
4433 'kp_3' => chr(27) . 'Os',
4434 'kp_4' => chr(27) . 'Ot',
4435 'kp_5' => chr(27) . 'Ou',
4436 'kp_6' => chr(27) . 'Ov',
4437 'kp_7' => chr(27) . 'Ow',
4438 'kp_8' => chr(27) . 'Ox',
4439 'kp_9' => chr(27) . 'Oy',
4440 },
4441 # Keycodes available at all times (assuming that $self->useDirectKeysFlag is TRUE, and
4442 # the previous two hashes take precedence)
4443 constDirectKeysHash => {
4444 'up' => chr(27) . '[A',
4445 'down' => chr(27) . '[B',
4446 'right' => chr(27) . '[C',
4447 'left' => chr(27) . '[D',
4448 'num_lock' => chr(27) . 'OP', # PF1 / not available on MSWin/*BSD
4449 'kp_divide' => chr(27) . 'OQ', # PF2
4450 'kp_multiply' => chr(27) . 'OR', # PF3
4451 'kp_subtract' => chr(27) . 'OS', # PF4
4452 },
4453 # Constant hash of Axmud keycodes which must be intercepted by a ->signal_connect in
4454 # GA::Win::Internal->setKeyPressEvent and sent to the world, whenever a session's
4455 # special echo mode is enabled
4456 constDirectSpecialKeysHash => {
4457 'escape' => chr(27),
4458 'tab' => chr(11),
4459 'backspace' => chr(8),
4460 'delete' => chr(127),
4461 },
4462  
4463 # Debugging flag set to TRUE if invalid escape sequences should be displayed as 'debug'
4464 # messages, FALSE otherwise
4465 debugEscSequenceFlag => FALSE, # [config]
4466 # Debugging flag set to TRUE if incoming option negotiations should be displayed as
4467 # 'debug' messages, FALSE otherwise
4468 debugTelnetFlag => FALSE, # [config]
4469 # Parallel debugging flag set to TRUE if a very short 'debug' message should be
4470 # displayed for incoming option negotiations (ignored if ->debugTelnetFlag is TRUE)
4471 debugTelnetMiniFlag => FALSE, # [config]
4472 # Debugging flag set to TRUE if GA::Obj::Telnet should write its own logfile for
4473 # option negotiations, telopt.log (store in Axmud's base directory)
4474 debugTelnetLogFlag => FALSE, # [config]
4475 # Debugging flag set to TRUE if MSDP data sent to Status/Locator tasks should be
4476 # displayed as 'debug' messages, FALSE otherwise
4477 debugMsdpFlag => FALSE, # [config]
4478 # Debugging flag set to TRUE if MXP errors should be displayed as 'debug' messages,
4479 # FALSE otherwise
4480 debugMxpFlag => FALSE, # [config]
4481 # Debugging flag set to TRUE if MXP comment elements should be displayed as 'debug'
4482 # messages, FALSE otherwise
4483 debugMxpCommentFlag => FALSE, # [config]
4484 # Debugging flag set to TRUE if Pueblo errors should be displayed as 'debug' messages,
4485 # FALSE otherwise
4486 debugPuebloFlag => FALSE, # [config]
4487 # Debugging flag set to TRUE if Pueblo comment elements should be displayed as 'debug'
4488 # messages, FALSE otherwise
4489 debugPuebloCommentFlag => FALSE, # [config]
4490 # Debugging flag set to TRUE if ZMP data should be displayed as 'debug' messages, FALSE
4491 # otherwise
4492 debugZmpFlag => FALSE, # [config]
4493 # Debugging flag set to TRUE if incoming ATCP data should be displayed as 'debug'
4494 # messages, FALSE otherwise
4495 debugAtcpFlag => FALSE, # [config]
4496 # Debugging flag set to TRUE if incoming GMCP data should be displayed as 'debug'
4497 # messages, FALSE otherwise
4498 debugGmcpFlag => FALSE, # [config]
4499 # Debugging flag set to TRUE if MCP errors should be displayed as 'debug' messages,
4500 # FALSE otherwise
4501 debugMcpFlag => FALSE, # [config]
4502  
4503 # Desktop and display settings
4504 # ----------------------------
4505  
4506 # Display variables
4507 # Axmud makes use of a number of windows, both those it creates and 'external' windows
4508 # it doesn't create
4509 # 'grid' windows are permanent (or semi-permanent). Axmud tries to arrange these windows
4510 # so they don't overlap or, if there isn't enough room on the workspace, to make them
4511 # overlap in sensible ways. Axmud tries to take account of the different desktop
4512 # environments in getting the positioning of its windows right. 'grid' windows can
4513 # include 'external' windows, such as media players, so that they don't overlap
4514 # Axmud's own windows (if required)
4515 # 'free' windows are temporary, and are displayed in the middle of the workspace without
4516 # regard for the positioning of any 'grid' windows
4517 # If your system has multiple workspaces available, 'grid' windows can be arranged on
4518 # each one of them. Each workspace can have one or more 'workspace grids' on which
4519 # 'grid' windows for that workspace are arranged
4520 #
4521 # NB Recent Axmud versions can draw task windows and the Automapper window inside the
4522 # 'main' window, as well as in separate 'grid' windows, as before. These are called
4523 # 'pseudo-windows'. Their ->number IV is always -1, and they don't appear in registry
4524 # hashes of windows. This feature is experimental, so in general comments don't
4525 # mention them
4526 #
4527 # There are two modes for handling windows in multiple sessions, according to the
4528 # setting of this flag:
4529 # TRUE (traditional) : All sessions share a single 'main' window. The 'main'
4530 # window's Gtk3::Grid contains one table object, a pane object
4531 # (GA::Table::Pane) which displays text received from each session's world
4532 # in a separate tab. No other widgets are allowed on the table. Other
4533 # 'internal' windows may be visible; on each workspace, they are arranged on
4534 # workspace grids belonging to their session (on every workspace, one
4535 # workspace grid for every session). The current session is the one whose tab
4536 # is visible; only its 'internal' windows are visible; 'internal' windows
4537 # controlled by other sessions are not visible (usually minimised)
4538 # FALSE: All sessions have their own 'main' window. The 'main' window's
4539 # Gtk3::Grid contains at least one pane object, but can also contain other
4540 # table widgets (including other pane objects). Other 'internal' windows are
4541 # arranged on a workspace grid shared by all sessions (one workspace grid for
4542 # every workspace in use). When the current session changes, no windows are
4543 # made visible or invisible (usually minimised or un-minimised)
4544 shareMainWinFlag => TRUE, # [config]
4545 # When the user wants to change the setting of ->shareMainWinFlag, the change can't be
4546 # applied immediately.
4547 # Instead, this IV is set to 'on' or 'off'. When Axmud next starts, if this IV is not
4548 # set to 'default', ->shareMainWinFlag is set to TRUE (for 'on') or FALSE (for 'off');
4549 # ->restartShareMainWinMode is then set back to 'default'
4550 restartShareMainWinMode => 'default', # [config]
4551 # Workspace grids can be available, or not. GA::Obj::Desktop->gridPermitFlag is set to
4552 # FALSE if workspace grids are not available at all (because the desktop is too small,
4553 # because Axmud is running on MS Windows or running in blind mode, etc)
4554 # Independent of that flag is this one, which the user can set with
4555 # ';activategrid' and ';disactivategrid'. When Axmud starts, it tries to create
4556 # workspace grids if this flag and GA::Obj::Desktop->gridPermitFlag are both TRUE
4557 activateGridFlag => TRUE, # [config]
4558 # When workspace grids are not available, Axmud can try to remember the size and
4559 # position of its 'grid' windows. Users can adjust the size/positions manually, and
4560 # have those settings applied in future sessions
4561 # Flag set to TRUE if Axmud should try to remember the size and position of 'grid'
4562 # windows, FALSE if not (can be TRUE even if workspace grids are available)
4563 storeGridPosnFlag => FALSE, # [config]
4564 # When ->storeGridPosnFlag is TRUE, Axmud uses this hash to store the size/position of
4565 # each 'grid' window with a unique ->winName (e.g. 'main', 'status_task', 'map').
4566 # When it's FALSE, this hash is not updated at all
4567 # A key-value pair is created when a 'grid' window is created, if there's not already a
4568 # matching entry in the hash
4569 # If a 'grid' window is created when workspace grids are not available, and if there's
4570 # an entry in this hash with the same ->winName, that entry is used for the size and
4571 # position of the new 'grid' window. If, on the other hand, workspace grids are
4572 # available, then the new window's size and position is set by the workspace grid code
4573 # If a 'grid' window is resized (by code or manually by the user) and it's either the
4574 # only window with the same ->winName open, or the first one of that ->winName that
4575 # was opened, then the entry in this hash is updated
4576 # 'External' windows are never added to this hash
4577 # Hash in the form
4578 # ->storeGridPosnHash{window_name} = list_reference
4579 # ...where 'list_reference' is a reference to a list in the form (x y width height). At
4580 # least one of the four values must be defined. When a 'grid' window is created and
4581 # workspace grids aren't available, the posn is only used if both 'x' and 'y' are
4582 # defined, and the size is only used if both 'width' and 'height' are defined. Those
4583 # are the minimum requirements; in actual use, Axmud's code almost certainly delivers
4584 # an entry with all four values defined
4585 storeGridPosnHash => {}, # [config]
4586 #
4587 # Constant hash of standard 'grid' window types (any type of window that can be put onto
4588 # a workspace grid; includes 'external' windows, but doesn't include the data viewer
4589 # window, 'edit' windows, 'pref' windows, 'dialogue' windows etc)
4590 # NB 'Internal' windows are a sub-class of 'grid' window handled by GA::Win::Internal,
4591 # consisting of the window types 'main', 'protocol' and 'custom'
4592 # Hash in the form
4593 # $constWinTypeHash{window_type} = 'undef'
4594 # ...where 'window_type' matches GA::Generic::GridWin->winType
4595 constGridWinTypeHash => {
4596 # Any 'grid' window used as a 'main' window by any session (can be created only by
4597 # GA::Client or GA::Session)
4598 'main' => undef,
4599 # Any 'grid' window used as an Automapper window (can be created by any code)
4600 'map' => undef,
4601 # Any 'grid' window created by a MUD protocol such as MXP (can be created only by
4602 # GA::Session)
4603 'protocol' => undef,
4604 # Any 'grid' window NOT used as a 'main' window by any session (besides 'map' and
4605 # 'protocol' windows), whose widgets can't be customised (can be created by any
4606 # code)
4607 'fixed' => undef,
4608 # Any 'grid' window NOT used as a 'main' window by any session (besides 'map' and
4609 # 'protocol' windows), whose widgets can be customised (e.g. windows controlled
4610 # by individual tasks; can be created by any code)
4611 'custom' => undef,
4612 # Any 'external' window (not created by Axmud, but which has been placed on a
4613 # workspace grid, such as media players (can be created only by GA::Session)
4614 'external' => undef,
4615 },
4616 # Constant hash of standard 'free' window types (temporary windows that can't be put
4617 # onto a workspace grid)
4618 # Hash in the form
4619 # $constFreeWinTypeHash{window_type} = 'undef'
4620 # ...where 'window_type' matches GA::Generic::FreeWin->winType
4621 constFreeWinTypeHash => {
4622 # The data viewer window
4623 'viewer' => undef,
4624 # All 'edit' windows
4625 'edit' => undef,
4626 # All preference windows (collectively, 'edit' and 'pref' windows are called
4627 # 'config' windows)
4628 'pref' => undef,
4629 # All wizard windows
4630 'wiz' => undef,
4631 # All 'dialogue' windows
4632 'dialogue' => undef,
4633 # Any other kind of temporary window can use this window type
4634 'other' => undef,
4635 },
4636 #
4637 # The layout of 'internal' windows can be customised. The 'plan' for arranging widgets
4638 # in an 'internal' window is called a winmap, and is handled by a GA::Obj::Winmap
4639 # object
4640 # The winmap divides the window's client area into horizontal (by default) or vertical
4641 # strips (conceptually, not using a specific Gtk3 widget)
4642 # The winmap only affects the window when it is first created (or when it is reset).
4643 # The Axmud code is then free to add/remove strips, or add/remove/resizes widgets
4644 # within the Gtk3::Grid, whenever it pleases
4645 # Axmud has several standard winmaps, which can't be modified by the user (but which
4646 # can be cloned, and the clones are modifiable)
4647 # 'main_wait' - The winmap used in the spare 'main' window visible when Axmud starts,
4648 # before the first session is created. From top to bottom, the window will contain
4649 # a menu bar, toolbar, Gtk3::Grid and an entry box. The Gtk3::Grid contains no
4650 # table objects
4651 # 'internal_wait' - The equivalent of 'main_wait' for 'internal' windows other than
4652 # 'main' windows. It's probably not required by anything, but is available
4653 # nonetheless. The window contains only one strip object, the compulsory
4654 # GA::Strip::Table; it contains no table objects
4655 # 'main_fill' - The default winmap for 'main' windows. From top to bottom, the window
4656 # will contain a menu bar, toolbar, Gtk3::Grid, a gauge box, an entry box and an
4657 # info box. The Gtk3::Grid contains a single pane object (GA::Table::Pane, which
4658 # consists of one or two Gtk3::TextViews sharing a single Gtk3::TextBuffer)
4659 # filling the whole table
4660 # 'main_part' - The same as 'main_fill', but the single pane object fills two-thirds
4661 # of the left-hand side of the table, leaving the remaining third empty for other
4662 # widgets
4663 # 'main_empty' - The same as 'main_fill', but the Gtk3::Grid is empty
4664 # 'basic_fill' - The default winmap for 'internal' windows besides 'main' windows.
4665 # Contains only a Gtk3::Grid. The Gtk3::Grid contains a single pane object
4666 # filling the whole table
4667 # 'basic_part' - The same as 'basic_fill', but the single pane object fills only the
4668 # lower quarter of the table, leaving plenty of room for other widgets
4669 # 'basic_empty' - The same as 'basic_fill', but the Gtk3::Grid is empty
4670 # 'entry_fill' - From top to bottom, contains a Gtk3::Grid and an entry box. The
4671 # Gtk3::Grid contains a single pane object filling the whole table
4672 # 'entry_part' - The same as 'entry_fill', but the single pane object fills only the
4673 # lower quarter of the table, leaving plenty of room for other widgets
4674 # 'entry_empty' - The same as 'entry_fill', but the Gtk3::Grid is empty
4675 # Constant registry hash of standard winmap names, in the form
4676 # $constWinmapNameHash->{name} = undef
4677 constWinmapNameHash => {
4678 'main_wait' => undef,
4679 'main_fill' => undef,
4680 'main_part' => undef,
4681 'main_empty' => undef,
4682 'basic_fill' => undef,
4683 'basic_part' => undef,
4684 'basic_empty' => undef,
4685 'entry_fill' => undef,
4686 'entry_part' => undef,
4687 'entry_empty' => undef,
4688 },
4689 # Registry hash of blessed references to all winmap objects. Names have max of 16 chars.
4690 # Hash in the form
4691 # $winmapHash{name} = blessed_reference_to_winmap_object
4692 winmapHash => {}, # [winmaps]
4693 # A hash containing only the 'standard' winmap objects, a subset of
4694 # $self->winmapHash (filled by GA::Obj::Winmap->setupStandardWinmap)
4695 standardWinmapHash => {}, # [winmaps]
4696 # The name of the default winmaps to use when a 'main' window or other 'internal'
4697 # window object is created
4698 # Constant default values for the winmaps (these values never change)
4699 # Default winmap for 'main' windows when workspace grids are enabled
4700 # ($self->activateGridFlag = TRUE)
4701 constDefaultEnabledWinmap => 'main_fill',
4702 # Default winmap for 'main' windows when workspace grids are disabled
4703 # ($self->activateGridFlag = FALSE)
4704 constDefaultDisabledWinmap => 'main_part',
4705 # Default winmap for other 'internal' windows besides 'main' windows
4706 constDefaultInternalWinmap => 'basic_fill',
4707 # Customisable default values for the winmaps
4708 defaultEnabledWinmap => undef, # [winmaps] Set below
4709 defaultDisabledWinmap => undef, # [winmaps] Set below
4710 defaultInternalWinmap => undef, # [winmaps] Set below
4711 #
4712 # A workspace grid is divided into 'gridblocks'. The size of a gridblock can be changed,
4713 # but the default size is 10x10 pixels (min 1, max 100)
4714 # 'Grid' windows are moved and resized to fit on a workspace grid, leaving no partially-
4715 # filled gridblocks, and no gridblocks with more than one window occupying them
4716 # In fact, a workspace grid exists in three dimensions, allowing Axmud to stack windows
4717 # on top of each other when the workspace grid is full. The default number of layers
4718 # is 16 and the layer at the bottom is the default one. (Both of these values can be
4719 # changed.)
4720 # 'Grid' windows are usually placed in the default layer. If there's no room for them
4721 # there, they're placed in the first available layer below; if there are no available
4722 # layers below (which will be the case, if the default layer is at the bottom),
4723 # they're placed in the first available layer above
4724 # Constant default value for a workspace griblock
4725 # (This value never changes; min - 1 pixel, max - 100)
4726 constGridBlockSize => 10,
4727 # Customisable default size for a workspace gridblock
4728 gridBlockSize => undef, # [config] Set below
4729 #
4730 # The 'plan' for a workspace grid is called a zonemap. Zonemaps are 60x60 grids,
4731 # regardless of the size of the workspace.
4732 # A zonemap is filled with zone models. Zone models are a 'plan' for an individual zone
4733 # on a workspace grid
4734 #
4735 # PLAN ACTUAL
4736 # zonemap -> workspace grid
4737 # zone model -> zone
4738 #
4739 # Axmud will try to make the zonemap fit onto the workspace grid as closely as possible,
4740 # but because of the irregular size of some workspaces, zones in the zonemap might not
4741 # be in exactly the same proportions as zones in the gridmap.
4742 # Axmud has several standard zonemaps, which can't be modified by the user (but which
4743 # can be cloned, and the clones are modifiable)
4744 # 'single' - The entire workspace is covered by a single zone. Windows (even 'main'
4745 # windows) use their default sizes. Windows cannot be stacked above each other
4746 # 'single2' - A modified version of 'single', in which windows can be stacked above
4747 # each other
4748 # 'basic' - Intended for use when $self->shareMainWinFlag = TRUE. There are two zones.
4749 # The first zone covers the left-hand 2/3 of the workspace and is reserved for a
4750 # single 'main' window. The other zone covers the right-hand 1/3 of the workspace
4751 # and is available for all 'grid' windows (and only those windows can be stacked
4752 # above each other). The first 'main' window expands to fill the whole of its
4753 # zone. Other windows use their default sizes
4754 # 'extended' - Intended for use when $self->shareMainWinFlag = TRUE. The left-hand 2/3
4755 # of the workspace is reserved for a single 'main' window and the Status and
4756 # Locator task windows. The task windows go above the first 'main' window; the
4757 # Status window is to the left of the Locator window. The right-hand 1/3 of the
4758 # workspace is reserved for a single 'map' window at the top half and any other
4759 # 'grid' windows at the bottom half (and only those windows can be stacked above
4760 # each other)
4761 # 'widescreen' - A modified version of 'extended' for widescreen monitors, with the
4762 # the workspace divided into halves, rather than a 2/3 - 1/3 split
4763 # 'horizontal' - Intended for use when $self->shareMainWinFlag = FALSE. The workspace
4764 # is divided into two halves, left and right, with each half occupied by a single
4765 # session's windows. Inside the half, the 'main' window is at the bottom, and
4766 # other windows are at the top. Windows cannot be stacked above each other
4767 # 'horizontal2' - A modified version of 'horizontal', in which windows can be stacked
4768 # above each other
4769 # 'vertical' - Intended for use when $self->shareMainWinFlag = FALSE. The workspace is
4770 # divided into two halves, top and bottom, with each half occupied by a single
4771 # session's windows. Inside the half, the 'main' window is on the left, and other
4772 # windows are on the right. Windows cannot be stacked above each other
4773 # 'vertical2' - A modified version of 'vertical', in which windows can be stacked
4774 # above each other
4775 # Constant registry hash of standard zonemap names, in the form
4776 # $constZonemapHash->{name} = undef
4777 # $constZonemapHash->{name} = clone_from_standard_zonemap_called_this
4778 constZonemapHash => {
4779 'single' => undef,
4780 'single2' => 'single',
4781 'basic' => undef,
4782 'extended' => undef,
4783 'widescreen' => undef,
4784 'horizontal' => undef,
4785 'horizontal2' => 'horizontal',
4786 'vertical' => undef,
4787 'vertical2' => 'vertical',
4788 },
4789 # Registry hash of blessed references to all zonemap objects. Names have max of 16
4790 # chars. Hash in the form
4791 # $zonemapHash{unique_zonemap_name} = blessed_reference_to_zonemap_object
4792 zonemapHash => {}, # [zonemaps]
4793 # A hash containing only the 'standard' zonemap objects, a subset of
4794 # $self->zonemapHash (filled by GA::Obj::Zonemap->setupStandardZonemap)
4795 standardZonemapHash => {}, # [zonemaps]
4796 # Constant registry hash which specifies how many workspaces to use on startup, and the
4797 # default zonemaps for each one. Hash in the form
4798 # $constInitWorkspaceHash{unique_number} = default_zonemap_name
4799 constInitWorkspaceHash => {
4800 0 => 'basic',
4801 },
4802 # Customisable registry hash of workspaces to use on startup. The default workspace has
4803 # the 'unique_number' 0, and corresponds to the workspace in which Axmud starts. Any
4804 # further workspaces should be numbered consecutively (1, 2, 3...). If a key-value
4805 # pair is removed, subsequent key-value pairs must be renumbered
4806 # This hash is only used on startup; the workspaces currently in use are stored in
4807 # GA::Obj::Desktop->workspaceHash
4808 # Hash in the form
4809 # $initWorkspaceHash{unique_number} = default_zonemap_name
4810 # $initWorkspaceHash{unique_number} = 'undef'
4811 # NB If 'undef' is specified, GA::Obj::Desktop->useWorkspace chooses a zonemap based on
4812 # the current value of $self->shareMainWinFlag
4813 initWorkspaceHash => {}, # [config] Set below
4814 # Constant direction of workspace use. If $self->initWorkspaceHash specifies we should
4815 # use two or more workspaces at startup, this IV specifies in which direction we
4816 # should move, after finding the default workspace:
4817 # 'move_left' - move left from the default workspace until we reach the
4818 # left-most workspace (and then stop)
4819 # 'move_right' - move right from the default workspace until we reach the
4820 # right-most workspace (and then stop)
4821 # 'start_left' - after finding the default workspace, the next workspace
4822 # should be the left-most one, after that move right until we
4823 # reach the right-most workspace (and then stop)
4824 # 'start_right' - after finding the default workspace, the next workspace
4825 # should be the right-most one, after that move left until we
4826 # reach the left-most workspace (and then stop)
4827 constInitWorkspaceDir => 'move_right',
4828 # Customisable direction of workspace use
4829 initWorkspaceDir => undef, # [config] Set below
4830 #
4831 # Sometimes a window almost fills a zone, leaving gaps of just a few gridblocks here and
4832 # there. When a new window is created, GA::Obj::Zone->adjustSingleWin can remedy this
4833 # situation by expanding the window to remove the small gap between it and the edge of
4834 # its zone
4835 # If the zone has a maximum number of windows, then the biggest gap (measured in
4836 # gridblocks) that GA::Obj::Zone->adjustSingleWin can fix is the maximum number of
4837 # windows, minus 1. (A gap that's the same size as the maximum windows shouldn't
4838 # exist)
4839 # Otherwise, the size of the maximum gap is stored in this IV. This IV holds the maximum
4840 # size of the gap between a window and an edge of the grid, in gridblocks, that can be
4841 # removed by the function.
4842 # When gridblocks are their default size (10 pixels), a good value for this IV is 1 or
4843 # 2. 3 would be ok, but 4 is probably too much. When set to 0, gaps will not be
4844 # removed at all.
4845 # Constant default size for the grid gap (this value never changes; min: 0, max: 100)
4846 constGridGapMaxSize => 2,
4847 # Customisable default value for the grid gap
4848 gridGapMaxSize => 2, # [config]
4849 # When there are a larger gaps in a zone, and if the windows in the zone are all the
4850 # same width (or all the same height), GA::Obj::Zone->adjustMultipleWin can adjust
4851 # the size of all of the windows at the same time to either remove the gap (if it is
4852 # small), or to increase the gap to make room for another window (if it is big).
4853 # This flag is set to TRUE if adjustments are allowed, FALSE if not
4854 gridAdjustmentFlag => TRUE, # [config]
4855 # When the available workspace is an arkward size (i.e. not exactly divisible by
4856 # $self->gridBlockSize) there may be a small gap on the right and bottom edges of the
4857 # workspace grid. GA::Obj::WorkspaceGrid->fineTuneWinSize can close the gap, if this
4858 # flag is set to TRUE
4859 gridEdgeCorrectionFlag => TRUE, # [config]
4860 # When a window is deleted in the middle of the zone, the resulting empty space
4861 # doesn't look very attractive. If this flag is TRUE, when a window is deleted, other
4862 # windows are re-shuffled to move them closer to the zone's starting corner, moving
4863 # the gap to the opposite end
4864 gridReshuffleFlag => TRUE, # [config]
4865 # When a GA::Session is no longer a current session, its workspace 'grid' windows must
4866 # be hidden. When it becomes a current session again, those windows must be un-hidden
4867 # (this doesn't apply to the 'main' window, which is always visible)
4868 # If this flag is set to TRUE, the windows become invisible; if the flag is set to
4869 # FALSE, they are merely minimised
4870 gridInvisWinFlag => FALSE, # [config]
4871 #
4872 # The maximum and minimum sizes of workspace that Axmud allows. If the workspace is
4873 # bigger than the maximum, Axmud will use less than the whole workspace. If the
4874 # workspace is smaller than the minimum, Axmud will only allow a single 'grid' window
4875 # (as well as any number of 'free' windows) to open, workspace grids will be disabled
4876 constWorkspaceMaxWidth => 3200,
4877 constWorkspaceMaxHeight => 3200,
4878 constWorkspaceMinWidth => 800,
4879 constWorkspaceMinHeight => 600,
4880 #
4881 # Default window sizes
4882 # Constant default size for windows of the type 'main'. (Any window is allowed to use
4883 # these values. The constant values never change. Min: 100, max:
4884 # ->constWorkspaceMaxWidth / ->constWorkspaceMaxHeight)
4885 constMainWinWidth => 800,
4886 constMainWinHeight => 600,
4887 # Customisable default size for windows of the type 'main'
4888 customMainWinWidth => undef, # [config] Set below
4889 customMainWinHeight => undef, # [config] Set below
4890 # Constant default spacing values for 'main' windows (in pixels)
4891 constMainBorderPixels => 5,
4892 constMainSpacingPixels => 5,
4893 #
4894 # Constant default size for other 'grid' windows besides those of the type 'main'. (Not
4895 # used very often, because GA::Obj::Zone defines its own default window size. Any
4896 # window is allowed to use these values. The constant values never change. Min: 100,
4897 # max: ->constWorkspaceMaxWidth / ->constWorkspaceMaxHeight)
4898 constGridWinWidth => 400,
4899 constGridWinHeight => 300,
4900 # Customisable default size for task windows
4901 customGridWinWidth => undef, # [config] Set below
4902 customGridWinHeight => undef, # [config] Set below
4903 # Constant default spacing values for other 'grid' windows (in pixels)
4904 constGridBorderPixels => 5,
4905 constGridSpacingPixels => 5,
4906 #
4907 # Constant default size for 'free' windows. (Any window is allowed to use these values,
4908 # but 'dialogue' windows usually specify their own size. The constant values never
4909 # change. Min: 100, max: ->constWorkspaceMaxWidth / ->constWorkspaceMaxHeight)
4910 constFreeWinWidth => 700,
4911 constFreeWinHeight => 500,
4912 # Customisable default size for 'free' windows
4913 customFreeWinWidth => undef, # [config] Set below
4914 customFreeWinHeight => undef, # [config] Set below
4915 # Constant default spacing values for 'free' windows (in pixels)
4916 constFreeBorderPixels => 5,
4917 constFreeSpacingPixels => 5,
4918 # Unfortunately, when we display labels in Axmud 'dialogue' windows, we usually have to
4919 # break up the text into separate lines (as Gtk+ no longer handles that)
4920 # The maximum number of characters per line, when that is done
4921 constDialogueLabelSize => 50,
4922 #
4923 # Flag set to TRUE if the treeview index is visible in edit/preference windows, FALSE if
4924 # not
4925 configWinIndexFlag => TRUE, # [config]
4926 # Flag set to TRUE if the treeview index is simplified (less important tabs are not
4927 # added), FALSE if not
4928 configWinSimplifyFlag => TRUE, # [config]
4929 # Width of the treeview index on the left side of all 'edit' and 'pref' windows (when
4930 # visible)
4931 constConfigWinIndexWidth => 250,
4932 # Customisable treeview index width
4933 customConfigWinIndexWidth => undef, # [config] Set below
4934 #
4935 # The edges of the workspace may not be available to windows because of panels (called
4936 # 'taskbars' in MS Windows). These IVs hold the sizes, in pixels, of the area
4937 # unavailable on each edge of the workspace. If 0, Axmud assumes windows can be placed
4938 # at the edges (min: 0, max left+right: ->constWorkspaceMaxWidth, max top+bottom:
4939 # ->constWorkspaceMaxHeight)
4940 # Constant size of a workspace panel (this value never changes)
4941 constPanelSize => 0,
4942 # Constant default sizes for panels, used when no panels can be detected at all. We'll
4943 # assume that it's most likely that people have a single panel at the bottom of the
4944 # workspace; let's also assume that it's quite big
4945 constPanelLeftSize => 0,
4946 constPanelRightSize => 0,
4947 constPanelTopSize => 0,
4948 constPanelBottomSize => 50,
4949 # Customisable sizes for panel sizes. Axmud assumes any sizes that are defined here are
4950 # valid for all workspaces. For any sizes that are not defined, Axmud tries to detect
4951 # the sizes for each workspace it uses. If detection fails, Axmud uses the constant
4952 # values just above
4953 customPanelLeftSize => undef, # [config]
4954 customPanelRightSize => undef, # [config]
4955 customPanelTopSize => undef, # [config]
4956 customPanelBottomSize => undef, # [config]
4957 #
4958 # Window controls are the edges of any windows, typically including a border on all
4959 # four sides, and a window name at the top. The sizes of window controls are
4960 # required when moving windows around the workspace, so Axmud tests window controls on
4961 # each workspace it uses. (It's rather unlikely that different workspaces will use
4962 # different window controls, but Axmud checks for that possibility anyway)
4963 # Constant default size for window controls (this value never changes; min: 0 pixels,
4964 # max: 100)
4965 constControlsSize => 0,
4966 # Constant default sizes for window controls, used when the window controls test fails.
4967 # (These values never change; based on Linux Mint 18 using Cinnamon)
4968 constControlsLeftSize => 1,
4969 constControlsRightSize => 1,
4970 constControlsTopSize => 25,
4971 constControlsBottomSize => 1,
4972 # Customisable sizes for window controls. If all four sizes here are defined, Axmud
4973 # uses them for all workspaces. If even one size is not defined, Axmud tries to detect
4974 # window controls sizes in every workspace it uses. If detection fails, Axmud uses the
4975 # constant values just above
4976 customControlsLeftSize => undef, # [config]
4977 customControlsRightSize => undef, # [config]
4978 customControlsTopSize => undef, # [config]
4979 customControlsBottomSize => undef, # [config]
4980 #
4981 # DEBUG
4982 # Hack for incorrect window positioning on MS Windows (Axmud v2.0)
4983 # If True, use zero-width window controls on the left/right/bottom (but not top) sides,
4984 # and when moving windows, move them a few pixels to the left
4985 mswinWinPosnTweakFlag => TRUE, # [config]
4986 #
4987 # Constant default colour scheme for the pane objects (GA::Table::Pane), each of which
4988 # displays a Gtk3::TextView in an 'internal' windows
4989 # (These values never change; each value MUST be a standard colour tag, not an Xterm or
4990 # RGB colour tag)
4991 constTextColour => 'white',
4992 constUnderlayColour => 'ul_black',
4993 constBackgroundColour => 'black',
4994 constFont => 'monospace',
4995 constFontSize => 10, # Updated for MS Windows below
4996 # In Pueblo mode, the default colour for clickable links (not used otherwise)
4997 constPuebloLinkColour => 'CYAN',
4998 # Registry hash of colour scheme objects, each of which defines a colour scheme that can
4999 # be used in a Gtk3::TextView
5000 # Colour schemes with the same name as a type of window are used as the default colour
5001 # scheme for that type of window. Those colour scheme objects can be modified, but not
5002 # deleted from the hash. Other colour scheme objects can be added, deleted and
5003 # modified as required
5004 # Hash in the form
5005 # $colourSchemeHash{unique_name} = blessed_reference_to_colour_scheme_object
5006 colourSchemeHash => {}, # [winmaps]
5007 #
5008 # Constant default colours used for particular types of system message
5009 # (These values never changes; each value is a standard colour tag)
5010 constInsertCmdColour => 'green', # [config]
5011 constShowSystemTextColour => 'YELLOW', # [config]
5012 constShowErrorColour => 'cyan', # [config]
5013 constShowWarningColour => 'cyan', # [config]
5014 constShowDebugColour => 'GREEN', # [config]
5015 constShowImproperColour => 'MAGENTA', # [config]
5016 # Customisable default colours used for particular types of system message
5017 customInsertCmdColour => undef, # [config] Set below
5018 customShowSystemTextColour => undef, # [config] Set below
5019 customShowErrorColour => undef, # [config] Set below
5020 customShowWarningColour => undef, # [config] Set below
5021 customShowDebugColour => undef, # [config] Set below
5022 customShowImproperColour => undef, # [config] Set below
5023 #
5024 # When 'black' text is shown on a 'black' background, it is invisible. If this flag is
5025 # set, text that's the same colour as the background is converted to/from bold (i.e.
5026 # 'black' becomes 'BLACK', and 'BLACK' becomes 'black'
5027 convertInvisibleFlag => FALSE, # [config]
5028 # Constant default size for the textviews, corresponding to the number of lines that can
5029 # be stored in any textview object's Gtk3::TextBuffer (when it's full, the earliest
5030 # line is removed to make way for a new line)
5031 # NB If required, text buffers can be set to be of unlimited size; these IVs only apply
5032 # if a maximum size is needed
5033 # NB The absolute minimum/maximum size (when a size is used at all) is taken from the
5034 # IVs for Axmud's display, instruction and world command buffers, ->constMaxBufferSize
5035 # and ->constMinBufferSize
5036 constTextBufferSize => 10000,
5037 # Default maximum number of lines that can be shown in a Gtk3::TextView
5038 customTextBufferSize => undef, # [config] Set below
5039  
5040 # A set of Gtk3::Gdk::Cursors, one for when the mouse is hovering over a normal part of
5041 # a textview, and others when it is hovering over various kinds of clickable link
5042 constNormalCursor => Gtk3::Gdk::Cursor->new('xterm'),
5043 constWWWCursor => Gtk3::Gdk::Cursor->new('hand1'),
5044 constPromptCursor => Gtk3::Gdk::Cursor->new('sb_down_arrow'),
5045 constPopupCursor => Gtk3::Gdk::Cursor->new('target'),
5046 constCmdCursor => Gtk3::Gdk::Cursor->new('mouse'),
5047 constMailCursor => Gtk3::Gdk::Cursor->new('pencil'),
5048 constTelnetCursor => Gtk3::Gdk::Cursor->new('trek'),
5049 # Another set of Gtk3::Gdk::Cursors for the automapper window's free click mode
5050 constMapCursor => Gtk3::Gdk::Cursor->new('arrow'),
5051 constMapAddCursor => Gtk3::Gdk::Cursor->new('plus'),
5052 constMapConnectCursor => Gtk3::Gdk::Cursor->new('crosshair'),
5053 constMapMergeCursor => Gtk3::Gdk::Cursor->new('target'),
5054  
5055 # Icon file paths (relative to the main directory) for the 'internal' window strip
5056 # object, GA::Strip::SearchBox
5057 constUpIconPath => '/icons/search/arrow_up.png',
5058 constDownIconPath => '/icons/search/arrow_down.png',
5059 constResetIconPath => '/icons/search/broom.png',
5060 constCaseIconPath => '/icons/search/capitalization.png',
5061 constRegexIconPath => '/icons/search/token_shortland_character.png',
5062 constDivideIconPath => '/icons/search/application_tile_vertical.png',
5063 # Icon file paths (relative to the main directory) for the 'internal' window strip
5064 # object, GA::Strip::Entry
5065 constWipeIconPath => '/icons/button/broom.png',
5066 constAddIconPath => '/icons/button/textfield_add.png',
5067 constEmptyIconPath => '/icons/button/console.png',
5068 constSystemIconPath => '/icons/button/console_system.png',
5069 constDebugIconPath => '/icons/button/console_debug.png',
5070 constErrorIconPath => '/icons/button/console_error.png',
5071 constMultiIconPath => '/icons/button/toggle_expand.png',
5072 constSearchIconPath => '/icons/button/search.png',
5073 constCancelIconPath => '/icons/button/wall.png',
5074 constSwitchIconPath => '/icons/button/switch_windows.png',
5075 constSplitIconPath => '/icons/button/application_tile_vertical.png',
5076 constRestoreIconPath => '/icons/button/application.png',
5077 constScrollIconPath => '/icons/button/lock_open.png',
5078 constLockIconPath => '/icons/button/lock.png',
5079  
5080 # The sizes of icon provided for Axmud (icon files are in /icons/win/
5081 # Constant list of icon sizes (these values never change; in pixels)
5082 constIconSizeList => [16, 32, 48, 64, 128],
5083  
5084 # Standard shadow type for Gtk3::Frame and Gtk3::ScrolledWindows (possible values are
5085 # 'in', 'out', 'etched-in', 'etched-out' or 'none')
5086 constShadowType => 'in',
5087  
5088 # 'Internal' windows
5089 # ------------------
5090  
5091 # Axmud keeps two lists of strip objects - one for Axmud's built-in strip objects, and
5092 # another for all strip objects (built-in objects and custom objects added via a
5093 # plugin, which should inherit from GA::Strip::Custom)
5094 #
5095 # The constant registry of strip objects (these values never change). A hash in the form
5096 # $constStripHash{package_name} = pretty_name
5097 # NB Both 'package_name' and 'pretty_name' should be unique. To avoid problems, use the
5098 # plugin name in 'pretty_name', e.g. 'Myplugin toolbar'
5099 constStripHash => {
5100 'Games::Axmud::Strip::MenuBar'
5101 => $axmud::SCRIPT . ' menu bar',
5102 'Games::Axmud::Strip::Toolbar'
5103 => $axmud::SCRIPT . ' toolbar',
5104 'Games::Axmud::Strip::Table'
5105 => $axmud::SCRIPT . ' table',
5106 'Games::Axmud::Strip::GaugeBox'
5107 => $axmud::SCRIPT . ' gauge box',
5108 'Games::Axmud::Strip::SearchBox'
5109 => $axmud::SCRIPT . ' search box',
5110 'Games::Axmud::Strip::Entry'
5111 => $axmud::SCRIPT . ' command entry box',
5112 'Games::Axmud::Strip::ConnectInfo'
5113 => $axmud::SCRIPT . ' connection info box',
5114 },
5115 # The customisable registry hash of strip objects, in the form
5116 # $customStripHash{package_name} = description
5117 customStripHash => {}, # Set below
5118  
5119 # Likewise, Axmud keeps two lists of table objects - one for Axmud's built-in table
5120 # objects, and another for all table objects (built-in objects and custom objects
5121 # added via a plugin, which should inherit from GA::Table::Custom)
5122 #
5123 # The constant registry of table objects (these values never change). A hash in the form
5124 # $constTableHash{package_name} = pretty-name
5125 # NB Both 'package_name' and 'pretty_name' should be unique. To avoid problems, use the
5126 # plugin name in 'pretty_name', e.g. 'Myplugin button'
5127 constTableHash => {
5128 'Games::Axmud::Table::Holder'
5129 => $axmud::SCRIPT . ' holder',
5130 'Games::Axmud::Table::Container'
5131 => $axmud::SCRIPT . ' generic container',
5132 'Games::Axmud::Table::MiniTable'
5133 => $axmud::SCRIPT . ' mini-table',
5134 'Games::Axmud::Table::Label'
5135 => $axmud::SCRIPT . ' label',
5136 'Games::Axmud::Table::Button'
5137 => $axmud::SCRIPT . ' button',
5138 'Games::Axmud::Table::CheckButton'
5139 => $axmud::SCRIPT . ' check button',
5140 'Games::Axmud::Table::RadioButton'
5141 => $axmud::SCRIPT . ' radio button',
5142 'Games::Axmud::Table::Entry'
5143 => $axmud::SCRIPT . ' entry box',
5144 'Games::Axmud::Table::ComboBox'
5145 => $axmud::SCRIPT . ' combobox',
5146 'Games::Axmud::Table::SimpleList'
5147 => $axmud::SCRIPT . ' simple list',
5148 'Games::Axmud::Table::TextView'
5149 => $axmud::SCRIPT . ' simple textview',
5150 'Games::Axmud::Table::Pane'
5151 => $axmud::SCRIPT . ' window pane',
5152 'Games::Axmud::Table::PseudoWin'
5153 => $axmud::SCRIPT . ' pseudo-window',
5154 },
5155 # The customisable registry hash of table objects, in the form
5156 # $customTableHash{package_name} = description
5157 customTableHash => {}, # Set below
5158  
5159 # Constant registry list used to initialise the default set of toolbar buttons used in
5160 # 'internal' windows (usually only 'main' windows), when required. List in groups of
5161 # 6, in the form
5162 # name - Unique object name
5163 # descrip - Short description
5164 # iconPath - File path to the icon
5165 # instruct - Instruction to execute
5166 # session_flag - Icon only sensitised when there is a current session
5167 # connect_flag - Icon only sensitised when current session connected to a world
5168 # Separators are in groups of 1
5169 constToolbarList => [
5170 'connect_me',
5171 'Connect to a world',
5172 'phone_vintage.png',
5173 ';connect',
5174 FALSE, # Always available
5175 FALSE, # Doesn't require connection to world
5176 'login_me',
5177 'Mark the character as logged in',
5178 'user_go.png',
5179 ';login',
5180 TRUE, # Requires current session
5181 TRUE, # Requires connection to world
5182 'save_me',
5183 'Save data',
5184 'drive_disk.png',
5185 ';save',
5186 TRUE, # Requires current session
5187 TRUE, # Requires connection to world
5188 # separator
5189 'separator',
5190 'open_map',
5191 'Open Automapper window',
5192 'compass.png',
5193 ';openautomapper',
5194 TRUE, # Requires current session
5195 TRUE, # Requires connection to world
5196 # v1.3.051 commented out to leave room in widescreen mode for the stop client button
5197 # 'reset_loc',
5198 # 'Reset the Locator task',
5199 # 'roadworks.png',
5200 # ';resetlocator',
5201 # TRUE, # Requires current session
5202 # TRUE, # Requires connection to world
5203 # separator
5204 'separator',
5205 'active_int',
5206 'View active interfaces',
5207 'gear_in.png',
5208 ';editactiveinterface',
5209 TRUE, # Requires current session
5210 TRUE, # Requires connection to world
5211 'edit_trigger',
5212 'Edit world trigger cage',
5213 'gun.png',
5214 ';editcage -t',
5215 TRUE, # Requires current session
5216 TRUE, # Requires connection to world
5217 'edit_alias',
5218 'Edit world alias cage',
5219 'user_detective.png',
5220 ';editcage -a',
5221 TRUE, # Requires current session
5222 TRUE, # Requires connection to world
5223 'edit_macro',
5224 'Edit world macro cage',
5225 'keyboard.png',
5226 ';editcage -m',
5227 TRUE, # Requires current session
5228 TRUE, # Requires connection to world
5229 'edit_timer',
5230 'Edit world timer cage',
5231 'clock_red.png',
5232 ';editcage -i',
5233 TRUE, # Requires current session
5234 TRUE, # Requires connection to world
5235 'edit_hook',
5236 'Edit world hook cage',
5237 'candy_cane.png',
5238 ';editcage -h',
5239 TRUE, # Requires current session
5240 TRUE, # Requires connection to world
5241 'route',
5242 'Edit route cage',
5243 'routing_go_straight_left.png',
5244 ';editcage -r',
5245 TRUE, # Requires current session
5246 TRUE, # Requires connection to world
5247 # separator
5248 'separator',
5249 'edit_quick',
5250 'Set quick preferences',
5251 'book_edit.png',
5252 ';editquick',
5253 TRUE, # Requires current session
5254 TRUE, # Requires connection to world
5255 'edit_client',
5256 'Set Axmud client preferences',
5257 'application_edit.png',
5258 ';editclient',
5259 TRUE, # Requires current session
5260 TRUE, # Requires connection to world
5261 'edit_world',
5262 'Edit current world profile',
5263 'world_edit.png',
5264 ';editworld',
5265 TRUE, # Requires current session
5266 TRUE, # Requires connection to world
5267 'open_viewer',
5268 'Open data viewer window',
5269 'watermark_table.png',
5270 ';opendataviewer',
5271 TRUE, # Requires current session
5272 TRUE, # Requires connection to world
5273 # separator
5274 'separator',
5275 'speech',
5276 'Turn on text-to-speech',
5277 'ear_listen.png',
5278 ';speech toggle',
5279 FALSE, # Doesn't current session
5280 FALSE, # Doesn't connection to world
5281 'freeze_task',
5282 'Freeze/unfreeze tasks',
5283 'cold.png',
5284 ';freezetask',
5285 TRUE, # Requires current session
5286 TRUE, # Requires connection to world
5287 'disable_int',
5288 'Disable all active interfaces',
5289 'prohibition_button.png',
5290 ';disableactiveinterface',
5291 TRUE, # Requires current session
5292 FALSE, # Doesn't connection to world
5293 # separator
5294 'separator',
5295 'layer_up',
5296 'Move workspace grid up a layer',
5297 'hand_point_090.png',
5298 ';layerup',
5299 TRUE, # Requires current session
5300 TRUE, # Requires connection to world
5301 'layer_down',
5302 'Move workspace grid down a layer',
5303 'hand_point_270.png',
5304 ';layerdown',
5305 TRUE, # Requires current session
5306 TRUE, # Requires connection to world
5307 'help_me',
5308 'Show quick help',
5309 'help.png',
5310 ';openaboutwindow -h',
5311 FALSE, # Always available
5312 FALSE, # Doesn't require connection to world
5313 'quit',
5314 'Stop session or client',
5315 'quit.png',
5316 ';stopsession',
5317 FALSE, # Always available
5318 FALSE, # Doesn't require connection to world
5319 'quit_client',
5320 'Stop client',
5321 'quit_client.png',
5322 ';stopclient',
5323 FALSE, # Always available
5324 FALSE, # Doesn't require connection to world
5325 ],
5326 # Registry hash of toolbar button objects which exist, in the form
5327 # $toolbarHash{unique_name} = blessed_reference_to_toolbar_button_object
5328 toolbarHash => {}, # [toolbar]
5329 # Registry list of toolbar button object names, in the order in which they appear in the
5330 # toolbar (and any number of occurences of the word 'separator', which is not a
5331 # toolbar button, but a separator)
5332 toolbarList => [], # [toolbar]
5333  
5334 # External applications
5335 # ---------------------
5336  
5337 # Constant registry list of external application commands for Linux
5338 # NB Any audio package can be used to play MSP sound triggers, but Axmud is only able to
5339 # apply the volume parameter to packages it actively supports. Currently, only the SoX
5340 # package is actively supported
5341 constLinuxCmdList => [
5342 'firefox "%s" &', # Firefox
5343 'thunderbird -compose "to=\'%s\'" &', # Thunderbird
5344 'play -q "%s" &', # play from SoX package
5345 'xed "%s" &', # xed
5346 ],
5347 # Constant registry list of external application commands for MS Windows
5348 constMSWinCmdList => [
5349 'start iexplore.exe %s', # Internet Explorer
5350 'start outlook.exe /c ipm.note /m %s', # Outlook Express
5351 'start wmplayer.exe /play %s', # Windows Media Player
5352 'start notepad.exe /A %s', # Notepad
5353 ],
5354 # Constant registry list of external application commands for *BSD
5355 constBSDCmdList => [
5356 'firefox "%s" &', # Firefox
5357 'thunderbird -compose "to=\'%s\'" &', # Thunderbird
5358 'play -q "%s" &', # play from SoX package
5359 'pluma "%s" &', # Pluma
5360 ],
5361 # The command to run a web browser. %s is substituted for a URL
5362 browserCmd => undef, # [config] set below
5363 # The command to open an email application. %s is subsituted for the email address
5364 # of the person to email
5365 emailCmd => undef, # [config] set below
5366 # The command to run an audio player. %s is substituted for the full file path
5367 # (default value opens sox package on Linux)
5368 audioCmd => undef, # [config] set below
5369 # The command to open a text editor. %s is subsituted for the file to open
5370 textEditCmd => undef, # [config] set below
5371  
5372 # Sound and sound effects
5373 # -----------------------
5374  
5375 # Audio file formats supported by various parts of Axmud (principally by the MSP code)
5376 constSoundFormatHash => {
5377 # Supported in MSP spec
5378 'mid' => undef,
5379 'midi' => undef,
5380 'wav' => undef,
5381 # Not supported in MSP spec, but supported by Axmud
5382 'aac' => undef,
5383 'aiff' => undef,
5384 'alac' => undef,
5385 'flac' => undef,
5386 'mp3' => undef,
5387 'ogg' => undef,
5388 'wma' => undef,
5389 },
5390 # Flag set to TRUE if sound effects are allowed at all, FALSE if not
5391 allowSoundFlag => FALSE, # [config]
5392 # Flag set to TRUE if Axmud should play a 'bell' when GA::Obj::TextView->insertText
5393 # (etc) tries to display an ASCII 7 character (bell), FALSE if not
5394 # Set to TRUE by default so that turning on sound will automatically allow remote beeps
5395 allowAsciiBellFlag => TRUE, # [config]
5396 # Axmud provides two groups of sound effects by default. The first group are used by
5397 # various parts of the Axmud code, and are named for the purpose for which they're
5398 # mostly used
5399 # Constant registry hash of standard sound effects, in the form
5400 # $constStandardSoundHash{effect_name} = file_name
5401 # ...where 'file_name' is the file in /items/sounds
5402 constStandardSoundHash => {
5403 # Text received after going AFK
5404 'afk' => 'afk.mp3',
5405 # Timed alerts
5406 'alert' => 'alert.mp3',
5407 # General alarm
5408 'alarm' => 'alarm.mp3',
5409 # General attack started
5410 'attack' => 'attack.mp3',
5411 # Old-fashioned beep
5412 'beep' => 'beep.mp3',
5413 # Desk bell
5414 'bell' => 'bell.mp3',
5415 # Incoming chat message
5416 'call' => 'call.mp3',
5417 # Character dies
5418 'death' => 'death.mp3',
5419 # Character deposits money into bank
5420 'deposit' => 'deposit.mp3',
5421 # System error/warning/debug/improper arguments messages
5422 'error' => 'error.mp3',
5423 # General arrival
5424 'greeting' => 'greeting.mp3',
5425 # General kill
5426 'kill' => 'kill.mp3',
5427 # Automapper gets lost
5428 'lost' => 'lost.mp3',
5429 # General notification
5430 'notify' => 'notify.mp3',
5431 # Something is ready
5432 'ready' => 'ready.mp3',
5433 # Torch has burnt out
5434 'torch' => 'torch.mp3',
5435 # Character withdraws money from bank
5436 'withdraw' => 'withdraw.mp3',
5437 },
5438 # The second group are named after the sounds that the sound effects contain, and can be
5439 # used for any purpose
5440 # The following registry hash is in the same format as ->constStandardSoundHash, and
5441 # contains both groups of sound effects, representing all the sound files in
5442 # /items/sounds (refreshed every time Axmud runs)
5443 constExtendedSoundHash => {},
5444 # Customisable registry hash of sound effects (the 'sound effects bank') in the form
5445 # $customSoundHash{effect} = full_file_path
5446 # This hash is initially filled with all the sound effects in /items/sounds, and from
5447 # then on can be customised by the user
5448 # If full_file_path is an empty string (or 'undef'), no sound is played
5449 customSoundHash => {}, # [config] Set below
5450  
5451 # Text-to-speech (TTS)
5452 # --------------------
5453  
5454 # There are two flags that turn TTS on and off
5455 # The user can toggle the first one on or off at any time (using the ;speech command),
5456 # and is saved in the config file
5457 # Flag set to TRUE if TTS is allowed at all, FALSE if not
5458 customAllowTTSFlag => FALSE, # [config]
5459 # The second flag is not saved in any file. It is set to TRUE when
5460 # $self->customAllowTTSFlag is TRUE or when the global variable
5461 # $axmud::BLIND_MODE_FLAG is TRUE
5462 # In this way if the user starts Axmud in blind mode, TTS is definitely turned on; if
5463 # the user then restarts Axmud not in blind mode, TTS will be on or off, depending on
5464 # the value of ->customAllowTTSFlag
5465 # (Thus, a single installation of Axmud can be used by two users, one with a visual
5466 # impairment and one without)
5467 systemAllowTTSFlag => FALSE,
5468 # If the user specifies a TTS engine from the command line (e.g. by running
5469 # './axmud.pl festival' or './baxmud.pl deathmud.com 5000 festival'), that engine
5470 # is used exclusively while Axmud is running. This IV stores the engine, if specified
5471 forceTTSEngine => undef,
5472 # Constant list of TTS engines that Axmud currently supports - eSpeak, espeak-ng, Flite,
5473 # Festival, Swift (using Cepstral) and a dummy engine, 'none', which produces no
5474 # speech when specified
5475 constTTSList => [
5476 'espeak', 'esng', 'flite', 'festival', 'swift', 'none',
5477 ],
5478 # Constant list of TTS engines that Axmud supports on this operating system
5479 constTTSCompatList => [], # Set below
5480 # Allow TTS smoothing, which inserts an artificial full stop at the end of lines which
5481 # don't end with one, if the next line begins with a capital letter (makes the voice
5482 # sound more natural)
5483 ttsSmoothFlag => TRUE, # [config]
5484  
5485 # Any part of the code can perform TTS by calling $self->tts. That function produces
5486 # a TTS job (a GA::Obj::TtsJob object). The job stores a single piece of text to
5487 # convert to speech, the engine to use, and any optional parameters
5488 # A list of TTS job objects, usually performed in sequence
5489 ttsJobList => [],
5490 # The maximum size of $self->ttsJobList. When the list is full, we remove the oldest
5491 # job (the first one in the list) to make way for a new job (added to the end of the
5492 # list)
5493 ttsJobMax => 1000,
5494 # A second list of jobs, used for any system messages which are urgent (for example, the
5495 # confirmation message from the ';split' command, when TTS is enabled)
5496 # $self->ttsPerformJobs performs all jobs on this list immediately, before checking
5497 # ->ttsJobList. This list has no maximum size (jobs are removed from the list, as
5498 # soon as they are performed)
5499 ttsUrgentJobList => [],
5500 # The job mode, which defines what happens when ;skip and ;unskip (etc) are used. Set
5501 # to 'default' to read aloud all the text for the job, 'sentence' to read aloud one
5502 # sentence at a time, or 'word' to read aloud one word at a time
5503 ttsJobMode => 'default',
5504 # A pointer, set to an index in $self->ttsJobList. The pointer tells us which job is
5505 # the current one (i.e. the next piece of text to be converted to speech)
5506 # When $self->ttsJobList is empty, set to 0. When every job in $self->ttsJobList has
5507 # been performed, set to -1 (to represent a pointer a the end of the list)
5508 ttsJobPointer => 0,
5509 # A mini-pointer, pointing at a position in a job's ->text string (the first character
5510 # in the string is 0). Set to 0 when ->ttsJobMode is 'default'. When ->ttsJobMode is
5511 # 'sentence' or 'word', points at the character at the beginning of a sentence/word
5512 ttsJobMiniPointer => 0,
5513 # A flag set to TRUE if each job in the list should be performed as soon as the previous
5514 # job has finished, FALSE if not
5515 ttsJobAutoFlag => TRUE,
5516 # A flag set to TRUE if the current job (marked by $self->ttsJobPointer) should be
5517 # performed once, FALSE if it shouldn't be performed right now (ignored when
5518 # $self->ttsJobAutoFlag is TRUE)
5519 ttsJobOnceFlag => TRUE,
5520 # Flag set to TRUE when $self->ttsJobMode changes, and set back to FALSE when any job is
5521 # performed, or when the ';skip' command is used. When TRUE, the ';skip' command
5522 # doesn't advance $self->ttsJobMiniPointer, as it ordinarily would. Thus, the user
5523 # can type ';first' and then ';skip', in order to hear the first sentence or word in
5524 # a job (rather the second
5525 ttsChangeModeFlag => FALSE,
5526 # The IPC::Run harness handling the system process, in which text is currently being
5527 # converted to speech. Reset back to 'undef' as soon as we detect that the system
5528 # process has finished
5529 ttsCurrentHarness => undef,
5530  
5531 # When blind mode is enabled, we can hijack the escape and cursor keys for navigating
5532 # the TTS job list
5533 # Hash of affected keycodes, in the form
5534 # $ttsHijackKeycodeHash{keycode} = client_command_to_call
5535 ttsHijackKeycodeHash => {
5536 'home' => 'split',
5537 'end' => 'prompt',
5538 'right' => 'skip',
5539 'left' => 'unskip',
5540 'page_down' => 'skip more',
5541 'page_up' => 'unskip more',
5542 'up' => 'first',
5543 'down' => 'last',
5544 'tab' => 'resume',
5545 'escape' => 'shutup',
5546 },
5547 # Flag set to TRUE when the keys are hijacked, and FALSE when they are not hijacked.
5548 # This setting is toggled with the ;freekeys command (and is ignored when not in
5549 # blind mode)
5550 ttsHijackFlag => TRUE, # [config]
5551 # Corresponding flag for when blind mode is not enabled
5552 # Flag set to TRUE when the keys are hijacked, and FALSE when they are not hijacked.
5553 # This setting is toggled with the ;hijackkeys command (and is ignored when in blind
5554 # mode)
5555 ttsForceHijackFlag => FALSE, # [config]
5556  
5557 # Constant lists of default TTS settings, used for initialising TTS configuration
5558 # objects, in the form
5559 # (tts_engine, tts_voice, tts_speed, tts_rate, tts_pitch, tts_volume...)
5560 constTtsDefaultList => [
5561 'espeak',
5562 'english_rp', # Male voice
5563 80,
5564 undef,
5565 50,
5566 undef,
5567 'esng',
5568 'en', # Male voice
5569 80,
5570 undef,
5571 50,
5572 80,
5573 'flite',
5574 'slt', # Female voice
5575 undef,
5576 undef,
5577 undef,
5578 undef,
5579 'festival', # Male voice
5580 'voice_kal_diphone',
5581 undef,
5582 33,
5583 undef,
5584 20,
5585 'swift',
5586 'David',
5587 30, # Used on MSWin
5588 50, # Used on Linux/*BSD
5589 50,
5590 80,
5591 'none', # Doesn't actually read anything
5592 undef,
5593 undef,
5594 undef,
5595 undef,
5596 undef,
5597 ],
5598 # Constant hash of TTS configuration objects to be created at startup, in the form
5599 # $constTtsObjHash{unique_name} = which_tts_engine_to_use_by_default
5600 # ...where 'unique_name' is max 16 chars, no reserved names
5601 # For most values, we use 'undef' rather than an engine name. The call to
5602 # $self->ttsCreateStandard then chooses which engine to use: on Linux, 'espeak', and
5603 # on MS Windows, either 'espeak', 'sng' or 'festival', depending on which engines
5604 # are actually installed on the system
5605 constTtsObjHash => {
5606 # Default TTS settings
5607 'espeak' => 'espeak', # Default for each TTS engine
5608 'esng' => 'esng',
5609 'flite' => 'flite',
5610 'festival' => 'festival',
5611 'swift' => 'swift',
5612 'none' => 'espeak', # The 'void' engine - doesn't read anything
5613 'task' => undef, # Default for tasks
5614 'script' => undef, # Default for Axbasic scripts
5615 'default' => undef, # Default for everything else
5616 # Default TTS settings for various parts of Axmud
5617 'receive' => undef, # Text received from world
5618 'system' => undef, # System messages, i.e. ->writeText
5619 'error' => undef, # System error/warning/debug/improper msgs
5620 'command' => undef, # World commands
5621 'dialogue' => undef, # 'Dialogue' windows
5622 # Default TTS settings for various built-in tasks
5623 'attack' => undef,
5624 'chat' => undef,
5625 'channels' => undef,
5626 'divert' => undef,
5627 'locator' => undef,
5628 'status' => undef,
5629 'watch' => undef,
5630 },
5631 # Constant hash of TTS configuration objects which cannot be removed
5632 constTtsPermObjHash => {
5633 'espeak' => undef,
5634 'esng' => undef,
5635 'flite' => undef,
5636 'festival' => undef,
5637 'swift' => undef,
5638 'none' => undef,
5639 'task' => undef,
5640 'script' => undef,
5641 'default' => undef,
5642 },
5643 # Constant hash of TTS configuration objects which cannot be modified, as their IVs are
5644 # used as default values for other configuration object IVs
5645 constTtsFixedObjHash => {
5646 'espeak' => undef,
5647 'esng' => undef,
5648 'flite' => undef,
5649 'festival' => undef,
5650 'swift' => undef,
5651 'none' => undef,
5652 },
5653 # Registry hash of TTS configuration objects (GA::Obj::Tts) in the form
5654 # $ttsObjHash{unique_name} = blessed_reference_to_tts_object
5655 # ...where 'unique_name' is max 16 chars, no reserved names
5656 # When Axmud runs for the first time, TTS configuration objects are created for each of
5657 # the keys in $self->constTtsObjHash
5658 # The configuration objects in $self->constTtsPermObjHash cannot be removed from this
5659 # hash. The configuration objects in ->constTtsFixedObjHash cannot be modified.
5660 # Otherwise, the user and/or code can freely add and remove configuration objects from
5661 # this hash
5662 ttsObjHash => {},
5663  
5664 # Constant hash of TTS (normal) attributes, which allows the ';read' command to interact
5665 # with specific tasks
5666 # Hash in the form
5667 # $constTtsAttribHash{attribute} = name_of_task_which_uses_it
5668 # ...where 'attribute' is a string unique to this hash, preferably a single word in all
5669 # lower-case letters
5670 constTtsAttribHash => {
5671 # Locator task
5672 'title' => 'locator_task', # Reads current room title
5673 'descrip' => 'locator_task', # ...description
5674 'description' => 'locator_task', # ...description
5675 'exit' => 'locator_task', # ...exit list
5676 'exits' => 'locator_task', # ...exit list
5677 'content' => 'locator_task', # ...contents
5678 'contents' => 'locator_task', # ...contents
5679 'command' => 'locator_task', # ...room commands
5680 'cmd' => 'locator_task', # ...room commands
5681 # Status task
5682 'status' => 'status_task', # Read current char's life status
5683 'life' => 'status_task', # ...life and death counts
5684 'lives' => 'status_task', # ...life and death counts
5685 'health' => 'status_task', # ...health points/max health points
5686 'magic' => 'status_task', # ...magic points
5687 'energy' => 'status_task', # ...energy points
5688 'guild' => 'status_task', # ...guild points
5689 'social' => 'status_task', # ...social points
5690 'xp' => 'status_task', # ...xp
5691 'experience' => 'status_task', # ...xp
5692 'level' => 'status_task', # ...level
5693 'align' => 'status_task', # ...alignment
5694 'alignment' => 'status_task', # ...alignment
5695 'age' => 'status_task', # ...age
5696 'time' => 'status_task', # ...game time
5697 'bank' => 'status_task', # ...bank balance
5698 'purse' => 'status_task', # ...purse contents
5699 },
5700 # Hash of TTS (normal) attributes, initially set identical to ->constTtsAttribHash,
5701 # and then modified as plugins add new plugin tasks
5702 # Each GA::Session contains a customisable hash, initially given the same key-value
5703 # pairs as this one, which contains all the TTS attributes used by built-in tasks. If
5704 # the new tasks add attributes already used by built-in tasks, then the key-value
5705 # pairs are overwritten, and the attributes point to the new task, not the built-in
5706 # task
5707 ttsAttribHash => {}, # Set below
5708 # Constant hash of TTS flag attributes, which allows the ';switch' command to
5709 # interact with specific tasks
5710 # Hash in the form
5711 # $constTtsFlagAttribHash{flag_attribute} = name_of_task_which_uses_it
5712 # ...where 'flag_attribute' is a string unique to this hash (not a TRUE or FALSE value),
5713 # preferably a single word in all lower-case letters
5714 # NB Each GA::Session contains a customisable hash, as for $self->constTtsAttribHash
5715 constTtsFlagAttribHash => {
5716 # Attack task
5717 'fight' => 'attack_task', # Turn on/off automatic kill reading
5718 'interact' => 'attack_task', # ...interaction reading
5719 'interaction' => 'attack_task', # ...interaction reading
5720 # Channels task
5721 'channels' => 'channels_task', # Turn on/off reading diverted msgs
5722 # Chat task
5723 'chat' => 'chat_task', # Turns on/off reading all messages
5724 'chatout' => 'chat_task', # ...only sent messages
5725 'chatin' => 'chat_task', # ...only received messages
5726 'chatecho' => 'chat_task', # ...only echoed (group) messages
5727 'chatsystem' => 'chat_task', # ...only local system messages
5728 'chatremote' => 'chat_task', # ...only remote system messages
5729 'chatsnoop' => 'chat_task', # ...only snooping messages
5730 # Divert task
5731 'divert' => 'divert_task', # Turn on/off reading diverted msgs
5732 'tell' => 'divert_task', # ...only tells
5733 'social' => 'divert_task', # ...only socials
5734 'custom' => 'divert_task', # ...only customs
5735 'warning' => 'divert_task', # ...only warnings
5736 # Locator task
5737 'title' => 'locator_task', # Turn on/off room title reading
5738 'descrip' => 'locator_task', # ...description reading
5739 'description' => 'locator_task', # ...description reading
5740 'exit' => 'locator_task', # ...exit list reading
5741 'exits' => 'locator_task', # ...exit list reading
5742 'content' => 'locator_task', # ...contents reading
5743 'contents' => 'locator_task', # ...contents reading
5744 'command' => 'locator_task', # ...room commands
5745 'cmd' => 'locator_task', # ...room commands
5746 # Status task
5747 'life' => 'status_task', # Turn on/off life status reading
5748 # Watch task
5749 'watch' => 'watch_task', # Turn on/off reading watched msgs
5750 },
5751 # Hash of TTS flag attributes, initially set identical to ->constTtsFlagAttribHash,
5752 # and then modified as plugins add new plugin tasks
5753 ttsFlagAttribHash => {}, # Set below
5754 # Constant hash of TTS alert attributes, which allows the ';alert' command to
5755 # interact with specific tasks
5756 # Hash in the form
5757 # $constTtsAlertAttribHash{alert_attribute} = name_of_task_which_uses_it
5758 # ...where 'alert_attribute' is a string unique to this hash, preferably a single word
5759 # in all lower-case letters
5760 # NB Each GA::Session contains a customisable hash, as for $self->constTtsAttribHash
5761 constTtsAlertAttribHash => {
5762 # Status task
5763 'healthup' => 'status_task', # HP recovers to minimum level
5764 'healthdown' => 'status_task', # ...falls to maximum level
5765 'magicup' => 'status_task', # Magic points recover to min level
5766 'magicdown' => 'status_task', # ...falls to maximum level
5767 'energyup' => 'status_task', # Energy points recover to min level
5768 'energydown' => 'status_task', # ...falls to maximum level
5769 'guildup' => 'status_task', # Guild points recover to min level
5770 'guilddown' => 'status_task', # ...falls to maximum level
5771 'socialup' => 'status_task', # Social points recover to min level
5772 'socialdown' => 'status_task', # ...falls to maximum level
5773 # ...
5774 },
5775 # Hash of TTS alert attributes, initially set identical to ->constTtsAlertAttribHash,
5776 # and then modified as plugins add new plugin tasks
5777 ttsAlertAttribHash => {}, # set below
5778  
5779 # IVs that govern what text is converted to speech
5780 # Convert text received from the world (after modification by triggers, etc)
5781 ttsReceiveFlag => TRUE, # [config]
5782 # Don't convert text received from the world before a login is processed (except for
5783 # prompts)
5784 ttsLoginFlag => TRUE, # [config]
5785 # Don't convert text received from the world that matches
5786 # GA::Profile::World->cmdPromptPatternList (after a login)
5787 ttsPromptFlag => TRUE, # [config]
5788 # Convert system messages
5789 ttsSystemFlag => TRUE, # [config]
5790 # Convert system error messages (including warning and debug messages)
5791 ttsSystemErrorFlag => TRUE, # [config]
5792 # Convert world commands
5793 ttsWorldCmdFlag => TRUE, # [config]
5794 # Convert 'dialogue' windows (as far as possible)
5795 ttsDialogueFlag => TRUE, # [config]
5796 # Convert (some) text displayed in (some) task windows
5797 ttsTaskFlag => FALSE, # [config]
5798 # Verbose speech (if enabled, preface lines with 'System message', 'Received text', etc)
5799 ttsVerboseFlag => FALSE, # [config]
5800  
5801 # Regardless of whether $self->ttsPromptFlag is set or not, and whether login has been
5802 # completed or not, $self->tts checks received text against
5803 # GA::Profile::World->cmdPromptPatternList, and stores the most recent matching prompt
5804 # here (so it can be replayed using the ';prompt' command)
5805 ttsLastPrompt => undef,
5806  
5807 # Paths to the binaries for various speech engines on MS Windows (ignored on other
5808 # operating systems). Note that there are two possible paths for eSpeak
5809 msWinPathESpeak => "C:\\Program Files\\espeak\\command_line\\espeak.exe",
5810 msWinAltPathESpeak
5811 => "C:\\Program Files (x86)\\espeak\\command_line\\espeak.exe",
5812 msWinPathESNG => "C:\\Program Files\\eSpeak NG\\espeak-ng.exe",
5813 msWinPathFestival => "C:\\festival\\src\\main\\festival.exe",
5814 msWinPathSwift => "C:\\Program Files\\Cepstral\\bin\\swift.exe",
5815  
5816 # Special IVs for interacting with the Festival server (on MS Windows, we never use the
5817 # server engine, only the command-line engine)
5818 # The default Festival server port
5819 constTtsFestivalServerPort => 1314,
5820 # The actual server port to use, when required. If 'undef' (or an empty string), the
5821 # command-line Festival engine is used
5822 ttsFestivalServerPort => undef, # [config]
5823 # Flag set to TRUE, the first time that $self->tts is called to use the Festival engine.
5824 # On that occasion, if $self->ttsFestivalServerPort is set, we try to start the
5825 # Festival server
5826 ttsFestivalFirstFlag => FALSE,
5827 # Festival server mode: 'cmd_line' to send text to the command-line engine, 'server' to
5828 # send it to the server engine
5829 ttsFestivalServerMode => 'cmd_line',
5830 # Festival server connection mode: 'cmd_line' when $self->ttsFestivalMode is 'cmd_line'.
5831 # Otherwise, set to 'waiting' when no connection is established, 'connecting' when
5832 # trying to establish a connection, and 'connected' when a connection has been
5833 # established
5834 ttsFestivalConnectMode => 'cmd_line',
5835 # The IO::Socket::INET object for the connection to the Festival server
5836 ttsFestivalSocket => undef,
5837 # When dealing with the Festival server, we may have to perform several actions, one
5838 # after the other, waiting for one to finish before starting the next
5839 # A list of requested actions. $self->ttsPerformJobs performs them one at a time
5840 # Valid requested actions are 'start', 'connect' and 'disconnect'
5841 ttsFestivalRequestList => [],
5842 # After the requested action 'start', we must give time for the server to initialise,
5843 # before we can give up trying to connect to it. The time (matches $self->clientTime)
5844 # at which we should stop trying to connect to the server. If the value is 'undef',
5845 # we give up after the first failed attempt
5846 ttsFestivalCheckTime => undef,
5847 # The period (in seconds) to wait
5848 ttsFestivalStopTime => 3,
5849 # Axmud must not try to start the server again, if the first attempt fails (unless
5850 # $self->ttsFestivalServerPort has changed). Flag set to TRUE if we could not start
5851 # the server, and set back to FALSE when the port is changed
5852 ttsFestivalFailFlag => FALSE,
5853 # Axmud must not try to start the server again, if a previous attempt succeeded (even if
5854 # the port has changed). Flag set to TRUE if we succeeded in starting the server
5855 ttsFestivalSuccessFlag => FALSE,
5856  
5857 # When $axmud::BLIND_MODE_FLAG is TRUE, show the user a helpful message about the help
5858 # for visually-impaired users
5859 # Flag is set to TRUE the first time this message is shown, after which it is never
5860 # shown again
5861 blindHelpMsgShownFlag => FALSE, # [config]
5862  
5863 # Other IVs
5864 # ---------
5865  
5866 # Lists of short names for months and days of the week (mainly used with functions like
5867 # ->localTime, ->localClock and ->localDate)
5868 # Registry list of short months (these values never change)
5869 constMonthList => [
5870 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',
5871 ],
5872 # Customisable list of short months (can be changed for other languages)
5873 customMonthList => [], # [config] Set below
5874 # Registry list of short days (these values never change)
5875 constDayList => [
5876 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat',
5877 ],
5878 # Customisable list of short days (can be changed for other languages)
5879 customDayList => [], # [config] Set below
5880 # Hash used by $self->convertRoman to convert integer numbers to Roman numerals, based
5881 # on Text::Roman by Stanislaw Pusep
5882 constRomanHash => {
5883 'I' => 1,
5884 'V' => 5,
5885 'X' => 10,
5886 'L' => 50,
5887 'C' => 100,
5888 'D' => 500,
5889 'M' => 1000,
5890 'IV' => 4,
5891 'IX' => 9,
5892 'XL' => 40,
5893 'XC' => 90,
5894 'CD' => 400,
5895 'CM' => 900,
5896 },
5897  
5898 # Constant list of IP lookup servers that provide the user's IP address (tested
5899 # September 2020)
5900 constIPLookupList => [
5901 'http://ifconfig.me/ip',
5902 'https://ifconfig.co/ip',
5903 'https://api.ipify.org',
5904 'http://icanhazip.com/',
5905 'https://ip.protenus.com/ip',
5906 ],
5907 # Customisable list (in case, in the far future, none of them are available)
5908 ipLookupList => [], # [config] Set below
5909 # The user's current IP address. To prevent unnecessary delays, the user's IP address is
5910 # only detected when required (for example, by the Chat task, or by
5911 # GA::Session->processNewEnvironData). When $self->ipv4Get is called and the user's
5912 # IP address is successfully retrieved, it is stored here. Subsequent calls to to
5913 # ->ipv4Get return this value
5914 # The value is not stored in the config file, so if the user switches to a different IP
5915 # address while Axmud is running, the old IP address continues to be used (unless the
5916 # user invokes the ;forcelookup command)
5917 currentIP => undef,
5918  
5919 # Lines in help files should be longer than 80 characters long
5920 constHelpCharLimit => 80, # [config]
5921  
5922 # The system time, in seconds, at which the client started
5923 startTime => undef,
5924 # The date/time at which the client started
5925 startClock => undef,
5926 startDate => undef,
5927 startClockString => undef,
5928 startDateString => undef,
5929  
5930 # When text is received from the world that doesn't end in a newline character, we wait
5931 # a short time before treating it as a prompt. If nothing else is received in that
5932 # time, it's a prompt.
5933 # Constant default time to wait
5934 constPromptWaitTime => 0.5,
5935 # The time to wait (in seconds, minimum value 0.1, maximum value 5)
5936 promptWaitTime => undef, # [config] Set below
5937 # At the start of a session, how long to wait for the character to login before showing
5938 # a reminder message
5939 # Constant default time to wait
5940 constLoginWarningTime => 60,
5941 # The time to wait (in seconds, minimum value 0 for 'immediately')
5942 loginWarningTime => undef, # [config] Set below
5943  
5944 # Toolbar buttons in the 'main' and automapper windows are created with labels. On most
5945 # Linux systems, the labels are only visible in a drop-down menu if there are too
5946 # many buttons in the toolbar, but on other systems (including MS Windows), the
5947 # labels are displayed beneath the buttons (which we don't want). Users can toggle
5948 # this flag to suit their own system
5949 # Flag set to TRUE if toolbar buttons should have labels, FALSE otherwise
5950 toolbarLabelFlag => undef, # [config] Set below
5951 # Some 'edit'/'pref' windows use the irreversible icon (stored as the file
5952 # /icons/system/irreversible.png) on buttons to show that stored data will be
5953 # modified immediately. However, on some (Linux) systems the icon isn't currently
5954 # visible. Flag set to TRUE if an icon should be drawn, FALSE if an asterisk should be
5955 # drawn instead
5956 irreversibleIconFlag => FALSE, # [config]
5957 # Flag set to TRUE if the popup window created by GA::Generic::Win->showBusyWin should
5958 # not be shown at all; FALSE if it can be shown (when required)
5959 allowBusyWinFlag => TRUE, # [config]
5960 # Flag set to FALSE if system messages should never be displayed in a session's 'main'
5961 # window, but redirected to the Session Console window; TRUE if the session should
5962 # decide for itself which of those to do
5963 mainWinSystemMsgFlag => TRUE, # [config]
5964 # Flag set to TRUE if a session's 'main' window urgency hint should be set, when text
5965 # is received from the world
5966 mainWinUrgencyFlag => FALSE, # [config]
5967 # Flag set to TRUE if tooltips should be shown in session's default tab
5968 mainWinTooltipFlag => TRUE, # [config]
5969  
5970 # Calls to $self->commify can modify a long number like 1000000 into something more
5971 # readable, like 1,000,000 (currently, only used by the Status task, but it's
5972 # available to any code)
5973 # The default mode to use when converting numbers with a call to $self->commify
5974 # 'none' - don't use commas (1000000)
5975 # 'comma' - use commas (1,000,000)
5976 # 'europe' - use European-style full stops/periods (1.000.000)
5977 # 'brit' - use British-style spaces (1 000 000)
5978 # 'underline' - use underlines (1_000_000)
5979 commifyMode => 'none', # [config]
5980  
5981 # Flag set to TRUE if the session's 'main' window urgency hint should be set once, when
5982 # the next text is received from the world; as soon as text is received, the flag is
5983 # set back to FALSE.
5984 tempUrgencyFlag => FALSE,
5985 # Flag set to TRUE if a sound effect should be played, when the next text is received
5986 # from the world; as soon as text is received, the flag is set back to FALSE
5987 tempSoundFlag => FALSE,
5988  
5989 # Regexes used to recognise valid web links
5990 constUrlRegex => $urlRegex,
5991 constShortUrlRegex => $shortRegex,
5992 # Flag set to TRUE if GA::Session->extractClickLinks should use both
5993 # $self->constUrlRegex and ->constShortUrlRegex, set to FALSE if it should only use
5994 # ->constUrlRegex
5995 shortUrlFlag => TRUE,
5996 # Regex used to recognise valid email addresses
5997 constEmailRegex => $emailRegex,
5998  
5999 # IV set briefly by private code (not included in the public release) which creates a
6000 # set of pre-configured worlds in the /items/worlds directory. When set,
6001 # ';exportfiles' and ';exportdata' save a file to a specific sub-directory, not to a
6002 # directory specified by the user. Set to 'undef' at all other times
6003 privConfigAllWorld => undef,
6004  
6005 # Benchmarking IVs
6006 # ----------------
6007  
6008 # Provides on-the-fly benchmarking of Axmud processes
6009 # Call $self->benchMark to set a start time, and $self->stopBenchMark to set a stop
6010 # time. The difference between the two is used to set the list IVs
6011 # The start time (matches the system time); set by $self->benchMark and reset by
6012 # ->stopBenchMark
6013 benchMarkTime => undef,
6014 # The last 10 and 100 benchmark times, used to provide an average (in microseconds),
6015 # which is written to the terminal
6016 benchMarkShortList => [],
6017 benchMarkLongList => [],
6018  
6019 # Debug flags
6020 # -----------
6021  
6022 # Flag set to TRUE if the text received from the world should be displayed in the 'main'
6023 # window with explicit text buffer line numbers (set to FALSE if text should be
6024 # displayed normally)
6025 debugLineNumsFlag => FALSE, # [config]
6026 # Flag set to TRUE if the text received from the world should be displayed in the 'main'
6027 # window with explicit Axmud colour/style tags (set to FALSE if text should be
6028 # displayed normally)
6029 debugLineTagsFlag => FALSE, # [config]
6030 # Flag set to TRUE if the Locator task should display standard debug messages as it
6031 # tries to interpret room statements (set to FALSE if the Locator should behave
6032 # normally)
6033 # Locator task debug messages uses an error code in the range 100-999
6034 debugLocatorFlag => FALSE, # [config]
6035 # Flag set to TRUE if the Locator task should display extensive standard debug messages
6036 # as it tries to interpret room statements (set to FALSE if the Locator should behave
6037 # normally)
6038 debugMaxLocatorFlag => FALSE, # [config]
6039 # Flag set to TRUE if GA::Obj::Exit should display debug messages for an illegal
6040 # exit direction (typically one that's over 64 characters long), FALSE if no debug
6041 # message should be shown
6042 debugExitFlag => FALSE, # [config]
6043 # Flag set to TRUE if the Locator task should display a summary of the contents of its
6044 # ->moveList IV (which contains a list of look/glance and movement commands for which
6045 # it is expecting to receive room statements) in its task window (set to FALSE if the
6046 # Locator's task window should behave normally)
6047 debugMoveListFlag => FALSE, # [config]
6048 # Flag set to TRUE if GA::Obj::WorldModel->parseObj (which converts a string like 'Two
6049 # big guards, a troll and three small torches are here' into a string of non-model
6050 # objects) should display standard debug messages as it parses lines (set to FALSE if
6051 # the function should behave normally)
6052 debugParseObjFlag => FALSE, # [config]
6053 # Flag set to TRUE if GA::Obj::WorldModel->objCompare (which compares a target model
6054 # object against a list of other model objects, to see if any of them seem to match
6055 # the target) should display standard debug messages as it makes comparisons (set to
6056 # FALSE if the function should behave normally)
6057 # (Also used by GA::Obj::WorldModel->objMatch)
6058 debugCompareObjFlag => FALSE, # [config]
6059 # Flag set to TRUE if GA::Client->loadPlugin should display debug messages, when a
6060 # plugin can't be loaded, specifying exactly why (set to FALSE otherwise)
6061 debugExplainPluginFlag => FALSE, # [config]
6062 # Flag set to TRUE if functions in the generic object, Games::Axmud (inherited by all
6063 # other objects) should show a debug message every time some part of the Axmud code
6064 # tries to use an IV which doesn't exist
6065 debugCheckIVFlag => TRUE, # [config]
6066 # Flag set to TRUE if Axmud should show error messages if a table object (inheriting
6067 # from GA::Generic::Table) can't be added or resized within its table strip object
6068 # (GA::Strip::Table)
6069 debugTableFitFlag => FALSE, # [config]
6070 # Flag set to TRUE if Perl errors/warnings should be displayed in the 'main' window
6071 # (set to FALSE if they should be sent to the terminal)
6072 debugTrapErrorFlag => TRUE, # [config]
6073  
6074 # Misc flags
6075 # ----------
6076  
6077 # When Axmud first runs (specifically, when GA::Obj::File->setupConfigFile is called),
6078 # the Setup 'wiz' window (GA::WizWin::Setup) invites the new user to initialise a few
6079 # settings. If required for testing purposes, the window can be blocked by setting
6080 # this flag to FALSE
6081 allowSetupWizWinFlag => TRUE,
6082 # If the flag above is TRUE, GA::Obj::File->setupConfigFile sets this flag to TRUE,
6083 # which is the signal to GA::Client->start to open the Setup 'wiz' window
6084 showSetupWizWinFlag => FALSE,
6085 # Flag that can be set to TRUE by any code (by calling $self->set_blockWorldHintFlag)
6086 # to stop the GA::Session displaying a 'dialogue' window with the world profile's
6087 # ->worldHint, when the session starts
6088 blockWorldHintFlag => FALSE,
6089 };
6090  
6091 # Bless the object into existence
6092 bless $self, $class;
6093  
6094 # Set remaining IVs
6095  
6096 $self->{charSet} = $self->constCharSet;
6097 # Sets ->charSetList
6098 $self->compileCharSets();
6099  
6100 $self->{clientCmdPrettyList} = [$self->constClientCmdPrettyList];
6101  
6102 $self->{cmdSep} = $self->constCmdSep;
6103  
6104 $self->{constWorldList} = [
6105 sort {lc($a) cmp lc($b)}
6106 ($self->ivKeys('constWorldHash'))
6107 ];
6108  
6109 $self->{cageTypeList} = [$self->constCageTypeList];
6110  
6111 $self->{taskPackageHash} = {$self->constTaskPackageHash};
6112 $self->{taskLabelHash} = {$self->constTaskLabelHash};
6113 $self->{taskRunFirstList} = [$self->constTaskRunFirstList];
6114 $self->{taskRunLastList} = [$self->constTaskRunLastList];
6115  
6116 $self->{logPrefHash} = {$self->constLogPrefHash};
6117  
6118 $self->{chatSmileyHash} = {$self->constChatSmileyHash};
6119  
6120 $self->{colourTagHash} = {$self->constColourTagHash};
6121 $self->{boldColourTagHash} = {$self->constBoldColourTagHash};
6122  
6123 # Sets ->constXTermColourHash, ->constNetscapeColourHash
6124 $self->setXTermColours();
6125 if ($self->currentColourCube eq 'netscape') {
6126  
6127 $self->{xTermColourHash} = {$self->constNetscapeColourHash};
6128  
6129 } else {
6130  
6131 # Default
6132 $self->{xTermColourHash} = {$self->constXTermColourHash};
6133 }
6134  
6135 foreach my $item ($self->constMsspVarList) {
6136  
6137 if (substr($item, 0, 1) ne '#') {
6138  
6139 $msspHash{$item} = undef;
6140 }
6141 }
6142  
6143 $self->{constMsspVarHash} = \%msspHash;
6144  
6145 $self->{defaultEnabledWinmap} = $self->constDefaultEnabledWinmap;
6146 $self->{defaultDisabledWinmap} = $self->constDefaultDisabledWinmap;
6147 $self->{defaultInternalWinmap} = $self->constDefaultInternalWinmap;
6148  
6149 $self->{gridBlockSize} = $self->constGridBlockSize;
6150  
6151 $self->{initWorkspaceHash} = {$self->constInitWorkspaceHash};
6152 $self->{initWorkspaceDir} = $self->constInitWorkspaceDir;
6153  
6154 $self->{customMainWinWidth} = $self->constMainWinWidth;
6155 $self->{customMainWinHeight} = $self->constMainWinHeight;
6156 $self->{customGridWinWidth} = $self->constGridWinWidth;
6157 $self->{customGridWinHeight} = $self->constGridWinHeight;
6158 $self->{customFreeWinWidth} = $self->constFreeWinWidth;
6159 $self->{customFreeWinHeight} = $self->constFreeWinHeight;
6160  
6161 $self->{customConfigWinIndexWidth}
6162 = $self->constConfigWinIndexWidth;
6163  
6164 if ($^O eq 'MSWin32') {
6165  
6166 $self->{constFontSize} = 13;
6167 }
6168  
6169 $self->{customInsertCmdColour} = $self->constInsertCmdColour;
6170 $self->{customShowSystemTextColour}
6171 = $self->constShowSystemTextColour;
6172 $self->{customShowErrorColour} = $self->constShowErrorColour;
6173 $self->{customShowWarningColour}
6174 = $self->constShowWarningColour;
6175 $self->{customShowDebugColour} = $self->constShowDebugColour;
6176 $self->{customShowImproperColour}
6177 = $self->constShowImproperColour;
6178  
6179 $self->{customTextBufferSize} = $self->constTextBufferSize;
6180  
6181 $self->{customStripHash} = {$self->constStripHash};
6182 $self->{customTableHash} = {$self->constTableHash};
6183  
6184 if ($^O eq 'linux') {
6185 @cmdList = $self->constLinuxCmdList;
6186 } elsif ($^O eq 'MSWin32') {
6187 @cmdList = $self->constMSWinCmdList;
6188 } elsif ($^O =~ m/bsd/i) { # 'freebsd', 'openbsd'
6189 @cmdList = $self->constBSDCmdList;
6190 }
6191  
6192 $self->{customDisplayBufferSize}
6193 = $self->constDisplayBufferSize;
6194 $self->{customInstructBufferSize}
6195 = $self->constInstructBufferSize;
6196 $self->{customCmdBufferSize} = $self->constCmdBufferSize;
6197  
6198 $self->{browserCmd} = shift @cmdList;
6199 $self->{emailCmd} = shift @cmdList;
6200 $self->{audioCmd} = shift @cmdList;
6201 $self->{textEditCmd} = shift @cmdList;
6202  
6203 $self->compileSoundEffects();
6204 foreach my $effect ($self->ivKeys('constExtendedSoundHash')) {
6205  
6206 # Values in ->constExtendedSoundHash are file names relative to /items/sounds; values in
6207 # ->customSoundHash should be full file paths
6208 $soundHash{$effect}
6209 = $axmud::DATA_DIR . '/sounds/' . $self->ivShow('constExtendedSoundHash', $effect);
6210 }
6211  
6212 $self->{customSoundHash} = {%soundHash};
6213  
6214 if ($^O eq 'MSWin32') {
6215 $self->{constTTSCompatList} = ['espeak', 'esng', 'festival', 'swift', 'none'];
6216 } else {
6217 $self->{constTTSCompatList} = [$self->constTTSList];
6218 }
6219  
6220 $self->{ttsAttribHash} = {$self->constTtsAttribHash};
6221 $self->{ttsFlagAttribHash} = {$self->constTtsFlagAttribHash};
6222 $self->{ttsAlertAttribHash} = {$self->constTtsAlertAttribHash};
6223  
6224 $self->{customMonthList} = [$self->constMonthList];
6225 $self->{customDayList} = [$self->constDayList];
6226  
6227 $self->{ipLookupList} = [$self->constIPLookupList];
6228  
6229 $self->{promptWaitTime} = $self->constPromptWaitTime;
6230 $self->{loginWarningTime} = $self->constLoginWarningTime;
6231  
6232 if ($^O eq 'MSWin32') {
6233 $self->{toolbarLabelFlag} = FALSE;
6234 } else {
6235 $self->{toolbarLabelFlag} = TRUE;
6236 }
6237  
6238 return $self;
6239 }
6240  
6241 ##################
6242 # Methods
6243  
6244 # Support functions for ->new
6245  
6246 sub compileCharSets {
6247  
6248 # Called by $self->new to set the contents of $self->charSetList
6249 #
6250 # Expected arguments
6251 # (none besides $self)
6252 #
6253 # Return values
6254 # 'undef' on improper arguments
6255 # 1 otherwise
6256  
6257 my ($self, $check) = @_;
6258  
6259 # Local variables
6260 my (
6261 $latinFlag, $unicodeFlag, $strictFlag, $extendFlag,
6262 @allList, @modList,
6263 );
6264  
6265 # Check for improper arguments
6266 if (defined $check) {
6267  
6268 # Global variable $axmud::CLIENT not set yet, so we'll just have to print the
6269 # improper arguments message
6270 print "IMPROPER ARGUMENTS: Games::Axmud::Client->compileCharSets "
6271 . join(' ', @_) . "\n";
6272 return undef;
6273 }
6274  
6275 # Get the Perl module's list of all charsets
6276 @allList = Encode->encodings(":all");
6277  
6278 # Some encodings are more important for Axmud than others. If the list contains them, move
6279 # them to the top of the list
6280 # (We'll sort the list first, although it should already be sorted)
6281 foreach my $item (sort {lc($a) cmp lc($b)} (@allList)) {
6282  
6283 if ($item eq 'iso-8859-1') {
6284 $latinFlag = TRUE;
6285 } elsif ($item eq 'utf8') {
6286 $unicodeFlag = TRUE;
6287 } elsif ($item eq 'utf-8-strict') {
6288 $strictFlag = TRUE;
6289 } elsif ($item eq 'cp437') {
6290 $extendFlag = TRUE;
6291 } else {
6292 push (@modList, $item);
6293 }
6294 }
6295  
6296 if ($extendFlag) {
6297  
6298 unshift (@modList, 'cp437');
6299 }
6300  
6301 if ($strictFlag) {
6302  
6303 unshift (@modList, 'utf-8-strict');
6304 }
6305  
6306 if ($unicodeFlag) {
6307  
6308 unshift (@modList, 'utf8');
6309 }
6310  
6311 if ($latinFlag) {
6312  
6313 unshift (@modList, 'iso-8859-1');
6314 }
6315  
6316 # Set the IV
6317 $self->{charSetList} = \@modList;
6318  
6319 return 1;
6320 }
6321  
6322 sub setXTermColours {
6323  
6324 # Called by $self->new to set the contents of $self->constXTermColourHash and
6325 # ->constNetscapeColourHash, based on a fixed algorithm borrowed from
6326 # http://www.gammon.com.au/forum/bbshowpost.php?id=7761&page=4
6327 #
6328 # Expected arguments
6329 # (none besides $self)
6330 #
6331 # Return values
6332 # 'undef' on improper arguments
6333 # 1 otherwise
6334  
6335 my ($self, $check) = @_;
6336  
6337 # Local variables
6338 my (%xTermHash, %netscapeHash);
6339  
6340 # Check for improper arguments
6341 if (defined $check) {
6342  
6343 # Global variable $axmud::CLIENT not set yet, so we'll just have to print the
6344 # improper arguments message
6345 print "IMPROPER ARGUMENTS: Games::Axmud::Client->setXTermColours "
6346 . join(' ', @_) . "\n";
6347 return undef;
6348 }
6349  
6350 # Generate the xterm colour cube
6351 %xTermHash = $self->generateColourCube(
6352 0,
6353 95,
6354 135,
6355 175,
6356 215,
6357 255,
6358 );
6359  
6360 $self->{constXTermColourHash} = \%xTermHash;
6361  
6362 # Generate the netscape colour cube
6363 %netscapeHash = $self->generateColourCube(
6364 0,
6365 51,
6366 102,
6367 153,
6368 204,
6369 255,
6370 );
6371  
6372 $self->{constNetscapeColourHash} = \%netscapeHash;
6373  
6374 return 1;
6375 }
6376  
6377 sub generateColourCube {
6378  
6379 # Called by $self->setXTermColours to generate one of the two colour cubes used by Axmud:
6380 # either the xterm colour cube or the netscape colour cube
6381 #
6382 # Expected arguments
6383 # @valueList
6384 # - Set of values that differentiate the two colour cubes
6385 # - Set to (0, 95, 135, 175, 205, 255) for the xterm colour cube
6386 # - Set to (0, 51, 102, 153, 204, 255) for the netscape colour cube
6387 #
6388 # Return values
6389 # An empty hash on improper arguments
6390 # Otherwise returns a hash converting an xterm colour tag (a string in the range 'x0' to
6391 # 'x255') into an RGB colour tag (a string in the range '#000000' to '#FFFFFF')
6392  
6393 my ($self, @valueList) = @_;
6394  
6395 # Local variables
6396 my (
6397 @colourList,
6398 %emptyHash, %returnHash,
6399 );
6400  
6401 # Check for improper arguments
6402 if (! @valueList) {
6403  
6404 # Global variable $axmud::CLIENT not set yet, so we'll just have to print the
6405 # improper arguments message
6406 print "IMPROPER ARGUMENTS: Games::Axmud::Client->generateColourCube "
6407 . join(' ', @_) . "\n";
6408 return %emptyHash;
6409 }
6410  
6411 # Add basic xterm colour tags x0 - x15
6412 push (@colourList,
6413 $self->convertRGB(0, 0, 0), # black
6414 $self->convertRGB(128, 0, 0), # maroon
6415 $self->convertRGB(0, 128, 0), # green
6416 $self->convertRGB(128, 128, 0), # olive
6417 $self->convertRGB(0, 0, 128), # navy
6418 $self->convertRGB(128, 0, 128), # purple
6419 $self->convertRGB(0, 128, 128), # teal
6420 $self->convertRGB(192, 192, 192), # silver
6421  
6422 $self->convertRGB(128, 128, 128), # grey
6423 $self->convertRGB(255, 0, 0), # red
6424 $self->convertRGB(0, 255, 0), # lime
6425 $self->convertRGB(255, 255, 0), # yellow
6426 $self->convertRGB(0, 0, 255), # blue
6427 $self->convertRGB(255, 0, 255), # magenta
6428 $self->convertRGB(0, 255, 255), # cyan
6429 $self->convertRGB(255, 255, 255), # white
6430 );
6431  
6432 # Add extended xterm colour tags x16 - x230
6433 for (my $red = 0; $red < 6; $red++) {
6434  
6435 for (my $green = 0; $green < 6; $green++) {
6436  
6437 for (my $blue = 0; $blue < 6; $blue++) {
6438  
6439 $colourList[(16 + ($red * 36) + ($green * 6) + $blue)]
6440 = $self->convertRGB(
6441 $valueList[$red],
6442 $valueList[$green],
6443 $valueList[$blue],
6444 );
6445 }
6446 }
6447 }
6448  
6449 # Add greyscale xterm colour tags x231-x255
6450 for (my $grey = 0; $grey < 24; $grey++) {
6451  
6452 my $value = 8 + ($grey * 10);
6453  
6454 $colourList[($grey + 232)] = $self->convertRGB($value, $value, $value);
6455 }
6456  
6457 # Prepare the return hash
6458 for (my $index = 0; $index < 256; $index++) {
6459  
6460 $returnHash{'x' . $index} = $colourList[$index];
6461 }
6462  
6463 return %returnHash;
6464 }
6465  
6466 sub convertRGB {
6467  
6468 # Called by $self->generateColourCube, which was in turn called by $self->setXTermColours
6469 # and $self->new
6470 # Converts an xterm-256 colour (using a 6x6x6 colour cube) into an RGB colour tag
6471 #
6472 # Expected arguments
6473 # $red - An integer in the range 0-255
6474 # $green - An integer in the range 0-255
6475 # $blue - An integer in the range 0-255
6476 #
6477 # Return values
6478 # 'undef' on improper arguments
6479 # Otherwise returns an RGB colour tag like '#000000'
6480  
6481 my ($self, $red, $green, $blue, $check) = @_;
6482  
6483 # Check for improper arguments
6484 if (! defined $red || ! defined $green || ! defined $blue || defined $check) {
6485  
6486 # Global variable $axmud::CLIENT not set yet, so we'll just have to print the
6487 # improper arguments message
6488 print "IMPROPER ARGUMENTS: Games::Axmud::Client->convertRGB " . join(' ', @_) . "\n";
6489 return undef;
6490 }
6491  
6492 return ('#' . sprintf('%02X%02X%02X', $red, $green, $blue));
6493 }
6494  
6495 sub compileSoundEffects {
6496  
6497 # Called by $self->new to set the contents of $self->constExtendedSoundHash; one key-value
6498 # pair for every sound file in /items/sounds
6499 #
6500 # Expected arguments
6501 # (none besides $self)
6502 #
6503 # Return values
6504 # 'undef' on improper arguments or if the /items/sounds directory doesn't exist
6505 # 1 otherwise
6506  
6507 my ($self, $check) = @_;
6508  
6509 # Local variables
6510 my (
6511 $dir, $dirHandle, $regex,
6512 @fileList,
6513 %hash,
6514 );
6515  
6516 # Check for improper arguments
6517 if (defined $check) {
6518  
6519 # Global variable $axmud::CLIENT not set yet, so we'll just have to print the
6520 # improper arguments message
6521 print "IMPROPER ARGUMENTS: Games::Axmud::Client->compileSoundEffects "
6522 . join(' ', @_) . "\n";
6523 return undef;
6524 }
6525  
6526 $dir = $axmud::SHARE_DIR . '/items/sounds/';
6527 if (! -e $dir) {
6528  
6529 return undef;
6530 }
6531  
6532 # Get a list of text files in this directory
6533 if (! opendir ($dirHandle, $dir)) {
6534  
6535 return undef;
6536  
6537 } else {
6538  
6539 @fileList = readdir ($dirHandle);
6540 closedir $dirHandle;
6541 }
6542  
6543 # Filter out non-sound files
6544 $regex = '\.(' . join('|', $self->ivKeys('constSoundFormatHash')) . ')$';
6545 foreach my $file (@fileList) {
6546  
6547 my $name;
6548  
6549 if ($file =~ m/$regex/) {
6550  
6551 $name = $file;
6552 $name =~ s/$regex//;
6553  
6554 $hash{$name} = $file;
6555 }
6556 }
6557  
6558 # Set the IV
6559 $self->{constExtendedSoundHash} = \%hash;
6560  
6561 return 1;
6562 }
6563  
6564 # Start / stop
6565  
6566 sub start {
6567  
6568 # Called by axmud.pl on startup, immediately after the call to GA::Client->new
6569 # Starts the client. Opens the first 'main' window, and prompts the user to connect to a
6570 # world
6571 #
6572 # Expected arguments
6573 # (none besides $self)
6574 #
6575 # Return values
6576 # 'undef' on improper arguments or if setup fails
6577 # 1 otherwise
6578  
6579 my ($self, $check) = @_;
6580  
6581 # Local variables
6582 my (
6583 $warningFlag, $roomObj, $exitObj, $desktopObj, $host, $engine, $port, $world, $profObj,
6584 $taskObj, $offlineFlag,
6585 @list,
6586 );
6587  
6588 # Check for improper arguments
6589 if (defined $check) {
6590  
6591 return $axmud::CLIENT->writeImproper($self->_objClass . '->start', @_);
6592 }
6593  
6594 # Set the date/time at which the client started
6595 $self->ivPoke('startTime', $self->localTime());
6596 $self->ivPoke('startClock', $self->localClock());
6597 $self->ivPoke('startDate', $self->localDate());
6598 $self->ivPoke('startClockString', $self->localClockString());
6599 $self->ivPoke('startDateString', $self->localDateString());
6600  
6601 # In Axmud test mode, blind mode is always disabled
6602 if ($axmud::TEST_MODE_FLAG) {
6603  
6604 $axmud::BLIND_MODE_FLAG = FALSE;
6605 }
6606  
6607 # In Axmud blind mode, TTS is always enabled
6608 if ($axmud::BLIND_MODE_FLAG) {
6609  
6610 $self->ivPoke('systemAllowTTSFlag', TRUE);
6611 }
6612  
6613 # Load the basic mudlist, and store the data in GA::Obj::BasicWorld objects. The data
6614 # isn't important, so don't disable loading/saving of data files if the operation fails
6615 if (! $self->loadBasicWorlds()) {
6616  
6617 $warningFlag = TRUE;
6618 $self->writeWarning(
6619 'Could not load basic mudlist (files possible corrupted)',
6620 $self->_objClass . '->start',
6621 );
6622 }
6623  
6624 # Load phrasebooks, and store the data in GA::Obj::PhraseBook objects. The data isn't
6625 # important, so don't disable loading/saving of data files if the operation fails
6626 if (! $self->loadPhrasebooks()) {
6627  
6628 $warningFlag = TRUE;
6629 $self->writeWarning(
6630 'Could not load phrasebooks (files possible corrupted)',
6631 $self->_objClass . '->start',
6632 );
6633 }
6634  
6635 # Create the file objects stored by this GA::Client object
6636 if (! $self->createFileObjs()) {
6637  
6638 $warningFlag = TRUE;
6639 $self->writeWarning(
6640 'Could not create file objects for the client - loading/saving disabled',
6641 $self->_objClass . '->start',
6642 );
6643  
6644 # Disable all loading/saving of data files (the TRUE argument means 'don't prompt the
6645 # user to do an emergency save')
6646 $self->disableAllFileAccess(TRUE);
6647 }
6648  
6649 # Make sure all standard directories exist
6650 if (! $self->createDataDirs()) {
6651  
6652 $warningFlag = TRUE;
6653 $self->writeWarning(
6654 'Could not create standard directories - loading/saving disabled',
6655 $self->_objClass . '->start',
6656 );
6657  
6658 # Disable all loading/saving of data files (the TRUE argument means 'don't prompt the
6659 # user to do an emergency save')
6660 $self->disableAllFileAccess(TRUE);
6661 }
6662  
6663 # Delete everything in the temporary directories
6664 # (The former is for plugins; the latter is for Axmud code)
6665 foreach my $tempDir ($axmud::DATA_DIR . '/tmp/', $axmud::DATA_DIR . '/data/temp/') {
6666  
6667 # Simplest way to empty the directory and all its sub-directories seems to be to
6668 # destroy the directory and make a new one
6669 File::Path::remove_tree($tempDir);
6670 mkdir ($tempDir, 0755);
6671 }
6672  
6673 # Create interface model objects (which store default values for interfaces - triggers,
6674 # aliases, macros, timers and hooks)
6675 @list = ('trigger', 'alias', 'macro', 'timer', 'hook');
6676 foreach my $type (@list) {
6677  
6678 my ($package, $obj);
6679  
6680 $package = 'Games::Axmud::InterfaceModel::' . ucfirst($type);
6681 $obj = $package->new();
6682 if (! $obj) {
6683  
6684 # (Allow writing to something other than GA::Session - there are no sessions yet)
6685 return $self->writeError(
6686 'Could not create interface model objects',
6687 $self->_objClass . '->start',
6688 );
6689  
6690 } else {
6691  
6692 $self->ivAdd('interfaceModelHash', $type, $obj);
6693 }
6694 }
6695  
6696 # Create standard zonemaps
6697 $self->createStandardZonemaps();
6698 # Create standard winmaps
6699 $self->createStandardWinmaps();
6700 # Create standard colour schemes
6701 $self->createStandardColourSchemes();
6702 # Set up supported MCP packages
6703 $self->createSupportedMcpPackages();
6704 # Set up keycodes for the current system
6705 $self->setupKeycodes();
6706 # Create default TTS objects
6707 $self->ttsCreateStandard();
6708  
6709 # Create a room object and an exit object with default values for their IVs, used to supply
6710 # default values for all other room/exit objects
6711 $roomObj = Games::Axmud::ModelObj::Room->new($self, 'default', 'global');
6712 $exitObj = Games::Axmud::Obj::Exit->new($self, 'default', 'global');
6713 if (! $roomObj || ! $exitObj) {
6714  
6715 return $self->writeError(
6716 'Could not initialise the default room and exit objects',
6717 $self->_objClass . '->start',
6718 );
6719  
6720 } else {
6721  
6722 $axmud::DEFAULT_ROOM = $roomObj;
6723 $axmud::DEFAULT_EXIT = $exitObj;
6724 }
6725  
6726 # Load (or create) the config file (if allowed)
6727 if (! $self->configFileObj->setupConfigFile()) {
6728  
6729 $warningFlag = TRUE;
6730 $self->writeWarning(
6731 'Error reading (or creating) the ' . $axmud::SCRIPT . ' config file - loading'
6732 . '/saving disabled',
6733 $self->_objClass . '->start',
6734 );
6735  
6736 # Disable all loading/saving of data files (the TRUE argument means 'don't prompt the
6737 # user to do an emergency save')
6738 $self->disableAllFileAccess(TRUE);
6739 }
6740  
6741 # Any changes to IV values which could not be applied immediately, the last time Axmud was
6742 # running, should be applied now
6743 # (->restartShareMainWinMode is 'default' if no change is required, or 'off' / 'on' if a
6744 # change is required)
6745 if ($self->restartShareMainWinMode ne 'default') {
6746  
6747 if ($self->restartShareMainWinMode eq 'off') {
6748 $self->ivPoke('shareMainWinFlag', FALSE);
6749 } else {
6750 $self->ivPoke('shareMainWinFlag', TRUE);
6751 }
6752  
6753 $self->ivPoke('restartShareMainWinMode', 'default');
6754 }
6755  
6756 # Initialise the default set of toolbar button objects
6757 if (! $self->initialiseToolbar()) {
6758  
6759 return $self->writeError(
6760 'Could not initialise toolbar button objects',
6761 $self->_objClass . '->start',
6762 );
6763 }
6764  
6765 # Create the main desktop object. Set up the default workspace, set up window icons, prepare
6766 # rc-file styles for each kind of window, create the first 'main' window
6767 $desktopObj = Games::Axmud::Obj::Desktop->new();
6768 if (! $desktopObj) {
6769  
6770 return $self->writeError(
6771 'Could not set up the desktop',
6772 $self->_objClass . '->start',
6773 );
6774  
6775 } else {
6776  
6777 $self->ivPoke('desktopObj', $desktopObj);
6778 if (! $desktopObj->start()) {
6779  
6780 return $self->writeError(
6781 'Could not set up the desktop',
6782 $self->_objClass . '->start',
6783 );
6784  
6785 } else {
6786  
6787 # Loading of data files and plugins could take some seconds; make the whole 'main'
6788 # window visible in the meantime
6789 $desktopObj->updateWidgets($self->_objClass . '->start');
6790 }
6791 }
6792  
6793 # Perform an auto-backup of Axmud's data directory, if required
6794 if (
6795 $self->autoBackupMode eq 'all_start'
6796 || (
6797 $self->autoBackupMode eq 'interval_start' && $self->checkBackupInterval()
6798 )
6799 ) {
6800 $self->doAutoBackup();
6801 }
6802  
6803 # Display a 'dialogue' window while loading data files/plugins
6804 if (! $axmud::TEST_MODE_FLAG && ! $axmud::BLIND_MODE_FLAG) {
6805  
6806 $self->mainWin->showBusyWin();
6807 }
6808  
6809 # If the user is using a new version of Axmud, check if there are any new pre-configured
6810 # worlds in this version. If so, insert them into Axmud's data directory
6811 if (
6812 $self->convertVersion($axmud::VERSION) > $self->convertVersion($self->prevClientVersion)
6813 ) {
6814 $self->insertPreConfigWorlds();
6815 # Don't perform this operation again until the next Axmud release
6816 $self->ivPoke('prevClientVersion', $axmud::VERSION);
6817 }
6818  
6819 # Load world profiles, creating a file object for each (if allowed, and if there are any to
6820 # load)
6821 if ($self->loadDataFlag && $self->configWorldProfList && ! $axmud::TEST_PRE_CONFIG_FLAG) {
6822  
6823 if (! $self->loadWorldProfs() ) {
6824  
6825 $warningFlag = TRUE;
6826 $self->writeWarning(
6827 'Error loading the world profiles expected after reading the \'config\''
6828 . ' file',
6829 $self->_objClass . '->start',
6830 );
6831 }
6832 }
6833  
6834 # Load data for the remaining file objects ('tasks', 'scripts', 'contacts', 'dicts',
6835 # 'toolbar', 'usercmds', 'zonemaps', 'winmaps', 'tts')
6836 if ($self->loadDataFlag && ! $self->loadOtherFiles()) {
6837  
6838 $warningFlag = TRUE;
6839 $self->writeWarning(
6840 'Error reading (or creating) data files - loading/saving disabled',
6841 $self->_objClass . '->start',
6842 );
6843  
6844 # Disable all loading/saving of data files (the TRUE argument means 'don't prompt the
6845 # user to do an emergency save')
6846 $self->disableAllFileAccess(TRUE);
6847 }
6848  
6849 # Add remaining workspaces, if any are specified
6850 $desktopObj->setupWorkspaces();
6851  
6852 # Set up client commands
6853 if (! $self->setupCmds()) {
6854  
6855 # (Allow writing to something other than GA::Session - there are no sessions yet)
6856 return $self->writeError(
6857 'Could not initialise ' . $axmud::SCRIPT . ' client commands',
6858 $self->_objClass . '->start',
6859 );
6860 }
6861  
6862 # Delete the contents of log directories (leaving files inside worlds' own log directories
6863 # intact), if the flag is set (but don't delete directories if this function has produced
6864 # any warning messages - so that the messages aren't lost
6865 if ($self->deleteStandardLogsFlag && ! $warningFlag) {
6866  
6867 $self->deleteStandardLogs();
6868 }
6869  
6870 # Load plugins in the /private directory, if it exists (will not exist in any public release
6871 # of Axmud)
6872 if (-e $axmud::SHARE_DIR . '/private') {
6873  
6874 $self->loadPrivatePlugins();
6875 }
6876  
6877 # Load initial plugins
6878 if ($self->initPluginList) {
6879  
6880 foreach my $pluginPath ($self->initPluginList) {
6881  
6882 if (! $self->loadPlugin($pluginPath)) {
6883  
6884 $self->writeWarning(
6885 'Error loading the plugin \'' . $pluginPath . '\'',
6886 $self->_objClass . '->start',
6887 );
6888 }
6889 }
6890 }
6891  
6892 # Close the 'dialogue' window and reset the Client IV that stores it
6893 if ($self->busyWin) {
6894  
6895 $self->mainWin->closeDialogueWin($self->busyWin);
6896 }
6897  
6898 # Start the client loop
6899 if (! $self->startClientLoop()) {
6900  
6901 return $self->writeError(
6902 'Could not start the client loop',
6903 $self->_objClass . '->start',
6904 );
6905 }
6906  
6907 # Prepare to initialise connections
6908 if ($self->showSetupWizWinFlag) {
6909  
6910 # When Axmud runs for the first time (specifically, when there is no Axmud config file)
6911 # this flag will be set to TRUE, instructing us to open the Setup 'wiz' window so the
6912 # new user can initialise a few settings
6913 if ($axmud::TEST_MODE_FLAG) {
6914  
6915 # In Axmud test mode, don't show the Setup window at all; just insert a couple of
6916 # tasks into the global initial tasklist
6917 $self->addGlobalInitTask('status_task');
6918 $self->addGlobalInitTask('locator_task');
6919  
6920 # Don't show the setup window twice
6921 $self->set_showSetupWizWinFlag(FALSE);
6922  
6923 } elsif ($axmud::BLIND_MODE_FLAG) {
6924  
6925 # In Axmud blind mode, don't show the Setup window at all; instead, insert a few
6926 # tasks into the global initial tasklist, and modify a few of their settings
6927 # (specifically, none of them open a task window)
6928 $taskObj = $self->addGlobalInitTask('status_task');
6929 if ($taskObj) {
6930  
6931 $taskObj->set_startWithWinFlag(FALSE);
6932 }
6933  
6934 $taskObj = $self->addGlobalInitTask('locator_task');
6935 if ($taskObj) {
6936  
6937 $taskObj->set_startWithWinFlag(FALSE);
6938 }
6939  
6940 $taskObj = $self->addGlobalInitTask('compass_task');
6941 if ($taskObj) {
6942  
6943 $taskObj->set_startWithWinFlag(FALSE);
6944 }
6945  
6946 $taskObj = $self->addGlobalInitTask('divert_task');
6947 if ($taskObj) {
6948  
6949 $taskObj->set_requireWinFlag(FALSE);
6950 $taskObj->set_startWithWinFlag(FALSE);
6951 # Turn off sound effects, since TTS is used instead
6952 $taskObj->ivUndef('tellAlertSound');
6953 $taskObj->ivUndef('socialAlertSound');
6954 $taskObj->ivUndef('customAlertSound');
6955 $taskObj->ivUndef('warningAlertSound');
6956 $taskObj->ivUndef('otherAlertSound');
6957 }
6958  
6959 # Don't show the setup window twice
6960 $self->set_showSetupWizWinFlag(FALSE);
6961  
6962 } else {
6963  
6964 # Open the setup window. When it closes, it will open the Connections window for us
6965 $self->mainWin->quickFreeWin('Games::Axmud::WizWin::Setup');
6966  
6967 # Disable most main window toolbar/menu items, while the window is open
6968 $self->desktopObj->restrictWidgets();
6969  
6970 # Don't show the setup window twice
6971 $self->set_showSetupWizWinFlag(FALSE);
6972  
6973 return 1;
6974 }
6975 }
6976  
6977 if (@ARGV) {
6978  
6979 # The user started Axmud with arguments, e.g. from a Linux terminal:
6980 # ./axmud.pl deathmud.com 5000
6981 # If the port is not specified, the generic port is used:
6982 # ./axmud.pl deathmud.com (use port 23)
6983 # The user can also specify a world profile name:
6984 # ./axmud.pl deathmud
6985 #
6986 # Any of those formats can use baxmud.pl rather than axmud.pl
6987 # Any of those formats can specify one of Axmud's supported text-to-speech engines,
6988 # after all the other arguments (any of the items in $self->constTTSList, e.g.
6989 # 'festival'). If a recognised speech engine is specified, that engine is used for
6990 # all text-to-speech while Axmud is running
6991 $engine = $ARGV[-1];
6992 if (defined $engine && defined $self->ivFind('constTTSList', $engine)) {
6993  
6994 pop @ARGV;
6995 $self->ivPoke('forceTTSEngine', $engine);
6996 }
6997 }
6998  
6999 if (@ARGV) {
7000  
7001 $host = shift @ARGV;
7002 $port = shift @ARGV;
7003 if (@ARGV) {
7004  
7005 # (Allow writing to something other than GA::Session - there are no sessions yet)
7006 return $self->writeError(
7007 'Invalid command line arguments (try \'<host> <port>\', \'<host>\' or'
7008 . ' \'<world_name>\')',
7009 $self->_objClass . '->start',
7010 );
7011 }
7012  
7013 if (! $port && $self->ivExists('worldProfHash', $host)) {
7014  
7015 # $host is a world profile name
7016 $world = $host;
7017 $profObj = $self->ivShow('worldProfHash', $world);
7018 ($host, $port) = $profObj->getConnectDetails();
7019  
7020 if (! $self->startSession($world, $host, $port)) {
7021  
7022 # (Allow writing to something other than GA::Session - there are no sessions
7023 # yet)
7024 return $self->writeError(
7025 'Could not open a session connecting to \'' . $host . '\'',
7026 $self->_objClass . '->start',
7027 );
7028 }
7029  
7030 } else {
7031  
7032 # $host is a host address. Get a temporary world name
7033 $world = $self->getTempProfName();
7034 if (
7035 ! $world
7036 || ! $self->startSession(
7037 $world,
7038 $host,
7039 $port,
7040 undef, # No character
7041 undef, # No password
7042 undef, # No account
7043 undef, # Default protocol
7044 undef, # No login mode
7045 FALSE, # Not offline mode
7046 TRUE, # Temporary world profile
7047 )
7048 ) {
7049 # (Allow writing to something other than GA::Session - there are no sessions
7050 # yet)
7051 return $self->writeError(
7052 'Could not open a session connecting to \'' . $host . '\'',
7053 $self->_objClass . '->start',
7054 );
7055 }
7056 }
7057  
7058 } elsif ($axmud::BLIND_MODE_FLAG && ! $self->autoConnectList) {
7059  
7060 # In Axmud blind mode, open a series of standard 'dialogue' windows, allowing the
7061 # visually-impaired user to select/create a world and/or character
7062 $self->connectBlind();
7063  
7064 } elsif ($axmud::TEST_MODE_FLAG) {
7065  
7066 # In Axmud test mode, connect to a world which is assumed to be running on the local
7067 # machine
7068 if (! $axmud::TEST_MODE_LOGIN_LIST[5]) {
7069 $offlineFlag = TRUE;
7070 } else {
7071 $offlineFlag = undef;
7072 }
7073  
7074 if (
7075 ! $self->startSession(
7076 $axmud::TEST_MODE_LOGIN_LIST[0], # World
7077 $axmud::TEST_MODE_LOGIN_LIST[1], # Host
7078 $axmud::TEST_MODE_LOGIN_LIST[2], # Post
7079 $axmud::TEST_MODE_LOGIN_LIST[3], # Character
7080 $axmud::TEST_MODE_LOGIN_LIST[4], # Password
7081 undef, # Account
7082 undef, # Default protocol
7083 undef, # No login mode
7084 $offlineFlag,
7085 )
7086 ) {
7087 return undef;
7088 }
7089  
7090 } elsif ($self->autoConnectList) {
7091  
7092 # Connect to all the worlds specified by the auto-connection list
7093 OUTER: foreach my $line ($self->autoConnectList) {
7094  
7095 my (
7096 $worldName, $worldObj, $host, $port, $char, $password, $account,
7097 @list,
7098 );
7099  
7100 # Each line is in the form <world> <optional_char> <optional_char>...
7101 @list = split(/\s+/, $line);
7102 $worldName = shift @list;
7103  
7104 # Check the world exists and, if not, ignore this line
7105 $worldObj = $self->ivShow('worldProfHash', $worldName);
7106 if (! $worldObj) {
7107  
7108 next OUTER;
7109 }
7110  
7111 if (! @list) {
7112  
7113 # Get connection details for this world
7114 ($host, $port) = $worldObj->getConnectDetails();
7115  
7116 # Connect without a character
7117 if (
7118 $self->startSession($worldName, $host, $port)
7119 && $axmud::BLIND_MODE_FLAG
7120 ) {
7121 # In blind mode, stop after the first successful connection
7122 last OUTER;
7123 }
7124  
7125 } else {
7126  
7127 INNER: foreach my $thisChar (@list) {
7128  
7129 # Check that the character profile exists
7130 my $profType = $worldObj->ivShow('profHash', $thisChar);
7131 if (! defined $profType || $profType ne 'char') {
7132  
7133 next INNER;
7134 }
7135  
7136 # Check that a connection has already been initiated for this world/
7137 # character combination
7138 foreach my $session ($self->ivValues('sessionHash')) {
7139  
7140 if (
7141 $session->initWorld eq $worldName
7142 && $session->initChar
7143 && $session->initChar eq $thisChar
7144 ) {
7145 next INNER;
7146 }
7147 }
7148  
7149 # Get connection details for this world
7150 ($host, $port, $char, $password, $account)
7151 = $worldObj->getConnectDetails($thisChar);
7152  
7153 # Connect with a character
7154 if (
7155 $self->startSession(
7156 $worldName,
7157 $host,
7158 $port,
7159 $char,
7160 $password,
7161 $account
7162 )
7163 && $axmud::BLIND_MODE_FLAG
7164 ) {
7165 # In blind mode, stop after the first successful connection
7166 last OUTER;
7167 }
7168 }
7169 }
7170 }
7171  
7172 # During this process, if no connections were actually initialised, open the Connections
7173 # window as normal (except in Axmud blind mode)
7174 if (! $self->sessionHash) {
7175  
7176 if ($axmud::BLIND_MODE_FLAG) {
7177 $self->connectBlind();
7178 } else {
7179 $self->mainWin->quickFreeWin('Games::Axmud::OtherWin::Connect');
7180 }
7181 }
7182  
7183 } else {
7184  
7185 # Open the Connections window. If the user wants to connect to a world, it calls
7186 # GA::Client->startSession
7187 $self->mainWin->quickFreeWin('Games::Axmud::OtherWin::Connect');
7188 }
7189  
7190 return 1;
7191 }
7192  
7193 sub stop {
7194  
7195 # Called by axmud.pl on shutdown
7196 # Also called by $self->stopSession, GA::Cmd::StopClient->do, GA::Cmd::Panic->do,
7197 # GA::Cmd::RestoreWorld->do, GA::Win::Internal->setDeleteEvent and
7198 # GA::Strip::MenuBar->drawWorldColumn
7199 # Stops the client
7200 #
7201 # Expected arguments
7202 # (none besides $self)
7203 #
7204 # Return values
7205 # 'undef' on improper arguments
7206 # 1 otherwise
7207  
7208 my ($self, $check) = @_;
7209  
7210 # Local variables
7211 my $tempDir;
7212  
7213 # Check for improper arguments
7214 if (defined $check) {
7215  
7216 return $axmud::CLIENT->writeImproper($self->_objClass . '->stop', @_);
7217 }
7218  
7219 # The END() function will call this function again, before terminating the script, unless
7220 # we set this flag
7221 # (The TRUE value also gives GA::Obj::WorkspaceGrid->stop to destroy a shared 'main'
7222 # window, rather than just disengaging it)
7223 $self->ivPoke('shutdownFlag', TRUE);
7224  
7225 # This flag prevents multiple concurrent calls to this function if, for example, the user
7226 # is repeatedly clicking the 'main' window's close button
7227 if ($self->terminatingFlag) {
7228  
7229 return undef;
7230  
7231 } else {
7232  
7233 $self->ivPoke('terminatingFlag', TRUE);
7234 }
7235  
7236 # If any text is being convertd to speech right now, interrupt it
7237 $self->ttsInterruptJob();
7238  
7239 # Perform an auto-backup of Axmud's data directory, if required
7240 if (
7241 $self->autoBackupMode eq 'all_stop'
7242 || (
7243 $self->autoBackupMode eq 'interval_stop' && $self->checkBackupInterval()
7244 )
7245 ) {
7246 $self->doAutoBackup();
7247 }
7248  
7249 # Fire any hooks in any session that are using the 'close_disconnect' hook event
7250 foreach my $sessionObj ($self->listSessions()) {
7251  
7252 $sessionObj->checkHooks('close_disconnect');
7253 }
7254  
7255 # Stop every current session
7256 if ($self->sessionHash && ! $self->stopAllSessions()) {
7257  
7258 return $self->writeError(
7259 'Could not stop all sessions',
7260 $self->_objClass . '->stop',
7261 );
7262 }
7263  
7264 # Stop the client loop (if running)
7265 if ($self->clientLoopObj && ! $self->stopClientLoop()) {
7266  
7267 return $self->writeError(
7268 'Could not stop the client loop',
7269 $self->_objClass . '->stop',
7270 );
7271 }
7272  
7273 # Close any remaining 'internal' windows, restore 'external' windows to their original size/
7274 # position, close any remaining 'free' windows
7275 if (! $self->desktopObj->stop()) {
7276  
7277 return $self->writeError(
7278 'Could not stop the desktop object',
7279 $self->_objClass . '->stop',
7280 );
7281 }
7282  
7283 # Delete everything in the temporary directories
7284 # (The former is for plugins; the latter is for Axmud code)
7285 foreach my $tempDir ($axmud::DATA_DIR . '/tmp/', $axmud::DATA_DIR . '/data/temp/') {
7286  
7287 # Simplest way to empty the directory and all its sub-directories seems to be to
7288 # destroy the directory and make a new one
7289 File::Path::remove_tree($tempDir);
7290 mkdir ($tempDir, 0755);
7291 }
7292  
7293 # Halt Gtk3, which halts Axmud
7294 Gtk3->main_quit();
7295  
7296 return 1;
7297 }
7298  
7299 # Setup
7300  
7301 sub loadBasicWorlds {
7302  
7303 # Called by $self->start
7304 # Loads data from the basic mudlist and stores it in GA::Obj::BasicWorld objects, ready for
7305 # the Connections window to display
7306 #
7307 # Expected arguments
7308 # (none besides $self)
7309 #
7310 # Return values
7311 # 'undef' on improper arguments, if the file can't be read or if it appears to be
7312 # corrupted
7313 # 1 on success
7314  
7315 my ($self, $check) = @_;
7316  
7317 # Local variables
7318 my (
7319 $path, $fileHandle, $exitFlag,
7320 @list,
7321 %hash,
7322 );
7323  
7324 # Check for improper arguments
7325 if (defined $check) {
7326  
7327 return $axmud::CLIENT->writeImproper($self->_objClass . '->loadBasicWorlds', @_);
7328 }
7329  
7330 $path = $axmud::SHARE_DIR . '/items/mudlist/mudlist.txt';
7331 if (! -e $path) {
7332  
7333 return undef;
7334 }
7335  
7336 # Open the file for reading
7337 if (! open ($fileHandle, "<$path")) {
7338  
7339 return undef;
7340 }
7341  
7342 # Read the file
7343 do {
7344  
7345 my $line = <$fileHandle>;
7346  
7347 # Without this line, Cyrillic text is read as gibberish
7348 $line = Encode::decode('utf8', $line);
7349  
7350 if (! defined $line) {
7351  
7352 $exitFlag = TRUE;
7353  
7354 # Ignore empty lines and comments
7355 } elsif ($line =~ m/\S/ && ! ($line =~ m/^\s*\#/)) {
7356  
7357 chomp $line;
7358 push (@list, $self->trimWhitespace($line));
7359 }
7360  
7361 } until ($exitFlag);
7362  
7363 close $fileHandle;
7364  
7365 if (! @list) {
7366  
7367 # File is empty
7368 return undef;
7369 }
7370  
7371 # Store the data
7372 do {
7373  
7374 my ($longName, $name, $host, $port, $adultFlag, $language, $obj);
7375  
7376 $longName = shift @list;
7377 $name = shift @list;
7378 $host = shift @list;
7379 $port = shift @list;
7380 $adultFlag = shift @list;
7381 $language = shift @list;
7382  
7383 # Check that a line isn't missing (and that an extra line hasn't been inserted) by
7384 # checking the value of the flag, which can only be 0 or 1, and also by checking that
7385 # $language is defined (which also means missing or additional lines)
7386 if (
7387 (! defined $adultFlag || ($adultFlag ne '1' && $adultFlag ne '0'))
7388 || ! defined $language
7389 ) {
7390 # File corrupted
7391 return undef;
7392 }
7393  
7394 # $adultFlag must be TRUE or FALSE
7395 if (! $adultFlag) {
7396 $adultFlag = FALSE;
7397 } else {
7398 $adultFlag = TRUE;
7399 }
7400  
7401 # Create an object to store basic details for this world
7402 $obj = Games::Axmud::Obj::BasicWorld->new(
7403 $name,
7404 $longName,
7405 $host,
7406 $port,
7407 $adultFlag,
7408 $language,
7409 );
7410  
7411 if (! $obj) {
7412  
7413 # Improper args or $name is invalid
7414 return undef;
7415  
7416 } else {
7417  
7418 $hash{$name} = $obj;
7419 }
7420  
7421 } until (! @list);
7422  
7423 # Data loaded successfully; store it
7424 $self->{constBasicWorldHash} = \%hash;
7425  
7426 # Operation complete
7427 return 1;
7428 }
7429  
7430 sub loadPhrasebooks {
7431  
7432 # Called by $self->start
7433 # Loads data from the phrasebook files and stores it in GA::Obj::Phrasebook objects
7434 #
7435 # Expected arguments
7436 # (none besides $self)
7437 #
7438 # Return values
7439 # 'undef' on improper arguments, if the file can't be read or if it appears to be
7440 # corrupted
7441 # 1 on success
7442  
7443 my ($self, $check) = @_;
7444  
7445 # Local variables
7446 my (
7447 $dirHandle, $dir,
7448 @fileList, @modList,
7449 %hash,
7450 );
7451  
7452 # Check for improper arguments
7453 if (defined $check) {
7454  
7455 return $axmud::CLIENT->writeImproper($self->_objClass . '->loadPhrasebooks', @_);
7456 }
7457  
7458 $dir = $axmud::SHARE_DIR . '/items/phrasebooks/';
7459 if (! -e $dir) {
7460  
7461 return undef;
7462 }
7463  
7464 # Get a list of text files in this directory
7465 if (! opendir ($dirHandle, $dir)) {
7466  
7467 return undef;
7468  
7469 } else {
7470  
7471 @fileList = readdir ($dirHandle);
7472 closedir $dirHandle;
7473 }
7474  
7475 # Filter out the file template (beginning with an underline) and anything that's not a .txt
7476 # file
7477 foreach my $file (@fileList) {
7478  
7479 if ($file =~ m/^[A-Za-z].*\.txt$/) {
7480  
7481 push (@modList, $file);
7482 }
7483 }
7484  
7485 if (! @modList) {
7486  
7487 return undef;
7488 }
7489  
7490 # Read each file in turn, creating a new phrasebook object for each
7491 foreach my $file (@modList) {
7492  
7493 my (
7494 $path, $fileHandle, $pbObj, $exitFlag, $name, $targetName, $nounPosn, $number,
7495 @lineList, @primaryDirList, @primaryAbbrevDirList, @definiteList, @indefiniteList,
7496 @andList, @orList, @numberList,
7497 );
7498  
7499 # Open the file for reading
7500 $path = $dir . $file;
7501 if (! open ($fileHandle, "<$path")) {
7502  
7503 return undef;
7504 }
7505  
7506 # Read the file
7507 do {
7508  
7509 my $line = <$fileHandle>;
7510  
7511 # Without this line, the Russian phrasebook is gibberish
7512 $line = Encode::decode('utf8', $line);
7513  
7514 if (! defined $line) {
7515  
7516 $exitFlag = TRUE;
7517  
7518 } elsif ($line =~ m/^\s*[[:alnum:]]/) {
7519  
7520 # Ignore empty lines and lines starting with a #
7521 chomp $line;
7522 push (@lineList, $self->trimWhitespace($line));
7523 }
7524  
7525 } until ($exitFlag);
7526  
7527 close $fileHandle;
7528  
7529 # Interpret the data
7530 $name = shift @lineList;
7531 $targetName = shift @lineList;
7532 $nounPosn = shift @lineList;
7533  
7534 for (my $count = 0; $count < 18; $count++) {
7535  
7536 push (@primaryDirList, shift @lineList);
7537 }
7538  
7539 for (my $count = 0; $count < 18; $count++) {
7540  
7541 push (@primaryAbbrevDirList, shift @lineList);
7542 }
7543  
7544 $number = shift @lineList;
7545 if (! $self->intCheck($number, 0)) {
7546  
7547 return undef;
7548  
7549 } elsif ($number > 0) {
7550  
7551 for (my $count = 0; $count < $number; $count++) {
7552  
7553 push (@definiteList, shift @lineList);
7554 }
7555 }
7556  
7557 $number = shift @lineList;
7558 if (! $self->intCheck($number, 0)) {
7559  
7560 return undef;
7561  
7562 } elsif ($number > 0) {
7563  
7564 for (my $count = 0; $count < $number; $count++) {
7565  
7566 push (@indefiniteList, shift @lineList);
7567 }
7568 }
7569  
7570 $number = shift @lineList;
7571 if (! $self->intCheck($number, 0)) {
7572  
7573 return undef;
7574  
7575 } elsif ($number > 0) {
7576  
7577 for (my $count = 0; $count < $number; $count++) {
7578  
7579 push (@andList, shift @lineList);
7580 }
7581 }
7582  
7583 $number = shift @lineList;
7584 if (! $self->intCheck($number, 0)) {
7585  
7586 return undef;
7587  
7588 } elsif ($number > 0) {
7589  
7590 for (my $count = 0; $count < $number; $count++) {
7591  
7592 push (@orList, shift @lineList);
7593 }
7594 }
7595  
7596 for (my $count = 0; $count < 10; $count++) {
7597  
7598 push (@numberList, shift @lineList);
7599 }
7600  
7601 # There shouldn't be anything left
7602 if (@lineList) {
7603  
7604 return undef;
7605 }
7606  
7607 # Store the data in a phrasebook object
7608 $pbObj = Games::Axmud::Obj::Phrasebook->new($name, $targetName);
7609 if (! $pbObj) {
7610  
7611 return undef;
7612  
7613 } else {
7614  
7615 if (substr($nounPosn, 0, 1) eq 'n') {
7616 $pbObj->ivPoke('nounPosn', 'noun_adj');
7617 } else {
7618 $pbObj->ivPoke('nounPosn', 'adj_noun');
7619 }
7620  
7621 $pbObj->ivPoke('primaryDirList', @primaryDirList);
7622 $pbObj->ivPoke('primaryAbbrevDirList', @primaryAbbrevDirList);
7623 $pbObj->ivPoke('definiteList', @definiteList);
7624 $pbObj->ivPoke('indefiniteList', @indefiniteList);
7625 $pbObj->ivPoke('andList', @andList);
7626 $pbObj->ivPoke('orList', @orList);
7627 $pbObj->ivPoke('numberList', @numberList);
7628  
7629 $hash{$name} = $pbObj;
7630 }
7631 }
7632  
7633 $self->{constPhrasebookHash} = \%hash;
7634  
7635 # Operation complete
7636 return 1;
7637 }
7638  
7639 sub createFileObjs {
7640  
7641 # Called by $self->start
7642 # Creates the file objects (GA::Obj::File) that are stored in this GA::Client's registry
7643 # (omitting those which are stored in GA::Session's registry)
7644 # NB Does not create any 'worldprof' file objects yet
7645 #
7646 # Expected arguments
7647 # (none besides $self)
7648 #
7649 # Return values
7650 # 'undef' on improper arguments or if any of the file objects can't be created
7651 # 1 on success
7652  
7653 my ($self, $check) = @_;
7654  
7655 # Local variables
7656 my @list;
7657  
7658 # Check for improper arguments
7659 if (defined $check) {
7660  
7661 return $axmud::CLIENT->writeImproper($self->_objClass . '->createFileObjs', @_);
7662 }
7663  
7664 # The list of file object types to create
7665 @list = (
7666 'config', 'tasks', 'scripts', 'contacts', 'dicts', 'toolbar', 'usercmds', 'zonemaps',
7667 'winmaps', 'tts',
7668 );
7669  
7670 # Create the FileObjs
7671 foreach my $type (@list) {
7672  
7673 my $obj = Games::Axmud::Obj::File->new($type);
7674  
7675 if (! $obj) {
7676  
7677 return undef;
7678  
7679 } else {
7680  
7681 # FileObj created
7682 $self->ivAdd('fileObjHash', $type, $obj);
7683 if ($type eq 'config') {
7684  
7685 $self->ivPoke('configFileObj', $obj);
7686 }
7687 }
7688 }
7689  
7690 # All file objects created
7691 return 1;
7692 }
7693  
7694 sub setModifyFlag {
7695  
7696 # Called by anything
7697 # Sets a file object's ->modifyFlag, first checking that the file object actually exists
7698 # (and displaying a warning, if not)
7699 # NB 'otherprof' and 'worldmodel' file objects can't be accessed from here. Use
7700 # GA::Session->setModifyFlag instead
7701 # NB The GA::Session->setModifyFlag can be called for any file object stored in the client's
7702 # registry; it passes requests directly to this function
7703 #
7704 # Expected arguments
7705 # $objName - The unique name of the file object, matching a key in $self->fileObjHash
7706 # ('config', 'tasks', 'scripts', 'contacts', 'dicts', 'toolbar',
7707 # 'usercmds', 'zonemaps', 'winmaps', 'tts' or the name of a world profile)
7708 # $flag - The setting for the flag (TRUE of FALSE)
7709 #
7710 # Optional arguments
7711 # $func - The calling function. Ignored for now, if specified
7712 #
7713 # Return values
7714 # 'undef' on improper arguments
7715 # $flag on success
7716  
7717 my ($self, $objName, $flag, $func, $check) = @_;
7718  
7719 # Check for improper arguments
7720 if (! defined $objName || ! defined $flag || defined $check) {
7721  
7722 return $axmud::CLIENT->writeImproper($self->_objClass . '->setModifyFlag', @_);
7723 }
7724  
7725 # Check the file object exists
7726 if (! $self->ivExists('fileObjHash', $objName)) {
7727  
7728 return $self->writeWarning(
7729 'Missing file object \'' . $objName . '\' - can\'t set its modified data flag',
7730 $self->_objClass . '->setModifyFlag',
7731 );
7732  
7733 } else {
7734  
7735 return $self->ivShow('fileObjHash', $objName)->set_modifyFlag($flag);
7736 }
7737 }
7738  
7739 sub createDataDirs {
7740  
7741 # Called by $self->start and by GA::Obj::File->setupConfigFile
7742 # Creates any standard Axmud data directories that don't already exist
7743 #
7744 # Expected arguments
7745 # (none besides $self)
7746 #
7747 # Return values
7748 # 'undef' on improper arguments
7749 # 1 on success
7750  
7751 my ($self, $check) = @_;
7752  
7753 # Check for improper arguments
7754 if (defined $check) {
7755  
7756 return $axmud::CLIENT->writeImproper($self->_objClass . '->createDataDirs', @_);
7757 }
7758  
7759 # Check for data directories created by previous versions of Axmud (which will have
7760 # different names)
7761 if (! -e $axmud::DATA_DIR) {
7762  
7763 OUTER: foreach my $nameShort (@axmud::COMPAT_DIR_LIST) {
7764  
7765 my ($dataDir, $config);
7766  
7767 # (Ignore the directory we already know doesn't exist)
7768 if ($nameShort ne $axmud::NAME_SHORT) {
7769  
7770 $dataDir = File::HomeDir->my_home . '/' . $nameShort . '-data';
7771 if (-e $dataDir) {
7772  
7773 # Data directory exists; rename it and its config file
7774 if (File::Copy::Recursive::dirmove($dataDir, $axmud::DATA_DIR)) {
7775  
7776 # MSWin uses .ini, everything else uses .conf
7777 $config = $axmud::DATA_DIR . '/' . $nameShort . '.';
7778 if (-e $config . 'ini') {
7779  
7780 File::Copy::move(
7781 $config . 'ini',
7782 $axmud::DATA_DIR . '/' . $axmud::NAME_SHORT . '.ini',
7783 );
7784  
7785 } elsif (-e $config . 'conf') {
7786  
7787 File::Copy::move(
7788 $config . 'conf',
7789 $axmud::DATA_DIR . '/' . $axmud::NAME_SHORT . '.conf',
7790 );
7791 }
7792 }
7793  
7794 last OUTER;
7795 }
7796 }
7797 }
7798 }
7799  
7800 # Create directories
7801 mkdir ($axmud::DATA_DIR, 0755);
7802 mkdir ($axmud::DATA_DIR . '/buffers', 0755);
7803 mkdir ($axmud::DATA_DIR . '/custom', 0755);
7804 mkdir ($axmud::DATA_DIR . '/data', 0755);
7805 mkdir ($axmud::DATA_DIR . '/data/worlds', 0755);
7806 # (Temp directory for use by Axmud code only)
7807 mkdir ($axmud::DATA_DIR . '/data/temp', 0755);
7808 mkdir ($axmud::DATA_DIR . '/logos', 0755);
7809 mkdir ($axmud::DATA_DIR . '/logs', 0755);
7810 mkdir ($axmud::DATA_DIR . '/logs/standard', 0755);
7811 mkdir ($axmud::DATA_DIR . '/msp', 0755);
7812 mkdir ($axmud::DATA_DIR . '/mxp', 0755);
7813 mkdir ($axmud::DATA_DIR . '/plugins', 0755);
7814 mkdir ($axmud::DATA_DIR . '/plugins/help', 0755);
7815 mkdir ($axmud::DATA_DIR . '/plugins/help/cmd', 0755);
7816 mkdir ($axmud::DATA_DIR . '/plugins/help/task', 0755);
7817 mkdir ($axmud::DATA_DIR . '/screenshots', 0755);
7818 mkdir ($axmud::DATA_DIR . '/scripts', 0755);
7819 mkdir ($axmud::DATA_DIR . '/sounds', 0755);
7820 mkdir ($axmud::DATA_DIR . '/store', 0755);
7821 # (Temp directory for use by plugins)
7822 mkdir ($axmud::DATA_DIR . '/tmp', 0755);
7823  
7824 # Make sure the data directory's README file is in place
7825 File::Copy::copy($axmud::SHARE_DIR . '/items/readme/README', $axmud::DATA_DIR);
7826  
7827 return 1;
7828 }
7829  
7830 sub fillDataDirs {
7831  
7832 # Called by GA::Obj::File->setupConfigFile when a new 'config' file is created
7833 # Copies data from Axmud's base sub-directories (default sound effects, icons, etc) into its
7834 # data directories; when the user wants to mess with files, they can modify the files in
7835 # the data directories - not the default copies in Axmud's base directory
7836 #
7837 # Expected arguments
7838 # (none besides $self)
7839 #
7840 # Optional arguments
7841 # $type - The type of files to copy - 'scripts' or 'sounds'. If 'undef', both
7842 # of these files are copied
7843 # $replaceFlag - If set to TRUE, a default file in Axmud's base sub-directories
7844 # replaces the corresponding one in the data directories. If FALSE (or
7845 # 'undef'), only files that are missing in the data directories are
7846 # copied
7847 #
7848 # Return values
7849 # 'undef' on improper arguments
7850 # 1 on success
7851  
7852 my ($self, $type, $replaceFlag, $check) = @_;
7853  
7854 # Local variables
7855 my (
7856 $dir, $dirHandle,
7857 @fileList,
7858 );
7859  
7860 # Check for improper arguments
7861 if (defined $check) {
7862  
7863 return $axmud::CLIENT->writeImproper($self->_objClass . '->fillDataDirs', @_);
7864 }
7865  
7866 # Copy scripts
7867 if (! defined $type || $type eq 'scripts') {
7868  
7869 $dir = $axmud::SHARE_DIR . '/items/scripts';
7870 if (-e $dir) {
7871  
7872 # Open the directory for reading
7873 opendir($dirHandle, $dir);
7874  
7875 # Get a list of files in the directory
7876 @fileList = ();
7877 while (my $file = readdir($dirHandle)) {
7878  
7879 push (@fileList, $file);
7880 }
7881  
7882 # Close the directory handle
7883 closedir($dirHandle);
7884  
7885 # Copy each file into the equivalent data directory
7886 foreach my $file (@fileList) {
7887  
7888 my ($originalPath, $copyPath);
7889  
7890 $originalPath = $dir . '/' . $file;
7891 $copyPath = $axmud::DATA_DIR . '/scripts/' . $file;
7892  
7893 # Copy the file if $replaceFlag forces us to, or if a file with the same path as
7894 # $newPath doesn't already exist
7895 if ($replaceFlag || ! (-e $copyPath)) {
7896  
7897 File::Copy::copy($originalPath, $copyPath);
7898 }
7899 }
7900 }
7901 }
7902  
7903 # Copy sounds
7904 if (! defined $type || $type eq 'sounds') {
7905  
7906 $dir = $axmud::SHARE_DIR . '/items/sounds';
7907 if (-e $dir) {
7908  
7909 # Open the directory for reading
7910 opendir($dirHandle, $dir);
7911  
7912 # Get a list of files in the directory
7913 @fileList = ();
7914 while (my $file = readdir($dirHandle)) {
7915  
7916 push (@fileList, $file);
7917 }
7918  
7919 # Close the directory handle
7920 closedir($dirHandle);
7921  
7922 # Copy each file into the equivalent data directory
7923 foreach my $file (@fileList) {
7924  
7925 my ($originalPath, $copyPath);
7926  
7927 $originalPath = $dir . '/' . $file;
7928 $copyPath = $axmud::DATA_DIR . '/sounds/' . $file;
7929  
7930 # Copy the file if $replaceFlag forces us to, or if a file with the same path as
7931 # $newPath doesn't already exist
7932 if ($replaceFlag || ! (-e $copyPath)) {
7933  
7934 File::Copy::copy($originalPath, $copyPath);
7935 }
7936 }
7937 }
7938 }
7939  
7940 return 1;
7941 }
7942  
7943 sub createStandardZonemaps {
7944  
7945 # Called by $self->start
7946 # Makes sure the standard GA::Obj::Zonemap objects specified by $self->constZonemapHash
7947 # (e.g. 'basic', 'widescreen') exist and, if not, create them
7948 #
7949 # Expected arguments
7950 # (none besides $self)
7951 #
7952 # Return values
7953 # 'undef' on improper arguments or if one of the standard zonemaps doesn't exist and
7954 # can't be created
7955 # 1 otherwise
7956  
7957 my ($self, $check) = @_;
7958  
7959 # Local variables
7960 my (
7961 $modFlag,
7962 %constHash,
7963 );
7964  
7965 # Check for improper arguments
7966 if (defined $check) {
7967  
7968 return $axmud::CLIENT->writeImproper($self->_objClass . '->createStandardZonemaps', @_);
7969 }
7970  
7971 # Import the hash of standard zonemaps (for convenience)
7972 %constHash = $self->constZonemapHash;
7973  
7974 # First create zonemaps that aren't clones
7975 foreach my $zonemapName (keys %constHash) {
7976  
7977 my $zonemapObj;
7978  
7979 # If this standard zonemap hasn't already been created, and doesn't need to be cloned...
7980 if (
7981 ! $self->ivExists('zonemapHash', $zonemapName)
7982 && ! $constHash{$zonemapName}
7983 ) {
7984 # ...then create it
7985 $zonemapObj = Games::Axmud::Obj::Zonemap->new($zonemapName);
7986 if (! $zonemapObj) {
7987  
7988 return $self->writeError(
7989 'Cannot set up the standard \'' . $zonemapName . '\' zonemap',
7990 $self->_objClass . '->createStandardZonemaps',
7991 );
7992  
7993 } else {
7994  
7995 # Add the zonemap to the client's registries
7996 $self->ivAdd('zonemapHash', $zonemapObj->name, $zonemapObj);
7997 $self->ivAdd('standardZonemapHash', $zonemapObj->name, $zonemapObj);
7998  
7999 $modFlag = TRUE;
8000 }
8001 }
8002 }
8003  
8004 # Now create zonemaps that are clones (of zonemap objects we've already created)
8005 foreach my $cloneName (keys %constHash) {
8006  
8007 my ($originalName, $originalObj, $cloneObj);
8008  
8009 $originalName = $constHash{$cloneName};
8010 if ($originalName) {
8011  
8012 $originalObj = $self->ivShow('zonemapHash', $originalName);
8013 }
8014  
8015 # If this standard zonemap hasn't already been created, and does need to be cloned, and
8016 # the original now exists...
8017 if (
8018 $originalObj
8019 && ! $self->ivExists('zonemapHash', $cloneName)
8020 ) {
8021 # ...then create it
8022 $cloneObj = $originalObj->clone($cloneName);
8023 if (! $cloneObj) {
8024  
8025 return $self->writeError(
8026 'Cannot set up the standard \'' . $cloneName . '\' zonemap',
8027 $self->_objClass . '->createStandardZonemaps',
8028 );
8029  
8030 } else {
8031  
8032 # Add the zonemap to the client's registries
8033 $self->ivAdd('zonemapHash', $cloneObj->name, $cloneObj);
8034 $self->ivAdd('standardZonemapHash', $cloneObj->name, $cloneObj);
8035 $modFlag = TRUE;
8036  
8037 # The clone differs from the original in that its zone models should allow
8038 # multiple layers, except for models reserved for 'main' windows
8039 # Apply that change now
8040 $cloneObj->modifyStandardZonemap();
8041 }
8042 }
8043 }
8044  
8045 if ($modFlag) {
8046  
8047 # The data stored in these IVs are saved in the 'zonemaps' file
8048 $self->setModifyFlag('zonemaps', TRUE, $self->_objClass . '->createStandardZonemaps');
8049 }
8050  
8051 return 1;
8052 }
8053  
8054 sub createTempZonemap {
8055  
8056 # Called by GA::Session->processMxpFrameElement
8057 # Creates a 'temporary' zonemap (one that is never saved, and which is destroyed when the
8058 # calling session closes, and which can only be used with the calling session)
8059 #
8060 # Expected arguments
8061 # $session - The calling GA::Session
8062 #
8063 # Return values
8064 # 'undef' on improper arguments or if there's an error
8065 # Otherwise returns the new GA::Obj::Zonemap object
8066  
8067 my ($self, $session, $check) = @_;
8068  
8069 # Local variables
8070 my ($count, $name, $zonemapObj, $modelObj);
8071  
8072 # Check for improper arguments
8073 if (! defined $session || defined $check) {
8074  
8075 return $axmud::CLIENT->writeImproper($self->_objClass . '->createTempZonemap', @_);
8076 }
8077  
8078 # Create a zonemap called 'temp_n', where 'n' is the first available integer number
8079 $count = 0;
8080 do {
8081  
8082 $count++;
8083 if (! $self->ivExists('zonemapHash', 'temp_' . $count)) {
8084  
8085 $name = 'temp_' . $count;
8086 }
8087  
8088 } until ($name);
8089  
8090 # Unlikely in the extreme that we'll ever use a trillion zonemaps, but let's check anyway
8091 if (! $self->nameCheck($name, 16)) {
8092  
8093 return undef;
8094 }
8095  
8096 # Create the temporary zonemap
8097 $zonemapObj = Games::Axmud::Obj::Zonemap->new($name, TRUE, $session);
8098 if (! $zonemapObj) {
8099  
8100 return undef;
8101 }
8102  
8103 # Add the zonemap to the client's registries
8104 $self->ivAdd('zonemapHash', $zonemapObj->name, $zonemapObj);
8105  
8106 # Add a single zone model, covering the whole of the zonemap's internal grid
8107 $modelObj = Games::Axmud::Obj::ZoneModel->new($zonemapObj);
8108 $modelObj->{left} = 0;
8109 $modelObj->{right} = 59;
8110 $modelObj->{top} = 0;
8111 $modelObj->{bottom} = 59;
8112 $modelObj->{width} = 60;
8113 $modelObj->{height} = 60;
8114 $zonemapObj->addZoneModel($modelObj);
8115  
8116 return $zonemapObj;
8117 }
8118  
8119 sub checkCurrentZonemap {
8120  
8121 # Called by GA::EditWin::ZoneModel and GA::Cmd::ModifyZoneModel->do
8122 # Checks whether the specified zonemap is being used by any workspace grid (a
8123 # GA::Obj::WorkspaceGrid object), because a zonemap in use cannot be modified
8124 #
8125 # Expected arguments
8126 # $zonemap - The name of the zonemap to check
8127 #
8128 # Return values
8129 # 'undef' in improper arguments or if $zonemap isn't in use by any workspace grid
8130 # 1 if $zonemap is in use by any workspace grid
8131  
8132 my ($self, $zonemap, $check) = @_;
8133  
8134 # Check for improper arguments
8135 if (! defined $zonemap || defined $check) {
8136  
8137 return $axmud::CLIENT->writeImproper($self->_objClass . '->checkCurrentZonemap', @_);
8138 }
8139  
8140 foreach my $workspaceGridObj ($self->desktopObj->ivValues('gridHash')) {
8141  
8142 if ($workspaceGridObj->zonemap && $workspaceGridObj->zonemap eq $zonemap) {
8143  
8144 return 1;
8145 }
8146 }
8147  
8148 # $zonemap isn't in use by any workspace grid
8149 return undef;
8150 }
8151  
8152 sub createStandardWinmaps {
8153  
8154 # Called by $self->start
8155 # Makes sure the standard GA::Obj::Winmap objects specified by
8156 # $self->constWinmapNameHash (e.g. 'main_fill', 'entry_empty') exist and, if not, create
8157 # them
8158 #
8159 # Expected arguments
8160 # (none besides $self)
8161 #
8162 # Return values
8163 # 'undef' on improper arguments or if one of the standard winmaps doesn't exist and can't
8164 # be created
8165 # 1 otherwise
8166  
8167 my ($self, $check) = @_;
8168  
8169 # Local variables
8170 my $modFlag;
8171  
8172 # Check for improper arguments
8173 if (defined $check) {
8174  
8175 return $axmud::CLIENT->writeImproper($self->_objClass . '->createStandardWinmaps', @_);
8176 }
8177  
8178 foreach my $winmapName ($self->ivKeys('constWinmapNameHash')) {
8179  
8180 my $winmapObj;
8181  
8182 # If this standard winmap hasn't already been created...
8183 if (! $self->ivExists('winmapHash', $winmapName)) {
8184  
8185 # ...then create it
8186 $winmapObj = Games::Axmud::Obj::Winmap->new($winmapName);
8187 if (! $winmapObj) {
8188  
8189 return $self->writeError(
8190 'Cannot set up the standard \'' . $winmapName . '\' winmap',
8191 $self->_objClass . '->createStandardWinmaps',
8192 );
8193  
8194 } else {
8195  
8196 # Add the winmap to the client's registries
8197 $self->ivAdd('winmapHash', $winmapObj->name, $winmapObj);
8198 $self->ivAdd('standardWinmapHash', $winmapObj->name, $winmapObj);
8199  
8200 $modFlag = TRUE;
8201 }
8202 }
8203 }
8204  
8205 if ($modFlag) {
8206  
8207 # The data stored in these IVs are saved in the 'winmaps' file
8208 $self->setModifyFlag('winmaps', TRUE, $self->_objClass . '->createStandardWinmaps');
8209 }
8210  
8211 return 1;
8212 }
8213  
8214 sub createStandardColourSchemes {
8215  
8216 # Called by $self->start
8217 # Makes sure the standard GA::Obj::ColourScheme objects (whose names matches a type of
8218 # 'grid' or 'free' window) exist and, if not, create them
8219 #
8220 # Expected arguments
8221 # (none besides $self)
8222 #
8223 # Return values
8224 # 'undef' on improper arguments or if one of the standard zonemaps doesn't exist and
8225 # can't be created
8226 # 1 otherwise
8227  
8228 my ($self, $check) = @_;
8229  
8230 # Local variables
8231 my (
8232 $modFlag,
8233 @list,
8234 );
8235  
8236 # Check for improper arguments
8237 if (defined $check) {
8238  
8239 return $axmud::CLIENT->writeImproper(
8240 $self->_objClass . '->createStandardColourSchemes',
8241 @_,
8242 );
8243 }
8244  
8245 push (@list, $self->ivKeys('constGridWinTypeHash'), $self->ivKeys('constFreeWinTypeHash'));
8246  
8247 foreach my $winType (@list) {
8248  
8249 if (! $self->ivExists('colourSchemeHash', $winType)) {
8250  
8251 # Doesn't exist, so create it
8252 my $obj = Games::Axmud::Obj::ColourScheme->new($winType);
8253 if (! $obj) {
8254  
8255 return $self->writeError(
8256 'Cannot set up the standard \'' . $winType . '\' colour scheme',
8257 $self->_objClass . '->createStandardColourSchemes',
8258 );
8259  
8260 } else {
8261  
8262 # Add the colour scheme to the client's registry
8263 $self->ivAdd('colourSchemeHash', $obj->name, $obj);
8264 $modFlag = TRUE;
8265 }
8266 }
8267 }
8268  
8269 if ($modFlag) {
8270  
8271 # The data stored in these IVs are saved in the 'winmaps' file
8272 $self->setModifyFlag(
8273 'winmaps',
8274 TRUE,
8275 $self->_objClass . '->createStandardColourSchemes',
8276 );
8277 }
8278  
8279 return 1;
8280 }
8281  
8282 sub createSupportedMcpPackages {
8283  
8284 # Called by $self->start
8285 # Creates MCP package objects (inheriting from Games::Axmud::Generic::Mcp) for all
8286 # MCP packages supported by Axmud (before any initial plugins have defined new ones)
8287 #
8288 # Expected arguments
8289 # (none besides $self)
8290 #
8291 # Return values
8292 # 'undef' on improper arguments or if one of the supported MCP package objects can't be
8293 # created
8294 # 1 otherwise
8295  
8296 my ($self, $check) = @_;
8297  
8298 # Local variables
8299 my @list;
8300  
8301 # Check for improper arguments
8302 if (defined $check) {
8303  
8304 return $axmud::CLIENT->writeImproper(
8305 $self->_objClass . '->createSupportedMcpPackages',
8306 @_,
8307 );
8308 }
8309  
8310 @list = $self->constMcpPackageList;
8311 if (! @list) {
8312  
8313 # No supported packages to add
8314 return 1;
8315 }
8316  
8317 # Create an MCP package object for each supported package
8318 do {
8319  
8320 my ($name, $perlPackage, $min, $max, $obj);
8321  
8322 $name = shift @list;
8323 $perlPackage = shift @list;
8324 $min = shift @list;
8325 $max = shift @list;
8326  
8327 # Obviously we, the authors, aren't going to create duplicate packages, but there's no
8328 # harm in checking
8329 if ($self->ivExists('mcpPackageHash', $name)) {
8330  
8331 return $self->writeError(
8332 'Duplicate supported MCP package \'' . $name . '\'',
8333 $self->_objClass . '->createSupportedMcpPackages',
8334 );
8335 }
8336  
8337 # Create the MCP package object
8338 $obj = $perlPackage->new($name, $min, $max);
8339 if (! $obj) {
8340  
8341 return $self->writeError(
8342 'Cannot set up supported MCP package \'' . $name . '\'',
8343 $self->_objClass . '->createSupportedMcpPackages',
8344 );
8345  
8346 } else {
8347  
8348 $self->ivAdd('mcpPackageHash', $name, $obj);
8349 }
8350  
8351 } until (! @list);
8352  
8353 return 1;
8354 }
8355  
8356 sub setupKeycodes {
8357  
8358 # Called by $self->start
8359 # Sets up keycodes for the current system by populating $self->keycodeHash and
8360 # $self->revKeycodeHash
8361 #
8362 # Expected arguments
8363 # (none besides $self)
8364 #
8365 # Return values
8366 # 'undef' on improper arguments
8367 # 1 otherwise
8368  
8369 my ($self, $check) = @_;
8370  
8371 # Check for improper arguments
8372 if (defined $check) {
8373  
8374 return $axmud::CLIENT->writeImproper($self->_objClass . '->setupKeycodes', @_);
8375 }
8376  
8377 $self->ivPoke('keycodeHash', $self->constKeycodeHash);
8378 if ($^O eq 'MSWin32') {
8379  
8380 foreach my $key ($self->ivKeys('constMSWinKeycodeHash')) {
8381  
8382 $self->ivAdd('keycodeHash', $key, $self->ivShow('constMSWinKeycodeHash', $key));
8383 }
8384  
8385 } elsif ($^O =~ m/bsd/i) {
8386  
8387 foreach my $key ($self->ivKeys('constBSDKeycodeHash')) {
8388  
8389 $self->ivAdd('keycodeHash', $key, $self->ivShow('constBSDKeycodeHash', $key));
8390 }
8391 }
8392  
8393 foreach my $standard ($self->ivKeys('keycodeHash')) {
8394  
8395 my (
8396 $string,
8397 @list,
8398 );
8399  
8400 $string = $self->ivShow('keycodeHash', $standard);
8401  
8402 # $string is a single standard keycode, e.g. 'kp_0', or a set of standard keycodes
8403 # separated by whitespace, e.g. 'up kp_up'
8404 @list = split(/\s+/, $string);
8405  
8406 foreach my $item (@list) {
8407  
8408 $self->ivAdd('revKeycodeHash', $item, $standard);
8409 }
8410 }
8411  
8412 return 1;
8413 }
8414  
8415 sub copyPreConfigWorld {
8416  
8417 # Called by GA::Obj::File->setupConfigFile when a new 'config' file is created
8418 # Also called by $self->insertPreConfigWorlds when the user is using a newer version of
8419 # Axmud
8420 #
8421 # Copies a pre-configured world profile from Axmud's base sub-directories into its data
8422 # directories
8423 # If called by ->setupConfigFile, creates a dummy entry in $self->worldProfHash, ready for
8424 # the file object to create a 'config' file that includes the pre-configured worlds
8425 # If called by ->insertPreConfigWorlds, doesn't create a dummy entry, but otherwise the
8426 # operation is identical
8427 #
8428 # If, by any chance, Axmud's data directories already contain a world profile with the same
8429 # name, don't replace them (but still update $self->worldProfHash)
8430 #
8431 # Expected arguments
8432 # $world - The name of the pre-configured world profile
8433 #
8434 # Optional arguments
8435 # $setupFlag - TRUE if called by GA::Obj::File->setupConfigFile; FALSE (or 'undef') if
8436 # called by anything else
8437 #
8438 # Return values
8439 # 'undef' on improper arguments or if there's a serious error (meaning that no further
8440 # pre-configured worlds can be copied)
8441 # Otherwise returns a string: 'success' if the pre-configured world is succesfully
8442 # copied, 'fail' if the world can't be copied (but it's safe to continue copying
8443 # other worlds)
8444  
8445 my ($self, $world, $setupFlag, $check) = @_;
8446  
8447 # Local variables
8448 my (
8449 $importPath, $extractObj, $tempDir, $newDir, $origLogo, $newLogo, $hashRef, $fileObj,
8450 @fileList,
8451 %fileHash, %loadHash, %dictHash,
8452 );
8453  
8454 # Check for improper arguments
8455 if (! defined $world || defined $check) {
8456  
8457 return $axmud::CLIENT->writeImproper($self->_objClass . '->copyPreConfigWorld', @_);
8458 }
8459  
8460 # Pre-configured world test mode: When preparing for a release, the authors set this flag to
8461 # TRUE to stop Axmud complaining about missing pre-configured worlds
8462 if ($axmud::TEST_PRE_CONFIG_FLAG) {
8463  
8464 return 'success';
8465 }
8466  
8467 # If a directory for the pre-configured world exists and a data directory for a world with
8468 # the same name doesn't exist...
8469 if (
8470 -e $axmud::SHARE_DIR . '/items/worlds/' . $world
8471 && ! (-e $axmud::DATA_DIR . '/data/worlds/' . $world)
8472 ) {
8473 # Copy the pre-configured worlds into the data directories (code adapted from
8474 # GA::Cmd::ImportFiles->do)
8475 $importPath = $axmud::SHARE_DIR . '/items/worlds/' . $world . '/' . $world . '.tgz';
8476 if (! -e $importPath) {
8477  
8478 $self->writeWarning(
8479 'General error importing pre-configured worlds (archive missing for \''
8480 . $world . '\' world)',
8481 $self->_objClass . '->copyPreConfigWorld',
8482 );
8483  
8484 return 'fail';
8485 }
8486  
8487 # Build an Archive::Extract object
8488 $extractObj = Archive::Extract->new(archive => $importPath);
8489 if (! $extractObj) {
8490  
8491 return $self->writeError(
8492 'General error importing pre-configured worlds (archive error)',
8493 $self->_objClass . '->copyPreConfigWorld',
8494 );
8495 }
8496  
8497 # Extract the object to a temporary directory (if it doesn't already exist, create it)
8498 $tempDir = $axmud::DATA_DIR . '/data/temp/import';
8499 if (! $extractObj->extract(to => $tempDir)) {
8500  
8501 return $self->writeError(
8502 'General error importing pre-configured worlds (extraction error)',
8503 $self->_objClass . '->copyPreConfigWorld',
8504 );
8505 }
8506  
8507 # All the files are now in /data/temp/import. Get a list of paths, relative to $tempDir,
8508 # of all the extracted files
8509 @fileList = @{$extractObj->files}; # e.g. export/tasks.axm
8510 # Convert all the paths into absolute paths. Check they are real Axmud files and, if so,
8511 # store them in a hash
8512 foreach my $file (@fileList) {
8513  
8514 my (
8515 $fileType, $filePath,
8516 %headerHash,
8517 );
8518  
8519 $filePath = $tempDir . '/' . $file;
8520  
8521 %headerHash = Games::Axmud::Obj::File->examineDataFile($filePath, 'return_header');
8522 if (! %headerHash) {
8523  
8524 $self->writeWarning(
8525 'General error importing pre-configured worlds (archive contains invalid'
8526 . ' file)',
8527 $self->_objClass . '->copyPreConfigWorld',
8528 );
8529  
8530 return 'fail';
8531  
8532 } else {
8533  
8534 $fileType = $headerHash{'file_type'};
8535 $fileHash{$fileType} = $filePath;
8536 }
8537 }
8538  
8539 # Now we can check that we have the right three files ('worldprof', 'otherprof' and
8540 # 'worldmodel')
8541 if (
8542 ! exists $fileHash{'worldprof'}
8543 || ! exists $fileHash{'otherprof'}
8544 || ! exists $fileHash{'worldmodel'}
8545 || scalar (keys %fileHash) != 3
8546 ) {
8547 $self->writeWarning(
8548 'General error importing pre-configured worlds (incorrect archive for \''
8549 . $world . '\' world)',
8550 $self->_objClass . '->copyPreConfigWorld',
8551 );
8552  
8553 return 'fail';
8554 }
8555  
8556 # Create the data sub-directory
8557 $newDir = $axmud::DATA_DIR . '/data/worlds/' . $world . '/';
8558 if (! mkdir ($newDir, 0755)) {
8559  
8560 $self->writeWarning(
8561 'General error importing pre-configured worlds (could not copy files)',
8562 $self->_objClass . '->copyPreConfigWorld',
8563 );
8564  
8565 return 'fail';
8566 }
8567  
8568 # Copy the files into the sub-directory
8569 foreach my $file (keys %fileHash) {
8570  
8571 my $filePath = $fileHash{$file};
8572  
8573 if (! File::Copy::copy($filePath, $newDir . $file . '.axm')) {
8574  
8575 # Give up importing this pre-configured world; destroy its data sub-directory
8576 File::Path::remove_tree($newDir);
8577  
8578 $self->writeWarning(
8579 'General error importing pre-configured worlds (could not copy files)',
8580 $self->_objClass . '->copyPreConfigWorld',
8581 );
8582  
8583 return 'fail';
8584 }
8585 }
8586  
8587 # When this function was called by GA::Obj::File->setupConfigFile, add a dummy entry to
8588 # the this object's profile registry so the calling function,
8589 # GA::Obj::File->setupConfigFile, can add the world to the 'config' file it's about to
8590 # create (the dummy entry will be removed by that function)
8591 if ($setupFlag) {
8592  
8593 $self->ivAdd('worldProfHash', $world, undef);
8594 }
8595  
8596 # If a logo for this world exists, and if the equivalent logo doesn't exist in the data
8597 # directory, copy it
8598 $origLogo = $axmud::SHARE_DIR . '/items/worlds/' . $world . '/' . $world . '.png';
8599 $newLogo = $axmud::DATA_DIR . '/logos/' . $world . '.png';
8600  
8601 if (-e $origLogo && ! (-e $newLogo)) {
8602  
8603 File::Copy::copy($origLogo, $newLogo);
8604 }
8605  
8606 # Now, try to import the corresponding file containing the world's dictionary
8607 $importPath = $axmud::SHARE_DIR . '/items/worlds/' . $world . '/' . $world . '.amx';
8608 if (! -e $importPath) {
8609  
8610 # Pre-configured dictionary archive missing; so move on to the next world
8611 $self->writeWarning(
8612 'General error importing pre-configured worlds (dictionary archive not found)',
8613 $self->_objClass . '->copyPreConfigWorld',
8614 );
8615  
8616 return 'fail';
8617 }
8618  
8619 # We can't call GA::Obj::File->importDataFile because it expects a GA::Session as an
8620 # argument
8621 # Instead, we'll use a modified version of ->importDataFile and ->extractData
8622  
8623 # Load all the data into an anonymous hash
8624 eval { $hashRef = Storable::lock_retrieve($importPath); };
8625 if (! $hashRef) {
8626  
8627 return $self->writeError(
8628 'General error importing pre-configured worlds (lockfile error)',
8629 $self->_objClass . '->copyPreConfigWorld',
8630 );
8631 }
8632  
8633 # Convert the anonymous hash referenced by $hashRef into a named hash
8634 %loadHash = %{$hashRef};
8635  
8636 # Before v1.0.868, Axmud had a different name. Update all header data
8637 if (
8638 defined $loadHash{'script_version'}
8639 && $self->convertVersion($loadHash{'script_version'}) < 1_000_868
8640 ) {
8641 %loadHash = Games::Axmud::Obj::File->updateHeaderAfterRename(%loadHash);
8642 }
8643  
8644 if (
8645 # Check the header is valid
8646 ! defined $loadHash{'file_type'} || ! defined $loadHash{'script_name'}
8647 || ! defined $loadHash{'script_version'} || ! defined $loadHash{'save_date'}
8648 || ! defined $loadHash{'save_time'} || ! exists $loadHash{'assoc_world_prof'}
8649 # Check it's the right kind of file
8650 || $loadHash{'file_type'} ne 'dicts'
8651 # Check the file was created by a compatible programme
8652 || ! Games::Axmud::Obj::File->checkCompatibility($loadHash{'script_name'})
8653 ) {
8654 $self->writeWarning(
8655 'General error importing pre-configured worlds (dictionary archive invalid)',
8656 $self->_objClass . '->copyPreConfigWorld',
8657 );
8658  
8659 return 'fail';
8660 }
8661  
8662 # Import the dictionary objects stored in the file
8663 %dictHash = %{$loadHash{'dict_hash'}};
8664 if (%dictHash) {
8665  
8666 foreach my $dictObj (values %dictHash) {
8667  
8668 # Before v1.0.868, Axmud had a different name. Update the dictionary object
8669 $dictObj = Games::Axmud::Obj::File->update_obj_dict($dictObj);
8670  
8671 $self->ivAdd('dictHash', $dictObj->name, $dictObj);
8672 }
8673  
8674 # The data stored in this IV is saved in the 'dicts' file
8675 $self->setModifyFlag('dicts', TRUE, $self->_objClass . '->copyPreConfigWorld');
8676 # Because dictionary objects may contain new IVs (or other changes), we need to call
8677 # the file object's ->updateExtractedData (this happens elsewhere, for the
8678 # 'worldprof', 'otherprof' and 'worldmodel' files, but for the 'dicts' file, we
8679 # must do it now)
8680 $fileObj = $self->ivShow('fileObjHash', 'dicts');
8681 $fileObj->updateExtractedData(
8682 $self->convertVersion($loadHash{'script_version'}),
8683 );
8684 }
8685 }
8686  
8687 # Operation complete
8688 return 'success';
8689 }
8690  
8691 sub cleanPreConfigWorlds {
8692  
8693 # Called by GA::Obj::File->setupConfigFile after a call to $self->copyPreConfigWorlds, which
8694 # added a number of dummy entries to $self->worldProfHash
8695 # Removes the dummy entries, adding new entries in $self->configWorldProfList (as if the
8696 # config file had been read, not created)
8697 #
8698 # Expected arguments
8699 # (none besides $self)
8700 #
8701 # Return values
8702 # 'undef' on improper arguments
8703 # 1 otherwise
8704  
8705 my ($self, $check) = @_;
8706  
8707 # Check for improper arguments
8708 if (defined $check) {
8709  
8710 return $axmud::CLIENT->writeImproper($self->_objClass . '->cleanPreConfigWorlds', @_);
8711 }
8712  
8713 foreach my $world ($self->ivKeys('worldProfHash')) {
8714  
8715 my $worldObj = $self->ivShow('worldProfHash', $world);
8716  
8717 if (! defined $worldObj) {
8718  
8719 $self->ivDelete('worldProfHash', $world);
8720 $self->ivPush('configWorldProfList', $world);
8721 }
8722 }
8723  
8724 return 1;
8725 }
8726  
8727 sub insertPreConfigWorlds {
8728  
8729 # Called by $self->start when the user is using a new version of Axmud
8730 # Checks whether any pre-configured worlds have been added since the version of Axmud last
8731 # used by the user (i.e. the version that created the Axmud data directory we're using)
8732 # If any are found, inserts them into Axmud's data directory
8733 #
8734 # Expected arguments
8735 # (none besides $self)
8736 #
8737 # Return values
8738 # 'undef' on improper arguments or if there's a serious error (after which, this function
8739 # gives up inserting pre-configured worlds)
8740 # 1 on success or if there are only minor errors (this function continued trying to
8741 # insert pre-configured worlds after the minor error)
8742  
8743 my ($self, $check) = @_;
8744  
8745 # Local variables
8746 my (
8747 $prevVersion,
8748 %alreadyHash,
8749 );
8750  
8751 # Check for improper arguments
8752 if (defined $check) {
8753  
8754 return $axmud::CLIENT->writeImproper($self->_objClass . '->insertPreConfigWorlds', @_);
8755 }
8756  
8757 # Convert version, e.g. '1.1.0' to '1_001_000'
8758 $prevVersion = $self->convertVersion($self->prevClientVersion);
8759 # Compile a hash of world profiles which (should) already exist (none of which have been
8760 # loaded by $self->start yet)
8761 foreach my $world ($self->configWorldProfList) {
8762  
8763 $alreadyHash{$world} = undef;
8764 }
8765  
8766 # Only insert pre-configured worlds that are newer than the version of Axmud the user was
8767 # using last time
8768 # Also don't import a pre-configured world if a world profile with the same name (created by
8769 # the user) already exists
8770 foreach my $world ($self->constWorldList) {
8771  
8772 my ($worldVersion, $result);
8773  
8774 if (! exists $alreadyHash{$world} && $self->ivExists('constWorldHash', $world)) {
8775  
8776 $worldVersion = $self->convertVersion($self->ivShow('constWorldHash', $world));
8777  
8778 if ($worldVersion > $prevVersion) {
8779  
8780 $result = $self->copyPreConfigWorld($world);
8781 if (! defined $result) {
8782  
8783 # Serious error. Give up inserting pre-configured worlds
8784 return undef;
8785  
8786 } elsif ($result = 'success') {
8787  
8788 # No minor error reported, so tell the calling function to load this world
8789 # profile
8790 $self->ivPush('configWorldProfList', $world);
8791 }
8792 }
8793 }
8794 }
8795  
8796 return 1;
8797 }
8798  
8799 sub loadWorldProfs {
8800  
8801 # Called by $self->start
8802 # $self->configWorldProfList contains a list of world profile names stored in the 'config'
8803 # file. This function loads each of those profiles into memory
8804 #
8805 # Expected arguments
8806 # (none besides $self)
8807 #
8808 # Return values
8809 # 'undef' on improper arguments or if any of the expected world profiles can't be loaded
8810 # (when that happens, this function continues trying to load world profiles before
8811 # returning 'undef')
8812 # 1 on success
8813  
8814 my ($self, $check) = @_;
8815  
8816 # Local variables
8817 my ($worldDir, $failFlag);
8818  
8819 # Check for improper arguments
8820 if (defined $check) {
8821  
8822 return $axmud::CLIENT->writeImproper($self->_objClass . '->loadWorldProfs', @_);
8823 }
8824  
8825 # Set the directory in which world profile-related data is stored
8826 $worldDir = $axmud::DATA_DIR . '/data/worlds';
8827  
8828 # Load each profile in turn
8829 foreach my $world ($self->configWorldProfList) {
8830  
8831 my ($old, $new, $fileObj, $dir, $path, $file);
8832  
8833 # Before v1.0.868, worldprof.axm was called worlddefn.amd, and otherprof.axm was called
8834 # otherdefn.amd. If the old files are present, rename them
8835 $old = $worldDir . '/' . $world . '/worlddefn.amd';
8836 if (-e $old) {
8837  
8838 $new = $worldDir . '/' . $world . '/worldprof.axm';
8839 File::Copy::move($old, $new);
8840 }
8841  
8842 $old = $worldDir . '/' . $world . '/otherdefn.amd';
8843 if (-e $old) {
8844  
8845 $new = $worldDir . '/' . $world . '/otherprof.axm';
8846 File::Copy::move($old, $new);
8847 }
8848  
8849 # Create a file object to store the header information, once loaded.
8850 $fileObj = Games::Axmud::Obj::File->new('worldprof', $world);
8851 if (! $fileObj) {
8852  
8853 return $self->writeError(
8854 'Failed to create a file object for the world profile \'' . $world . '\'',
8855 $self->_objClass . '->loadWorldProfs',
8856 );
8857  
8858 } else {
8859  
8860 # Add the file object to its registry
8861 $self->ivAdd('fileObjHash', $fileObj->assocWorldProf, $fileObj);
8862  
8863 # Load the profile file (in overwrite mode - only the world profile itself is
8864 # overwritten)
8865 $dir = $worldDir . '/' . $world;
8866 $file = $fileObj->standardFileName;
8867 $path = $dir . '/' . $fileObj->standardFileName;
8868  
8869 if (! $fileObj->loadDataFile($file, $path, $dir)) {
8870  
8871 # Try loading the automatic backup, i.e. 'worldprof.axm.bu'
8872 if (! $fileObj->loadDataFile($file, $path, $dir, TRUE)) {
8873  
8874 # Continue loading world profiles, but this function will return 'undef'
8875 $failFlag = TRUE;
8876  
8877 } else {
8878  
8879 # The contents of the backup, now loaded into memory, must be saved at some
8880 # point
8881 $fileObj->set_modifyFlag(TRUE);
8882 # Don't overwrite the existing backup file with the faulty one
8883 $fileObj->set_preserveBackupFlag(TRUE);
8884 }
8885 }
8886 }
8887 }
8888  
8889 if ($failFlag) {
8890 return undef;
8891 } else {
8892 return 1;
8893 }
8894 }
8895  
8896 sub getTempProfName {
8897  
8898 # Called by $self->start, GA::Cmd::Telnet->do, GA::Cmd::SSH->do, GA::Cmd::SSL->do or
8899 # GA::OtherWin::Connect->connectWorldCallback
8900 # All sessions require a current world profile with a defined name. For situations in which
8901 # we want to create a temporary world profile that won't be saved - such as when the
8902 # Connections window starts a new connection, but the user hasn't specified a world name -
8903 # this function returns an available world profile name to use
8904 #
8905 # Expected arguments
8906 # (none besides $self)
8907 #
8908 # Return values
8909 # 'undef' on improper arguments or if there are no available world profile names (an
8910 # exceedingly unlikely situation)
8911 # Otherwise, returns an available world profile name
8912  
8913 my ($self, $check) = @_;
8914  
8915 # Check for improper arguments
8916 if (defined $check) {
8917  
8918 return $axmud::CLIENT->writeImproper($self->_objClass . '->getTempProfName', @_);
8919 }
8920  
8921 for (my $count = 1; $count <= 9999; $count++) {
8922  
8923 if (! $self->ivExists('worldProfHash', 'temp_world_' . $count)) {
8924  
8925 return 'temp_world_' . $count;
8926 }
8927 }
8928  
8929 # No temporary profile names available
8930 return undef;
8931 }
8932  
8933 sub loadOtherFiles {
8934  
8935 # Called by $self->start
8936 # Loads data from the files 'tasks', 'scripts', 'contacts', 'dicts', 'toolbar', 'usercmds',
8937 # 'zonemaps', 'winmaps', 'tts')
8938 # Any of the files which don't yet exist are created
8939 #
8940 # Expected arguments
8941 # (none besides $self)
8942 #
8943 # Return values
8944 # 'undef' on improper arguments or if any of the file objects can't be loaded (or created)
8945 # 1 on success
8946  
8947 my ($self, $check) = @_;
8948  
8949 # Local variables
8950 my @list;
8951  
8952 # Check for improper arguments
8953 if (defined $check) {
8954  
8955 return $axmud::CLIENT->writeImproper($self->_objClass . '->loadOtherFiles', @_);
8956 }
8957  
8958 # The list of file types to load
8959 @list = (
8960 'tasks', 'scripts', 'contacts', 'dicts', 'toolbar', 'usercmds', 'zonemaps', 'winmaps',
8961 'tts',
8962 );
8963  
8964 # Create the FileObjs
8965 foreach my $type (@list) {
8966  
8967 my $obj;
8968  
8969 if (! $self->ivExists('fileObjHash', $type)) {
8970  
8971 # The corresponding file object is missing. This should never happen
8972 return undef;
8973  
8974 } else {
8975  
8976 $obj = $self->ivShow('fileObjHash', $type);
8977 # Load the file
8978 if (! $obj->setupDataFile()) {
8979  
8980 # File not loaded (or created)
8981 return undef;
8982 }
8983 }
8984 }
8985  
8986 # All files loaded
8987 return 1;
8988 }
8989  
8990 sub disableAllFileAccess {
8991  
8992 # Called by $self->start, $self->createFileObjs or by any other code
8993 # Disables loading and saving of files across all sessions
8994 #
8995 # Expected arguments
8996 # (none besides $self)
8997 #
8998 # Optional arguments flag
8999 # $noPromptFlag - If set to TRUE, there's no need to prompt the user for an emergency
9000 # save. If set to FALSE (or 'undef'), prompt the user in the normal
9001 # way, if allowed
9002 #
9003 # Return values
9004 # 'undef' on improper arguments
9005 # 1 on success
9006  
9007 my ($self, $noPromptFlag, $check) = @_;
9008  
9009 # Local variables
9010 my $choice;
9011  
9012 # Check for improper arguments
9013 if (defined $check) {
9014  
9015 return $axmud::CLIENT->writeImproper($self->_objClass . '->createFileObjs', @_);
9016 }
9017  
9018 # Disable loading/saving of the 'config' file for the client
9019 $self->ivPoke('loadConfigFlag', FALSE);
9020 $self->ivPoke('saveConfigFlag', FALSE);
9021 # Disable loading/saving of all other data files by all sessions
9022 $self->ivPoke('loadDataFlag', FALSE);
9023 $self->ivPoke('saveDataFlag', FALSE);
9024  
9025 # The data stored in these IVs is saved in the 'config' file (set the modify flag, even
9026 # though the 'config' file can't be saved)
9027 $self->setModifyFlag('config', TRUE, $self->_objClass . '->disableAllFileAccess');
9028  
9029 # Do an emergency save, if allowed
9030 if ($self->emergencySaveFlag && ! $noPromptFlag) {
9031  
9032 if ($self->mainWin) {
9033  
9034 # Ask the user for permission to do an emergency save
9035 $choice = $self->mainWin->showMsgDialogue(
9036 'Emergency save',
9037 'warning',
9038 'File access is about to be disabled. Would you like to do an emergency save?',
9039 'yes-no',
9040 );
9041  
9042 if ($choice eq 'yes') {
9043  
9044 $self->doEmergencySave();
9045 }
9046  
9047 } else {
9048  
9049 # No 'main' window from which to do open 'dialogue' windows, so go ahead and do the
9050 # emergency save
9051 $self->doEmergencySave();
9052 }
9053 }
9054  
9055 return 1;
9056 }
9057  
9058 sub doEmergencySave {
9059  
9060 # Called by $self->disableAllFileAccess, GA::Cmd::EmergencySave->do or by any other code
9061 # Performs an emergency save, saving all file objects to a location specified by the user
9062 # (which is almost always not the usual Axmud data directory)
9063 #
9064 # Expected arguments
9065 # (none besides $self)
9066 #
9067 # Return values
9068 # 'undef' on improper arguments or if the user cancels the operation
9069 # Otherwise, returns the directory in which the files were saved
9070  
9071 my ($self, $check) = @_;
9072  
9073 # Local variables
9074 my ($dir, $msg, $errorCount);
9075  
9076 # Check for improper arguments
9077 if (defined $check) {
9078  
9079 return $axmud::CLIENT->writeImproper($self->_objClass . '->doEmergencySave', @_);
9080 }
9081  
9082 # Prompt the user for a directory in which to save
9083 if ($self->mainWin) {
9084  
9085 $dir = $self->mainWin->showFileChooser(
9086 'Emergency save location',
9087 'select-folder',
9088 );
9089  
9090 if (! $dir) {
9091  
9092 return undef;
9093 }
9094  
9095 # Create a sub-directory in that directory
9096 # e.g. .../axmud_101218_09_17_12
9097 $dir .= '/' . $axmud::NAME_SHORT . '_' . $self->localDateString() . '_'
9098 . $self->localClockString;
9099  
9100 } else {
9101  
9102 # If there is no 'main' window, save into Axmud's base directory as a fallback
9103 $dir = $axmud::SHARE_DIR . '/EMERGENCY_SAVE/' . $axmud::NAME_SHORT . '_'
9104 . $self->localDateString() . '_' . $self->localClockString;
9105 }
9106  
9107 if (! mkdir ($dir, 0755)) {
9108  
9109 $msg = 'Could not create an emergency save directory (folder); you can try again using'
9110 . ' the \';emergencysave\' command';
9111  
9112 if ($self->mainWin) {
9113  
9114 $self->mainWin->showMsgDialogue(
9115 'Emergency save',
9116 'error',
9117 $msg,
9118 'ok',
9119 );
9120  
9121 } else {
9122  
9123 $self->writeError($msg, $self->_objClass . '->doEmergencySave');
9124 }
9125  
9126 return 1;
9127 }
9128  
9129 # Create a further sub-directory for world-specific files
9130 if (! mkdir ($dir . '/worlds', 0755)) {
9131  
9132 $msg = 'Could not create an emergency save directory (folder); you can try again using'
9133 . ' the \';emergencysave\' command.';
9134  
9135 if ($self->mainWin) {
9136  
9137 $self->mainWin->showMsgDialogue(
9138 'Emergency save',
9139 'error',
9140 $msg,
9141 'ok',
9142 );
9143  
9144 } else {
9145  
9146 $self->writeError($msg, $self->_objClass . '->doEmergencySave');
9147 }
9148  
9149 return 1;
9150 }
9151  
9152 # Save file objects stored in this GA::Client
9153 # (NB 'otherprof' or 'worldmodel' files should only be stored in the GA::Session)
9154 $errorCount = 0;
9155  
9156 foreach my $fileObjName ($self->ivKeys('fileObjHash')) {
9157  
9158 my ($fileObj, $thisDir);
9159  
9160 $fileObj = $self->ivShow('fileObjHash', $fileObjName);
9161  
9162 if ($fileObj->fileType eq 'config') {
9163  
9164 if (
9165 ! $fileObj->saveConfigFile(
9166 $fileObj->actualFileName,
9167 $dir . '/' . $fileObj->actualFileName,
9168 $dir,
9169 # The TRUE flag tells the function that an emergency save is in progress
9170 TRUE,
9171 )
9172 ) {
9173 $errorCount++;
9174 }
9175  
9176 } elsif ($fileObj->fileType eq 'worldprof') {
9177  
9178 # ('worldprof' files are stored in their own directory)
9179 $thisDir = $dir . '/worlds/' . $fileObj->assocWorldProf;
9180  
9181 if (
9182 ! $fileObj->saveDataFile(
9183 $fileObj->actualFileName,
9184 $thisDir . '/' . $fileObj->actualFileName,
9185 $thisDir,
9186 # The TRUE flag tells the function that an emergency save is in progress
9187 TRUE,
9188 )
9189 ) {
9190 $errorCount++;
9191 }
9192  
9193 } else {
9194  
9195 if (
9196 ! $fileObj->saveDataFile(
9197 $fileObj->actualFileName,
9198 $dir . '/' . $fileObj->actualFileName,
9199 $dir,
9200 # The TRUE flag tells the function that an emergency save is in
9201 # progress
9202 TRUE,
9203 )
9204 ) {
9205 $errorCount++;
9206 }
9207 }
9208 }
9209  
9210 # Instruct each session to do an emergency save in their own directory
9211 foreach my $thisSession ($self->listSessions()) {
9212  
9213 if (! $thisSession->sessionEmergencySave($dir)) {
9214  
9215 $errorCount++;
9216 }
9217 }
9218  
9219 # Show a confirmation
9220 if ($errorCount) {
9221  
9222 $msg = 'Emergency save complete (sessions saved: '
9223 . $self->ivPairs('sessionHash') . ', errors: ' . $errorCount
9224 . '; you can try again using the' . ' \';emergencysave\' command)';
9225  
9226 if ($self->mainWin) {
9227  
9228 $self->mainWin->showMsgDialogue(
9229 'Emergency save',
9230 'warning',
9231 $msg,
9232 'ok',
9233 );
9234  
9235 } else {
9236  
9237 $self->writeWarning($msg, $self->_objClass . '->doEmergencySave');
9238 }
9239  
9240 } else {
9241  
9242 $msg = 'Emergency save complete (sessions saved: '
9243 . $self->ivPairs('sessionHash') . ')';
9244  
9245 if ($self->mainWin) {
9246  
9247 $self->mainWin->showMsgDialogue(
9248 'Emergency save',
9249 'info',
9250 $msg,
9251 'ok',
9252 );
9253  
9254 } else {
9255  
9256 $self->writeText($msg);
9257 }
9258 }
9259  
9260 # Operation complete
9261 return $dir;
9262 }
9263  
9264 sub setupCmds {
9265  
9266 # Called by $self->start
9267 # Creates a Perl object for each client command, storing them in the registry
9268 # $self->clientCmdHash. (See also the code in $self->addPluginCmds)
9269 #
9270 # Expected arguments
9271 # (none besides $self)
9272 #
9273 # Return values
9274 # 'undef' on improper arguments
9275 # 1 otherwise
9276  
9277 my ($self, $check) = @_;
9278  
9279 # Check for improper arguments
9280 if (defined $check) {
9281  
9282 return $axmud::CLIENT->writeImproper($self->_objClass . '->setupCmds', @_);
9283 }
9284  
9285 foreach my $string ($self->clientCmdPrettyList) {
9286  
9287 my ($package, $obj);
9288  
9289 # $self->clientCmdPrettyList contains a list of client commands, grouped under headings.
9290 # The headings begin with a '@' character
9291 if (substr ($string, 0, 1) ne '@') {
9292  
9293 # Not a heading. Create a Perl object
9294 $package = 'Games::Axmud::Cmd::' . $string;
9295 $obj = $package->new();
9296 if (! $obj) {
9297  
9298 # (Allow writing to something other than GA::Session - there are no sessions
9299 # yet)
9300 return $self->writeError(
9301 'Could not create client command \'' . $self->cmdSep . lc($string) . '\'',
9302 $self->_objClass . '->setupCmds',
9303 );
9304 }
9305  
9306 # Update IVs
9307 $self->ivAdd('clientCmdHash', lc($string), $obj);
9308 $self->ivPush('clientCmdList', lc($string));
9309  
9310 # Set up user commands corresponding to this client command
9311 foreach my $userCmd ($obj->defaultUserCmdList) {
9312  
9313 # Check the user command isn't already in use by another client command
9314 if ($self->ivExists('constUserCmdHash', lc($userCmd))) {
9315  
9316 # (Allow writing to something other than GA::Session - there are no
9317 # sessions yet)
9318 return $self->writeError(
9319 'Duplicate user command \'' . $userCmd . '\' pointing at client'
9320 . ' command \'' . lc($string) . '\'',
9321 $self->_objClass . '->setupCmds',
9322 );
9323  
9324 } else {
9325  
9326 # Add the user command to GA::Client's hash. It's a constant variable (once
9327 # set by this function), so we can't use ->ivAdd
9328 $self->{'constUserCmdHash'}{lc($userCmd)} = lc($string);
9329 }
9330 }
9331  
9332 # The customisable hash of user commands is, for the time being, identical
9333 $self->ivPoke('userCmdHash', $self->constUserCmdHash);
9334 }
9335 }
9336  
9337 # Setup complete
9338 return 1;
9339 }
9340  
9341 sub initialiseToolbar {
9342  
9343 # Called by $self->start and GA::PrefWin::Client->toolbarTab
9344 # Creates a default set of toolbar button objects and updates the IVs $self->toolbarHash
9345 # and ->toolbarList
9346 #
9347 # Expected arguments
9348 # (none besides $self)
9349 #
9350 # Return values
9351 # 'undef' on improper arguments or if there's an error creating a toolbar button object
9352 # 1 otherwise
9353  
9354 my ($self, $check) = @_;
9355  
9356 # Local variables
9357 my @defaultList;
9358  
9359 # Check for improper arguments
9360 if (defined $check) {
9361  
9362 return $axmud::CLIENT->writeImproper($self->_objClass . '->initialiseToolbar', @_);
9363 }
9364  
9365 # Empty the existing IVs
9366 $self->ivEmpty('toolbarHash');
9367 $self->ivEmpty('toolbarList');
9368  
9369 # The items are in groups of 6, one group for each GA::Obj::Toolbar object to be created.
9370 # However, separators are in groups of 1
9371 @defaultList = $self->constToolbarList;
9372 if (@defaultList) {
9373  
9374 do {
9375  
9376 my ($name, $descrip, $iconPath, $instruct, $sessionFlag, $connectFlag);
9377  
9378 if ($defaultList[0] eq 'separator') {
9379  
9380 shift @defaultList,
9381 $self->ivPush('toolbarList', 'separator');
9382  
9383 } else {
9384  
9385 $name = shift @defaultList;
9386 $descrip = shift @defaultList;
9387 $iconPath = shift @defaultList;
9388 $instruct = shift @defaultList;
9389 $sessionFlag = shift @defaultList;
9390 $connectFlag = shift @defaultList;
9391  
9392 # Check that $name and $descrip are valid
9393 if (! $self->nameCheck($name, 16)) {
9394  
9395 $self->writeWarning(
9396 'Invalid default toolbar button name \'' . $name . '\'',
9397 $self->_objClass . '->initialiseToolbar',
9398 );
9399  
9400 } elsif (length ($descrip) > 32) {
9401  
9402 $self->writeWarning(
9403 'Invalid default toolbar button description (button \'' . $name . '\')',
9404 $self->_objClass . '->initialiseToolbar',
9405 );
9406  
9407 } else {
9408  
9409 # Create a new toolbar button object
9410 my $obj = Games::Axmud::Obj::Toolbar->new(
9411 $name,
9412 $descrip,
9413 FALSE, # Default, not custom, toolbar button
9414 $iconPath,
9415 $instruct,
9416 $sessionFlag,
9417 $connectFlag,
9418 );
9419  
9420 if (! $obj) {
9421  
9422 return undef;
9423  
9424 } else {
9425  
9426 $self->ivAdd('toolbarHash', $obj->name, $obj);
9427 $self->ivPush('toolbarList', $obj->name);
9428 }
9429 }
9430 }
9431  
9432 } until (! @defaultList);
9433 }
9434  
9435 return 1;
9436 }
9437  
9438 sub connectBlind {
9439  
9440 # Called by $self->start in Axmud blind mode
9441 # Open a series of standard 'dialogue' windows, allowing the visually-impaired user to
9442 # select a world and/or character
9443 #
9444 # Expected arguments
9445 # (none besides $self)
9446 #
9447 # Return values
9448 # 'undef' on improper arguments
9449 # 1 on success
9450  
9451 my ($self, $check) = @_;
9452  
9453 # Local variables
9454 my (
9455 $newWorldString, $newCharString, $title, $choice, $connectWorld, $connectWorldObj,
9456 $connectHost, $connectPort, $loginMode, $connectChar, $connectPwd, $connectAccount,
9457 $startFlag,
9458 @faveList, @visitedList, @otherList, @comboList, @comboList2, @comboList3,
9459 %worldHash, %nameHash, %checkHash, %loginHash,
9460 );
9461  
9462 # Check for improper arguments
9463 if (defined $check) {
9464  
9465 return $axmud::CLIENT->writeImproper($self->_objClass . '->connectBlind', @_);
9466 }
9467  
9468 # Make sure the test window for finding desktop panels has been removed
9469 $self->desktopObj->updateWidgets($self->_objClass . '->connectBlind');
9470  
9471 # Get a list of worlds, favourite worlds first, then all visited worlds sorted by number
9472 # of visits, finally unvisited worlds sorted alphabetically
9473 # (Code borrowed from GA::OtherWin::Connect->resetTreeView)
9474 $newWorldString = 'Create new world';
9475 $newCharString = 'Create new character';
9476  
9477 # For each world, decide which name to use. Create a hash in the form
9478 # $nameHash{profile_name} = displayed_name
9479 # (where 'displayed_name' is the long name, if available, or the profile name, if not
9480 # At the same time, create a parallel hash to check for duplicate long names, in the form
9481 # $checkHash{long_name} = profile_name
9482 # If duplicate long names are found, 'displayed_name' should include both the long name and
9483 # the profile name
9484 %worldHash = $self->worldProfHash;
9485 foreach my $worldObj (values %worldHash) {
9486  
9487 my ($otherWorld, $otherWorldObj);
9488  
9489 if ($worldObj->longName) {
9490  
9491 if ($worldObj->longName eq $newWorldString) {
9492  
9493 $nameHash{$worldObj->name} = $worldObj->longName . ' (' . $worldObj->name . ')';
9494 $checkHash{$worldObj->longName} = $worldObj->name;
9495  
9496 } elsif (exists $checkHash{$worldObj->longName}) {
9497  
9498 # Amend both entries to include the long name and the profile name
9499 $otherWorld = $checkHash{$worldObj->longName};
9500 $otherWorldObj = $worldHash{$otherWorld};
9501  
9502 $nameHash{$worldObj->name} = $worldObj->longName . ' (' . $worldObj->name . ')';
9503 # (There's already an entry in $checkHash matching ->longName)
9504 $nameHash{$otherWorld}
9505 = $otherWorldObj->longName . ' (' . $otherWorldObj->name . ')';
9506  
9507 } else {
9508  
9509 # Not a duplicate, so just display the long name
9510 $nameHash{$worldObj->name} = $worldObj->longName;
9511 $checkHash{$worldObj->longName} = $worldObj->name;
9512 }
9513  
9514 } else {
9515  
9516 # Just display the profile name
9517 $nameHash{$worldObj->name} = $worldObj->name;
9518 }
9519 }
9520  
9521 # Remove all favourite worlds from %worldHash, so they can be displayed first
9522 foreach my $name ($self->favouriteWorldList) {
9523  
9524 if (exists $worldHash{$name}) {
9525  
9526 push (@faveList, $worldHash{$name});
9527 delete $worldHash{$name};
9528 }
9529 }
9530  
9531 # Remove all visited worlds from %worldHash, so they can be displayed next
9532 foreach my $name (keys %worldHash) {
9533  
9534 my $worldObj = $worldHash{$name};
9535  
9536 if ($worldObj->numberConnects) {
9537  
9538 push (@visitedList, $worldObj);
9539 delete $worldHash{$name};
9540 }
9541 }
9542  
9543 # ...and sort that list so the most-visited worlds appear at the top
9544 @visitedList = sort {$a->numberConnects <=> $b->numberConnects} (@visitedList);
9545  
9546 # Now sort the remaining world profiles alphabetically
9547 @otherList = sort {lc($nameHash{$a->name}) cmp lc($nameHash{$b->name})} (values %worldHash);
9548  
9549 # Combine the three lists, replacing the GA::Profile::World objects with a name
9550 foreach my $worldObj (@faveList, @visitedList) {
9551  
9552 push (@comboList, $nameHash{$worldObj->name});
9553 }
9554  
9555 # The 'create new world' goes at the top
9556 push (@comboList, $newWorldString);
9557  
9558 foreach my $worldObj (@otherList) {
9559  
9560 push (@comboList, $nameHash{$worldObj->name});
9561 }
9562  
9563 # Open the 'dialogue' window
9564 $choice = $self->mainWin->showComboDialogue(
9565 'Welcome to ' . $axmud::SCRIPT,
9566 'Please use your cursor or arrow keys to select a world, and your tab and enter keys'
9567 . ' to click OK',
9568 \@comboList,
9569 TRUE, # Show only a single OK button
9570 );
9571  
9572 if (! $choice) {
9573  
9574 return $self->stop();
9575  
9576 } elsif ($choice ne $newWorldString) {
9577  
9578 $connectWorld = $checkHash{$choice};
9579 $connectWorldObj = $self->ivShow('worldProfHash', $connectWorld);
9580 }
9581  
9582 # Branch 1 - new world profile
9583 # ----------------------------
9584  
9585 if ($choice eq $newWorldString) {
9586  
9587 $connectWorld = $self->mainWin->showEntryDialogue(
9588 'New world',
9589 'Enter a name for the new world and press RETURN (maximum 16 characters and no'
9590 . ' spaces)',
9591 16,
9592 undef, undef, undef,
9593 TRUE, # Show only a single OK button
9594 );
9595  
9596 if (! $connectWorld) {
9597  
9598 return $self->stop();
9599  
9600 } elsif ($self->ivExists('worldProfHash', $connectWorld)) {
9601  
9602 $connectWorldObj = $self->ivShow('worldProfHash', $connectWorld);
9603  
9604 } else {
9605  
9606 $connectHost = $self->mainWin->showEntryDialogue(
9607 'Host',
9608 'Enter the DNS or IP address for the world and press RETURN',
9609 256,
9610 undef, undef, undef,
9611 TRUE, # Show only a single OK button
9612 );
9613  
9614 if (! $connectHost) {
9615  
9616 return $self->stop();
9617 }
9618  
9619 $connectPort = $self->mainWin->showEntryDialogue(
9620 'Port',
9621 'Enter the port and press RETURN',
9622 256,
9623 undef, undef, undef,
9624 TRUE, # Show only a single OK button
9625 );
9626  
9627 if (! $connectPort) {
9628  
9629 return $self->stop();
9630 }
9631  
9632 # (A subset of login modes in GA::Profile::World->loginMode)
9633 %loginHash = (
9634 'No automatic login' => 'none',
9635 'LP / Diku / AberMUD style logins' => 'lp',
9636 'TinyMUD style logins' => 'tiny',
9637 'Basic telnet logins' => 'telnet',
9638 );
9639  
9640 @comboList3 = (
9641 'No automatic login',
9642 'LP / Diku / AberMUD style logins',
9643 'TinyMUD style logins',
9644 'Basic telnet logins',
9645 );
9646  
9647 $choice = $self->mainWin->showComboDialogue(
9648 'Automatic login mode',
9649 'What kind of login does this world use? (If you\'re not sure, select \'no'
9650 . ' automatic login\')',
9651 \@comboList3,
9652 TRUE, # Show only a single OK button
9653 );
9654  
9655 if (! $choice) {
9656 $loginMode = 'none';
9657 } else {
9658 $loginMode = $loginHash{$choice};
9659 }
9660  
9661 # (Characters are optional)
9662 $connectChar = $self->mainWin->showEntryDialogue(
9663 'Character',
9664 'Enter a character name and press RETURN',
9665 16,
9666 undef, undef, undef,
9667 TRUE, # Show only a single OK button
9668 );
9669  
9670 if ($connectChar) {
9671  
9672 # (Passwords are optional)
9673 $connectPwd = $self->mainWin->showEntryDialogue(
9674 'Password',
9675 'Enter a password and press RETURN',
9676 undef, # No maximum password length
9677 undef,
9678 TRUE, # Obscure password text
9679 undef,
9680 TRUE, # Show only a single OK button
9681 );
9682 }
9683  
9684 # Ready to start the session
9685 $startFlag = TRUE;
9686 }
9687 }
9688  
9689 # Branch 2 - existing world profile
9690 # ---------------------------------
9691  
9692 if (! $startFlag) {
9693  
9694 # Get a sorted list of player profiles, with the most recently-connected player at the
9695 # top
9696 foreach my $char ($connectWorldObj->ivKeys('passwordHash')) {
9697  
9698 if (
9699 ! $connectWorldObj->lastConnectChar
9700 || $char eq $connectWorldObj->lastConnectChar
9701 ) {
9702 push (@comboList2, $char);
9703 }
9704 }
9705  
9706 # (If there are no characters in the list, skip the next dialogue)
9707 if (@comboList2) {
9708  
9709 push (@comboList2, $newCharString);
9710  
9711 $choice = $self->mainWin->showComboDialogue(
9712 'Select character',
9713 'Use your cursor keys to select a character, and your tab and enter keys to'
9714 . ' click OK',
9715 \@comboList2,
9716 TRUE, # Show only a single OK button
9717 );
9718  
9719 if (! $choice) {
9720  
9721 return $self->stop();
9722  
9723 } elsif ($choice ne $newCharString) {
9724  
9725 ($connectHost, $connectPort, $connectChar, $connectPwd, $connectAccount)
9726 = $connectWorldObj->getConnectDetails($choice);
9727 }
9728 }
9729  
9730 if (! $connectChar) {
9731  
9732 # (Characters are optional)
9733 $connectChar = $self->mainWin->showEntryDialogue(
9734 'Character',
9735 'Enter a character name and press RETURN',
9736 16,
9737 undef, undef, undef,
9738 TRUE, # Show only a single OK button
9739 );
9740  
9741 if ($connectChar) {
9742  
9743 # (Passwords are optional)
9744 $connectPwd = $self->mainWin->showEntryDialogue(
9745 'Password',
9746 'Enter a password and press RETURN',
9747 undef, # No maximum password length
9748 undef,
9749 TRUE, # Obscure password text
9750 undef,
9751 TRUE, # Show only a single OK button
9752 );
9753 }
9754  
9755 # Set the world profile's new password hash, just as the Connections window
9756 # (GA::OtherWin::Connect->updateProfile) does in this situation
9757 if (! defined $connectWorldObj->ivShow('passwordHash', $connectChar)) {
9758  
9759 $connectWorldObj->ivAdd('newPasswordHash', $connectChar, $connectPwd);
9760 }
9761  
9762 # Also get the host/port, ready for the call below
9763 ($connectHost, $connectPort) = $connectWorldObj->getConnectDetails();
9764 }
9765 }
9766  
9767 # The TTS job list has almost certainly been interrupted. Reset some IVs, so that the we
9768 # can start performing TTS jobs immediately (start reading aloud the session's text
9769 # immediately)
9770 $self->ttsRestart();
9771  
9772 # Start the session
9773 if (
9774 ! $self->startSession(
9775 $connectWorld,
9776 $connectHost,
9777 $connectPort,
9778 $connectChar,
9779 $connectPwd,
9780 $connectAccount,
9781 undef, # Default protocol
9782 $loginMode, # May be 'undef'
9783 )
9784 ) {
9785 # Display a confirmation
9786 $self->mainWin->showMsgDialogue(
9787 'Failed connection',
9788 'error',
9789 'General error while connecting to \'' . $connectWorld . '\'',
9790 'ok',
9791 );
9792  
9793 return $self->stop();
9794  
9795 } else {
9796  
9797 # Operation complete
9798 return 1;
9799 }
9800 }
9801  
9802 sub addGlobalInitTask {
9803  
9804 # Called by $self->start (when no sessions are running) to add a task to the global initial
9805 # tasklist
9806 # (Also called by functions in GA::WizWin::Setup)
9807 #
9808 # Expected arguments
9809 # $taskName - The task's formal name (e.g. 'status_task')
9810 #
9811 # Return values
9812 # 'undef' on improper arguments or if the initial task can't be added
9813 # Otherwise returns the new initial task
9814  
9815 my ($self, $taskName, $check) = @_;
9816  
9817 # Local variables
9818 my ($packageName, $taskObj);
9819  
9820 # Check for improper arguments
9821 if (! defined $taskName || defined $check) {
9822  
9823 return $axmud::CLIENT->writeImproper($self->_objClass . '->addGlobalInitTask', @_);
9824 }
9825  
9826 # Get the package name corresponding to $taskName (e.g. 'Games::Axmud::Task::Status',
9827 # 'Games::Axmud::Task::Divert')
9828 $packageName = $self->ivShow('constTaskPackageHash', $taskName);
9829 if (! $packageName) {
9830  
9831 return undef;
9832 }
9833  
9834 # Create the task object. We have to cheat a bit and name this GA::Client as the parent
9835 # GA::Session (it's not stored as an IV)
9836 $taskObj = $packageName->new($self);
9837 if (! $taskObj) {
9838  
9839 return undef;
9840 }
9841  
9842 # (No need to check plugins, normally done by a call to GA::Generic::Task->checkPlugins -
9843 # only built-in tasks exist in ->constTaskPackageHash)
9844  
9845 # Set the standard IV (normally done by GA::Generic::Task->setParentFileObj)
9846 $taskObj->{_parentFile} = 'tasks';
9847 # Set the task type (normally done in the call to $taskObj->new)
9848 $taskObj->{taskType} = 'initial';
9849  
9850 # Update the global initial tasklist (normally done by GA::Generic::Task->updateTaskLists)
9851 # Give task a unique name within the global initial tasklist
9852 $taskObj->{uniqueName} = $taskObj->{name} . '_' . $self->inc_initTaskTotal();
9853 # Create an entry in the global initial tasklist (this call marks the parent file objects as
9854 # having had its data modified)
9855 $self->add_initTask($taskObj);
9856  
9857 return $taskObj;
9858 }
9859  
9860 # Client and session loop
9861  
9862 sub startClientLoop {
9863  
9864 # Called by $self->start
9865 # Starts the client loop, which calls $self->spinClientLoop whenever the loop spins
9866 #
9867 # Expected arguments
9868 # (none besides $self)
9869 #
9870 # Return values
9871 # 'undef' on improper arguments or if the loop can't be started
9872 # 1 otherwise
9873  
9874 my ($self, $check) = @_;
9875  
9876 # Local variables
9877 my $loopObj;
9878  
9879 # Check for improper arguments
9880 if (defined $check) {
9881  
9882 return $axmud::CLIENT->writeImproper($self->_objClass . '->startClientLoop', @_);
9883 }
9884  
9885 # Create the object that handles the loop
9886 $loopObj = Games::Axmud::Obj::Loop->new(
9887 $self,
9888 'spinClientLoop',
9889 'client',
9890 );
9891  
9892 if (! $loopObj) {
9893  
9894 return undef;
9895  
9896 } else {
9897  
9898 $self->ivPoke('clientLoopObj', $loopObj);
9899 }
9900  
9901 # Start the loop
9902 if (! $loopObj->startLoop($self->clientLoopDelay)) {
9903  
9904 return undef;
9905  
9906 } else {
9907  
9908 # Initialise blinking text in textviews, with text initially visible
9909 $self->ivPoke('blinkSlowCheckTime', $self->clientTime + ($self->blinkSlowTime / 2));
9910 $self->ivPoke('blinkSlowFlag', TRUE);
9911 $self->ivPoke('blinkFastCheckTime', $self->clientTime + ($self->blinkFastTime / 2));
9912 $self->ivPoke('blinkFastFlag', TRUE);
9913  
9914 return 1;
9915 }
9916 }
9917  
9918 sub stopClientLoop {
9919  
9920 # Called by $self->stop
9921 # Stops the client loop
9922 #
9923 # Expected arguments
9924 # (none besides $self)
9925 #
9926 # Return values
9927 # 'undef' on improper arguments, if the loop isn't running or if it can't be stopped
9928 # 1 otherwise
9929  
9930 my ($self, $check) = @_;
9931  
9932 # Local variables
9933 my $result;
9934  
9935 # Check for improper arguments
9936 if (defined $check) {
9937  
9938 return $axmud::CLIENT->writeImproper($self->_objClass . '->stopClientLoop', @_);
9939 }
9940  
9941 if (! $self->clientLoopObj) {
9942  
9943 return undef;
9944 }
9945  
9946 # Stop the loop
9947 $result = $self->clientLoopObj->stopLoop();
9948  
9949 # Update IVs
9950 $self->ivUndef('clientLoopObj');
9951  
9952 return $result;
9953 }
9954  
9955 sub spinClientLoop {
9956  
9957 # Called by $self->clientLoopObj->spinLoop when the client loop spins
9958 # Updates 'internal' windows and some of their strip objects. Makes blinking text in
9959 # Gtk3::Textviews blink on or off. Checks file objects and, if any need to be saved,
9960 # updates the title of 'main' windows
9961 #
9962 # Expected arguments
9963 # $loopObj - The GA::Obj::Loop object handling the client loop
9964 #
9965 # Return values
9966 # 'undef' on improper arguments, if the client loop isn't running or if $loopObj is the
9967 # wrong loop object
9968 # 1 otherwise
9969  
9970 my ($self, $loopObj, $check) = @_;
9971  
9972 # Local variables
9973 my (
9974 $connectInfoFlag, $result,
9975 @bufferList,
9976 );
9977  
9978 # Check for improper arguments
9979 if (! defined $loopObj || defined $check) {
9980  
9981 return $axmud::CLIENT->writeImproper($self->_objClass . '->spinClientLoop', @_);
9982 }
9983  
9984 if (
9985 ! $self->clientLoopObj
9986 || $self->clientLoopObj ne $loopObj
9987 || $self->suspendSessionLoopFlag
9988 ) {
9989 return undef;
9990 }
9991  
9992 # Update IVs
9993 $self->ivPoke('clientTime', $loopObj->spinTime);
9994  
9995 # Update blinkers states for each session
9996 foreach my $session ($self->listSessions()) {
9997  
9998 $session->updateBlinkers();
9999 }
10000  
10001 # Update 'internal' windows
10002 foreach my $winObj ($self->desktopObj->listGridWins()) {
10003  
10004 my (
10005 $stripObj,
10006 %hash,
10007 );
10008  
10009 if (
10010 $winObj->winType eq 'main'
10011 || $winObj->winType eq 'protocol'
10012 || $winObj->winType eq 'custom'
10013 ) {
10014 # If the GA::Strip::GaugeBox strip object's gauge box has been empty for too long,
10015 # remove it
10016 $stripObj = $winObj->ivShow('firstStripHash', 'Games::Axmud::Strip::GaugeBox');
10017 if (
10018 $stripObj
10019 && defined $stripObj->gaugeCheckTime
10020 && $stripObj->gaugeCheckTime < $self->clientTime
10021 ) {
10022 $stripObj->removeGaugeBox();
10023 }
10024  
10025 # If the GA::Strip::Entry strip object's console button is in flashing mode, make
10026 # it flash once
10027 if ($winObj->visibleSession && $winObj->visibleSession->systemMsgCheckTime) {
10028  
10029 $stripObj = $winObj->ivShow('firstStripHash', 'Games::Axmud::Strip::Entry');
10030 if ($stripObj) {
10031  
10032 $stripObj->set_consoleIconFlash();
10033 }
10034 }
10035  
10036 # Update the GA::Strip::ConnectInfo strip object in every 'internal' window
10037 # approximately every second
10038 # (GA::Strip::ConnectInfo are allowed in 'internal' windows besides 'main' windows,
10039 # but they don't display connection data)
10040 if ($winObj->visibleSession) {
10041  
10042 if (
10043 ! $winObj->visibleSession->connectInfoCheckTime
10044 || $winObj->visibleSession->connectInfoCheckTime
10045 < int($winObj->visibleSession->sessionTime)
10046 ) {
10047 $winObj->setTimeLabel($winObj->visibleSession->getTimeLabelText());
10048 }
10049  
10050 } else {
10051  
10052 $winObj->setTimeLabel('');
10053 }
10054  
10055 # Re-draw blinkers in any 'internal' window which uses them, as appropriate
10056 # (GA::Strip::ConnectInfo are allowed in 'internal' windows besides 'main' windows,
10057 # but blinkers are only updated in the session's 'main' window)
10058 if ($winObj->visibleSession) {
10059  
10060 $stripObj
10061 = $winObj->ivShow('firstStripHash', 'Games::Axmud::Strip::ConnectInfo');
10062  
10063 if ($stripObj) {
10064  
10065 # Import the visible session's blinker state hash (for convenience)
10066 %hash = $winObj->visibleSession->blinkerStateHash;
10067  
10068 # Redraw each blinker that is off, but should be on (and vice-versa)
10069 foreach my $blinkerNum (keys %hash) {
10070  
10071 my ($blinkerState, $blinkerObj);
10072  
10073 $blinkerState = $hash{$blinkerNum};
10074 $blinkerObj = $stripObj->ivShow('blinkerHash', $blinkerNum);
10075  
10076 if (
10077 $blinkerObj
10078 && (
10079 (defined $blinkerState && ! $blinkerObj->onFlag)
10080 || (! defined $blinkerState && $blinkerObj->onFlag)
10081 )
10082 ) {
10083 # Redraw this blinker
10084 $stripObj->drawBlinker($blinkerNum, ! ($blinkerObj->onFlag));
10085 }
10086 }
10087 }
10088 }
10089 }
10090 }
10091  
10092 # Get a list of textview buffers which might contain blinking text
10093 foreach my $textViewObj ($self->desktopObj->ivValues('textViewHash')) {
10094  
10095 push (@bufferList, $textViewObj->buffer);
10096 }
10097  
10098 # Update the buffers' text tags (if it's time to do so), making the text appear or disappear
10099 # on cue
10100 if ($self->clientTime > $self->blinkSlowCheckTime) {
10101  
10102 foreach my $buffer (@bufferList) {
10103  
10104 my ($blinkTag, $cursorTag);
10105  
10106 $blinkTag = $buffer->get_tag_table->lookup('blink_slow');
10107 $cursorTag = $buffer->get_tag_table->lookup('cursor');
10108  
10109 if ($blinkTag) {
10110  
10111 $blinkTag->set_property('foreground-set', $self->blinkSlowFlag);
10112 $blinkTag->set_property('background-set', $self->blinkSlowFlag);
10113 }
10114  
10115 # The textview object's cursor is updated at the same time
10116 if ($cursorTag && ! $self->useFastCursorFlag) {
10117  
10118 if ($self->blinkSlowFlag) {
10119 $cursorTag->set_property('underline', 'single');
10120 } else {
10121 $cursorTag->set_property('underline', 'none');
10122 }
10123 }
10124 }
10125  
10126 if ($self->blinkSlowFlag) {
10127 $self->ivPoke('blinkSlowFlag', FALSE);
10128 } else {
10129 $self->ivPoke('blinkSlowFlag', TRUE);
10130 }
10131  
10132 $self->ivPoke('blinkSlowCheckTime', $self->clientTime + ($self->blinkSlowTime / 2));
10133 }
10134  
10135 if ($self->clientTime > $self->blinkFastCheckTime) {
10136  
10137 foreach my $buffer (@bufferList) {
10138  
10139 my ($blinkTag, $cursorTag);
10140  
10141 $blinkTag = $buffer->get_tag_table->lookup('blink_fast');
10142 $cursorTag = $buffer->get_tag_table->lookup('cursor');
10143  
10144 if ($blinkTag) {
10145  
10146 $blinkTag->set_property('foreground-set', $self->blinkFastFlag);
10147 $blinkTag->set_property('background-set', $self->blinkFastFlag);
10148 }
10149  
10150 # The textview object's cursor is updated at the same time
10151 if ($cursorTag && $self->useFastCursorFlag) {
10152  
10153 if ($self->blinkFastFlag) {
10154 $cursorTag->set_property('underline', 'single');
10155 } else {
10156 $cursorTag->set_property('underline', 'none');
10157 }
10158 }
10159 }
10160  
10161 if ($self->blinkFastFlag) {
10162 $self->ivPoke('blinkFastFlag', FALSE);
10163 } else {
10164 $self->ivPoke('blinkFastFlag', TRUE);
10165 }
10166  
10167 $self->ivPoke('blinkFastCheckTime', $self->clientTime + ($self->blinkFastTime / 2));
10168 }
10169  
10170 # Checks all the file objects stored in $self->fileObjHash and change the title of all
10171 # 'main' windows, if necessary (using an asterisk to show that at least one file needs to
10172 # be saved, and no asterisk to show that none of them need to be saved)
10173 $self->checkMainWinTitles();
10174  
10175 # Restore the border size of any pane objects whose border size has been briefly increased
10176 $self->paneRestoreBorder();
10177  
10178 # Perform text-to-speech (TTS) requests and jobs
10179 $self->ttsPerformJobs();
10180  
10181 return 1;
10182 }
10183  
10184 sub haltSessionLoops {
10185  
10186 # Called by $SIG{__DIE__} in axmud.pl
10187 # We don't know which GA::Session caused the Perl error, but we can leave Axmud in a (more
10188 # or less) functional state by halting all client loops and session loops; the user can
10189 # restart them, when ready, with the ';restart' command
10190 #
10191 # Expected arguments
10192 # (none besides $self)
10193 #
10194 # Return values
10195 # 'undef' on improper arguments
10196 # 1 otherwise
10197  
10198 my ($self, $check) = @_;
10199  
10200 # Local variables
10201 my @list;
10202  
10203 # Check for improper arguments
10204 if (defined $check) {
10205  
10206 return $axmud::CLIENT->writeImproper($self->_objClass . '->haltSessionLoops', @_);
10207 }
10208  
10209 $self->ivPoke('suspendSessionLoopFlag', TRUE);
10210  
10211 # The Glib::Timeout might have stopped, or not (depending on what caused the error), so we
10212 # need to formally stop it
10213 foreach my $session ($self->ivValues('sessionHash')) {
10214  
10215 $session->stopSessionLoop();
10216 }
10217  
10218 @list = (
10219 ' ',
10220 'Because of a Perl error, ' . $axmud::SCRIPT . ' internal processes have been'
10221 . ' suspended across all sessions. (This will prevent you from seeing the same'
10222 . ' error message again and again, and will perhaps protect your stored data'
10223 . ' from getting corrupted. If there are several sessions open, the error is'
10224 . ' sometimes visible only in one session.)',
10225 ' ',
10226 'Most errors of this kind are caused by invalid patterns (regular expressions)'
10227 . ' in your interfaces (triggers, aliases, macros, timers and hooks). You can'
10228 . ' often correct them by opening an \'edit\' window and by replacing the'
10229 . ' invalid pattern with a valid one or by deleting it altogether.',
10230 ' ',
10231 );
10232  
10233 if ($self->pluginHash) {
10234  
10235 push (@list,
10236 'If the error was caused by a faulty plugin, the plugin can be disabled with'
10237 . ' the \';disableplugin\' command. Errors with the ' . $axmud::SCRIPT . ' code'
10238 . ' itself should be reported to the authors.',
10239 ' ',
10240 );
10241  
10242 }
10243  
10244 push (@list,
10245 'When you are ready, you can use the \';restart\' command to return '
10246 . $axmud::SCRIPT . ' to a more-or-less functional state.',
10247 ' ',
10248 '---',
10249 ' ',
10250 'Too long, didn\'t read? Just type: ;restart',
10251 ' ',
10252 );
10253  
10254 foreach my $session ($self->ivValues('sessionHash')) {
10255  
10256 foreach my $line (@list) {
10257  
10258 $session->writeText($line);
10259 }
10260 }
10261  
10262 return 1;
10263 }
10264  
10265 sub restoreSessionLoops {
10266  
10267 # Called by GA::Cmd::Restart->do
10268 # Restarts client/session loops stopped by a call to $self->haltSessionLoops
10269 #
10270 # Expected arguments
10271 # (none besides $self)
10272 #
10273 # Return values
10274 # 'undef' on improper arguments
10275 # 1 otherwise
10276  
10277 my ($self, $check) = @_;
10278  
10279 # Check for improper arguments
10280 if (defined $check) {
10281  
10282 return $axmud::CLIENT->writeImproper($self->_objClass . '->restoreSessionLoops', @_);
10283 }
10284  
10285 $self->ivPoke('suspendSessionLoopFlag', FALSE);
10286  
10287 # The Glib::Timeout might have stopped, or not (depending on what caused the error), so we
10288 # need to formally stop it
10289 foreach my $session ($self->ivValues('sessionHash')) {
10290  
10291 $session->startSessionLoop();
10292 }
10293  
10294 return 1;
10295 }
10296  
10297 sub checkMainWinTitles {
10298  
10299 # Called by $self->spinClientLoop
10300 # This titles of all 'main' windows need to be changed from time to time (all 'main' windows
10301 # have the same title, and any changes are performed on all 'main' windows at the same
10302 # time)
10303 # This function checks whether it's necessary to change them and performs the operation, if
10304 # so
10305 #
10306 # Expected arguments
10307 # (none besides $self)
10308 #
10309 # Return values
10310 # 'undef' on improper arguments
10311 # 1 otherwise
10312  
10313 my ($self, $check) = @_;
10314  
10315 # Local variables
10316 my (
10317 $exitFlag,
10318 @winObjList,
10319 );
10320  
10321 # Check for improper arguments
10322 if (defined $check) {
10323  
10324 return $axmud::CLIENT->writeImproper($self->_objClass . '->checkMainWinTitles', @_);
10325 }
10326  
10327 # Get an ordered list of all 'main' windows
10328 @winObjList = $self->desktopObj->listGridWins('main');
10329  
10330 # Check file objects for the client
10331 if ($self->showModFlag) {
10332  
10333 # 'main' window titles contain an asterisk, meaning that some files need to be saved. If
10334 # they have all been saved, we change the titles
10335 OUTER: foreach my $fileObj ($self->ivValues('fileObjHash')) {
10336  
10337 if ($fileObj->modifyFlag) {
10338  
10339 $exitFlag = TRUE;
10340 last OUTER;
10341 }
10342 }
10343  
10344 if (! $exitFlag) {
10345  
10346 # All files already saved; change 'main' windows titles
10347 foreach my $winObj (@winObjList) {
10348  
10349 $winObj->setMainWinTitle(FALSE);
10350 }
10351  
10352 # Update IVs
10353 $self->ivPoke('showModFlag', FALSE);
10354 }
10355  
10356 } else {
10357  
10358 # 'main' window titles don't contain an asterisk, meaning that no files need to be
10359 # saved. If any of them now need to be saved, we change the titles
10360 OUTER: foreach my $fileObj ($self->ivValues('fileObjHash')) {
10361  
10362 if ($fileObj->modifyFlag) {
10363  
10364 $exitFlag = TRUE;
10365 last OUTER;
10366 }
10367 }
10368  
10369 if ($exitFlag) {
10370  
10371 # At least one file needs to be saved; change the label (the window's ->showModFlag
10372 # is automatically updated)
10373 # All files already saved; change 'main' window titles
10374 foreach my $winObj (@winObjList) {
10375  
10376 $winObj->setMainWinTitle(TRUE);
10377 }
10378  
10379 # Update IVs
10380 $self->ivPoke('showModFlag', TRUE);
10381 }
10382 }
10383  
10384 return 1;
10385 }
10386  
10387 sub paneModifyBorder {
10388  
10389 # Called by GA::Strip::Entry->setSwitchSignals
10390 # In 'internal' windows, that strip object includes a switcher button to switch between pane
10391 # objects (GA::Table::Pane); the scroll lock/split screen buttons then apply to the
10392 # selected pane object
10393 # When a pane object is selected, this function is called to briefly increase the pane's
10394 # border size; any other panes in the same window are immediately restored
10395 # The size of this pane is restored to normal by a call to $self->paneRestoreBorder from
10396 # $self->spinClientLoop
10397 #
10398 # Expected arguments
10399 # $paneObj - The selected pane object
10400 #
10401 # Return values
10402 # 'undef' on improper arguments
10403 # 1 otherwise
10404  
10405 my ($self, $paneObj, $check) = @_;
10406  
10407 # Check for improper arguments
10408 if (! defined $paneObj || defined $check) {
10409  
10410 return $axmud::CLIENT->writeImproper($self->_objClass . '->paneModifyBorder', @_);
10411 }
10412  
10413 # Immediately restore the border size of any other pane object in this window
10414 foreach my $time ($self->ivKeys('paneRestoreHash')) {
10415  
10416 my $otherPaneObj = $self->ivShow('paneRestoreHash', $time);
10417  
10418 if ($otherPaneObj->winObj && $otherPaneObj->winObj eq $paneObj->winObj) {
10419  
10420 # Restore this pane object's border size immediately
10421 $otherPaneObj->set_borderWidth(FALSE);
10422 $self->ivDelete('paneRestoreHash', $time);
10423 }
10424 }
10425  
10426 # Modify the pane's border size
10427 $paneObj->set_borderWidth(TRUE);
10428 # Add an entry for this pane object, setting the time at which its border will be restored
10429 # Pane object numbers are not unique to the client, so in this hash we take the unusual
10430 # step of using a system time as a key, matching the time at which the border size
10431 # should be restored
10432 $self->ivAdd('paneRestoreHash', ($self->clientTime + $self->paneDelay), $paneObj);
10433  
10434 return 1;
10435 }
10436  
10437 sub paneRestoreBorder {
10438  
10439 # Called by $self->spinClientLoop
10440 # In 'internal' windows, the strip object GA::Strip::Entry includes a switcher button to
10441 # switch between pane objects (GA::Table::Pane); the scroll lock/split screen buttons
10442 # then apply to the selected pane object
10443 # When a pane object is selected, $self->paneModifyBorder is called to briefly increase the
10444 # pane's border size; the client loop calls this function to check whether it's time to
10445 # restore any border sizes, and to restore them if so
10446 #
10447 # Expected arguments
10448 # (none besides $self)
10449 #
10450 # Return values
10451 # 'undef' on improper arguments
10452 # 1 otherwise
10453  
10454 my ($self, $check) = @_;
10455  
10456 # Check for improper arguments
10457 if (defined $check) {
10458  
10459 return $axmud::CLIENT->writeImproper($self->_objClass . '->paneRestoreBorder', @_);
10460 }
10461  
10462 foreach my $time ($self->ivKeys('paneRestoreHash')) {
10463  
10464 my $paneObj;
10465  
10466 if ($time < $self->clientTime) {
10467  
10468 $paneObj = $self->ivShow('paneRestoreHash', $time);
10469 # Check the pane object and its window still exist (just in case)
10470 if (
10471 $paneObj->winObj
10472 && $self->desktopObj->ivExists('gridWinHash', $paneObj->winObj->number)
10473 ) {
10474 # Restore this pane object's border size immediately
10475 $paneObj->set_borderWidth(FALSE);
10476 $self->ivDelete('paneRestoreHash', $time);
10477 }
10478 }
10479 }
10480  
10481 return 1;
10482 }
10483  
10484 # Session methods
10485  
10486 sub startSession {
10487  
10488 # Called initially by GA::OtherWin::Connect->connectWorldCallback or $self->connectBlind,
10489 # thereafter by GA::Cmd::Connect->do, Reconnect->do, XConnect->do, Telnet->do, SSH->do and
10490 # SSL->do
10491 # Starts a session (managing a single connection to a world)
10492 #
10493 # Expected arguments
10494 # $world - The world's name (matches a world profile name)
10495 #
10496 # Optional arguments
10497 # $host - The world's host address (if 'undef', default host address used)
10498 # $port - The world's port (if 'undef', default host port used)
10499 # $char - A character name (matches a character profile name (if 'undef', no
10500 # character profile used)
10501 # $pass - The corresponding password (if 'undef', the world profile is consulted
10502 # to provide the password, if possible)
10503 # $account - The character's associated account name, for worlds that use both
10504 # (if 'undef', no account name used)
10505 # $protocol - If set to 'telnet', 'ssh' or 'ssl', that protocol is used; if 'undef'
10506 # or an unrecognised value, the world profile's ->protocol is used
10507 # $loginMode - Set when called by $self->connectBlind, when a new world profile is to
10508 # be created, and the user has specified what type of ->loginMode this
10509 # world uses; otherwise set to 'undef'
10510 # $offlineFlag - If TRUE, the session doesn't actually connect to the world, but still
10511 # loads all data and makes some client commands available. If FALSE
10512 # (or 'undef'), the session tries to connect to the world
10513 # $tempFlag - If set to TRUE, the world profile is a temporary world profile,
10514 # created because the user didn't specify a world name. File saving
10515 # in the session will be disabled. Otherwise set to FALSE (or
10516 # 'undef')
10517 #
10518 # Return values
10519 # 'undef' on improper arguments or if the GA::Session object can't be created or started
10520 # The new GA::Session object on success
10521  
10522 my (
10523 $self, $world, $host, $port, $char, $pass, $account, $protocol, $loginMode,
10524 $offlineFlag, $tempFlag, $check,
10525 ) = @_;
10526  
10527 # Local variables
10528 my ($actualCount, $tempName, $successFlag, $worldObj, $newSession, $index);
10529  
10530 # Check for improper arguments
10531 if (! defined $world || defined $check) {
10532  
10533 return $axmud::CLIENT->writeImproper($self->_objClass . '->startSession', @_);
10534 }
10535  
10536 # In blind mode, only one session is allowed. To allow the user to use ';reconnect', and
10537 # so on, terminate the existing session which is not connected to a world before
10538 # creating a new one
10539 if ($axmud::BLIND_MODE_FLAG) {
10540  
10541 foreach my $session ($self->listSessions()) {
10542  
10543 if (
10544 $session->status eq 'waiting'
10545 || $session->status eq 'offline'
10546 || $session->status eq 'disconnected'
10547 ) {
10548 $self->stopSession($session);
10549 }
10550 }
10551 }
10552  
10553 # Count the number of active sessions
10554 $actualCount = $self->ivPairs('sessionHash');
10555  
10556 # Check that we don't already have too many sessions
10557 if ($actualCount >= $self->sessionMax) {
10558  
10559 $self->mainWin->showMsgDialogue(
10560 'Session limit reached',
10561 'error',
10562 'Can\'t open a new session (' . $axmud::SCRIPT . ' has reached its limit of '
10563 . $self->sessionMax . ' sessions - see the help for \';maxsession\')',
10564 'ok',
10565 );
10566  
10567 return undef;
10568  
10569 } elsif ($axmud::BLIND_MODE_FLAG && $actualCount >= 1) {
10570  
10571 $self->mainWin->showMsgDialogue(
10572 'Session limit reached',
10573 'error',
10574 'Can\'t open multiple sessions when ' . $axmud::SCRIPT . ' is running in \'blind\''
10575 . ' mode',
10576 'ok',
10577 );
10578  
10579 return undef;
10580 }
10581  
10582 # Two sessions can have the same current world, but they can't have the same current
10583 # character (unless one of them has their ->status set to 'disconnected')
10584 if ($char && $self->testSessions($world, $char, TRUE)) {
10585  
10586 $self->mainWin->showMsgDialogue(
10587 'Duplicate character',
10588 'error',
10589 'You are already connected to \'' . $world . '\' using the character \'' . $char
10590 . '\'',
10591 'ok',
10592 );
10593  
10594 return undef;
10595 }
10596  
10597 # For temporary profiles, check a world profile with the same name doesn't already exist
10598 # and, if so, rename the temporary profile
10599 if ($tempFlag && $self->ivExists('worldProfHash', $world)) {
10600  
10601 # (Give up after too many renaming attempts)
10602 OUTER: for (my $count = 2; $count < 999; $count++) {
10603  
10604 $tempName = $world . $count; # e.g. 'deathmud2'
10605  
10606 # Max length of a profile is 16 chars
10607 if (length ($tempName) <= 16 && ! $self->ivExists('worldProfHash', $tempName)) {
10608  
10609 $world = $tempName;
10610 $successFlag = TRUE;
10611 last OUTER;
10612 }
10613 }
10614  
10615 if (! $successFlag) {
10616  
10617 $self->mainWin->showMsgDialogue(
10618 'Bad temporary world',
10619 'error',
10620 'Attempted to create a temporary world profile, but a world profile called \''
10621 . $world . '\' already exists, and ' . $axmud::SCRIPT . ' could not find an'
10622 . ' alternative name',
10623 'ok',
10624 );
10625  
10626 return undef;
10627 }
10628 }
10629  
10630 # If $host and/or $port were not specified, use generic values
10631 if (! defined $host) {
10632  
10633 $host = '127.0.0.1';
10634 }
10635  
10636 if (! defined $port) {
10637  
10638 $port = 23;
10639 }
10640  
10641 # If $protocol is not recognised, use a default value
10642 if (
10643 defined $protocol && $protocol ne 'telnet' && $protocol ne 'ssh' && $protocol ne 'ssl'
10644 ) {
10645 # Default is 'telnet'
10646 $protocol = undef;
10647 }
10648  
10649 # Create the GA::Session
10650 $newSession = Games::Axmud::Session->new(
10651 $self->sessionCount,
10652 $world,
10653 $host,
10654 $port,
10655 $char,
10656 $pass,
10657 $account,
10658 $protocol,
10659 $loginMode,
10660 $offlineFlag,
10661 $tempFlag,
10662 );
10663  
10664 if (! $newSession) {
10665  
10666 return undef;
10667 }
10668  
10669 # Session object created. Update IVs
10670 $self->ivIncrement('sessionCount');
10671 $self->ivAdd('sessionHash', $newSession->number, $newSession);
10672  
10673 # Start the session
10674 if (! $newSession->start()) {
10675 return undef;
10676 } else {
10677 return $newSession;
10678 }
10679 }
10680  
10681 sub stopSession {
10682  
10683 # Called by GA::Cmd::StopSession->do, $self->disablePlugin and GA::Session->del_winObj
10684 # Also called by $self->startSession in blind mode, to remove the existing disconnected
10685 # session
10686 #
10687 # Stops a GA::Session
10688 #
10689 # Expected arguments
10690 # $session - The GA::Session object to stop
10691 #
10692 # Return values
10693 # 'undef' on improper arguments, if the session is missing from the registry or if it
10694 # can't be stopped (no error msgs)
10695 # 1 otherwise
10696  
10697 my ($self, $session, $check) = @_;
10698  
10699 # Local variables
10700 my $nextSession;
10701  
10702 # Check for improper arguments
10703 if (! defined $session || defined $check) {
10704  
10705 return $axmud::CLIENT->writeImproper($self->_objClass . '->stopSession', @_);
10706 }
10707  
10708 if (! $self->ivExists('sessionHash', $session->number)) {
10709  
10710 # $session seems to be missing from the registry
10711 return $self->writeError(
10712 'Session #' . $session->number . ' missing from session registry',
10713 $self->_objClass . '->stopSession',
10714 );
10715  
10716 } else {
10717  
10718 # Update IVs
10719 $self->ivDelete('sessionHash', $session->number);
10720  
10721 # Terminate the session
10722 $session->stop();
10723 if ($self->currentSession eq $session) {
10724  
10725 if (! $self->sessionHash) {
10726  
10727 # There are no more sessions left
10728 $self->setCurrentSession();
10729 if (! $self->shareMainWinFlag) {
10730  
10731 # When sessions don't share a 'main' window, close the client when the last
10732 # session terminates
10733 # (If sessions do share a 'main' window, GA::Session->stop has already
10734 # created a spare 'main' window, and the client doesn't stop)
10735 $self->stop();
10736 }
10737  
10738 } else {
10739  
10740 # Decide which session is the new current one. It's the one which was created
10741 # after $session but, if $session was the most recently-created one, it's
10742 # the one created last
10743 # (The TRUE argument means use the last one, rather than the first one, if
10744 # necessary)
10745 $nextSession = $self->getNextSession($session, TRUE);
10746 if ($nextSession) {
10747  
10748 # Make the session's default tab the new visible tab in its pane object
10749 if ($nextSession->defaultTabObj) {
10750  
10751 $nextSession->defaultTabObj->paneObj->setVisibleTab(
10752 $nextSession->defaultTabObj,
10753 );
10754 }
10755  
10756 # If all sessions have their own 'main' window, make sure the new current
10757 # session's 'main' window is visible
10758 if (! $self->shareMainWinFlag) {
10759  
10760 $nextSession->mainWin->restoreFocus();
10761 }
10762 }
10763 }
10764 }
10765  
10766 return 1;
10767 }
10768 }
10769  
10770 sub stopAllSessions {
10771  
10772 # Called by $self->stop
10773 # Stops every GA::Session
10774 #
10775 # Expected arguments
10776 # (none besides $self)
10777 #
10778 # Return values
10779 # 'undef' on improper arguments, if no sessions exist or if a session can't be closed (no
10780 # error msgs)
10781 # 1 otherwise
10782  
10783 my ($self, $check) = @_;
10784  
10785 # Check for improper arguments
10786 if (defined $check) {
10787  
10788 return $axmud::CLIENT->writeImproper($self->_objClass . '->stopAllSessions', @_);
10789 }
10790  
10791 if (! $self->sessionHash) {
10792  
10793 # There are no sessions to stop
10794 return undef;
10795 }
10796  
10797 # Close every session
10798 foreach my $session ($self->listSessions()) {
10799  
10800 # Terminate the session
10801 if (! $session->stop()) {
10802  
10803 # Failed to terminate the session
10804 return undef;
10805 }
10806 }
10807  
10808 # The call we're about to make to ->setCurrentSession requires an empty ->sessionHash
10809 $self->ivEmpty('sessionHash');
10810  
10811 # All sessions terminated
10812 $self->setCurrentSession();
10813  
10814 return 1;
10815 }
10816  
10817 sub setCurrentSession {
10818  
10819 # Called by GA::Win::Internal->setVisibleSession whenever a 'main' window that has focus
10820 # changes its visible session. Also called by $self->stopSession and ->stopAllSessions
10821 # Updates IVs and fires some hooks
10822 #
10823 # Expected arguments
10824 # (none besides $self)
10825 #
10826 # Optional arguments
10827 # $session - The GA::Session that is the new current session. Unless the registry
10828 # $self->sessionHash is empty, there must be a current session at all
10829 # times. If not specified, there is no current session
10830 #
10831 # Return values
10832 # 'undef' on improper arguments or if no new current session is specified when the
10833 # registry is not empty
10834 # 1 otherwise
10835  
10836 my ($self, $session, $check) = @_;
10837  
10838 # Check for improper arguments
10839 if (defined $check) {
10840  
10841 return $axmud::CLIENT->writeImproper($self->_objClass . '->setCurrentSession', @_);
10842 }
10843  
10844 # No current session
10845 if (! defined $session) {
10846  
10847 if ($self->sessionHash) {
10848  
10849 # The registry is not empty, but should be
10850 return $self->writeError(
10851 'Could not set a null session - registry not empty',
10852 $self->_objClass . '->setCurrentSession',
10853 );
10854  
10855 } else {
10856  
10857 $self->ivUndef('currentSession');
10858 $self->ivEmpty('sessionHash');
10859 }
10860  
10861 # New current session
10862 } else {
10863  
10864 if (
10865 $self->currentSession
10866 && $self->currentSession ne $session
10867 && $self->shareMainWinFlag
10868 ) {
10869 # Fire any hooks that are using the 'not_current' hook event
10870 $self->currentSession->checkHooks('not_current', $session->number);
10871 }
10872  
10873 $self->ivPoke('currentSession', $session);
10874 $self->ivPoke('mainWin', $session->mainWin);
10875  
10876 # Fire any hooks that are using the 'current_session' hook event
10877 $session->checkHooks('current_session', undef);
10878 # Fire any hooks that are using the 'change_current' hook event
10879 foreach my $otherSession ($self->listSessions()) {
10880  
10881 if ($otherSession ne $session) {
10882  
10883 $otherSession->checkHooks('change_current', $session->number);
10884 }
10885 }
10886 }
10887  
10888 return 1;
10889 }
10890  
10891 sub getNextSession {
10892  
10893 # Called by $self->stopSession or any other code
10894 # Given a session, find the session which was created after that one. If the specified
10895 # session was the most recently-created one, return either the first or last remaining
10896 # session
10897 #
10898 # Expected arguments
10899 # $session - A GA::Session
10900 #
10901 # Optional arguments
10902 # $lastFlag - If there are no sessions that were created after the specified
10903 # $session, then this function returns the most recently-created other
10904 # session (if $lastFlag is TRUE), or the earliest-created other session
10905 # if ($lastFlag is FALSE or 'undef')
10906 #
10907 # Return values
10908 # 'undef' on improper arguments or if $self->sessionHash is empty
10909 # Otherwise, returns the session described above
10910  
10911 my ($self, $session, $lastFlag, $check) = @_;
10912  
10913 # Local variables
10914 my ($first, $last, $match);
10915  
10916 # Check for improper arguments
10917 if (! defined $session || defined $check) {
10918  
10919 return $axmud::CLIENT->writeImproper($self->_objClass . '->getNextSession', @_);
10920 }
10921  
10922 OUTER: foreach my $otherSession ($self->listSessions()) {
10923  
10924 if ($otherSession ne $session) {
10925  
10926 $last = $otherSession;
10927 if (! defined $first) {
10928  
10929 $first = $otherSession;
10930 }
10931  
10932 if ($otherSession->number > $session->number) {
10933  
10934 $match = $otherSession;
10935 last OUTER;
10936 }
10937 }
10938 }
10939  
10940 if (! $match) {
10941  
10942 if ($lastFlag) {
10943 return $last;
10944 } else {
10945 return $first;
10946 }
10947  
10948 } else {
10949  
10950 return $match;
10951 }
10952 }
10953  
10954 sub listSessions {
10955  
10956 # Convenience function. Returns a list of existing GA::Session objects in the order in
10957 # which they were created
10958 #
10959 # Expected arguments
10960 # (none besides $self)
10961 #
10962 # Optional arguments
10963 # $ignoreSession - If specified, ignore this session
10964 #
10965 # Return values
10966 # An empty list on improper arguments
10967 # Otherwise returns the ordered list of sessions (may be an empty list)
10968  
10969 my ($self, $ignoreSession, $check) = @_;
10970  
10971 # Local variables
10972 my (@sessionList, @returnList, @emptyList);
10973  
10974 # Check for improper arguments
10975 if (defined $check) {
10976  
10977 $axmud::CLIENT->writeImproper($self->_objClass . '->listSessions', @_);
10978 return @emptyList;
10979 }
10980  
10981 if (! $ignoreSession) {
10982  
10983 return (sort {$a->number <=> $b->number} ($self->ivValues('sessionHash')));
10984  
10985 } else {
10986  
10987 @sessionList = sort {$a->number <=> $b->number} ($self->ivValues('sessionHash'));
10988 foreach my $session (@sessionList) {
10989  
10990 if ($session ne $ignoreSession) {
10991  
10992 push (@returnList, $session);
10993 }
10994 }
10995  
10996 return @returnList;
10997 }
10998 }
10999  
11000 sub testSessions {
11001  
11002 # Called by $self->startSession or GA::Generic::Cmd->setProfile
11003 # Given specified world and character profiles, tests other sessions to see if any of them
11004 # are using the same current world and character and returns the number of matching
11005 # sessions
11006 #
11007 # Expected arguments
11008 # $world - Name of a world profile
11009 # $char - Name of a character profile associated with that world
11010 #
11011 # Optional arguments
11012 # $ignoreFlag - Flag set to TRUE when called by $self->startSession; ignores sessions
11013 # whose ->status is 'disconnected'. Otherwise set to FALSE (or
11014 # 'undef'), and all matching session are returned
11015 #
11016 # Return values
11017 # 'undef' on improper arguments
11018 # Otherwise returns the number of matching sessions (may be 0)
11019  
11020 my ($self, $world, $char, $ignoreFlag, $check) = @_;
11021  
11022 # Local variables
11023 my $count;
11024  
11025 # Check for improper arguments
11026 if (! defined $world || ! defined $char || defined $check) {
11027  
11028 return $axmud::CLIENT->writeImproper($self->_objClass . '->testSessions', @_);
11029 }
11030  
11031 $count = 0;
11032 foreach my $session ($self->listSessions()) {
11033  
11034 if (
11035 $session->currentWorld->name eq $world
11036 && $session->currentChar && $session->currentChar->name eq $char
11037 && (
11038 ! $ignoreFlag
11039 || ($ignoreFlag && $session->status ne 'disconnected')
11040 )
11041 ) {
11042 $count++;
11043 }
11044 }
11045  
11046 return $count;
11047 }
11048  
11049 sub findSessions {
11050  
11051 # Called by GA::Session->setupProfiles
11052 # Compiles a list of sessions whose current world matches a specified world, and returns
11053 # the list (in the order in which the sessions were created)
11054 #
11055 # Expected arguments
11056 # $worldName - The name of a world profile
11057 #
11058 # Optional arguments
11059 # $ignoreSession - If specified, ignore this session
11060 #
11061 # Return values
11062 # An empty list on improper arguments or if no session is using $name as its current world
11063 # Otherwise, returns the list of matching sessions
11064  
11065 my ($self, $worldName, $ignoreSession, $check) = @_;
11066  
11067 # Local variables
11068 my (@emptyList, @returnArray);
11069  
11070 # Check for improper arguments
11071 if (defined $check) {
11072  
11073 $axmud::CLIENT->writeImproper($self->_objClass . '->findSessions', @_);
11074 return @emptyList;
11075 }
11076  
11077 foreach my $session ($self->listSessions()) {
11078  
11079 if (
11080 (! $ignoreSession || $ignoreSession ne $session)
11081 && $session->currentWorld
11082 && $session->currentWorld->name eq $worldName
11083 ) {
11084 # This is a matching GA::Session
11085 push (@returnArray, $session);
11086 }
11087 }
11088  
11089 # Return the list of matching sessions (may be empty)
11090 return @returnArray;
11091 }
11092  
11093 sub checkSessions {
11094  
11095 # Called by GA::Strip::MenuBar->drawWorldColumn just before doing the ';stopsession' or
11096 # ';stopclient' commands
11097 # Checks every session to see whether any of them are connected, and whether there are any
11098 # unsaved files at all (if not, the 'main' window doesn't have to prompt the user for
11099 # confirmation, before stopping the session/client).
11100 #
11101 # Expected arguments
11102 # (none besides $self)
11103 #
11104 # Optional arguments
11105 # $session - If specified, ignore other GA::Session objects (but still check the
11106 # client's file objects)
11107 #
11108 # Return values
11109 # 'undef' on improper arguments or if there are any connected sessions or unsaved files
11110 # 1 if there are absolutely no connected sessions or unsaved files
11111  
11112 my ($self, $session, $check) = @_;
11113  
11114 # Check for improper arguments
11115 if (defined $check) {
11116  
11117 return $axmud::CLIENT->writeImproper($self->_objClass . '->checkSessions', @_);
11118 }
11119  
11120 # Check GA::Client file objects
11121 foreach my $fileObj ($self->ivValues('fileObjHash')) {
11122  
11123 if ($fileObj->modifyFlag) {
11124  
11125 return undef;
11126 }
11127 }
11128  
11129 # Check each session in turn
11130 foreach my $otherSession ($self->listSessions()) {
11131  
11132 if ($session && $session ne $otherSession) {
11133  
11134 # Ignore this session
11135 next OUTER;
11136 }
11137  
11138 # Check the session's connection status
11139 if ($otherSession->status ne 'disconnected' && $otherSession->status ne 'offline') {
11140  
11141 return undef;
11142 }
11143  
11144 # Check GA::Session file objects
11145 foreach my $fileObj ($otherSession->ivValues('sessionFileObjHash')) {
11146  
11147 if ($fileObj->modifyFlag) {
11148  
11149 return undef;
11150 }
11151 }
11152 }
11153  
11154 # There are no connected sessions or unsaved files
11155 return 1;
11156 }
11157  
11158 sub broadcastInstruct {
11159  
11160 # Can be called by anything (with great caution!)
11161 # Executes an instruction in every session (optionally, with the exception of a specified
11162 # session)
11163 #
11164 # Expected arguments
11165 # $instruct - The instruction to execute, e.g. 'north', ';about'
11166 #
11167 # Optional arguments
11168 # $excludeSession - The GA::Session to which the instruction should NOT be executed.
11169 # If 'undef', the instruction is executed in every session
11170 #
11171 # Return values
11172 # 'undef' on improper arguments
11173 # 1 otherwise
11174  
11175 my ($self, $instruct, $excludeSession, $check) = @_;
11176  
11177 # Check for improper arguments
11178 if (! defined $instruct || defined $check) {
11179  
11180 return $axmud::CLIENT->writeImproper($self->_objClass . '->broadcastInstruct', @_);
11181 }
11182  
11183 foreach my $session ($self->listSessions()) {
11184  
11185 if (! $excludeSession || ($excludeSession ne $session)) {
11186  
11187 $session->doInstruct($instruct);
11188 }
11189 }
11190  
11191 return 1;
11192 }
11193  
11194 # Buffers
11195  
11196 sub updateInstructBuffer {
11197  
11198 # Called by GA::Session->updateInstructBuffer when an instruction is added to the session's
11199 # buffer registry
11200 # Updates this client's own instruction buffer, creating a separate buffer object (with a
11201 # different ->number than the one created by the calling function)
11202 #
11203 # Expected arguments
11204 # $session - The calling GA::Session
11205 # $instruct - The instruction itself (e.g. ';setworld deathmud' or 'north;kill orc')
11206 # $type - The type of instruction: 'client' for a client command, 'world' for a
11207 # world command, 'perl' for a Perl command and 'echo' for an echo command
11208 #
11209 # Return values
11210 # 'undef' on improper arguments or if the buffer is not updated
11211 # Otherwise returns the buffer object created
11212  
11213 my ($self, $session, $instruct, $type, $check) = @_;
11214  
11215 # Local variables
11216 my $obj;
11217  
11218 # Check for improper arguments
11219 if (! defined $session || ! defined $instruct || ! defined $type || defined $check) {
11220  
11221 return $axmud::CLIENT->writeImproper($self->_objClass . '->updateInstructBuffer', @_);
11222 }
11223  
11224 if (! defined $self->instructBufferFirst) {
11225  
11226 # This the first instruction ever processed
11227 $self->ivPoke('instructBufferFirst', 0);
11228 }
11229  
11230 # Create a new buffer object for this instruction
11231 $obj = Games::Axmud::Buffer::Instruct->new(
11232 $session,
11233 'client',
11234 $self->instructBufferCount,
11235 $instruct,
11236 $type,
11237 $self->clientTime,
11238 );
11239  
11240 if (! $obj) {
11241  
11242 return undef;
11243  
11244 } else {
11245  
11246 # Update the instruction buffer
11247 $self->ivAdd('instructBufferHash', $obj->number, $obj);
11248 $self->ivIncrement('instructBufferCount');
11249 $self->ivPoke('instructBufferLast', ($self->instructBufferCount - 1));
11250  
11251 # If the buffer is full, remove the oldest line
11252 if ($self->instructBufferCount > $self->customInstructBufferSize) {
11253  
11254 $self->ivDelete('instructBufferHash', $self->instructBufferFirst);
11255 $self->ivIncrement('instructBufferFirst');
11256 }
11257  
11258 return $obj;
11259 }
11260 }
11261  
11262 sub updateCmdBuffer {
11263  
11264 # Called by GA::Session->updateCmdBuffer when a world command is added to the session's
11265 # buffer registry
11266 # Updates this client's own world command buffer, creating a separate buffer object (with a
11267 # different ->number than the one created by the calling function)
11268 #
11269 # Expected arguments
11270 # $session - The calling GA::Session
11271 # $cmd - The world command itself (e.g. 'north', 'kill orc')
11272 #
11273 # Return values
11274 # 'undef' on improper arguments or if the buffer can't be updated
11275 # Otherwise returns the buffer object created
11276  
11277 my ($self, $session, $cmd, $check) = @_;
11278  
11279 # Local variables
11280 my $obj;
11281  
11282 # Check for improper arguments
11283 if (! defined $session || ! defined $cmd || defined $check) {
11284  
11285 return $axmud::CLIENT->writeImproper($self->_objClass . '->updateCmdBuffer', @_);
11286 }
11287  
11288 if (! defined $self->cmdBufferFirst) {
11289  
11290 # This the first world command ever processed
11291 $self->ivPoke('cmdBufferFirst', 0);
11292 }
11293  
11294 # Create a new buffer object for this world command
11295 $obj = Games::Axmud::Buffer::Cmd->new(
11296 $session,
11297 'client',
11298 $self->cmdBufferCount,
11299 $cmd,
11300 $self->clientTime,
11301 );
11302  
11303 if (! $obj) {
11304  
11305 return undef;
11306  
11307 } else {
11308  
11309 # Update the world command buffer
11310 $self->ivAdd('cmdBufferHash', $obj->number, $obj);
11311 $self->ivIncrement('cmdBufferCount');
11312 $self->ivPoke('cmdBufferLast', ($self->cmdBufferCount - 1));
11313  
11314 # If the buffer is full, remove the oldest line
11315 if ($self->cmdBufferCount > $self->customCmdBufferSize) {
11316  
11317 $self->ivDelete('cmdBufferHash', $self->cmdBufferFirst);
11318 $self->ivIncrement('cmdBufferFirst');
11319 }
11320  
11321 return $obj;
11322 }
11323 }
11324  
11325 # Plugins
11326  
11327 sub loadPlugin {
11328  
11329 # Called by GA::Session->start, $self->loadPrivatePlugins, GA::Cmd::LoadPlugin->do and
11330 # ->TestPlugin->do
11331 # Attemps to load a Perl module as a plugin. Checks the file exists, that it is a Perl file,
11332 # that it has the right Axmud plugin header and that there are no compile errors, then
11333 # loads the plugin
11334 #
11335 # Axmud plugin headers have a fixed format. If the header is not in this format, the plugin
11336 # is not loaded
11337 # There can be any number of empty lines, or lines containing only comments, after the first
11338 # line. Lines after the package line can appear in any order; duplicate lines replace the
11339 # earlier one (so '#: Author: JRR Tolkien' replaces and earlier '#: Author: JK Rowling')
11340 # The format is case sensitive, except for the lines mentioned just below (so
11341 # '#: author: jk rowling' will not be recognised)
11342 #
11343 # The header is in the format:
11344 # #!/usr/bin/perl
11345 # package NAME;
11346 # #: Version: VERSION
11347 # #: Description: ONE LINE DESCRIPTION
11348 # #: Author: AUTHOR'S NAME (optional)
11349 # #: Copyright: COPYRIGHT MESSAGE (optional)
11350 # #: Require: AXMUD VERSION (optional)
11351 # #: Init: STRING (optional)
11352 #
11353 # NB NAME can't be the name of an existing plugin, or the client name (matching
11354 # $axmud::SCRIPT, case-insensitive)
11355 # NB AXMUD VERSION can be in the form 'v1.0.0' / 'V1.0.0' / '1.0.0'. If it's not a valid
11356 # version number, the plugin is not loaded
11357 # NB STRING is case-insensitive, and should be one of the strings 'enable', 'disable',
11358 # 'enabled' or 'disabled'. If it's not one of those strings, the default behaviour
11359 # (equivalent to 'enable') is used
11360 #
11361 # Expected arguments
11362 # $path - The full file path to the Perl module
11363 #
11364 # Optional arguments
11365 # $testFlag - If set to TRUE, the plugin isn't loaded, just tested. Set to FALSE (or
11366 # 'undef') otherwise
11367 #
11368 # Return values
11369 # 'undef' on improper arguments, if the plugin can't be loaded or if it has already been
11370 # loaded
11371 # Otherwise returns the name of the plugin loaded
11372  
11373 my ($self, $path, $testFlag, $check) = @_;
11374  
11375 # Local variables
11376 my (
11377 $string, $fileHandle, $line, $packageName, $exitFlag, $version, $descrip, $author,
11378 $copyright, $require, $init, $enabledFlag, $result, $obj, $null,
11379 );
11380  
11381 # Check for improper arguments
11382 if (! defined $path || defined $check) {
11383  
11384 return $axmud::CLIENT->writeImproper($self->_objClass . '->loadPlugin', @_);
11385 }
11386  
11387 if (! $testFlag) {
11388 $string = 'load failure';
11389 } else {
11390 $string = 'test failure';
11391 }
11392  
11393 # Check the file exists
11394 if (! -e $path) {
11395  
11396 if ($self->debugExplainPluginFlag) {
11397  
11398 $self->writeDebug('Plugin \'' . $path . '\' ' . $string . ': file doesn\'t exist');
11399 }
11400  
11401 return undef;
11402 }
11403  
11404 # Check the file is a Perl file by reading the first line, which should contain a Perl
11405 # shebang
11406 if (! open ($fileHandle, "<", $path)) {
11407  
11408 if ($self->debugExplainPluginFlag) {
11409  
11410 $self->writeDebug(
11411 'Plugin \'' . $path . '\' ' . $string . ': could not open file',
11412 );
11413 }
11414  
11415 return undef;
11416 }
11417  
11418 # Check the first line contains a Perl shebang
11419 $line = <$fileHandle>;
11420 if (! $line =~ /^#!\s*(.*perl\S*)/) {
11421  
11422 if ($self->debugExplainPluginFlag) {
11423  
11424 $self->writeDebug(
11425 'Plugin \'' . $path . '\' ' . $string . ': line is not Perl shebang',
11426 );
11427 }
11428  
11429 close $fileHandle;
11430  
11431 return undef;
11432 }
11433  
11434 # Read the next non-empty line to get the package name
11435 $line = $self->readPluginLine($fileHandle);
11436 if (! $line || ! ($line =~ m/^package\s+(.+)\;/)) {
11437  
11438 if ($self->debugExplainPluginFlag) {
11439  
11440 $self->writeDebug(
11441 'Plugin \'' . $path . '\' ' . $string . ': missing package name in plugin'
11442 . ' header',
11443 );
11444 }
11445  
11446 close $fileHandle;
11447  
11448 return undef;
11449  
11450 } else {
11451  
11452 $packageName = $1;
11453 }
11454  
11455 # The remaining header lines can occur in any order
11456 do {
11457  
11458 # Read the next non-empty line to get the version
11459 $line = $self->readPluginLine($fileHandle);
11460  
11461 if (! $line) {
11462  
11463 # Header has finished
11464 $exitFlag = TRUE;
11465  
11466 } else {
11467  
11468 if ($line =~ m/^\#\:\s+Version\:\s+/) {
11469  
11470 $line =~ s/^\#\:\s+Version\:\s+//;
11471 $version = $self->trimWhitespace($line);
11472  
11473 } elsif ($line =~ m/^\#\:\s+Description\:\s+/) {
11474  
11475 $line =~ s/^\#\:\s+Description\:\s+//;
11476 $descrip = $self->trimWhitespace($line);
11477  
11478 } elsif ($line =~ m/^\#\:\s+Author\:\s+/) {
11479  
11480 $line =~ s/^\#\:\s+Author\:\s+//;
11481 $author = $self->trimWhitespace($line);
11482  
11483 } elsif ($line =~ m/^\#\:\s+Copyright\:\s+/) {
11484  
11485 $line =~ s/^\#\:\s+Copyright\:\s+//;
11486 $copyright = $self->trimWhitespace($line);
11487  
11488 } elsif ($line =~ m/^\#\:\s+Require\:\s+[vV]?/) {
11489  
11490 $line =~ s/^\#\:\s+Require\:\s+[vV]?//;
11491 $require = $self->trimWhitespace($line);
11492  
11493 } elsif ($line =~ m/^\#\:\s+Init\:\s+/) {
11494  
11495 $line =~ s/^\#\:\s+Init\:\s+//;
11496 $init = lc($self->trimWhitespace($line));
11497  
11498 } else {
11499  
11500 # Header has finished
11501 $exitFlag = TRUE;
11502 }
11503 }
11504  
11505 } until ($exitFlag);
11506  
11507 # (Don't need to read the file any further)
11508 close $fileHandle;
11509  
11510 # Check that the package name is allowed
11511 if (lc($packageName) eq $axmud::NAME_SHORT) {
11512  
11513 if ($self->debugExplainPluginFlag) {
11514  
11515 $self->writeDebug(
11516 'Plugin \'' . $path . '\' ' . $string . ': package name \'' . $packageName
11517 . '\' is not allowed',
11518 );
11519 }
11520  
11521 return undef;
11522 }
11523  
11524 # Check that the compulsory version and description were specified
11525 if (! defined $version) {
11526  
11527 if ($self->debugExplainPluginFlag) {
11528  
11529 $self->writeDebug(
11530 'Plugin \'' . $path . '\' ' . $string . ': missing version in plugin header',
11531 );
11532 }
11533  
11534 return undef;
11535  
11536 } elsif (! defined $descrip) {
11537  
11538 if ($self->debugExplainPluginFlag) {
11539  
11540 $self->writeDebug(
11541 'Plugin \'' . $path . '\' ' . $string . ': missing description in plugin'
11542 . ' header',
11543 );
11544 }
11545  
11546 return undef;
11547 }
11548  
11549 # Check that the minimum Axmud version, if specified, is high enough
11550 if (
11551 defined $require
11552 && $self->convertVersion($require) > $self->convertVersion($axmud::VERSION)
11553 ) {
11554 if ($self->debugExplainPluginFlag) {
11555  
11556 $self->writeDebug(
11557 'Plugin \'' . $path . '\' ' . $string . ': minimum version \'' . $require
11558 . '\' is higher than current ' . $axmud::SCRIPT . ' version \''
11559 . $axmud::VERSION . '\'',
11560 );
11561 }
11562  
11563 return undef;
11564 }
11565  
11566 # Check that the init status, if specified, is a recognised string (and ignore it, if not)
11567 if (
11568 defined $init && $init ne 'enable' && $init ne 'disable' && $init ne 'enabled'
11569 && $init ne 'disabled'
11570 ) {
11571 $init = undef;
11572 }
11573  
11574 # Set whether the plugin starts enabled (default) or disabled
11575 if (! defined $init || $init eq 'enable' || $init eq 'enabled') {
11576 $enabledFlag = TRUE;
11577 } else {
11578 $enabledFlag = FALSE;
11579 }
11580  
11581 # Check that the plugin hasn't already been loaded (but don't bother if we're just testing
11582 # the file)
11583 if (! $testFlag && $self->ivExists('pluginHash', $packageName)) {
11584  
11585 # Plugin called $packageName already loaded
11586 if ($self->debugExplainPluginFlag) {
11587  
11588 $self->writeDebug(
11589 'Plugin \'' . $path . '\' ' . $string . ': plugin called \'' . $packageName
11590 . '\' has already been loaded',
11591 );
11592 }
11593  
11594 return undef;
11595 }
11596  
11597 # Check the file's syntax. System returns 0 on success, something else on failure
11598 if ($^O eq 'MSWin32') {
11599 $null = 'nul';
11600 } else {
11601 $null = '/dev/null';
11602 }
11603  
11604 $result = system("perl -c $path 2>$null >$null");
11605 if ($result ne '0') {
11606  
11607 if ($self->debugExplainPluginFlag) {
11608  
11609 $self->writeDebug(
11610 'Plugin \'' . $path . '\' ' . $string . ': Perl syntax check failed',
11611 );
11612 }
11613  
11614 return undef;
11615 }
11616  
11617 # If $testFlag is set, we don't need to actually load the plugin
11618 if ($testFlag) {
11619  
11620 # Operation complete
11621 return $packageName;
11622 }
11623  
11624 # Create a plugin object to handle the file
11625 $obj = Games::Axmud::Obj::Plugin->new(
11626 $packageName,
11627 $path,
11628 $version,
11629 $descrip,
11630 $enabledFlag,
11631 $author, # May be 'undef'
11632 $copyright, # May be 'undef'
11633 $require, # May be 'undef'
11634 $init, # May be 'undef'
11635 );
11636  
11637 if (! $obj) {
11638  
11639 # (Couldn't create object, error message already displayed)
11640 if ($self->debugExplainPluginFlag) {
11641  
11642 $self->writeDebug(
11643 'Plugin \'' . $path . '\' ' . $string . ': couldn\'t create plugin object',
11644 );
11645 }
11646  
11647 return undef;
11648 }
11649  
11650 # Update IVs
11651 $self->ivAdd('pluginHash', $packageName, $obj);
11652  
11653 # Attempt to load the plugin
11654 eval { Module::Load::load($path); };
11655 if ($@) {
11656  
11657 if ($self->debugExplainPluginFlag) {
11658  
11659 $self->writeDebug(
11660 'Plugin \'' . $path . '\' ' . $string . ': could not load plugin',
11661 );
11662 }
11663  
11664 $self->ivDelete('pluginHash', $packageName);
11665  
11666 return undef;
11667 }
11668  
11669 # Plugin loaded. If it should start disabled, disable it now
11670 if (! $enabledFlag) {
11671  
11672 $self->disablePlugin($packageName);
11673 }
11674  
11675 return $packageName;
11676 }
11677  
11678 sub loadPrivatePlugins {
11679  
11680 # Called by $self->start
11681 # Loads private plugins stored in the /private directory (which doesn't exist in public
11682 # releases of Axmud)
11683 #
11684 # Expected arguments
11685 # (none besides $self)
11686 #
11687 # Return values
11688 # 'undef' on improper arguments
11689 # 1 otherwise
11690  
11691 my ($self, $check) = @_;
11692  
11693 # Local variables
11694 my (@pathList, @modList);
11695  
11696 # Check for improper arguments
11697 if (defined $check) {
11698  
11699 return $axmud::CLIENT->writeImproper($self->_objClass . '->loadPrivatePlugins', @_);
11700 }
11701  
11702 if ($^O eq 'MSWin32') {
11703 @pathList = glob($axmud::SHARE_DIR . '\\private\\*.pm');
11704 } else {
11705 @pathList = glob($axmud::SHARE_DIR . '/private/*.pm');
11706 }
11707  
11708 foreach my $path (@pathList) {
11709  
11710 # Private plugins begin with an alpha-numeric character and end .pm; all other .pm files
11711 # in the directory must begin with an underline character
11712 # Remove all non-plugin files from the list
11713 if ($path =~ m/private[\\\/][[:alnum:]][[:word:]\s]*\.pm$/) {
11714  
11715 push (@modList, $path);
11716 }
11717 }
11718  
11719 # Load each plugin
11720 foreach my $path (@modList) {
11721  
11722 my $plugin = $self->loadPlugin($path);
11723 if (! $plugin) {
11724  
11725 $self->writeWarning(
11726 'Error loading the private plugin \'' . $path . '\'',
11727 $self->_objClass . '->loadPrivatePlugins',
11728 );
11729 }
11730 }
11731  
11732 return 1;
11733 }
11734  
11735 sub readPluginLine {
11736  
11737 # Called by $self->loadPlugin
11738 # Reads lines from an already opened plugin file, looking for the first line which isn't
11739 # empty (or contains only a comment that's not part of the header)
11740 # Returns the first matching line found
11741 #
11742 # Expected arguments
11743 # $fileHandle - The plugin file's filehandle
11744 #
11745 # Return values
11746 # 'undef' on improper arguments or if end-of-file is reached before the line is found
11747 # The first matching line found otherwise
11748  
11749 my ($self, $fileHandle, $check) = @_;
11750  
11751 # Check for improper arguments
11752 if (! defined $fileHandle || defined $check) {
11753  
11754 return $axmud::CLIENT->writeImproper($self->_objClass . '->readPluginLine', @_);
11755 }
11756  
11757 while (<$fileHandle>) {
11758  
11759 my $line = $_;
11760  
11761 chomp $line;
11762  
11763 if (
11764 $line
11765 && ! (
11766 $line =~ m/^\s+$/
11767 || $line =~ m/\s*\#[^\:]/
11768 )
11769 ) {
11770 # This is the line we're looking for
11771 return $line;
11772 }
11773 }
11774  
11775 # No matching line found
11776 return undef;
11777 }
11778  
11779 sub enablePlugin {
11780  
11781 # Called by GA::Cmd::EnablePlugin->do
11782 # Enables a loaded plugin, after an earlier call to $self->disablePlugin disabled it
11783 #
11784 # Expected arguments
11785 # $plugin - The name of the plugin to enable
11786 #
11787 # Return values
11788 # 'undef' on improper arguments or if a plugin called $plugin has not been loaded
11789 # 1 otherwise
11790  
11791 my ($self, $plugin, $check) = @_;
11792  
11793 # Local variables
11794 my ($pluginObj, $listRef);
11795  
11796 # Check for improper arguments
11797 if (! defined $plugin || defined $check) {
11798  
11799 return $axmud::CLIENT->writeImproper($self->_objClass . '->enablePlugin', @_);
11800 }
11801  
11802 # Find the plugin object
11803 $pluginObj = $self->ivShow('pluginHash', $plugin);
11804 if (! $pluginObj) {
11805  
11806 # Plugin not found
11807 return undef;
11808 }
11809  
11810 # Enable the plugin
11811 $pluginObj->set_enabledFlag(TRUE);
11812  
11813 # If any of this plugin's tasks defined text-to-speech attributes (TTS), update the
11814 # our customisable attribute hashes, re-assigning existing attributes to these tasks, if
11815 # necessary
11816 foreach my $taskName ($self->ivKeys('pluginTaskHash')) {
11817  
11818 if ($plugin eq $self->ivShow('pluginTaskHash', $taskName)) {
11819  
11820 $self->ttsAssignAttribs($taskName);
11821 }
11822 }
11823  
11824 # Restore the plugin's client commands. If there are any (built-in) client commands of the
11825 # same name, move them somewhere else, in case this plugin is disabled again at some point
11826 # in the future
11827 foreach my $pluginCmd ($self->ivKeys('pluginCmdHash')) {
11828  
11829 my ($otherPlugin, $pluginCmdObj, $originalCmdObj);
11830  
11831 $otherPlugin = $self->ivShow('pluginCmdHash', $pluginCmd);
11832 if ($otherPlugin eq $plugin) {
11833  
11834 if ($self->ivExists('clientCmdHash', $pluginCmd)) {
11835  
11836 # Restore the plugin command, and move the original to a special IV, so that it
11837 # too can be restored if the plugin is re-disabled at some point
11838 $pluginCmdObj = $self->ivShow('replaceClientCmdHash', $pluginCmd);
11839 $originalCmdObj = $self->ivShow('clientCmdHash', $pluginCmd);
11840 $self->ivAdd('replaceClientCmdHash', $pluginCmd, $originalCmdObj);
11841 $self->ivAdd('clientCmdHash', $pluginCmd, $pluginCmdObj);
11842  
11843 } else {
11844  
11845 # Just restore the plugin command
11846 $pluginCmdObj = $self->ivShow('replaceClientCmdHash', $pluginCmd);
11847 $self->ivAdd('clientCmdHash', $pluginCmd, $pluginCmdObj);
11848 $self->ivDelete('replaceClientCmdHash', $pluginCmd);
11849 }
11850 }
11851 }
11852  
11853 # Also restore the plugin's client commands (along with any group headings) to
11854 # $self->clientCmdPrettyList
11855 if ($self->ivExists('clientCmdReplacePrettyHash', $plugin)) {
11856  
11857 $listRef = $self->ivShow('clientCmdReplacePrettyHash', $plugin);
11858 if (defined $listRef && @$listRef) {
11859  
11860 $self->ivPush('clientCmdPrettyList', @$listRef);
11861 }
11862 }
11863  
11864 # Sensitise/desensitise menu bar/toolbar items, depending on current conditions
11865 $self->desktopObj->restrictWidgets();
11866  
11867 # Operation complete
11868 return 1;
11869 }
11870  
11871 sub disablePlugin {
11872  
11873 # Called by GA::Cmd::DisablePlugin->do
11874 # Disables a loaded plugin. Halts all of the plugin's tasks (new tasks from the plugin
11875 # can't start). Closes any windows of the types added by the plugin. Disables any client
11876 # commands added by the plugin
11877 #
11878 # Expected arguments
11879 # $plugin - The name of the plugin to disable
11880 #
11881 # Return values
11882 # 'undef' on improper arguments or if a plugin called $plugin has not been loaded
11883 # 1 otherwise
11884  
11885 my ($self, $plugin, $check) = @_;
11886  
11887 # Local variables
11888 my ($pluginObj, $listRef, $index, $matchFlag);
11889  
11890 # Check for improper arguments
11891 if (! defined $plugin || defined $check) {
11892  
11893 return $axmud::CLIENT->writeImproper($self->_objClass . '->disablePlugin', @_);
11894 }
11895  
11896 # Find the plugin object
11897 $pluginObj = $self->ivShow('pluginHash', $plugin);
11898 if (! $pluginObj) {
11899  
11900 # Plugin not found
11901 return undef;
11902 }
11903  
11904 # Disable the plugin
11905 $pluginObj->set_enabledFlag(FALSE);
11906  
11907 # If any of this plugin's tasks are running, in any session, halt them
11908 foreach my $session ($self->listSessions()) {
11909  
11910 foreach my $taskObj ($session->ivValues('currentTaskHash')) {
11911  
11912 my $thisPlugin = $self->ivShow('pluginTaskHash', $taskObj->name);
11913  
11914 if (defined $thisPlugin && $thisPlugin eq $plugin) {
11915  
11916 # Halt the task
11917 $session->pseudoCmd('halttask ' . $taskObj->uniqueName);
11918 }
11919 }
11920 }
11921  
11922 # If any of our customisable text-to-speech (TTS) hashes have assigned an attribute to
11923 # this plugin's tasks, re-assign the attributes to a built-in task, if possible, or
11924 # otherwise remove the attributes completely
11925 foreach my $taskName ($self->ivKeys('pluginTaskHash')) {
11926  
11927 if ($plugin eq $self->ivShow('pluginTaskHash', $taskName)) {
11928  
11929 $self->ttsResetAttribs($taskName);
11930 }
11931 }
11932  
11933 # Close any 'free' windows added by the plugin
11934 foreach my $winObj
11935 (sort {$a->number <=> $b->number} ($self->desktopObj->ivValues('freeWinHash')))
11936 {
11937 my $thisPlugin = $self->ivShow('pluginFreeWinHash', $winObj->_objClass);
11938 if (defined $thisPlugin && $thisPlugin eq $plugin) {
11939  
11940 # Close the window
11941 $winObj->winDestroy();
11942 }
11943 }
11944  
11945 # Close any 'grid' windows added by the plugin
11946 foreach my $winObj
11947 (sort {$a->number <=> $b->number} ($self->desktopObj->ivValues('freeWinHash')))
11948 {
11949 my $thisPlugin = $self->ivShow('pluginGridWinHash', $winObj->_objClass);
11950 if (defined $thisPlugin && $thisPlugin eq $plugin) {
11951  
11952 # For 'main' windows, terminate any session using the window
11953 if ($winObj->winType eq 'main') {
11954  
11955 foreach my $session
11956 (sort {$a->number <=> $b->number} ($self->ivValues('sessionHash')))
11957 {
11958 if ($session->mainWin && $session->mainWin eq $winObj) {
11959  
11960 $self->stopSession($session);
11961 }
11962 }
11963 }
11964  
11965 # Close the window
11966 $winObj->winDestroy();
11967 }
11968 }
11969  
11970 # If the plugin loaded any client commands that replaced an existing client command of the
11971 # same name, restore the original. Otherwise, remove the command completely
11972 foreach my $pluginCmd ($self->ivKeys('pluginCmdHash')) {
11973  
11974 my ($otherPlugin, $pluginCmdObj, $originalCmdObj);
11975  
11976 $otherPlugin = $self->ivShow('pluginCmdHash', $pluginCmd);
11977 if ($otherPlugin eq $plugin) {
11978  
11979 if ($self->ivExists('replaceClientCmdHash', $pluginCmd)) {
11980  
11981 # Restore the original, and move the plugin command to a special IV, so that it
11982 # too can be restored if the plugin is re-enabled at some point
11983 $originalCmdObj = $self->ivShow('replaceClientCmdHash', $pluginCmd);
11984 $pluginCmdObj = $self->ivShow('clientCmdHash', $pluginCmd);
11985 $self->ivAdd('replaceClientCmdHash', $pluginCmd, $pluginCmdObj);
11986 $self->ivAdd('clientCmdHash', $pluginCmd, $originalCmdObj);
11987  
11988 } else {
11989  
11990 # Just move the plugin command to a special IV, so that it can be restored if
11991 # the plugin is re-enabled
11992 $pluginCmdObj = $self->ivShow('clientCmdHash', $pluginCmd);
11993 $self->ivAdd('replaceClientCmdHash', $pluginCmd, $pluginCmdObj);
11994 $self->ivDelete('clientCmdHash', $pluginCmd);
11995 }
11996 }
11997 }
11998  
11999 # Any plugin client commands should also have been added to $self->clientCmdPrettyList.
12000 # Attempt to remove them
12001 if ($self->ivExists('clientCmdReplacePrettyHash', $plugin)) {
12002  
12003 $listRef = $self->ivShow('clientCmdReplacePrettyHash', $plugin);
12004 if (defined $listRef && @$listRef) {
12005  
12006 # Search through $self->clientCmdPrettyList, looking for an exact match for the
12007 # contents of the list in $listRef
12008 $index = -1;
12009 do {
12010  
12011 my $failFlag;
12012  
12013 $index++;
12014  
12015 if ($self->ivIndex('clientCmdPrettyList', $index) eq $$listRef[0]) {
12016  
12017 # Found the first item in $listRef; do the rest of the items match?
12018 OUTER: for (my $count = $index; $count < scalar @$listRef; $count++) {
12019  
12020 if (
12021 $self->ivIndex('clientCmdPrettyList', $count) ne $$listRef[$count]
12022 ) {
12023 # Nope! Try again on the next iteration of the do loop
12024 $failFlag = TRUE;
12025 last OUTER;
12026 }
12027 }
12028  
12029 if (! $failFlag) {
12030  
12031 # Found a complete match
12032 $matchFlag = TRUE;
12033 }
12034 }
12035  
12036 } until ($matchFlag || $index == ((scalar $self->clientCmdPrettyList) - 1));
12037  
12038 if ($matchFlag) {
12039  
12040 # Remove the group headings and client commands from this plugin
12041 $self->ivSplice('clientCmdPrettyList', $index, scalar @$listRef);
12042 }
12043 }
12044 }
12045  
12046 # Sensitise/desensitise menu bar/toolbar items, depending on current conditions
12047 $self->desktopObj->restrictWidgets();
12048  
12049 # Operation complete
12050 return 1;
12051 }
12052  
12053 sub addPluginCmds {
12054  
12055 # Called by any Axmud plugin
12056 # Adds client commands defined in the plugin
12057 #
12058 # Expected arguments
12059 # $plugin - The plugin's main package (declared in the file header)
12060 #
12061 # Optional arguments
12062 # @list - A list of client commands, grouped thematically (using the same format as
12063 # $self->clientCmdPrettyList uses). If the list is empty, no commands are
12064 # added
12065 #
12066 # Return values
12067 # 'undef' on improper arguments or if a client command object can't be created
12068 # Otherwise returns the number of client command objects created (may be 0)
12069  
12070 my ($self, $plugin, @list) = @_;
12071  
12072 # Local variables
12073 my (
12074 $pluginObj, $count,
12075 @clientCmdList, @clientCmdPrettyList,
12076 %clientCmdHash, %replaceClientCmdHash, %userCmdHash, %pluginCmdHash,
12077 );
12078  
12079 # Check for improper arguments
12080 if (! defined $plugin) {
12081  
12082 return $axmud::CLIENT->writeImproper($self->_objClass . '->addPluginCmds', @_);
12083 }
12084  
12085 # Find the plugin object
12086 $pluginObj = $self->ivShow('pluginHash', $plugin);
12087 if (! $pluginObj) {
12088  
12089 # Plugin not found - a very unlikely occurrence for this function, but it's worth
12090 # checking anyway
12091 return undef;
12092 }
12093  
12094 # If no commands specified, nothing to add
12095 if (! @list) {
12096  
12097 return 0;
12098 }
12099  
12100 # Import GA::Client IVs; they are only updated if all commands are sucessfully added
12101 %clientCmdHash = $self->clientCmdHash;
12102 %replaceClientCmdHash = $self->replaceClientCmdHash;
12103 @clientCmdList = $self->clientCmdList;
12104 %userCmdHash = $self->userCmdHash;
12105 @clientCmdPrettyList = $self->clientCmdPrettyList;
12106 %pluginCmdHash = $self->pluginCmdHash;
12107  
12108 # (Code adapted from $self->setupCmds)
12109 $count = 0;
12110 foreach my $string (@list) {
12111  
12112 my ($replaceFlag, $package, $obj);
12113  
12114 # @list contains a list of commands, grouped under headings. The headings begin with a
12115 # '@' character
12116 if (substr ($string, 0, 1) ne '@') {
12117  
12118 # Not a heading. If there's an existing command of the same name, remove it
12119 if (exists $clientCmdHash{lc($string)}) {
12120  
12121 # Remove the existing client command, but don't change any user commands; they
12122 # stay the same when the plugin command is loaded
12123 $replaceFlag = TRUE;
12124 $replaceClientCmdHash{lc($string)} = $clientCmdHash{lc($string)};
12125 delete $clientCmdHash{lc($string)};
12126 }
12127  
12128 # Create a Perl object
12129 $package = 'Games::Axmud::Cmd::Plugin::' . $string;
12130 $obj = $package->new();
12131 if (! $obj) {
12132  
12133 return $self->writeError(
12134 'Could not create client command \'' . $self->cmdSep . lc($string) . '\'',
12135 $self->_objClass . '->addPluginCmds',
12136 );
12137 }
12138  
12139 # Set up user commands corresponding to this client command (but not if it's
12140 # replacing an existing command of the same name)
12141 if (! $replaceFlag) {
12142  
12143 foreach my $userCmd ($obj->defaultUserCmdList) {
12144  
12145 # Check the user command isn't already in use by another client command
12146 if (exists $userCmdHash{lc($userCmd)}) {
12147  
12148 # (Allow writing to something other than GA::Session - there are no
12149 # sessions yet)
12150 return $self->writeError(
12151 'Duplicate user command \'' . $userCmd . '\' pointing at client'
12152 . ' command \'' . lc($string) . '\'',
12153 $self->_objClass . '->setupCmds',
12154 );
12155  
12156 } else {
12157  
12158 # Add the user command to the GA::Client's hash
12159 $userCmdHash{lc($userCmd)} = lc($string);
12160 }
12161 }
12162 }
12163  
12164 # Update IVs
12165 $count++;
12166  
12167 $clientCmdHash{lc($string)} = $obj;
12168 push (@clientCmdList, lc($string));
12169 $pluginCmdHash{lc($string)} = $plugin;
12170 }
12171  
12172 # Both headings and command names are added to ->clientCmdPrettyList
12173 push (@clientCmdPrettyList, $string);
12174 }
12175  
12176 # No errors, so we can now update the GA::Client IVs (if any command objects were actually
12177 # added)
12178 if ($count) {
12179  
12180 $self->ivPoke('clientCmdHash', %clientCmdHash);
12181 $self->ivPoke('replaceClientCmdHash', %replaceClientCmdHash);
12182 $self->ivPoke('clientCmdList', @clientCmdList);
12183 $self->ivPoke('userCmdHash', %userCmdHash);
12184 $self->ivPoke('clientCmdPrettyList', @clientCmdPrettyList);
12185 $self->ivPoke('pluginCmdHash', %pluginCmdHash);
12186  
12187 $self->ivAdd('clientCmdReplacePrettyHash', $plugin, \@list);
12188 }
12189  
12190 # Operation complete
12191 return $count;
12192 }
12193  
12194 sub addPluginTasks {
12195  
12196 # Called by any Axmud plugin
12197 # Adds tasks defined in the plugin
12198 #
12199 # Expected arguments
12200 # $plugin - The plugin's main package (declared in the file header)
12201 #
12202 # Optional arguments
12203 # @list - A list containing groups of 3 elements, in the form
12204 # (task_package, task_formal_name, reference_to_task_label_list)
12205 # - ...where 'task_package' is the package name of the Perl object for the
12206 # task (e.g. 'Games::Axmud::Task::MyCoolTask'), 'task_package_name' is
12207 # the task's formal name, stored in ->task (e.g. 'my_cool_task'), and
12208 # 'reference_to_task_label_list' is a list of task labels (e.g.
12209 # 'mct', 'mycool', 'mycooltask'. If the list is empty, no tasks are
12210 # added
12211 #
12212 # Return values
12213 # 'undef' on improper arguments or if a task can't be added
12214 # Otherwise returns the number of tasks added (may be 0)
12215  
12216 my ($self, $plugin, @list) = @_;
12217  
12218 # Local variables
12219 my (
12220 $pluginObj, $count,
12221 @newTaskList,
12222 %taskPackageHash, %taskLabelHash, %pluginTaskHash,
12223 );
12224  
12225 # Check for improper arguments
12226 if (! defined $plugin) {
12227  
12228 return $axmud::CLIENT->writeImproper($self->_objClass . '->addPluginTasks', @_);
12229 }
12230  
12231 # Find the plugin object
12232 $pluginObj = $self->ivShow('pluginHash', $plugin);
12233 if (! $pluginObj) {
12234  
12235 # Plugin not found - a very unlikely occurrence for this function, but it's worth
12236 # checking anyway
12237 return undef;
12238 }
12239  
12240 # Import GA::Client IVs; they are only updated if all tasks are sucessfully added
12241 %taskPackageHash = $self->taskPackageHash;
12242 %taskLabelHash = $self->taskLabelHash;
12243 %pluginTaskHash = $self->pluginTaskHash;
12244  
12245 # (Code adapted from $self->setupCmds)
12246 $count = 0;
12247 if (@list) {
12248  
12249 do {
12250  
12251 my ($packageName, $taskName, $listRef);
12252  
12253 $packageName = shift @list;
12254 $taskName = shift @list;
12255 $listRef = shift @list;
12256  
12257 if (! $packageName) {
12258  
12259 return $self->writeError(
12260 'Could not add task (no package name specified)',
12261 $self->_objClass . '->addPluginTasks',
12262 );
12263  
12264 } elsif (! $taskName || ! defined $listRef) {
12265  
12266 return $self->writeError(
12267 'Could not add task (invalid formal name or undefined label list)',
12268 $self->_objClass . '->addPluginTasks',
12269 );
12270 }
12271  
12272 # (Code adapted from GA::Cmd::AddTaskPackage->do)
12273  
12274 # Check that no tasks of this type are running in any session
12275 foreach my $session ($self->listSessions()) {
12276  
12277 if ($session->ivExists('currentTaskNameHash', $taskName)) {
12278  
12279 return $self->writeError(
12280 'Can\'t change the package name for the task \'' . $taskName
12281 . '\' because the task is running in at least one session (try halting'
12282 . ' the task first)',
12283 $self->_objClass . '->addPluginTasks',
12284 );
12285 }
12286 }
12287  
12288 # Check that $taskName is not too long
12289 if (length $taskName > 16) {
12290  
12291 return $self->writeError(
12292 'Task name \'' . $taskName . '\' is too long (max 16 characters)',
12293 $self->_objClass . '->addPluginTasks',
12294 );
12295 }
12296  
12297 # (Code adapted from GA::Cmd::AddTaskLabel->do)
12298  
12299 # Check that all the labels in $listRef don't already exist, and that the labels are
12300 # allowed
12301 foreach my $label (@$listRef) {
12302  
12303 if (exists $taskLabelHash{$label} && $taskLabelHash{$label} ne $taskName) {
12304  
12305 return $self->writeError(
12306 'The label \'' . $label . '\' already exists (and points to the \''
12307 . $taskLabelHash{$label} . '\' task)',
12308 $self->_objClass . '->addPluginTasks',
12309 );
12310 }
12311  
12312 if (! $self->nameCheck($label, 32)) {
12313  
12314 return $self->writeError(
12315 'Illegal task label name \'' . $label . '\'',
12316 $self->_objClass . '->addPluginTasks',
12317 );
12318 }
12319 }
12320  
12321 # Add the task package name and labels (overwrite identical entries, if they
12322 # already exist)
12323 $count++;
12324 $taskPackageHash{$taskName} = $packageName;
12325 foreach my $label (@$listRef) {
12326  
12327 $taskLabelHash{$label} = $taskName;
12328 }
12329  
12330 # Mark the task as having been added by the plugin
12331 $pluginTaskHash{$taskName} = $plugin;
12332  
12333 # Preserve the new taskname temporarily
12334 push (@newTaskList, $taskName);
12335  
12336 } until (! @list);
12337 }
12338  
12339 # No errors, so we can now update the GA::Client IVs (if any tasks were actually added)
12340 if ($count) {
12341  
12342 $self->ivPoke('taskPackageHash', %taskPackageHash);
12343 $self->ivPoke('taskLabelHash', %taskLabelHash);
12344 $self->ivPoke('pluginTaskHash', %pluginTaskHash);
12345 }
12346  
12347 # We can also update our customisable text-to-speech (TTS) hashes, so that if the same
12348 # TTS attributes are used by multiple tasks, this plugin's tasks take priority
12349 foreach my $taskName (@newTaskList) {
12350  
12351 $self->ttsAssignAttribs($taskName);
12352 }
12353  
12354 # Operation complete
12355 return $count;
12356 }
12357  
12358 sub addPluginGridWins {
12359  
12360 # Called by any Axmud plugin
12361 # Adds 'grid' windows defined in the plugin
12362 #
12363 # Expected arguments
12364 # $plugin - The plugin's main package (declared in the file header)
12365 #
12366 # Optional arguments
12367 # @list - A list of 'grid' window package names (in groups of 1 element). If the
12368 # list is empty, no 'grid' windows are added. Duplicates are not added
12369 #
12370 # Return values
12371 # 'undef' on improper arguments or if a 'grid' window package can't be added
12372 # Otherwise returns the number of 'grid' window packages added (may be 0)
12373  
12374 my ($self, $plugin, @list) = @_;
12375  
12376 # Local variables
12377 my ($pluginObj, $count);
12378  
12379 # Check for improper arguments
12380 if (! defined $plugin) {
12381  
12382 return $axmud::CLIENT->writeImproper($self->_objClass . '->addPluginGridWins', @_);
12383 }
12384  
12385 # Find the plugin object
12386 $pluginObj = $self->ivShow('pluginHash', $plugin);
12387 if (! $pluginObj) {
12388  
12389 # Plugin not found - a very unlikely occurrence for this function, but it's worth
12390 # checking anyway
12391 return undef;
12392 }
12393  
12394 # Don't add duplicates
12395 $count = 0;
12396 foreach my $package (@list) {
12397  
12398 if (! $self->ivExists('pluginGridWinHash', $package)) {
12399  
12400 $self->ivAdd('pluginGridWinHash', $package, $plugin);
12401 $count++;
12402 }
12403 }
12404  
12405 # Operation complete
12406 return $count;
12407 }
12408  
12409 sub addPluginFreeWins {
12410  
12411 # Called by any Axmud plugin
12412 # Adds 'free' windows defined in the plugin
12413 #
12414 # Expected arguments
12415 # $plugin - The plugin's main package (declared in the file header)
12416 #
12417 # Optional arguments
12418 # @list - A list of 'free' window package names (in groups of 1 element); should
12419 # not include any 'dialogue' windows. If the list is empty, no 'free'
12420 # windows are added. Duplicates are not added
12421 #
12422 # Return values
12423 # 'undef' on improper arguments or if a 'free' window package can't be added
12424 # Otherwise returns the number of 'free' window packages added (may be 0)
12425  
12426 my ($self, $plugin, @list) = @_;
12427  
12428 # Local variables
12429 my ($pluginObj, $count);
12430  
12431 # Find the plugin object
12432 $pluginObj = $self->ivShow('pluginHash', $plugin);
12433 if (! $pluginObj) {
12434  
12435 # Plugin not found - a very unlikely occurrence for this function, but it's worth
12436 # checking anyway
12437 return undef;
12438 }
12439  
12440 # Check for improper arguments
12441 if (! defined $plugin) {
12442  
12443 return $axmud::CLIENT->writeImproper($self->_objClass . '->addPluginFreeWins', @_);
12444 }
12445  
12446 # Don't add duplicates
12447 $count = 0;
12448 foreach my $package (@list) {
12449  
12450 if (! $self->ivExists('pluginFreeWinHash', $package)) {
12451  
12452 $self->ivAdd('pluginFreeWinHash', $package, $plugin);
12453 $count++;
12454 }
12455 }
12456  
12457 # Operation complete
12458 return $count;
12459 }
12460  
12461 sub addPluginStripObjs {
12462  
12463 # Called by any Axmud plugin
12464 # Adds strip objects defined in the plugin. Note that if an existing strip object with the
12465 # same package name already exists in $self->customStripHash, it is not replaced, and this
12466 # plugin's strip object does not become available for use
12467 #
12468 # Expected arguments
12469 # $plugin - The plugin's main package (declared in the file header)
12470 # $stripPackage - The package name for the strip object, e.g.
12471 # 'Games::Axmud::Strip::MyObj'
12472 # $descrip - A short description, e.g. 'Test strip object'
12473 #
12474 # Return values
12475 # 'undef' on improper arguments or if the plugin's strip object can't be added
12476 # 1 on success
12477  
12478 my ($self, $plugin, $stripPackage, $descrip, $check) = @_;
12479  
12480 # Local variables
12481 my $pluginObj;
12482  
12483 # Check for improper arguments
12484 if (! defined $plugin || ! defined $stripPackage || ! defined $descrip || defined $check) {
12485  
12486 return $axmud::CLIENT->writeImproper($self->_objClass . '->addPluginStripObjs', @_);
12487 }
12488  
12489 # Find the plugin object
12490 $pluginObj = $self->ivShow('pluginHash', $plugin);
12491 if (! $pluginObj) {
12492  
12493 # Plugin not found - a very unlikely occurrence for this function, but it's worth
12494 # checking anyway
12495 return undef;
12496 }
12497  
12498 # Check that a strip object with the same package name doesn't already exist
12499 if ($self->ivShow('customStripHash', $stripPackage)) {
12500  
12501 return undef;
12502 }
12503  
12504 # Update IVs
12505 $self->ivAdd('customStripHash', $stripPackage, $descrip);
12506 $self->ivAdd('pluginStripObjHash', $stripPackage, $plugin);
12507  
12508 # Operation complete
12509 return 1;
12510 }
12511  
12512 sub addPluginTableObjs {
12513  
12514 # Called by any Axmud plugin
12515 # Adds table objects defined in the plugin. Note that if an existing table object with the
12516 # same package name already exists in $self->customTableHash, it is not replaced, and this
12517 # plugin's table object does not become available for use
12518 #
12519 # Expected arguments
12520 # $plugin - The plugin's main package (declared in the file header)
12521 # $tablePackage - The package name for the table object, e.g.
12522 # 'Games::Axmud::Table::MyObj'
12523 # $descrip - A short description, e.g. 'Test table object'
12524 #
12525 # Return values
12526 # 'undef' on improper arguments or if the plugin's table object can't be added
12527 # 1 on success
12528  
12529 my ($self, $plugin, $tablePackage, $descrip, $check) = @_;
12530  
12531 # Local variables
12532 my $pluginObj;
12533  
12534 # Check for improper arguments
12535 if (! defined $plugin || ! defined $tablePackage || ! defined $descrip || defined $check) {
12536  
12537 return $axmud::CLIENT->writeImproper($self->_objClass . '->addPluginTableObjs', @_);
12538 }
12539  
12540 # Find the plugin object
12541 $pluginObj = $self->ivShow('pluginHash', $plugin);
12542 if (! $pluginObj) {
12543  
12544 # Plugin not found - a very unlikely occurrence for this function, but it's worth
12545 # checking anyway
12546 return undef;
12547 }
12548  
12549 # Check that a table object with the same package name doesn't already exist
12550 if ($self->ivShow('customTableHash', $tablePackage)) {
12551  
12552 return undef;
12553 }
12554  
12555 # Update IVs
12556 $self->ivAdd('customTableHash', $tablePackage, $descrip);
12557 $self->ivAdd('pluginTableObjHash', $tablePackage, $plugin);
12558  
12559 # Operation complete
12560 return 1;
12561 }
12562  
12563 sub addPluginCages {
12564  
12565 # Called by any Axmud plugin
12566 # Adds cages defined in the plugin
12567 #
12568 # Expected arguments
12569 # $plugin - The plugin's main package (declared in the file header)
12570 #
12571 # Optional arguments
12572 # @list - A list containing groups of 3 elements, in the form
12573 # (cage_package, cage_type, edit_win_package)
12574 # - ...where 'cage_package' is the package name of the Perl object for the
12575 # cage (e.g. 'Games::Axmud::Cage::MyCage'), 'cage_type' is the cage's
12576 # type, e.g. 'mycage' (max 8 characters) and 'edit_win_package' is the
12577 # package name of the cage's 'edit' window (or 'undef', if the cage
12578 # doesn't have an 'edit' window). If the list is empty, no cages are added
12579 # - NB Cage 'edit' windows must also be added to this client via a call to
12580 # $self->addPluginFreeWins
12581 #
12582 # Return values
12583 # 'undef' on improper arguments or if a task can't be added
12584 # Otherwise returns the number of cages added (may be 0)
12585  
12586 my ($self, $plugin, @list) = @_;
12587  
12588 # Local variables
12589 my (
12590 $pluginObj, $count,
12591 @cageTypeList,
12592 %pluginCageHash, %pluginCagePackageHash, %pluginCageEditWinHash,
12593 );
12594  
12595 # Check for improper arguments
12596 if (! defined $plugin) {
12597  
12598 return $axmud::CLIENT->writeImproper($self->_objClass . '->addPluginCages', @_);
12599 }
12600  
12601 # Find the plugin object
12602 $pluginObj = $self->ivShow('pluginHash', $plugin);
12603 if (! $pluginObj) {
12604  
12605 # Plugin not found - a very unlikely occurrence for this function, but it's worth
12606 # checking anyway
12607 return undef;
12608 }
12609  
12610 # Import GA::Client IVs; they are only updated if all cages are sucessfully added
12611 @cageTypeList = $self->cageTypeList;
12612 %pluginCageHash = $self->pluginCageHash;
12613 %pluginCagePackageHash = $self->pluginCagePackageHash;
12614 %pluginCageEditWinHash = $self->pluginCageEditWinHash;
12615  
12616 # (Code adapted from $self->setupCmds)
12617 $count = 0;
12618 if (@list) {
12619  
12620 do {
12621  
12622 my ($packageName, $cageType, $editWinPackage);
12623  
12624 $packageName = shift @list;
12625 $cageType = shift @list;
12626 $editWinPackage = shift @list; # Can be 'undef'
12627  
12628 if (! $packageName) {
12629  
12630 return $self->writeError(
12631 'Could not add cage (no package name specified)',
12632 $self->_objClass . '->addPluginCages',
12633 );
12634  
12635 } elsif (! $cageType) {
12636  
12637 return $self->writeError(
12638 'Could not add cage (no cage type specified)',
12639 $self->_objClass . '->addPluginCages',
12640 );
12641 }
12642  
12643 # Check that $cageType is not too long
12644 if (length $cageType > 8) {
12645  
12646 return $self->writeError(
12647 'Cage type \'' . $cageType . '\' is too long (max 8 characters)',
12648 $self->_objClass . '->addPluginCages',
12649 );
12650 }
12651  
12652 # Check that the cage type doesn't already exist
12653 foreach my $item (@cageTypeList) {
12654  
12655 if ($item eq $cageType) {
12656  
12657 return $self->writeError(
12658 'The cage type \'' . $cageType . '\' already exists',
12659 $self->_objClass . '->addPluginCages',
12660 );
12661 }
12662 }
12663  
12664 # Add the cage
12665 $count++;
12666 push (@cageTypeList, $cageType);
12667 $pluginCageHash{$cageType} = $plugin;
12668 $pluginCagePackageHash{$cageType} = $packageName;
12669 $pluginCageEditWinHash{$cageType} = $editWinPackage;
12670  
12671 } until (! @list);
12672 }
12673  
12674 # No errors, so we can now update the GA::Client IVs (if any cages were actually added)
12675 if ($count) {
12676  
12677 $self->ivPoke('cageTypeList', @cageTypeList);
12678 $self->ivPoke('pluginCageHash', %pluginCageHash);
12679 $self->ivPoke('pluginCagePackageHash', %pluginCagePackageHash);
12680 $self->ivPoke('pluginCageEditWinHash', %pluginCageEditWinHash);
12681  
12682 # Update existing profiles
12683 foreach my $session ($self->listSessions()) {
12684  
12685 # The TRUE argument means 'don't display a message for each cage created/destroyed'
12686 $session->updateCages(TRUE);
12687 }
12688 }
12689  
12690 # Operation complete
12691 return $count;
12692 }
12693  
12694 sub addPluginMenus {
12695  
12696 # Called by any Axmud plugin
12697 # Adds menu items defined in the plugin to any menu strip object (GA::Strip::MenuBar)
12698 # displayed in any 'internal' window while the client is running (and the plugin is
12699 # enabled)
12700 #
12701 # Expected arguments
12702 # $plugin - The plugin's main package (declared in the file header)
12703 #
12704 # Optional arguments
12705 # $funcRef - Reference to a function which contain the code to add menu items to a
12706 # Gtk3::Menu widget, pre-existing or created by this function. The
12707 # referenced function must accept the strip object and Gtk3::Menu as
12708 # arguments, and return 'undef' on failure or 1 on success
12709 #
12710 # Return values
12711 # 'undef' on improper arguments or if the menu items can't be added
12712 # 1 otherwise
12713  
12714 my ($self, $plugin, $funcRef, $check) = @_;
12715  
12716 # Local variables
12717 my ($pluginObj, $subMenu);
12718  
12719 # Check for improper arguments
12720 if (! defined $plugin || ! defined $funcRef || defined $check) {
12721  
12722 return $axmud::CLIENT->writeImproper($self->_objClass . '->addPluginWidgets', @_);
12723 }
12724  
12725 # Find the plugin object
12726 $pluginObj = $self->ivShow('pluginHash', $plugin);
12727 if (! $pluginObj) {
12728  
12729 # Plugin not found - a very unlikely occurrence for this function, but it's worth
12730 # checking anyway
12731 return undef;
12732 }
12733  
12734 # Each plugin can only call this function once
12735 if ($self->ivExists('pluginMenuFuncHash', $plugin)) {
12736  
12737 return undef;
12738  
12739 } else {
12740  
12741 $self->ivAdd('pluginMenuFuncHash', $plugin, $funcRef);
12742 }
12743  
12744 # Any 'internal' windows which already exist and which have a menu strip object should add a
12745 # sub-menu for this plugin now; any new 'internal' windows created from now will
12746 # automatically call the referenced function to add their own sub-menus
12747 foreach my $winObj ($self->desktopObj->ivValues('gridWinHash')) {
12748  
12749 my ($stripObj, $subMenu);
12750  
12751 if (
12752 $winObj->winType eq 'main'
12753 || $winObj->winType eq 'protocol'
12754 || $winObj->winType eq 'custom'
12755 ) {
12756 $stripObj = $winObj->ivShow('firstStripHash', 'Games::Axmud::Strip::MenuBar');
12757 if ($stripObj) {
12758  
12759 $subMenu = $stripObj->addPluginWidgets($plugin);
12760 if (! $subMenu) {
12761  
12762 return undef;
12763 }
12764  
12765 # Call the referenced function to add menu items to this sub-menu
12766 if (! &$funcRef($stripObj, $subMenu)) {
12767  
12768 return undef;
12769 }
12770  
12771 # Update the window to show the new menu items
12772 $winObj->winShowAll($self->_objClass . '->addPluginMenus');
12773 }
12774 }
12775 }
12776  
12777 return 1;
12778 }
12779  
12780 sub addPluginMxpFilters {
12781  
12782 # Called by any Axmud plugin
12783 # Adds the plugin function that's used to apply MXP file filters
12784 #
12785 # Expected arguments
12786 # $plugin - The plugin's main package (declared in the file header)
12787 # $funcRef - Reference to the function that does the conversion
12788 #
12789 # Return values
12790 # 'undef' on improper arguments
12791 # 1 otherwise
12792  
12793 my ($self, $plugin, $funcRef, $check) = @_;
12794  
12795 # Local variables
12796 my $pluginObj;
12797  
12798 # Check for improper arguments
12799 if (! defined $plugin || ! defined $funcRef || defined $check) {
12800  
12801 return $axmud::CLIENT->writeImproper($self->_objClass . '->addPluginMxpFilters', @_);
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 # Update IVs
12814 $self->ivAdd('pluginMxpFilterHash', $plugin, $funcRef);
12815  
12816 # Operation complete
12817 return 1;
12818 }
12819  
12820 sub addPluginMcpPackages {
12821  
12822 # Called by any Axmud plugin
12823 # Adds the MCP package object (inheriting from GA::Generic::Mcp) defined by the plugin
12824 #
12825 # Expected arguments
12826 # $plugin - The plugin's main package (declared in the file header)
12827 # $name - The name of the MCP package, e.g. 'mcp-negotiate-can'. Must conform to
12828 # MCP's package name rules (see the MCP spec for more information);
12829 # this function won't allow you to add 'official' MCP packages whose
12830 # name starts 'mcp-'
12831 # $perlPackage - The Perl package for the object, e.g. Games::Axmud::Mcp::MyPackage
12832 # $minVersion - The minimum package version supported (e.g. '1.0', '2.0' etc). Should
12833 # ideally be a string (i.e. '1.0' not 1). If not a valid number (any
12834 # decimal number greater than 0), 1.0 is used
12835 # $maxVersion - The maximum package version supported (e.g. '1.0', '2.0' etc). Should
12836 # ideally be a string (i.e. '1.0' not 1). If not a valid number (any
12837 # decimal number greater than 0), 1.0 is used
12838 #
12839 # Optional arguments
12840 # @supplantList - An optional list of MCP package names for which Axmud should prefer to
12841 # use this MCP package, if the world supports both. Standard MCP
12842 # packages like 'mcp-negotiate' cannot be supplanted (specifically,
12843 # any package whose name begins 'mcp-' cannot be supplanted; the name
12844 # is ignored if present in this list)
12845 #
12846 # Return values
12847 # 'undef' on improper arguments or if the MCP package object can't be added
12848 # 1 otherwise
12849  
12850 my ($self, $plugin, $name, $perlPackage, $minVersion, $maxVersion, @supplantList) = @_;
12851  
12852 # Local variables
12853 my ($pluginObj, $mcpObj);
12854  
12855 # Check for improper arguments
12856 if (
12857 ! defined $plugin || ! defined $name || ! defined $perlPackage || ! defined $minVersion
12858 || ! defined $maxVersion
12859 ) {
12860 return $axmud::CLIENT->writeImproper($self->_objClass . '->addPluginMcpPackages', @_);
12861 }
12862  
12863 # Find the plugin object
12864 $pluginObj = $self->ivShow('pluginHash', $plugin);
12865 if (! $pluginObj) {
12866  
12867 # Plugin not found - a very unlikely occurrence for this function, but it's worth
12868 # checking anyway
12869 return undef;
12870 }
12871  
12872 # Check that an MCP package object with the same name doesn't already exist
12873 if ($self->ivExists('mcpPackageHash', $name)) {
12874  
12875 return $self->writeError(
12876 'Could not create MCP package \'' . $name . '\' - duplicate package name',
12877 $self->_objClass . '->addPluginMcpPackages',
12878 );
12879 }
12880  
12881 # Don't add 'official' MCP packages (those whose names start 'mcp-')
12882 if (substr($name, 0, 4) eq 'mcp-') {
12883  
12884 return $self->writeError(
12885 'Cannot create \'official\' MCP package \'' . $name . '\'',
12886 $self->_objClass . '->addPluginMcpPackages',
12887 );
12888 }
12889  
12890 # Create the MCP package object
12891 $mcpObj = $perlPackage->new($name, $minVersion, $maxVersion, $plugin, @supplantList);
12892 if (! $mcpObj) {
12893  
12894 return $self->writeError(
12895 'Could not create MCP package \'' . $name . '\' - internal error',
12896 $self->_objClass . '->createSupportedMcpPackages',
12897 );
12898 }
12899  
12900 # Update IVs
12901 $self->ivAdd('mcpPackageHash', $name, $mcpObj);
12902  
12903 # Operation complete
12904 return 1;
12905 }
12906  
12907 # Logging
12908  
12909 sub deleteStandardLogs {
12910  
12911 # Called by $self->start, if the ->deleteStandardLogsFlag is set
12912 # Makes sure the /logs and /logs/standard directories are empty (but doesn't interfere with
12913 # each world's own log directory)
12914 #
12915 # Expected arguments
12916 # (none besides $self)
12917 #
12918 # Return values
12919 # 'undef' on improper arguments
12920 # 1 otherwise
12921  
12922 my ($self, $check) = @_;
12923  
12924 # Check for improper arguments
12925 if (defined $check) {
12926  
12927 return $axmud::CLIENT->writeImproper($self->_objClass . '->deleteStandardLogs', @_);
12928 }
12929  
12930 foreach my $path ($self->ivValues('logPrefHash')) {
12931  
12932 if (-e $axmud::DATA_DIR . $path) {
12933  
12934 unlink ($axmud::DATA_DIR . $path);
12935 }
12936 }
12937  
12938 return 1;
12939 }
12940  
12941 sub deleteWorldLogDir {
12942  
12943 # Called by GA::Session->setupProfiles, if the ->deleteWorldLogsFlag is set
12944 # Deletes the logfile directory for the specified world
12945 #
12946 # Expected arguments
12947 # $world - The name of a world profile
12948 #
12949 # Return values
12950 # 'undef' on improper arguments
12951 # 1 otherwise
12952  
12953 my ($self, $world, $check) = @_;
12954  
12955 # Check for improper arguments
12956 if (! defined $world || defined $check) {
12957  
12958 return $axmud::CLIENT->writeImproper($self->_objClass . '->deleteWorldLogDir', @_);
12959 }
12960  
12961 # Delete the dictory...
12962 File::Path::remove_tree($axmud::DATA_DIR . '/logs/' . $world);
12963  
12964 return 1;
12965 }
12966  
12967 sub createWorldLogDir {
12968  
12969 # Called by GA::Session->setupProfiles
12970 # Creates the logfile directory for the specified world
12971 #
12972 # Expected arguments
12973 # $world - The name of a world profile
12974 #
12975 # Return values
12976 # 'undef' on improper arguments
12977 # 1 otherwise
12978  
12979 my ($self, $world, $check) = @_;
12980  
12981 # Local variables
12982 my $dir;
12983  
12984 # Check for improper arguments
12985 if (! defined $world || defined $check) {
12986  
12987 return $axmud::CLIENT->writeImproper($self->_objClass . '->createWorldLogDir', @_);
12988 }
12989  
12990 # Create the dictory (unless it already exists)
12991 $dir = $axmud::DATA_DIR . '/logs/' . $world;
12992 if (! -e $dir) {
12993  
12994 mkdir ($dir, 0755);
12995 }
12996  
12997 return 1;
12998 }
12999  
13000 sub writeLog {
13001  
13002 # Can be called by any function, but mostly called by:
13003 # GA::Obj::TextView->showSystemText, ->showError, ->showWarning, ->showDebug,
13004 # ->showImproper, GA::Session->writeIncomingDataLogs, ->dispatchCmd, ->dispatchPassword
13005 #
13006 # Writes some text to one or more logfiles (if allowed)
13007 #
13008 # Expected arguments
13009 # $session - The GA::Session that generated the message
13010 # $standardflag - Set to TRUE for standard logfiles, so that the session number is
13011 # written to the logfile (so we can tell which session generated the
13012 # text); FALSE otherwise
13013 # $text - The text to be written
13014 # $beforeFlag - TRUE if $text should be preceded by a newline character, FALSE if not
13015 # $afterFlag - TRUE if $text should be followed by a newline character, FALSE if not
13016 #
13017 # Optional arguments
13018 # @fileTypeList - A list of logfile types to which $text must be written. For standard
13019 # logfiles, the types are keys in GA::Client->logPrefHash; otherwise,
13020 # keys in GA::Session->currentWorld->logPrefHash. If an empty list,
13021 # $text is not written to any logfile. If any of the log file types
13022 # are unrecognised, they are simply ignored (no error message is
13023 # generated)
13024 #
13025 # Return values
13026 # 'undef' on improper arguments or if logging is disabled for all sessions
13027 # 1 otherwise
13028  
13029 my ($self, $session, $standardflag, $text, $beforeFlag, $afterFlag, @fileTypeList) = @_;
13030  
13031 # Local variables
13032 my (
13033 $prefix, $preamble,
13034 @argList,
13035 );
13036  
13037 # Check for improper arguments
13038 if (
13039 ! defined $session || ! defined $standardflag || ! defined $text
13040 || ! defined $beforeFlag || ! defined $afterFlag
13041 ) {
13042 # Can't call $self->showImproper, or we'll get an infinite loop, so write something to
13043 # the terminal
13044 # Protect against Perl errors if any of the arguments are undefined
13045 foreach my $arg (@_) {
13046 if (defined $arg) {
13047 push(@argList, $arg);
13048 } else {
13049 push(@argList, '<<undef>>');
13050 }
13051 }
13052  
13053 print "IMPROPER ARGUMENTS: " . $self->_objClass . "->writeLog() " . join (" ", @argList)
13054 . "\n";
13055 return undef;
13056 }
13057  
13058 # If logging is disabled for all sessions, don't write anything
13059 if (! $self->allowLogsFlag) {
13060  
13061 return undef;
13062 }
13063  
13064 # Prefix the date and/or time to the line to be written, if allowed
13065 if ($self->logPrefixDateFlag) {
13066  
13067 $prefix = $self->localDateString();
13068 }
13069  
13070 if ($self->logPrefixTimeFlag) {
13071  
13072 if ($prefix) {
13073 $prefix .= ' ' . $self->localClock();
13074 } else {
13075 $prefix = $self->localClock();
13076 }
13077 }
13078  
13079 # For standard logfiles, add the session number
13080 if ($standardflag) {
13081  
13082 if ($prefix) {
13083 $prefix .= ' [' . $session->number . ']';
13084 } else {
13085 $prefix = '[' . $session->number . ']';
13086 }
13087 }
13088  
13089 # Create the logfile preamble as a single string, if one is set
13090 if (! $self->logPreambleList) {
13091 $preamble = '';
13092 } else {
13093 $preamble = join("\n", $self->logPreambleList) . "\n";
13094 }
13095  
13096 OUTER: foreach my $type (@fileTypeList) {
13097  
13098 my ($path, $fileHandle, $newFileFlag, $thisText, $lastChar);
13099  
13100 # Check that the log $fileType is recognised, and that logging is turned on for it
13101 # If so, set the file's path
13102 if ($standardflag) {
13103  
13104 # Standard logfiles
13105 if (
13106 ! $self->ivExists('logPrefHash', $type)
13107 || ! $self->ivShow('logPrefHash', $type)
13108 ) {
13109 next OUTER;
13110  
13111 } else {
13112  
13113 $path = $axmud::DATA_DIR . $self->ivShow('constLogPathHash', $type)
13114 }
13115  
13116 } else {
13117  
13118 # World-specific logfiles
13119 if (
13120 ! $session->currentWorld->ivExists('logPrefHash', $type)
13121 || ! $session->currentWorld->ivShow('logPrefHash', $type)
13122 ) {
13123 next OUTER;
13124  
13125 } else {
13126  
13127 $path = $axmud::DATA_DIR . '/logs/'
13128 . $session->currentWorld->name . '/' . $type;
13129 }
13130 }
13131  
13132 # If the file name must be unique for every session, or for every distinct date, modify
13133 # its path
13134 if ($self->logClientFlag) {
13135 $path .= '_' . $self->startDateString . '_' . $self->startClockString;
13136 } elsif ($self->logDayFlag) {
13137 $path .= '_' . $self->startDateString;
13138 }
13139  
13140 # Logfiles end with .txt on MS Windows
13141 if ($^O eq 'MSWin32') {
13142  
13143 $path .= '.txt';
13144 }
13145  
13146 # Check whether the file already exists
13147 if (! -e $path) {
13148  
13149 $newFileFlag = TRUE;
13150  
13151 # Add the prefix (if one was set)
13152 if ($prefix) {
13153  
13154 $thisText = $prefix . ' ' . $text;
13155 }
13156  
13157 # For new logfiles, ignore $beforeFlag, but apply $afterFlag
13158 if ($afterFlag) {
13159  
13160 $thisText .= "\n";
13161 }
13162  
13163 } else {
13164  
13165 if (! $beforeFlag) {
13166  
13167 # Test whether the file ends with a newline character, or not
13168 if (! open ($fileHandle, "<$path")) {
13169  
13170 # Could not open file
13171 next OUTER;
13172 }
13173  
13174 # Read the last character
13175 seek $fileHandle, -1, 2; # SEEK_END
13176 $lastChar = getc($fileHandle);
13177 close $fileHandle;
13178 }
13179  
13180 # Apply $beforeFlag and $afterFlag, and if we're writing on a new line, add $prefix
13181 # at the right position
13182 if ($beforeFlag) {
13183 $thisText = "\n";
13184 } else {
13185 $thisText = "";
13186 }
13187  
13188 if ($beforeFlag || $lastChar eq "\n") {
13189  
13190 $thisText .= $prefix;
13191 }
13192  
13193 if ($thisText) {
13194 $thisText .= ' ' . $text;
13195 } else {
13196 $thisText = $text;
13197 }
13198  
13199 if ($afterFlag) {
13200  
13201 $thisText .= "\n";
13202 }
13203 }
13204  
13205 # Open the file for writing, appending $text to anything already there
13206 if (! open ($fileHandle, ">>$path")) {
13207  
13208 # Could not open file
13209 next OUTER;
13210 }
13211  
13212 # This line prevents any nasty 'Wide character in print' errors when (for example)
13213 # receiving UTF8 characters from the world
13214 binmode $fileHandle, ':utf8';
13215  
13216 # If the file didn't already exist, write a header
13217 if ($newFileFlag) {
13218  
13219 print
13220 $fileHandle
13221 $axmud::SCRIPT . ' v' . $axmud::VERSION . ' logfile \'' . $type
13222 . '\' started at ' . $self->localTime() . "\n$preamble";
13223 }
13224  
13225 # Write the line and close the file
13226 print $fileHandle $thisText;
13227 close $fileHandle;
13228 }
13229  
13230 # Logging complete
13231 return 1;
13232 }
13233  
13234 # Colour/style tags
13235  
13236 sub checkColourTags {
13237  
13238 # Can be called by anything
13239 # Checks whether a specified colour tag is standard colour tag, an xterm colour tag or an
13240 # RGB colour tag
13241 #
13242 # Expected arguments
13243 # $tag - The colour tag to check. Standard colour tags are case-sensitive (i.e.
13244 # 'red' and 'RED' are different colours), but xterm and RGB colour tags
13245 # are case-insensitive (i.e. '#ffffff' and '#FFFFFF' are the same colour)
13246 #
13247 # Optional arguments
13248 # $mode - Specifies which tags to check
13249 # 'all' (or 'undef') - check standard, xterm and RGB colour tags
13250 # 'standard' - check only standard colour tags
13251 # 'xterm' - check only xterm colour tags
13252 # 'rgb' - check only RGB colour tags
13253 #
13254 # Return values
13255 # An empty list on improper arguments it it's not a recognised colour tag, or if $mode is
13256 # set to 'standard', 'xterm' or 'rgb' and $tag isn't one of those colour tags, or if
13257 # $mode is an unrecognised value
13258 # Otherwise returns a list identifying $tag, in the form
13259 # (tag_type, underlay_flag)
13260 # ...where 'tag_type' is one of the strings 'standard', 'xterm' or 'rgb', and
13261 # 'underlay_flag' is TRUE if it's an underlay tag, FALSE if not
13262  
13263 my ($self, $tag, $mode, $check) = @_;
13264  
13265 # Local variables
13266 my (
13267 $underlayFlag,
13268 @emptyList,
13269 );
13270  
13271 # Check for improper arguments
13272 if (! defined $tag || defined $check) {
13273  
13274 $axmud::CLIENT->writeImproper($self->_objClass . '->checkColourTags', @_);
13275 return @emptyList;
13276 }
13277  
13278 if (! defined $mode) {
13279  
13280 $mode = 'all';
13281 }
13282  
13283 # Standard colour tags
13284 if ($mode eq 'all' || $mode eq 'standard') {
13285  
13286 # GA::Client->colourTagHash and ->boldColourTagHash both contain 'red', 'BLUE' etc, but
13287 # they don't contain the corresponding underlay tags 'ul_red', 'UL_BLUE', etc
13288 # Since 'red' is the same colour as 'ul_red', we can simply remove the 'ul_' or 'UL_'
13289 # portions
13290 if (substr($tag, 0, 3) eq 'ul_') {
13291  
13292 substr($tag, 0, 3) = '';
13293 if ($self->ivExists('colourTagHash', $tag)) {
13294  
13295 # Valid standard underlay colour tag
13296 return ('standard', TRUE);
13297  
13298 } else {
13299  
13300 # Invalid standard underlay colour tag
13301 return @emptyList;
13302 }
13303  
13304 } elsif (substr($tag, 0, 3) eq 'UL_') {
13305  
13306 substr($tag, 0, 3) = '';
13307 if ($self->ivExists('boldColourTagHash', $tag)) {
13308  
13309 # Valid standard underlay colour tag
13310 return ('standard', TRUE);
13311  
13312 } else {
13313  
13314 # Invalid standard underlay colour tag
13315 return @emptyList;
13316 }
13317  
13318 } elsif (
13319 $self->ivExists('colourTagHash', $tag)
13320 || $self->ivExists('boldColourTagHash', $tag)
13321 ) {
13322 # Valid standard colour tag
13323 return ('standard', FALSE);
13324 }
13325 }
13326  
13327 # xterm and RGB colour tags are case-insensitive (unlike standard colour tags)
13328 $tag = lc($tag);
13329 # Remove the initial 'u' that represents an underlay colour (as opposed to a text colour)
13330 if (substr($tag, 0, 1) eq 'u') {
13331  
13332 substr($tag, 0, 1) = '';
13333 $underlayFlag = TRUE;
13334 }
13335  
13336 # xterm colour tags
13337 if ($mode eq 'all' || $mode eq 'xterm') {
13338  
13339 if ($self->ivExists('xTermColourHash', $tag)) {
13340  
13341 if (! $underlayFlag) {
13342  
13343 # Valid xterm text colour tag
13344 return ('xterm', FALSE);
13345  
13346 } else {
13347  
13348 # Valid xterm underlay colour tag
13349 return ('xterm', TRUE);
13350 }
13351 }
13352 }
13353  
13354 # RGB colour tags
13355 if ($mode eq 'all' || $mode eq 'rgb') {
13356  
13357 if ($tag =~ m/^\#[a-f0-9]{6}$/) {
13358  
13359 if (! $underlayFlag) {
13360  
13361 # Valid RGB text colour tag
13362 return ('rgb', FALSE);
13363  
13364 } else {
13365  
13366 # Valid RGB underlay colour tag
13367 return ('rgb', TRUE);
13368 }
13369 }
13370 }
13371  
13372 # Otherwise it's an invalid colour tag
13373 return @emptyList;
13374 }
13375  
13376 sub checkTextTags {
13377  
13378 # Can be called by anything
13379 # A modified copy of $self->checkColourTags; checks only standard, xterm and RGB text
13380 # colour tags (ignores underlay colour tags)
13381 #
13382 # Expected arguments
13383 # $tag - The colour tag to check. Standard colour tags are case-sensitive (i.e.
13384 # 'red' and 'RED' are different colours), but xterm and RGB colour tags
13385 # are case-insensitive (i.e. '#ffffff' and '#FFFFFF' are the same colour)
13386 #
13387 # Optional arguments
13388 # $mode - Specifies which tags to check
13389 # 'all' (or 'undef') - check standard, xterm and RGB colour tags
13390 # 'standard' - check only standard colour tags
13391 # 'xterm' - check only xterm colour tags
13392 # 'rgb' - check only RGB colour tags
13393 #
13394 # Return values
13395 # 'undef' on improper arguments it it's not a recognised text colour tag (including any
13396 # underlay colour tag), or if $mode is set to 'standard', 'xterm' or 'rgb' and $tag
13397 # isn't one of those colour tags, or if $mode is an unrecognised value
13398 # Otherwise returns a string identifying $tag: 'standard', 'xterm' or 'rgb'
13399  
13400 my ($self, $tag, $mode, $check) = @_;
13401  
13402 # Check for improper arguments
13403 if (! defined $tag || defined $check) {
13404  
13405 return $axmud::CLIENT->writeImproper($self->_objClass . '->checkTextTags', @_);
13406 }
13407  
13408 if (! defined $mode) {
13409  
13410 $mode = 'all';
13411 }
13412  
13413 # Standard text colour tags
13414 if ($mode eq 'all' || $mode eq 'standard') {
13415  
13416 if (
13417 $self->ivExists('colourTagHash', $tag)
13418 || $self->ivExists('boldColourTagHash', $tag)
13419 ) {
13420 # Valid standard colour tag
13421 return 'standard';
13422 }
13423 }
13424  
13425 # xterm and RGB colour tags are case-insensitive (unlike standard colour tags)
13426 $tag = lc($tag);
13427  
13428 # xterm colour tags
13429 if ($mode eq 'all' || $mode eq 'xterm') {
13430  
13431 if ($self->ivExists('xTermColourHash', $tag)) {
13432  
13433 # Valid xterm text colour tag
13434 return 'xterm';
13435 }
13436 }
13437  
13438 # RGB colour tags
13439 if ($mode eq 'all' || $mode eq 'rgb') {
13440  
13441 if ($tag =~ m/^\#[a-f0-9]{6}$/) {
13442  
13443 # Valid RGB text colour tag
13444 return 'rgb';
13445 }
13446 }
13447  
13448 # Otherwise it's either a valid underlay colour tag, or an invalid colour tag
13449 return undef;
13450 }
13451  
13452 sub checkUnderlayTags {
13453  
13454 # Can be called by anything
13455 # A modified copy of $self->checkColourTags; checks only standard, xterm and RGB underlay
13456 # colour tags (ignores text colour tags)
13457 #
13458 # Expected arguments
13459 # $tag - The colour tag to check. Standard colour tags are case-sensitive (i.e.
13460 # 'ul_red' and 'UL_RED' are different colours), but xterm and RGB colour
13461 # tags are case-insensitive (i.e. 'u#ffffff' and 'U#FFFFFF' are the same
13462 # colour)
13463 #
13464 # Optional arguments
13465 # $mode - Specifies which tags to check
13466 # 'all' (or 'undef') - check standard, xterm and RGB colour tags
13467 # 'standard' - check only standard colour tags
13468 # 'xterm' - check only xterm colour tags
13469 # 'rgb' - check only RGB colour tags
13470 #
13471 # Return values
13472 # 'undef' on improper arguments it it's not a recognised underlay colour tag (including
13473 # any text colour tag), or if $mode is set to 'standard', 'xterm' or 'rgb' and $tag
13474 # isn't one of those colour tags, or if $mode is an unrecognised value
13475 # Otherwise returns a string identifying $tag: 'standard', 'xterm' or 'rgb'
13476  
13477 my ($self, $tag, $mode, $check) = @_;
13478  
13479 # Check for improper arguments
13480 if (! defined $tag || defined $check) {
13481  
13482 return $axmud::CLIENT->writeImproper($self->_objClass . '->checkUnderlayTags', @_);
13483 }
13484  
13485 if (! defined $mode) {
13486  
13487 $mode = 'all';
13488 }
13489  
13490 # Standard colour tags
13491 if ($mode eq 'all' || $mode eq 'standard') {
13492  
13493 # GA::Client->colourTagHash and ->boldColourTagHash both contain 'red', 'BLUE' etc, but
13494 # they don't contain the corresponding underlay tags 'ul_red', 'UL_BLUE', etc
13495 # Since 'red' is the same colour as 'ul_red', we can simply remove the 'ul_' or 'UL_'
13496 # portions
13497 if (substr($tag, 0, 3) eq 'ul_') {
13498  
13499 substr($tag, 0, 3) = '';
13500 if ($self->ivExists('colourTagHash', $tag)) {
13501  
13502 # Valid standard underlay colour tag
13503 return 'standard';
13504  
13505 } else {
13506  
13507 # Invalid standard underlay colour tag
13508 return undef;
13509 }
13510  
13511 } elsif (substr($tag, 0, 3) eq 'UL_') {
13512  
13513 substr($tag, 0, 3) = '';
13514 if ($self->ivExists('boldColourTagHash', $tag)) {
13515  
13516 # Valid standard underlay colour tag
13517 return 'standard'
13518  
13519 } else {
13520  
13521 # Invalid standard underlay colour tag
13522 return undef;
13523 }
13524 }
13525 }
13526  
13527 # xterm and RGB colour tags are case-insensitive (unlike standard colour tags)
13528 $tag = lc($tag);
13529 # Remove the initial 'u' that represents an underlay colour (as opposed to a text colour)
13530 if (substr($tag, 0, 1) eq 'u') {
13531  
13532 substr($tag, 0, 1) = '';
13533  
13534 } else {
13535  
13536 # Not a valid xterm or RGB underlay colour flag
13537 return undef;
13538 }
13539  
13540 # xterm colour tags
13541 if ($mode eq 'all' || $mode eq 'xterm') {
13542  
13543 if ($self->ivExists('xTermColourHash', $tag)) {
13544  
13545 # Valid xterm underlay colour tag
13546 return 'xterm';
13547 }
13548 }
13549  
13550 # RGB colour tags
13551 if ($mode eq 'all' || $mode eq 'rgb') {
13552  
13553 if ($tag =~ m/^\#[a-f0-9]{6}$/) {
13554  
13555 # Valid RGB underlay colour tag
13556 return 'rgb';
13557 }
13558 }
13559  
13560 # Otherwise it's either a valid text colour tag, or an invalid colour tag
13561 return undef;
13562 }
13563  
13564 sub checkBoldTags {
13565  
13566 # Can be called by anything
13567 # Checks whether a specified colour tag is bold standard colour tag - either a text tag
13568 # like 'BLUE' or an underlay tag like 'UL_BLUE'
13569 #
13570 # Expected arguments
13571 # $tag - the colour tag to check
13572 #
13573 # Return values
13574 # 'undef' on improper arguments it it's not a bold standard colour tag
13575 # 'text' if it's a bold standard text colour tag (e.g. 'BLUE')
13576 # 'underlay' if it's an bold standard underlay tag (e.g. 'UL_BLUE')
13577  
13578 my ($self, $tag, $check) = @_;
13579  
13580 # Check for improper arguments
13581 if (! defined $tag || defined $check) {
13582  
13583 return $axmud::CLIENT->writeImproper($self->_objClass . '->checkBoldTags', @_);
13584 }
13585  
13586 # ->boldColourTagHash contains 'BLUE' etc, but it doesn't contain the corresponding underlay
13587 # tags 'UL_BLUE', etc
13588 # Since 'BLUE' is the same colour as 'UL_BLUE', we can simply remove 'UL_' portion
13589 if (substr($tag, 0, 3) eq 'UL_') {
13590  
13591 substr($tag, 0, 3) = '';
13592 if ($self->ivExists('boldColourTagHash', $tag)) {
13593  
13594 # Valid bold standard underlay colour tag
13595 return 'underlay';
13596 }
13597  
13598 } elsif ($self->ivExists('boldColourTagHash', $tag)) {
13599  
13600 # Valid bold standard text colour tag
13601 return 'text';
13602 }
13603  
13604 # Not a valid bold standard colour tag
13605 return undef;
13606 }
13607  
13608 sub returnRGBColour {
13609  
13610 # Can be called by anything
13611 # Translate one of the standard colour tags used by Axmud (e.g. 'white') or an xterm colour
13612 # tag (e.g. 'x255') into an RGB colour tag (e.g. '#FFFFFF')
13613 # If an RGB colour tag is supplied, returns it unmodified
13614 # If the standard/xterm colour tag isn't recognised, returns a failsafe RGB tag based on
13615 # either $self->constTextColour or $self->constBackgroundColour
13616 #
13617 # Expected arguments
13618 # $tag - the Axmud colour tag to translate
13619 #
13620 # Return values
13621 # 'undef' on improper arguments
13622 # Otherwise returns an RGB colour in the form #xxxxxx
13623  
13624 my ($self, $tag, $check) = @_;
13625  
13626 # Local variables
13627 my ($defaultText, $defaultBackground);
13628  
13629 # Check for improper arguments
13630 if (! defined $tag || defined $check) {
13631  
13632 return $axmud::CLIENT->writeImproper($self->_objClass . '->returnRGBColour', @_);
13633 }
13634  
13635 # Get some failsafe RGB tags to use in case $tag isn't recognised
13636 $defaultText = $self->ivShow('colourTagHash', $self->constTextColour);
13637 $defaultBackground = $self->ivShow('colourTagHash', $self->constBackgroundColour);
13638  
13639 # If we have been supplied with an RGB colour tag, we must return it unmodified
13640 if ($tag =~ m/^[Uu]?\#[A-Fa-f0-9]{6}$/) {
13641  
13642 return $tag;
13643  
13644 # The tag 'red' should return the same RGB colour as 'ul_red', and the tag 'BLUE' should
13645 # return the same RGB colour as 'UL_BLUE'
13646 } elsif (substr($tag, 0, 3) eq 'ul_') {
13647  
13648 substr($tag, 0, 3) = '';
13649 if ($self->ivExists('colourTagHash', $tag)) {
13650  
13651 # Valid (normal) underlay colour tag
13652 return $self->ivShow('colourTagHash', $tag);
13653  
13654 } else {
13655  
13656 # Invalid (normal) underlay colour tag. Use the default background colour instead
13657 return $defaultBackground;
13658 }
13659  
13660 } elsif (substr($tag, 0, 3) eq 'UL_') {
13661  
13662 substr($tag, 0, 3) = '';
13663 if ($self->ivExists('boldColourTagHash', $tag)) {
13664  
13665 # Valid (bold) underlay colour tag
13666 return $self->ivShow('boldColourTagHash', $tag);
13667  
13668 } else {
13669  
13670 # Invalid (bold) underlay colour tag. Use the default background colour instead
13671 return $defaultBackground;
13672 }
13673  
13674 } elsif ($self->ivExists('colourTagHash', $tag)) {
13675  
13676 # Valid (normal) text colour tag
13677 return $self->ivShow('colourTagHash', $tag);
13678  
13679 } elsif ($self->ivExists('boldColourTagHash', $tag)) {
13680  
13681 # Valid (bold) text colour tag
13682 return $self->ivShow('boldColourTagHash', $tag);
13683  
13684 } elsif ($self->ivExists('xTermColourHash', $tag)) {
13685  
13686 # Valid xterm text colour tag
13687 return $self->ivShow('xTermColourHash', $tag);
13688  
13689 } elsif (
13690 substr($tag, 0, 1) eq 'u'
13691 && $self->ivExists('xTermColourHash', substr($tag, 1))
13692 ) {
13693 # Valid xterm underlay colour tag
13694 return $self->ivShow('xTermColourHash', substr($tag, 1));
13695  
13696 } else {
13697  
13698 # Invalid colour tag. Use the (global) default text colour instead
13699 return $defaultText;
13700 }
13701 }
13702  
13703 sub returnCairoColour {
13704  
13705 # Can be called by anything (but is not currently called by anything)
13706 # Translates any Axmud colour tag (including standard, xterm and RGB tags) into a format
13707 # used for Cairo drawing - a reference to a list containing three values in the range 0-1,
13708 # corresponding to the RGB values Cairo is expecting
13709 #
13710 # Expected arguments
13711 # $tag - the Axmud colour tag to translate
13712 #
13713 # Return values
13714 # 'undef' on improper arguments
13715 # Otherwise returns the list reference described above
13716  
13717 my ($self, $tag, $check) = @_;
13718  
13719 # Local variables
13720 my @list;
13721  
13722 # Check for improper arguments
13723 if (! defined $tag || defined $check) {
13724  
13725 return $axmud::CLIENT->writeImproper($self->_objClass . '->returnCairoColour', @_);
13726 }
13727  
13728 # Convert the colour tag to an RGB tag, in the form '#ABCDEF'
13729 $tag = $self->returnRGBColour($tag);
13730 if (! $tag) {
13731  
13732 return undef;
13733 }
13734  
13735 # Convert the 'AB', 'CD' and 'EF' portions to values in the range 0-1, and return them
13736 @list = (
13737 (hex (substr($tag, -6, 2)) / 255),
13738 (hex (substr($tag, -4, 2)) / 255),
13739 (hex (substr($tag, -2, 2)) / 255),
13740 );
13741  
13742 return \@list;
13743 }
13744  
13745 sub swapColours {
13746  
13747 # Can be called by anything
13748 # Converts a text colour tag into an underlay colour tag, or an underlay colour tag into a
13749 # text colour tag
13750 #
13751 # Expected arguments
13752 # (none besides $self)
13753 #
13754 # Optional arguments
13755 # $tag - A standard colour tag, e.g 'red' or 'UL_BLUE', an xterm colour tag,
13756 # e.g. 'x255' or 'ux255', or an RGB colour tag, e.g. '#FF0000' or
13757 # 'u#FF0000'. If 'undef', then 'undef' is returned
13758 #
13759 # Return values
13760 # 'undef' on improper arguments or if $tag is 'undef'
13761 # Otherwise returns the converted tag
13762  
13763 my ($self, $tag, $check) = @_;
13764  
13765 # Local variables
13766 my ($type, $underlayFlag);
13767  
13768 # Check for improper arguments
13769 if (defined $check) {
13770  
13771 return $axmud::CLIENT->writeImproper($self->_objClass . '->swapColours', @_);
13772 }
13773  
13774 if (! defined $tag) {
13775  
13776 return undef;
13777 }
13778  
13779 ($type, $underlayFlag) = $self->checkColourTags($tag);
13780 if ($type) {
13781  
13782 if ($type eq 'standard') {
13783  
13784 # Standard text colour tags
13785 if (! $underlayFlag) {
13786  
13787 if ($self->ivExists('constColourTagHash', $tag)) {
13788 $tag = 'ul_' . $tag;
13789 } else {
13790 $tag = 'UL_' . $tag;
13791 }
13792  
13793 # Standard underlay colour tags
13794 } else {
13795  
13796 # Remove the initial 'ul_' or 'UL_'
13797 $tag = substr($tag, 3);
13798 }
13799  
13800 # xterm text colour tags
13801 # RGB text colour tags
13802 } elsif (! $underlayFlag) {
13803  
13804 $tag = 'u' . $tag;
13805  
13806 # xterm underlay colour tags
13807 # RGB underlay colour tags
13808 } else {
13809  
13810 # Remove the initial 'u'
13811 $tag = substr($tag, 1);
13812 }
13813 }
13814  
13815 return $tag;
13816 }
13817  
13818 # Text-to-speech (TTS)
13819  
13820 sub tts {
13821  
13822 # Can be called by anything
13823 # Converts a string to audible speech, using one of the supported TTS engines. Never tries
13824 # to convert a string if it contains no alphanumeric characters (because if we send
13825 # unreadable text to the engine, there will be an unwelcome delay)
13826 #
13827 # This function processes its arguments into a standard list, then calls
13828 # $self->ttsAddJob to create a new TTS job. The job is added to a list, and jobs are
13829 # performed in sequence until the user interrupts that sequence (for example, with the
13830 # ';skip' command)
13831 #
13832 # Expected arguments
13833 # (none besides self)
13834 #
13835 # Optional arguments
13836 # $text - The text to convert to audible speech (if an empty string or 'undef', nothing
13837 # happens)
13838 # $type - The type of message to be converted: 'receive' for text received from the
13839 # world, 'system', 'error' for system messages, 'command' (or 'cmd') for a
13840 # world command, 'dialogue' for a 'dialogue' window or 'task' for a task
13841 # message or 'other' for something else (if an empty string or 'undef', the
13842 # type 'other' is used)
13843 # $configuration
13844 # - Name of the TTS configuration object to use, which specifies the engine,
13845 # voice, word speed and word pitch to use (a key in GA::Client->ttsObjHash; if
13846 # set to an empty string or 'undef', or if no TTS configuration object called
13847 # $name exists, the 'default' configuration object is used)
13848 # - If set to the dummy configuration 'none', nothing is read out
13849 # - If $self->forceTTSEngine, that is used as the configuration, overriding any
13850 # setting of $configuration besides 'none'
13851 # $session
13852 # - The calling GA::Session (can be set to 'undef' if there is no calling
13853 # session)
13854 # $engine, $voice, $speed, $rate, $pitch, $volume
13855 # - Set when called by GA::Cmd::Speak->do, in order to override the engine,
13856 # voice, speed and/or pitch of the specified $configuration (any that are set
13857 # to 'undef' are ignored). For $speed, $rate, $pitch and $volume, the values
13858 # (if defined) are in the range 0-100
13859 # $exclFlag
13860 # - Set to TRUE when called by GA::Cmd::Speak->do (or by any similar code),
13861 # meaning that the TTS configuration's exclusive/excluded patterns and the
13862 # world profile's command prompt patterns should not be checked. Set to FALSE
13863 # (or 'undef') if they should be checked as normal
13864 # $overrideFlag
13865 # - Set to TRUE when called by GA::Cmd::Speak->do (or by anything else), meaning
13866 # that the text should be converted even if GA::Client->systemAllowTTSFlag
13867 # is set to FALSE (subject to other checks)
13868 #
13869 # Return values
13870 # 'undef' on improper arguments, if $text contains no alphanumeric characters (or is
13871 # 'undef'), if TTS is disabled generally or if the text-to-speech conversion can't be
13872 # done for any other reason
13873 # 1 otherwise
13874  
13875 my (
13876 $self, $text, $type, $configuration, $session, $engine, $voice, $speed, $rate, $pitch,
13877 $volume, $exclFlag, $overrideFlag, $check,
13878 ) = @_;
13879  
13880 # Local variables
13881 my (
13882 $ttsObj, $cmd, $param, $begin, $end, $rateFlag, $pitchFlag, $volumeFlag, $string,
13883 @lineList, @modList, @finalList, @cmdList, @altCmdList, @promptList,
13884 );
13885  
13886 # Check for improper arguments
13887 if (defined $check) {
13888  
13889 return $axmud::CLIENT->writeImproper($self->_objClass . '->tts', @_);
13890 }
13891  
13892 # If no $text was specified or if TTS is disabled generally, there's nothing to convert
13893 # (We check for alphanumeric characters below)
13894 if (
13895 ! defined $text
13896 || $text eq ''
13897 || (! $self->systemAllowTTSFlag && ! $overrideFlag)
13898 ) {
13899 return undef;
13900 }
13901  
13902 # If the user specified a TTS engine from the command line, it overrides all other TTS
13903 # engines
13904 if (
13905 $self->forceTTSEngine
13906 && (! defined $configuration || $configuration ne 'none')
13907 ) {
13908 if (defined $configuration && $self->forceTTSEngine ne $configuration) {
13909  
13910 # Ignore the voice/speed/rate/pitch/volume specified by the calling function
13911 # GA::Cmd::Speak->do
13912 $voice = $speed = $rate = $pitch = $volume = undef;
13913 }
13914  
13915 $configuration = $self->forceTTSEngine;
13916 }
13917  
13918 # The TTS engine's system commands use " to contain the text portion, so if $text contains
13919 # any double quotes, replace them with single quotes
13920 $text =~ s/\"/\'/g;
13921  
13922 # Set the TTS configuration object (GA::Obj::Tts) to use, which specifies the TTS engine,
13923 # voice, word speed, word rate, word pitch and volume. If no TTS configuration object was
13924 # specified, use the default one
13925 if (
13926 ! $configuration
13927 || ! $self->ivExists('ttsObjHash', $configuration)
13928 ) {
13929 $configuration = 'default';
13930 }
13931  
13932 $ttsObj = $self->ivShow('ttsObjHash', $configuration);
13933  
13934 # Set the type of message, if none was specified (or if an invalid type was specified)
13935 if (
13936 ! $type
13937 || (
13938 $type ne 'receive' && $type ne 'system' && $type ne 'error' && $type ne 'command'
13939 && $type ne 'cmd' && $type ne 'dialogue' && $type ne 'task' && $type ne 'other'
13940  
13941 )
13942 ) {
13943 $type = 'other';
13944  
13945 } elsif ($type eq 'cmd') {
13946  
13947 $type = 'command';
13948 }
13949  
13950 # Set the engine (overriding the TTS configuration object, if necessary)
13951 if (! $engine) {
13952  
13953 $engine = $ttsObj->engine;
13954 }
13955  
13956 # Don't try to do text to speech with the dummy engine 'none', or with an unrecognisd
13957 # engine
13958 if (! $engine || $engine eq 'none' || ! defined $self->ivFind('constTTSList', $engine)) {
13959  
13960 return undef;
13961 }
13962  
13963 # Not all engines are supported all operating systems
13964 if ($^O eq 'MSWin32' && $engine eq 'flite') {
13965  
13966 return undef;
13967 }
13968  
13969 # The first time the Festival engine is specified, try to start the Festival server (but not
13970 # on MS Windows, for which we only support the command-line engine)
13971 if ($engine eq 'festival' && ! $self->ttsFestivalFirstFlag && $^O ne 'MSWin32') {
13972  
13973 $self->ivPoke('ttsFestivalFirstFlag', TRUE);
13974 # Only start the server if a port has been specified
13975 if (
13976 defined $self->ttsFestivalServerPort
13977 && $self->ttsFestivalServerPort ne ''
13978 ) {
13979 # Request that $self->ttsPerformJobs starts the server, and then connects to it
13980 $self->ivPush('ttsFestivalRequestList', 'start');
13981 }
13982 }
13983  
13984 # Set the voice, speed, rate, pitch and volume to use (overriding the TTS configuration
13985 # object, if necessary)
13986 if (! $voice) {
13987  
13988 $voice = $ttsObj->voice; # May still be 'undef'
13989 }
13990  
13991 if (! $speed) {
13992  
13993 $speed = $ttsObj->speed; # May still be 'undef'
13994 }
13995  
13996 if (! $rate) {
13997  
13998 $rate = $ttsObj->rate; # May still be 'undef'
13999 }
14000  
14001 if (! $pitch) {
14002  
14003 $pitch = $ttsObj->pitch; # May still be 'undef'
14004 }
14005  
14006 if (! $volume) {
14007  
14008 $volume = $ttsObj->volume; # May still be 'undef'
14009 }
14010  
14011 # Split $text into separate lines, so we can check each line before re-combining them for
14012 # TTS operations
14013 # Don't attempt to convert any lines which contain no alphanumeric characters
14014 foreach my $line (split("\n", $text)) {
14015  
14016 if ($line =~ m/[[:alnum:]]/) {
14017  
14018 push (@lineList, $line);
14019 }
14020 }
14021  
14022 if (! @lineList) {
14023  
14024 # There is no alphanumeric text to read
14025 return undef;
14026 }
14027  
14028 # For 'receive' text, check each line against the world profile's recognised command prompts
14029 # so the ';prompt' command can retrieve the most recent one
14030 if (! $exclFlag && $type eq 'receive') {
14031  
14032 OUTER: foreach my $line (@lineList) {
14033  
14034 INNER: foreach my $pattern ($session->currentWorld->cmdPromptPatternList) {
14035  
14036 # (To avoid having to check the patterns again below, compile two separate
14037 # lists)
14038 if ($line =~ m/$pattern/i) {
14039  
14040 push (@promptList, $line);
14041 }
14042 }
14043 }
14044  
14045 if (@promptList) {
14046  
14047 $self->ivPoke('ttsLastPrompt', $promptList[-1]);
14048 }
14049 }
14050  
14051 # Check each line of $text against exclusive/excluded patterns (unless the flag is set)
14052 if ($exclFlag) {
14053  
14054 @modList = @lineList;
14055  
14056 } else {
14057  
14058 OUTER: foreach my $line (@lineList) {
14059  
14060 my $matchFlag;
14061  
14062 if ($ttsObj->exclusiveList) {
14063  
14064 INNER: foreach my $pattern ($ttsObj->exclusiveList) {
14065  
14066 if ($line =~ m/$pattern/i) {
14067  
14068 $matchFlag = TRUE;
14069 last INNER;
14070 }
14071 }
14072  
14073 if ($matchFlag) {
14074  
14075 # $line matches an exclusive pattern, so we do convert it to speech
14076 push (@modList, $line);
14077 }
14078  
14079 } elsif ($ttsObj->excludedList) {
14080  
14081 INNER: foreach my $pattern ($ttsObj->excludedList) {
14082  
14083 if ($line =~ m/$pattern/i) {
14084  
14085 $matchFlag = TRUE;
14086 last INNER;
14087 }
14088 }
14089  
14090 if (! $matchFlag) {
14091  
14092 # $line does not match an excluded pattern, so we do convert it to speech
14093 push (@modList, $line);
14094 }
14095  
14096 } elsif ($type eq 'receive' && $self->ttsPromptFlag && $session->loginFlag) {
14097  
14098 INNER: foreach my $promptLine (@promptList) {
14099  
14100 if ($line eq $promptLine) {
14101  
14102 $matchFlag = TRUE;
14103 last INNER;
14104 }
14105 }
14106  
14107 if (! $matchFlag) {
14108  
14109 # $line does not match a recognised command prompt, so we do convert it to
14110 # speech
14111 push (@modList, $line);
14112 }
14113  
14114 } else {
14115  
14116 # No exclusive/excluded patterns to check
14117 push (@modList, $line);
14118 }
14119 }
14120  
14121 if (! @modList) {
14122  
14123 # No readable lines found, so don't perform TTS
14124 return undef;
14125 }
14126 }
14127  
14128 # Recombine the lines into a single string, so that the TTS engine reads them more naturally
14129 if ($type ne 'receive') {
14130  
14131 push (@finalList, join(' ', @modList));
14132  
14133 } else {
14134  
14135 # Text received from the world is handled a little differently
14136 if (! $self->ttsSmoothFlag) {
14137  
14138 # Don't recombine the lines. For most TTS engines, there will be an audible gap
14139 # between each line, but the user can use ';skip' and ';unskip' to replay whole
14140 # lines, exactly as they were received from the world
14141 @finalList = @modList;
14142  
14143 } else {
14144  
14145 # Split the text into artificial lines, ending with a full stop (etc). The user can
14146 # ';skip' and ';unskip' lines that correspond to sentences (as far as possible)
14147 $string = join(' ', @modList);
14148 @finalList = $string =~ m/[^\.\!\?]+[\.\!\?]*/g;
14149 }
14150 }
14151  
14152 # Create new TTS job(s), and add them to the job list
14153 foreach my $line (@finalList) {
14154  
14155 # Create a new TTS job, and add it to the job list
14156 $self->ttsAddJob($line, $engine, $voice, $speed, $rate, $pitch, $volume);
14157 }
14158  
14159 # Inform the calling session (if any) which type of message was most recently converted
14160 # to speech
14161 if ($session) {
14162  
14163 $session->set_ttsLastType($type);
14164 }
14165  
14166 # Operation complete
14167 return 1;
14168 }
14169  
14170 sub ttsCreateStandard {
14171  
14172 # Called by $self->start
14173 # Creates standard TTS configuration objects and stores them in the client registry
14174 #
14175 # Expected arguments
14176 # (none besides $self)s
14177 #
14178 # Return values
14179 # 'undef' on improper arguments, or if one of the standard zonemaps doesn't exist and
14180 # can't be created
14181 # 1 otherwise
14182  
14183 my ($self, $check) = @_;
14184  
14185 # Local variables
14186 my (
14187 $default,
14188 @list,
14189 );
14190  
14191 # Check for improper arguments
14192 if (defined $check) {
14193  
14194 return $axmud::CLIENT->writeImproper($self->_objClass . '->createStandardTTS', @_);
14195 }
14196  
14197 # First create standard TTS configuration objects for each supported TTS engine ('espeak',
14198 # 'esng', 'flite', 'festival', 'swift' and the dummy engine 'none')
14199 @list = $self->constTtsDefaultList;
14200  
14201 do {
14202  
14203 my ($engine, $voice, $speed, $rate, $pitch, $volume, $obj);
14204  
14205 $engine = shift @list;
14206 $voice = shift @list;
14207 $speed = shift @list;
14208 $rate = shift @list;
14209 $pitch = shift @list;
14210 $volume = shift @list;
14211  
14212 $obj = Games::Axmud::Obj::Tts->new(
14213 $engine, # This TTS configuration object has the same name as its engine
14214 $engine,
14215 $voice,
14216 $speed,
14217 $rate,
14218 $pitch,
14219 $volume,
14220 );
14221  
14222 if (! $obj) {
14223  
14224 return $self->writeError(
14225 'Cannot create the standard TTS configuration object \'' . $engine . '\'',
14226 $self->_objClass . '->createStandardTTS',
14227 );
14228  
14229 } else {
14230  
14231 $self->ivAdd('ttsObjHash', $engine, $obj);
14232 }
14233  
14234 } until (! @list);
14235  
14236 # Next create the remaining standard TTS configuration objects, copying settings from one of
14237 # the objects we created above
14238  
14239 # Decide which default engine to use, when $self->ttsObjHash doesn't specify one
14240 if ($^O ne 'MSWin32') {
14241  
14242 $default = 'espeak';
14243  
14244 } else {
14245  
14246 if (defined $self->msWinPathFestival && -e $self->msWinPathFestival) {
14247 $default = 'festival';
14248 } elsif (defined $self->msWinPathESNG && -e $self->msWinPathESNG) {
14249 $default = 'esng';
14250 } else {
14251 $default = 'espeak';
14252 }
14253 }
14254  
14255 # Create the remaining configurations
14256 foreach my $name ($self->ivKeys('constTtsObjHash')) {
14257  
14258 my ($copyName, $copyObj, $newObj);
14259  
14260 # If this TTS configuration object wasn't created above...
14261 if (! $self->ivExists('ttsObjHash', $name)) {
14262  
14263 # Copy settings from this already-created TTS configuration object
14264 $copyName = $self->ivShow('constTtsObjHash', $name);
14265 if (! defined $copyName) {
14266  
14267 $copyName = $default;
14268 }
14269  
14270 $copyObj = $self->ivShow('ttsObjHash', $copyName);
14271  
14272 # Create a new object, using the settings from $copyObj
14273 $newObj = Games::Axmud::Obj::Tts->new(
14274 $name,
14275 $copyObj->engine,
14276 $copyObj->voice,
14277 $copyObj->speed,
14278 $copyObj->rate,
14279 $copyObj->pitch,
14280 $copyObj->volume,
14281 );
14282  
14283 if (! $newObj) {
14284  
14285 return $self->writeError(
14286 'Cannot create the standard TTS configuration object \'' . $name . '\'',
14287 $self->_objClass . '->createStandardTTS',
14288 );
14289  
14290 } else {
14291  
14292 $self->ivAdd('ttsObjHash', $name, $newObj);
14293 }
14294 }
14295 }
14296  
14297 # Operation complete
14298 return 1;
14299 }
14300  
14301 sub ttsAssignAttribs {
14302  
14303 # Called by $self->loadPlugin and ->enablePlugin
14304 # Updates the customisabletext-to-speech (TTS) attribute hashes, to take account of a task
14305 # loaded from a plugin
14306 #
14307 # Expected arguments
14308 # $taskName - The newly-loaded task's standard name
14309 #
14310 # Return values
14311 # 'undef' on improper arguments or if the hashes can't be updated
14312 # 1 otherwise
14313  
14314 my ($self, $taskName, $check) = @_;
14315  
14316 # Local variables
14317 my ($packageName, $taskObj);
14318  
14319 # Check for improper arguments
14320 if (defined $check) {
14321  
14322 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsAssignAttribs', @_);
14323 }
14324  
14325 # Get the package name corresponding to $taskName (e.g. 'Games::Axmud::Task::Status',
14326 # 'Games::Axmud::Task::Divert')
14327 $packageName = Games::Axmud::Generic::Cmd->findTaskPackageName($self, $taskName);
14328 if (! defined $packageName) {
14329  
14330 return undef;
14331 }
14332  
14333 # Create a dummy task, so we can access its IVs
14334 $taskObj = $packageName->new($self);
14335 if (! $taskObj) {
14336  
14337 return undef;
14338 }
14339  
14340 # Update TTS attributes
14341 # # v1.2.036. For unknown reasons, calling Games::Axmud::ivKeys() while loading a plugin from
14342 # # ../share/private causes a stream of Perl errors. Workaround is to fetch the keys from
14343 # # the IV directly
14344 # foreach my $attrib ($taskObj->ivKeys('ttsAttribHash')) {
14345 foreach my $attrib (keys %{$taskObj->{'ttsAttribHash'}}) {
14346  
14347 # In $self->ttsAttribHash, any existing (probably built-in tasks) using the same
14348 # attribute are replaced with the task loaded from the plugin
14349 $self->ivAdd('ttsAttribHash', $attrib, $taskObj->name);
14350 }
14351  
14352 # foreach my $flagAttrib ($taskObj->ivKeys('ttsFlagAttribHash')) {
14353 foreach my $flagAttrib (keys %{$taskObj->{'ttsFlagAttribHash'}}) {
14354  
14355 $self->ivAdd('ttsFlagAttribHash', $flagAttrib, $taskObj->name);
14356 }
14357  
14358 # foreach my $alertAttrib ($taskObj->ivKeys('ttsAlertAttribHash')) {
14359 foreach my $alertAttrib (keys %{$taskObj->{'ttsAlertAttribHash'}}) {
14360  
14361 $self->ivAdd('ttsAlertAttribHash', $alertAttrib, $taskObj->name);
14362 }
14363  
14364 # Operation complete
14365 return 1;
14366 }
14367  
14368 sub ttsResetAttribs {
14369  
14370 # Called by $self->disablePlugin
14371 # Updates the customisable text-to-speech (TTS) attribute hashes, to remove any attributes
14372 # assigned to a task from the disabled plugin
14373 # If those attributes are assigned to one of Axmud's built-in tasks, those attributes are
14374 # re-assigned to the built-in task. Otherwise, they are removed from the attribute hashes
14375 # entirely
14376 # (This doesn't take account of a situation, in which an attribute is used by a built-in
14377 # task and two tasks from two different plugins. If one of the plugins is disabled, the
14378 # attribute is re-assigned to the built-in task, not the other plugin task. Not a perfect
14379 # system, but a practical one.)
14380 #
14381 # Expected arguments
14382 # $taskName - The task's standard name
14383 #
14384 # Return values
14385 # 'undef' on improper arguments or if the hashes can't be updated
14386 # 1 otherwise
14387  
14388 my ($self, $taskName, $check) = @_;
14389  
14390 # Local variables
14391 my ($packageName, $taskObj);
14392  
14393 # Check for improper arguments
14394 if (defined $check) {
14395  
14396 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsResetAttribs', @_);
14397 }
14398  
14399 # Get the package name corresponding to $taskName (e.g. 'Games::Axmud::Task::Status',
14400 # 'Games::Axmud::Task::Divert')
14401 $packageName = Games::Axmud::Generic::Cmd->findTaskPackageName($self, $taskName);
14402 if (! defined $packageName) {
14403  
14404 return undef;
14405 }
14406  
14407 # Create a dummy task, so we can access its IVs
14408 $taskObj = $packageName->new($self);
14409 if (! $taskObj) {
14410  
14411 return undef;
14412 }
14413  
14414 # Update TTS attributes
14415 foreach my $attrib ($taskObj->ivKeys('ttsAttribHash')) {
14416  
14417 if ($self->ivExists('constTtsAttribHash', $attrib)) {
14418  
14419 # Re-assign the attribute to a built-in task
14420 $self->ivAdd(
14421 'ttsAttribHash',
14422 $attrib,
14423 $self->ivShow('constTtsAttribHash', $attrib),
14424 );
14425  
14426 } else {
14427  
14428 # Delete the attribute
14429 $self->ivDelete('ttsAttribHash', $attrib);
14430 }
14431 }
14432  
14433 foreach my $flagAttrib ($taskObj->ivKeys('ttsFlagAttribHash')) {
14434  
14435 if ($self->ivExists('constTtsFlagAttribHash', $flagAttrib)) {
14436  
14437 # Re-assign the flag attribute to a built-in task
14438 $self->ivAdd(
14439 'ttsFlagAttribHash',
14440 $flagAttrib,
14441 $self->ivShow('constTtsFlagAttribHash', $flagAttrib),
14442 );
14443  
14444 } else {
14445  
14446 # Delete the flag attribute
14447 $self->ivDelete('ttsFlagAttribHash', $flagAttrib);
14448 }
14449 }
14450  
14451 foreach my $alertAttrib ($taskObj->ivKeys('ttsAlertAttribHash')) {
14452  
14453 if ($self->ivExists('constTtsAlertAttribHash', $alertAttrib)) {
14454  
14455 # Re-assign the alert attribute to a built-in task
14456 $self->ivAdd(
14457 'ttsAlertAttribHash',
14458 $alertAttrib,
14459 $self->ivShow('constTtsAlertAttribHash', $alertAttrib),
14460 );
14461  
14462 } else {
14463  
14464 # Delete the alert attribute
14465 $self->ivDelete('ttsAlertAttribHash', $alertAttrib);
14466 }
14467 }
14468  
14469 # Operation complete
14470 return 1;
14471 }
14472  
14473 # (TTS jobs)
14474  
14475 sub ttsReset {
14476  
14477 # Called by $self->set_customAllowTTSFlag when TTS has just been disabled
14478 # Interrupts any TTS jobs that might be in progress (halting any speech that the user can
14479 # hear), and resets TTS IVs to their default values
14480 #
14481 # Expected arguments
14482 # (none besides $self)
14483 #
14484 # Return values
14485 # 'undef' on improper arguments
14486 # 1 otherwise
14487  
14488 my ($self, $check) = @_;
14489  
14490 # Check for improper arguments
14491 if (defined $check) {
14492  
14493 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsReset', @_);
14494 }
14495  
14496 # Interrupt any speech being read aloud. The next call to $self->ttsPerformJobs will set
14497 # ->ttsCurrentHarness back to 'undef'
14498 $self->ttsInterruptJob();
14499  
14500 # Disconnect from the Festival server, if connected
14501 $self->ttsFestivalDisconnect();
14502  
14503 # Reset IVs
14504 $self->ivEmpty('ttsJobList');
14505 $self->ivEmpty('ttsUrgentJobList');
14506 $self->ivPoke('ttsJobMode', 'default');
14507 $self->ivPoke('ttsJobPointer', 0);
14508 $self->ivPoke('ttsJobMiniPointer', 0);
14509 $self->ivPoke('ttsJobAutoFlag', TRUE);
14510 $self->ivPoke('ttsJobOnceFlag', TRUE);
14511 $self->ivPoke('ttsChangeModeFlag', FALSE);
14512 # $self->ivUndef('ttsCurrentHarness');
14513  
14514 $self->ivPoke('ttsFestivalServerMode', 'cmd_line');
14515 $self->ivPoke('ttsFestivalConnectMode', 'cmd_line');
14516 $self->ivUndef('ttsFestivalSocket');
14517 $self->ivEmpty('ttsFestivalRequestList');
14518 $self->ivUndef('ttsFestivalCheckTime');
14519 $self->ivPoke('ttsFestivalFailFlag', FALSE);
14520 # (Still don't start the server again, if a previous attempt succeeded)
14521 # $self->ivPoke('ttsFestivalSuccessFlag', FALSE);
14522  
14523 return 1;
14524 }
14525  
14526 sub ttsRestart {
14527  
14528 # Called by $self->connectBlind, just before it calls ->startSession
14529 # The initial dialogue windows have almost certainly interrupted the job list, so when the
14530 # session starts, received text won't be read aloud until the ;skip, ;resume (etc)
14531 # commands are used
14532 # This is a less extreme version of $self->ttsReset. Empties the job list (but not the
14533 # urgent job list or the request list), and resets some IVs, so that the session's text
14534 # can be converted to speech almost immediately (i.e. after the end of any urgent jobs
14535 # created by the initial dialogue windows)
14536 #
14537 # Expected arguments
14538 # (none besides ($self)
14539 #
14540 # Return values
14541 # 'undef' on improper arguments
14542 # 1 otherwise
14543  
14544 my ($self, $check) = @_;
14545  
14546 # Check for improper arguments
14547 if (defined $check) {
14548  
14549 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsRestart', @_);
14550 }
14551  
14552 # Reset IVs
14553 $self->ivEmpty('ttsJobList');
14554 $self->ivPoke('ttsJobMode', 'default');
14555 $self->ivPoke('ttsJobPointer', 0);
14556 $self->ivPoke('ttsJobMiniPointer', 0);
14557 $self->ivPoke('ttsJobAutoFlag', TRUE);
14558 $self->ivPoke('ttsJobOnceFlag', TRUE);
14559 $self->ivPoke('ttsChangeModeFlag', FALSE);
14560  
14561 return 1;
14562 }
14563  
14564 sub ttsAddJob {
14565  
14566 # Called by $self->tts (only)
14567 # Creates a new TTS job, and adds it to the job list (deleting the oldest job, if the list
14568 # is now too long)
14569 #
14570 # Expected arguments
14571 # $text - The text to convert to speech (should not be an empty string)
14572 # $engine - TTS engine to use (must be one of the values in
14573 # GA::CLIENT->constTTSList)
14574 #
14575 # Optional arguments
14576 # $voice - Voice used with the TTS engine (eSpeak, espeak-ng, Flite, Festival server,
14577 # Swift only; ignored when the engine is Festival command line). If an
14578 # empty string or 'undef', the engine's default voice is used
14579 # $speed - Word speed used with the TTS engine (eSpeak and espeak-ng only; ignored
14580 # for other engines). A value in the range 0-100. If an invalid value or
14581 # 'undef', the engine's default speed is used
14582 # $rate - Word rate used with the TTS engine (Festival server and Swift only;
14583 # ignored for other engines, including Festival command line). A value in
14584 # the range 0-100. If an invalid value or 'undef', the engine's default
14585 # rate is used
14586 # $pitch - Word pitch used with the TTS engine (eSpeak and Swift only; ignored for
14587 # other engines). A value in the range 0-100. If an invalid value or
14588 # 'undef', the engine's default pitch is used
14589 # $volume - Volume used with the TTS engine (Festival server and Swift only; ignored
14590 # for other engines, including Festival command line). A value in the
14591 # range 0-100. If an invalid value or 'undef', the engine's default pitch
14592 # is used
14593 # Return values
14594 # 'undef' on improper arguments or if the job can't be created
14595 # 1 otherwise
14596  
14597 my ($self, $text, $engine, $voice, $speed, $rate, $pitch, $volume, $check) = @_;
14598  
14599 # Local variables
14600 my $jobObj;
14601  
14602 # Check for improper arguments
14603 if (! defined $text || ! defined $engine || defined $check) {
14604  
14605 return $axmud::CLIENT->writeImproper($self->_objClass . '->openURL', @_);
14606 }
14607  
14608 # Create the TTS job
14609 $jobObj = Games::Axmud::Obj::TtsJob->new(
14610 $text,
14611 $engine,
14612 $voice,
14613 $speed,
14614 $rate,
14615 $pitch,
14616 $volume,
14617 );
14618  
14619 if (! $jobObj) {
14620  
14621 return undef;
14622  
14623 } else {
14624  
14625 # Add the new job to the list, deleting the oldest job, if the list is now too long
14626 $self->ivPush('ttsJobList', $jobObj);
14627 if ((scalar $self->ttsJobList) > $self->ttsJobMax) {
14628  
14629 $self->ivShift('ttsJobList');
14630 }
14631  
14632 if ($self->ttsJobPointer == -1) {
14633  
14634 $self->ivPoke('ttsJobPointer', ((scalar $self->ttsJobList) - 1));
14635 }
14636  
14637 return 1;
14638 }
14639 }
14640  
14641 sub ttsAddUrgentJob {
14642  
14643 # Can be called by anything to add a job to $self->ttsUrgentJobList. Jobs on this list are
14644 # performed immediately, and before any job in $self->ttsJobList
14645 # Currently used only for system messages that must be read aloud immediately
14646 #
14647 # Expected arguments
14648 # $text - The text to convert to speech (should not be an empty string)
14649 #
14650 # Optional arguments
14651 # $configName - The name of the TTS configuration to use. If 'undef' or an
14652 # unrecognised name, uses the 'system' configuration
14653 # $overrideFlag - If TRUE, the urgent job list is emptied, before this job is added. If
14654 # FALSE (or 'undef'), other urgent jobs are performed first
14655 # $engine, $voice, $speed, $rate, $pitch, $volume
14656 # - Values which, if specified, override those specified by the TTS
14657 # configuration
14658 #
14659 # Return values
14660 # 'undef' on improper arguments or if the job can't be created
14661 # 1 otherwise
14662  
14663 my (
14664 $self, $text, $configName, $overrideFlag, $engine, $voice, $speed, $rate, $pitch,
14665 $volume, $check
14666 ) = @_;
14667  
14668 # Local variables
14669 my ($configObj, $jobObj);
14670  
14671 # Check for improper arguments
14672 if (! defined $text || defined $check) {
14673  
14674 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsAddUrgentJob', @_);
14675 }
14676  
14677 # Set values to use
14678 if (! defined $configName || ! $self->ivExists('ttsObjHash', $configName)) {
14679  
14680 $configName = 'system'
14681 }
14682  
14683 $configObj = $self->ivShow('ttsObjHash', $configName);
14684  
14685 if (! defined $engine) {
14686  
14687 $engine = $configObj->engine;
14688 }
14689  
14690 if (! defined $voice) {
14691  
14692 $voice = $configObj->voice;
14693 }
14694  
14695 if (! defined $speed) {
14696  
14697 $speed = $configObj->speed;
14698 }
14699  
14700 if (! defined $rate) {
14701  
14702 $rate = $configObj->rate;
14703 }
14704  
14705 if (! defined $pitch) {
14706  
14707 $pitch = $configObj->pitch;
14708 }
14709  
14710 if (! defined $volume) {
14711  
14712 $volume = $configObj->volume;
14713 }
14714  
14715 # Create the TTS job
14716 $jobObj = Games::Axmud::Obj::TtsJob->new(
14717 $text,
14718 $engine,
14719 $voice,
14720 $speed,
14721 $rate,
14722 $pitch,
14723 $volume,
14724 TRUE, # This is an urgent job
14725 );
14726  
14727 if (! $jobObj) {
14728  
14729 return undef;
14730  
14731 } else {
14732  
14733 # Add the new job to the urgent list
14734 if ($overrideFlag) {
14735 $self->ivPoke('ttsUrgentJobList', $jobObj);
14736 } else {
14737 $self->ivPush('ttsUrgentJobList', $jobObj);
14738 }
14739  
14740 # Interrupt any ongoing TTS
14741 $self->ttsInterruptJob();
14742 # Update other IVs, as if the user had typed ';shutup' (unless we are alrady at the end
14743 # of the list; in that case, it's better to keep reading aloud new incoming text)
14744 if ($self->ttsJobPointer > -1) {
14745  
14746 $self->ivPoke('ttsJobAutoFlag', FALSE);
14747 $self->ivPoke('ttsJobOnceFlag', FALSE);
14748 }
14749  
14750 return 1;
14751 }
14752 }
14753  
14754 sub ttsPerformJobs {
14755  
14756 # Called by $self->spinClientLoop (only)
14757 # This function does three things on every spin of the client loop:
14758 # 1. TTS requested actions are used to handle Axmud's connection to a Festival server. If
14759 # requested actions have been made, executes the first one and returns, without
14760 # executing any more actions or performing any TTS jobs
14761 # 2. If a previous call to this function has sent text to a TTS engine, checks to see
14762 # whether the TTS conversion has been completed, and updates IVs if so
14763 # 3. A TTS job comprises a piece of text to be converted to speech (by sending the text to
14764 # a TTS engine). The text is sometimes split into pieces (sentences or words), and
14765 # converted to speech one piece at a time. If TTS jobs are waiting to be performed,
14766 # performs the first one. Any 'urgent' TTS jobs take priority over other jobs.
14767 # Performing a job comprises converting the whole text to speech, or just one
14768 # sentence/word of it. (Subsequent jobs are performed in future calls to this
14769 # function)
14770 #
14771 # Expected arguments
14772 # (none besides $self)
14773 #
14774 # Return values
14775 # 'undef' on improper arguments
14776 # 1 otherwise
14777  
14778 my ($self, $check) = @_;
14779  
14780 # Local variables
14781 my (
14782 $request, $jobObj, $urgentFlag,
14783 @cmdList,
14784 );
14785  
14786 # Check for improper arguments
14787 if (defined $check) {
14788  
14789 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsPerformJobs', @_);
14790 }
14791  
14792 # Perform the first requested action for the Festival server
14793 # (Perform only one request per spin of the client loop, giving the Festival server a chance
14794 # to start up, before we try to connect to it. Ignore any invalid requests)
14795 $request = $self->ivShift('ttsFestivalRequestList');
14796 if (defined $request) {
14797  
14798 if ($request eq 'disconnect' && $self->ttsFestivalSocket) {
14799  
14800 # Disconnect from a Festival server
14801 $self->ttsFestivalDisconnect();
14802  
14803 } elsif ($request eq 'start') {
14804  
14805 # Start the Festival server
14806 $self->ttsFestivalStart();
14807  
14808 } elsif ($request eq 'connect' && ! $self->ttsFestivalSocket) {
14809  
14810 # Connect to a Festival server
14811 if (! $self->ttsFestivalConnect()) {
14812  
14813 if (defined $self->ttsFestivalCheckTime) {
14814  
14815 # When the server has just been started, we wait a few seconds before giving
14816 # up trying to connect to it, rather than giving up immediately, as we
14817 # ordinarly would
14818 if ($self->ttsFestivalCheckTime > $self->getTime()) {
14819  
14820 # Process this same request again, on the next spin of the client loop
14821 $self->ivUnshift('ttsFestivalRequestList', $request);
14822  
14823 } else {
14824  
14825 # We have been waiting too long, so give up
14826 $self->ivUndef('ttsFestivalCheckTime');
14827 # Default to using the command-line engine
14828 $self->ivPoke('ttsFestivalServerMode', 'cmd_line');
14829 $self->ivPoke('ttsFestivalConnectMode', 'cmd_line');
14830 }
14831  
14832 } else {
14833  
14834 # Failed once-only connection. Default to using the command-line engine
14835 $self->ivPoke('ttsFestivalServerMode', 'cmd_line');
14836 $self->ivPoke('ttsFestivalConnectMode', 'cmd_line');
14837 }
14838  
14839 } else {
14840  
14841 # Make sure the IV is reset after a successful connection
14842 $self->ivUndef('ttsFestivalCheckTime');
14843 }
14844 }
14845  
14846 # Do not perform any more requests, or any more jobs, until the next spin of the
14847 # client loop. (This gives us time to connect to a Festival server, before doing
14848 # text-to-speech)
14849 return 1;
14850 }
14851  
14852 # If text was being converted to speech during the last spin of the client loop, see if it's
14853 # finished yet
14854 if ($self->ttsCurrentHarness) {
14855  
14856 if ($self->ttsCurrentHarness->pumpable()) {
14857  
14858 # TTS conversion in progress; wait for the next spin of the client loop before
14859 # performing the next job, if any
14860 return 1;
14861  
14862 } else {
14863  
14864 # TTS conversion completed; update the IV
14865 $self->ivUndef('ttsCurrentHarness');
14866 }
14867 }
14868  
14869 # Perform the current TTS job, if it's waiting to be performed
14870 if (
14871 ($self->ttsJobAutoFlag || $self->ttsJobOnceFlag)
14872 || $self->ttsUrgentJobList
14873 ) {
14874 # Get the next job, if any. 'Urgent' jobs take priority over everything else
14875 $jobObj = $self->ivShift('ttsUrgentJobList');
14876 if (! $jobObj) {
14877  
14878 $jobObj = $self->ttsGetNextJob();
14879 if ($jobObj) {
14880  
14881 # Set the value of GA::Obj::TtsJob->currentText which, depending on the value of
14882 # $self->ttsJobMode, will be the whole of its ->text, or just a sentence, or
14883 # just a single word
14884 # (This does not apply to 'urgen't jobs, which are always performed with their
14885 # entire ->text)
14886 $jobObj->prepareText();
14887 }
14888 }
14889  
14890 if ($jobObj) {
14891  
14892 # Retrieve values from the GA::Obj::TtsJob, and convert them into a list of
14893 # parameters to be used in the system command
14894 @cmdList = $self->ttsPrepareSystemCmd($jobObj);
14895 if (@cmdList) {
14896  
14897 # Mark this job's text as having been converted to speech at least once (and
14898 # perhaps only partially)
14899 $jobObj->ivPoke('newFlag', FALSE);
14900  
14901 # Convert text to speech using the Festival engine
14902 if ($jobObj->engine eq 'festival') {
14903  
14904 if (
14905 $self->ttsFestivalConnectMode eq 'connected'
14906 && ($^O ne 'MSWin32')
14907 ) {
14908 # Use the server engine. If the socket has closed,
14909 # $self->ttsFestivalServerMode is updated. We never use the server
14910 # engine on MS windows
14911 $self->ttsFestivalSend($cmdList[0]);
14912 }
14913  
14914 if ($self->ttsFestivalServerMode eq 'cmd_line') {
14915  
14916 # Use the command-line engine
14917 # The first argument in @cmdList is for the server engine, so discard it
14918 shift @cmdList;
14919 # The rest of @cmdList is already in the correct format for
14920 # IPC::Run::start, so we don't need to take out a reference on it,
14921 # as we do for all other engines
14922 if ($^O ne 'MSWin32') {
14923  
14924 eval {
14925 $self->ivPoke('ttsCurrentHarness', IPC::Run::start(@cmdList));
14926 };
14927  
14928 } else {
14929  
14930 # N.B. In order for this to work, the IPC::Run code itself must be
14931 # modified. See the notes in ../axmud/nsis/axmud.install.nsi
14932 eval {
14933 $self->ivPoke(
14934 'ttsCurrentHarness',
14935 IPC::Run::start_festival(@cmdList),
14936 );
14937 };
14938 }
14939 }
14940  
14941 # Convert text to speech using all other supported engines
14942 } else {
14943  
14944 # All engines except Festival
14945 eval { $self->ivPoke('ttsCurrentHarness', IPC::Run::start(\@cmdList)); };
14946 }
14947 }
14948  
14949 # (Urgent jobs do not affect our pointers at all)
14950 if (! $jobObj->urgentFlag) {
14951  
14952 # Move the pointer(s) to the next word, sentence or job, if necessary
14953 if ($self->ttsJobAutoFlag) {
14954  
14955 # On the next spin of the loop, perform the job after this one (if required)
14956 $self->ttsAdvancePointer();
14957  
14958 } elsif ($self->ttsJobOnceFlag) {
14959  
14960 # The job we've just performed is only performed once
14961 $self->ivPoke('ttsJobOnceFlag', FALSE);
14962 }
14963  
14964 # Update the IV which prevents ;skip from going straight to the second sentence/
14965 # word in a job, after a change to $self->ttsJobMode
14966 $self->ivPoke('ttsChangeModeFlag', FALSE);
14967 }
14968 }
14969 }
14970  
14971 # Wait for the next spin of the client loop
14972 return 1;
14973 }
14974  
14975 sub ttsGetNextJob {
14976  
14977 # Called by $self->ttsPerformJobs
14978 # A pointer specifies which TTS job in the job list is the next one to be performed
14979 # Depending on current settings, either return the job, or return 'undef' if there is no job
14980 # to perform
14981 #
14982 # Expected arguments
14983 # (none)
14984 #
14985 # Return values
14986 # 'undef' on improper arguments or if there is no job to perform
14987 # Otherwise, returns the GA::Obj::TTSJob object for the next job to perform
14988  
14989 my ($self, $check) = @_;
14990  
14991 # Check for improper arguments
14992 if (defined $check) {
14993  
14994 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsGetNextJob', @_);
14995 }
14996  
14997 if ($self->ttsJobAutoFlag || $self->ttsJobOnceFlag) {
14998  
14999 if (! $self->ttsJobList || $self->ttsJobPointer == -1) {
15000  
15001 # Job list is empty, or all jobs already performed (so pointer is at the end of the
15002 # list)
15003 return undef;
15004  
15005 } else {
15006  
15007 # A job is waiting to be performed
15008 return $self->ttsReadJob($self->ttsJobPointer);
15009 }
15010 }
15011 }
15012  
15013 sub ttsReadJob {
15014  
15015 # Called by $self->ttsGetNextJob, ->ttsAdvancePointer and ->ttsRegressPointer
15016 # A pointer specifies which TTS job in the job list is the next one to be performed
15017 # Read the next job and return it
15018 #
15019 # Expected arguments
15020 # $pointer - An index in $self->ttsJobList, pointing at a GA::Obj::TtsJob object
15021 #
15022 # Return values
15023 # 'undef' on improper arguments or if there is no job to perform
15024 # Otherwise, returns the GA::Obj::TTSJob object for the next job to perform
15025  
15026 my ($self, $pointer, $check) = @_;
15027  
15028 # Check for improper arguments
15029 if (! defined $pointer || defined $check) {
15030  
15031 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsReadJob', @_);
15032 }
15033  
15034 # (The calling function should have checked that the list contains jobs, and that the
15035 # pointer is not at the end of the list)
15036 if (! $self->ttsJobList || $pointer == -1) {
15037  
15038 return undef;
15039  
15040 } else {
15041  
15042 return $self->ivIndex('ttsJobList', $pointer);
15043 }
15044 }
15045  
15046 sub ttsAdvancePointer {
15047  
15048 # Called by $self->ttsPerformJobs and ->ttsSkipJob
15049 #
15050 # Two pointers specify the next piece of text to be converted to speech
15051 # $self->ttsJobPointer points to an index in $self->ttsJobList, corresponding to a
15052 # GA::Obj::TtsJob object. If the pointer is at the end of the list, its value is -1
15053 # $self->ttsJobMiniPointer points to a position in that job's text (the first character is
15054 # 0)
15055 #
15056 # Move the pointers from their current position, to the next position (the next job, and/or
15057 # the next sentence/word in the current job)
15058 #
15059 # Expected arguments
15060 # (none besides ($self)
15061 #
15062 # Return values
15063 # 'undef' on improper arguments or if there's an error
15064 # 1 otherwise
15065  
15066 my ($self, $check) = @_;
15067  
15068 # Local variables
15069 my ($jobObj, $mode, $result);
15070  
15071 # Check for improper arguments
15072 if (defined $check) {
15073  
15074 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsAdvancePointer', @_);
15075 }
15076  
15077 # (Don't do anything if the job list is empty, or if the pointer is already at the end of
15078 # the list)
15079 if ($self->ttsJobList && $self->ttsJobPointer > -1) {
15080  
15081 $jobObj = $self->ttsReadJob($self->ttsJobPointer);
15082 if (! $jobObj) {
15083  
15084 # Some kind of error. Mark the pointer at the end of the list
15085 $self->ivPoke('ttsJobPointer', -1);
15086 $self->ivPoke('ttsJobMiniPointer', 0);
15087 # When we reach the end of the list, resume auto-reading text
15088 $self->ivPoke('ttsJobAutoFlag', TRUE);
15089  
15090 return undef;
15091 }
15092  
15093 $mode = $self->ttsJobMode;
15094  
15095 if ($mode eq 'sentence' && ! $self->ttsJobAutoFlag) {
15096  
15097 # Advance the pointer(s), one sentence at a time
15098 $result = $jobObj->findNextSentence($self->ttsJobMiniPointer);
15099 if (! defined $result) {
15100  
15101 # The mini-pointer is already pointing to the start of the last sentence.
15102 # Advance the pointer to the beginning of the next line
15103 $mode = 'default';
15104  
15105 } else {
15106  
15107 $self->ivPoke('ttsJobMiniPointer', $result);
15108 }
15109  
15110 } elsif ($mode eq 'word' && ! $self->ttsJobAutoFlag) {
15111  
15112 # Advance the pointer(s), one word at a time
15113 $result = $jobObj->findNextWord($self->ttsJobMiniPointer);
15114 if (! defined $result) {
15115  
15116 # The mini-pointer is already pointing to the start of the last word. Advance
15117 # the pointer to the beginning of the next line
15118 $mode = 'default';
15119  
15120 } else {
15121  
15122 $self->ivPoke('ttsJobMiniPointer', $result);
15123 }
15124 }
15125  
15126 if ($mode eq 'default' || $self->ttsJobAutoFlag) {
15127  
15128 # Advance the main pointer to the next job
15129 if ($self->ttsJobPointer >= ((scalar $self->ttsJobList) - 1)) {
15130  
15131 # Now at the end of the job list
15132 $self->ivPoke('ttsJobPointer', -1);
15133 $self->ivPoke('ttsJobMiniPointer', 0);
15134 # When we reach the end of the list, resume auto-reading text
15135 $self->ivPoke('ttsJobAutoFlag', TRUE);
15136  
15137 } else {
15138  
15139 # Move the pointer to the next job in the list
15140 $self->ivIncrement('ttsJobPointer');
15141 $self->ivPoke('ttsJobMiniPointer', 0);
15142 }
15143 }
15144 }
15145  
15146 return 1;
15147 }
15148  
15149 sub ttsRegressPointer {
15150  
15151 # Called by $self->ttsUnskipJob and ->ttsLastJob
15152 #
15153 # Two pointers specify the next piece of text to be converted to speech
15154 # $self->ttsJobPointer points to an index in $self->ttsJobList, corresponding to a
15155 # GA::Obj::TtsJob object. If the pointer is at the end of the list, its value is -1
15156 # $self->ttsJobMiniPointer points to a position in that job's text (the first character is
15157 # 0)
15158 #
15159 # Move the pointers from their current position, to the previous position (the previous job,
15160 # and/or the previous sentence/word in the current job)
15161 #
15162 # Expected arguments
15163 # (none besides ($self)
15164 #
15165 # Return values
15166 # 'undef' on improper arguments or if there's an error
15167 # 1 otherwise
15168  
15169 my ($self, $check) = @_;
15170  
15171 # Local variables
15172 my ($jobObj, $mode, $result, $updateFlag, $pointer, $newJobObj);
15173  
15174 # Check for improper arguments
15175 if (defined $check) {
15176  
15177 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsRegressPointer', @_);
15178 }
15179  
15180 # (Don't do anything if the job list is empty, or if both pointers are already at the
15181 # beginning of the list)
15182 if ($self->ttsJobList && ($self->ttsJobPointer != 0 || $self->ttsJobMiniPointer != 0)) {
15183  
15184 $mode = $self->ttsJobMode;
15185  
15186 if ($self->ttsJobPointer != -1) {
15187  
15188 $jobObj = $self->ttsReadJob($self->ttsJobPointer);
15189 if (! $jobObj) {
15190  
15191 # Some kind of error. Mark the pointer at the beginning of the list
15192 $self->ivPoke('ttsJobPointer', 0);
15193 $self->ivPoke('ttsJobMiniPointer', 0);
15194  
15195 return undef;
15196 }
15197  
15198 } elsif ($mode eq 'sentence' || $mode eq 'word') {
15199  
15200 # The main pointer is at the end of the list. Allow the code below to regress the
15201 # pointer to the previous job, then the last sentence/word in that job
15202 $mode = 'default';
15203 $updateFlag = TRUE;
15204 }
15205  
15206 if ($mode eq 'sentence') {
15207  
15208 # Regress the pointer(s), one sentence at a time
15209 $result = $jobObj->findPreviousSentence($self->ttsJobMiniPointer);
15210 if (! defined $result) {
15211  
15212 # The mini-pointer is already pointing to the start of the first sentence (or
15213 # there was an error)
15214 # Regress the pointer to the last sentence in the previous line
15215 $mode = 'default';
15216 if ($self->ttsJobPointer != 0) {
15217  
15218 $updateFlag = TRUE;
15219 }
15220  
15221 } else {
15222  
15223 $self->ivPoke('ttsJobMiniPointer', $result);
15224 }
15225  
15226 } elsif ($mode eq 'word') {
15227  
15228 # Regress the pointer(s), one word at a time
15229 $result = $jobObj->findPreviousWord($self->ttsJobMiniPointer);
15230 if (! defined $result) {
15231  
15232 # The mini-pointer is already pointing to the start of the first word (or
15233 # there was an error)
15234 # Regress the pointer to the last word in the previous line
15235 $mode = 'default';
15236 if ($self->ttsJobPointer != 0) {
15237  
15238 $updateFlag = TRUE;
15239 }
15240  
15241 } else {
15242  
15243 $self->ivPoke('ttsJobMiniPointer', $result);
15244 }
15245 }
15246  
15247 if ($mode eq 'default') {
15248  
15249 # Regress the pointer to the previous job
15250 if ($self->ttsJobPointer == -1) {
15251 $pointer = scalar $self->ttsJobList;
15252 } else {
15253 $pointer = $self->ttsJobPointer;
15254 }
15255  
15256 if ($pointer > 0) {
15257  
15258 $pointer--;
15259 }
15260  
15261 $self->ivPoke('ttsJobPointer', $pointer);
15262 $self->ivPoke('ttsJobMiniPointer', 0);
15263  
15264 if ($updateFlag) {
15265  
15266 $newJobObj = $self->ttsReadJob($self->ttsJobPointer);
15267 if ($newJobObj) {
15268  
15269 if ($self->ttsJobMode eq 'sentence') {
15270 $result = $newJobObj->findPreviousSentence(length($newJobObj->text));
15271 } else {
15272 $result = $newJobObj->findPreviousWord(length($newJobObj->text));
15273 }
15274  
15275 if (! defined $result) {
15276  
15277 # The previous job contains only one sentence/word
15278 $self->ivPoke('ttsJobMiniPointer', 0);
15279  
15280 } else {
15281  
15282 # The previous job contains multiple sentences/words
15283 $self->ivPoke('ttsJobMiniPointer', $result);
15284 }
15285 }
15286 }
15287 }
15288 }
15289  
15290 return 1;
15291 }
15292  
15293 sub ttsSkipJob {
15294  
15295 # Can be called by anything (but usually called by GA::Cmd::Skip->do)
15296 # Depending on the value of $self->ttsJobMode, interrupt any text currently being converted
15297 # to speech, and move the pointers to the next job, or the next sentence or word in the
15298 # current job
15299 #
15300 # Expected arguments
15301 # (none besides ($self)
15302 #
15303 # Optional arguments
15304 # $jobCount - If specified, must be an integer, 1 or above. Override the normal
15305 # behaviour by resetting IVs to their default values, then skipping
15306 # the specified number of jobs in the list (or to the last job in the
15307 # list, if there aren't enough jobs)
15308 #
15309 # Return values
15310 # 'undef' on improper arguments
15311 # 1 otherwise
15312  
15313 my ($self, $jobCount, $check) = @_;
15314  
15315 # Check for improper arguments
15316 if ((defined $jobCount && ! $self->intCheck($jobCount, 1)) || defined $check) {
15317  
15318 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsSkipJob', @_);
15319 }
15320  
15321 # Advance the pointer, in order to perform the next job, if necessary
15322 if ($self->ttsJobList) {
15323  
15324 if (! defined $jobCount) {
15325  
15326 if (
15327 # (When this flag is set, the pointer has already been advanced by
15328 # ->ttsPerformJobs)
15329 ! $self->ttsJobAutoFlag
15330 # (When this flag is set, there has been a change in $self->ttsJobMode. Let the
15331 # user hear the first sentence/word in the job, not the second one)
15332 && ! $self->ttsChangeModeFlag
15333 ) {
15334 $self->ttsAdvancePointer();
15335 }
15336  
15337 } else {
15338  
15339 if ($self->ttsJobPointer != -1) {
15340  
15341 $self->ivPoke('ttsJobPointer', ($self->ttsJobPointer + $jobCount));
15342 }
15343  
15344 if ($self->ttsJobPointer >= scalar ($self->ttsJobList)) {
15345  
15346 $self->ivPoke('ttsJobPointer', -1);
15347 }
15348  
15349 $self->ivPoke('ttsJobMiniPointer', 0);
15350 }
15351  
15352 $self->ivPoke('ttsChangeModeFlag', FALSE);
15353 if ($self->ttsJobPointer > -1 && ! $self->ttsJobAutoFlag) {
15354  
15355 $self->ivPoke('ttsJobOnceFlag', TRUE);
15356 }
15357  
15358 # Interrupt any text being converted to speech right now, allowing the next job to
15359 # start as quickly as possible
15360 $self->ttsInterruptJob();
15361 }
15362  
15363 return 1;
15364 }
15365  
15366 sub ttsUnskipJob {
15367  
15368 # Can be called by anything (but usually called by GA::Cmd::Unskip->do)
15369 # Depending on the value of $self->ttsJobMode, interrupt any text currently being converted
15370 # to speech, and move the pointers to the previous job, or the previous sentence or word
15371 # in the current job
15372 #
15373 # Expected arguments
15374 # (none besides ($self)
15375 #
15376 # Optional arguments
15377 # $jobCount - If specified, must be an integer, 1 or above. Override the normal
15378 # behaviour by resetting IVs to their default values, then unskipping
15379 # the specified number of jobs in the list (or to the first job in the
15380 # list, if there aren't enough jobs)
15381 #
15382 # Return values
15383 # 'undef' on improper arguments
15384 # 1 otherwise
15385  
15386 my ($self, $jobCount, $check) = @_;
15387  
15388 # Check for improper arguments
15389 if ((defined $jobCount && ! $self->intCheck($jobCount, 1)) || defined $check) {
15390  
15391 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsUnskipJob', @_);
15392 }
15393  
15394 if ($self->ttsJobList) {
15395  
15396 if (! defined $jobCount) {
15397  
15398 if ($self->ttsJobAutoFlag && $self->ttsCurrentHarness) {
15399  
15400 # A job is being performed right now, and the pointer has already been advanced
15401 # to the next job; therefore, to get the previous line/sentence/word, we need
15402 # to regress the pointer twice
15403 $self->ttsRegressPointer();
15404 }
15405  
15406 # If the pointer is already at the beginning of the list, re-perform the first job
15407 # in the list
15408 # (This doesn't happen when we're at the end of the list, and $self->ttsSkipJob is
15409 # called)
15410 $self->ttsRegressPointer();
15411  
15412 } else {
15413  
15414 if ($self->ttsJobPointer != -1) {
15415  
15416 $self->ivPoke('ttsJobPointer', ($self->ttsJobPointer - $jobCount));
15417 } else {
15418 $self->ivPoke('ttsJobPointer', ((scalar $self->ttsJobList) - $jobCount - 1));
15419 }
15420  
15421 if ($self->ttsJobPointer < 0) {
15422  
15423 $self->ivPoke('ttsJobPointer', 0);
15424 }
15425  
15426 $self->ivPoke('ttsJobMiniPointer', 0);
15427 }
15428  
15429 $self->ivPoke('ttsJobAutoFlag', FALSE);
15430 $self->ivPoke('ttsJobOnceFlag', TRUE);
15431  
15432 # Interrupt any text being converted to speech right now, allowing the next job to
15433 # start as quickly as possible
15434 $self->ttsInterruptJob();
15435 }
15436  
15437 return 1;
15438 }
15439  
15440 sub ttsFirstJob {
15441  
15442 # Can be called by anything (but usually called by GA::Cmd::First->do)
15443 # Depending on the value of $self->ttsJobMode, interrupt any text currently being converted
15444 # to speech, and move the pointers to the first job, or the first sentence or word in the
15445 # current job
15446 #
15447 # Expected arguments
15448 # (none besides ($self)
15449 #
15450 # Return values
15451 # 'undef' on improper arguments
15452 # 1 otherwise
15453  
15454 my ($self, $check) = @_;
15455  
15456 # Check for improper arguments
15457 if (defined $check) {
15458  
15459 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsFirstJob', @_);
15460 }
15461  
15462 if ($self->ttsJobList) {
15463  
15464 if ($self->ttsJobMode eq 'default') {
15465  
15466 # Move the main pointer to the beginning of the job list
15467 $self->ivPoke('ttsJobPointer', 0);
15468 $self->ivPoke('ttsJobMiniPointer', 0);
15469  
15470 } else {
15471  
15472 # Replay the first word/sentence in the current job
15473 $self->ivPoke('ttsJobMiniPointer', 0);
15474 }
15475  
15476 $self->ivPoke('ttsJobAutoFlag', FALSE);
15477 $self->ivPoke('ttsJobOnceFlag', TRUE);
15478  
15479 # Interrupt any text being converted to speech right now, allowing the next job to
15480 # start as quickly as possible
15481 $self->ttsInterruptJob();
15482 }
15483  
15484 return 1;
15485 }
15486  
15487 sub ttsLastJob {
15488  
15489 # Can be called by anything (but usually called by GA::Cmd::Last->do)
15490 # Depending on the value of $self->ttsJobMode, interrupt any text currently being converted
15491 # to speech, and move the pointers to the first job, or the first sentence or word in the
15492 # current job
15493 #
15494 # Expected arguments
15495 # (none besides ($self)
15496 #
15497 # Return values
15498 # 'undef' on improper arguments
15499 # 1 otherwise
15500  
15501 my ($self, $check) = @_;
15502  
15503 # Local variables
15504 my ($jobObj, $result);
15505  
15506 # Check for improper arguments
15507 if (defined $check) {
15508  
15509 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsLastJob', @_);
15510 }
15511  
15512 if ($self->ttsJobList) {
15513  
15514 $jobObj = $self->ttsReadJob($self->ttsJobPointer);
15515  
15516 if (! $jobObj || $self->ttsJobMode eq 'default') {
15517  
15518 # Move the pointer after the last job...
15519 $self->ivPoke('ttsJobPointer', -1);
15520 $self->ivPoke('ttsJobMiniPointer', 0);
15521  
15522 # Then regress the pointer to put it at the beginning of the last job, ready to read
15523 # it out
15524 $self->ttsRegressPointer();
15525  
15526 $self->ivPoke('ttsJobAutoFlag', TRUE);
15527 $self->ivPoke('ttsJobOnceFlag', FALSE);
15528  
15529 } else {
15530  
15531 # Move the mini-pointer to the start of the job's text
15532 $self->ivPoke('ttsJobMiniPointer', 0);
15533  
15534 if ($self->ttsJobMode eq 'sentence') {
15535  
15536 # Then move it to the final sentence, one sentence at a time
15537 do {
15538  
15539 $result = $jobObj->findNextSentence($self->ttsJobMiniPointer);
15540 if (defined $result) {
15541  
15542 $self->ivPoke('ttsJobMiniPointer', $result);
15543 }
15544  
15545 } until (! defined $result);
15546  
15547 } elsif ($self->ttsJobMode eq 'word') {
15548  
15549 # Then move it to the final word, one word at a time
15550 do {
15551  
15552 $result = $jobObj->findNextWord($self->ttsJobMiniPointer);
15553 if (defined $result) {
15554  
15555 $self->ivPoke('ttsJobMiniPointer', $result);
15556 }
15557  
15558 } until (! defined $result);
15559 }
15560  
15561 $self->ivPoke('ttsJobAutoFlag', FALSE);
15562 $self->ivPoke('ttsJobOnceFlag', TRUE);
15563 }
15564  
15565 # Interrupt any text being converted to speech right now, allowing the next job to
15566 # start as quickly as possible
15567 $self->ttsInterruptJob();
15568 }
15569  
15570 return 1;
15571 }
15572  
15573 sub ttsResumeJob {
15574  
15575 # Can be called by anything (but usually called by GA::Cmd::Last->resume)
15576 # Does two things. Usually, it interrupts any text currently being converted to speech,
15577 # switches to performing jobs by line (not by sentence or word), and moves the pointer to
15578 # the first job whose text has never been converted to speech
15579 # If this is already happening, then interrupt any text currently being converted to speech
15580 # and move the pointer to the end of the list (ready to perform the next job that arrives)
15581 #
15582 # Expected arguments
15583 # (none besides ($self)
15584 #
15585 # Return values
15586 # 'undef' on improper arguments
15587 # 1 otherwise
15588  
15589 my ($self, $check) = @_;
15590  
15591 # Local variables
15592 my ($count, $jobObj);
15593  
15594 # Check for improper arguments
15595 if (defined $check) {
15596  
15597 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsResumeJob', @_);
15598 }
15599  
15600 if ($self->ttsJobMode eq 'default' && $self->ttsJobAutoFlag) {
15601  
15602 # Move the pointer to the end of the list
15603 $self->ivPoke('ttsJobPointer', -1);
15604 $self->ivPoke('ttsJobMiniPointer', 0);
15605  
15606 } else {
15607  
15608 $self->ivPoke('ttsJobMode', 'default');
15609 $self->ivPoke('ttsJobAutoFlag', TRUE);
15610 $self->ivPoke('ttsJobOnceFlag', TRUE);
15611  
15612 # Find the first job which has never been converted to speech, even partially
15613 $count = -1;
15614 OUTER: foreach my $otherJobObj ($self->ttsJobList) {
15615  
15616 $count++;
15617 if ($otherJobObj->newFlag) {
15618  
15619 $jobObj = $otherJobObj;
15620 last OUTER;
15621 }
15622 }
15623  
15624 if (! $jobObj) {
15625  
15626 # All jobs performed; move the pointer to the end of the list
15627 $self->ivPoke('ttsJobPointer', -1);
15628 $self->ivPoke('ttsJobMiniPointer', 0);
15629  
15630 } else {
15631  
15632 # Move the pointer to the job
15633 $self->ivPoke('ttsJobPointer', $count);
15634 $self->ivPoke('ttsJobMiniPointer', 0);
15635 }
15636 }
15637  
15638 # Interrupt any text being converted to speech right now, allowing the next job to start as
15639 # quickly as possible
15640 $self->ttsInterruptJob();
15641  
15642 return 1;
15643 }
15644  
15645 sub ttsSilenceJob {
15646  
15647 # Can be called by anything (but usually called by GA::Cmd::Last->shutup)
15648 # If text is being converted to speech right now, interrupts it
15649 # If $self->ttsJobAutoFlag is set, unsets it (so the user can use ;skip, ;unskip and so on
15650 # to replay jobs before and after the current one)
15651 #
15652 # Expected arguments
15653 # (none besides ($self)
15654 #
15655 # Return values
15656 # 'undef' on improper arguments
15657 # 1 otherwise
15658  
15659 my ($self, $check) = @_;
15660  
15661 # Check for improper arguments
15662 if (defined $check) {
15663  
15664 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsSilenceJob', @_);
15665 }
15666  
15667 # Update IVs
15668 $self->ivPoke('ttsJobAutoFlag', FALSE);
15669 $self->ivPoke('ttsJobOnceFlag', FALSE);
15670  
15671 # Interrupt any text being converted to speech right now, allowing the next job to start as
15672 # quickly as possible
15673 $self->ttsInterruptJob();
15674  
15675 return 1;
15676 }
15677  
15678 sub ttsInterruptJob {
15679  
15680 # Can be called by anything, but usually called by GA::Cmd::Shutup->do, or by
15681 # $self->ttsSkipJob, ->ttsUnskipJob, ->ttsFirstJob and ->ttsLastJob
15682 # If text is currently being converted to speech by a speech engine, interrupts it,
15683 # allowing the next job (or sentence/word) to be converted, if one is waiting to be
15684 # converted
15685 #
15686 # Expected arguments
15687 # (none besides ($self)
15688 #
15689 # Return values
15690 # 'undef' on improper arguments
15691 # 1 otherwise
15692  
15693 my ($self, $check) = @_;
15694  
15695 # Check for improper arguments
15696 if (defined $check) {
15697  
15698 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsInterruptJob', @_);
15699 }
15700  
15701 # When this IV is set, text is being converted to speech by a speech engine other than the
15702 # Festival server engine
15703 if ($self->ttsCurrentHarness) {
15704  
15705 if ($self->ttsCurrentHarness->pumpable()) {
15706  
15707 # IPC::Run::kill_kill($self->ttsCurrentHarness, coup_d_grace => "QUIT");
15708 IPC::Run::kill_kill($self->ttsCurrentHarness, grace => 0);
15709 }
15710  
15711 # Interrupt the Festival server engine, if connected
15712 } elsif (
15713 $self->ttsFestivalServerMode eq 'server'
15714 && $self->ttsFestivalConnectMode eq 'connected'
15715 ) {
15716 # DEBUG N.B. For unknown reasons, this should interrupt the Festival server engine,
15717 # but does not
15718 $self->ttsFestivalSend("(audio_mode 'shutup)");
15719 }
15720  
15721 return 1;
15722 }
15723  
15724 sub ttsPrepareSystemCmd {
15725  
15726 # Called by $self->ttsPerformJobs
15727 # Prepares the parameters of a system command for performing the specifed TTS job. The
15728 # parameters depend on the operating system and current conditions, as well as the job
15729 # itself
15730 #
15731 # Expected arguments
15732 # $jobObj - The GA::Obj::TtsJob object
15733 #
15734 # Return values
15735 # An empty list on improper arguments, if the TTS engine is unrecognised or if the job
15736 # can't be performed
15737 # Otherwise returns a list of parameters to use in the system command. For the Festival
15738 # engine, returns a list of two system commands, one for each engine version
15739  
15740 my ($self, $jobObj, $check) = @_;
15741  
15742 # Local variables
15743 my @emptyList;
15744  
15745 # Check for improper arguments
15746 if (! defined $jobObj || defined $check) {
15747  
15748 $axmud::CLIENT->writeImproper($self->_objClass . '->ttsPrepareSystemCmd', @_);
15749 return @emptyList;
15750 }
15751  
15752 if ($jobObj->engine eq 'espeak') {
15753 return $self->ttsConvertESpeak($jobObj);
15754 } elsif ($jobObj->engine eq 'esng') {
15755 return $self->ttsConvertESNG($jobObj);
15756 } elsif ($jobObj->engine eq 'flite') {
15757 return $self->ttsConvertFlite($jobObj);
15758 } elsif ($jobObj->engine eq 'festival') {
15759 return $self->ttsConvertFestival($jobObj);
15760 } elsif ($jobObj->engine eq 'swift') {
15761 return $self->ttsConvertSwift($jobObj);
15762 } else {
15763 # Unrecognised engine
15764 return @emptyList;
15765 }
15766 }
15767  
15768 sub ttsConvertCheck {
15769  
15770 # Called by $self->ttsConvertESpeak, etc
15771 # Checks that values stored in the specified TTS job are valid (in general), before trying
15772 # to prepare a system command. For example, checks that the specified volume is in the
15773 # range 0-100
15774 # Does not check that the values are valid for a particular speech engine; that is handled
15775 # by the calling function
15776 #
15777 # Expected arguments
15778 # $jobObj - The GA::Obj::TtsJob object
15779 #
15780 # Return values
15781 # 'undef' on improper arguments, or if any of the values are valid
15782 # 1 if all values are valid
15783  
15784 my ($self, $jobObj, $check) = @_;
15785  
15786 # Check for improper arguments
15787 if (! defined $jobObj || defined $check) {
15788  
15789 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsConvertCheck', @_);
15790 }
15791  
15792 if (
15793 ! defined $jobObj->currentText
15794 || $jobObj->currentText eq ''
15795 || ! defined $self->ivFind('constTTSCompatList', $jobObj->engine)
15796 ) {
15797 return undef;
15798 }
15799  
15800 foreach my $iv (qw(speed rate pitch volume)) {
15801  
15802 my $value = $jobObj->$iv;
15803  
15804 if (
15805 defined $value
15806 && $value ne ''
15807 && (
15808 ! ($value =~ m/^[-]?\d+(\.\d*)?$/)
15809 || $value < 0
15810 || $value > 100
15811 )
15812 ) {
15813 return undef;
15814 }
15815 }
15816  
15817 # All values valid (in general)
15818 return 1;
15819 }
15820  
15821 sub ttsConvertESpeak {
15822  
15823 # Called by $self->ttsPrepareSystemCmd (only)
15824 # Prepares the parameters of a system command for performing the specifed TTS job, using the
15825 # eSpeak engine
15826 # The parameters depend on the operating system and current conditions, as well as the job
15827 # itself
15828 #
15829 # Expected arguments
15830 # $jobObj - The GA::Obj::TtsJob object
15831 #
15832 # Return values
15833 # An empty list on improper arguments, if the TTS engine is unrecognised or if the job
15834 # can't be performed
15835 # Otherwise returns a list of parameters to use in the system command
15836  
15837 my ($self, $jobObj, $check) = @_;
15838  
15839 # Local variables
15840 my (@emptyList, @cmdList);
15841  
15842 # Check for improper arguments
15843 if (! defined $jobObj || defined $check) {
15844  
15845 $axmud::CLIENT->writeImproper($self->_objClass . '->ttsConvertESpeak', @_);
15846 return @emptyList;
15847 }
15848  
15849 # Check values are valid in general
15850 if (! $self->ttsConvertCheck($jobObj)) {
15851  
15852 return @emptyList;
15853 }
15854  
15855 # Prepare the system command
15856 if ($^O eq 'MSWin32') {
15857  
15858 if (-e $self->msWinPathESpeak) {
15859  
15860 push (@cmdList, $self->msWinPathESpeak);
15861  
15862 } elsif (-e $self->msWinAltPathESpeak) {
15863  
15864 push (@cmdList, $self->msWinAltPathESpeak);
15865  
15866 } else {
15867  
15868 # eSpeak engine not installed
15869 return @emptyList;
15870 }
15871  
15872 } else {
15873  
15874 push (@cmdList, 'espeak');
15875 }
15876  
15877 if ($^O eq 'MSWin32') {
15878 push (@cmdList, $jobObj->currentText);
15879 } else {
15880 push (@cmdList, '"' . $jobObj->currentText . '"');
15881 }
15882  
15883 # With eSpeak, we can set the voice, speed and pitch, but not rate or volume
15884 if (defined $jobObj->voice && $jobObj->voice ne '') {
15885  
15886 push (@cmdList, '-v', $jobObj->voice);
15887 }
15888  
15889 # Speed in the range 10-200
15890 if (defined $jobObj->speed && $jobObj->speed ne '') {
15891  
15892 push (@cmdList, '-s', (int($jobObj->speed * 1.9) + 10));
15893 }
15894  
15895 # Pitch in the range 0-99
15896 if (defined $jobObj->pitch && $jobObj->pitch ne '') {
15897  
15898 if ($jobObj->pitch > 99) {
15899  
15900 $jobObj->pitch = 99;
15901 }
15902  
15903 push (@cmdList, '-p', $jobObj->pitch);
15904 }
15905  
15906 return @cmdList;
15907 }
15908  
15909 sub ttsConvertESNG {
15910  
15911 # Called by $self->ttsPrepareSystemCmd (only)
15912 # Prepares the parameters of a system command for performing the specifed TTS job, using the
15913 # espeak-sng engine
15914 # The parameters depend on the operating system and current conditions, as well as the job
15915 # itself
15916 #
15917 # Expected arguments
15918 # $jobObj - The GA::Obj::TtsJob object
15919 #
15920 # Return values
15921 # An empty list on improper arguments, if the TTS engine is unrecognised or if the job
15922 # can't be performed
15923 # Otherwise returns a list of parameters to use in the system command
15924  
15925 my ($self, $jobObj, $check) = @_;
15926  
15927 # Local variables
15928 my (@emptyList, @cmdList);
15929  
15930 # Check for improper arguments
15931 if (! defined $jobObj || defined $check) {
15932  
15933 $axmud::CLIENT->writeImproper($self->_objClass . '->ttsConvertESNG', @_);
15934 return @emptyList;
15935 }
15936  
15937 # Check values are valid in general
15938 if (! $self->ttsConvertCheck($jobObj)) {
15939  
15940 return @emptyList;
15941 }
15942  
15943 # Prepare the system command
15944 if ($^O eq 'MSWin32') {
15945  
15946 if (-e $self->msWinPathESNG) {
15947  
15948 push (@cmdList, $self->msWinPathESNG);
15949  
15950 } else {
15951  
15952 # espeak-ng engine not installed
15953 return @emptyList;
15954 }
15955  
15956 } else {
15957  
15958 push (@cmdList, 'espeak-ng');
15959 }
15960  
15961 if ($^O eq 'MSWin32') {
15962 push (@cmdList, $jobObj->currentText);
15963 } else {
15964 push (@cmdList, '"' . $jobObj->currentText . '"');
15965 }
15966  
15967 # With espeak-ng, we can set the voice, speed, pitch and volume, but not rate
15968 if (defined $jobObj->voice && $jobObj->voice ne '') {
15969  
15970 push (@cmdList, '-v', $jobObj->voice);
15971 }
15972  
15973 # Speed in the range 10-200
15974 if (defined $jobObj->speed && $jobObj->speed ne '') {
15975  
15976 push (@cmdList, '-s', (int($jobObj->speed * 1.9) + 10));
15977 }
15978  
15979 # Pitch in the range 0-99
15980 if (defined $jobObj->pitch && $jobObj->pitch ne '') {
15981  
15982 if ($jobObj->pitch > 99) {
15983  
15984 $jobObj->pitch = 99;
15985 }
15986  
15987 push (@cmdList, '-p', $jobObj->pitch);
15988 }
15989  
15990 # Volume in the range 0-200
15991 if (defined $jobObj->volume && $jobObj->volume ne '') {
15992  
15993 push (@cmdList, '-a', ($jobObj->volume * 2));
15994 }
15995  
15996 return @cmdList;
15997 }
15998  
15999 sub ttsConvertFlite {
16000  
16001 # Called by $self->ttsPrepareSystemCmd (only)
16002 # Prepares the parameters of a system command for performing the specifed TTS job, using the
16003 # Flite engine
16004 # The parameters depend on the operating system and current conditions, as well as the job
16005 # itself
16006 #
16007 # Expected arguments
16008 # $jobObj - The GA::Obj::TtsJob object
16009 #
16010 # Return values
16011 # An empty list on improper arguments, if the TTS engine is unrecognised or if the job
16012 # can't be performed
16013 # Otherwise returns a list of parameters to use in the system command
16014  
16015 my ($self, $jobObj, $check) = @_;
16016  
16017 # Local variables
16018 my (@emptyList, @cmdList);
16019  
16020 # Check for improper arguments
16021 if (! defined $jobObj || defined $check) {
16022  
16023 $axmud::CLIENT->writeImproper($self->_objClass . '->ttsConvertFlite', @_);
16024 return @emptyList;
16025 }
16026  
16027 # Check values are valid in general
16028 if (! $self->ttsConvertCheck($jobObj)) {
16029  
16030 return @emptyList;
16031 }
16032  
16033 # Prepare the system command
16034 if ($^O eq 'MSWin32') {
16035  
16036 # Not available on MS Windows
16037 return @emptyList;
16038  
16039 } else {
16040  
16041 push (@cmdList, 'flite');
16042 }
16043  
16044 push (@cmdList, '-t', '"' . $jobObj->currentText . '"');
16045  
16046 # With Flite, we can set the voice, but not speed, rate, pitch or volume
16047 if (defined $jobObj->voice && $jobObj->voice ne '') {
16048  
16049 push (@cmdList, '-voice', $jobObj->voice);
16050 }
16051  
16052 return @cmdList;
16053 }
16054  
16055 sub ttsConvertFestival {
16056  
16057 # Called by $self->ttsPrepareSystemCmd (only)
16058 # Prepares the parameters of a system command for performing the specifed TTS job, using the
16059 # Festival engine
16060 # The parameters depend on the operating system and current conditions, as well as the job
16061 # itself
16062 #
16063 # Expected arguments
16064 # $jobObj - The GA::Obj::TtsJob object
16065 #
16066 # Return values
16067 # An empty list on improper arguments, if the TTS engine is unrecognised or if the job
16068 # can't be performed
16069 # Otherwise, returns a list of arguments. The first argument is the command for the
16070 # server engine. The remaining comprise the command for the command-line engine. Thus,
16071 # if $self->ttsPerformJobs tries to use the server engine and fails, it can default
16072 # back to the command-line engine without calling this function a second time
16073  
16074 my ($self, $jobObj, $check) = @_;
16075  
16076 # Local variables
16077 my (
16078 $cmd,
16079 @emptyList, @cmdList,
16080 );
16081  
16082 # Check for improper arguments
16083 if (! defined $jobObj || defined $check) {
16084  
16085 $axmud::CLIENT->writeImproper($self->_objClass . '->ttsConvertFestival', @_);
16086 return @emptyList;
16087 }
16088  
16089 # Check values are valid in general
16090 if (! $self->ttsConvertCheck($jobObj)) {
16091  
16092 return @emptyList;
16093 }
16094  
16095 # Prepare the system command
16096  
16097 # Server engine (never used on MS Windows)
16098 $cmd = "(let ((utt (Utterance Text \"" . $jobObj->currentText . "\")))";
16099 if (defined $jobObj->voice && $jobObj->voice ne '') {
16100  
16101 $cmd .= " (begin (" . $jobObj->voice . ")";
16102  
16103 # Rate in the range 0.5-2
16104 if (defined $jobObj->rate && $jobObj->rate ne '') {
16105  
16106 $cmd .= " (Parameter.set 'Duration_Stretch' " . (($jobObj->rate * 0.015) + 0.5)
16107 . ")";
16108 }
16109  
16110 # Volume in the range 0.33-6
16111 if (defined $jobObj->volume && $jobObj->volume ne '') {
16112  
16113 $cmd .= " (utt.synth utt) (utt.wave.resample utt 8000)"
16114 . " (utt.wave.rescale utt " . (($jobObj->volume * 0.0567) + 0.33)
16115 . ") (utt.play utt)";
16116 }
16117  
16118 $cmd .= ")";
16119 }
16120  
16121 $cmd .= ")\n";
16122  
16123 push (@cmdList, $cmd);
16124  
16125 # Command-line engine (used on all operating systems)
16126 # For system commands using pipes, IPC::Run::start expects a list in this format
16127 if ($^O eq 'MSWin32') {
16128  
16129 if (-e $self->msWinPathFestival) {
16130  
16131 chomp $cmd;
16132 # In MS Windows CMD.exe, need to escape the characters & \ < > ^ | "
16133 $cmd =~ s/([\&\\\<\>\^\|\"])/^$1/g;
16134  
16135 # N.B. In order for this to work, the IPC::Run code itself must be modified. See the
16136 # instructions in ../axmud/nsis/axmud.install.nsi
16137 push (@cmdList,
16138 [ 'CMD', '/C', 'echo', '""' . $cmd . '""', ],
16139 '|',
16140 [ $self->msWinPathFestival ],
16141 );
16142  
16143 } else {
16144  
16145 # Festival engine not installed
16146 return @emptyList;
16147 }
16148  
16149 } else {
16150  
16151 push (@cmdList,
16152 [ 'echo', $cmd, ],
16153 '|',
16154 [ 'festival' ],
16155 );
16156 }
16157  
16158 # Return the server command first, followed by the arguments comprising the command for the
16159 # ommand-line engine
16160 return @cmdList;
16161 }
16162  
16163 sub ttsConvertSwift {
16164  
16165 # Called by $self->ttsPrepareSystemCmd (only)
16166 # Prepares the parameters of a system command for performing the specifed TTS job, using the
16167 # Swift engine
16168 # The parameters depend on the operating system and current conditions, as well as the job
16169 # itself
16170 #
16171 # Expected arguments
16172 # $jobObj - The GA::Obj::TtsJob object
16173 #
16174 # Return values
16175 # An empty list on improper arguments, if the TTS engine is unrecognised or if the job
16176 # can't be performed
16177 # Otherwise returns a list of parameters to use in the system command
16178  
16179 my ($self, $jobObj, $check) = @_;
16180  
16181 # Local variables
16182 my (
16183 $param, $pitch, $begin, $end, $rate, $volume,
16184 @emptyList, @cmdList,
16185 );
16186  
16187 # Check for improper arguments
16188 if (! defined $jobObj || defined $check) {
16189  
16190 $axmud::CLIENT->writeImproper($self->_objClass . '->ttsConvertSwift', @_);
16191 return @emptyList;
16192 }
16193  
16194 # Check values are valid in general
16195 if (! $self->ttsConvertCheck($jobObj)) {
16196  
16197 return @emptyList;
16198 }
16199  
16200 # Prepare the system command
16201 if ($^O eq 'MSWin32') {
16202  
16203 if (-e $self->msWinPathSwift) {
16204  
16205 push (@cmdList, $self->msWinPathSwift);
16206  
16207 } else {
16208  
16209 # Swift engine not installed
16210 return @emptyList;
16211 }
16212  
16213 } else {
16214  
16215 push (@cmdList, 'swift');
16216 }
16217  
16218 # With Swift on MS Windows (using Cepstral), we can set the voice, speed, pitch and volume,
16219 # but not rate
16220 if ($^O eq 'MSWin32') {
16221  
16222 if (defined $jobObj->voice && $jobObj->voice ne '') {
16223  
16224 push (@cmdList, '-n', $jobObj->voice);
16225 }
16226  
16227 # Speed in the range 100-400
16228 if (defined $jobObj->speed && $jobObj->speed ne '') {
16229  
16230 $param = 'speech/rate=' . (($jobObj->speed * 3) + 100);
16231 }
16232  
16233 # Pitch in the range 0.1-5
16234 if (defined $jobObj->pitch && $jobObj->pitch ne '') {
16235  
16236 $pitch = int($jobObj->pitch / 20);
16237 if ($pitch < 0.1) {
16238  
16239 $pitch = 0.1;
16240 }
16241  
16242 if (! $param) {
16243 $param = 'speech/pitch/shift=' . $pitch;
16244 } else {
16245 $param .= ',speech/pitch/shift=' . $pitch;
16246 }
16247 }
16248  
16249 # Volume in the range 0-100
16250 if (defined $jobObj->volume && $jobObj->volume ne '') {
16251  
16252 if (! $param) {
16253 $param = 'audio/volume=' . $jobObj->volume;
16254 } else {
16255 $param .= ',audio/volume=' . $jobObj->volume;
16256 }
16257 }
16258  
16259 # All done
16260 if ($param) {
16261  
16262 push (@cmdList, '-p', $param);
16263 }
16264  
16265 push (@cmdList, $jobObj->currentText);
16266  
16267 # With Swift on Linux (using Cepstral), we can set the voice, rate, pitch and volume, but
16268 # not speed
16269 } else {
16270  
16271 if ($jobObj->voice ne '') {
16272  
16273 $begin = "<voice name=\"" . $jobObj->voice . "\">";
16274 $end = "</voice>";
16275  
16276 } else {
16277  
16278 $begin = '';
16279 $end = '';
16280 }
16281  
16282 # (Rate, pitch and volume all share an element; only create the element if at least one
16283 # valid value is being used)
16284  
16285 # Rate in the range 0.5-2
16286 if (defined $jobObj->rate && $jobObj->rate ne '') {
16287  
16288 $rate = ($jobObj->rate * 0.015) + 0.5;
16289 }
16290  
16291 # Pitch in the range 0.1-5
16292 if (defined $jobObj->pitch && $jobObj->pitch ne '') {
16293  
16294 $pitch = $jobObj->pitch / 20;
16295 if ($pitch < 0.1) {
16296  
16297 $pitch = 0.1;
16298 }
16299 }
16300  
16301 # Volume in the range 0.33-6
16302 if (defined $jobObj->volume && $jobObj->volume ne '') {
16303  
16304 $volume = ($jobObj->volume * 0.0567) + 0.33;
16305 }
16306  
16307 if ($rate ne '' || $pitch ne '' || $volume ne '') {
16308  
16309 $begin .= "<prosody";
16310 if ($rate ne '') {
16311  
16312 $begin .= " rate='$rate'";
16313 }
16314  
16315 if ($pitch ne '') {
16316  
16317 $begin .= " pitch='$pitch'";
16318 }
16319  
16320 if ($volume ne '') {
16321  
16322 $begin .= " volume='$volume'";
16323 }
16324  
16325 $begin .= ">";
16326 $end = "</prosody>" . $end;
16327 }
16328  
16329 push (@cmdList, $begin . $jobObj->currentText . $end);
16330 }
16331  
16332 return @cmdList;
16333 }
16334  
16335 sub ttsFestivalConnect {
16336  
16337 # Called by $self->ttsPerformJobs (only), in response to the TTS action request 'connect'
16338 # Attempts to connect to a Festival server engine
16339 #
16340 # Expected arguments
16341 # (none besides $self)
16342 #
16343 # Return values
16344 # 'undef' on improper arguments or if a connection cannot be establed with the Festival
16345 # server
16346 # 1 if a connection is established
16347  
16348 my ($self, $check) = @_;
16349  
16350 # Local variables
16351 my $socket;
16352  
16353 # Check for improper arguments
16354 if (defined $check) {
16355  
16356 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsFestivalConnect', @_);
16357 }
16358  
16359 # These checks should have been taken care of by the calling code
16360 if (
16361 $self->ttsFestivalServerMode ne 'server'
16362 || $self->ttsFestivalSocket
16363 || $^O eq 'MSWin32'
16364 ) {
16365 return undef;
16366 }
16367  
16368 # Attempt to connect to the Festival server
16369 $self->ivPoke('ttsFestivalConnectMode', 'connecting');
16370  
16371 $socket = IO::Socket::INET->new(
16372 Proto => 'tcp',
16373 PeerAddr => '127.0.0.1',
16374 PeerPort => $self->ttsFestivalServerPort,
16375 );
16376  
16377 if (! $socket) {
16378  
16379 $self->ivPoke('ttsFestivalConnectMode', 'waiting');
16380  
16381 return undef;
16382  
16383 } else {
16384  
16385 $self->ivPoke('ttsFestivalConnectMode', 'connected');
16386 $self->ivPoke('ttsFestivalSocket', $socket);
16387  
16388 return 1;
16389 }
16390 }
16391  
16392 sub ttsFestivalDisconnect {
16393  
16394 # Called by $self->ttsPerformJobs (only), in response to the TTS action request 'disconnect'
16395 # Attempts to disconnect from the Festival server engine
16396 #
16397 # Expected arguments
16398 # (none besides $self)
16399 #
16400 # Return values
16401 # 'undef' on improper arguments
16402 # 1 otherwise
16403  
16404 my ($self, $check) = @_;
16405  
16406 # Check for improper arguments
16407 if (defined $check) {
16408  
16409 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsFestivalDisconnect', @_);
16410 }
16411  
16412 if ($self->ttsFestivalSocket) {
16413  
16414 # Close the socket
16415 close $self->ttsFestivalSocket;
16416 $self->ivUndef('ttsFestivalSocket');
16417  
16418 # Update IVs
16419 if ($self->ttsFestivalServerMode eq 'server') {
16420  
16421 # (...implying, if $FESTIVAL_MODE has not been changed to 'cmd_line'...)
16422 $self->ivPoke('ttsFestivalConnectMode', 'waiting');
16423 }
16424  
16425 $self->ivPoke('ttsFestivalServerMode', 'cmd_line');
16426 $self->ivPoke('ttsFestivalConnectMode', 'cmd_line');
16427 }
16428  
16429 return 1;
16430 }
16431  
16432 sub ttsFestivalStart {
16433  
16434 # Called by $self->ttsPerformJobs (only), in response to the TTS action request 'start'
16435 # Assuming that no Festival server is running on the user's system, attempts to start one
16436 #
16437 # Expected arguments
16438 # (none besides $self)
16439 #
16440 # Return values
16441 # 'undef' if the server cannot be started or, if it is started, a connection cannot be
16442 # established with it
16443 # 1 on success
16444  
16445 my ($self, $check) = @_;
16446  
16447 # Local variables
16448 my $result;
16449  
16450 # Check for improper arguments
16451 if (defined $check) {
16452  
16453 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsFestivalStart', @_);
16454 }
16455  
16456 # Don't try to start the server a second time, unless the port has changed
16457 if (
16458 $self->ttsFestivalFailFlag
16459 || $self->ttsFestivalSuccessFlag
16460 || $^O eq 'MSWin32'
16461 ) {
16462 return undef;
16463 }
16464  
16465 # Update IVs
16466 $self->ivPoke('ttsFestivalServerMode', 'server');
16467 $self->ivPoke('ttsFestivalConnectMode', 'waiting');
16468  
16469 # Start the server
16470 $result = system "festival --server &";
16471 if ($result == -1) {
16472  
16473 # Server not started. Don't try again, unless the Festival port changes
16474 $self->ivPoke('ttsFestivalFailFlag', TRUE);
16475 return undef;
16476  
16477 } else {
16478  
16479 # Server started
16480 # Don't try again under any circumstances. This setting prevents Axmud from starting
16481 # redundant multiple servers
16482 $self->ivPoke('ttsFestivalSuccessFlag', TRUE);
16483  
16484 # On the next spin of the client loop, try to connect to the server
16485 $self->ivPush('ttsFestivalRequestList', 'connect');
16486  
16487 # The server may need time to initialise, before we can connect to it
16488 # Ordinarily we give up after the first failed connection. Set variables that allow
16489 # $self->ttsPerformJobs to keep trying for a few seconds, before giving up
16490 $self->ivPoke('ttsFestivalCheckTime', $self->getTime() + $self->ttsFestivalStopTime);
16491  
16492 return 1;
16493 }
16494 }
16495  
16496 sub ttsFestivalSend {
16497  
16498 # Called by $self->ttsPerformJobs and ->ttsInterruptJob
16499 # Sends a command to the Festival server. If the connection has closed, updates IVs
16500 #
16501 # Expected arguments
16502 # $cmd - The text to send to the server
16503 #
16504 # Return values
16505 # 'undef' on improper arguments, if not connected to the server or if the connection has
16506 # closed
16507 # 1 otherwise
16508  
16509 my ($self, $cmd, $check) = @_;
16510  
16511 # Check for improper arguments
16512 if (! defined $cmd || defined $check) {
16513  
16514 return $axmud::CLIENT->writeImproper($self->_objClass . '->ttsFestivalSend', @_);
16515 }
16516  
16517 if (
16518 $self->ttsFestivalServerMode ne 'server'
16519 || $self->ttsFestivalConnectMode ne 'connected'
16520 || ! $self->ttsFestivalSocket
16521 || $^O eq 'MSWin32'
16522 ) {
16523 return undef;
16524  
16525 } elsif (! $self->ttsFestivalSocket->print($cmd)) {
16526  
16527 # Socket has closed; go back to using the command line engine
16528 $self->ivPoke('ttsFestivalServerMode', 'cmd_line');
16529 $self->ivPoke('ttsFestivalConnectMode', 'cmd_line');
16530 $self->ivUndef('ttsFestivalSocket');
16531  
16532 return undef;
16533  
16534 } else {
16535  
16536 return 1;
16537 }
16538 }
16539  
16540 # External applications
16541  
16542 sub openFileInBrowser {
16543  
16544 # Called by GA::Cmd::Blind->do or any other function
16545 # Opens a file in an external web browser (if allowed)
16546 #
16547 # Expected arguments
16548 # $path - The file path to open
16549 #
16550 # Return values
16551 # 'undef' on improper arguments or if the path can't be opened
16552 # 1 otherwise
16553  
16554 my ($self, $path, $check) = @_;
16555  
16556 # Local variables
16557 my $cmd;
16558  
16559 # Check for improper arguments
16560 if (! defined $path || defined $check) {
16561  
16562 return $axmud::CLIENT->writeImproper($self->_objClass . '->openFileInBrowser', @_);
16563 }
16564  
16565 if (! $self->browserCmd || ! ($self->browserCmd =~ m/%s/)) {
16566  
16567 # No browser command set, or it doesn't contain a %s (which is substituted for the path)
16568 return undef;
16569  
16570 } else {
16571  
16572 $cmd = $self->browserCmd;
16573 $cmd =~ s/%s/$path/;
16574  
16575 system $cmd;
16576  
16577 return 1;
16578 }
16579 }
16580  
16581 sub openURL {
16582  
16583 # Called by GA::Strip::MenuBar->drawHelpColumn, GA::Obj::TextView->setButtonPressEvent,
16584 # GA::OtherWin::Connect->createTableWidgets or any other function
16585 # Opens a URL link in an external web browser (if allowed)
16586 #
16587 # Expected arguments
16588 # $link - The URL to open
16589 #
16590 # Return values
16591 # 'undef' on improper arguments or if the link can't be opened
16592 # 1 otherwise
16593  
16594 my ($self, $link, $check) = @_;
16595  
16596 # Local variables
16597 my $cmd;
16598  
16599 # Check for improper arguments
16600 if (! defined $link || defined $check) {
16601  
16602 return $axmud::CLIENT->writeImproper($self->_objClass . '->openURL', @_);
16603 }
16604  
16605 if (! $self->browserCmd || ! ($self->browserCmd =~ m/%s/)) {
16606  
16607 # No browser command set, or it doesn't contain a %s (which is substituted for the link)
16608 return undef;
16609  
16610 } else {
16611  
16612 $cmd = $self->browserCmd;
16613 $cmd =~ s/%s/$link/;
16614  
16615 system $cmd;
16616  
16617 return 1;
16618 }
16619 }
16620  
16621 sub openEmail {
16622  
16623 # Called by GA::Obj::TextView->setButtonPressEvent or by any other function
16624 # Opens an email link in an external email application (if allowed)
16625 #
16626 # Expected arguments
16627 # $link - The email address to open
16628 #
16629 # Return values
16630 # 'undef' on improper arguments or if the link can't be opened
16631 # 1 otherwise
16632  
16633 my ($self, $link, $check) = @_;
16634  
16635 # Local variables
16636 my $cmd;
16637  
16638 # Check for improper arguments
16639 if (! defined $link || defined $check) {
16640  
16641 return $axmud::CLIENT->writeImproper($self->_objClass . '->openEmail', @_);
16642 }
16643  
16644 if (! $self->emailCmd || ! ($self->emailCmd =~ m/%s/)) {
16645  
16646 # No email command set, or it doesn't contain a %s (which is substituted for the link)
16647 return undef;
16648  
16649 } else {
16650  
16651 $cmd = $self->emailCmd;
16652 $cmd =~ s/%s/$link/;
16653  
16654 system $cmd;
16655  
16656 return 1;
16657 }
16658 }
16659  
16660 # Sound and sound effects
16661  
16662 sub playSound {
16663  
16664 # Can be called by anything
16665 # Plays a specified sound effect (if allowed, and if the sound effect exists)
16666 #
16667 # Expected arguments
16668 # $sound - The name of the sound effect to play; should match a key in
16669 # $self->customSoundHash
16670 #
16671 # Return values
16672 # 'undef' on improper arguments or if the sound effect can't be played
16673 # 1 otherwise
16674  
16675 my ($self, $sound, $check) = @_;
16676  
16677 # Local variables
16678 my ($file, $cmd);
16679  
16680 # Check for improper arguments
16681 if (! defined $sound || defined $check) {
16682  
16683 return $axmud::CLIENT->writeImproper($self->_objClass . '->playSound', @_);
16684 }
16685  
16686 $file = $self->ivShow('customSoundHash', $sound);
16687  
16688 if (
16689 # Sound not allowed
16690 ! $self->allowSoundFlag
16691 # No external audio player set, or the command to start the audio player doesn't contain
16692 # a %s substitution
16693 || ! $self->audioCmd
16694 || ! ($self->audioCmd =~ m/%s/)
16695 # Sound effect doesn't exist, or no file specified for this sound effect
16696 || ! $file
16697 # File doesn't exist
16698 || ! (-e $file)
16699 ) {
16700 return undef;
16701  
16702 } else {
16703  
16704 # Play the file associated with $sound. GA::Client->audioCmd is a value in the form
16705 # 'play %s &', where %s is substituted for the name of the file to play
16706 $cmd = $self->audioCmd;
16707 $cmd =~ s/%s/$file/;
16708  
16709 system $cmd;
16710  
16711 return 1;
16712 }
16713 }
16714  
16715 sub playSoundFile {
16716  
16717 # Can be called by anything
16718 # Plays a sound file using the specified filepath. Unlike $self->playSound, which plays one
16719 # of Axmud's sound effects, this function can be called to play any sound file on the
16720 # local system
16721 # The optional arguments are designed for playing MSP sound triggers (called by
16722 # GA::Session->processMspSoundTrigger). Other code can specify these arguments too, if
16723 # required
16724 # The $v (volume) argument is only applied when using one of Axmud's supported audio
16725 # packages. At the moment, the only package supported is SoX
16726 #
16727 # Expected arguments
16728 # $session - The calling GA::Session
16729 # $path - The full file path of the sound to play
16730 #
16731 # Optional arguments
16732 # $delFlag - Set to TRUE if the file $path should be deleted, when it has finished
16733 # playing, set to FALSE (or 'undef') otherwise. (Used for MXP sound files
16734 # which are converted from a world-specific file format, and which should
16735 # be deleted after being played)
16736 # $type - The MSP sound trigger type, 'sound' or 'music'. Should be 'undef' (or
16737 # 'other') for non-MSP sounds
16738 # $v - The sound volume. Value in the range 0-100 (if 'undef', no volume applied)
16739 # $l - Number of repeats. Value in the range 1+, or -1 to repeat indefinitely (if
16740 # 'undef', sound played only once)
16741 # $p - Sound priority. Value in the range 0-100. If $p is higher than the
16742 # priority of the sound already playing, the old sound is stopped and this
16743 # sound is played instead; otherwise, this sound is not played at all (if
16744 # 'undef', default priority of 50 is applied by this function)
16745 # - (NB Axmud sound effects played by $self->playSound are independent, and
16746 # not affected by this function)
16747 # $c - Continue flag. Values 0 or 1. If 1, the file should simply continue
16748 # playing if requested again. If 0, the file should restart, if requested
16749 # again.
16750 # - (NB Axmud sound effects played by $self->playSound are independent, and
16751 # not affected by this function)
16752 #
16753 # Return values
16754 # 'undef' on improper arguments or if the sound file can't be played
16755 # 1 otherwise
16756  
16757 my ($self, $session, $path, $delFlag, $type, $v, $l, $p, $c, $check) = @_;
16758  
16759 # Local variables
16760 my (
16761 $cmd, $harness, $soundObj, $num,
16762 @args,
16763 );
16764  
16765 # Check for improper arguments
16766 if (! defined $session || ! defined $path || defined $check) {
16767  
16768 return $axmud::CLIENT->writeImproper($self->_objClass . '->playSoundFile', @_);
16769 }
16770  
16771 if (
16772 # Sound not allowed
16773 ! $self->allowSoundFlag
16774 # No external audio player set, or the command to start the audio player doesn't contain
16775 # a %s substitution
16776 || ! $self->audioCmd
16777 || ! ($self->audioCmd =~ m/%s/)
16778 # File doesn't exist
16779 || ! (-e $path)
16780 ) {
16781 return undef;
16782 }
16783  
16784 # For non-MSP sounds, the $type stored in the GA::Obj::Sound object should be 'other'
16785 if (! defined $type) {
16786  
16787 $type = 'other';
16788 }
16789  
16790 # Use default values for $delFlag, $v, $l, $p and $c, if they were not specified
16791 if (! defined $delFlag) {
16792  
16793 $delFlag = FALSE;
16794 }
16795  
16796 if (! defined $v) {
16797  
16798 $v = 100;
16799 }
16800  
16801 if (! defined $l) {
16802  
16803 $l = 1;
16804 }
16805  
16806 if (! defined $p) {
16807  
16808 $p = 50;
16809 }
16810  
16811 if (! defined $c) {
16812  
16813 $c = 1;
16814 }
16815  
16816 # Prepare the argument list
16817 $cmd = $self->audioCmd;
16818 if (
16819 $^O ne 'MSWin32'
16820 && (substr($cmd, 0, 4) eq 'sox ' || substr($cmd, 0, 5) eq 'play ')
16821 ) {
16822 # Supported audio package, SoX ('-q' for quiet)
16823 @args = ('play', '-q');
16824  
16825 if (defined $v) {
16826  
16827 # $v is in the range 0-100; SoX expects a value in the range 0-1
16828 if ($v) {
16829 push (@args, '-v ' . ($v / 100));
16830 } else {
16831 push (@args, '-v 0');
16832 }
16833 }
16834  
16835 push (@args, $path);
16836  
16837 } else {
16838  
16839 # Unsupported audio package
16840 $cmd =~ s/%s//;
16841 @args = ($cmd, $path);
16842 }
16843  
16844 # Play the sound
16845 $harness = IPC::Run::start(\@args);
16846 # Create a GA::Obj::Sound object to store the harness details, so we can monitor its
16847 # progress
16848 $session->add_soundHarness(
16849 $path,
16850 $harness,
16851 $delFlag,
16852 $type,
16853 $v,
16854 $l,
16855 $p,
16856 $c,
16857 );
16858  
16859 return 1;
16860 }
16861  
16862 sub repeatSoundFile {
16863  
16864 # Called by GA::Session->spinMaintainLoop (only)
16865 # Repeat the playing of a sound file, using details stored in a GA::Obj::Sound object
16866 # (This function complements $self->playSoundFile)
16867 #
16868 # Expected arguments
16869 # $soundObj - The GA::Obj::Sound object
16870 #
16871 # Return values
16872 # 'undef' on improper arguments or if the sound file can't be played
16873 # 1 otherwise
16874  
16875 my ($self, $soundObj, $check) = @_;
16876  
16877 # Local variables
16878 my (
16879 $cmd, $harness,
16880 @args,
16881 );
16882  
16883 # Check for improper arguments
16884 if (! defined $soundObj || defined $check) {
16885  
16886 return $axmud::CLIENT->writeImproper($self->_objClass . '->repeatSoundFile', @_);
16887 }
16888  
16889 if (
16890 # Sound not allowed
16891 ! $self->allowSoundFlag
16892 # No external audio player set, or the command to start the audio player doesn't contain
16893 # a %s substitution
16894 || ! $self->audioCmd
16895 || ! ($self->audioCmd =~ m/%s/)
16896 # File path no longer exists
16897 || ! (-e $soundObj->path)
16898 ) {
16899 return undef;
16900 }
16901  
16902 # Prepare the argument list
16903 $cmd = $self->audioCmd;
16904 if (
16905 $^O ne 'MSWin32'
16906 && (substr($cmd, 0, 4) eq 'sox ' || substr($cmd, 0, 5) eq 'play ')
16907 ) {
16908 # Supported audio package, SoX ('-q' for quiet)
16909 @args = ('play', '-q');
16910  
16911 # $v is in the range 0-100; SoX expects a value in the range 0-1
16912 if ($soundObj->volume) {
16913 push (@args, '-v ' . ($soundObj->volume / 100));
16914 } else {
16915 push (@args, '-v 0');
16916 }
16917  
16918 push (@args, $soundObj->path);
16919  
16920 } else {
16921  
16922 # Unsupported audio package
16923 $cmd =~ s/%s//;
16924 @args = ($cmd, $soundObj->path);
16925 }
16926  
16927 # Play the sound
16928 $harness = IPC::Run::start(\@args);
16929 # Update the GA::Obj::Sound object with the harness for the new sound (the calling function
16930 # should update $soundObj->repeat, if necessary)
16931 $soundObj->ivPoke('harness', $harness);
16932  
16933 return 1;
16934 }
16935  
16936 # Seasonally appropriate logos/icons
16937  
16938 sub getClientLogo {
16939  
16940 # Returns the seasonally-appropriate file path for the client logo, mainly used in the
16941 # Connections window
16942 #
16943 # Expected arguments
16944 # (none besides $self)
16945 #
16946 # Optional arguments
16947 # $adultFlag - If TRUE, show the client logo with an '18' in one corner. If FALSE (or
16948 # 'undef'), show the usual logo
16949 #
16950 # Return values
16951 # 'undef' on improper arguments
16952 # Otherwise returns the file path
16953  
16954 my ($self, $adultFlag, $check) = @_;
16955  
16956 # Local variables
16957 my ($second, $minute, $hour, $dayOfMonth, $month);
16958  
16959 # Check for improper arguments
16960 if (defined $check) {
16961  
16962 return $axmud::CLIENT->writeImproper($self->_objClass . '->getClientLogo', @_);
16963 }
16964  
16965 ($second, $minute, $hour, $dayOfMonth, $month) = localtime();
16966  
16967 # NB $month is in the range 0-11
16968 if (($month == 11 && $dayOfMonth >= 24) || ($month == 0 && $dayOfMonth <= 5)) {
16969  
16970 if (! $adultFlag) {
16971 return $axmud::SHARE_DIR . '/icons/system/client_logo_xmas.png';
16972 } else {
16973 return $axmud::SHARE_DIR . '/icons/system/client_logo_xmas_18.png';
16974 }
16975  
16976 } else {
16977  
16978 if (! $adultFlag) {
16979 return $axmud::SHARE_DIR . '/icons/system/client_logo.png';
16980 } else {
16981 return $axmud::SHARE_DIR . '/icons/system/client_logo_18.png';
16982 }
16983 }
16984 }
16985  
16986 sub getDialogueIcon {
16987  
16988 # Returns the seasonally-appropriate file path for the standard 'dialogue' window icon
16989 #
16990 # Expected arguments
16991 # (none besides $self)
16992 #
16993 # Optional arguments
16994 # $mode - If specified and set to 'large' or 'medium', then the large/medium-size icon
16995 # is used. For any other value (including 'undef'), the standard small icon is
16996 # used
16997 #
16998 # Return values
16999 # 'undef' on improper arguments
17000 # Otherwise returns the file path
17001  
17002 my ($self, $mode, $check) = @_;
17003  
17004 # Local variables
17005 my ($second, $minute, $hour, $dayOfMonth, $month);
17006  
17007 # Check for improper arguments
17008 if (defined $check) {
17009  
17010 return $axmud::CLIENT->writeImproper($self->_objClass . '->getDialogueIcon', @_);
17011 }
17012  
17013 ($second, $minute, $hour, $dayOfMonth, $month) = localtime();
17014  
17015 # NB $month is in the range 0-11
17016 if (($month == 11 && $dayOfMonth >= 24) || ($month == 0 && $dayOfMonth <= 5)) {
17017  
17018 if (defined $mode && $mode eq 'large') {
17019 return $axmud::SHARE_DIR . '/icons/system/dialogue_icon_xmas_large.png';
17020 } elsif (defined $mode && $mode eq 'medium') {
17021 return $axmud::SHARE_DIR . '/icons/system/dialogue_icon_xmas_medium.png';
17022 } else {
17023 return $axmud::SHARE_DIR . '/icons/system/dialogue_icon_xmas.png';
17024 }
17025  
17026 } else {
17027  
17028 if (defined $mode && $mode eq 'large') {
17029 return $axmud::SHARE_DIR . '/icons/system/dialogue_icon_large.png';
17030 } elsif (defined $mode && $mode eq 'medium') {
17031 return $axmud::SHARE_DIR . '/icons/system/dialogue_icon_medium.png';
17032 } else {
17033 return $axmud::SHARE_DIR . '/icons/system/dialogue_icon.png';
17034 }
17035 }
17036 }
17037  
17038 # Auto-backup
17039  
17040 sub checkBackupInterval {
17041  
17042 # Called by $self->start when $self->autoBackupMode is 'interval_start', and by $self->stop
17043 # when $self->autoBackupMode is 'interval_stop'
17044 # Checks whether it is time to perform an auto-backup
17045 #
17046 # Expected arguments
17047 # (none besides $self)
17048 #
17049 # Return values
17050 # 'undef' on improper arguments or if it's not yet time to perform an auto-backup
17051 # 1 if it is time to perform at auto-backup
17052  
17053 my ($self, $check) = @_;
17054  
17055 # Local variables
17056 my ($format, $time, $oldTime, $diff);
17057  
17058 # Check for improper arguments
17059 if (defined $check) {
17060  
17061 return $axmud::CLIENT->writeImproper($self->_objClass . '->checkBackupInterval', @_);
17062 }
17063  
17064 if (! $self->autoBackupInterval) {
17065  
17066 # Don't do auto-backups for the time being
17067 return undef;
17068  
17069 } elsif (! $self->autoBackupDate) {
17070  
17071 # No auto-backup time recorded, so perform an auto-backup now
17072 return 1;
17073  
17074 } else {
17075  
17076 # Otherwise, do the calculation
17077 $format = '%a %b %d, %Y'; # e.g. 'Thu Dec 18, 2010'
17078 $time = Time::Piece->strptime($self->localDate(), $format);
17079 $oldTime = Time::Piece->strptime($self->autoBackupDate, $format);
17080  
17081 $diff = $time->julian_day() - $oldTime->julian_day();
17082  
17083 if ($diff < $self->autoBackupInterval) {
17084 return undef;
17085 } else {
17086 return 1;
17087 }
17088 }
17089 }
17090  
17091 sub doAutoBackup {
17092  
17093 # Called by $self->start or $self->stop when it's time to do an auto-backup
17094 #
17095 # Expected arguments
17096 # (none besides $self)
17097 #
17098 # Return values
17099 # 'undef' on improper arguments or if the auto-backup fails
17100 # 1 on success
17101  
17102 my ($self, $check) = @_;
17103  
17104 # Local variables
17105 my (
17106 $dataDir, $ext, $fileName, $backupPath, $zipObj, $tarObj,
17107 @fileList,
17108 );
17109  
17110 # Check for improper arguments
17111 if (defined $check) {
17112  
17113 return $axmud::CLIENT->writeImproper($self->_objClass . '->doAutoBackup', @_);
17114 }
17115  
17116 # (Code borrowed from GA::Cmd::BackupData, as we don't want client command error messages)
17117  
17118 # Import the Axmud data directory for use in regexes
17119 $dataDir = $axmud::DATA_DIR;
17120  
17121 # In 'default' mode, archive to .zip on MS Windows, and to .tgz on Linux
17122 if ($self->autoBackupFileType eq 'default') {
17123  
17124 if ($^O eq 'MSWin32') {
17125 $ext = 'zip';
17126 } else {
17127 $ext = 'tgz';
17128 }
17129  
17130 } elsif ($self->autoBackupFileType eq 'zip') {
17131 $ext = 'zip';
17132 } else {
17133 $ext = 'tgz';
17134 }
17135  
17136 # Set the filename, appending the time if required
17137 if (! $axmud::CLIENT->autoBackupAppendFlag) {
17138  
17139 $fileName = $axmud::NAME_FILE . '_backup_' . $axmud::CLIENT->localDateString() . '.'
17140 . $ext;
17141  
17142 } else {
17143  
17144 $fileName = $axmud::NAME_FILE . '_backup_' . $axmud::CLIENT->localDateString() . '_'
17145 . $axmud::CLIENT->localClockString() . '.' . $ext;
17146 }
17147  
17148 # If necessary, open a file chooser dialog to decide where to save the exported file
17149 if ($self->autoBackupDir && -e $self->autoBackupDir) {
17150  
17151 $backupPath = $self->autoBackupDir;
17152  
17153 } else {
17154  
17155 $backupPath = $self->mainWin->showFileChooser(
17156 'Backup ' . $axmud::SCRIPT . ' data',
17157 'save',
17158 $fileName,
17159 );
17160 }
17161  
17162 if (! $backupPath) {
17163  
17164 return undef;
17165 }
17166  
17167 # Display a 'dialogue' window while backing up data. The 'undef' argument means 'show the
17168 # standard icon'
17169 if (! $axmud::BLIND_MODE_FLAG) {
17170  
17171 $self->mainWin->showBusyWin(undef, 'Backing up...');
17172 }
17173  
17174 # Get a list of files in the data directory, recursively searching sub-directories
17175 File::Find::find(
17176 sub { push (@fileList, $File::Find::name); },
17177 $dataDir . '/',
17178 );
17179  
17180 # Perform the backup
17181 if ($ext eq 'zip') {
17182  
17183 # Create a zip object
17184 $zipObj = Archive::Zip->new();
17185  
17186 foreach my $file (@fileList) {
17187  
17188 my $modFile;
17189  
17190 if ($file ne $dataDir) {
17191  
17192 $modFile = $file;
17193 $modFile =~ s/$dataDir//;
17194  
17195 # 6 is the default compression level
17196 $zipObj->addFile($file, $modFile, 6);
17197 }
17198 }
17199  
17200 # Save the .zip file. Successful operation returns 0
17201 if ($zipObj->writeToFileNamed($backupPath)) {
17202  
17203 # Close the 'dialogue' window and reset the Client IV that stores it
17204 if ($self->busyWin) {
17205  
17206 $self->mainWin->closeDialogueWin($self->busyWin);
17207 }
17208  
17209 return undef;
17210 }
17211  
17212 } else {
17213  
17214 # Create a tar object
17215 $tarObj = Archive::Tar->new();
17216  
17217 foreach my $file (@fileList) {
17218  
17219 if ($file ne $dataDir) {
17220  
17221 $tarObj->add_files($file);
17222 # Rename each file in the archive to remove the directory structure
17223 $tarObj->rename(substr($file, 1), substr($file, length($dataDir)));
17224 }
17225 }
17226  
17227 # Save the .tgz file
17228 if (
17229 ! $tarObj->write(
17230 $backupPath,
17231 Archive::Tar::COMPRESS_GZIP,
17232 $axmud::NAME_SHORT . '-data',
17233 )
17234 ) {
17235 # Close the 'dialogue' window and reset the Client IV that stores it
17236 if ($self->busyWin) {
17237  
17238 $self->mainWin->closeDialogueWin($self->busyWin);
17239 }
17240  
17241 return undef;
17242 }
17243 }
17244  
17245 # Operation successful. Update IVs so the next scheduled auto-backup occurs on time
17246 if ($self->autoBackupMode eq 'all_start' || $self->autoBackupMode eq 'all_stop') {
17247  
17248 # No scheduled auto-backups; auto-backups occur when Axmud starts/stops
17249 $self->ivUndef('autoBackupDate');
17250  
17251 } else {
17252  
17253 # Scheduled auto-backups
17254 $self->ivPoke('autoBackupDate', $self->localDate());
17255 }
17256  
17257 # Close the 'dialogue' window and reset the Client IV that stores it
17258 if ($self->busyWin) {
17259  
17260 $self->mainWin->closeDialogueWin($self->busyWin);
17261 }
17262  
17263 return 1;
17264 }
17265  
17266 # General-purpose methods
17267  
17268 sub nameCheck {
17269  
17270 # Checks whether a name for a Perl object matches Axmud's naming rules (namely, must be
17271 # between 1 to $maxLength characters, containing letters, numbers and underlines -
17272 # first character can't be a number. International characters, e.g. those in Cyrillic,
17273 # are accepted)
17274 # Also checks that the name doesn't clash with one of Axmud's reserved words
17275 #
17276 # Expected arguments
17277 # $name - the name (string) to be tested
17278 # $maxLength - the maximum string length allowed
17279 #
17280 # Return values
17281 # 'undef' on improper arguments or if $name is not valid, according to Axmud's naming
17282 # rules
17283 # 1 if $name is acceptable
17284  
17285 my ($self, $name, $maxLength, $check) = @_;
17286  
17287 # Check for improper arguments
17288 if (! defined $name || ! defined $maxLength || defined $check) {
17289  
17290 return $axmud::CLIENT->writeImproper($self->_objClass . '->nameCheck', @_);
17291 }
17292  
17293 # Check reserved words
17294 if ($self->ivExists('constReservedHash', lc($name))) {
17295  
17296 return undef;
17297 }
17298  
17299 # Perform the check
17300 $maxLength--;
17301  
17302 if (! ($name =~ m/^[[:alpha:]\_]{1}[[:word:]]{0,$maxLength}$/)) {
17303 return undef;
17304 } else {
17305 return 1;
17306 }
17307 }
17308  
17309 sub intCheck {
17310  
17311 # Checks whether a value is an integer, or not
17312 #
17313 # Expected arguments
17314 # (none besides $self)
17315 #
17316 # Optional arguments
17317 # $num - A value to test. If 'undef' or an empty string, no value is tested (and
17318 # no error message is produced)
17319 # $min - If defined, a minimum value. Can be zero or any floating-point number,
17320 # positive or negative (but will usually be another integer)
17321 # $max - If defined, a maximum value. Can be zero or any floating-point number,
17322 # positive or negative (but will usually be another integer)
17323 #
17324 # Return values
17325 # 'undef' on improper arguments, if $num is not a valid integer, if $min is defined and
17326 # $num is not that value or higher, or if $max is defined and $num is not that value
17327 # or lower
17328 # 1 otherwise
17329  
17330 my ($self, $num, $min, $max, $check) = @_;
17331  
17332 # Check for improper arguments
17333 if (defined $check) {
17334  
17335 return $axmud::CLIENT->writeImproper($self->_objClass . '->intCheck', @_);
17336 }
17337  
17338 if (
17339 ! defined $num
17340 || $num eq ""
17341 || ! ($num =~ m/^[-]?\d+$/)
17342 || (defined $min && $num < $min)
17343 || (defined $max && $num > $max)
17344 ) {
17345 return undef;
17346 } else {
17347 return 1;
17348 }
17349 }
17350  
17351 sub floatCheck {
17352  
17353 # Checks whether a value is a floating-point (decimal) number, or not
17354 #
17355 # NB To check for a floating-point number that is any value above a minimum, do this:
17356 # if (! $axmud::CLIENT->floatCheck($value, $min) || $value == $min) {
17357 #
17358 # Expected arguments
17359 # (none besides $self)
17360 #
17361 # Optional arguments
17362 # $num - A value to test. If 'undef' or an empty string, no value is tested (and
17363 # no error message is produced)
17364 # $min - If defined, a minimum value. Can be zero or any floating-point number,
17365 # positive or negative
17366 # $max - If defined, a maximum value. Can be zero or any floating-point number,
17367 # positive or negative
17368 #
17369 # Return values
17370 # 'undef' on improper arguments, if $num is not a valid floating-point number, if $min is
17371 # defined and $num is not that value or higher, or if $max is defined and $num is not
17372 # that value or lower
17373 # 1 otherwise
17374  
17375 my ($self, $num, $min, $max, $check) = @_;
17376  
17377 # Check for improper arguments
17378 if (defined $check) {
17379  
17380 return $axmud::CLIENT->writeImproper($self->_objClass . '->floatCheck', @_);
17381 }
17382  
17383 if (
17384 ! defined $num
17385 || $num eq ""
17386 || ! ($num =~ m/^[-]?\d+(\.\d*)?$/)
17387 || (defined $min && $num < $min)
17388 || (defined $max && $num > $max)
17389 ) {
17390 return undef;
17391 } else {
17392 return 1;
17393 }
17394 }
17395  
17396 sub ipv4Check {
17397  
17398 # Checks whether a specified string is a valid IPv4 address (using Regexp::IPv4)
17399 #
17400 # Expected arguments
17401 # $string - the string to check
17402 #
17403 # Return values
17404 # 'undef' on improper arguments or if $string is not a valid IPv4 address
17405 # 1 if $string is a valid IPv4 address
17406  
17407 my ($self, $string, $check) = @_;
17408  
17409 # Local variables
17410 my ($digRegex, $regex);
17411  
17412 # Check for improper arguments
17413 if (! defined $string || defined $check) {
17414  
17415 return $axmud::CLIENT->writeImproper($self->_objClass . '->ipv4Check', @_);
17416 }
17417  
17418 # Regexp::IPv4 is not available in Debian, but since it's only three lines of code, we'll
17419 # just import them directly
17420 $digRegex = '(?:25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2})';
17421 $regex = "(?:$digRegex(?:\\.$digRegex){3})";
17422 $regex = qr/$regex/;
17423  
17424 if ($string =~ /^$regex$/) {
17425 return 1;
17426 } else {
17427 return undef;
17428 }
17429 }
17430  
17431 sub ipv6Check {
17432  
17433 # Checks whether a specified string is a valid IPv6 address (using Regexp::IPv6)
17434 #
17435 # Expected arguments
17436 # $string - the string to check
17437 #
17438 # Return values
17439 # 'undef' on improper arguments or if $string is not a valid IPv6 address
17440 # 1 if $string is a valid IPv6 address
17441  
17442 my ($self, $string, $check) = @_;
17443  
17444 # Local variables
17445 my $regex;
17446  
17447 # Check for improper arguments
17448 if (! defined $string || defined $check) {
17449  
17450 return $axmud::CLIENT->writeImproper($self->_objClass . '->ipv6Check', @_);
17451 }
17452  
17453 $regex = $Regexp::IPv6::IPv6_re;
17454  
17455 if ($string =~ /^$regex$/) {
17456 return 1;
17457 } else {
17458 return undef;
17459 }
17460 }
17461  
17462 sub ipv4Get {
17463  
17464 # Contact remote servers to fetch the user's IP address
17465 #
17466 # Expected arguments
17467 # (none besides $self)
17468 #
17469 # Optional arguments
17470 # $forceFlag - The IP address fetched in the first call to this function is stored in
17471 # $self->currentIP. This same value is then returned by each subsequent
17472 # call to this function. However, if this flag is TRUE, the user's IP
17473 # address is fetched again
17474 #
17475 # Return values
17476 # 'undef' on improper arguments or if the IP address can't be fetched
17477 # Otherwise, the user's IP (in the form '101.102.103.104')
17478  
17479 my ($self, $forceFlag, $check) = @_;
17480  
17481 # Check for improper arguments
17482 if (defined $check) {
17483  
17484 return $axmud::CLIENT->writeImproper($self->_objClass . '->ipv4Get', @_);
17485 }
17486  
17487 if ($forceFlag) {
17488  
17489 $self->ivUndef('currentIP');
17490 }
17491  
17492 if ($self->currentIP) {
17493  
17494 return self->currentIP;
17495  
17496 } else {
17497  
17498 # $self->ipLookupList lists several servers, in case one of them isn't available
17499 foreach my $url ($self->ipLookupList) {
17500  
17501 my ($obj, $response);
17502  
17503 # (The default timeout is 60, which is much to long for these purposes, especially
17504 # since we have other URLs to try)
17505 $obj = HTTP::Tiny->new('timeout' => 1);
17506 if ($obj) {
17507  
17508 $response = $obj->get($url);
17509 if ($response->{success} && $response->{content} =~ m/^\d+\.\d+\.\d+\.\d+$/) {
17510  
17511 $self->ivPoke('currentIP', $response->{content});
17512  
17513 return $self->currentIP;
17514 }
17515 }
17516 }
17517 }
17518  
17519 # No IP address found
17520 $self->ivUndef('currentIP');
17521  
17522 return undef;
17523 }
17524  
17525 sub regexCheck {
17526  
17527 # Test that a regex is valid without generating a Perl error/warning message
17528 #
17529 # Expected arguments
17530 # $regex - The regex to test
17531 #
17532 # Return values
17533 # 'undef' on improper arguments or if $regex is a valid regular expression
17534 # Otherwise, returns the error message generated by the invalid regular expression
17535  
17536 my ($self, $regex, $check) = @_;
17537  
17538 # Local variables
17539 my $result;
17540  
17541 # Check for improper arguments
17542 if (! defined $regex || defined $check) {
17543  
17544 return $axmud::CLIENT->writeImproper($self->_objClass . '->regexCheck', @_);
17545 }
17546  
17547 # Set global variables to intercept the Perl error/warning message
17548 $axmud::TEST_REGEX_FLAG = TRUE;
17549 $axmud::TEST_REGEX_ERROR = undef;
17550 # Test the regex
17551 eval { qr/$regex/ };
17552 # The global variable is already set to 'undef' for a valid regex, or the error message
17553 # generated by an invalid regex
17554 $result = $axmud::TEST_REGEX_ERROR;
17555 $axmud::TEST_REGEX_FLAG = FALSE;
17556  
17557 if (! defined $result) {
17558  
17559 return undef;
17560  
17561 } else {
17562  
17563 # Remove the 'at lib/Games/Axmud/Client.pm line xxxxx' portion, which the user
17564 # definitely doesn't want
17565 $result =~ s/at lib.*Client\.pm line \d+.*//;
17566 # Also remove the final newline character
17567 chomp $result;
17568  
17569 return $result;
17570 }
17571 }
17572  
17573 sub commify {
17574  
17575 # Can be called by anything
17576 # Adds commas, full stops/periods, spaces or underlines/underscores to long numbers (e.g.
17577 # converts 1000000 to 1,000,000 / 1.000.000 / 1 000 000 / 1_000_000)
17578 # Returns the modified string
17579 #
17580 # Expected arguments
17581 # (none besides $self)
17582 #
17583 # Optional arguments
17584 # $number - An integer or floating point value, e.g. 1.124. If not defined, then 'undef'
17585 # is returned
17586 # $mode - 'none' to add nothing, 'comma' to add commas, 'europe' to add European-style
17587 # full stops/periods, 'brit' to add British-style spaces, 'underline' to use
17588 # underlines/underscores. If 'undef', $self->commifyMode is used. If an
17589 # unrecognised value is specified, adds nothing
17590 #
17591 # Return values
17592 # 'undef' if no arguments specified
17593 # Otherwise returns the modified string
17594  
17595 my ($self, $number, $mode, $check) = @_;
17596  
17597 # (No check for improper arguments)
17598  
17599 if (! defined $mode) {
17600  
17601 $mode = $self->commifyMode;
17602 }
17603  
17604 if (! defined $number) {
17605  
17606 return undef;
17607  
17608 } elsif ($mode eq 'comma') {
17609  
17610 # (add commas)
17611 1 while $number =~ s/^([-+]?\d+)(\d{3})/$1,$2/;
17612  
17613 } elsif ($mode eq 'europe') {
17614  
17615 # (add European-style full stops/periods)
17616 1 while $number =~ s/^([-+]?\d+)(\d{3})/$1.$2/;
17617  
17618 } elsif ($mode eq 'brit') {
17619  
17620 # (add British-style spaces)
17621 1 while $number =~ s/^([-+]?\d+)(\d{3})/$1 $2/;
17622  
17623 } elsif ($mode eq 'underline') {
17624  
17625 # (add underlines/underscores)
17626 1 while $number =~ s/^([-+]?\d+)(\d{3})/$1_$2/;
17627 }
17628  
17629 return $number;
17630 }
17631  
17632 sub getKeycode {
17633  
17634 # Called by anything
17635 # Given an Axmud standard keycode, or one of the recognised alternative versions of a
17636 # standard keycode, returns the corresponding keycode string (a string containing one or
17637 # more keycodes, separated by spaces)
17638 #
17639 # Expected arguments
17640 # $standard - The standard Axmud keycode type (a key in $self->constKeycodeHash) or the
17641 # alternative version of this type (a key in $self->constAltKeycodeHash)
17642 #
17643 # Return values
17644 # 'undef' on improper arguments or if $standard is an invalid standard/alternative keycode
17645 # 1 otherwise
17646  
17647 my ($self, $standard, $check) = @_;
17648  
17649 # Check for improper arguments
17650 if (! defined $standard || defined $check) {
17651  
17652 return $axmud::CLIENT->writeImproper($self->_objClass . '->getKeycode', @_);
17653 }
17654  
17655 # If $standard is an alternative keycode type, translate it into the standard keycode type
17656 if ($axmud::CLIENT->ivExists('constAltKeycodeHash', $standard)) {
17657  
17658 $standard = $axmud::CLIENT->ivShow('constAltKeycodeHash', $standard);
17659  
17660 # Otherwise, check that $type is a valid standard keycode type
17661 } elsif (! $self->ivExists('constKeycodeHash', $standard)) {
17662  
17663 # (No error message displayed - just return 'undef')
17664 return undef;
17665 }
17666  
17667 # Return the keycode string
17668 return $self->ivShow('keycodeHash', $standard);
17669 }
17670  
17671 sub reverseKeycode {
17672  
17673 # Called by anything
17674 # Converts one of the current system's keycodes (e.g. 'ISO_Level3_Shift' on Linux/*BSD,
17675 # 'Alt_R' on MS Windows) into an Axmud standard keycode
17676 #
17677 # Expected arguments
17678 # $sysKeycode - The system keycode, e.g. 'ISO_Level3_Shift', 'Alt_R'
17679 #
17680 # Return values
17681 # 'undef' on improper arguments
17682 # Otherwise returns the Axmud standard keycode. $self->constKeycodeHash doesn't include
17683 # the keycodes for ordinary letters and numbers, so if $sysKeycode isn't in that
17684 # hash, return $sysKeycode unmodified
17685  
17686 my ($self, $sysKeycode, $check) = @_;
17687  
17688 # Local variables
17689 my $standard;
17690  
17691 # Check for improper arguments
17692 if (! defined $sysKeycode || defined $check) {
17693  
17694 return $axmud::CLIENT->writeImproper($self->_objClass . '->reverseKeycode', @_);
17695 }
17696  
17697 $standard = $axmud::CLIENT->ivShow('revKeycodeHash', $sysKeycode);
17698 if (! $standard) {
17699 return $sysKeycode;
17700 } else {
17701 return $standard;
17702 }
17703 }
17704  
17705 sub convertKeycodeString {
17706  
17707 # Called by GA::Generic::Cmd->addInterface and ->modifyInterface while adding or modifying
17708 # a macro
17709 # The macro's stimulus is one of Axmud's standard keycodes (like 'f5') or a keycode string
17710 # (like 'shift f5' or 'ctrl a')
17711 # Standard keycodes in a keycode string must be in a given order (i.e. 'ctrl shift f5', not
17712 # 'shift ctrl f5' or even 'f5 shift ctrl')
17713 # This function changes the order of words in the keycode string, if necessary, and returns
17714 # the modified string
17715 #
17716 # Expected arguments
17717 # $string - A string containing one or more Axmud standard keycodes
17718 #
17719 # Return values
17720 # 'undef' on improper arguments
17721 # Otherwise returns the modified (or original) keycode string
17722  
17723 my ($self, $string, $check) = @_;
17724  
17725 # Local variables
17726 my (
17727 $ctrlFlag, $shiftFlag, $altFlag, $altGrFlag, $newString,
17728 @list, @modList,
17729 );
17730  
17731 # Check for improper arguments
17732 if (! defined $string || defined $check) {
17733  
17734 return $axmud::CLIENT->writeImproper($self->_objClass . '->convertKeycodeString', @_);
17735 }
17736  
17737 # Split the string into a list of words
17738 @list = split(m/\s+/, $string);
17739  
17740 # Go through @list, removing the 'ctrl', 'shift', 'alt', 'alt_gr' (which we'll put back
17741 # later)
17742 foreach my $keycode (@list) {
17743  
17744 if ($keycode eq 'ctrl') {
17745 $ctrlFlag = TRUE;
17746 } elsif ($keycode eq 'shift') {
17747 $shiftFlag = TRUE;
17748 } elsif ($keycode eq 'alt') {
17749 $altFlag = TRUE;
17750 } elsif ($keycode eq 'alt_gr') {
17751 $altGrFlag = TRUE;
17752 } else {
17753 push (@modList, $keycode);
17754 }
17755 }
17756  
17757 # Now compile a new keycode string
17758 $newString = '';
17759  
17760 if ($ctrlFlag) {
17761  
17762 $newString .= 'ctrl';
17763 }
17764  
17765 if ($shiftFlag) {
17766  
17767 if ($newString) {
17768 $newString .= ' shift';
17769 } else {
17770 $newString .= 'shift';
17771 }
17772 }
17773  
17774 if ($altFlag) {
17775  
17776 if ($newString) {
17777 $newString .= ' alt';
17778 } else {
17779 $newString .= 'alt';
17780 }
17781 }
17782  
17783 if ($altGrFlag) {
17784  
17785 if ($newString) {
17786 $newString .= ' alt_gr';
17787 } else {
17788 $newString .= 'alt_gr';
17789 }
17790 }
17791  
17792 foreach my $keycode (@modList) {
17793  
17794 # Preserve the order of keycodes other than 'ctrl', 'shift', 'alt' or 'alt_gr'
17795 if ($newString) {
17796 $newString .= ' ' . $keycode;
17797 } else {
17798 $newString .= $keycode;
17799 }
17800 }
17801  
17802 return $newString;
17803 }
17804  
17805 sub getTime {
17806  
17807 # Called by several functions which handle the task and incoming data loops
17808 # Returns the system's current time (expressed in seconds since the system epoch, to three
17809 # decimal places), using a call to Time::HiRes->gettimeofday()
17810 #
17811 # Expected arguments
17812 # (none besides $self)
17813 #
17814 # Return values
17815 # 'undef' on improper arguments
17816 # The system time on success
17817  
17818 my ($self, $check) = @_;
17819  
17820 # Local variables
17821 my ($secs, $micros);
17822  
17823 # Check for improper arguments
17824 if (defined $check) {
17825  
17826 return $axmud::CLIENT->writeImproper($self->_objClass . '->getTime', @_);
17827 }
17828  
17829 # Get the system time in seconds and microseconds
17830 ($secs, $micros) = Time::HiRes::gettimeofday();
17831 # Convert to seconds (to three decimal places)
17832 return ($secs + (int($micros / 1000)) / 1000);
17833 }
17834  
17835 sub getCounter {
17836  
17837 # Called by anything, but mostly by GA::Session->getTimeLabelText
17838 # Converts a time in seconds into a string like '35:07' or '4:35:07' (ignores milliseconds,
17839 # so 5.741 seconds is returned as the string '0:05'
17840 #
17841 # Expected arguments
17842 # $time - A time in seconds
17843 #
17844 # Return values
17845 # 'undef' on improper arguments
17846 # If $time is not a valid number (0 or positive), returns 0
17847 # Otherwise, returns a string like '35:07' or '4:35:07'
17848  
17849 my ($self, $time, $check) = @_;
17850  
17851 # Local variables
17852 my ($hours, $mins, $secs);
17853  
17854 # Check for improper arguments
17855 if (! defined $time || defined $check) {
17856  
17857 return $axmud::CLIENT->writeImproper($self->_objClass . '->getCounter', @_);
17858 }
17859  
17860 # Check $time is a valid number
17861 if (! $self->floatCheck($time, 0)) {
17862  
17863 return 0;
17864 }
17865  
17866 # Convert $time
17867 $mins = int ($time / 60);
17868 $secs = $time % 60;
17869  
17870 $hours = int ($mins / 60);
17871 $mins = $mins % 60;
17872  
17873 if (! $hours) {
17874 return $mins . sprintf(':%02d', $secs);
17875 } else {
17876 return $hours . sprintf(':%02d:%02d', $mins, $secs);
17877 }
17878 }
17879  
17880 sub localTime {
17881  
17882 # Converts the output from Perl's localtime() function into the following format:
17883 # e.g. 09:17:12, Thu Dec 18, 2010
17884 #
17885 # Expected arguments
17886 # (none besides $self)
17887 #
17888 # Return values
17889 # 'undef' on improper arguments
17890 # Otherwise the string described above
17891  
17892 my ($self, $check) = @_;
17893  
17894 # Local variables
17895 my (
17896 $second, $minute, $hour, $dayOfMonth, $month, $year, $yearOffset, $dayOfWeek,
17897 $dayOfYear, $daylightSavings,
17898 );
17899  
17900 # Check for improper arguments
17901 if (defined $check) {
17902  
17903 return $axmud::CLIENT->writeImproper($self->_objClass . '->localTime', @_);
17904 }
17905  
17906 (
17907 $second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear,
17908 $daylightSavings,
17909 ) = localtime();
17910  
17911 $year = 1900 + $yearOffset;
17912  
17913 return (
17914 sprintf('%02d:%02d:%02d, ', $hour, $minute, $second)
17915 . $self->ivIndex('customDayList', $dayOfWeek)
17916 . ' ' . $self->ivIndex('customMonthList', $month)
17917 . " $dayOfMonth, $year"
17918 );
17919 }
17920  
17921 sub localClock {
17922  
17923 # Converts the output from Perl's localtime() function into the following format:
17924 # e.g. 09:17:12
17925 #
17926 # Expected arguments
17927 # (none besides $self)
17928 #
17929 # Return values
17930 # 'undef' on improper arguments
17931 # Otherwise the string described above
17932  
17933 my ($self, $check) = @_;
17934  
17935 # Local variables
17936 my ($second, $minute, $hour);
17937  
17938 # Check for improper arguments
17939 if (defined $check) {
17940  
17941 return $axmud::CLIENT->writeImproper($self->_objClass . '->localClock', @_);
17942 }
17943  
17944 ($second, $minute, $hour) = localtime();
17945  
17946 return (sprintf('%02d:%02d:%02d', $hour, $minute, $second));
17947 }
17948  
17949 sub localClockString {
17950  
17951 # Converts the output from Perl's localtime() function into the following format:
17952 # e.g. 09_17_12
17953 #
17954 # Expected arguments
17955 # (none besides $self)
17956 #
17957 # Return values
17958 # 'undef' on improper arguments
17959 # Otherwise the string described above
17960  
17961 my ($self, $check) = @_;
17962  
17963 # Local variables
17964 my ($second, $minute, $hour);
17965  
17966 # Check for improper arguments
17967 if (defined $check) {
17968  
17969 return $axmud::CLIENT->writeImproper($self->_objClass . '->localClock', @_);
17970 }
17971  
17972 ($second, $minute, $hour) = localtime();
17973  
17974 return (sprintf('%.2d_%.2d_%.2d', $hour, $minute, $second));
17975 }
17976  
17977 sub localDate {
17978  
17979 # Converts the output from Perl's localtime() function into the following format:
17980 # e.g. Thu Dec 18, 2010
17981 #
17982 # Expected arguments
17983 # (none besides $self)
17984 #
17985 # Return values
17986 # 'undef' on improper arguments
17987 # Otherwise the string described above
17988  
17989 my ($self, $check) = @_;
17990  
17991 # Local variables
17992 my (
17993 $second, $minute, $hour, $dayOfMonth, $month, $year, $yearOffset, $dayOfWeek,
17994 $dayOfYear, $daylightSavings,
17995 );
17996  
17997 # Check for improper arguments
17998 if (defined $check) {
17999  
18000 return $axmud::CLIENT->writeImproper($self->_objClass . '->localDate', @_);
18001 }
18002  
18003 (
18004 $second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear,
18005 $daylightSavings
18006 ) = localtime();
18007  
18008 $year = 1900 + $yearOffset;
18009  
18010 return $self->ivIndex('customDayList', $dayOfWeek)
18011 . ' ' . $self->ivIndex('customMonthList', $month)
18012 . " $dayOfMonth, $year";
18013 }
18014  
18015 sub localDateString {
18016  
18017 # Converts the output from Perl's localtime() function into the following format:
18018 # e.g. 101218 (in format YYMMDD)
18019 #
18020 # Expected arguments
18021 # (none besides $self)
18022 #
18023 # Return values
18024 # 'undef' on improper arguments
18025 # Otherwise the string described above
18026  
18027 my ($self, $check) = @_;
18028  
18029 # Local variables
18030 my (
18031 $second, $minute, $hour, $dayOfMonth, $month, $year, $yearOffset, $dayOfWeek,
18032 $dayOfYear, $daylightSavings,
18033 );
18034  
18035 # Check for improper arguments
18036 if (defined $check) {
18037  
18038 return $axmud::CLIENT->writeImproper($self->_objClass . '->localDateString', @_);
18039 }
18040  
18041 (
18042 $second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear,
18043 $daylightSavings,
18044 ) = localtime();
18045  
18046 # $month is in the range 0-11
18047 $month++;
18048 $year = 1900 + $yearOffset;
18049  
18050 return (sprintf('%.2d%.2d%.2d', substr($year, 2), $month, $dayOfMonth));
18051 }
18052  
18053 sub convertTime {
18054  
18055 # Alternative to $self->localTime, that converts a specified system time rather than the
18056 # current system time into a string in the following format:
18057 # e.g. 09:17:12, Thu Dec 18, 2010
18058 #
18059 # Expected arguments
18060 # $otherTime - A system time (past, present or future) in seconds
18061 #
18062 # Optional arguments
18063 # $mode - If 'clock', only the clock component (e.g. 09:17:12) is returned. If
18064 # 'date', only the date component (e.g. Thu Dec 18, 2010). If 'undef',
18065 # FALSE or any other value, the full string is returned
18066 #
18067 # Return values
18068 # 'undef' on improper arguments
18069 # Otherwise the string described above
18070  
18071 my ($self, $otherTime, $mode, $check) = @_;
18072  
18073 # Local variables
18074 my (
18075 $second, $minute, $hour, $dayOfMonth, $month, $year, $yearOffset, $dayOfWeek,
18076 $dayOfYear, $daylightSavings,
18077 );
18078  
18079 # Check for improper arguments
18080 if (defined $check) {
18081  
18082 return $axmud::CLIENT->writeImproper($self->_objClass . '->convertTime', @_);
18083 }
18084  
18085 (
18086 $second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear,
18087 $daylightSavings,
18088 ) = localtime($otherTime);
18089  
18090 $year = 1900 + $yearOffset;
18091  
18092 if (defined $mode) {
18093  
18094 if ($mode eq 'clock') {
18095  
18096 return sprintf('%02d:%02d:%02d', $hour, $minute, $second);
18097  
18098 } elsif ($mode eq 'date') {
18099  
18100 return $self->ivIndex('customDayList', $dayOfWeek) . ' '
18101 . $self->ivIndex('customMonthList', $month)
18102 . " $dayOfMonth, $year";
18103 }
18104 }
18105  
18106 # Default - return full string
18107 return (
18108 sprintf('%02d:%02d:%02d, ', $hour, $minute, $second)
18109 . $self->ivIndex('customDayList', $dayOfWeek)
18110 . ' ' . $self->ivIndex('customMonthList', $month)
18111 . " $dayOfMonth, $year"
18112 );
18113 }
18114  
18115 sub trimWhitespace {
18116  
18117 # Can be called anything
18118 # Removes all whitespace at the beginning and end of a string
18119 # e.g. ' You are here. He is there <tab>'
18120 # >> 'You are here. He is there.'
18121 # Optionally replaces space in the middle of the string with a single space character
18122 # e.g. ' You are here. He is there <tab>'
18123 # >> 'You are here. He is there.'
18124 #
18125 # Expected arguments
18126 # $string - The string to trim
18127 #
18128 # Optional arguments
18129 # $flag - If set to TRUE, replaces space in the middle of the string; 'undef' otherwise
18130 #
18131 # Return values
18132 # 'undef' on improper arguments
18133 # Otherwise returns the trimmed string
18134  
18135 my ($self, $string, $flag, $check) = @_;
18136  
18137 # Check for improper arguments
18138 if (! defined $string || defined $check) {
18139  
18140 return $axmud::CLIENT->writeImproper($self->_objClass . '->trimWhitespace', @_);
18141 }
18142  
18143 # Trim whitespace from the beginning of the string
18144 $string =~ s/^\s+//;
18145 # Trim whitespace from the end of the string
18146 $string =~ s/\s+$//;
18147  
18148 if ($flag) {
18149  
18150 # Shorten whitespace in the middle of the string
18151 $string =~ s/\s+/ /g;
18152 }
18153  
18154 return $string;
18155 }
18156  
18157 sub convertVersion {
18158  
18159 # Converts an Axmud version (in the form 1.2.11) into a single integer number (in this case,
18160 # 1,002,011) so that version numbers can be compared
18161 # The string '1.2.11' is made up of three components. The first is converted into a number
18162 # measured in millions, the second a number measured in thousands, the third is not
18163 # converted
18164 # In this case, we have 1,000,000 + 2000 + 11 = 1002011
18165 # We assume that the 2nd and 3rd components aren't larger than 999
18166 #
18167 # Expected arguments
18168 # $string - An Axmud version string in the form 1.2.11 (possibly the value stored in
18169 # $axmud::VERSION)
18170 #
18171 # Return values
18172 # 'undef' on improper arguments
18173 # Otherwise, the converted string in the form of an integer number
18174  
18175 my ($self, $string, $check) = @_;
18176  
18177 # Local variables
18178 my (
18179 $number,
18180 @list,
18181 );
18182  
18183 # Check for improper arguments
18184 if (! defined $string || defined $check) {
18185  
18186 return $axmud::CLIENT->writeImproper($self->_objClass . '->convertVersion', @_);
18187 }
18188  
18189 # Convert the string into its three components
18190 @list = split(/\./, $string);
18191  
18192 # Convert the components into a single number
18193 $number = ($list[0] * 1_000_000) + ($list[1] * 1_000) + $list[2];
18194  
18195 return $number;
18196 }
18197  
18198 sub convertRoman {
18199  
18200 # Converts an integer into Roman numerals (based on code from Text::Roman version by
18201 # Stanislaw Pusep)
18202 #
18203 # Expected arguments
18204 # $value - Integer value between 1 and 3999
18205 #
18206 # Return values
18207 # 'undef' on improper arguments
18208 # An empty string if $value is not an integer between 1 and 3999
18209 # Otherwise returns the equivalent Roman numeral in upper-case letters, e.g. 'XII'
18210  
18211 my ($self, $value, $check) = @_;
18212  
18213 # Local variables
18214 my (
18215 $string,
18216 %reverseHash,
18217 );
18218  
18219 # Check for improper arguments
18220 if (! defined $value || defined $check) {
18221  
18222 return $axmud::CLIENT->writeImproper($self->_objClass . '->convertRoman', @_);
18223 }
18224  
18225 # Check that $value is valid
18226 if (! $self->intCheck($value, 1, 3999)) {
18227  
18228 return '';
18229 }
18230  
18231 # Do the conversion
18232 %reverseHash = reverse $self->constRomanHash;
18233 for (reverse sort { $a <=> $b } $self->ivValues('constRomanHash')) {
18234  
18235 $string .= $reverseHash{$_} x int($value / $_);
18236 $value %= $_;
18237 }
18238  
18239 return $string;
18240 }
18241  
18242 sub splitText {
18243  
18244 # Splits a line of text into a specified number of rows separated by line break characters
18245 # Each line will be no longer than a specified number of characters, but words are not
18246 # split (unless they're longer than the line)
18247 # Discards any extra text and optionally appends an ellipsis if doing so
18248 #
18249 # Expected arguments
18250 # $line - The line of text to split
18251 # $rows - The maximum number of rows. If 0, there is no maximum (and no text is
18252 # discarded)
18253 # $columns - The maximum number of columns per line (minimum 10)
18254 #
18255 # Optional arguments
18256 # $ellipsisFlag - If set to TRUE, an ellipsis is appended if any text is discarded.
18257 # If set to FALSE (or 'undef'), no ellipsis is appended
18258 # $noHyphenFlag - If set to TRUE, no hyphen is added at the end of a word which has
18259 # been split. If FALSE (or 'undef'), no hyphens are ever added
18260 #
18261 # Return values
18262 # The unmodified value of $text on improper arguments, or if $rows and/or $columns are
18263 # invalid values
18264 # Otherwise, returns the modified string
18265  
18266 my ($self, $line, $rows, $columns, $ellipsisFlag, $hyphenFlag, $check) = @_;
18267  
18268 # Local variables
18269 my (
18270 $hyphen, $keep, $newLine,
18271 @array,
18272 );
18273  
18274 # Check for improper arguments
18275 if (! defined $line || ! defined $rows || ! defined $columns || defined $check) {
18276  
18277 $axmud::CLIENT->writeImproper($self->_objClass . '->splitText', @_);
18278 return $line;
18279 }
18280  
18281 # Check for valid values of $rows and $columns
18282 if (! $self->intCheck($rows, 0) || ! $self->intCheck($columns, 10)) {
18283  
18284 return $line;
18285 }
18286  
18287 # Use a hyphen, or not
18288 if (! $hyphenFlag) {
18289 $hyphen = '';
18290 } else {
18291 $hyphen = '-';
18292 }
18293  
18294 # Replace any existing newline characters with spaces
18295 $line =~ s/\n+/ /g;
18296  
18297 # Split the text into distinct lines
18298 do {
18299  
18300 my ($i, $gap);
18301  
18302 $i = 0; # Search the text, character by character
18303 $keep = 0; # If splitting on a forward slash, preserve it
18304  
18305 if (length($line) <= $columns) {
18306  
18307 # No need to split anything (and this is the final iteration)
18308 push(@array, $line);
18309 $line = '';
18310  
18311 } else {
18312  
18313 # The line is going to be split near character number $columns. Find the space (or
18314 # tab, or forward slash) nearest to the end of the line
18315 OUTER: for ($i = $columns; $i > 0; $i--) {
18316  
18317 my $char = substr($line, $i, 1);
18318  
18319 if ($char eq " " || $char eq "\t") {
18320  
18321 last OUTER;
18322  
18323 } elsif ($char eq "/") {
18324  
18325 $keep = 1;
18326 last OUTER;
18327 }
18328 }
18329  
18330 # A space (or tab or forward slash) was found. Split the line there
18331 if ($i > 1) {
18332  
18333 push (@array, substr($line, 0, ($i + $keep)));
18334 $line = substr($line, ($i + 1));
18335  
18336 # There is no space at which the line can be split. Split a word (using a hyphen, if
18337 # allowed)
18338 } else {
18339  
18340 push (@array, substr($line, 0, ($columns)) . $hyphen);
18341 $line = substr($line, $columns);
18342 }
18343 }
18344  
18345 } until ($line eq '' || ($rows && (scalar @array) >= $rows));
18346  
18347 # Join the distinct lines together as a single string, with the lines separated by newline
18348 # characters
18349 $newLine = join("\n", @array);
18350 # If we're discarding extra text, append an ellipsis (if allowed)
18351 if ($line && $ellipsisFlag) {
18352  
18353 $newLine .= '...';
18354 }
18355  
18356 return $newLine;
18357 }
18358  
18359 sub encodeJson {
18360  
18361 # Uses the JSON module to convert a Perl data structure to a UTF-8 encoded binary string
18362 #
18363 # Expected arguments
18364 # $data - The Perl data structure to encode
18365 #
18366 # Return values
18367 # 'undef' on improper arguments or if the conversion fails
18368 # Otherwise returns the binary string
18369  
18370 my ($self, $data, $check) = @_;
18371  
18372 # Local variables
18373 my $obj;
18374  
18375 # Check for improper arguments
18376 if (! defined $data || defined $check) {
18377  
18378 return $axmud::CLIENT->writeImproper($self->_objClass . '->encodeJson', @_);
18379 }
18380  
18381 $obj = JSON->new();
18382 $obj->allow_nonref();
18383 $obj->allow_unknown();
18384 $obj->space_before();
18385 $obj->space_after();
18386  
18387 return $obj->utf8->encode($data);
18388 }
18389  
18390 sub decodeJson {
18391  
18392 # Uses the JSON module to convert a UTF-8 encoded binary string to a Perl data structure
18393 #
18394 # Expected arguments
18395 # $data - The string to decode
18396 #
18397 # Return values
18398 # 'undef' on improper arguments, if $data is an empty string (or contains just space
18399 # characters), or if the conversion fails
18400 # Otherwise returns the Perl data structure
18401  
18402 my ($self, $data, $check) = @_;
18403  
18404 # Local variables
18405 my $obj;
18406  
18407 # Check for improper arguments
18408 if (! defined $data || defined $check) {
18409  
18410 return $axmud::CLIENT->writeImproper($self->_objClass . '->decodeJson', @_);
18411 }
18412  
18413 # (Materia magica presents an ATCP/GMCP packet which produces a $data consisting of a single
18414 # space character, so we need to check for that)
18415 if ($data eq '' || $data =~ m/^\s*$/) {
18416  
18417 return undef;
18418 }
18419  
18420 $obj = JSON->new();
18421 $obj->allow_nonref();
18422 $obj->allow_unknown();
18423  
18424 return $obj->utf8->decode($data);
18425 }
18426  
18427 sub benchMark {
18428  
18429 # Can be called by anything
18430 # Stores the current system time in $self->benchMarkTime
18431 # The subsequent call to $self->stopBenchMark calculates the time that has elapsed between
18432 # the two function calls
18433 #
18434 # Expected arguments
18435 # (none besides $self)
18436 #
18437 # Return values
18438 # 1
18439  
18440 my ($self) = @_;
18441  
18442 # Local variables
18443 my ($secs, $micros);
18444  
18445 # (No improper arguments check for speed)
18446  
18447 # Store the system time to 3dp
18448 ($secs, $micros) = Time::HiRes::gettimeofday();
18449 $self->{benchMarkTime} = ($secs * 1000000) + $micros;
18450  
18451 return 1;
18452 }
18453  
18454 sub stopBenchMark {
18455  
18456 # Can be called by anything
18457 # Works out the time (in microseconds) that has elapsed since the previous call to
18458 # $self->benchMark, and writes it to the terminal, updating averaging IVs at the same time
18459 #
18460 # Expected arguments
18461 # (none besides $self)
18462 #
18463 # Return values
18464 # 1
18465  
18466 my ($self) = @_;
18467  
18468 # Local variable
18469 my ($secs, $micros, $time, $count, $total, $average, $count2, $total2, $average2);
18470  
18471 # (No improper arguments check for speed)
18472  
18473 if (! $self->{benchMarkTime}) {
18474  
18475 # Bad call
18476 return 1;
18477 }
18478  
18479 # Get the system time to 3dp
18480 ($secs, $micros) = Time::HiRes::gettimeofday();
18481 $time = ($secs * 1000000) + $micros - $self->{benchMarkTime};
18482  
18483 # Calculate average of the short list
18484 $self->ivPush('benchMarkShortList', $time);
18485 $count = $self->ivNumber('benchMarkShortList');
18486 if ($count >= 10) {
18487  
18488 $self->ivShift('benchMarkShortList');
18489 $count--;
18490 }
18491  
18492 $total = 0;
18493 foreach my $time ($self->benchMarkShortList) {
18494  
18495 $total += $time;
18496 }
18497  
18498 $average = int($total / $count);
18499  
18500 # Calculate average of the long list
18501 $self->ivPush('benchMarkLongList', $time);
18502 $count2 = $self->ivNumber('benchMarkLongList');
18503 if ($count2 >= 100) {
18504  
18505 $self->ivShift('benchMarkLongList');
18506 $count2--;
18507 }
18508  
18509 $total2 = 0;
18510 foreach my $time ($self->benchMarkLongList) {
18511  
18512 $total2 += $time;
18513 }
18514  
18515 $average2 = int($total2 / $count2);
18516  
18517 print "BENCHMARK: time $time, recent $average, average $average2\n";
18518  
18519 return 1;
18520 }
18521  
18522 ##################
18523 # Accessors - set
18524  
18525 sub set_aboutWin {
18526  
18527 my ($self, $winObj, $check) = @_;
18528  
18529 # Check for improper arguments
18530 if (defined $check) {
18531  
18532 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_aboutWin', @_);
18533 }
18534  
18535 # Update IVs
18536 $self->ivPoke('aboutWin', $winObj);
18537  
18538 return 1;
18539 }
18540  
18541 sub set_activateGridFlag {
18542  
18543 my ($self, $flag, $check) = @_;
18544  
18545 # Check for improper arguments
18546 if (! defined $flag || defined $check) {
18547  
18548 return $axmud::CLIENT->writeImproper(
18549 $self->_objClass . '->set_activateGridFlag',
18550 @_,
18551 );
18552 }
18553  
18554 if ($flag) {
18555 $self->ivPoke('activateGridFlag', TRUE);
18556 } else {
18557 $self->ivPoke('activateGridFlag', FALSE);
18558 }
18559  
18560 # The data stored in this IV is saved in the 'config' file
18561 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_activateGridFlag');
18562  
18563 return 1;
18564 }
18565  
18566 sub add_activeKeycode {
18567  
18568 my ($self, $keycode, $check) = @_;
18569  
18570 # Check for improper arguments
18571 if (! defined $keycode || defined $check) {
18572  
18573 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_activeKeycode', @_);
18574 }
18575  
18576 $self->ivAdd('activeKeycodeHash', $keycode, undef);
18577  
18578 return 1;
18579 }
18580  
18581 sub reset_activeKeycodes {
18582  
18583 my ($self, $check) = @_;
18584  
18585 # Local variables
18586 my %hash;
18587  
18588 # Check for improper arguments
18589 if (defined $check) {
18590  
18591 return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_activeKeycodes', @_);
18592 }
18593  
18594 OUTER: foreach my $session ($self->listSessions()) {
18595  
18596 INNER: foreach my $keycode ($session->ivValues('macroHash')) {
18597  
18598 $hash{$keycode} = undef;
18599 }
18600 }
18601  
18602 $self->ivPoke('activeKeycodeHash', %hash);
18603 $self->ivPoke('resetKeycodesFlag', FALSE);
18604  
18605 return 1;
18606 }
18607  
18608 sub set_allowAsciiBellFlag {
18609  
18610 my ($self, $flag, $check) = @_;
18611  
18612 # Check for improper arguments
18613 if (! defined $flag || defined $check) {
18614  
18615 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_allowAsciiBellFlag', @_);
18616 }
18617  
18618 if ($flag) {
18619 $self->ivPoke('allowAsciiBellFlag', TRUE);
18620 } else {
18621 $self->ivPoke('allowAsciiBellFlag', FALSE);
18622 }
18623  
18624 # The data stored in this IV is saved in the 'config' file
18625 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_allowAsciiBellFlag');
18626  
18627 return 1;
18628 }
18629  
18630 sub set_allowBusyWinFlag {
18631  
18632 my ($self, $flag, $check) = @_;
18633  
18634 # Check for improper arguments
18635 if (! defined $flag || defined $check) {
18636  
18637 return $axmud::CLIENT->writeImproper(
18638 $self->_objClass . '->set_allowBusyWinFlag',
18639 @_,
18640 );
18641 }
18642  
18643 if ($flag) {
18644 $self->ivPoke('allowBusyWinFlag', TRUE);
18645 } else {
18646 $self->ivPoke('allowBusyWinFlag', FALSE);
18647 }
18648  
18649 # The data stored in this IV is saved in the 'config' file
18650 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_allowBusyWinFlag');
18651  
18652 return 1;
18653 }
18654  
18655 sub set_allowModelSplitFlag {
18656  
18657 my ($self, $flag, $check) = @_;
18658  
18659 # Check for improper arguments
18660 if (! defined $flag || defined $check) {
18661  
18662 return $axmud::CLIENT->writeImproper(
18663 $self->_objClass . '->set_allowModelSplitFlag',
18664 @_,
18665 );
18666 }
18667  
18668 if ($flag) {
18669 $self->ivPoke('allowModelSplitFlag', TRUE);
18670 } else {
18671 $self->ivPoke('allowModelSplitFlag', FALSE);
18672 }
18673  
18674 # The data stored in this IV is saved in the 'config' file
18675 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_allowModelSplitFlag');
18676  
18677 return 1;
18678 }
18679  
18680 sub set_allowMxpFlag {
18681  
18682 my ($self, $type, $flag, $check) = @_;
18683  
18684 # Check for improper arguments
18685 if (! defined $flag || defined $check) {
18686  
18687 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_allowMxpFlag', @_);
18688 }
18689  
18690 if (! $flag) {
18691 $flag = FALSE;
18692 } else {
18693 $flag = TRUE;
18694 }
18695  
18696 if ($type eq 'font') {
18697 $self->ivPoke('allowMxpFontFlag', $flag);
18698 } elsif ($type eq 'image') {
18699 $self->ivPoke('allowMxpImageFlag', $flag);
18700 } elsif ($type eq 'load_image') {
18701 $self->ivPoke('allowMxpLoadImageFlag', $flag);
18702 } elsif ($type eq 'filter_image') {
18703 $self->ivPoke('allowMxpFilterImageFlag', $flag);
18704 } elsif ($type eq 'sound') {
18705 $self->ivPoke('allowMxpSoundFlag', $flag);
18706 } elsif ($type eq 'load_sound') {
18707 $self->ivPoke('allowMxpLoadSoundFlag', $flag);
18708 } elsif ($type eq 'gauge') {
18709 $self->ivPoke('allowMxpGaugeFlag', $flag);
18710 } elsif ($type eq 'frame') {
18711 $self->ivPoke('allowMxpFrameFlag', $flag);
18712 } elsif ($type eq 'interior') {
18713 $self->ivPoke('allowMxpInteriorFlag', $flag);
18714 } elsif ($type eq 'crosslink') {
18715 $self->ivPoke('allowMxpCrosslinkFlag', $flag);
18716 } elsif ($type eq 'room') {
18717 $self->ivPoke('allowMxpRoomFlag', $flag);
18718 } elsif ($type eq 'flexible') {
18719 $self->ivPoke('allowMxpFlexibleFlag', $flag);
18720 } elsif ($type eq 'perm') {
18721 $self->ivPoke('allowMxpPermFlag', $flag);
18722 }
18723  
18724 # The data stored in this IV is saved in the 'config' file
18725 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_allowMxpFlag');
18726  
18727 # Any sessions which are connected to a world, and which are using MXP, should re-issue
18728 # their <SUPPORTS> tag (this isn't part of the MXP spec, but it can't do any damage; the
18729 # world will either implement an unsolicited <SUPPORTS> tag, or it won't)
18730 if (! $self->mxpPreventSupportFlag && $type ne 'room') {
18731  
18732 foreach my $session ($self->ivValues('sessionHash')) {
18733  
18734 if ($session->status eq 'connected' && $session->mxpMode eq 'client_agree') {
18735  
18736 # Process a fake <SUPPORT> tag, as if the world had sent one
18737 $session->processMxpSupportElement('<SUPPORT>', 0, 'SUPPORT');
18738 }
18739 }
18740 }
18741  
18742 return 1;
18743 }
18744  
18745 sub set_allowSoundFlag {
18746  
18747 my ($self, $flag, $check) = @_;
18748  
18749 # Check for improper arguments
18750 if (! defined $flag || defined $check) {
18751  
18752 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_allowSoundFlag', @_);
18753 }
18754  
18755 if ($flag) {
18756 $self->ivPoke('allowSoundFlag', TRUE);
18757 } else {
18758 $self->ivPoke('allowSoundFlag', FALSE);
18759 }
18760  
18761 # The data stored in this IV is saved in the 'config' file
18762 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_allowSoundFlag');
18763  
18764 # Any sessions which are connected to a world, and which are using MXP, should re-issue
18765 # their <SUPPORTS> tag (this isn't part of the MXP spec, but it can't do any damage; the
18766 # world will either implement an unsolicited <SUPPORTS> tag, or it won't)
18767 foreach my $session ($self->ivValues('sessionHash')) {
18768  
18769 if ($session->status eq 'connected' && $session->mxpMode eq 'client_agree') {
18770  
18771 # Process a fake <SUPPORT> tag, as if the world had sent one
18772 $session->processMxpSupportElement('<SUPPORT>', 0, 'SUPPORT');
18773 }
18774 }
18775  
18776 return 1;
18777 }
18778  
18779 sub set_audioCmd {
18780  
18781 my ($self, $cmd, $check) = @_;
18782  
18783 # Check for improper arguments
18784 if (! defined $cmd || defined $check) {
18785  
18786 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_audioCmd', @_);
18787 }
18788  
18789 $self->ivPoke('audioCmd', $cmd);
18790  
18791 # The data stored in this IV is saved in the 'config' file
18792 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_audioCmd');
18793  
18794 return 1;
18795 }
18796  
18797 sub set_autoCompleteMode {
18798  
18799 my ($self, $mode, $check) = @_;
18800  
18801 # Check for improper arguments
18802 if (! defined $mode || defined $check) {
18803  
18804 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_autoCompleteMode', @_);
18805 }
18806  
18807 # Update IVs
18808 $self->ivPoke('autoCompleteMode', $mode);
18809 $self->ivUndef('instructBufferPosn');
18810 $self->ivUndef('cmdBufferPosn');
18811  
18812 foreach my $session ($self->listSessions()) {
18813  
18814 $session->set_instructBufferPosn();
18815 $session->set_cmdBufferPosn();
18816 }
18817  
18818 foreach my $winObj ($self->desktopObj->ivValues('gridWinHash')) {
18819  
18820 $winObj->resetEntry();
18821 }
18822  
18823 # The data stored in this IV is saved in the 'config' file
18824 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_autoCompleteMode');
18825  
18826 return 1;
18827 }
18828  
18829 sub set_autoCompleteParent {
18830  
18831 my ($self, $parent, $check) = @_;
18832  
18833 # Check for improper arguments
18834 if (! defined $parent || defined $check) {
18835  
18836 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_autoCompleteParent', @_);
18837 }
18838  
18839 # Update IVs
18840 if ($parent eq 'client') {
18841 $self->ivPoke('autoCompleteParent', 'combined');
18842 } else {
18843 $self->ivPoke('autoCompleteParent', 'session'); # Initial value
18844 }
18845  
18846 $self->ivUndef('instructBufferPosn');
18847 $self->ivUndef('cmdBufferPosn');
18848  
18849 foreach my $session ($self->listSessions()) {
18850  
18851 $session->set_instructBufferPosn();
18852 $session->set_cmdBufferPosn();
18853 }
18854  
18855 foreach my $winObj ($self->desktopObj->ivValues('gridWinHash')) {
18856  
18857 $winObj->resetEntry();
18858 }
18859  
18860 # The data stored in this IV is saved in the 'config' file
18861 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_autoCompleteParent');
18862  
18863 return 1;
18864 }
18865  
18866 sub set_autoCompleteType {
18867  
18868 my ($self, $type, $check) = @_;
18869  
18870 # Check for improper arguments
18871 if (! defined $type || defined $check) {
18872  
18873 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_autoCompleteType', @_);
18874 }
18875  
18876 # Update IVs
18877 if ($type eq 'instruct') {
18878 $self->ivPoke('autoCompleteType', 'instruct');
18879 } else {
18880 $self->ivPoke('autoCompleteType', 'cmd'); # Initial value
18881 }
18882  
18883 $self->ivUndef('instructBufferPosn');
18884 $self->ivUndef('cmdBufferPosn');
18885  
18886 foreach my $session ($self->listSessions()) {
18887  
18888 $session->set_instructBufferPosn();
18889 $session->set_cmdBufferPosn();
18890 }
18891  
18892 foreach my $winObj ($self->desktopObj->ivValues('gridWinHash')) {
18893  
18894 $winObj->resetEntry();
18895 }
18896  
18897 # The data stored in this IV is saved in the 'config' file
18898 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_autoCompleteType');
18899  
18900 return 1;
18901 }
18902  
18903 sub set_autoConnectList {
18904  
18905 my ($self, @args) = @_;
18906  
18907 # (No improper arguments to check; @args can be an empty list)
18908  
18909 $self->ivPoke('autoConnectList', @args);
18910  
18911 # The data stored in this IV is saved in the 'config' file
18912 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_autoConnectList');
18913  
18914 return 1;
18915 }
18916  
18917 sub set_autoRetainFileFlag {
18918  
18919 my ($self, $flag, $check) = @_;
18920  
18921 # Check for improper arguments
18922 if (! defined $flag || defined $check) {
18923  
18924 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_autoRetainFileFlag', @_);
18925 }
18926  
18927 if ($flag) {
18928 $self->ivPoke('autoRetainFileFlag', TRUE);
18929 } else {
18930 $self->ivPoke('autoRetainFileFlag', FALSE);
18931 }
18932  
18933 # The data stored in this IV is saved in the 'config' file
18934 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_autoRetainFileFlag');
18935  
18936 return 1;
18937 }
18938  
18939 sub set_autoSaveFlag {
18940  
18941 my ($self, $flag, $check) = @_;
18942  
18943 # Check for improper arguments
18944 if (! defined $flag || defined $check) {
18945  
18946 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_autoSaveFlag', @_);
18947 }
18948  
18949 if ($flag) {
18950 $self->ivPoke('autoSaveFlag', TRUE);
18951 } else {
18952 $self->ivPoke('autoSaveFlag', FALSE);
18953 }
18954  
18955 # The data stored in this IV is saved in the 'config' file
18956 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_autoSaveFlag');
18957  
18958 return 1;
18959 }
18960  
18961 sub set_autoSaveWaitTime {
18962  
18963 my ($self, $time, $check) = @_;
18964  
18965 # Check for improper arguments
18966 if (! defined $time || defined $check) {
18967  
18968 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_autoSaveWaitTime', @_);
18969 }
18970  
18971 $self->ivPoke('autoSaveWaitTime', $time);
18972  
18973 # The data stored in this IV is saved in the 'config' file
18974 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_autoSaveWaitTime');
18975  
18976 return 1;
18977 }
18978  
18979 sub set_autoBackupAppendFlag {
18980  
18981 my ($self, $flag, $check) = @_;
18982  
18983 # Check for improper arguments
18984 if (! defined $flag || defined $check) {
18985  
18986 return $axmud::CLIENT->writeImproper(
18987 $self->_objClass . '->set_autoBackupAppendFlag',
18988 @_,
18989 );
18990 }
18991  
18992 if ($flag) {
18993 $self->ivPoke('autoBackupAppendFlag', TRUE);
18994 } else {
18995 $self->ivPoke('autoBackupAppendFlag', FALSE);
18996 }
18997  
18998 # The data stored in this IV is saved in the 'config' file
18999 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_autoBackupAppendFlag');
19000  
19001 return 1;
19002 }
19003  
19004 sub set_autoBackupDir {
19005  
19006 my ($self, $dir, $check) = @_;
19007  
19008 # Check for improper arguments
19009 if (defined $check) {
19010  
19011 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_autoBackupDir', @_);
19012 }
19013  
19014 $self->ivPoke('autoBackupDir', $dir);
19015  
19016 # The data stored in this IV is saved in the 'config' file
19017 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_autoBackupDir');
19018  
19019 return 1;
19020 }
19021  
19022 sub set_autoBackupFileType {
19023  
19024 my ($self, $type, $check) = @_;
19025  
19026 # Check for improper arguments
19027 if (
19028 ! defined $type
19029 || ($type ne 'default' && $type ne 'tar' && $type ne 'zip')
19030 || defined $check
19031 ) {
19032 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_autoBackupFileType', @_);
19033 }
19034  
19035 $self->ivPoke('autoBackupFileType', $type);
19036  
19037 # The data stored in this IV is saved in the 'config' file
19038 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_autoBackupFileType');
19039  
19040 return 1;
19041 }
19042  
19043 sub set_autoBackupInterval {
19044  
19045 my ($self, $number, $check) = @_;
19046  
19047 # Check for improper arguments
19048 if (! defined $number || defined $check) {
19049  
19050 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_autoBackupInterval', @_);
19051 }
19052  
19053 $self->ivPoke('autoBackupInterval', $number);
19054  
19055 # The data stored in this IV is saved in the 'config' file
19056 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_autoBackupInterval');
19057  
19058 return 1;
19059 }
19060  
19061 sub set_autoBackupMode {
19062  
19063 my ($self, $mode, $check) = @_;
19064  
19065 # Check for improper arguments
19066 if (
19067 ! defined $mode
19068 || (
19069 $mode ne 'no_backup' && $mode ne 'all_start' && $mode ne 'all_stop'
19070 && $mode ne 'interval_start' && $mode ne 'interval_stop'
19071 ) || defined $check
19072 ) {
19073 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_autoBackupMode', @_);
19074 }
19075  
19076 $self->ivPoke('autoBackupMode', $mode);
19077  
19078 # The data stored in this IV is saved in the 'config' file
19079 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_autoBackupMode');
19080  
19081 return 1;
19082 }
19083  
19084 sub set_blindHelpMsgShownFlag {
19085  
19086 my ($self, $flag, $check) = @_;
19087  
19088 # Check for improper arguments
19089 if (! defined $flag || defined $check) {
19090  
19091 return $axmud::CLIENT->writeImproper(
19092 $self->_objClass . '->set_blindHelpMsgShownFlag',
19093 @_,
19094 );
19095 }
19096  
19097 if ($flag) {
19098 $self->ivPoke('blindHelpMsgShownFlag', TRUE);
19099 } else {
19100 $self->ivPoke('blindHelpMsgShownFlag', FALSE);
19101 }
19102  
19103 # The data stored in this IV is saved in the 'config' file
19104 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_blindHelpMsgShownFlag');
19105  
19106 return 1;
19107 }
19108  
19109 sub set_blockWorldHintFlag {
19110  
19111 my ($self, $flag, $check) = @_;
19112  
19113 # Check for improper arguments
19114 if (! defined $flag || defined $check) {
19115  
19116 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_blockWorldHintFlag', @_);
19117 }
19118  
19119 if ($flag) {
19120 $self->ivPoke('blockWorldHintFlag', TRUE);
19121 } else {
19122 $self->ivPoke('blockWorldHintFlag', FALSE);
19123 }
19124  
19125 return 1;
19126 }
19127  
19128 sub set_browserCmd {
19129  
19130 my ($self, $cmd, $check) = @_;
19131  
19132 # Check for improper arguments
19133 if (! defined $cmd || defined $check) {
19134  
19135 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_browserCmd', @_);
19136 }
19137  
19138 $self->ivPoke('browserCmd', $cmd);
19139  
19140 # The data stored in this IV is saved in the 'config' file
19141 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_browserCmd');
19142  
19143 return 1;
19144 }
19145  
19146 sub set_busyWin {
19147  
19148 my ($self, $winObj, $check) = @_;
19149  
19150 # Check for improper arguments
19151 if (defined $check) {
19152  
19153 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_busyWin', @_);
19154 }
19155  
19156 # Update IVs
19157 $self->ivPoke('busyWin', $winObj);
19158  
19159 return 1;
19160 }
19161  
19162 sub set_chatAcceptMode {
19163  
19164 my ($self, $mode, $check) = @_;
19165  
19166 # Check for improper arguments
19167 if (
19168 ! defined $mode
19169 || ($mode ne 'prompt' && $mode ne 'accept_contact' && $mode ne 'accept_all')
19170 || defined $check
19171 ) {
19172 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_chatAcceptMode', @_);
19173 }
19174  
19175 $self->ivPoke('chatAcceptMode', $mode);
19176  
19177 # The data stored in this IV is saved in the 'contacts' file
19178 $self->setModifyFlag('contacts', TRUE, $self->_objClass . '->set_chatAcceptMode');
19179  
19180 return 1;
19181 }
19182  
19183 sub add_chatContact {
19184  
19185 my ($self, $name, $obj, $check) = @_;
19186  
19187 # Check for improper arguments
19188 if (! defined $name || ! defined $obj || defined $check) {
19189  
19190 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_chatContact', @_);
19191 }
19192  
19193 $self->ivAdd('chatContactHash', $name, $obj);
19194  
19195 # The data stored in this IV is saved in the 'contacts' file
19196 $self->setModifyFlag('contacts', TRUE, $self->_objClass . '->add_chatContact');
19197  
19198 return 1;
19199 }
19200  
19201 sub del_chatContact {
19202  
19203 my ($self, $name, $check) = @_;
19204  
19205 # Check for improper arguments
19206 if (! defined $name || defined $check) {
19207  
19208 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_chatContact', @_);
19209 }
19210  
19211 $self->ivDelete('chatContactHash', $name);
19212  
19213 # The data stored in this IV is saved in the 'contacts' file
19214 $self->setModifyFlag('contacts', TRUE, $self->_objClass . '->del_chatContact');
19215  
19216 return 1;
19217 }
19218  
19219 sub set_charSet {
19220  
19221 # This function should only be called by GA::Cmd::SetCharSet->do
19222  
19223 my ($self, $charSet, $check) = @_;
19224  
19225 # Check for improper arguments
19226 if (! defined $charSet || defined $check) {
19227  
19228 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_charSet', @_);
19229 }
19230  
19231 $self->ivPoke('charSet', $charSet);
19232  
19233 # The data stored in this IV is saved in the 'config' file
19234 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_charSet');
19235  
19236 return 1;
19237 }
19238  
19239 sub set_chatEmail {
19240  
19241 my ($self, $email, $check) = @_;
19242  
19243 # Check for improper arguments
19244 if (defined $check) {
19245  
19246 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_chatEmail', @_);
19247 }
19248  
19249 $self->ivPoke('chatEmail', $email); # Can be 'undef'
19250  
19251 # The data stored in this IV is saved in the 'contacts' file
19252 $self->setModifyFlag('contacts', TRUE, $self->_objClass . '->set_chatEmail');
19253  
19254 return 1;
19255 }
19256  
19257 sub set_chatIcon {
19258  
19259 my ($self, $path, $check) = @_;
19260  
19261 # Check for improper arguments
19262 if (! defined $path || defined $check) {
19263  
19264 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_chatIcon', @_);
19265 }
19266  
19267 $self->ivPoke('chatIcon', $path); # Can't be 'undef'
19268  
19269 # The data stored in this IV is saved in the 'contacts' file
19270 $self->setModifyFlag('contacts', TRUE, $self->_objClass . '->set_chatIcon');
19271  
19272 return 1;
19273 }
19274  
19275 sub set_chatName {
19276  
19277 my ($self, $name, $check) = @_;
19278  
19279 # Check for improper arguments
19280 if (defined $check) {
19281  
19282 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_chatName', @_);
19283 }
19284  
19285 $self->ivPoke('chatName', $name); # Can be 'undef'
19286  
19287 # The data stored in this IV is saved in the 'contacts' file
19288 $self->setModifyFlag('contacts', TRUE, $self->_objClass . '->set_chatName');
19289  
19290 return 1;
19291 }
19292  
19293 sub add_chatSmiley {
19294  
19295 my ($self, $smiley, $path, $check) = @_;
19296  
19297 # Check for improper arguments
19298 if (! defined $smiley || ! defined $path || defined $check) {
19299  
19300 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_chatSmiley', @_);
19301 }
19302  
19303 $self->ivAdd('chatSmileyHash', $smiley, $path);
19304  
19305 # The data stored in this IV is saved in the 'contacts' file
19306 $self->setModifyFlag('contacts', TRUE, $self->_objClass . '->add_chatSmiley');
19307  
19308 return 1;
19309 }
19310  
19311 sub del_chatSmiley {
19312  
19313 my ($self, $smiley, $check) = @_;
19314  
19315 # Check for improper arguments
19316 if (! defined $smiley || defined $check) {
19317  
19318 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_chatSmiley', @_);
19319 }
19320  
19321 $self->ivDelete('chatSmileyHash', $smiley);
19322  
19323 # The data stored in this IV is saved in the 'contacts' file
19324 $self->setModifyFlag('contacts', TRUE, $self->_objClass . '->del_chatSmiley');
19325  
19326 return 1;
19327 }
19328  
19329 sub set_chatSmileyHash {
19330  
19331 my ($self, %hash) = @_;
19332  
19333 # (Don't check for improper arguments - %hash can be empty)
19334  
19335 $self->ivPoke('chatSmileyHash', %hash);
19336  
19337 # The data stored in these IVs is saved in the 'contacts' file
19338 $self->setModifyFlag('contacts', TRUE, $self->_objClass . '->set_chatSmileyHash');
19339  
19340 return 1;
19341 }
19342  
19343 sub set_cmdBufferPosn {
19344  
19345 my ($self, $posn, $check) = @_;
19346  
19347 # Check for improper arguments
19348 if (defined $check) {
19349  
19350 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_cmdBufferPosn', @_);
19351 }
19352  
19353 # Update IVs
19354 $self->ivPoke('cmdBufferPosn', $posn);
19355  
19356 return 1;
19357 }
19358  
19359 sub set_cmdSep {
19360  
19361 my ($self, $string, $check) = @_;
19362  
19363 # Check for improper arguments
19364 if (! defined $string || defined $check) {
19365  
19366 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_cmdSep', @_);
19367 }
19368  
19369 $self->ivPoke('cmdSep', $string);
19370  
19371 # The data stored in this IV is saved in the 'config' file
19372 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_cmdSep');
19373  
19374 return 1;
19375 }
19376  
19377 sub add_colourScheme {
19378  
19379 my ($self, $obj, $check) = @_;
19380  
19381 # Check for improper arguments
19382 if (! defined $obj || defined $check) {
19383  
19384 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_colourScheme', @_);
19385 }
19386  
19387 # Update IVs
19388 $self->ivAdd('colourSchemeHash', $obj->name, $obj);
19389  
19390 # The data stored in this IV is saved in the 'winmaps' file
19391 $self->setModifyFlag('winmaps', TRUE, $self->_objClass . '->add_colourScheme');
19392  
19393 return 1;
19394 }
19395  
19396 sub del_colourScheme {
19397  
19398 my ($self, $name, $check) = @_;
19399  
19400 # Check for improper arguments
19401 if (! defined $name || defined $check) {
19402  
19403 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_colourScheme', @_);
19404 }
19405  
19406 # Update IVs
19407 $self->ivDelete('colourSchemeHash', $name);
19408  
19409 # The data stored in this IV is saved in the 'winmaps' file
19410 $self->setModifyFlag('winmaps', TRUE, $self->_objClass . '->del_colourScheme');
19411  
19412 return 1;
19413 }
19414  
19415 sub set_commifyMode {
19416  
19417 my ($self, $mode, $check) = @_;
19418  
19419 # Check for improper arguments
19420 if (
19421 ! defined $mode
19422 || (
19423 $mode ne 'comma' && $mode ne 'europe' && $mode ne 'brit' && $mode ne 'underline'
19424 && $mode ne 'none'
19425 )
19426 || defined $check
19427 ) {
19428 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_commifyMode', @_);
19429 }
19430  
19431 $self->ivPoke('commifyMode', $mode);
19432  
19433 # The data stored in this IV is saved in the 'config' file
19434 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_commifyMode');
19435  
19436 return 1;
19437 }
19438  
19439 sub set_configWinIndexFlag {
19440  
19441 my ($self, $flag, $check) = @_;
19442  
19443 # Check for improper arguments
19444 if (! defined $flag || defined $check) {
19445  
19446 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_configWinIndexFlag', @_);
19447 }
19448  
19449 if ($flag) {
19450 $self->ivPoke('configWinIndexFlag', TRUE);
19451 } else {
19452 $self->ivPoke('configWinIndexFlag', FALSE);
19453 }
19454  
19455 # The data stored in this IV is saved in the 'config' file
19456 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_configWinIndexFlag');
19457  
19458 return 1;
19459 }
19460  
19461 sub set_configWinSimplifyFlag {
19462  
19463 my ($self, $flag, $check) = @_;
19464  
19465 # Check for improper arguments
19466 if (! defined $flag || defined $check) {
19467  
19468 return $axmud::CLIENT->writeImproper(
19469 $self->_objClass . '->set_configWinSimplifyFlag',
19470 @_,
19471 );
19472 }
19473  
19474 if ($flag) {
19475 $self->ivPoke('configWinSimplifyFlag', TRUE);
19476 } else {
19477 $self->ivPoke('configWinSimplifyFlag', FALSE);
19478 }
19479  
19480 # The data stored in this IV is saved in the 'config' file
19481 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_configWinSimplifyFlag');
19482  
19483 return 1;
19484 }
19485  
19486 sub set_configWorldProfList {
19487  
19488 my ($self, @list) = @_;
19489  
19490 # (No improper arguments to check)
19491  
19492 $self->ivPoke('configWorldProfList', @list);
19493  
19494 return 1;
19495 }
19496  
19497 sub set_connectHistoryFlag {
19498  
19499 my ($self, $flag, $check) = @_;
19500  
19501 # Check for improper arguments
19502 if (! defined $flag || defined $check) {
19503  
19504 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_connectHistoryFlag', @_);
19505 }
19506  
19507 if ($flag) {
19508 $self->ivPoke('connectHistoryFlag', TRUE);
19509 } else {
19510 $self->ivPoke('connectHistoryFlag', FALSE);
19511 }
19512  
19513 return 1;
19514 }
19515  
19516 sub set_connectWin {
19517  
19518 my ($self, $winObj, $check) = @_;
19519  
19520 # Check for improper arguments
19521 if (defined $check) {
19522  
19523 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_connectWin', @_);
19524 }
19525  
19526 # Update IVs
19527 $self->ivPoke('connectWin', $winObj);
19528  
19529 return 1;
19530 }
19531  
19532 sub set_consoleWin {
19533  
19534 my ($self, $winObj, $check) = @_;
19535  
19536 # Check for improper arguments
19537 if (defined $check) {
19538  
19539 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_consoleWin', @_);
19540 }
19541  
19542 # Update IVs
19543 $self->ivPoke('consoleWin', $winObj);
19544  
19545 return 1;
19546 }
19547  
19548 sub set_currentColourCube {
19549  
19550 my ($self, $cube, $check) = @_;
19551  
19552 # Check for improper arguments
19553 if (! defined $cube || defined $check) {
19554  
19555 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_currentColourCube', @_);
19556 }
19557  
19558 $self->ivPoke('currentColourCube', $cube);
19559 if ($cube eq 'netscape') {
19560  
19561 $self->ivPoke('xTermColourHash', $self->constNetscapeColourHash);
19562  
19563 } else {
19564  
19565 # Default
19566 $self->ivPoke('xTermColourHash', $self->constXTermColourHash);
19567 }
19568  
19569 # The data stored in this IV is saved in the 'config' file
19570 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_currentColourCube');
19571  
19572 return 1;
19573 }
19574  
19575 sub reset_currentIP {
19576  
19577 my ($self, $check) = @_;
19578  
19579 # Check for improper arguments
19580 if (defined $check) {
19581  
19582 return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_currentIP', @_);
19583 }
19584  
19585 $self->ivUndef('currentIP');
19586  
19587 # The data stored in this IV is saved in the 'config' file
19588 $self->setModifyFlag('config', TRUE, $self->_objClass . '->reset_currentIP');
19589  
19590 return 1;
19591 }
19592  
19593 sub set_customAllowTTSFlag {
19594  
19595 my ($self, $flag, $check) = @_;
19596  
19597 # Check for improper arguments
19598 if (! defined $flag || defined $check) {
19599  
19600 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_customAllowTTSFlag', @_);
19601 }
19602  
19603 if ($flag) {
19604  
19605 $self->ivPoke('customAllowTTSFlag', TRUE);
19606 $self->ivPoke('systemAllowTTSFlag', TRUE);
19607  
19608 } else {
19609  
19610 $self->ivPoke('customAllowTTSFlag', FALSE);
19611 if (! $axmud::BLIND_MODE_FLAG) {
19612  
19613 $self->ivPoke('systemAllowTTSFlag', FALSE);
19614 $self->ivPoke('ttsForceHijackFlag', FALSE);
19615  
19616 } else {
19617  
19618 $self->ivPoke('systemAllowTTSFlag', TRUE);
19619 }
19620 }
19621  
19622 if (! $self->systemAllowTTSFlag) {
19623  
19624 # Interrupt any TTS jobs that might be in progress, and reset TTS IVs to their
19625 # default values
19626 $self->ttsReset();
19627 }
19628  
19629 # The data stored in this IV is saved in the 'config' file
19630 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customAllowTTSFlag');
19631  
19632 return 1;
19633 }
19634  
19635 sub set_customClientName {
19636  
19637 my ($self, $name, $check) = @_;
19638  
19639 # Check for improper arguments
19640 if (defined $check) {
19641  
19642 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_customClientName', @_);
19643 }
19644  
19645 if ($name) {
19646 $self->ivPoke('customClientName', $name);
19647 } else {
19648 $self->ivPoke('customClientName', '');
19649 }
19650  
19651 # The data stored in this IV is saved in the 'config' file
19652 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customClientName');
19653  
19654 return 1;
19655 }
19656  
19657 sub set_customClientVersion {
19658  
19659 my ($self, $version, $check) = @_;
19660  
19661 # Check for improper arguments
19662 if (defined $check) {
19663  
19664 return $axmud::CLIENT->writeImproper(
19665 $self->_objClass . '->set_customClientVersion',
19666 @_,
19667 );
19668 }
19669  
19670 if ($version) {
19671 $self->ivPoke('customClientVersion', $version);
19672 } else {
19673 $self->ivPoke('customClientVersion', '');
19674 }
19675  
19676 # The data stored in this IV is saved in the 'config' file
19677 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customClientVersion');
19678  
19679 return 1;
19680 }
19681  
19682 sub set_customInsertCmdColour {
19683  
19684 my ($self, $value, $check) = @_;
19685  
19686 # Check for improper arguments
19687 if (! defined $value || defined $check) {
19688  
19689 return $axmud::CLIENT->writeImproper(
19690 $self->_objClass . '->set_customInsertCmdColour',
19691 @_,
19692 );
19693 }
19694  
19695 $self->ivPoke('customInsertCmdColour', $value);
19696  
19697 # The data stored in this IV is saved in the 'config' file
19698 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customInsertCmdColour');
19699  
19700 return 1;
19701 }
19702  
19703 sub set_convertInvisibleFlag {
19704  
19705 my ($self, $flag, $check) = @_;
19706  
19707 # Check for improper arguments
19708 if (! defined $flag || defined $check) {
19709  
19710 return $axmud::CLIENT->writeImproper(
19711 $self->_objClass . '->set_convertInvisibleFlag',
19712 @_,
19713 );
19714 }
19715  
19716 if ($flag) {
19717 $self->ivPoke('convertInvisibleFlag', TRUE);
19718 } else {
19719 $self->ivPoke('convertInvisibleFlag', FALSE);
19720 }
19721  
19722 # The data stored in this IV is saved in the 'config' file
19723 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_convertInvisibleFlag');
19724  
19725 return 1;
19726 }
19727  
19728 sub set_customCmdBufferSize {
19729  
19730 my ($self, $size, $check) = @_;
19731  
19732 # Check for improper arguments
19733 if (! defined $size || defined $check) {
19734  
19735 return $axmud::CLIENT->writeImproper(
19736 $self->_objClass . '->set_customCmdBufferSize',
19737 @_,
19738 );
19739 }
19740  
19741 $self->ivPoke('customCmdBufferSize', $size);
19742  
19743 # The data stored in this IV is saved in the 'config' file
19744 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customCmdBufferSize');
19745  
19746 return 1;
19747 }
19748  
19749 sub set_customConfigWinIndexWidth {
19750  
19751 my ($self, $width, $check) = @_;
19752  
19753 # Check for improper arguments
19754 if (! defined $width || defined $check) {
19755  
19756 return $axmud::CLIENT->writeImproper(
19757 $self->_objClass . '->set_customConfigWinIndexWidth',
19758 @_,
19759 );
19760 }
19761  
19762 # Update IVs
19763 $self->ivPoke('customConfigWinIndexWidth', $width);
19764  
19765 return 1;
19766 }
19767  
19768 sub set_customControlsSize {
19769  
19770 my ($self, $type, $value, $check) = @_;
19771  
19772 # Check for improper arguments
19773 if (
19774 ! defined $type
19775 || ($type ne 'left' && $type ne 'right' && $type ne 'top' && $type ne 'bottom')
19776 || defined $check
19777 ) {
19778 return $axmud::CLIENT->writeImproper(
19779 $self->_objClass . '->set_customControlsSize',
19780 @_,
19781 );
19782 }
19783  
19784 # $value can be 'undef'
19785 $self->ivPoke('customControls' . ucfirst($type) . 'Size', $value);
19786  
19787 # The data stored in this IV is saved in the 'config' file
19788 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customControlsSize');
19789  
19790 return 1;
19791 }
19792  
19793 sub set_customDayList {
19794  
19795 my ($self, @list) = @_;
19796  
19797 # Check for improper arguments
19798 if (! @list || (scalar @list) < 7) {
19799  
19800 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_customDayList', @_);
19801 }
19802  
19803 $self->ivPoke('customDayList', @list);
19804  
19805 # The data stored in these IVs are saved in the 'config' file
19806 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customDayList');
19807  
19808 return 1;
19809 }
19810  
19811 sub reset_customDayList {
19812  
19813 my ($self, $check) = @_;
19814  
19815 # Check for improper arguments
19816 if (defined $check) {
19817  
19818 return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_customDayList', @_);
19819 }
19820  
19821 $self->ivPoke('customDayList', $self->constDayList);
19822  
19823 # The data stored in these IVs are saved in the 'config' file
19824 $self->setModifyFlag('config', TRUE, $self->_objClass . '->reset_customDayList');
19825  
19826 return 1;
19827 }
19828  
19829 sub set_customDisplayBufferSize {
19830  
19831 my ($self, $size, $check) = @_;
19832  
19833 # Check for improper arguments
19834 if (! defined $size || defined $check) {
19835  
19836 return $axmud::CLIENT->writeImproper(
19837 $self->_objClass . '->set_customDisplayBufferSize',
19838 @_,
19839 );
19840 }
19841  
19842 $self->ivPoke('customDisplayBufferSize', $size);
19843  
19844 # The data stored in this IV is saved in the 'config' file
19845 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customDisplayBufferSize');
19846  
19847 return 1;
19848 }
19849  
19850 sub set_customFreeWinSize {
19851  
19852 my ($self, $width, $height, $check) = @_;
19853  
19854 # Check for improper arguments
19855 if (! defined $width || ! defined $height || defined $check) {
19856  
19857 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_customFreeWinSize', @_);
19858 }
19859  
19860 $self->ivPoke('customFreeWinWidth', $width);
19861 $self->ivPoke('customFreeWinHeight', $height);
19862  
19863 # The data stored in this IV is saved in the 'config' file
19864 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customFreeWinSize');
19865  
19866 return 1;
19867 }
19868  
19869 sub set_customGridWinSize {
19870  
19871 my ($self, $width, $height, $check) = @_;
19872  
19873 # Check for improper arguments
19874 if (! defined $width || ! defined $height || defined $check) {
19875  
19876 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_customGridWinSize', @_);
19877 }
19878  
19879 $self->ivPoke('customGridWinWidth', $width);
19880 $self->ivPoke('customGridWinHeight', $height);
19881  
19882 # The data stored in this IV is saved in the 'config' file
19883 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customGridWinSize');
19884  
19885 return 1;
19886 }
19887  
19888 sub set_customInstructBufferSize {
19889  
19890 my ($self, $size, $check) = @_;
19891  
19892 # Check for improper arguments
19893 if (! defined $size || defined $check) {
19894  
19895 return $axmud::CLIENT->writeImproper(
19896 $self->_objClass . '->set_customInstructBufferSize',
19897 @_,
19898 );
19899 }
19900  
19901 $self->ivPoke('customInstructBufferSize', $size);
19902  
19903 # The data stored in this IV is saved in the 'config' file
19904 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customInstructBufferSize');
19905  
19906 return 1;
19907 }
19908  
19909 sub set_customMainWinSize {
19910  
19911 my ($self, $width, $height, $check) = @_;
19912  
19913 # Check for improper arguments
19914 if (! defined $width || ! defined $height || defined $check) {
19915  
19916 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_customMainWinSize', @_);
19917 }
19918  
19919 $self->ivPoke('customMainWinWidth', $width);
19920 $self->ivPoke('customMainWinHeight', $height);
19921  
19922 # The data stored in this IV is saved in the 'config' file
19923 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customMainWinSize');
19924  
19925 return 1;
19926 }
19927  
19928 sub set_customMonthList {
19929  
19930 my ($self, @list) = @_;
19931  
19932 # Check for improper arguments
19933 if (! @list || (scalar @list) < 12) {
19934  
19935 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_customMonthList', @_);
19936 }
19937  
19938 $self->ivPoke('customMonthList', @list);
19939  
19940 # The data stored in these IVs are saved in the 'config' file
19941 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customMonthList');
19942  
19943 return 1;
19944 }
19945  
19946 sub reset_customMonthList {
19947  
19948 my ($self, $check) = @_;
19949  
19950 # Check for improper arguments
19951 if (defined $check) {
19952  
19953 return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_customMonthList', @_);
19954 }
19955  
19956 $self->ivPoke('customMonthList', $self->constMonthList);
19957  
19958 # The data stored in these IVs are saved in the 'config' file
19959 $self->setModifyFlag('config', TRUE, $self->_objClass . '->reset_customMonthList');
19960  
19961 return 1;
19962 }
19963  
19964 sub set_customPanelSize {
19965  
19966 my ($self, $type, $value, $check) = @_;
19967  
19968 # Check for improper arguments
19969 if (
19970 ! defined $type
19971 || ($type ne 'left' && $type ne 'right' && $type ne 'top' && $type ne 'bottom')
19972 || defined $check
19973 ) {
19974 return $axmud::CLIENT->writeImproper(
19975 $self->_objClass . '->set_customPanelSize',
19976 @_,
19977 );
19978 }
19979  
19980 # $value can be 'undef'
19981 $self->ivPoke('customPanel' . ucfirst($type) . 'Size', $value);
19982  
19983 # The data stored in this IV is saved in the 'config' file
19984 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customPanelSize');
19985  
19986 return 1;
19987 }
19988  
19989 sub set_customShowDebugColour {
19990  
19991 my ($self, $value, $check) = @_;
19992  
19993 # Check for improper arguments
19994 if (! defined $value || defined $check) {
19995  
19996 return $axmud::CLIENT->writeImproper(
19997 $self->_objClass . '->set_customShowDebugColour',
19998 @_,
19999 );
20000 }
20001  
20002 $self->ivPoke('customShowDebugColour', $value);
20003  
20004 # The data stored in this IV is saved in the 'config' file
20005 $self->setModifyFlag('config', TRUE, $self->_objClass . '->customShowDebugColour');
20006  
20007 return 1;
20008 }
20009  
20010 sub set_customShowErrorColour {
20011  
20012 my ($self, $value, $check) = @_;
20013  
20014 # Check for improper arguments
20015 if (! defined $value || defined $check) {
20016  
20017 return $axmud::CLIENT->writeImproper(
20018 $self->_objClass . '->set_customShowErrorColour',
20019 @_,
20020 );
20021 }
20022  
20023 $self->ivPoke('customShowErrorColour', $value);
20024  
20025 # The data stored in this IV is saved in the 'config' file
20026 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customShowErrorColour');
20027  
20028 return 1;
20029 }
20030  
20031 sub set_customShowImproperColour {
20032  
20033 my ($self, $value, $check) = @_;
20034  
20035 # Check for improper arguments
20036 if (! defined $value || defined $check) {
20037  
20038 return $axmud::CLIENT->writeImproper(
20039 $self->_objClass . '->set_customShowImproperColour',
20040 @_,
20041 );
20042 }
20043  
20044 $self->ivPoke('customShowImproperColour', $value);
20045  
20046 # The data stored in this IV is saved in the 'config' file
20047 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customShowImproperColour');
20048  
20049 return 1;
20050 }
20051  
20052 sub set_customShowSystemTextColour {
20053  
20054 my ($self, $value, $check) = @_;
20055  
20056 # Check for improper arguments
20057 if (! defined $value || defined $check) {
20058  
20059 return $axmud::CLIENT->writeImproper(
20060 $self->_objClass . '->set_customShowSystemTextColour',
20061 @_,
20062 );
20063 }
20064  
20065 $self->ivPoke('customShowSystemTextColour', $value);
20066  
20067 # The data stored in this IV is saved in the 'config' file
20068 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customShowSystemTextColour');
20069  
20070 return 1;
20071 }
20072  
20073 sub set_customShowWarningColour {
20074  
20075 my ($self, $value, $check) = @_;
20076  
20077 # Check for improper arguments
20078 if (! defined $value || defined $check) {
20079  
20080 return $axmud::CLIENT->writeImproper(
20081 $self->_objClass . '->set_customShowWarningColour',
20082 @_,
20083 );
20084 }
20085  
20086 $self->ivPoke('customShowWarningColour', $value);
20087  
20088 # The data stored in this IV is saved in the 'config' file
20089 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customShowWarningColour');
20090  
20091 return 1;
20092 }
20093  
20094 sub reset_customSoundHash {
20095  
20096 my ($self, $check) = @_;
20097  
20098 # Local variables
20099 my %soundHash;
20100  
20101 # Check for improper arguments
20102 if (defined $check) {
20103  
20104 return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_customSoundHash', @_);
20105 }
20106  
20107 foreach my $effect ($self->ivKeys('constExtendedSoundHash')) {
20108  
20109 # Values in ->constExtendedSoundHash are file names; values in ->customSoundHash should
20110 # be full file paths
20111 $soundHash{$effect}
20112 = $axmud::DATA_DIR . '/sounds/' . $self->ivShow('constExtendedSoundHash', $effect);
20113 }
20114  
20115 $self->ivPoke('customSoundHash', %soundHash);
20116  
20117 # The data stored in this IV is saved in the 'config' file
20118 $self->setModifyFlag('config', TRUE, $self->_objClass . '->reset_customSoundHash');
20119  
20120 return 1;
20121 }
20122  
20123 sub add_customTask {
20124  
20125 my ($self, $obj, $check) = @_;
20126  
20127 # Check for improper arguments
20128 if (! defined $obj || defined $check) {
20129  
20130 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_customTask', @_);
20131 }
20132  
20133 # Update IVs
20134 $self->ivAdd('customTaskHash', $obj->customName, $obj);
20135  
20136 # The data stored in this IV is saved in the 'tasks' file
20137 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->add_customTask');
20138  
20139 return 1;
20140 }
20141  
20142 sub del_customTask {
20143  
20144 my ($self, $obj, $check) = @_;
20145  
20146 # Check for improper arguments
20147 if (! defined $obj || defined $check) {
20148  
20149 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_customTask', @_);
20150 }
20151  
20152 # Update IVs
20153 $self->ivDelete('customTaskHash', $obj->customName);
20154  
20155 # The data stored in this IV is saved in the 'tasks' file
20156 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->del_customTask');
20157  
20158 return 1;
20159 }
20160  
20161 sub reset_customTaskHash {
20162  
20163 my ($self, $check) = @_;
20164  
20165 # Check for improper arguments
20166 if (defined $check) {
20167  
20168 return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_customTaskHash', @_);
20169 }
20170  
20171 $self->ivEmpty('customTaskHash');
20172  
20173 # The data stored in these IVs is saved in the 'tasks' file
20174 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->reset_customTaskHash');
20175  
20176 return 1;
20177 }
20178  
20179 sub set_customTextBufferSize {
20180  
20181 my ($self, $size, $check) = @_;
20182  
20183 # Check for improper arguments
20184 if (! defined $size || defined $check) {
20185  
20186 return $axmud::CLIENT->writeImproper(
20187 $self->_objClass . '->set_customTextBufferSize',
20188 @_,
20189 );
20190 }
20191  
20192 $self->ivPoke('customTextBufferSize', $size);
20193  
20194 # The data stored in this IV is saved in the 'config' file
20195 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_customTextBufferSize');
20196  
20197 return 1;
20198 }
20199  
20200 sub set_debugFlag {
20201  
20202 my ($self, $iv, $flag, $check) = @_;
20203  
20204 # Check for improper arguments
20205 if (
20206 ! defined $iv
20207 || (
20208 # Main debug flags
20209 $iv ne 'debugLineNumsFlag'
20210 && $iv ne 'debugLineTagsFlag'
20211 && $iv ne 'debugLocatorFlag'
20212 && $iv ne 'debugMaxLocatorFlag'
20213 && $iv ne 'debugExitFlag'
20214 && $iv ne 'debugMoveListFlag'
20215 && $iv ne 'debugParseObjFlag'
20216 && $iv ne 'debugCompareObjFlag'
20217 && $iv ne 'debugExplainPluginFlag'
20218 && $iv ne 'debugCheckIVFlag'
20219 && $iv ne 'debugTableFitFlag'
20220 && $iv ne 'debugTrapErrorFlag'
20221 # Telnet negotiation debug flags
20222 && $iv ne 'debugEscSequenceFlag'
20223 && $iv ne 'debugTelnetFlag'
20224 && $iv ne 'debugTelnetMiniFlag'
20225 && $iv ne 'debugTelnetLogFlag'
20226 && $iv ne 'debugMsdpFlag'
20227 && $iv ne 'debugMxpFlag'
20228 && $iv ne 'debugMxpCommentFlag'
20229 && $iv ne 'debugPuebloFlag'
20230 && $iv ne 'debugPuebloCommentFlag'
20231 && $iv ne 'debugZmpFlag'
20232 && $iv ne 'debugAtcpFlag'
20233 && $iv ne 'debugGmcpFlag'
20234 && $iv ne 'debugMcpFlag'
20235 )
20236 || ! defined $flag
20237 || defined $check
20238 ) {
20239 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_debugFlag', @_);
20240 }
20241  
20242 if ($flag) {
20243 $self->ivPoke($iv, TRUE);
20244 } else {
20245 $self->ivPoke($iv, FALSE);
20246 }
20247  
20248 # The data stored in this IV is saved in the 'config' file
20249 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_debugFlag');
20250  
20251 return 1;
20252 }
20253  
20254 sub toggle_debugFlag {
20255  
20256 my ($self, $iv, $check) = @_;
20257  
20258 # Check for improper arguments
20259 if (
20260 ! defined $iv
20261 || (
20262 # Main debug flags
20263 $iv ne 'debugLineNumsFlag'
20264 && $iv ne 'debugLineTagsFlag'
20265 && $iv ne 'debugLocatorFlag'
20266 && $iv ne 'debugMaxLocatorFlag'
20267 && $iv ne 'debugExitFlag'
20268 && $iv ne 'debugMoveListFlag'
20269 && $iv ne 'debugParseObjFlag'
20270 && $iv ne 'debugCompareObjFlag'
20271 && $iv ne 'debugExplainPluginFlag'
20272 && $iv ne 'debugCheckIVFlag'
20273 && $iv ne 'debugTableFitFlag'
20274 && $iv ne 'debugTrapErrorFlag'
20275 # Telnet negotiation debug flags
20276 && $iv ne 'debugEscSequenceFlag'
20277 && $iv ne 'debugTelnetFlag'
20278 && $iv ne 'debugTelnetMiniFlag'
20279 && $iv ne 'debugTelnetLogFlag'
20280 && $iv ne 'debugMsdpFlag'
20281 && $iv ne 'debugMxpFlag'
20282 && $iv ne 'debugMxpCommentFlag'
20283 && $iv ne 'debugPuebloFlag'
20284 && $iv ne 'debugPuebloCommentFlag'
20285 && $iv ne 'debugZmpFlag'
20286 && $iv ne 'debugAtcpFlag'
20287 && $iv ne 'debugGmcpFlag'
20288 && $iv ne 'debugMcpFlag'
20289 ) || defined $check
20290 ) {
20291 return $axmud::CLIENT->writeImproper($self->_objClass . '->toggle_debugFlag', @_);
20292 }
20293  
20294 # Special case - disabling ->debugLocatorFlag also disables ->debugMaxLocatorFlag
20295 if (
20296 $iv eq 'debugLocatorFlag'
20297 && $self->debugLocatorFlag
20298 ) {
20299 $self->ivPoke($iv, FALSE);
20300 $self->ivPoke('debugMaxLocatorFlag', FALSE);
20301  
20302 } else {
20303  
20304 if (! $self->$iv) {
20305 $self->ivPoke($iv, TRUE);
20306 } else {
20307 $self->ivPoke($iv, FALSE);
20308 }
20309 }
20310  
20311 # The data stored in this IV is saved in the 'config' file
20312 $self->setModifyFlag('config', TRUE, $self->_objClass . '->toggle_debugFlag');
20313  
20314 return 1;
20315 }
20316  
20317 sub set_defaultDisabledWinmap {
20318  
20319 my ($self, $name, $check) = @_;
20320  
20321 # Check for improper arguments
20322 if (! defined $name || defined $check) {
20323  
20324 return $axmud::CLIENT->writeImproper(
20325 $self->_objClass . '->set_defaultDisabledWinmap',
20326 @_,
20327 );
20328 }
20329  
20330 $self->ivPoke('defaultDisabledWinmap', $name);
20331  
20332 # The data stored in this IV is saved in the 'winmaps' file
20333 $self->setModifyFlag('winmaps', TRUE, $self->_objClass . '->set_defaultDisabledWinmap');
20334  
20335 return 1;
20336 }
20337  
20338 sub set_defaultEnabledWinmap {
20339  
20340 my ($self, $name, $check) = @_;
20341  
20342 # Check for improper arguments
20343 if (! defined $name || defined $check) {
20344  
20345 return $axmud::CLIENT->writeImproper(
20346 $self->_objClass . '->set_defaultEnabledWinmap',
20347 @_,
20348 );
20349 }
20350  
20351 $self->ivPoke('defaultEnabledWinmap', $name);
20352  
20353 # The data stored in this IV is saved in the 'winmaps' file
20354 $self->setModifyFlag('winmaps', TRUE, $self->_objClass . '->set_defaultEnabledWinmap');
20355  
20356 return 1;
20357 }
20358  
20359 sub set_defaultInternalWinmap {
20360  
20361 my ($self, $name, $check) = @_;
20362  
20363 # Check for improper arguments
20364 if (! defined $name || defined $check) {
20365  
20366 return $axmud::CLIENT->writeImproper(
20367 $self->_objClass . '->set_defaultInternalWinmap',
20368 @_,
20369 );
20370 }
20371  
20372 $self->ivPoke('defaultInternalWinmap', $name);
20373  
20374 # The data stored in this IV is saved in the 'winmaps' file
20375 $self->setModifyFlag('winmaps', TRUE, $self->_objClass . '->set_defaultInternalWinmap');
20376  
20377 return 1;
20378 }
20379  
20380 sub add_dict {
20381  
20382 my ($self, $obj, $check) = @_;
20383  
20384 # Check for improper arguments
20385 if (! defined $obj || defined $check) {
20386  
20387 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_dict', @_);
20388 }
20389  
20390 $self->ivAdd('dictHash', $obj->name, $obj);
20391  
20392 # The data stored in this IV is saved in the 'dicts' file
20393 $self->setModifyFlag('dicts', TRUE, $self->_objClass . '->add_dict');
20394  
20395 return 1;
20396 }
20397  
20398 sub del_dict {
20399  
20400 my ($self, $obj, $check) = @_;
20401  
20402 # Check for improper arguments
20403 if (! defined $obj || defined $check) {
20404  
20405 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_dict', @_);
20406 }
20407  
20408 $self->ivDelete('dictHash', $obj->name);
20409  
20410 # The data stored in this IV is saved in the 'dicts' file
20411 $self->setModifyFlag('dicts', TRUE, $self->_objClass . '->del_dict');
20412  
20413 return 1;
20414 }
20415  
20416 sub set_dictHash {
20417  
20418 my ($self, %hash) = @_;
20419  
20420 # (No improper arguments to check - %hash can be empty)
20421  
20422 $self->ivPoke('dictHash', %hash);
20423  
20424 # The data stored in this IV is saved in the 'dicts' file
20425 $self->setModifyFlag('dicts', TRUE, $self->_objClass . '->set_dictHash');
20426  
20427 return 1;
20428 }
20429  
20430 sub set_emailCmd {
20431  
20432 my ($self, $cmd, $check) = @_;
20433  
20434 # Check for improper arguments
20435 if (! defined $cmd || defined $check) {
20436  
20437 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_emailCmd', @_);
20438 }
20439  
20440 $self->ivPoke('emailCmd', $cmd);
20441  
20442 # The data stored in this IV is saved in the 'config' file
20443 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_emailCmd');
20444  
20445 return 1;
20446 }
20447  
20448 sub set_favouriteWorldList {
20449  
20450 my ($self, @args) = @_;
20451  
20452 # (No improper arguments to check; @args can be an empty list)
20453  
20454 $self->ivPoke('favouriteWorldList', @args);
20455  
20456 # The data stored in this IV is saved in the 'config' file
20457 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_favouriteWorldList');
20458  
20459 return 1;
20460 }
20461  
20462 sub set_fileFailFlag {
20463  
20464 my ($self, $flag, $check) = @_;
20465  
20466 # Check for improper arguments
20467 if (! defined $flag || defined $check) {
20468  
20469 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_fileFailFlag', @_);
20470 }
20471  
20472 if ($flag) {
20473 $self->ivPoke('fileFailFlag', TRUE);
20474 } else {
20475 $self->ivPoke('fileFailFlag', FALSE);
20476 }
20477  
20478 return 1;
20479 }
20480  
20481 sub add_fileObj {
20482  
20483 my ($self, $obj, $check) = @_;
20484  
20485 # Check for improper arguments
20486 if (! defined $obj || defined $check) {
20487  
20488 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_fileObj', @_);
20489 }
20490  
20491 $self->ivAdd('fileObjHash', $obj->name, $obj);
20492  
20493 return 1;
20494 }
20495  
20496 sub del_fileObj {
20497  
20498 my ($self, $obj, $check) = @_;
20499  
20500 # Check for improper arguments
20501 if (! defined $obj || defined $check) {
20502  
20503 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_fileObj', @_);
20504 }
20505  
20506 $self->ivDelete('fileObjHash', $obj->name);
20507  
20508 return 1;
20509 }
20510  
20511 sub set_ttsForceHijackFlag {
20512  
20513 my ($self, $flag, $check) = @_;
20514  
20515 # Check for improper arguments
20516 if (! defined $flag || defined $check) {
20517  
20518 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_ttsForceHijackFlag', @_);
20519 }
20520  
20521 if ($flag) {
20522 $self->ivPoke('ttsForceHijackFlag', TRUE);
20523 } else {
20524 $self->ivPoke('ttsForceHijackFlag', FALSE);
20525 }
20526  
20527 # The data stored in this IV is saved in the 'config' file
20528 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_ttsForceHijackFlag');
20529  
20530 return 1;
20531 }
20532  
20533 sub set_gridAdjustmentFlag {
20534  
20535 my ($self, $flag, $check) = @_;
20536  
20537 # Check for improper arguments
20538 if (! defined $flag || defined $check) {
20539  
20540 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_gridAdjustmentFlag', @_);
20541 }
20542  
20543 if ($flag) {
20544 $self->ivPoke('gridAdjustmentFlag', TRUE);
20545 } else {
20546 $self->ivPoke('gridAdjustmentFlag', FALSE);
20547 }
20548  
20549 # The data stored in this IV is saved in the 'config' file
20550 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_gridAdjustmentFlag');
20551  
20552 return 1;
20553 }
20554  
20555 sub set_gridBlockSize {
20556  
20557 my ($self, $size, $check) = @_;
20558  
20559 # Check for improper arguments
20560 if (! defined $size || defined $check) {
20561  
20562 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_gridBlockSize', @_);
20563 }
20564  
20565 $self->ivPoke('gridBlockSize', $size);
20566  
20567 # The data stored in this IV is saved in the 'config' file
20568 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_gridBlockSize');
20569  
20570 return 1;
20571 }
20572  
20573 sub set_gridEdgeCorrectionFlag {
20574  
20575 my ($self, $flag, $check) = @_;
20576  
20577 # Check for improper arguments
20578 if (! defined $flag || defined $check) {
20579  
20580 return $axmud::CLIENT->writeImproper(
20581 $self->_objClass . '->set_gridEdgeCorrectionFlag',
20582 @_,
20583 );
20584 }
20585  
20586 if ($flag) {
20587 $self->ivPoke('gridEdgeCorrectionFlag', TRUE);
20588 } else {
20589 $self->ivPoke('gridEdgeCorrectionFlag', FALSE);
20590 }
20591  
20592 # The data stored in this IV is saved in the 'config' file
20593 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_gridEdgeCorrectionFlag');
20594  
20595 return 1;
20596 }
20597  
20598 sub set_gridGapMaxSize {
20599  
20600 my ($self, $size, $check) = @_;
20601  
20602 # Check for improper arguments
20603 if (! defined $size || defined $check) {
20604  
20605 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_gridGapMaxSize', @_);
20606 }
20607  
20608 $self->ivPoke('gridGapMaxSize', $size);
20609  
20610 # The data stored in this IV is saved in the 'config' file
20611 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_gridGapMaxSize');
20612  
20613 return 1;
20614 }
20615  
20616 sub set_gridInvisWinFlag {
20617  
20618 my ($self, $flag, $check) = @_;
20619  
20620 # Check for improper arguments
20621 if (! defined $flag || defined $check) {
20622  
20623 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_gridInvisWinFlag', @_);
20624 }
20625  
20626 if ($flag) {
20627 $self->ivPoke('gridInvisWinFlag', TRUE);
20628 } else {
20629 $self->ivPoke('gridInvisWinFlag', FALSE);
20630 }
20631  
20632 # The data stored in this IV is saved in the 'config' file
20633 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_gridInvisWinFlag');
20634  
20635 return 1;
20636 }
20637  
20638 sub set_gridReshuffleFlag {
20639  
20640 my ($self, $flag, $check) = @_;
20641  
20642 # Check for improper arguments
20643 if (! defined $flag || defined $check) {
20644  
20645 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_gridReshuffleFlag', @_);
20646 }
20647  
20648 if ($flag) {
20649 $self->ivPoke('gridReshuffleFlag', TRUE);
20650 } else {
20651 $self->ivPoke('gridReshuffleFlag', FALSE);
20652 }
20653  
20654 # The data stored in this IV is saved in the 'config' file
20655 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_gridReshuffleFlag');
20656  
20657 return 1;
20658 }
20659  
20660 sub add_initPlugin {
20661  
20662 my ($self, $pluginPath, $check) = @_;
20663  
20664 # Check for improper arguments
20665 if (! defined $pluginPath || defined $check) {
20666  
20667 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_initPlugin', @_);
20668 }
20669  
20670 $self->ivPush('initPluginList', $pluginPath);
20671  
20672 # The data stored in this IV is saved in the 'config' file
20673 $self->setModifyFlag('config', TRUE, $self->_objClass . '->add_initPlugin');
20674  
20675 return 1;
20676 }
20677  
20678 sub del_initPlugin {
20679  
20680 my ($self, $index, $check) = @_;
20681  
20682 # Check for improper arguments
20683 if (! defined $index || defined $check) {
20684  
20685 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_initPlugin', @_);
20686 }
20687  
20688 if ($self->initPluginList && $index < (scalar $self->initPluginList)) {
20689  
20690 $self->ivSplice('initPluginList', $index, 1);
20691 }
20692  
20693 # The data stored in this IV is saved in the 'config' file
20694 $self->setModifyFlag('config', TRUE, $self->_objClass . '->del_initPlugin');
20695  
20696 return 1;
20697 }
20698  
20699 sub add_initScript {
20700  
20701 my ($self, $scriptName, $mode, $check) = @_;
20702  
20703 # Check for improper arguments
20704 if (
20705 ! defined $scriptName
20706 || ! defined $mode
20707 || ($mode ne 'no_task' && $mode ne 'run_task' && $mode ne 'run_task_win')
20708 || defined $check
20709 ) {
20710 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_initScript', @_);
20711 }
20712  
20713 # See if the script already exists in the initial scriptlist
20714 if (! defined $self->ivFind('initScriptOrderList', $scriptName)) {
20715  
20716 # Not there, so add it
20717 $self->ivPush('initScriptOrderList', $scriptName);
20718 }
20719  
20720 # In either case, update the hash (replacing any previous entry)
20721 $self->ivAdd('initScriptHash', $scriptName, $mode);
20722  
20723 # The data stored in this IV is saved in the 'scripts' file
20724 $self->setModifyFlag('scripts', TRUE, $self->_objClass . '->add_initScript');
20725  
20726 return 1;
20727 }
20728  
20729 sub del_initScript {
20730  
20731 my ($self, $scriptName, $check) = @_;
20732  
20733 # Local variables
20734 my $index;
20735  
20736 # Check for improper arguments
20737 if (! defined $scriptName || defined $check) {
20738  
20739 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_initScript', @_);
20740 }
20741  
20742 # Update IVs
20743 $self->ivDelete('initScriptHash', $scriptName);
20744 $index = $self->ivFind('initScriptOrderList', $scriptName);
20745 if (defined $index) {
20746  
20747 $self->ivSplice('initScriptOrderList', $index, 1);
20748 }
20749  
20750 # The data stored in this IV is saved in the 'scripts' file
20751 $self->setModifyFlag('scripts', TRUE, $self->_objClass . '->del_initScript');
20752  
20753 return 1;
20754 }
20755  
20756 sub set_initScriptOrderList {
20757  
20758 my ($self, @args) = @_;
20759  
20760 # (No improper arguments to check; @args can be an empty list)
20761  
20762 $self->ivPoke('initScriptOrderList', @args);
20763  
20764 # The data stored in this IV is saved in the 'scripts' file
20765 $self->setModifyFlag('scripts', TRUE, $self->_objClass . '->set_initScriptOrderList');
20766  
20767 return 1;
20768 }
20769  
20770 sub add_initTask {
20771  
20772 my ($self, $obj, $check) = @_;
20773  
20774 # Check for improper arguments
20775 if (! defined $obj || defined $check) {
20776  
20777 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_initTask', @_);
20778 }
20779  
20780 # Update IVs
20781 $self->ivAdd('initTaskHash', $obj->uniqueName, $obj);
20782 $self->ivPush('initTaskOrderList', $obj->uniqueName);
20783  
20784 # The data stored in these IVs is saved in the 'tasks' file
20785 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->add_initTask');
20786  
20787 return 1;
20788 }
20789  
20790 sub del_initTask {
20791  
20792 my ($self, $obj, $check) = @_;
20793  
20794 # Local variables
20795 my $index;
20796  
20797 # Check for improper arguments
20798 if (! defined $obj || defined $check) {
20799  
20800 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_initTask', @_);
20801 }
20802  
20803 # Update IVs
20804 $self->ivDelete('initTaskHash', $obj->uniqueName);
20805 $index = $self->ivFind('initTaskOrderList', $obj->uniqueName);
20806 if (defined $index) {
20807  
20808 $self->ivSplice('initTaskOrderList', $index, 1);
20809 }
20810  
20811 # The data stored in these IVs is saved in the 'tasks' file
20812 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->add_initTask');
20813  
20814 return 1;
20815 }
20816  
20817 sub reset_initTaskHash {
20818  
20819 my ($self, $check) = @_;
20820  
20821 # Check for improper arguments
20822 if (defined $check) {
20823  
20824 return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_initTaskHash', @_);
20825 }
20826  
20827 $self->ivEmpty('initTaskHash');
20828 $self->ivEmpty('initTaskOrderList');
20829 $self->ivPoke('initTaskTotal', 0);
20830  
20831 # The data stored in these IVs is saved in the 'tasks' file
20832 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->reset_initTaskHash');
20833  
20834 return 1;
20835 }
20836  
20837 sub set_initTaskOrderList {
20838  
20839 my ($self, @args) = @_;
20840  
20841 # (No improper arguments to check; @args can be an empty list)
20842  
20843 $self->ivPoke('initTaskOrderList', @args);
20844  
20845 # The data stored in this IV is saved in the 'tasks' file
20846 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->set_initTaskOrderList');
20847  
20848 return 1;
20849 }
20850  
20851 sub inc_initTaskTotal {
20852  
20853 my ($self, $check) = @_;
20854  
20855 # Check for improper arguments
20856 if (defined $check) {
20857  
20858 return $axmud::CLIENT->writeImproper($self->_objClass . '->inc_initTaskTotal', @_);
20859 }
20860  
20861 # The data stored in this IV is saved in the 'tasks' file
20862 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->inc_initTaskTotal');
20863  
20864 return $self->ivIncrement('initTaskTotal');
20865 }
20866  
20867 sub reset_initTaskTotal {
20868  
20869 my ($self, $check) = @_;
20870  
20871 # Check for improper arguments
20872 if (defined $check) {
20873  
20874 return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_initTaskTotal', @_);
20875 }
20876  
20877 $self->ivPoke('initTaskTotal', 0);
20878  
20879 # The data stored in this IV is saved in the 'tasks' file
20880 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->reset_initTaskTotal');
20881  
20882 return 1;
20883 }
20884  
20885 sub add_initWorkspace {
20886  
20887 my ($self, $number, $zonemap, $check) = @_;
20888  
20889 # Check for improper arguments
20890 if (! defined $number || defined $check) {
20891  
20892 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_initWorkspace', @_);
20893 }
20894  
20895 $self->ivAdd('initWorkspaceHash', $number, $zonemap);
20896  
20897 # The data stored in this IV is saved in the 'config' file
20898 $self->setModifyFlag('config', TRUE, $self->_objClass . '->add_initWorkspace');
20899  
20900 return 1;
20901 }
20902  
20903 sub del_initWorkspace {
20904  
20905 my ($self, $number, $check) = @_;
20906  
20907 # Local variables
20908 my (
20909 $count,
20910 %modHash,
20911 );
20912  
20913 # Check for improper arguments
20914 if (! defined $number || defined $check) {
20915  
20916 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_initWorkspace', @_);
20917 }
20918  
20919 # Default initial workspace can't be deleted under any circumstances
20920 if ($number eq '0') {
20921  
20922 return undef;
20923  
20924 } else {
20925  
20926 $self->ivDelete('initWorkspaceHash', $number);
20927  
20928 # Remaining initial workspaces must be renumbered
20929 $count = 0;
20930 foreach my $key ($self->ivKeys('initWorkspaceHash')) {
20931  
20932 $modHash{$count} = $self->ivShow('initWorkspaceHash', $key);
20933 $count++;
20934 }
20935  
20936 $self->ivPoke('initWorkspaceHash', %modHash);
20937  
20938 # The data stored in this IV is saved in the 'config' file
20939 $self->setModifyFlag('config', TRUE, $self->_objClass . '->add_initWorkspace');
20940  
20941 return 1;
20942 }
20943 }
20944  
20945 sub set_initWorkspaceDir {
20946  
20947 my ($self, $string, $check) = @_;
20948  
20949 # Check for improper arguments
20950 if (! defined $string || defined $check) {
20951  
20952 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_initWorkspaceDir', @_);
20953 }
20954  
20955 $self->ivPoke('initWorkspaceDir', $string);
20956  
20957 # The data stored in this IV is saved in the 'config' file
20958 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_initWorkspaceDir');
20959  
20960 return 1;
20961 }
20962  
20963 sub set_instructBufferPosn {
20964  
20965 my ($self, $posn, $check) = @_;
20966  
20967 # Check for improper arguments
20968 if (defined $check) {
20969  
20970 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_instructBufferPosn', @_);
20971 }
20972  
20973 # Update IVs
20974 $self->ivPoke('instructBufferPosn', $posn);
20975  
20976 return 1;
20977 }
20978  
20979 sub toggle_instructFlag {
20980  
20981 my ($self, $type, $check) = @_;
20982  
20983 # Local variables
20984 my $iv;
20985  
20986 # Check for improper arguments
20987 if (
20988 ! defined $type
20989 || (
20990 $type ne 'confirm' && $type ne 'convert' && $type ne 'world' && $type ne 'other'
20991 && $type ne 'max'
20992 )
20993 ) {
20994 return $axmud::CLIENT->writeImproper($self->_objClass . '->toggle_instructFlag', @_);
20995 }
20996  
20997 if ($type eq 'confirm') {
20998 $iv = 'confirmWorldCmdFlag';
20999 } elsif ($type eq 'convert') {
21000 $iv = 'convertWorldCmdFlag';
21001 } elsif ($type eq 'world') {
21002 $iv = 'preserveWorldCmdFlag';
21003 } elsif ($type eq 'other') {
21004 $iv = 'preserveOtherCmdFlag';
21005 } elsif ($type eq 'max') {
21006 $iv = 'maxMultiCmdFlag';
21007 }
21008 if ($self->$iv) {
21009 $self->ivPoke($iv, FALSE);
21010 } else {
21011 $self->ivPoke($iv, TRUE);
21012 }
21013  
21014 # The data stored in these IVs are saved in the 'config' file
21015 $self->setModifyFlag('config', TRUE, $self->_objClass . '->toggle_instructFlag');
21016  
21017 return 1;
21018 }
21019  
21020 sub add_interfaceClipboardList {
21021  
21022 my ($self, $interfaceObj, $check) = @_;
21023  
21024 # Check for improper arguments
21025 if (! defined $interfaceObj || defined $check) {
21026  
21027 return $axmud::CLIENT->writeImproper(
21028 $self->_objClass . '->add_interfaceClipboardList',
21029 @_,
21030 );
21031 }
21032  
21033 if (! $self->ivFind('interfaceClipboardList', $interfaceObj)) {
21034  
21035 $self->ivPush('interfaceClipboardList', $interfaceObj);
21036 }
21037  
21038 return 1;
21039 }
21040  
21041 sub reset_interfaceClipboardList {
21042  
21043 my ($self, $check) = @_;
21044  
21045 # Check for improper arguments
21046 if (defined $check) {
21047  
21048 return $axmud::CLIENT->writeImproper(
21049 $self->_objClass . '->reset_interfaceClipboardList',
21050 @_,
21051 );
21052 }
21053  
21054 $self->ivEmpty('interfaceClipboardList');
21055  
21056 return 1;
21057 }
21058  
21059 sub set_ipLookupList {
21060  
21061 my ($self, @args) = @_;
21062  
21063 # (No improper arguments to check; @args can be an empty list)
21064  
21065 $self->ivPoke('ipLookupList', @args);
21066  
21067 # The data stored in this IV is saved in the 'config' file
21068 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_ipLookupList');
21069  
21070 return 1;
21071 }
21072  
21073 sub set_irreversibleIconFlag {
21074  
21075 my ($self, $flag, $check) = @_;
21076  
21077 # Check for improper arguments
21078 if (! defined $flag || defined $check) {
21079  
21080 return $axmud::CLIENT->writeImproper(
21081 $self->_objClass . '->set_irreversibleIconFlag',
21082 @_,
21083 );
21084 }
21085  
21086 if ($flag) {
21087 $self->ivPoke('irreversibleIconFlag', TRUE);
21088 } else {
21089 $self->ivPoke('irreversibleIconFlag', FALSE);
21090 }
21091  
21092 # The data stored in this IV is saved in the 'config' file
21093 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_irreversibleIconFlag');
21094  
21095 return 1;
21096 }
21097  
21098 sub toggle_keysFlag {
21099  
21100 my ($self, $type, $check) = @_;
21101  
21102 # Local variables
21103 my $iv;
21104  
21105 # Check for improper arguments
21106 if (
21107 ! defined $type
21108 || (
21109 $type ne 'scroll' && $type ne 'smooth_scroll' && $type ne 'auto_split'
21110 && $type ne 'auto_complete' && $type ne 'switch_tab'
21111 )
21112 ) {
21113 return $axmud::CLIENT->writeImproper($self->_objClass . '->toggle_keysFlag', @_);
21114 }
21115  
21116 if ($type eq 'scroll') {
21117 $iv = 'useScrollKeysFlag';
21118 } elsif ($type eq 'smooth_scroll') {
21119 $iv = 'smoothScrollKeysFlag';
21120 } elsif ($type eq 'auto_split') {
21121 $iv = 'autoSplitKeysFlag';
21122 } elsif ($type eq 'auto_complete') {
21123 $iv = 'useCompleteKeysFlag';
21124 } elsif ($type eq 'switch_tab') {
21125 $iv = 'useSwitchKeysFlag';
21126 }
21127 if ($self->$iv) {
21128 $self->ivPoke($iv, FALSE);
21129 } else {
21130 $self->ivPoke($iv, TRUE);
21131 }
21132  
21133 # The data stored in these IVs are saved in the 'config' file
21134 $self->setModifyFlag('config', TRUE, $self->_objClass . '->toggle_keysFlag');
21135  
21136 return 1;
21137 }
21138  
21139 sub set_loadConfigFlag {
21140  
21141 my ($self, $flag, $check) = @_;
21142  
21143 # Check for improper arguments
21144 if (! defined $flag || defined $check) {
21145  
21146 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_loadConfigFlag', @_);
21147 }
21148  
21149 if ($flag) {
21150 $self->ivPoke('loadConfigFlag', TRUE);
21151 } else {
21152 $self->ivPoke('loadConfigFlag', FALSE);
21153 }
21154  
21155 # The data stored in this IV is saved in the 'config' file
21156 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_loadConfigFlag');
21157  
21158 return 1;
21159 }
21160  
21161 sub set_loadDataFlag {
21162  
21163 my ($self, $flag, $check) = @_;
21164  
21165 # Check for improper arguments
21166 if (! defined $flag || defined $check) {
21167  
21168 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_loadDataFlag', @_);
21169 }
21170  
21171 if ($flag) {
21172 $self->ivPoke('loadDataFlag', TRUE);
21173 } else {
21174 $self->ivPoke('loadDataFlag', FALSE);
21175 }
21176  
21177 # The data stored in this IV is saved in the 'config' file
21178 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_loadDataFlag');
21179  
21180 return 1;
21181 }
21182  
21183 sub toggle_logFlag {
21184  
21185 my ($self, $type, $check) = @_;
21186  
21187 # Local variables
21188 my $iv;
21189  
21190 # Check for improper arguments
21191 if (
21192 ! defined $type
21193 || (
21194 $type ne 'allow' && $type ne 'del_standard' && $type ne 'del_world'
21195 && $type ne 'new_client' && $type ne 'new_day' && $type ne 'prefix_date'
21196 && $type ne 'prefix_time' && $type ne 'image'
21197 )
21198 ) {
21199 return $axmud::CLIENT->writeImproper($self->_objClass . '->toggle_logFlag', @_);
21200 }
21201  
21202 if ($type eq 'allow') {
21203 $iv = 'allowLogsFlag';
21204 } elsif ($type eq 'del_standard') {
21205 $iv = 'deleteStandardLogsFlag';
21206 } elsif ($type eq 'del_world') {
21207 $iv = 'deleteWorldLogsFlag';
21208 } elsif ($type eq 'new_client') {
21209 $iv = 'logClientFlag';
21210 } elsif ($type eq 'new_day') {
21211 $iv = 'logDayFlag';
21212 } elsif ($type eq 'prefix_date') {
21213 $iv = 'logPrefixDateFlag';
21214 } elsif ($type eq 'prefix_time') {
21215 $iv = 'logPrefixTimeFlag';
21216 } elsif ($type eq 'image') {
21217 $iv = 'logImageFlag';
21218 }
21219  
21220 if ($self->$iv) {
21221 $self->ivPoke($iv, FALSE);
21222 } else {
21223 $self->ivPoke($iv, TRUE);
21224 }
21225  
21226 # The data stored in these IVs are saved in the 'config' file
21227 $self->setModifyFlag('config', TRUE, $self->_objClass . '->toggle_logFlag');
21228  
21229 return 1;
21230 }
21231  
21232 sub set_loginWarningTime {
21233  
21234 my ($self, $interval, $check) = @_;
21235  
21236 # Check for improper arguments
21237 if (! defined $interval || defined $check) {
21238  
21239 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_loginWarningTime', @_);
21240 }
21241  
21242 # Update IVs
21243 $self->ivPoke('loginWarningTime', $interval);
21244  
21245 # The data stored in this IV is saved in the 'config' file
21246 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_loginWarningTime');
21247  
21248 return 1;
21249 }
21250  
21251 sub set_logPreamble {
21252  
21253 my ($self, @list) = @_;
21254  
21255 # (No improper arguments to check)
21256  
21257 $self->ivPoke('logPreambleList', @list);
21258  
21259 # The data stored in this IV is saved in the 'config' file
21260 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_logPreamble');
21261  
21262 return 1;
21263 }
21264  
21265 sub set_logPref {
21266  
21267 my ($self, $logFile, $flag, $check) = @_;
21268  
21269 # Check for improper arguments
21270 if (! defined $logFile || ! defined $flag || defined $check) {
21271  
21272 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_logPref', @_);
21273 }
21274  
21275 if (! $self->ivExists('logPrefHash', $logFile)) {
21276  
21277 return undef;
21278  
21279 } else {
21280  
21281 if ($flag) {
21282 $self->ivAdd('logPrefHash', $logFile, TRUE);
21283 } else {
21284 $self->ivAdd('logPrefHash', $logFile, FALSE);
21285 }
21286  
21287 # The data stored in this IV is saved in the 'config' file
21288 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_logPref');
21289  
21290 return 1;
21291 }
21292 }
21293  
21294 sub set_loopSpinFlag {
21295  
21296 my ($self, $flag, $check) = @_;
21297  
21298 # Check for improper arguments
21299 if (! defined $flag || defined $check) {
21300  
21301 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_loopSpinFlag', @_);
21302 }
21303  
21304 if ($flag) {
21305 $self->ivPoke('clientLoopSpinFlag', TRUE);
21306 } else {
21307 $self->ivPoke('clientLoopSpinFlag', FALSE);
21308 }
21309  
21310 return 1;
21311 }
21312  
21313 sub set_mainWin {
21314  
21315 # Called by GA::Obj::Desktop->start and GA::Session->setMainWin
21316  
21317 my ($self, $winObj, $check) = @_;
21318  
21319 # Check for improper arguments
21320 if (! defined $winObj || defined $check) {
21321  
21322 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_mainWin', @_);
21323 }
21324  
21325 # Update IVs
21326 $self->ivPoke('mainWin', $winObj);
21327  
21328 return 1;
21329 }
21330  
21331 sub reset_mainWin {
21332  
21333 # Called by GA::Obj::Desktop->start and GA::Session->setMainWin
21334  
21335 my ($self, $check) = @_;
21336  
21337 # Check for improper arguments
21338 if (defined $check) {
21339  
21340 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_mainWin', @_);
21341 }
21342  
21343 # Update IVs
21344 $self->ivPoke('mainWin', undef);
21345  
21346 return 1;
21347 }
21348  
21349 sub set_mainWinSystemMsgFlag {
21350  
21351 my ($self, $flag, $check) = @_;
21352  
21353 # Check for improper arguments
21354 if (! defined $flag || defined $check) {
21355  
21356 return $axmud::CLIENT->writeImproper(
21357 $self->_objClass . '->set_mainWinSystemMsgFlag',
21358 @_,
21359 );
21360 }
21361  
21362 if ($flag) {
21363 $self->ivPoke('mainWinSystemMsgFlag', TRUE);
21364 } else {
21365 $self->ivPoke('mainWinSystemMsgFlag', FALSE);
21366 }
21367  
21368 # The data stored in this IV is saved in the 'config' file
21369 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_mainWinSystemMsgFlag');
21370  
21371 return 1;
21372 }
21373  
21374 sub set_mainWinTooltipFlag {
21375  
21376 my ($self, $flag, $check) = @_;
21377  
21378 # Check for improper arguments
21379 if (! defined $flag || defined $check) {
21380  
21381 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_mainWinTooltipFlag', @_);
21382 }
21383  
21384 if ($flag) {
21385 $self->ivPoke('mainWinTooltipFlag', TRUE);
21386 } else {
21387 $self->ivPoke('mainWinTooltipFlag', FALSE);
21388 }
21389  
21390 # The data stored in this IV is saved in the 'config' file
21391 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_mainWinTooltipFlag');
21392  
21393 return 1;
21394 }
21395  
21396 sub set_mainWinUrgencyFlag {
21397  
21398 my ($self, $flag, $check) = @_;
21399  
21400 # Check for improper arguments
21401 if (! defined $flag || defined $check) {
21402  
21403 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_mainWinUrgencyFlag', @_);
21404 }
21405  
21406 if ($flag) {
21407 $self->ivPoke('mainWinUrgencyFlag', TRUE);
21408 } else {
21409 $self->ivPoke('mainWinUrgencyFlag', FALSE);
21410 }
21411  
21412 # The data stored in this IV is saved in the 'config' file
21413 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_mainWinUrgencyFlag');
21414  
21415 return 1;
21416 }
21417  
21418 sub toggle_mnesFlag {
21419  
21420 # $flag is not specified when called by GA::Cmd::MNES->do, but is specified when called by
21421 # GA::PrefWin::Client
21422  
21423 my ($self, $type, $flag, $check) = @_;
21424  
21425 # Local variables
21426 my $iv;
21427  
21428 # Check for improper arguments
21429 if (! defined $type || ($type ne 'send_ip')) {
21430  
21431 return $axmud::CLIENT->writeImproper($self->_objClass . '->toggle_mnesFlag', @_);
21432 }
21433  
21434 # (At the moment, there is only one flag IV for MNES; nevertheless we'll keep the same
21435 # format used by other similar accessor functions)
21436 if ($type eq 'send_ip') {
21437  
21438 $iv = 'allowMnesSendIPFlag';
21439 }
21440  
21441 if (defined $flag) {
21442  
21443 if ($flag) {
21444 $self->ivPoke($iv, TRUE);
21445 } else {
21446 $self->ivPoke($iv, FALSE);
21447 }
21448  
21449 } elsif ($self->$iv) {
21450  
21451 $self->ivPoke($iv, FALSE);
21452  
21453 } else {
21454  
21455 $self->ivPoke($iv, TRUE);
21456 }
21457  
21458 # The data stored in these IVs are saved in the 'config' file
21459 $self->setModifyFlag('config', TRUE, $self->_objClass . '->toggle_mnesFlag');
21460  
21461 return 1;
21462 }
21463  
21464 sub set_modelSplitSize {
21465  
21466 my ($self, $size, $check) = @_;
21467  
21468 # Check for improper arguments
21469 if (! defined $size || defined $check) {
21470  
21471 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_modelSplitSize', @_);
21472 }
21473  
21474 # Update IVs
21475 $self->ivPoke('modelSplitSize', $size);
21476  
21477 # The data stored in this IV is saved in the 'config' file
21478 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_modelSplitSize');
21479  
21480 return 1;
21481 }
21482  
21483 sub toggle_mspFlag {
21484  
21485 # $flag is not specified when called by ;msp, but is specified when called by
21486 # GA::PrefWin::Client
21487  
21488 my ($self, $type, $flag, $check) = @_;
21489  
21490 # Local variables
21491 my $iv;
21492  
21493 # Check for improper arguments
21494 if (
21495 ! defined $type
21496 || ($type ne 'multiple' && $type ne 'load' && $type ne 'flexible')
21497 ) {
21498 return $axmud::CLIENT->writeImproper($self->_objClass . '->toggle_mspFlag', @_);
21499 }
21500  
21501 if ($type eq 'multiple') {
21502 $iv = 'allowMspMultipleFlag';
21503 } elsif ($type eq 'load') {
21504 $iv = 'allowMspLoadSoundFlag';
21505 } elsif ($type eq 'flexible') {
21506 $iv = 'allowMspFlexibleFlag';
21507 }
21508  
21509 if (defined $flag) {
21510  
21511 if ($flag) {
21512 $self->ivPoke($iv, TRUE);
21513 } else {
21514 $self->ivPoke($iv, FALSE);
21515 }
21516  
21517 } elsif ($self->$iv) {
21518  
21519 $self->ivPoke($iv, FALSE);
21520  
21521 } else {
21522  
21523 $self->ivPoke($iv, TRUE);
21524 }
21525  
21526 # The data stored in these IVs are saved in the 'config' file
21527 $self->setModifyFlag('config', TRUE, $self->_objClass . '->toggle_mspFlag');
21528  
21529 return 1;
21530 }
21531  
21532 sub set_mswinWinPosnTweakFlag {
21533  
21534 my ($self, $flag, $check) = @_;
21535  
21536 # Check for improper arguments
21537 if (! defined $flag || defined $check) {
21538  
21539 return $axmud::CLIENT->writeImproper(
21540 $self->_objClass . '->set_mswinWinPosnTweakFlag',
21541 @_,
21542 );
21543 }
21544  
21545 if ($flag) {
21546 $self->ivPoke('mswinWinPosnTweakFlag', TRUE);
21547 } else {
21548 $self->ivPoke('mswinWinPosnTweakFlag', FALSE);
21549 }
21550  
21551 # The data stored in these IVs are saved in the 'config' file
21552 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_mswinWinPosnTweakFlag');
21553  
21554 return 1;
21555 }
21556  
21557 sub toggle_mudProtocol {
21558  
21559 # $flag is not specified when called by ;setmudprotocol, but is specified when called by
21560 # GA::PrefWin::Client
21561  
21562 my ($self, $protocol, $flag, $check) = @_;
21563  
21564 # Local variables
21565 my $iv;
21566  
21567 # Check for improper arguments
21568 if (
21569 ! defined $protocol
21570 || (
21571 $protocol ne 'msdp' && $protocol ne 'mssp' && $protocol ne 'mccp'
21572 && $protocol ne 'msp' && $protocol ne 'mxp' && $protocol ne 'pueblo'
21573 && $protocol ne 'zmp' && $protocol ne 'aard102' && $protocol ne 'atcp'
21574 && $protocol ne 'gmcp' && $protocol ne 'mtts' && $protocol ne 'mnes'
21575 && $protocol ne 'mcp'
21576 )
21577 ) {
21578 return $axmud::CLIENT->writeImproper($self->_objClass . '->toggle_mudProtocol', @_);
21579 }
21580  
21581 if ($protocol eq 'msdp') {
21582 $iv = 'useMsdpFlag';
21583 } elsif ($protocol eq 'mssp') {
21584 $iv = 'useMsspFlag';
21585 } elsif ($protocol eq 'mccp') {
21586 $iv = 'useMccpFlag';
21587 } elsif ($protocol eq 'msp') {
21588 $iv = 'useMspFlag';
21589 } elsif ($protocol eq 'mxp') {
21590 $iv = 'useMxpFlag';
21591 } elsif ($protocol eq 'pueblo') {
21592 $iv = 'usePuebloFlag';
21593 } elsif ($protocol eq 'zmp') {
21594 $iv = 'useZmpFlag';
21595 } elsif ($protocol eq 'aard102') {
21596 $iv = 'useAard102Flag';
21597 } elsif ($protocol eq 'atcp') {
21598 $iv = 'useAtcpFlag';
21599 } elsif ($protocol eq 'gmcp') {
21600 $iv = 'useGmcpFlag';
21601 } elsif ($protocol eq 'mtts') {
21602 $iv = 'useMttsFlag';
21603 } elsif ($protocol eq 'mnes') {
21604 $iv = 'useMnesFlag';
21605 } elsif ($protocol eq 'mcp') {
21606 $iv = 'useMcpFlag';
21607 }
21608  
21609 if (defined $flag) {
21610  
21611 if ($flag) {
21612 $self->ivPoke($iv, TRUE);
21613 } else {
21614 $self->ivPoke($iv, FALSE);
21615 }
21616  
21617 } elsif ($self->$iv) {
21618  
21619 $self->ivPoke($iv, FALSE);
21620  
21621 } else {
21622  
21623 $self->ivPoke($iv, TRUE);
21624 }
21625  
21626 # If disabling an option, update every session (except for Pueblo and ZMP, which can't be
21627 # turned off mid-session)
21628 if (! $self->$iv && $iv ne 'pueblo' && $iv ne 'zmp') {
21629  
21630 foreach my $session ($self->listSessions()) {
21631  
21632 $session->disableMudProtocol($protocol);
21633 }
21634 }
21635  
21636 # The data stored in these IVs are saved in the 'config' file
21637 $self->setModifyFlag('config', TRUE, $self->_objClass . '->toggle_mudProtocol');
21638  
21639 return 1;
21640 }
21641  
21642 sub set_mxpPreventSupportFlag {
21643  
21644 my ($self, $flag, $check) = @_;
21645  
21646 # Check for improper arguments
21647 if (! defined $flag || defined $check) {
21648  
21649 return $axmud::CLIENT->writeImproper(
21650 $self->_objClass . '->set_mxpPreventSupportFlag',
21651 @_,
21652 );
21653 }
21654  
21655 if ($flag) {
21656 $self->ivPoke('mxpPreventSupportFlag', TRUE);
21657 } else {
21658 $self->ivPoke('mxpPreventSupportFlag', FALSE);
21659 }
21660  
21661 return 1;
21662 }
21663  
21664 sub set_oscPaletteFlag {
21665  
21666 my ($self, $flag, $check) = @_;
21667  
21668 # Check for improper arguments
21669 if (! defined $flag || defined $check) {
21670  
21671 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_oscPaletteFlag', @_);
21672 }
21673  
21674 if ($flag) {
21675 $self->ivPoke('oscPaletteFlag', TRUE);
21676 } else {
21677 $self->ivPoke('oscPaletteFlag', FALSE);
21678 }
21679  
21680 # The data stored in this IV is saved in the 'config' file
21681 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_oscPaletteFlag');
21682  
21683 return 1;
21684 }
21685  
21686 sub set_promptWaitTime {
21687  
21688 my ($self, $interval, $check) = @_;
21689  
21690 # Check for improper arguments
21691 if (! defined $interval || defined $check) {
21692  
21693 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_promptWaitTime', @_);
21694 }
21695  
21696 # Update IVs
21697 $self->ivPoke('promptWaitTime', $interval);
21698  
21699 # The data stored in this IV is saved in the 'config' file
21700 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_promptWaitTime');
21701  
21702 return 1;
21703 }
21704  
21705 sub set_resetKeycodesFlag {
21706  
21707 my ($self, $flag, $check) = @_;
21708  
21709 # Check for improper arguments
21710 if (! defined $flag || defined $check) {
21711  
21712 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_resetKeycodesFlag', @_);
21713 }
21714  
21715 if ($flag) {
21716 $self->ivPoke('resetKeycodesFlag', TRUE);
21717 } else {
21718 $self->ivPoke('resetKeycodesFlag', FALSE);
21719 }
21720  
21721 return 1;
21722 }
21723  
21724 sub set_restartShareMainWinMode {
21725  
21726 my ($self, $flag, $check) = @_;
21727  
21728 # Check for improper arguments
21729 if (! defined $flag || defined $check) {
21730  
21731 return $axmud::CLIENT->writeImproper(
21732 $self->_objClass . '->set_restartShareMainWinMode',
21733 @_,
21734 );
21735 }
21736  
21737 if ($flag) {
21738 $self->ivPoke('restartShareMainWinMode', 'on');
21739 } else {
21740 $self->ivPoke('restartShareMainWinMode', 'off');
21741 }
21742  
21743 # The data stored in this IV is saved in the 'config' file
21744 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_restartShareMainWinMode');
21745  
21746 return 1;
21747 }
21748  
21749 sub reset_runLists {
21750  
21751 my ($self, $check) = @_;
21752  
21753 # Check for improper arguments
21754 if (defined $check) {
21755  
21756 return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_runLists', @_);
21757 }
21758  
21759 $self->ivPoke('taskRunFirstList', $self->constTaskRunFirstList);
21760 $self->ivPoke('taskRunLastList', $self->constTaskRunLastList);
21761  
21762 # The data stored in these IVs is saved in the 'tasks' file
21763 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->reset_runLists');
21764  
21765 return 1;
21766 }
21767  
21768 sub set_saveConfigFlag {
21769  
21770 my ($self, $flag, $check) = @_;
21771  
21772 # Check for improper arguments
21773 if (! defined $flag || defined $check) {
21774  
21775 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_saveConfigFlag', @_);
21776 }
21777  
21778 if ($flag) {
21779 $self->ivPoke('saveConfigFlag', TRUE);
21780 } else {
21781 $self->ivPoke('saveConfigFlag', FALSE);
21782 }
21783  
21784 # The data stored in this IV is saved in the 'config' file
21785 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_saveConfigFlag');
21786  
21787 return 1;
21788 }
21789  
21790 sub set_saveDataFlag {
21791  
21792 my ($self, $flag, $check) = @_;
21793  
21794 # Check for improper arguments
21795 if (! defined $flag || defined $check) {
21796  
21797 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_saveDataFlag', @_);
21798 }
21799  
21800 if ($flag) {
21801 $self->ivPoke('saveDataFlag', TRUE);
21802 } else {
21803 $self->ivPoke('saveDataFlag', FALSE);
21804 }
21805  
21806 # The data stored in this IV is saved in the 'config' file
21807 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_saveDataFlag');
21808  
21809 return 1;
21810 }
21811  
21812 sub add_scriptDir {
21813  
21814 my ($self, $dir, $check) = @_;
21815  
21816 # Check for improper arguments
21817 if (! defined $dir || defined $check) {
21818  
21819 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_scriptDir', @_);
21820 }
21821  
21822 $self->ivPush('scriptDirList', $dir);
21823  
21824 # The data stored in this IV is saved in the 'scripts' file
21825 $self->setModifyFlag('scripts', TRUE, $self->_objClass . '->add_scriptDir');
21826  
21827 return 1;
21828 }
21829  
21830 sub del_scriptDir {
21831  
21832 my ($self, $index, $check) = @_;
21833  
21834 # Check for improper arguments
21835 if (! defined $index || defined $check) {
21836  
21837 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_soundEffect', @_);
21838 }
21839  
21840 $self->ivSplice('scriptDirList', $index, 1);
21841  
21842 # The data stored in this IV is saved in the 'scripts' file
21843 $self->setModifyFlag('scripts', TRUE, $self->_objClass . '->del_soundEffect');
21844  
21845 return 1;
21846 }
21847  
21848 sub inc_sessionCount {
21849  
21850 my ($self, $check) = @_;
21851  
21852 # Check for improper arguments
21853 if (defined $check) {
21854  
21855 return $axmud::CLIENT->writeImproper($self->_objClass . '->inc_sessionCount', @_);
21856 }
21857  
21858 return $self->ivIncrement('sessionCount');
21859 }
21860  
21861 sub set_sessionMax {
21862  
21863 my ($self, $num, $check) = @_;
21864  
21865 # Check for improper arguments
21866 if (
21867 ! defined $num
21868 || $num > $self->constSessionMax
21869 || defined $check
21870 ) {
21871 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_sessionMax', @_);
21872 }
21873  
21874 $self->ivPoke('sessionMax', $num);
21875  
21876 # The data stored in this IV is saved in the 'config' file
21877 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_sessionMax');
21878  
21879 return 1;
21880 }
21881  
21882 sub toggle_sessionFlag {
21883  
21884 my ($self, $type, $check) = @_;
21885  
21886 # Local variables
21887 my $iv;
21888  
21889 # Check for improper arguments
21890 if (
21891 ! defined $type
21892 || (
21893 $type ne 'xterm' && $type ne 'long' && $type ne 'simple' && $type ne 'close_main'
21894 && $type ne 'close_tab' && $type ne 'close_menu' && $type ne 'close_toolbutton'
21895 && $type ne 'switch_offline'
21896 )
21897 ) {
21898 return $axmud::CLIENT->writeImproper($self->_objClass . '->toggle_sessionFlag', @_);
21899 }
21900  
21901 if ($type eq 'xterm') {
21902 $iv = 'xTermTitleFlag';
21903 } elsif ($type eq 'long') {
21904 $iv = 'longTabLabelFlag';
21905 } elsif ($type eq 'simple') {
21906 $iv = 'simpleTabFlag';
21907 } elsif ($type eq 'close_main') {
21908 $iv = 'confirmCloseMainWinFlag';
21909 } elsif ($type eq 'close_tab') {
21910 $iv = 'confirmCloseTabFlag';
21911 } elsif ($type eq 'switch_offline') {
21912 $iv = 'offlineOnDisconnectFlag';
21913 } elsif ($type eq 'close_menu') {
21914 $iv = 'confirmCloseToolButtonFlag';
21915 } elsif ($type eq 'close_toolbutton') {
21916 $iv = 'confirmCloseMenuFlag';
21917 }
21918  
21919 if ($self->$iv) {
21920 $self->ivPoke($iv, FALSE);
21921 } else {
21922 $self->ivPoke($iv, TRUE);
21923 }
21924  
21925 # Redraw the tab title in every session
21926 if ($type ne 'switch_offline') {
21927  
21928 foreach my $session ($self->listSessions()) {
21929  
21930 # The TRUE argument means 'definitely update'
21931 $session->checkTabLabels(TRUE);
21932 }
21933 }
21934  
21935 # The data stored in these IVs are saved in the 'config' file
21936 $self->setModifyFlag('config', TRUE, $self->_objClass . '->toggle_sessionFlag');
21937  
21938 return 1;
21939 }
21940  
21941 sub set_sessionTabMode {
21942  
21943 my ($self, $mode, $check) = @_;
21944  
21945 # Check for improper arguments
21946 if (
21947 defined $check
21948 || ($mode ne 'bracket' && $mode ne 'hyphen' && $mode ne 'world' && $mode ne 'char')
21949 ) {
21950 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_sessionTabMode', @_);
21951 }
21952  
21953 # Update IVs
21954 $self->ivPoke('sessionTabMode', $mode);
21955  
21956 # Redraw the tab title in every session
21957 foreach my $session ($self->listSessions()) {
21958  
21959 # The TRUE argument means 'definitely update'
21960 $session->checkTabLabels(TRUE);
21961 }
21962  
21963 # The data stored in this IV is saved in the 'config' file
21964 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_sessionTabMode');
21965  
21966 return 1;
21967 }
21968  
21969 sub set_shareMainWinFlag {
21970  
21971 # Should only be called by GA::WizWin::Setup->saveChanges. Everything else should call
21972 # $self->set_restartShareMainWinMode
21973  
21974 my ($self, $flag, $check) = @_;
21975  
21976 # Check for improper arguments
21977 if (! defined $flag || defined $check) {
21978  
21979 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_shareMainWinFlag', @_);
21980 }
21981  
21982 if ($flag) {
21983 $self->ivPoke('shareMainWinFlag', TRUE);
21984 } else {
21985 $self->ivPoke('shareMainWinFlag', FALSE);
21986 }
21987  
21988 # The data stored in this IV is saved in the 'config' file
21989 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_shareMainWinFlag');
21990  
21991 return 1;
21992 }
21993  
21994 sub set_shortUrlFlag {
21995  
21996 my ($self, $flag, $check) = @_;
21997  
21998 # Check for improper arguments
21999 if (! defined $flag || defined $check) {
22000  
22001 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_shortUrlFlag', @_);
22002 }
22003  
22004 if ($flag) {
22005 $self->ivPoke('shortUrlFlag', TRUE);
22006 } else {
22007 $self->ivPoke('shortUrlFlag', FALSE);
22008 }
22009  
22010 # The data stored in this IV is saved in the 'config' file
22011 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_shortUrlFlag');
22012  
22013 return 1;
22014 }
22015  
22016 sub set_showSetupWizWinFlag {
22017  
22018 my ($self, $flag, $check) = @_;
22019  
22020 # Check for improper arguments
22021 if (! defined $flag || defined $check) {
22022  
22023 return $axmud::CLIENT->writeImproper(
22024 $self->_objClass . '->set_showSetupWizWinFlag',
22025 @_,
22026 );
22027 }
22028  
22029 if ($flag) {
22030 $self->ivPoke('showSetupWizWinFlag', TRUE);
22031 } else {
22032 $self->ivPoke('showSetupWizWinFlag', FALSE);
22033 }
22034  
22035 return 1;
22036 }
22037  
22038 sub toggle_sigilFlag {
22039  
22040 my ($self, $sigil, $check) = @_;
22041  
22042 # Local variables
22043 my $iv;
22044  
22045 # Check for improper arguments
22046 if (
22047 ! defined $sigil
22048 || (
22049 $sigil ne 'echo' && $sigil ne 'perl' && $sigil ne 'script' && $sigil ne 'multi'
22050 && $sigil ne 'speed' && $sigil ne 'bypass'
22051 )
22052 ) {
22053 return $axmud::CLIENT->writeImproper($self->_objClass . '->toggle_sigilFlag', @_);
22054 }
22055  
22056 $iv = $sigil . 'SigilFlag'; # e.g. ->echoSigilFlag
22057 if ($self->$iv) {
22058 $self->ivPoke($iv, FALSE);
22059 } else {
22060 $self->ivPoke($iv, TRUE);
22061 }
22062  
22063 # The data stored in these IVs are saved in the 'config' file
22064 $self->setModifyFlag('config', TRUE, $self->_objClass . '->toggle_sigilFlag');
22065  
22066 return 1;
22067 }
22068  
22069 sub add_soundEffect {
22070  
22071 my ($self, $sound, $path, $check) = @_;
22072  
22073 # Check for improper arguments
22074 if (! defined $sound || ! defined $path || defined $check) {
22075  
22076 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_soundEffect', @_);
22077 }
22078  
22079 $self->ivAdd('customSoundHash', $sound, $path);
22080  
22081 # The data stored in this IV is saved in the 'config' file
22082 $self->setModifyFlag('config', TRUE, $self->_objClass . '->add_soundEffect');
22083  
22084 return 1;
22085 }
22086  
22087 sub del_soundEffect {
22088  
22089 my ($self, $sound, $check) = @_;
22090  
22091 # Check for improper arguments
22092 if (! defined $sound || defined $check) {
22093  
22094 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_soundEffect', @_);
22095 }
22096  
22097 $self->ivDelete('customSoundHash', $sound);
22098  
22099 # The data stored in this IV is saved in the 'config' file
22100 $self->setModifyFlag('config', TRUE, $self->_objClass . '->del_soundEffect');
22101  
22102 return 1;
22103 }
22104  
22105 sub set_standardColourTag {
22106  
22107 my ($self, $tag, $rgb, $boldFlag, $check) = @_;
22108  
22109 # Check for improper arguments
22110 if (! defined $tag || ! defined $rgb || defined $check) {
22111  
22112 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_standardColourTag', @_);
22113 }
22114  
22115 # Update IVs
22116 if (! $boldFlag) {
22117 $self->ivAdd('colourTagHash', $tag, $rgb);
22118 } else {
22119 $self->ivAdd('boldColourTagHash', $tag, $rgb);
22120 }
22121  
22122 # The data stored in this IV is saved in the 'config' file
22123 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_standardColourTag');
22124  
22125 return 1;
22126 }
22127  
22128 sub add_standardZonemap {
22129  
22130 my ($self, $zonemap, $check) = @_;
22131  
22132 # Check for improper arguments
22133 if (! defined $zonemap || defined $check) {
22134  
22135 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_standardZonemap', @_);
22136 }
22137  
22138 # Update IVs
22139 $self->ivAdd('standardZonemapHash', $zonemap->name, $zonemap);
22140  
22141 # The data stored in this IV is saved in the 'zonemaps' file
22142 $self->setModifyFlag('zonemaps', TRUE, $self->_objClass . '->add_standardZonemap');
22143  
22144 return 1;
22145 }
22146  
22147 sub set_statusEvent {
22148  
22149 my ($self, $type, $number, $check) = @_;
22150  
22151 # Check for improper arguments
22152 if (
22153 ! defined $type || ($type ne 'before' && $type ne 'after') || ! defined $number
22154 || defined $check
22155 ) {
22156 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_statusEvent', @_);
22157 }
22158  
22159 if ($type eq 'before') {
22160 $self->ivPoke('statusEventBeforeCount', $number);
22161 } else {
22162 $self->ivPoke('statusEventAfterCount', $number);
22163 }
22164  
22165 # The data stored in this IV is saved in the 'config' file
22166 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_statusEvent');
22167  
22168 return 1;
22169 }
22170  
22171 sub set_storeGridPosnFlag {
22172  
22173 my ($self, $flag, $check) = @_;
22174  
22175 # Check for improper arguments
22176 if (! defined $flag || defined $check) {
22177  
22178 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_storeGridPosnFlag', @_);
22179 }
22180  
22181 if ($flag) {
22182 $self->ivPoke('storeGridPosnFlag', TRUE);
22183 } else {
22184 $self->ivPoke('storeGridPosnFlag', FALSE);
22185 }
22186  
22187 return 1;
22188 }
22189  
22190 sub add_storeGridPosn {
22191  
22192 # Called by GA::Win::Internal->setConfigureEvent and GA::Win::Map->setConfigureEvent
22193 # Also called by GA::Obj::Workspace->createGridWin and ->createSimpleGridWin
22194  
22195 my ($self, $winObj, $xPos, $yPos, $width, $height, $ignoreFlag, $check) = @_;
22196  
22197 # Check for improper arguments
22198 if (! defined $winObj || defined $check) {
22199  
22200 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_storeGridPosn', @_);
22201 }
22202  
22203 # Do nothing if the storage flag isn't set, if it's not a 'grid' window or if it's an
22204 # 'external' window
22205 # Allow storing of position but not size, or size but not position, but not both
22206 if (
22207 (! $self->storeGridPosnFlag && ! $ignoreFlag)
22208 || $winObj->winCategory ne 'grid'
22209 || $winObj->winType eq 'external'
22210 || (! defined $xPos && ! defined $yPos && ! defined $width && ! defined $height)
22211 ) {
22212 return undef;
22213 }
22214  
22215 # An entry is added/replaced in $self->storeGridPosnHash for any 'grid' window, but if there
22216 # are several windows with the same ->winName open, only the one which was opened first is
22217 # used
22218 foreach my $otherWinObj ($self->desktopObj->ivValues('gridWinHash')) {
22219  
22220 if (
22221 $otherWinObj ne $winObj
22222 && $otherWinObj->winName eq $winObj->winName
22223 && $otherWinObj->number < $winObj->number
22224 ) {
22225 return undef;
22226 }
22227 }
22228  
22229 # Update the hash IV
22230 $self->ivAdd(
22231 'storeGridPosnHash',
22232 $winObj->winName,
22233 [$xPos, $yPos, $width, $height],
22234 );
22235  
22236 # The data stored in this IV is saved in the 'config' file
22237 $self->setModifyFlag('config', TRUE, $self->_objClass . '->add_storeGridPosn');
22238  
22239 return 1;
22240 }
22241  
22242 sub del_storeGridPosn {
22243  
22244 my ($self, $winName, $check) = @_;
22245  
22246 # Check for improper arguments
22247 if (! defined $winName || defined $check) {
22248  
22249 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_storeGridPosn', @_);
22250 }
22251  
22252 $self->ivDelete('storeGridPosnHash', $winName);
22253  
22254 # The data stored in this IV is saved in the 'config' file
22255 $self->setModifyFlag('config', TRUE, $self->_objClass . '->del_storeGridPosn');
22256  
22257 return 1;
22258 }
22259  
22260 sub reset_storeGridPosn {
22261  
22262 my ($self, $check) = @_;
22263  
22264 # Check for improper arguments
22265 if (defined $check) {
22266  
22267 return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_storeGridPosn', @_);
22268 }
22269  
22270 $self->ivEmpty('storeGridPosnHash');
22271  
22272 # The data stored in this IV is saved in the 'config' file
22273 $self->setModifyFlag('config', TRUE, $self->_objClass . '->reset_storeGridPosn');
22274  
22275 return 1;
22276 }
22277  
22278 sub add_systemMsg {
22279  
22280 my ($self, $type, $msg, $check) = @_;
22281  
22282 # Check for improper arguments
22283 if (! defined $type || ! defined $msg || defined $check) {
22284  
22285 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_systemMsg', @_);
22286 }
22287  
22288 # If the Client Console window is actually open, display it there immediately
22289 if ($self->consoleWin) {
22290  
22291 $self->consoleWin->update($type, $msg);
22292  
22293 } else {
22294  
22295 $self->ivPush('systemMsgList', $type, $msg);
22296 # If the Connections window is open, tell it to change the icon on its button, so the
22297 # user can see that a system message has arrived
22298 if ($self->connectWin) {
22299  
22300 $self->connectWin->set_consoleButton(TRUE);
22301 }
22302 }
22303  
22304 return 1;
22305 }
22306  
22307 sub reset_systemMsg {
22308  
22309 my ($self, $check) = @_;
22310  
22311 # Check for improper arguments
22312 if (defined $check) {
22313  
22314 return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_systemMsg', @_);
22315 }
22316  
22317 $self->ivEmpty('systemMsgList');
22318  
22319 # If the Connections window is open, tell it to change the icon on its button
22320 if ($self->connectWin) {
22321  
22322 $self->connectWin->set_consoleButton(FALSE);
22323 }
22324  
22325 return 1;
22326 }
22327  
22328 sub add_taskLabel {
22329  
22330 my ($self, $label, $taskName, $check) = @_;
22331  
22332 # Check for improper arguments
22333 if (! defined $label || ! defined $taskName || defined $check) {
22334  
22335 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_taskLabel', @_);
22336 }
22337  
22338 $self->ivAdd('taskLabelHash', $label, $taskName);
22339  
22340 # The data stored in this IV is saved in the 'tasks' file
22341 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->add_taskLabel');
22342  
22343 return 1;
22344 }
22345  
22346 sub del_taskLabel {
22347  
22348 my ($self, $label, $check) = @_;
22349  
22350 # Check for improper arguments
22351 if (! defined $label || defined $check) {
22352  
22353 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_taskLabel', @_);
22354 }
22355  
22356 $self->ivDelete('taskLabelHash', $label);
22357  
22358 # The data stored in this IV is saved in the 'tasks' file
22359 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->del_taskLabel');
22360  
22361 return 1;
22362 }
22363  
22364 sub reset_taskLabels {
22365  
22366 my ($self, $check) = @_;
22367  
22368 # Check for improper arguments
22369 if (defined $check) {
22370  
22371 return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_taskLabels', @_);
22372 }
22373  
22374 $self->ivPoke('taskLabelHash', $self->constTaskLabelHash);
22375  
22376 # The data stored in this IV is saved in the 'tasks' file
22377 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->reset_taskLabels');
22378  
22379 return 1;
22380 }
22381  
22382 sub add_taskPackageName {
22383  
22384 my ($self, $taskName, $packageName, $check) = @_;
22385  
22386 # Check for improper arguments
22387 if (! defined $taskName || ! defined $packageName || defined $check) {
22388  
22389 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_taskPackageName', @_);
22390 }
22391  
22392 $self->ivAdd('taskPackageHash', $taskName, $packageName);
22393  
22394 return 1;
22395 }
22396  
22397 sub del_taskPackageName {
22398  
22399 my ($self, $taskName, $check) = @_;
22400  
22401 # Check for improper arguments
22402 if (! defined $taskName || defined $check) {
22403  
22404 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_taskPackageName', @_);
22405 }
22406  
22407 $self->ivDelete('taskPackageHash', $taskName);
22408  
22409 return 1;
22410 }
22411  
22412 sub reset_taskPackageNames {
22413  
22414 my ($self, $check) = @_;
22415  
22416 # Check for improper arguments
22417 if (defined $check) {
22418  
22419 return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_taskPackageNames', @_);
22420 }
22421  
22422 $self->ivPoke('taskPackageHash', $self->constTaskPackageHash);
22423  
22424 return 1;
22425 }
22426  
22427 sub set_taskRunFirstList {
22428  
22429 my ($self, @args) = @_;
22430  
22431 # (No improper arguments to check; @args can be an empty list)
22432  
22433 $self->ivPoke('taskRunFirstList', @args);
22434  
22435 # The data stored in this IV is saved in the 'tasks' file
22436 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->set_taskRunFirstList');
22437  
22438 return 1;
22439 }
22440  
22441 sub set_taskRunLastList {
22442  
22443 my ($self, @args) = @_;
22444  
22445 # (No improper arguments to check; @args can be an empty list)
22446  
22447 $self->ivPoke('taskRunLastList', @args);
22448  
22449 # The data stored in this IV is saved in the 'tasks' file
22450 $self->setModifyFlag('tasks', TRUE, $self->_objClass . '->set_taskRunLastList');
22451  
22452 return 1;
22453 }
22454  
22455 sub inc_taskTotal {
22456  
22457 my ($self, $check) = @_;
22458  
22459 # Check for improper arguments
22460 if (defined $check) {
22461  
22462 return $axmud::CLIENT->writeImproper($self->_objClass . '->inc_taskTotal', @_);
22463 }
22464  
22465 return $self->ivIncrement('taskTotal');
22466 }
22467  
22468 sub toggle_telnetOption {
22469  
22470 # $flag is not specified when called by ;settelnetoption, but is specified when called by
22471 # GA::PrefWin::Client
22472  
22473 my ($self, $option, $flag, $check) = @_;
22474  
22475 # Local variables
22476 my $iv;
22477  
22478 # Check for improper arguments
22479 if (
22480 ! defined $option
22481 || (
22482 $option ne 'echo' && $option ne 'sga' && $option ne 'ttype' && $option ne 'eor'
22483 && $option ne 'naws' && $option ne 'new_environ' && $option ne 'charset'
22484 )
22485 ) {
22486 return $axmud::CLIENT->writeImproper($self->_objClass . '->toggle_telnetOption', @_);
22487 }
22488  
22489 if ($option eq 'echo') {
22490 $iv = 'useEchoFlag';
22491 } elsif ($option eq 'sga') {
22492 $iv = 'useSgaFlag';
22493 } elsif ($option eq 'ttype') {
22494 $iv = 'useTTypeFlag';
22495 } elsif ($option eq 'eor') {
22496 $iv = 'useEorFlag';
22497 } elsif ($option eq 'naws') {
22498 $iv = 'useNawsFlag';
22499 } elsif ($option eq 'new_environ') {
22500 $iv = 'useNewEnvironFlag';
22501 } elsif ($option eq 'charset') {
22502 $iv = 'useCharSetFlag';
22503 }
22504  
22505 if (defined $flag) {
22506  
22507 if ($flag) {
22508 $self->ivPoke($iv, TRUE);
22509 } else {
22510 $self->ivPoke($iv, FALSE);
22511 }
22512  
22513 } elsif ($self->$iv) {
22514  
22515 $self->ivPoke($iv, FALSE);
22516  
22517 } else {
22518  
22519 $self->ivPoke($iv, TRUE);
22520 }
22521  
22522 # If disabling an option, update every session
22523 if (! $self->$iv) {
22524  
22525 foreach my $session ($self->listSessions()) {
22526  
22527 $session->disableTelnetOption($option);
22528 }
22529 }
22530  
22531 # The data stored in these IVs are saved in the 'config' file
22532 $self->setModifyFlag('config', TRUE, $self->_objClass . '->toggle_telnetOption');
22533  
22534 return 1;
22535 }
22536  
22537 sub set_tempSoundFlag {
22538  
22539 my ($self, $flag, $check) = @_;
22540  
22541 # Check for improper arguments
22542 if (! defined $flag || defined $check) {
22543  
22544 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_tempSoundFlag', @_);
22545 }
22546  
22547 if ($flag) {
22548 $self->ivPoke('tempSoundFlag', TRUE);
22549 } else {
22550 $self->ivPoke('tempSoundFlag', FALSE);
22551 }
22552  
22553 return 1;
22554 }
22555  
22556 sub set_tempUrgencyFlag {
22557  
22558 my ($self, $flag, $check) = @_;
22559  
22560 # Check for improper arguments
22561 if (! defined $flag || defined $check) {
22562  
22563 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_tempUrgencyFlag', @_);
22564 }
22565  
22566 if ($flag) {
22567 $self->ivPoke('tempUrgencyFlag', TRUE);
22568 } else {
22569 $self->ivPoke('tempUrgencyFlag', FALSE);
22570 }
22571  
22572 return 1;
22573 }
22574  
22575 sub toggle_termSetting {
22576  
22577 # $flag is not specified when called by ;configureterminal, but is specified when called by
22578 # GA::PrefWin::Client
22579  
22580 my ($self, $type, $flag, $check) = @_;
22581  
22582 # Local variables
22583 my $iv;
22584  
22585 # Check for improper arguments
22586 if (
22587 ! defined $type
22588 || (
22589 $type ne 'use_ctrl_seq' && $type ne 'show_cursor' && $type ne 'fast_cursor'
22590 && $type ne 'direct_keys'
22591 )
22592 ) {
22593 return $axmud::CLIENT->writeImproper($self->_objClass . '->toggle_termSetting', @_);
22594 }
22595  
22596 if ($type eq 'use_ctrl_seq') {
22597 $iv = 'useCtrlSeqFlag';
22598 } elsif ($type eq 'show_cursor') {
22599 $iv = 'useVisibleCursorFlag';
22600 } elsif ($type eq 'fast_cursor') {
22601 $iv = 'useFastCursorFlag';
22602 } elsif ($type eq 'direct_keys') {
22603 $iv = 'useDirectKeysFlag';
22604 }
22605  
22606 if (defined $flag) {
22607  
22608 if ($flag) {
22609 $self->ivPoke($iv, TRUE);
22610 } else {
22611 $self->ivPoke($iv, FALSE);
22612 }
22613  
22614 } elsif ($self->$iv) {
22615  
22616 $self->ivPoke($iv, FALSE);
22617  
22618 } else {
22619  
22620 $self->ivPoke($iv, TRUE);
22621 }
22622  
22623 # Inform every session that $self->useVisibleCursorFlag or ->useDirectKeysFlag have changed
22624 if ($type eq 'show_cursor') {
22625  
22626 foreach my $session ($self->listSessions()) {
22627  
22628 $session->textViewCursorUpdate();
22629 }
22630  
22631 } elsif ($type eq 'direct_keys') {
22632  
22633 foreach my $session ($self->listSessions()) {
22634  
22635 $session->textViewKeysUpdate();
22636 }
22637 }
22638  
22639 # The data stored in these IVs are saved in the 'config' file
22640 $self->setModifyFlag('config', TRUE, $self->_objClass . '->toggle_termSetting');
22641  
22642 return 1;
22643 }
22644  
22645 sub set_termTypeMode {
22646  
22647 my ($self, $mode, $check) = @_;
22648  
22649 # Check for improper arguments
22650 if (
22651 ! defined $mode
22652 || (
22653 $mode ne 'send_nothing' && $mode ne 'send_client' && $mode ne 'send_client_version'
22654 && $mode ne 'send_custom_client' && $mode ne 'send_default'
22655 && $mode ne 'send_unknown'
22656 )
22657 || defined $check
22658 ) {
22659 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_termTypeMode', @_);
22660 }
22661  
22662 # Update IVs
22663 $self->ivPoke('termTypeMode', $mode);
22664  
22665 # The data stored in this IV is saved in the 'config' file
22666 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_termTypeMode');
22667  
22668 return 1;
22669 }
22670  
22671 sub set_textEditCmd {
22672  
22673 my ($self, $cmd, $check) = @_;
22674  
22675 # Check for improper arguments
22676 if (! defined $cmd || defined $check) {
22677  
22678 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_textEditCmd', @_);
22679 }
22680  
22681 $self->ivPoke('textEditCmd', $cmd);
22682  
22683 # The data stored in this IV is saved in the 'config' file
22684 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_textEditCmd');
22685  
22686 return 1;
22687 }
22688  
22689 sub set_toolbarLabelFlag {
22690  
22691 my ($self, $flag, $check) = @_;
22692  
22693 # Check for improper arguments
22694 if (! defined $flag || defined $check) {
22695  
22696 return $axmud::CLIENT->writeImproper(
22697 $self->_objClass . '->set_toolbarLabelFlag',
22698 @_,
22699 );
22700 }
22701  
22702 if ($flag) {
22703 $self->ivPoke('toolbarLabelFlag', TRUE);
22704 } else {
22705 $self->ivPoke('toolbarLabelFlag', FALSE);
22706 }
22707  
22708 # The data stored in this IV is saved in the 'config' file
22709 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_toolbarLabelFlag');
22710  
22711 return 1;
22712 }
22713  
22714 sub set_toolbarHash {
22715  
22716 my ($self, %hash) = @_;
22717  
22718 # (No improper arguments to check - %hash can be empty)
22719  
22720 $self->ivPoke('toolbarHash', %hash);
22721  
22722 # The data stored in this IV is saved in the 'toolbar' file
22723 $self->setModifyFlag('toolbar', TRUE, $self->_objClass . '->set_toolbarHash');
22724  
22725 return 1;
22726 }
22727  
22728 sub set_toolbarList {
22729  
22730 my ($self, @list) = @_;
22731  
22732 # (No improper arguments to check - @list can be empty)
22733  
22734 $self->ivPoke('toolbarList', @list);
22735  
22736 # The data stored in this IV is saved in the 'toolbar' file
22737 $self->setModifyFlag('toolbar', TRUE, $self->_objClass . '->set_toolbarList');
22738  
22739 return 1;
22740 }
22741  
22742 sub add_ttsObj {
22743  
22744 my ($self, $obj, $check) = @_;
22745  
22746 # Check for improper arguments
22747 if (! defined $obj || defined $check) {
22748  
22749 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_ttsObj', @_);
22750 }
22751  
22752 $self->ivAdd('ttsObjHash', $obj->name, $obj);
22753  
22754 # The data stored in this IV is saved in the 'tts' file
22755 $self->setModifyFlag('tts', TRUE, $self->_objClass . '->add_ttsObj');
22756  
22757 return 1;
22758 }
22759  
22760 sub del_ttsObj {
22761  
22762 my ($self, $obj, $check) = @_;
22763  
22764 # Check for improper arguments
22765 if (! defined $obj || defined $check) {
22766  
22767 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_ttsObj', @_);
22768 }
22769  
22770 # Cannot delete certain standard objects
22771 if ($self->ivExists('constTtsPermObjHash', $obj->name)) {
22772  
22773 return undef;
22774  
22775 } else {
22776  
22777 $self->ivDelete('ttsObjHash', $obj->name);
22778 }
22779  
22780 # The data stored in this IV is saved in the 'tts' file
22781 $self->setModifyFlag('tts', TRUE, $self->_objClass . '->del_ttsObj');
22782  
22783 return 1;
22784 }
22785  
22786 sub set_ttsFestivalServerPort {
22787  
22788 my ($self, $newPort, $check) = @_;
22789  
22790 # Local variables
22791 my $oldPort;
22792  
22793 # Check for improper arguments
22794 if (
22795 defined $check
22796 || (defined $newPort && $newPort ne '' && ($newPort < 0 || $newPort > 65535))
22797 ) {
22798 return $axmud::CLIENT->writeImproper(
22799 $self->_objClass . '->set_ttsFestivalServerPort',
22800 @_,
22801 );
22802 }
22803  
22804 $oldPort = $self->ttsFestivalServerPort;
22805 $self->ivPoke('ttsFestivalServerPort', $newPort); # May be 'undef' or an empty string
22806  
22807 # Update connected IVs
22808 if (
22809 ((defined $oldPort && $oldPort ne '') && (! defined $newPort || $newPort eq ''))
22810 || ((defined $newPort && $newPort ne '') && (! defined $oldPort || $oldPort eq ''))
22811 || (defined $oldPort && defined $newPort && $oldPort ne $newPort)
22812 ) {
22813 # After changing port, we are allowed to attempt to start the server again
22814 $self->ivPoke('ttsFestivalFailFlag', FALSE);
22815  
22816 # If connected to the server, disconnect
22817 if (
22818 $self->ttsFestivalServerMode eq 'server'
22819 && $self->ttsFestivalConnectMode eq 'connected'
22820 ) {
22821 $self->ivPush('ttsFestivalRequestList', 'disconnect');
22822 }
22823  
22824 # If a port is specified, attempt to connect the server, starting it first, if
22825 # necessary
22826 if (defined $newPort && $newPort ne '') {
22827  
22828 if (! $self->ttsFestivalSuccessFlag) {
22829 $self->ivPush('ttsFestivalRequestList', 'start');
22830 } else {
22831 $self->ivPush('ttsFestivalRequestList', 'connect');
22832 }
22833 }
22834 }
22835  
22836 # The data stored in this IV is saved in the 'config' file
22837 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_ttsFestivalServerPort');
22838  
22839 return 1;
22840 }
22841  
22842 sub set_ttsFlag {
22843  
22844 my ($self, $type, $flag, $check) = @_;
22845  
22846 # Local variables
22847 my $iv;
22848  
22849 # Check for improper arguments
22850 if (
22851 ! defined $flag
22852 || (
22853 $type ne 'receive' && $type ne 'login' && $type ne 'prompt' && $type ne 'system'
22854 && $type ne 'error' && $type ne 'command' && $type ne 'cmd' && $type ne 'dialogue'
22855 && $type ne 'task' && $type ne 'verbose' && $type ne 'smooth'
22856 ) || defined $check
22857 ) {
22858  
22859 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_ttsFlag', @_);
22860 }
22861  
22862 if ($type eq 'receive') {
22863 $iv = 'ttsReceiveFlag';
22864 } elsif ($type eq 'login') {
22865 $iv = 'ttsLoginFlag';
22866 } elsif ($type eq 'prompt') {
22867 $iv = 'ttsPromptFlag';
22868 } elsif ($type eq 'system') {
22869 $iv = 'ttsSystemFlag';
22870 } elsif ($type eq 'error') {
22871 $iv = 'ttsSystemErrorFlag';
22872 } elsif ($type eq 'command' || $type eq 'cmd') {
22873 $iv = 'ttsWorldCmdFlag';
22874 } elsif ($type eq 'dialogue') {
22875 $iv = 'ttsDialogueFlag';
22876 } elsif ($type eq 'task') {
22877 $iv = 'ttsTaskFlag';
22878 } elsif ($type eq 'verbose') {
22879 $iv = 'ttsVerboseFlag';
22880 } elsif ($type eq 'smooth') {
22881 $iv = 'ttsSmoothFlag';
22882 }
22883  
22884 if ($flag) {
22885 $self->ivPoke($iv, TRUE);
22886 } else {
22887 $self->ivPoke($iv, FALSE);
22888 }
22889  
22890 # The data stored in this IV is saved in the 'config' file
22891 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_ttsFlag');
22892  
22893 return 1;
22894 }
22895  
22896 sub set_ttsHijackFlag {
22897  
22898 my ($self, $flag, $check) = @_;
22899  
22900 # Check for improper arguments
22901 if (! defined $flag || defined $check) {
22902  
22903 return $axmud::CLIENT->writeImproper($self->_objClass . '->set_ttsHijackFlag', @_);
22904 }
22905  
22906 if ($flag) {
22907 $self->ivPoke('ttsHijackFlag', TRUE);
22908 } else {
22909 $self->ivPoke('ttsHijackFlag', FALSE);
22910 }
22911  
22912 # The data stored in this IV is saved in the 'config' file
22913 $self->setModifyFlag('config', TRUE, $self->_objClass . '->set_tts_hijack_flag');
22914  
22915 return 1;
22916 }
22917  
22918 sub set_ttsJobMode {
22919  
22920 my ($self, $mode, $check) = @_;
22921  
22922 # Check for improper arguments
22923 if (
22924 ! defined $mode || ($mode ne 'default' && $mode ne 'sentence' && $mode ne 'word')
22925 || defined $check
22926 ) {
22927 return $axmud::CLIENT->writeImproper(
22928 $self->_objClass . '->set_ttsJobMode',
22929 @_,
22930 );
22931 }
22932  
22933 $self->ivPoke('ttsJobMode', $mode);
22934 if ($mode ne 'default') {
22935  
22936 $self->ivPoke('ttsChangeModeFlag', TRUE);
22937 }
22938  
22939 # Interrupt any text being read aloud now
22940 if ($self->ttsCurrentHarness) {
22941  
22942 $axmud::CLIENT->ttsInterruptJob();
22943 }
22944  
22945 return 1;
22946 }
22947  
22948 sub add_userCmd {
22949  
22950 my ($self, $userCmd, $standardCmd, $check) = @_;
22951  
22952 # Check for improper arguments
22953 if (! defined $userCmd || ! defined $standardCmd || defined $check) {
22954  
22955 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_userCmd', @_);
22956 }
22957  
22958 $self->ivAdd('userCmdHash', $userCmd, $standardCmd);
22959  
22960 # The data stored in these IVs is saved in the 'usercmds' file
22961 $self->setModifyFlag('usercmds', TRUE, $self->_objClass . '->add_userCmd');
22962  
22963 return 1;
22964 }
22965  
22966 sub del_userCmd {
22967  
22968 my ($self, $userCmd, $check) = @_;
22969  
22970 # Check for improper arguments
22971 if (! defined $userCmd || defined $check) {
22972  
22973 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_userCmd', @_);
22974 }
22975  
22976 $self->ivDelete('userCmdHash', $userCmd);
22977  
22978 # The data stored in these IVs is saved in the 'usercmds' file
22979 $self->setModifyFlag('usercmds', TRUE, $self->_objClass . '->del_userCmd');
22980  
22981 return 1;
22982 }
22983  
22984 sub reset_userCmd {
22985  
22986 my ($self, $check) = @_;
22987  
22988 # Check for improper arguments
22989 if (defined $check) {
22990  
22991 return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_userCmd', @_);
22992 }
22993  
22994 $self->ivPoke('userCmdHash', $self->constUserCmdHash);
22995  
22996 # The data stored in these IVs is saved in the 'usercmds' file
22997 $self->setModifyFlag('usercmds', TRUE, $self->_objClass . '->reset_userCmd');
22998  
22999 return 1;
23000 }
23001  
23002 sub del_winObj {
23003  
23004 # Called by GA::Win::Generic->winDestroy
23005  
23006 my ($self, $winObj, $check) = @_;
23007  
23008 # Local variables
23009 my $stripObj;
23010  
23011 # Check for improper arguments
23012 if (! defined $winObj || defined $check) {
23013  
23014 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_winObj', @_);
23015 }
23016  
23017 # For pseudo-windows, if the parent table object is still open, close it
23018 if ($winObj->pseudoWinTableObj) {
23019  
23020 $stripObj = $winObj->pseudoWinTableObj->stripObj;
23021 if ($stripObj->ivExists('tableObjHash', $winObj->pseudoWinTableObj->number)) {
23022  
23023 $stripObj->removeTableObj($winObj->pseudoWinTableObj);
23024 }
23025 }
23026  
23027 return 1;
23028 }
23029  
23030 sub add_worldProf {
23031  
23032 my ($self, $obj, $check) = @_;
23033  
23034 # Check for improper arguments
23035 if (! defined $obj || defined $check) {
23036  
23037 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_worldProf', @_);
23038 }
23039  
23040 $self->ivAdd('worldProfHash', $obj->name, $obj);
23041  
23042 # The data stored in this IV is saved in the 'config' and 'worldprof' files
23043 $self->setModifyFlag('config', TRUE, $self->_objClass . '->add_worldProf');
23044 $self->setModifyFlag($obj->name, TRUE, $self->_objClass . '->add_worldProf');
23045  
23046 return 1;
23047 }
23048  
23049 sub del_worldProf {
23050  
23051 my ($self, $obj, $check) = @_;
23052  
23053 # Check for improper arguments
23054 if (! defined $obj || defined $check) {
23055  
23056 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_worldProf', @_);
23057 }
23058  
23059 $self->ivDelete('worldProfHash', $obj->name);
23060  
23061 # The data stored in this IV is saved in the 'config' and 'worldprof' files
23062 $self->setModifyFlag('config', TRUE, $self->_objClass . '->del_worldProf');
23063 $self->setModifyFlag($obj->name, TRUE, $self->_objClass . '->del_worldProf');
23064  
23065 return 1;
23066 }
23067  
23068 sub add_winmap {
23069  
23070 my ($self, $obj, $check) = @_;
23071  
23072 # Check for improper arguments
23073 if (! defined $obj || defined $check) {
23074  
23075 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_winmap', @_);
23076 }
23077  
23078 # Update IVs
23079 $self->ivAdd('winmapHash', $obj->name, $obj);
23080  
23081 # The data stored in this IV is saved in the 'winmaps' file
23082 $self->setModifyFlag('winmaps', TRUE, $self->_objClass . '->add_winmap');
23083  
23084 return 1;
23085 }
23086  
23087 sub del_winmap {
23088  
23089 my ($self, $winmapName, $check) = @_;
23090  
23091 # Check for improper arguments
23092 if (! defined $winmapName || defined $check) {
23093  
23094 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_winmap', @_);
23095 }
23096  
23097 # Update IVs
23098 $self->ivDelete('winmapHash', $winmapName);
23099  
23100 # The data stored in this IV is saved in the 'winmaps' file
23101 $self->setModifyFlag('winmaps', TRUE, $self->_objClass . '->del_winmap');
23102  
23103 return 1;
23104 }
23105  
23106 sub add_zmpPackage {
23107  
23108 my ($self, $obj, $check) = @_;
23109  
23110 # Check for improper arguments
23111 if (! defined $obj || defined $check) {
23112  
23113 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_zmpPackage', @_);
23114 }
23115  
23116 # Can't replace an existing package object using one with the same name
23117 if ($self->ivExists('zmpPackageHash', $obj->name)) {
23118  
23119 return undef;
23120  
23121 } else {
23122  
23123 $self->ivAdd('zmpPackageHash', $obj->name, $obj);
23124  
23125 return $obj;
23126 }
23127 }
23128  
23129 sub add_zonemap {
23130  
23131 my ($self, $obj, $check) = @_;
23132  
23133 # Check for improper arguments
23134 if (! defined $obj || defined $check) {
23135  
23136 return $axmud::CLIENT->writeImproper($self->_objClass . '->add_zonemap', @_);
23137 }
23138  
23139 # Update IVs
23140 $self->ivAdd('zonemapHash', $obj->name, $obj);
23141  
23142 # The data stored in this IV is saved in the 'zonemaps' file
23143 $self->setModifyFlag('zonemaps', TRUE, $self->_objClass . '->add_zonemap');
23144  
23145 return 1;
23146 }
23147  
23148 sub del_zonemap {
23149  
23150 # Called by GA::Cmd::DeleteZonemap->do and, for temporary zonemaps, GA::Session->stop
23151 # (only; if a zonemap in use by a workspace grid is deleted, bad things can happen)
23152  
23153 my ($self, $zonemapName, $check) = @_;
23154  
23155 # Check for improper arguments
23156 if (! defined $zonemapName || defined $check) {
23157  
23158 return $axmud::CLIENT->writeImproper($self->_objClass . '->del_zonemap', @_);
23159 }
23160  
23161 # Update IVs
23162 $self->ivDelete('zonemapHash', $zonemapName);
23163  
23164 # The data stored in this IV is saved in the 'zonemaps' file
23165 $self->setModifyFlag('zonemaps', TRUE, $self->_objClass . '->del_zonemap');
23166  
23167 return 1;
23168 }
23169  
23170 ##################
23171 # Accessors - get
23172  
23173 sub desktopObj
23174 { $_[0]->{desktopObj} }
23175  
23176 sub mainWin
23177 { $_[0]->{mainWin} }
23178  
23179 sub aboutWin
23180 { $_[0]->{aboutWin} }
23181 sub busyWin
23182 { $_[0]->{busyWin} }
23183 sub connectWin
23184 { $_[0]->{connectWin} }
23185 sub consoleWin
23186 { $_[0]->{consoleWin} }
23187  
23188 sub constIVHash
23189 { my $self = shift; return %{$self->{constIVHash}}; }
23190 sub constReservedHash
23191 { my $self = shift; return %{$self->{constReservedHash}}; }
23192  
23193 sub loadConfigFlag
23194 { $_[0]->{loadConfigFlag} }
23195 sub saveConfigFlag
23196 { $_[0]->{saveConfigFlag} }
23197 sub loadDataFlag
23198 { $_[0]->{loadDataFlag} }
23199 sub saveDataFlag
23200 { $_[0]->{saveDataFlag} }
23201 sub deleteFilesAtStartFlag
23202 { $_[0]->{deleteFilesAtStartFlag} }
23203 sub fileFailFlag
23204 { $_[0]->{fileFailFlag} }
23205  
23206 sub emergencySaveFlag
23207 { $_[0]->{emergencySaveFlag} }
23208  
23209 sub autoSaveFlag
23210 { $_[0]->{autoSaveFlag} }
23211 sub autoSaveWaitTime
23212 { $_[0]->{autoSaveWaitTime} }
23213 sub autoRetainFileFlag
23214 { $_[0]->{autoRetainFileFlag} }
23215  
23216 sub autoBackupMode
23217 { $_[0]->{autoBackupMode} }
23218 sub autoBackupDir
23219 { $_[0]->{autoBackupDir} }
23220 sub autoBackupInterval
23221 { $_[0]->{autoBackupInterval} }
23222 sub autoBackupDate
23223 { $_[0]->{autoBackupDate} }
23224 sub autoBackupFileType
23225 { $_[0]->{autoBackupFileType} }
23226 sub autoBackupAppendFlag
23227 { $_[0]->{autoBackupAppendFlag} }
23228  
23229 sub fileObjHash
23230 { my $self = shift; return %{$self->{fileObjHash}}; }
23231 sub configFileObj
23232 { $_[0]->{configFileObj} }
23233 sub configWorldProfList
23234 { my $self = shift; return @{$self->{configWorldProfList}}; }
23235  
23236 sub constLargeFileSize
23237 { $_[0]->{constLargeFileSize} }
23238  
23239 sub allowModelSplitFlag
23240 { $_[0]->{allowModelSplitFlag} }
23241 sub constModelSplitSize
23242 { $_[0]->{constModelSplitSize} }
23243 sub modelSplitSize
23244 { $_[0]->{modelSplitSize} }
23245  
23246 sub initPluginList
23247 { my $self = shift; return @{$self->{initPluginList}}; }
23248 sub pluginHash
23249 { my $self = shift; return %{$self->{pluginHash}}; }
23250 sub pluginCmdHash
23251 { my $self = shift; return %{$self->{pluginCmdHash}}; }
23252 sub pluginTaskHash
23253 { my $self = shift; return %{$self->{pluginTaskHash}}; }
23254 sub pluginGridWinHash
23255 { my $self = shift; return %{$self->{pluginGridWinHash}}; }
23256 sub pluginFreeWinHash
23257 { my $self = shift; return %{$self->{pluginFreeWinHash}}; }
23258 sub pluginStripObjHash
23259 { my $self = shift; return %{$self->{pluginStripObjHash}}; }
23260 sub pluginTableObjHash
23261 { my $self = shift; return %{$self->{pluginTableObjHash}}; }
23262 sub pluginCageHash
23263 { my $self = shift; return %{$self->{pluginCageHash}}; }
23264 sub pluginCagePackageHash
23265 { my $self = shift; return %{$self->{pluginCagePackageHash}}; }
23266 sub pluginCageEditWinHash
23267 { my $self = shift; return %{$self->{pluginCageEditWinHash}}; }
23268 sub pluginMenuFuncHash
23269 { my $self = shift; return %{$self->{pluginMenuFuncHash}}; }
23270 sub pluginMxpFilterHash
23271 { my $self = shift; return %{$self->{pluginMxpFilterHash}}; }
23272  
23273 sub clientTime
23274 { $_[0]->{clientTime} }
23275 sub suspendSessionLoopFlag
23276 { $_[0]->{suspendSessionLoopFlag} }
23277  
23278 sub clientLoopObj
23279 { $_[0]->{clientLoopObj} }
23280 sub clientLoopSpinFlag
23281 { $_[0]->{clientLoopSpinFlag} }
23282 sub clientLoopDelay
23283 { $_[0]->{clientLoopDelay} }
23284  
23285 sub showModFlag
23286 { $_[0]->{showModFlag} }
23287  
23288 sub blinkerDelay
23289 { $_[0]->{blinkerDelay} }
23290  
23291 sub blinkSlowTime
23292 { $_[0]->{blinkSlowTime} }
23293 sub blinkSlowCheckTime
23294 { $_[0]->{blinkSlowCheckTime} }
23295 sub blinkSlowFlag
23296 { $_[0]->{blinkSlowFlag} }
23297 sub blinkFastTime
23298 { $_[0]->{blinkFastTime} }
23299 sub blinkFastCheckTime
23300 { $_[0]->{blinkFastCheckTime} }
23301 sub blinkFastFlag
23302 { $_[0]->{blinkFastFlag} }
23303  
23304 sub paneDelay
23305 { $_[0]->{paneDelay} }
23306 sub paneRestoreHash
23307 { my $self = shift; return %{$self->{paneRestoreHash}}; }
23308  
23309 sub systemMsgList
23310 { my $self = shift; return @{$self->{systemMsgList}}; }
23311  
23312 sub sessionHash
23313 { my $self = shift; return %{$self->{sessionHash}}; }
23314 sub sessionCount
23315 { $_[0]->{sessionCount} }
23316 sub constSessionMax
23317 { $_[0]->{constSessionMax} }
23318 sub sessionMax
23319 { $_[0]->{sessionMax} }
23320 sub currentSession
23321 { $_[0]->{currentSession} }
23322 sub shutdownFlag
23323 { $_[0]->{shutdownFlag} }
23324 sub terminatingFlag
23325 { $_[0]->{terminatingFlag} }
23326 sub offlineOnDisconnectFlag
23327 { $_[0]->{offlineOnDisconnectFlag} }
23328  
23329 sub sessionTabMode
23330 { $_[0]->{sessionTabMode} }
23331 sub xTermTitleFlag
23332 { $_[0]->{xTermTitleFlag} }
23333 sub longTabLabelFlag
23334 { $_[0]->{longTabLabelFlag} }
23335 sub simpleTabFlag
23336 { $_[0]->{simpleTabFlag} }
23337 sub confirmCloseMainWinFlag
23338 { $_[0]->{confirmCloseMainWinFlag} }
23339 sub confirmCloseTabFlag
23340 { $_[0]->{confirmCloseTabFlag} }
23341 sub confirmCloseMenuFlag
23342 { $_[0]->{confirmCloseMenuFlag} }
23343 sub confirmCloseToolButtonFlag
23344 { $_[0]->{confirmCloseToolButtonFlag} }
23345  
23346 sub constCharSet
23347 { $_[0]->{constCharSet} }
23348 sub charSet
23349 { $_[0]->{charSet} }
23350 sub charSetList
23351 { my $self = shift; return @{$self->{charSetList}}; }
23352  
23353 sub connectHistoryFlag
23354 { $_[0]->{connectHistoryFlag} }
23355  
23356 sub clientCmdHash
23357 { my $self = shift; return %{$self->{clientCmdHash}}; }
23358 sub replaceClientCmdHash
23359 { my $self = shift; return %{$self->{replaceClientCmdHash}}; }
23360 sub constClientCmdPrettyList
23361 { my $self = shift; return @{$self->{constClientCmdPrettyList}}; }
23362 sub clientCmdPrettyList
23363 { my $self = shift; return @{$self->{clientCmdPrettyList}}; }
23364 sub clientCmdList
23365 { my $self = shift; return @{$self->{clientCmdList}}; }
23366 sub clientCmdReplacePrettyHash
23367 { my $self = shift; return %{$self->{clientCmdReplacePrettyHash}}; }
23368  
23369 sub constUserCmdHash
23370 { my $self = shift; return %{$self->{constUserCmdHash}}; }
23371 sub userCmdHash
23372 { my $self = shift; return %{$self->{userCmdHash}}; }
23373  
23374 sub constClientSigil
23375 { $_[0]->{constClientSigil} }
23376 sub constForcedSigil
23377 { $_[0]->{constForcedSigil} }
23378 sub constEchoSigil
23379 { $_[0]->{constEchoSigil} }
23380 sub constPerlSigil
23381 { $_[0]->{constPerlSigil} }
23382 sub constScriptSigil
23383 { $_[0]->{constScriptSigil} }
23384 sub constMultiSigil
23385 { $_[0]->{constMultiSigil} }
23386 sub constSpeedSigil
23387 { $_[0]->{constSpeedSigil} }
23388 sub constBypassSigil
23389 { $_[0]->{constBypassSigil} }
23390  
23391 sub echoSigilFlag
23392 { $_[0]->{echoSigilFlag} }
23393 sub perlSigilFlag
23394 { $_[0]->{perlSigilFlag} }
23395 sub scriptSigilFlag
23396 { $_[0]->{scriptSigilFlag} }
23397 sub multiSigilFlag
23398 { $_[0]->{multiSigilFlag} }
23399 sub speedSigilFlag
23400 { $_[0]->{speedSigilFlag} }
23401 sub bypassSigilFlag
23402 { $_[0]->{bypassSigilFlag} }
23403  
23404 sub constCmdSep
23405 { $_[0]->{constCmdSep} }
23406 sub cmdSep
23407 { $_[0]->{cmdSep} }
23408  
23409 sub constDisplayBufferSize
23410 { $_[0]->{constDisplayBufferSize} }
23411 sub constInstructBufferSize
23412 { $_[0]->{constInstructBufferSize} }
23413 sub constCmdBufferSize
23414 { $_[0]->{constCmdBufferSize} }
23415 sub constMinBufferSize
23416 { $_[0]->{constMinBufferSize} }
23417 sub constMaxBufferSize
23418 { $_[0]->{constMaxBufferSize} }
23419 sub customDisplayBufferSize
23420 { $_[0]->{customDisplayBufferSize} }
23421 sub customInstructBufferSize
23422 { $_[0]->{customInstructBufferSize} }
23423 sub customCmdBufferSize
23424 { $_[0]->{customCmdBufferSize} }
23425  
23426 sub confirmWorldCmdFlag
23427 { $_[0]->{confirmWorldCmdFlag} }
23428 sub convertWorldCmdFlag
23429 { $_[0]->{convertWorldCmdFlag} }
23430 sub preserveWorldCmdFlag
23431 { $_[0]->{preserveWorldCmdFlag} }
23432 sub preserveOtherCmdFlag
23433 { $_[0]->{preserveOtherCmdFlag} }
23434 sub maxMultiCmdFlag
23435 { $_[0]->{maxMultiCmdFlag} }
23436  
23437 sub autoCompleteMode
23438 { $_[0]->{autoCompleteMode} }
23439 sub autoCompleteType
23440 { $_[0]->{autoCompleteType} }
23441 sub autoCompleteParent
23442 { $_[0]->{autoCompleteParent} }
23443  
23444 sub useScrollKeysFlag
23445 { $_[0]->{useScrollKeysFlag} }
23446 sub smoothScrollKeysFlag
23447 { $_[0]->{smoothScrollKeysFlag} }
23448 sub autoSplitKeysFlag
23449 { $_[0]->{autoSplitKeysFlag} }
23450 sub useCompleteKeysFlag
23451 { $_[0]->{useCompleteKeysFlag} }
23452 sub useSwitchKeysFlag
23453 { $_[0]->{useSwitchKeysFlag} }
23454  
23455 sub instructBufferHash
23456 { my $self = shift; return %{$self->{instructBufferHash}}; }
23457 sub instructBufferCount
23458 { $_[0]->{instructBufferCount} }
23459 sub instructBufferFirst
23460 { $_[0]->{instructBufferFirst} }
23461 sub instructBufferLast
23462 { $_[0]->{instructBufferLast} }
23463 sub instructBufferPosn
23464 { $_[0]->{instructBufferPosn} }
23465  
23466 sub cmdBufferHash
23467 { my $self = shift; return %{$self->{cmdBufferHash}}; }
23468 sub cmdBufferCount
23469 { $_[0]->{cmdBufferCount} }
23470 sub cmdBufferFirst
23471 { $_[0]->{cmdBufferFirst} }
23472 sub cmdBufferLast
23473 { $_[0]->{cmdBufferLast} }
23474 sub cmdBufferPosn
23475 { $_[0]->{cmdBufferPosn} }
23476  
23477 sub constProfPriorityList
23478 { my $self = shift; return @{$self->{constProfPriorityList}}; }
23479 sub constProfStandardHash
23480 { my $self = shift; return %{$self->{constProfStandardHash}}; }
23481  
23482 sub worldProfHash
23483 { my $self = shift; return %{$self->{worldProfHash}}; }
23484  
23485 sub constWorldHash
23486 { my $self = shift; return %{$self->{constWorldHash}}; }
23487 sub constWorldPatchHash
23488 { my $self = shift; return %{$self->{constWorldPatchHash}}; }
23489 sub constWorldList
23490 { my $self = shift; return @{$self->{constWorldList}}; }
23491 sub prevClientVersion
23492 { $_[0]->{prevClientVersion} }
23493 sub favouriteWorldList
23494 { my $self = shift; return @{$self->{favouriteWorldList}}; }
23495 sub autoConnectList
23496 { my $self = shift; return @{$self->{autoConnectList}}; }
23497 sub constBasicWorldHash
23498 { my $self = shift; return %{$self->{constBasicWorldHash}}; }
23499  
23500 sub constRoomFilterList
23501 { my $self = shift; return @{$self->{constRoomFilterList}}; }
23502 sub constRoomFilterKeyList
23503 { my $self = shift; return @{$self->{constRoomFilterKeyList}}; }
23504 sub constRoomFlagList
23505 { my $self = shift; return @{$self->{constRoomFlagList}}; }
23506 sub constRoomHazardHash
23507 { my $self = shift; return %{$self->{constRoomHazardHash}}; }
23508 sub constRoomNoObscuredHash
23509 { my $self = shift; return %{$self->{constRoomNoObscuredHash}}; }
23510  
23511 sub constModelTypeHash
23512 { my $self = shift; return %{$self->{constModelTypeHash}}; }
23513 sub constPrimaryDirList
23514 { my $self = shift; return @{$self->{constPrimaryDirList}}; }
23515 sub constShortPrimaryDirList
23516 { my $self = shift; return @{$self->{constShortPrimaryDirList}}; }
23517 sub constShortPrimaryDirHash
23518 { my $self = shift; return %{$self->{constShortPrimaryDirHash}}; }
23519 sub constOppDirHash
23520 { my $self = shift; return %{$self->{constOppDirHash}}; }
23521 sub constComponentTypeList
23522 { my $self = shift; return @{$self->{constComponentTypeList}}; }
23523 sub constExitStateHash
23524 { my $self = shift; return %{$self->{constExitStateHash}}; }
23525 sub constParseObjMax
23526 { $_[0]->{constParseObjMax} }
23527  
23528 sub constCageTypeList
23529 { my $self = shift; return @{$self->{constCageTypeList}}; }
23530 sub cageTypeList
23531 { my $self = shift; return @{$self->{cageTypeList}}; }
23532  
23533 sub dictHash
23534 { my $self = shift; return %{$self->{dictHash}}; }
23535 sub phrasebookHash
23536 { my $self = shift; return %{$self->{phrasebookHash}}; }
23537  
23538 sub interfaceModelHash
23539 { my $self = shift; return %{$self->{interfaceModelHash}}; }
23540 sub interfaceClipboardList
23541 { my $self = shift; return @{$self->{interfaceClipboardList}}; }
23542  
23543 sub constKeycodeHash
23544 { my $self = shift; return %{$self->{constKeycodeHash}}; }
23545 sub constMSWinKeycodeHash
23546 { my $self = shift; return %{$self->{constMSWinKeycodeHash}}; }
23547 sub constBSDKeycodeHash
23548 { my $self = shift; return %{$self->{constBSDKeycodeHash}}; }
23549 sub keycodeHash
23550 { my $self = shift; return %{$self->{keycodeHash}}; }
23551 sub revKeycodeHash
23552 { my $self = shift; return %{$self->{revKeycodeHash}}; }
23553 sub constAltKeycodeHash
23554 { my $self = shift; return %{$self->{constAltKeycodeHash}}; }
23555 sub constKeycodeList
23556 { my $self = shift; return @{$self->{constKeycodeList}}; }
23557 sub activeKeycodeHash
23558 { my $self = shift; return %{$self->{activeKeycodeHash}}; }
23559 sub resetKeycodesFlag
23560 { $_[0]->{resetKeycodesFlag} }
23561  
23562 sub constTaskPackageHash
23563 { my $self = shift; return %{$self->{constTaskPackageHash}}; }
23564 sub taskPackageHash
23565 { my $self = shift; return %{$self->{taskPackageHash}}; }
23566 sub constTaskLabelHash
23567 { my $self = shift; return %{$self->{constTaskLabelHash}}; }
23568 sub taskLabelHash
23569 { my $self = shift; return %{$self->{taskLabelHash}}; }
23570  
23571 sub constTaskRunFirstList
23572 { my $self = shift; return @{$self->{constTaskRunFirstList}}; }
23573 sub constTaskRunLastList
23574 { my $self = shift; return @{$self->{constTaskRunLastList}}; }
23575 sub taskRunFirstList
23576 { my $self = shift; return @{$self->{taskRunFirstList}}; }
23577 sub taskRunLastList
23578 { my $self = shift; return @{$self->{taskRunLastList}}; }
23579  
23580 sub taskTotal
23581 { $_[0]->{taskTotal} }
23582  
23583 sub initTaskHash
23584 { my $self = shift; return %{$self->{initTaskHash}}; }
23585 sub initTaskOrderList
23586 { my $self = shift; return @{$self->{initTaskOrderList}}; }
23587 sub initTaskTotal
23588 { $_[0]->{initTaskTotal} }
23589  
23590 sub customTaskHash
23591 { my $self = shift; return %{$self->{customTaskHash}}; }
23592  
23593 sub constTaskSettingsHash
23594 { my $self = shift; return %{$self->{constTaskSettingsHash}}; }
23595 sub constTaskStatusHash
23596 { my $self = shift; return %{$self->{constTaskStatusHash}}; }
23597  
23598 sub scriptDirList
23599 { my $self = shift; return @{$self->{scriptDirList}}; }
23600 sub initScriptHash
23601 { my $self = shift; return %{$self->{initScriptHash}}; }
23602 sub initScriptOrderList
23603 { my $self = shift; return @{$self->{initScriptOrderList}}; }
23604  
23605 sub constLogPrefHash
23606 { my $self = shift; return %{$self->{constLogPrefHash}}; }
23607 sub logPrefHash
23608 { my $self = shift; return %{$self->{logPrefHash}}; }
23609 sub constSessionLogPrefHash
23610 { my $self = shift; return %{$self->{constSessionLogPrefHash}}; }
23611 sub constSessionLogOrderList
23612 { my $self = shift; return @{$self->{constSessionLogOrderList}}; }
23613  
23614 sub constLogDescripHash
23615 { my $self = shift; return %{$self->{constLogDescripHash}}; }
23616 sub constLogOrderList
23617 { my $self = shift; return @{$self->{constLogOrderList}}; }
23618 sub constLogPathHash
23619 { my $self = shift; return %{$self->{constLogPathHash}}; }
23620 sub allowLogsFlag
23621 { $_[0]->{allowLogsFlag} }
23622 sub deleteStandardLogsFlag
23623 { $_[0]->{deleteStandardLogsFlag} }
23624 sub deleteWorldLogsFlag
23625 { $_[0]->{deleteWorldLogsFlag} }
23626  
23627 sub logDayFlag
23628 { $_[0]->{logDayFlag} }
23629 sub logClientFlag
23630 { $_[0]->{logClientFlag} }
23631 sub logPrefixDateFlag
23632 { $_[0]->{logPrefixDateFlag} }
23633 sub logPrefixTimeFlag
23634 { $_[0]->{logPrefixTimeFlag} }
23635 sub logImageFlag
23636 { $_[0]->{logImageFlag} }
23637 sub logPreambleList
23638 { my $self = shift; return @{$self->{logPreambleList}}; }
23639  
23640 sub statusEventBeforeCount
23641 { $_[0]->{statusEventBeforeCount} }
23642 sub statusEventAfterCount
23643 { $_[0]->{statusEventAfterCount} }
23644  
23645 sub chatName
23646 { $_[0]->{chatName} }
23647 sub chatEmail
23648 { $_[0]->{chatEmail} }
23649 sub constChatPort
23650 { $_[0]->{constChatPort} }
23651 sub chatAcceptMode
23652 { $_[0]->{chatAcceptMode} }
23653 sub chatContactHash
23654 { my $self = shift; return %{$self->{chatContactHash}}; }
23655  
23656 sub constChatIcon
23657 { $_[0]->{constChatIcon} }
23658 sub chatIcon
23659 { $_[0]->{chatIcon} }
23660  
23661 sub constChatContactIcon
23662 { $_[0]->{constChatContactIcon} }
23663 sub constChatSmileyHash
23664 { my $self = shift; return %{$self->{constChatSmileyHash}}; }
23665 sub chatSmileyHash
23666 { my $self = shift; return %{$self->{chatSmileyHash}}; }
23667  
23668 sub constColourTagList
23669 { my $self = shift; return @{$self->{constColourTagList}}; }
23670 sub constBoldColourTagList
23671 { my $self = shift; return @{$self->{constBoldColourTagList}}; }
23672 sub constColourTagHash
23673 { my $self = shift; return %{$self->{constColourTagHash}}; }
23674 sub constBoldColourTagHash
23675 { my $self = shift; return %{$self->{constBoldColourTagHash}}; }
23676 sub colourTagHash
23677 { my $self = shift; return %{$self->{colourTagHash}}; }
23678 sub boldColourTagHash
23679 { my $self = shift; return %{$self->{boldColourTagHash}}; }
23680 sub constMonochromeHash
23681 { my $self = shift; return %{$self->{constMonochromeHash}}; }
23682  
23683 sub constRainbowColourList
23684 { my $self = shift; return @{$self->{constRainbowColourList}}; }
23685 sub constHtmlColourHash
23686 { my $self = shift; return %{$self->{constHtmlColourHash}}; }
23687 sub constHtmlContrastHash
23688 { my $self = shift; return %{$self->{constHtmlContrastHash}}; }
23689  
23690 sub constXTermColourHash
23691 { my $self = shift; return %{$self->{constXTermColourHash}}; }
23692 sub constNetscapeColourHash
23693 { my $self = shift; return %{$self->{constNetscapeColourHash}}; }
23694 sub currentColourCube
23695 { $_[0]->{currentColourCube} }
23696 sub xTermColourHash
23697 { my $self = shift; return %{$self->{xTermColourHash}}; }
23698  
23699 sub constOscPaletteHash
23700 { my $self = shift; return %{$self->{constOscPaletteHash}}; }
23701 sub oscPaletteFlag
23702 { $_[0]->{oscPaletteFlag} }
23703  
23704 sub constStyleTagList
23705 { my $self = shift; return @{$self->{constStyleTagList}}; }
23706 sub constDummyTagList
23707 { my $self = shift; return @{$self->{constDummyTagList}}; }
23708 sub constStyleTagHash
23709 { my $self = shift; return %{$self->{constStyleTagHash}}; }
23710 sub constJustifyTagHash
23711 { my $self = shift; return %{$self->{constJustifyTagHash}}; }
23712 sub constDummyTagHash
23713 { my $self = shift; return %{$self->{constDummyTagHash}}; }
23714  
23715 sub constANSIColourHash
23716 { my $self = shift; return %{$self->{constANSIColourHash}}; }
23717 sub constANSIStyleHash
23718 { my $self = shift; return %{$self->{constANSIStyleHash}}; }
23719 sub constColourStyleList
23720 { my $self = shift; return @{$self->{constColourStyleList}}; }
23721 sub constPrettyTagHash
23722 { my $self = shift; return %{$self->{constPrettyTagHash}}; }
23723 sub constColourStyleHash
23724 { my $self = shift; return %{$self->{constColourStyleHash}}; }
23725  
23726 sub constTelnetHash
23727 { my $self = shift; return %{$self->{constTelnetHash}}; }
23728 sub constTeloptHash
23729 { my $self = shift; return %{$self->{constTeloptHash}}; }
23730  
23731 sub constHeadingSizeHash
23732 { my $self = shift; return %{$self->{constHeadingSizeHash}}; }
23733 sub constHeadingSpacingHash
23734 { my $self = shift; return %{$self->{constHeadingSpacingHash}}; }
23735  
23736 sub useEchoFlag
23737 { $_[0]->{useEchoFlag} }
23738 sub useSgaFlag
23739 { $_[0]->{useSgaFlag} }
23740 sub useTTypeFlag
23741 { $_[0]->{useTTypeFlag} }
23742 sub useEorFlag
23743 { $_[0]->{useEorFlag} }
23744 sub useNawsFlag
23745 { $_[0]->{useNawsFlag} }
23746 sub useNewEnvironFlag
23747 { $_[0]->{useNewEnvironFlag} }
23748 sub useCharSetFlag
23749 { $_[0]->{useCharSetFlag} }
23750  
23751 sub useMsdpFlag
23752 { $_[0]->{useMsdpFlag} }
23753 sub useMsspFlag
23754 { $_[0]->{useMsspFlag} }
23755 sub useMccpFlag
23756 { $_[0]->{useMccpFlag} }
23757 sub useMspFlag
23758 { $_[0]->{useMspFlag} }
23759 sub useMxpFlag
23760 { $_[0]->{useMxpFlag} }
23761 sub usePuebloFlag
23762 { $_[0]->{usePuebloFlag} }
23763 sub useZmpFlag
23764 { $_[0]->{useZmpFlag} }
23765 sub useAard102Flag
23766 { $_[0]->{useAard102Flag} }
23767 sub useAtcpFlag
23768 { $_[0]->{useAtcpFlag} }
23769 sub useGmcpFlag
23770 { $_[0]->{useGmcpFlag} }
23771 sub useMttsFlag
23772 { $_[0]->{useMttsFlag} }
23773 sub useMnesFlag
23774 { $_[0]->{useMnesFlag} }
23775 sub useMcpFlag
23776 { $_[0]->{useMcpFlag} }
23777  
23778 sub constMsspVarHash
23779 { my $self = shift; return %{$self->{constMsspVarHash}}; }
23780 sub constMsspVarList
23781 { my $self = shift; return @{$self->{constMsspVarList}}; }
23782  
23783 sub constMspVersion
23784 { $_[0]->{constMspVersion} }
23785 sub allowMspMultipleFlag
23786 { $_[0]->{allowMspMultipleFlag} }
23787 sub allowMspLoadSoundFlag
23788 { $_[0]->{allowMspLoadSoundFlag} }
23789 sub allowMspFlexibleFlag
23790 { $_[0]->{allowMspFlexibleFlag} }
23791  
23792 sub constMxpVersion
23793 { $_[0]->{constMxpVersion} }
23794 sub constMxpOfficialHash
23795 { my $self = shift; return %{$self->{constMxpOfficialHash}}; }
23796 sub constMxpAttribHash
23797 { my $self = shift; return %{$self->{constMxpAttribHash}}; }
23798 sub constMxpConvertHash
23799 { my $self = shift; return %{$self->{constMxpConvertHash}}; }
23800 sub constMxpLineSpacingHash
23801 { my $self = shift; return %{$self->{constMxpLineSpacingHash}}; }
23802 sub constMxpModalHash
23803 { my $self = shift; return %{$self->{constMxpModalHash}}; }
23804 sub constMxpStackConvertHash
23805 { my $self = shift; return %{$self->{constMxpStackConvertHash}}; }
23806 sub constMxpModalOnHash
23807 { my $self = shift; return %{$self->{constMxpModalOnHash}}; }
23808 sub constMxpFormatHash
23809 { my $self = shift; return %{$self->{constMxpFormatHash}}; }
23810 sub constMxpEntityHash
23811 { my $self = shift; return %{$self->{constMxpEntityHash}}; }
23812 sub allowMxpFontFlag
23813 { $_[0]->{allowMxpFontFlag} }
23814 sub allowMxpImageFlag
23815 { $_[0]->{allowMxpImageFlag} }
23816 sub allowMxpLoadImageFlag
23817 { $_[0]->{allowMxpLoadImageFlag} }
23818 sub allowMxpFilterImageFlag
23819 { $_[0]->{allowMxpFilterImageFlag} }
23820 sub allowMxpSoundFlag
23821 { $_[0]->{allowMxpSoundFlag} }
23822 sub allowMxpLoadSoundFlag
23823 { $_[0]->{allowMxpLoadSoundFlag} }
23824 sub allowMxpGaugeFlag
23825 { $_[0]->{allowMxpGaugeFlag} }
23826 sub allowMxpFrameFlag
23827 { $_[0]->{allowMxpFrameFlag} }
23828 sub allowMxpInteriorFlag
23829 { $_[0]->{allowMxpInteriorFlag} }
23830 sub allowMxpCrosslinkFlag
23831 { $_[0]->{allowMxpCrosslinkFlag} }
23832 sub allowMxpRoomFlag
23833 { $_[0]->{allowMxpRoomFlag} }
23834 sub allowMxpFlexibleFlag
23835 { $_[0]->{allowMxpFlexibleFlag} }
23836 sub allowMxpPermFlag
23837 { $_[0]->{allowMxpPermFlag} }
23838 sub mxpPreventSupportFlag
23839 { $_[0]->{mxpPreventSupportFlag} }
23840  
23841 sub constPuebloOfficialHash
23842 { my $self = shift; return %{$self->{constPuebloOfficialHash}}; }
23843 sub constPuebloImplementHash
23844 { my $self = shift; return %{$self->{constPuebloImplementHash}}; }
23845 sub constPuebloConvertHash
23846 { my $self = shift; return %{$self->{constPuebloConvertHash}}; }
23847 sub constPuebloModalHash
23848 { my $self = shift; return %{$self->{constPuebloModalHash}}; }
23849  
23850 sub zmpPackageHash
23851 { my $self = shift; return %{$self->{zmpPackageHash}}; }
23852  
23853 sub constMnesCharsetList
23854 { my $self = shift; return @{$self->{constMnesCharsetList}}; }
23855 sub allowMnesSendIPFlag
23856 { $_[0]->{allowMnesSendIPFlag} }
23857  
23858 sub constMcpPackageList
23859 { my $self = shift; return @{$self->{constMcpPackageList}}; }
23860 sub mcpPackageHash
23861 { my $self = shift; return %{$self->{mcpPackageHash}}; }
23862  
23863 sub constTermTypeList
23864 { my $self = shift; return @{$self->{constTermTypeList}}; }
23865 sub termTypeMode
23866 { $_[0]->{termTypeMode} }
23867 sub customClientName
23868 { $_[0]->{customClientName} }
23869 sub customClientVersion
23870 { $_[0]->{customClientVersion} }
23871  
23872 sub useCtrlSeqFlag
23873 { $_[0]->{useCtrlSeqFlag} }
23874 sub useVisibleCursorFlag
23875 { $_[0]->{useVisibleCursorFlag} }
23876 sub useFastCursorFlag
23877 { $_[0]->{useFastCursorFlag} }
23878 sub useDirectKeysFlag
23879 { $_[0]->{useDirectKeysFlag} }
23880 sub constDirectAppKeysHash
23881 { my $self = shift; return %{$self->{constDirectAppKeysHash}}; }
23882 sub constDirectAltKeysHash
23883 { my $self = shift; return %{$self->{constDirectAltKeysHash}}; }
23884 sub constDirectKeysHash
23885 { my $self = shift; return %{$self->{constDirectKeysHash}}; }
23886 sub constDirectSpecialKeysHash
23887 { my $self = shift; return %{$self->{constDirectSpecialKeysHash}}; }
23888  
23889 sub debugEscSequenceFlag
23890 { $_[0]->{debugEscSequenceFlag} }
23891 sub debugTelnetFlag
23892 { $_[0]->{debugTelnetFlag} }
23893 sub debugTelnetMiniFlag
23894 { $_[0]->{debugTelnetMiniFlag} }
23895 sub debugTelnetLogFlag
23896 { $_[0]->{debugTelnetLogFlag} }
23897 sub debugMsdpFlag
23898 { $_[0]->{debugMsdpFlag} }
23899 sub debugMxpFlag
23900 { $_[0]->{debugMxpFlag} }
23901 sub debugMxpCommentFlag
23902 { $_[0]->{debugMxpCommentFlag} }
23903 sub debugPuebloFlag
23904 { $_[0]->{debugPuebloFlag} }
23905 sub debugPuebloCommentFlag
23906 { $_[0]->{debugPuebloCommentFlag} }
23907 sub debugZmpFlag
23908 { $_[0]->{debugZmpFlag} }
23909 sub debugAtcpFlag
23910 { $_[0]->{debugAtcpFlag} }
23911 sub debugGmcpFlag
23912 { $_[0]->{debugGmcpFlag} }
23913 sub debugMcpFlag
23914 { $_[0]->{debugMcpFlag} }
23915  
23916 sub shareMainWinFlag
23917 { $_[0]->{shareMainWinFlag} }
23918 sub restartShareMainWinMode
23919 { $_[0]->{restartShareMainWinMode} }
23920 sub activateGridFlag
23921 { $_[0]->{activateGridFlag} }
23922 sub storeGridPosnFlag
23923 { $_[0]->{storeGridPosnFlag} }
23924 sub storeGridPosnHash
23925 { my $self = shift; return %{$self->{storeGridPosnHash}}; }
23926  
23927 sub constGridWinTypeHash
23928 { my $self = shift; return %{$self->{constGridWinTypeHash}}; }
23929 sub constFreeWinTypeHash
23930 { my $self = shift; return %{$self->{constFreeWinTypeHash}}; }
23931  
23932 sub constWinmapNameHash
23933 { my $self = shift; return %{$self->{constWinmapNameHash}}; }
23934 sub winmapHash
23935 { my $self = shift; return %{$self->{winmapHash}}; }
23936 sub standardWinmapHash
23937 { my $self = shift; return %{$self->{standardWinmapHash}}; }
23938 sub constDefaultEnabledWinmap
23939 { $_[0]->{constDefaultEnabledWinmap} }
23940 sub constDefaultDisabledWinmap
23941 { $_[0]->{constDefaultDisabledWinmap} }
23942 sub constDefaultInternalWinmap
23943 { $_[0]->{constDefaultInternalWinmap} }
23944 sub defaultEnabledWinmap
23945 { $_[0]->{defaultEnabledWinmap} }
23946 sub defaultDisabledWinmap
23947 { $_[0]->{defaultDisabledWinmap} }
23948 sub defaultInternalWinmap
23949 { $_[0]->{defaultInternalWinmap} }
23950  
23951 sub constGridBlockSize
23952 { $_[0]->{constGridBlockSize} }
23953 sub gridBlockSize
23954 { $_[0]->{gridBlockSize} }
23955  
23956 sub constZonemapHash
23957 { my $self = shift; return %{$self->{constZonemapHash}}; }
23958 sub zonemapHash
23959 { my $self = shift; return %{$self->{zonemapHash}}; }
23960 sub standardZonemapHash
23961 { my $self = shift; return %{$self->{standardZonemapHash}}; }
23962 sub constInitWorkspaceHash
23963 { my $self = shift; return %{$self->{constInitWorkspaceHash}}; }
23964 sub initWorkspaceHash
23965 { my $self = shift; return %{$self->{initWorkspaceHash}}; }
23966 sub constInitWorkspaceDir
23967 { $_[0]->{constInitWorkspaceDir} }
23968 sub initWorkspaceDir
23969 { $_[0]->{initWorkspaceDir} }
23970  
23971 sub constGridGapMaxSize
23972 { $_[0]->{constGridGapMaxSize} }
23973 sub gridGapMaxSize
23974 { $_[0]->{gridGapMaxSize} }
23975 sub gridAdjustmentFlag
23976 { $_[0]->{gridAdjustmentFlag} }
23977 sub gridEdgeCorrectionFlag
23978 { $_[0]->{gridEdgeCorrectionFlag} }
23979 sub gridReshuffleFlag
23980 { $_[0]->{gridReshuffleFlag} }
23981 sub gridInvisWinFlag
23982 { $_[0]->{gridInvisWinFlag} }
23983  
23984 sub constWorkspaceMaxWidth
23985 { $_[0]->{constWorkspaceMaxWidth} }
23986 sub constWorkspaceMaxHeight
23987 { $_[0]->{constWorkspaceMaxHeight} }
23988 sub constWorkspaceMinWidth
23989 { $_[0]->{constWorkspaceMinWidth} }
23990 sub constWorkspaceMinHeight
23991 { $_[0]->{constWorkspaceMinHeight} }
23992  
23993 sub constMainWinWidth
23994 { $_[0]->{constMainWinWidth} }
23995 sub constMainWinHeight
23996 { $_[0]->{constMainWinHeight} }
23997 sub customMainWinWidth
23998 { $_[0]->{customMainWinWidth} }
23999 sub customMainWinHeight
24000 { $_[0]->{customMainWinHeight} }
24001 sub constMainBorderPixels
24002 { $_[0]->{constMainBorderPixels} }
24003 sub constMainSpacingPixels
24004 { $_[0]->{constMainSpacingPixels} }
24005  
24006 sub constGridWinWidth
24007 { $_[0]->{constGridWinWidth} }
24008 sub constGridWinHeight
24009 { $_[0]->{constGridWinHeight} }
24010 sub customGridWinWidth
24011 { $_[0]->{customGridWinWidth} }
24012 sub customGridWinHeight
24013 { $_[0]->{customGridWinHeight} }
24014 sub constGridBorderPixels
24015 { $_[0]->{constGridBorderPixels} }
24016 sub constGridSpacingPixels
24017 { $_[0]->{constGridSpacingPixels} }
24018  
24019 sub constFreeWinWidth
24020 { $_[0]->{constFreeWinWidth} }
24021 sub constFreeWinHeight
24022 { $_[0]->{constFreeWinHeight} }
24023 sub customFreeWinWidth
24024 { $_[0]->{customFreeWinWidth} }
24025 sub customFreeWinHeight
24026 { $_[0]->{customFreeWinHeight} }
24027 sub constFreeBorderPixels
24028 { $_[0]->{constFreeBorderPixels} }
24029 sub constFreeSpacingPixels
24030 { $_[0]->{constFreeSpacingPixels} }
24031 sub constDialogueLabelSize
24032 { $_[0]->{constDialogueLabelSize} }
24033  
24034 sub configWinIndexFlag
24035 { $_[0]->{configWinIndexFlag} }
24036 sub configWinSimplifyFlag
24037 { $_[0]->{configWinSimplifyFlag} }
24038 sub constConfigWinIndexWidth
24039 { $_[0]->{constConfigWinIndexWidth} }
24040 sub customConfigWinIndexWidth
24041 { $_[0]->{customConfigWinIndexWidth} }
24042  
24043 sub constPanelSize
24044 { $_[0]->{constPanelSize} }
24045 sub constPanelLeftSize
24046 { $_[0]->{constPanelLeftSize} }
24047 sub constPanelRightSize
24048 { $_[0]->{constPanelRightSize} }
24049 sub constPanelTopSize
24050 { $_[0]->{constPanelTopSize} }
24051 sub constPanelBottomSize
24052 { $_[0]->{constPanelBottomSize} }
24053 sub customPanelLeftSize
24054 { $_[0]->{customPanelLeftSize} }
24055 sub customPanelRightSize
24056 { $_[0]->{customPanelRightSize} }
24057 sub customPanelTopSize
24058 { $_[0]->{customPanelTopSize} }
24059 sub customPanelBottomSize
24060 { $_[0]->{customPanelBottomSize} }
24061  
24062 sub constControlsSize
24063 { $_[0]->{constControlsSize} }
24064 sub constControlsLeftSize
24065 { $_[0]->{constControlsLeftSize} }
24066 sub constControlsRightSize
24067 { $_[0]->{constControlsRightSize} }
24068 sub constControlsTopSize
24069 { $_[0]->{constControlsTopSize} }
24070 sub constControlsBottomSize
24071 { $_[0]->{constControlsBottomSize} }
24072 sub customControlsLeftSize
24073 { $_[0]->{customControlsLeftSize} }
24074 sub customControlsRightSize
24075 { $_[0]->{customControlsRightSize} }
24076 sub customControlsTopSize
24077 { $_[0]->{customControlsTopSize} }
24078 sub customControlsBottomSize
24079 { $_[0]->{customControlsBottomSize} }
24080  
24081 sub mswinWinPosnTweakFlag
24082 { $_[0]->{mswinWinPosnTweakFlag} }
24083  
24084 sub constTextColour
24085 { $_[0]->{constTextColour} }
24086 sub constUnderlayColour
24087 { $_[0]->{constUnderlayColour} }
24088 sub constBackgroundColour
24089 { $_[0]->{constBackgroundColour} }
24090 sub constFont
24091 { $_[0]->{constFont} }
24092 sub constFontSize
24093 { $_[0]->{constFontSize} }
24094 sub constPuebloLinkColour
24095 { $_[0]->{constPuebloLinkColour} }
24096 sub colourSchemeHash
24097 { my $self = shift; return %{$self->{colourSchemeHash}}; }
24098  
24099 sub constInsertCmdColour
24100 { $_[0]->{constInsertCmdColour} }
24101 sub constShowSystemTextColour
24102 { $_[0]->{constShowSystemTextColour} }
24103 sub constShowErrorColour
24104 { $_[0]->{constShowErrorColour} }
24105 sub constShowWarningColour
24106 { $_[0]->{constShowWarningColour} }
24107 sub constShowDebugColour
24108 { $_[0]->{constShowDebugColour} }
24109 sub constShowImproperColour
24110 { $_[0]->{constShowImproperColour} }
24111 sub customInsertCmdColour
24112 { $_[0]->{customInsertCmdColour} }
24113 sub customShowSystemTextColour
24114 { $_[0]->{customShowSystemTextColour} }
24115 sub customShowErrorColour
24116 { $_[0]->{customShowErrorColour} }
24117 sub customShowWarningColour
24118 { $_[0]->{customShowWarningColour} }
24119 sub customShowDebugColour
24120 { $_[0]->{customShowDebugColour} }
24121 sub customShowImproperColour
24122 { $_[0]->{customShowImproperColour} }
24123  
24124 sub convertInvisibleFlag
24125 { $_[0]->{convertInvisibleFlag} }
24126 sub constTextBufferSize
24127 { $_[0]->{constTextBufferSize} }
24128 sub customTextBufferSize
24129 { $_[0]->{customTextBufferSize} }
24130  
24131 sub constNormalCursor
24132 { $_[0]->{constNormalCursor} }
24133 sub constWWWCursor
24134 { $_[0]->{constWWWCursor} }
24135 sub constPromptCursor
24136 { $_[0]->{constPromptCursor} }
24137 sub constPopupCursor
24138 { $_[0]->{constPopupCursor} }
24139 sub constCmdCursor
24140 { $_[0]->{constCmdCursor} }
24141 sub constMailCursor
24142 { $_[0]->{constMailCursor} }
24143 sub constTelnetCursor
24144 { $_[0]->{constTelnetCursor} }
24145 sub constMapCursor
24146 { $_[0]->{constMapCursor} }
24147 sub constMapAddCursor
24148 { $_[0]->{constMapAddCursor} }
24149 sub constMapConnectCursor
24150 { $_[0]->{constMapConnectCursor} }
24151 sub constMapMergeCursor
24152 { $_[0]->{constMapMergeCursor} }
24153  
24154 sub constUpIconPath
24155 { $_[0]->{constUpIconPath} }
24156 sub constDownIconPath
24157 { $_[0]->{constDownIconPath} }
24158 sub constResetIconPath
24159 { $_[0]->{constResetIconPath} }
24160 sub constCaseIconPath
24161 { $_[0]->{constCaseIconPath} }
24162 sub constRegexIconPath
24163 { $_[0]->{constRegexIconPath} }
24164 sub constDivideIconPath
24165 { $_[0]->{constDivideIconPath} }
24166 sub constWipeIconPath
24167 { $_[0]->{constWipeIconPath} }
24168 sub constAddIconPath
24169 { $_[0]->{constAddIconPath} }
24170 sub constEmptyIconPath
24171 { $_[0]->{constEmptyIconPath} }
24172 sub constSystemIconPath
24173 { $_[0]->{constSystemIconPath} }
24174 sub constDebugIconPath
24175 { $_[0]->{constDebugIconPath} }
24176 sub constErrorIconPath
24177 { $_[0]->{constErrorIconPath} }
24178 sub constMultiIconPath
24179 { $_[0]->{constMultiIconPath} }
24180 sub constSearchIconPath
24181 { $_[0]->{constSearchIconPath} }
24182 sub constCancelIconPath
24183 { $_[0]->{constCancelIconPath} }
24184 sub constSwitchIconPath
24185 { $_[0]->{constSwitchIconPath} }
24186 sub constSplitIconPath
24187 { $_[0]->{constSplitIconPath} }
24188 sub constRestoreIconPath
24189 { $_[0]->{constRestoreIconPath} }
24190 sub constScrollIconPath
24191 { $_[0]->{constScrollIconPath} }
24192 sub constLockIconPath
24193 { $_[0]->{constLockIconPath} }
24194  
24195 sub constIconSizeList
24196 { my $self = shift; return @{$self->{constIconSizeList}}; }
24197  
24198 sub constShadowType
24199 { $_[0]->{constShadowType} }
24200  
24201 sub constStripHash
24202 { my $self = shift; return %{$self->{constStripHash}}; }
24203 sub customStripHash
24204 { my $self = shift; return %{$self->{customStripHash}}; }
24205 sub constTableHash
24206 { my $self = shift; return %{$self->{constTableHash}}; }
24207 sub customTableHash
24208 { my $self = shift; return %{$self->{customTableHash}}; }
24209  
24210 sub constToolbarList
24211 { my $self = shift; return @{$self->{constToolbarList}}; }
24212 sub toolbarHash
24213 { my $self = shift; return %{$self->{toolbarHash}}; }
24214 sub toolbarList
24215 { my $self = shift; return @{$self->{toolbarList}}; }
24216  
24217 sub constLinuxCmdList
24218 { my $self = shift; return @{$self->{constLinuxCmdList}}; }
24219 sub constMSWinCmdList
24220 { my $self = shift; return @{$self->{constMSWinCmdList}}; }
24221 sub constBSDCmdList
24222 { my $self = shift; return @{$self->{constBSDCmdList}}; }
24223 sub browserCmd
24224 { $_[0]->{browserCmd} }
24225 sub emailCmd
24226 { $_[0]->{emailCmd} }
24227 sub audioCmd
24228 { $_[0]->{audioCmd} }
24229 sub textEditCmd
24230 { $_[0]->{textEditCmd} }
24231  
24232 sub constSoundFormatHash
24233 { my $self = shift; return %{$self->{constSoundFormatHash}}; }
24234 sub allowSoundFlag
24235 { $_[0]->{allowSoundFlag} }
24236 sub allowAsciiBellFlag
24237 { $_[0]->{allowAsciiBellFlag} }
24238 sub constStandardSoundHash
24239 { my $self = shift; return %{$self->{constStandardSoundHash}}; }
24240 sub constExtendedSoundHash
24241 { my $self = shift; return %{$self->{constExtendedSoundHash}}; }
24242 sub customSoundHash
24243 { my $self = shift; return %{$self->{customSoundHash}}; }
24244  
24245 sub customAllowTTSFlag
24246 { $_[0]->{customAllowTTSFlag} }
24247 sub systemAllowTTSFlag
24248 { $_[0]->{systemAllowTTSFlag} }
24249 sub forceTTSEngine
24250 { $_[0]->{forceTTSEngine} }
24251 sub constTTSList
24252 { my $self = shift; return @{$self->{constTTSList}}; }
24253 sub constTTSCompatList
24254 { my $self = shift; return @{$self->{constTTSCompatList}}; }
24255 sub ttsSmoothFlag
24256 { $_[0]->{ttsSmoothFlag} }
24257  
24258 sub ttsJobList
24259 { my $self = shift; return @{$self->{ttsJobList}}; }
24260 sub ttsJobMax
24261 { $_[0]->{ttsJobMax} }
24262 sub ttsUrgentJobList
24263 { my $self = shift; return @{$self->{ttsUrgentJobList}}; }
24264 sub ttsJobMode
24265 { $_[0]->{ttsJobMode} }
24266 sub ttsJobPointer
24267 { $_[0]->{ttsJobPointer} }
24268 sub ttsJobMiniPointer
24269 { $_[0]->{ttsJobMiniPointer} }
24270 sub ttsJobAutoFlag
24271 { $_[0]->{ttsJobAutoFlag} }
24272 sub ttsJobOnceFlag
24273 { $_[0]->{ttsJobOnceFlag} }
24274 sub ttsChangeModeFlag
24275 { $_[0]->{ttsChangeModeFlag} }
24276 sub ttsCurrentHarness
24277 { $_[0]->{ttsCurrentHarness} }
24278  
24279 sub ttsHijackKeycodeHash
24280 { my $self = shift; return %{$self->{ttsHijackKeycodeHash}}; }
24281 sub ttsHijackFlag
24282 { $_[0]->{ttsHijackFlag} }
24283 sub ttsForceHijackFlag
24284 { $_[0]->{ttsForceHijackFlag} }
24285  
24286 sub constTtsDefaultList
24287 { my $self = shift; return @{$self->{constTtsDefaultList}}; }
24288 sub constTtsObjHash
24289 { my $self = shift; return %{$self->{constTtsObjHash}}; }
24290 sub constTtsPermObjHash
24291 { my $self = shift; return %{$self->{constTtsPermObjHash}}; }
24292 sub constTtsFixedObjHash
24293 { my $self = shift; return %{$self->{constTtsFixedObjHash}}; }
24294 sub ttsObjHash
24295 { my $self = shift; return %{$self->{ttsObjHash}}; }
24296  
24297 sub constTtsAttribHash
24298 { my $self = shift; return %{$self->{constTtsAttribHash}}; }
24299 sub ttsAttribHash
24300 { my $self = shift; return %{$self->{ttsAttribHash}}; }
24301 sub constTtsFlagAttribHash
24302 { my $self = shift; return %{$self->{constTtsFlagAttribHash}}; }
24303 sub ttsFlagAttribHash
24304 { my $self = shift; return %{$self->{ttsFlagAttribHash}}; }
24305 sub constTtsAlertAttribHash
24306 { my $self = shift; return %{$self->{constTtsAlertAttribHash}}; }
24307 sub ttsAlertAttribHash
24308 { my $self = shift; return %{$self->{ttsAlertAttribHash}}; }
24309  
24310 sub ttsReceiveFlag
24311 { $_[0]->{ttsReceiveFlag} }
24312 sub ttsLoginFlag
24313 { $_[0]->{ttsLoginFlag} }
24314 sub ttsPromptFlag
24315 { $_[0]->{ttsPromptFlag} }
24316 sub ttsSystemFlag
24317 { $_[0]->{ttsSystemFlag} }
24318 sub ttsSystemErrorFlag
24319 { $_[0]->{ttsSystemErrorFlag} }
24320 sub ttsWorldCmdFlag
24321 { $_[0]->{ttsWorldCmdFlag} }
24322 sub ttsDialogueFlag
24323 { $_[0]->{ttsDialogueFlag} }
24324 sub ttsTaskFlag
24325 { $_[0]->{ttsTaskFlag} }
24326 sub ttsVerboseFlag
24327 { $_[0]->{ttsVerboseFlag} }
24328  
24329 sub ttsLastPrompt
24330 { $_[0]->{ttsLastPrompt} }
24331  
24332 sub msWinPathESpeak
24333 { $_[0]->{msWinPathESpeak} }
24334 sub msWinAltPathESpeak
24335 { $_[0]->{msWinAltPathESpeak} }
24336 sub msWinPathESNG
24337 { $_[0]->{msWinPathESNG} }
24338 sub msWinPathFestival
24339 { $_[0]->{msWinPathFestival} }
24340 sub msWinPathSwift
24341 { $_[0]->{msWinPathSwift} }
24342  
24343 sub constTtsFestivalServerPort
24344 { $_[0]->{constTtsFestivalServerPort} }
24345 sub ttsFestivalServerPort
24346 { $_[0]->{ttsFestivalServerPort} }
24347 sub ttsFestivalFirstFlag
24348 { $_[0]->{ttsFestivalFirstFlag} }
24349 sub ttsFestivalServerMode
24350 { $_[0]->{ttsFestivalServerMode} }
24351 sub ttsFestivalConnectMode
24352 { $_[0]->{ttsFestivalConnectMode} }
24353 sub ttsFestivalSocket
24354 { $_[0]->{ttsFestivalSocket} }
24355 sub ttsFestivalRequestList
24356 { my $self = shift; return @{$self->{ttsFestivalRequestList}}; }
24357 sub ttsFestivalCheckTime
24358 { $_[0]->{ttsFestivalCheckTime} }
24359 sub ttsFestivalStopTime
24360 { $_[0]->{ttsFestivalStopTime} }
24361 sub ttsFestivalFailFlag
24362 { $_[0]->{ttsFestivalFailFlag} }
24363 sub ttsFestivalSuccessFlag
24364 { $_[0]->{ttsFestivalSuccessFlag} }
24365  
24366 sub blindHelpMsgShownFlag
24367 { $_[0]->{blindHelpMsgShownFlag} }
24368  
24369 sub constMonthList
24370 { my $self = shift; return @{$self->{constMonthList}}; }
24371 sub customMonthList
24372 { my $self = shift; return @{$self->{customMonthList}}; }
24373 sub constDayList
24374 { my $self = shift; return @{$self->{constDayList}}; }
24375 sub customDayList
24376 { my $self = shift; return @{$self->{customDayList}}; }
24377 sub constRomanHash
24378 { my $self = shift; return %{$self->{constRomanHash}}; }
24379  
24380 sub constIPLookupList
24381 { my $self = shift; return @{$self->{constIPLookupList}}; }
24382 sub ipLookupList
24383 { my $self = shift; return @{$self->{ipLookupList}}; }
24384 sub currentIP
24385 { $_[0]->{currentIP} }
24386  
24387 sub constHelpCharLimit
24388 { $_[0]->{constHelpCharLimit} }
24389  
24390 sub startTime
24391 { $_[0]->{startTime} }
24392 sub startClock
24393 { $_[0]->{startClock} }
24394 sub startDate
24395 { $_[0]->{startDate} }
24396 sub startClockString
24397 { $_[0]->{startClockString} }
24398 sub startDateString
24399 { $_[0]->{startDateString} }
24400  
24401 sub constPromptWaitTime
24402 { $_[0]->{constPromptWaitTime} }
24403 sub promptWaitTime
24404 { $_[0]->{promptWaitTime} }
24405 sub constLoginWarningTime
24406 { $_[0]->{constLoginWarningTime} }
24407 sub loginWarningTime
24408 { $_[0]->{loginWarningTime} }
24409  
24410 sub toolbarLabelFlag
24411 { $_[0]->{toolbarLabelFlag} }
24412 sub irreversibleIconFlag
24413 { $_[0]->{irreversibleIconFlag} }
24414 sub allowBusyWinFlag
24415 { $_[0]->{allowBusyWinFlag} }
24416 sub mainWinSystemMsgFlag
24417 { $_[0]->{mainWinSystemMsgFlag} }
24418 sub mainWinUrgencyFlag
24419 { $_[0]->{mainWinUrgencyFlag} }
24420 sub mainWinTooltipFlag
24421 { $_[0]->{mainWinTooltipFlag} }
24422  
24423 sub commifyMode
24424 { $_[0]->{commifyMode} }
24425  
24426 sub tempUrgencyFlag
24427 { $_[0]->{tempUrgencyFlag} }
24428 sub tempSoundFlag
24429 { $_[0]->{tempSoundFlag} }
24430  
24431 sub constUrlRegex
24432 { $_[0]->{constUrlRegex} }
24433 sub constShortUrlRegex
24434 { $_[0]->{constShortUrlRegex} }
24435 sub shortUrlFlag
24436 { $_[0]->{shortUrlFlag} }
24437 sub constEmailRegex
24438 { $_[0]->{constEmailRegex} }
24439  
24440 sub privConfigAllWorld
24441 { $_[0]->{privConfigAllWorld} }
24442  
24443 sub benchMarkTime
24444 { $_[0]->{benchMarkTime} }
24445 sub benchMarkShortList
24446 { my $self = shift; return @{$self->{benchMarkShortList}}; }
24447 sub benchMarkLongList
24448 { my $self = shift; return @{$self->{benchMarkLongList}}; }
24449  
24450 sub debugLineNumsFlag
24451 { $_[0]->{debugLineNumsFlag} }
24452 sub debugLineTagsFlag
24453 { $_[0]->{debugLineTagsFlag} }
24454 sub debugLocatorFlag
24455 { $_[0]->{debugLocatorFlag} }
24456 sub debugExitFlag
24457 { $_[0]->{debugExitFlag} }
24458 sub debugMaxLocatorFlag
24459 { $_[0]->{debugMaxLocatorFlag} }
24460 sub debugMoveListFlag
24461 { $_[0]->{debugMoveListFlag} }
24462 sub debugParseObjFlag
24463 { $_[0]->{debugParseObjFlag} }
24464 sub debugCompareObjFlag
24465 { $_[0]->{debugCompareObjFlag} }
24466 sub debugExplainPluginFlag
24467 { $_[0]->{debugExplainPluginFlag} }
24468 sub debugCheckIVFlag
24469 { $_[0]->{debugCheckIVFlag} }
24470 sub debugTableFitFlag
24471 { $_[0]->{debugTableFitFlag} }
24472 sub debugTrapErrorFlag
24473 { $_[0]->{debugTrapErrorFlag} }
24474  
24475 sub allowSetupWizWinFlag
24476 { $_[0]->{allowSetupWizWinFlag} }
24477 sub showSetupWizWinFlag
24478 { $_[0]->{showSetupWizWinFlag} }
24479 sub blockWorldHintFlag
24480 { $_[0]->{blockWorldHintFlag} }
24481 }
24482  
24483 # Package must return a true value
24484 1