/
methods_info.cpp
1836 lines (1531 loc) · 57.2 KB
/
methods_info.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// methods_info.cpp
// General "information" methods
#include "stdafx.h"
#include "..\..\MUSHclient.h"
#include "..\..\doc.h"
#include "..\..\MUSHview.h"
#include "..\..\mainfrm.h"
#include "..\..\childfrm.h"
#include "..\..\sendvw.h"
#include "..\..\winplace.h"
#include "..\..\png\png.h"
#include "..\errors.h"
#include <direct.h>
// Implements:
// ErrorDesc
// GetConnectDuration
// GetDeviceCaps
// GetGlobalOption
// GetGlobalOptionList
// GetHostAddress
// GetHostName
// GetInfo
// GetLineCount
// GetLineInfo
// GetLinesInBufferCount
// GetMainWindowPosition
// GetNotes
// GetReceivedBytes
// GetScriptTime
// GetSelectionEndColumn
// GetSelectionEndLine
// GetSelectionStartColumn
// GetSelectionStartLine
// GetSentBytes
// GetStyleInfo
// GetSysColor
// GetSystemMetrics
// GetWorldID
// GetWorldWindowPosition
// IsConnected
// Version
// WorldAddress
// WorldName
// WorldPort
extern char working_dir [_MAX_PATH];
extern char file_browsing_dir [_MAX_PATH];
// world.GetLineCount - returns the count of lines received by this world
long CMUSHclientDoc::GetLineCount()
{
return m_total_lines;
} // end of CMUSHclientDoc::GetLineCount
// world.IsConnected - returns true if the world is open
BOOL CMUSHclientDoc::IsConnected()
{
return m_iConnectPhase == eConnectConnectedToMud;
} // end of CMUSHclientDoc::IsConnected
// world.worldname - returns the name of the current world
BSTR CMUSHclientDoc::WorldName()
{
CString strResult;
strResult = m_mush_name;
return strResult.AllocSysString();
} // end of CMUSHclientDoc::WorldName
// world.version - returns MUSHclient version
BSTR CMUSHclientDoc::Version()
{
CString strResult = MUSHCLIENT_VERSION;
return strResult.AllocSysString();
} // end of CMUSHclientDoc::Version
tInfoTypeMapping InfoTypes [] =
{
// (strings - configuration)
{ 1, "Server name" },
{ 2, "World name" },
{ 3, "Character name" },
{ 4, "Send to world - file preamble" },
{ 5, "Send to world - file postamble" },
{ 6, "Send to world - line preamble" },
{ 7, "Send to world - line postamble" },
{ 8, "World notes" },
{ 9, "Sound on new activity" },
{ 10, "Scripts editor" },
{ 11, "Log file preamble" },
{ 12, "Log file postamble" },
{ 13, "Log file line preamble - player input" },
{ 14, "Log file line preamble - notes" },
{ 15, "Log file line preamble - MUD output" },
{ 16, "Log file line postamble - player input" },
{ 17, "Log file line postamble - notes" },
{ 18, "Log file line postamble - MUD output" },
{ 19, "Speed Walk Filler" },
{ 20, "Output window font name" },
{ 21, "Speed walk prefix" },
{ 22, "Text sent on connecting" },
{ 23, "Input font name" },
{ 24, "Paste to world - file preamble" },
{ 25, "Paste to world - file postamble" },
{ 26, "Paste to world - line preamble" },
{ 27, "Paste to world - line postamble" },
{ 28, "Scripting language" },
{ 29, "Script function for world open" },
{ 30, "Script function for world close" },
{ 31, "Script function for world connect" },
{ 32, "Script function for world disconnect" },
{ 31, "Script function for world get focus" },
{ 32, "Script function for world lose focus" },
{ 35, "Script file name" },
{ 36, "Scripting prefix" },
{ 37, "Auto-say string" },
{ 38, "Auto-say override" },
{ 39, "Tab-completion defaults" },
{ 40, "Auto-log file name" },
{ 41, "Recall window - line preamble" },
{ 42, "Terminal ID (telnet negotiation)" },
{ 43, "Mapping failure message" },
{ 44, "Script function for MXP starting up" },
{ 45, "Script function for MXP closing down" },
{ 46, "Script function for MXP error" },
{ 47, "Script function for MXP tag open" },
{ 48, "Script function for MXP tag close" },
{ 49, "Script function for MXP variable set" },
{ 50, "Sound to play for beeps" },
// (strings - calculated at runtime)
{ 51, "Current log file name" },
{ 52, "Last \"immediate\" script expression" },
{ 53, "Current status line message" },
{ 54, "World file pathname" },
{ 55, "World title" },
{ 56, "MUSHclient application path name" },
{ 57, "World files default path (directory)" },
{ 58, "Log files default path (directory)" },
{ 59, "Script files default path (directory)" },
{ 60, "Plugin files default path (directory)" },
{ 61, "World IP address" },
{ 62, "Proxy server IP address" },
{ 63, "Host name (name of this PC)" },
{ 64, "Current directory path" },
{ 65, "Script function for world save" },
{ 66, "MUSHclient application directory" },
{ 67, "World file directory" },
{ 68, "Startup directory" },
{ 69, "Translation file" },
{ 70, "Locale" },
{ 71, "Fixed Pitch Font" },
{ 72, "MUSHclient version" },
{ 73, "MUSHclient compilation date/time" },
{ 74, "Sounds directory" },
{ 75, "Last telnet subnegotiation string received" },
{ 76, "Special font pathname" },
{ 77, "OS Version - service pack" },
{ 78, "Foreground image filename" },
{ 79, "Background image filename" },
{ 80, "LibPNG version number" },
{ 81, "LibPNG header version string" },
{ 82, "Preferences database pathname" },
{ 83, "SQLite3 version" },
{ 84, "File browsing directory" },
{ 85, "State files path (directory)" },
{ 86, "Word under mouse on mouse menu click" },
{ 87, "Last command sent" },
{ 88, "Window title last set by SetTitle" },
{ 89, "Window title last set by SetMainTitle" },
// (booleans - calculated at runtime)
{ 101, "No Echo" },
{ 102, "Debug incoming packets" },
{ 103, "Decompressing" },
{ 104, "MXP active" },
{ 105, "Pueblo active" },
{ 106, "World close flag" },
{ 107, "Currently-connecting" },
{ 108, "OK-to-disconnect" },
{ 109, "Trace" },
{ 110, "Script file changed" },
{ 111, "World file is modified" },
{ 112, "Automapper active" },
{ 113, "World is active" },
{ 114, "Output window paused" },
{ 115, "Localization active" },
{ 118, "Variables have changed" },
{ 119, "Script engine active" },
{ 120, "Scroll bar visible" },
{ 121, "High-resolution timer available" },
{ 122, "SQLite3 is thread-safe" },
// (numbers (longs) - calculated at runtime)
{ 201, "Total lines received" },
{ 202, "Lines received but not yet seen (new lines)" },
{ 203, "Total lines sent" },
{ 204, "Packets received" },
{ 205, "Packets sent" },
{ 206, "Total uncompressed bytes received" },
{ 207, "Total compresssed bytes received" },
{ 208, "MCCP protocol in use (0=none, 1 or 2)" },
{ 209, "MXP error count" },
{ 210, "MXP tags received" },
{ 211, "MXP entities received" },
{ 212, "Output font height" },
{ 213, "Output font width" },
{ 214, "Input font height" },
{ 215, "Input font width" },
{ 216, "Total bytes received" },
{ 217, "Total bytes sent" },
{ 218, "Count of variables" },
{ 219, "Count of triggers" },
{ 220, "Count of timers" },
{ 221, "Count of aliases" },
{ 222, "Count of queued commands" },
{ 223, "Count of mapper items" },
{ 224, "Count of lines in output window" },
{ 225, "Count of custom MXP elements" },
{ 226, "Count of custom MXP entities" },
{ 227, "Connect phase" },
{ 228, "World IP address (as long)" },
{ 229, "Proxy server IP address (as long)" },
{ 230, "Script execution depth" },
{ 231, "Log file size" },
{ 232, "High-performance timer" }, // double
{ 233, "Trigger execution time" }, // double
{ 234, "Alias execution time" }, // double
{ 235, "Number of world windows" },
{ 236, "Command window start selection column" },
{ 237, "Command window end selection column" },
{ 238, "World window display flags" },
{ 239, "Source of current action" },
{ 240, "Average character width in output window" },
{ 241, "Font height in output window" },
{ 242, "Number of lines received with bad UTF-8 in them" },
{ 243, "Fixed Pitch Font Size" },
{ 244, "Count of triggers evaluated" },
{ 245, "Count of triggers matched" },
{ 246, "Count of aliases evaluated" },
{ 247, "Count of aliases matched" },
{ 248, "Count of timers fired" },
{ 249, "Main frame window height" },
{ 250, "Main frame window width" },
{ 251, "Main toolbar window height" },
{ 252, "Main toolbar window width" },
{ 253, "Game toolbar window height" },
{ 254, "Game toolbar window width" },
{ 255, "Activity toolbar window height" },
{ 256, "Activity toolbar window width" },
{ 257, "Info bar window height" },
{ 258, "Info bar window width" },
{ 259, "Status bar window height" },
{ 260, "Status bar window width" },
{ 261, "World window non-client height" },
{ 262, "World window non-client width" },
{ 263, "World window client height" },
{ 264, "World window client width" },
{ 265, "OS Version - major" },
{ 266, "OS Version - minor" },
{ 267, "OS Version - build number" },
{ 268, "OS Version - platform ID" },
{ 269, "Foreground image mode" },
{ 270, "Background image mode" },
{ 271, "Background colour" },
{ 272, "Text rectangle - left" },
{ 273, "Text rectangle - top" },
{ 274, "Text rectangle - right" },
{ 275, "Text rectangle - bottom" },
{ 276, "Text rectangle - border offset" },
{ 277, "Text rectangle - border width" },
{ 278, "Text rectangle - outside colour" },
{ 279, "Text rectangle - outside style" },
{ 280, "Output window client height" },
{ 281, "Output window client width" },
{ 282, "Text rectangle - border colour" },
{ 283, "Mouse position - X" },
{ 284, "Mouse position - Y" },
{ 285, "Output window available" },
{ 286, "Triggers matched this session" },
{ 287, "Aliases matched this session" },
{ 288, "Timers fired this session" },
{ 289, "Last line with IAC/GA or IAC/EOR in it" },
{ 290, "Actual text rectangle - left" },
{ 291, "Actual text rectangle - top" },
{ 292, "Actual text rectangle - right" },
{ 293, "Actual text rectangle - bottom" },
{ 294, "State of keyboard modifiers" },
{ 295, "Times output window redrawn" },
{ 296, "Output window scroll bar position" },
{ 297, "High-resolution timer frequency" },
{ 298, "SQLite3 version number" },
{ 299, "ANSI code-page number" },
{ 300, "OEM code-page number" },
// (dates - calculated at runtime)
{ 301, "Time connected" },
{ 302, "Time log file was last flushed to disk" },
{ 303, "When script file was last modified" },
{ 304, "Time now" },
{ 305, "When client started executing" },
{ 306, "When this world was created/opened" },
// more numbers
{ 310, "Newlines received" },
{ 0, "" }, // end of table marker
};
static void GetWindowWidth (CWnd * pWnd, VARIANT & vaResult, const bool client = false )
{
RECT rect;
if (pWnd->m_hWnd)
{
if (client)
pWnd->GetClientRect(&rect);
else
{
pWnd->GetWindowRect(&rect);
pWnd->ScreenToClient (&rect);
}
}
else
rect.right = -1;
VariantClear (&vaResult);
vaResult.vt = VT_I4;
vaResult.lVal = rect.right;
} // end of GetWindowWidth
static void GetWindowHeight (CWnd * pWnd, VARIANT & vaResult, const bool client = false )
{
RECT rect;
rect.left = 0;
rect.top = 0;
rect.right = 0;
rect.bottom = 0;
if (pWnd->m_hWnd)
{
if (client)
pWnd->GetClientRect(&rect);
else
{
pWnd->GetWindowRect(&rect);
pWnd->ScreenToClient (&rect);
}
}
else
rect.right = -1;
VariantClear (&vaResult);
vaResult.vt = VT_I4;
vaResult.lVal = rect.bottom;
} // end of GetWindowHeight
// helper function
CMUSHView * CMUSHclientDoc::GetFirstOutputWindow ()
{
for(POSITION pos = GetFirstViewPosition(); pos != NULL; )
{
CView* pView = GetNextView(pos);
if (pView->IsKindOf(RUNTIME_CLASS(CMUSHView)))
return (CMUSHView*)pView;
} // end of loop through views
return NULL; // not found
} // end of CMUSHclientDoc::GetFirstOutputWindow
VARIANT CMUSHclientDoc::GetInfo(long InfoType)
{
VARIANT vaResult;
VariantInit(&vaResult);
vaResult.vt = VT_EMPTY; // in case dates are zero
switch (InfoType)
{
case 1: SetUpVariantString (vaResult, m_server); break;
case 2: SetUpVariantString (vaResult, m_mush_name); break;
case 3: SetUpVariantString (vaResult, m_name); break;
case 4: SetUpVariantString (vaResult, m_file_preamble); break;
case 5: SetUpVariantString (vaResult, m_file_postamble); break;
case 6: SetUpVariantString (vaResult, m_line_preamble); break;
case 7: SetUpVariantString (vaResult, m_line_postamble); break;
case 8: SetUpVariantString (vaResult, m_notes); break;
case 9: SetUpVariantString (vaResult, m_new_activity_sound); break;
case 10: SetUpVariantString (vaResult, m_strScriptEditor); break;
case 11: SetUpVariantString (vaResult, m_strLogFilePreamble); break;
case 12: SetUpVariantString (vaResult, m_strLogFilePostamble); break;
case 13: SetUpVariantString (vaResult, m_strLogLinePreambleInput); break;
case 14: SetUpVariantString (vaResult, m_strLogLinePreambleNotes); break;
case 15: SetUpVariantString (vaResult, m_strLogLinePreambleOutput); break;
case 16: SetUpVariantString (vaResult, m_strLogLinePostambleInput); break;
case 17: SetUpVariantString (vaResult, m_strLogLinePostambleNotes); break;
case 18: SetUpVariantString (vaResult, m_strLogLinePostambleOutput); break;
case 19: SetUpVariantString (vaResult, m_strSpeedWalkFiller); break;
case 20: SetUpVariantString (vaResult, m_font_name); break;
case 21: SetUpVariantString (vaResult, m_speed_walk_prefix); break;
case 22: SetUpVariantString (vaResult, m_connect_text); break;
case 23: SetUpVariantString (vaResult, m_input_font_name); break;
case 24: SetUpVariantString (vaResult, m_paste_postamble); break;
case 25: SetUpVariantString (vaResult, m_paste_preamble); break;
case 26: SetUpVariantString (vaResult, m_pasteline_postamble); break;
case 27: SetUpVariantString (vaResult, m_pasteline_preamble); break;
case 28: SetUpVariantString (vaResult, m_strLanguage); break;
case 29: SetUpVariantString (vaResult, m_strWorldOpen); break;
case 30: SetUpVariantString (vaResult, m_strWorldClose); break;
case 31: SetUpVariantString (vaResult, m_strWorldConnect); break;
case 32: SetUpVariantString (vaResult, m_strWorldDisconnect); break;
case 33: SetUpVariantString (vaResult, m_strWorldGetFocus); break;
case 34: SetUpVariantString (vaResult, m_strWorldLoseFocus); break;
case 35: SetUpVariantString (vaResult, m_strScriptFilename); break;
case 36: SetUpVariantString (vaResult, m_strScriptPrefix); break;
case 37: SetUpVariantString (vaResult, m_strAutoSayString); break;
case 38: SetUpVariantString (vaResult, m_strOverridePrefix); break;
case 39: SetUpVariantString (vaResult, m_strTabCompletionDefaults); break;
case 40: SetUpVariantString (vaResult, m_strAutoLogFileName); break;
case 41: SetUpVariantString (vaResult, m_strRecallLinePreamble); break;
case 42: SetUpVariantString (vaResult, m_strTerminalIdentification); break;
case 43: SetUpVariantString (vaResult, m_strMappingFailure); break;
case 44: SetUpVariantString (vaResult, m_strOnMXP_Start); break;
case 45: SetUpVariantString (vaResult, m_strOnMXP_Stop); break;
case 46: SetUpVariantString (vaResult, m_strOnMXP_Error); break;
case 47: SetUpVariantString (vaResult, m_strOnMXP_OpenTag); break;
case 48: SetUpVariantString (vaResult, m_strOnMXP_CloseTag); break;
case 49: SetUpVariantString (vaResult, m_strOnMXP_SetVariable); break;
case 50: SetUpVariantString (vaResult, m_strBeepSound); break;
case 51: SetUpVariantString (vaResult, m_logfile_name); break;
case 52: SetUpVariantString (vaResult, m_strLastImmediateExpression); break;
case 53: SetUpVariantString (vaResult, m_strStatusMessage); break;
case 54: SetUpVariantString (vaResult, GetPathName ()); break;
case 55: SetUpVariantString (vaResult, GetTitle ()); break;
case 56: SetUpVariantString (vaResult, App.m_strMUSHclientFileName); break;
case 57: SetUpVariantString (vaResult, App.m_strDefaultWorldFileDirectory); break;
case 58: SetUpVariantString (vaResult, App.m_strDefaultLogFileDirectory); break;
case 59: // scripts are in the execution directory at present
{
char fullfilename[MAX_PATH];
char * p;
GetModuleFileName (NULL, fullfilename, sizeof (fullfilename));
p = strrchr (fullfilename, '\\');
if (p)
*p = 0;
SetUpVariantString (vaResult, fullfilename);
break;
}
case 60: SetUpVariantString (vaResult, App.m_strPluginsDirectory); break;
case 61: SetUpVariantString (vaResult, inet_ntoa (m_sockAddr.sin_addr)); break;
case 62: SetUpVariantString (vaResult, inet_ntoa (m_ProxyAddr.sin_addr)); break;
case 63:
{
char szHostName[256];
if( gethostname(szHostName, sizeof szHostName) == 0 )
SetUpVariantString (vaResult, szHostName);
}
break;
case 64: // current directory
{
char * p = _getcwd (NULL, 1024);
if (p)
{
CString strPath (p);
free (p);
if (strPath.Right (1) != "\\")
strPath += "\\"; // append trailing backslash
SetUpVariantString (vaResult, strPath);
}
}
break;
case 65: SetUpVariantString (vaResult, m_strWorldSave); break;
case 66: SetUpVariantString (vaResult, ExtractDirectory (App.m_strMUSHclientFileName)); break;
case 67: SetUpVariantString (vaResult, ExtractDirectory (GetPathName ())); break;
case 68: SetUpVariantString (vaResult, working_dir); break;
case 69: SetUpVariantString (vaResult, App.m_strTranslatorFile); break;
case 70: SetUpVariantString (vaResult, App.m_strLocale); break;
case 71: SetUpVariantString (vaResult, App.m_strFixedPitchFont); break;
case 72: SetUpVariantString (vaResult, MUSHCLIENT_VERSION); break;
case 73: SetUpVariantString (vaResult, __DATE__ " " __TIME__); break;
case 74: SetUpVariantString (vaResult, ExtractDirectory (App.m_strMUSHclientFileName) + "sounds\\"); break;
case 75: SetUpVariantString (vaResult, m_IAC_subnegotiation_data.c_str ()); break;
case 76:
{
// for backwards compatibility, return the first special font
ci_set::const_iterator iter = m_strSpecialFontName.begin ();
if (iter != m_strSpecialFontName.end ())
SetUpVariantString (vaResult, iter->c_str ());
else
SetUpVariantString (vaResult, "");
break;
}
case 77: SetUpVariantString (vaResult, os_version.szCSDVersion); break;
case 78: SetUpVariantString (vaResult, m_strForegroundImageName); break;
case 79: SetUpVariantString (vaResult, m_strBackgroundImageName); break;
case 80: SetUpVariantString (vaResult, PNG_LIBPNG_VER_STRING); break;
case 81: SetUpVariantString (vaResult, PNG_HEADER_VERSION_STRING); break;
case 82: SetUpVariantString (vaResult, App.m_PreferencesDatabaseName.c_str ()); break;
case 83: SetUpVariantString (vaResult, sqlite3_libversion ()); break;
case 84: SetUpVariantString (vaResult, file_browsing_dir); break;
case 85: SetUpVariantString (vaResult, App.m_strDefaultStateFilesDirectory); break;
case 86: SetUpVariantString (vaResult, m_strWordUnderMenu); break;
case 87: SetUpVariantString (vaResult, m_strLastCommandSent); break;
case 88: SetUpVariantString (vaResult, m_strWindowTitle); break;
case 89: SetUpVariantString (vaResult, m_strMainWindowTitle); break;
case 101: SetUpVariantBool (vaResult, m_bNoEcho); break;
case 102: SetUpVariantBool (vaResult, m_bDebugIncomingPackets); break;
case 103: SetUpVariantBool (vaResult, m_bCompress); break;
case 104: SetUpVariantBool (vaResult, m_bMXP); break;
case 105: SetUpVariantBool (vaResult, m_bPuebloActive); break;
case 106: SetUpVariantBool (vaResult, m_iConnectPhase != eConnectConnectedToMud); break;
case 107: SetUpVariantBool (vaResult, m_iConnectPhase != eConnectNotConnected && // connecting
m_iConnectPhase != eConnectConnectedToMud); break;
case 108: SetUpVariantBool (vaResult, m_bDisconnectOK); break;
case 109: SetUpVariantBool (vaResult, m_bTrace); break;
case 110: SetUpVariantBool (vaResult, m_bInScriptFileChanged); break;
case 111: SetUpVariantBool (vaResult, IsModified ()); break;
case 112: SetUpVariantBool (vaResult, m_bMapping); break;
case 113: SetUpVariantBool (vaResult, m_pActiveCommandView || m_pActiveOutputView);
break;
case 114: // current view frozen
if (!(m_pActiveOutputView || m_pActiveCommandView))
SetUpVariantBool (vaResult, FALSE);
else if (m_pActiveOutputView)
SetUpVariantBool (vaResult, m_pActiveOutputView->m_freeze);
else
SetUpVariantBool (vaResult, m_pActiveCommandView->m_topview->m_freeze);
break;
case 115: SetUpVariantBool (vaResult, App.m_Translator_Lua != NULL); break;
case 118: SetUpVariantBool (vaResult, m_bVariablesChanged); break;
case 119: SetUpVariantBool (vaResult, m_ScriptEngine != NULL); break;
case 120: SetUpVariantBool (vaResult, m_bScrollBarWanted); break;
case 121: SetUpVariantBool (vaResult, App.m_iCounterFrequency != 0); break;
case 122: SetUpVariantBool (vaResult, sqlite3_threadsafe() != 0); break;
case 123: SetUpVariantBool (vaResult, m_bDoingSimulate); break;
case 124: SetUpVariantBool (vaResult, m_bLineOmittedFromOutput); break;
case 201: SetUpVariantLong (vaResult, m_total_lines); break;
case 202: SetUpVariantLong (vaResult, m_new_lines); break;
case 203: SetUpVariantLong (vaResult, m_nTotalLinesSent); break;
case 204: SetUpVariantLong (vaResult, (long) m_iInputPacketCount); break;
case 205: SetUpVariantLong (vaResult, (long) m_iOutputPacketCount); break;
case 206: SetUpVariantLong (vaResult, (long) m_nTotalUncompressed); break;
case 207: SetUpVariantLong (vaResult, (long) m_nTotalCompressed); break;
case 208: SetUpVariantLong (vaResult, m_iMCCP_type); break;
case 209: SetUpVariantLong (vaResult, (long) m_iMXPerrors); break;
case 210: SetUpVariantLong (vaResult, (long) m_iMXPtags); break;
case 211: SetUpVariantLong (vaResult, (long) m_iMXPentities); break;
case 212: SetUpVariantLong (vaResult, m_FontHeight); break;
case 213: SetUpVariantLong (vaResult, m_FontWidth); break;
case 214: SetUpVariantLong (vaResult, m_InputFontHeight); break;
case 215: SetUpVariantLong (vaResult, m_InputFontWidth); break;
case 216: SetUpVariantLong (vaResult, (long) m_nBytesIn); break;
case 217: SetUpVariantLong (vaResult, (long) m_nBytesOut); break;
case 218: SetUpVariantLong (vaResult, GetVariableMap ().GetCount ()); break;
case 219: SetUpVariantLong (vaResult, GetTriggerMap ().GetCount ()); break;
case 220: SetUpVariantLong (vaResult, GetTimerMap ().GetCount ()); break;
case 221: SetUpVariantLong (vaResult, GetAliasMap ().GetCount ()); break;
case 222: SetUpVariantLong (vaResult, m_QueuedCommandsList.GetCount ()); break;
case 223: SetUpVariantLong (vaResult, m_strMapList.GetCount ()); break;
case 224: SetUpVariantLong (vaResult, m_LineList.GetCount ()); break;
case 225: SetUpVariantLong (vaResult, m_CustomElementMap.GetCount ()); break;
case 226: SetUpVariantLong (vaResult, m_CustomEntityMap.GetCount ()); break;
case 227: SetUpVariantLong (vaResult, m_iConnectPhase); break;
case 228: SetUpVariantLong (vaResult, ntohl (m_sockAddr.sin_addr.s_addr)); break;
case 229: SetUpVariantLong (vaResult, ntohl (m_ProxyAddr.sin_addr.s_addr)); break;
case 230: SetUpVariantLong (vaResult, m_iExecutionDepth); break;
case 231: // log file size
{
if (m_logfile == NULL)
SetUpVariantLong (vaResult, 0); // no log file
else
{
fpos_t pos;
fgetpos (m_logfile, &pos);
SetUpVariantLong (vaResult, pos); // log file size
} // end of log file
}
break;
case 232:
if (App.m_iCounterFrequency)
{
LARGE_INTEGER the_time;
QueryPerformanceCounter (&the_time);
double ticks = (double) the_time.QuadPart / (double) App.m_iCounterFrequency;
SetUpVariantDouble (vaResult, ticks);
}
else
{
time_t timer;
time (&timer);
SetUpVariantDouble (vaResult, (double) timer);
}
break;
case 233: // time taken doing triggers
if (App.m_iCounterFrequency)
{
LONGLONG iTimeTaken = 0;
CTrigger * pTrigger;
POSITION pos;
double elapsed_time;
CString strName;
// count number of triggers matched
for (pos = GetTriggerMap ().GetStartPosition(); pos; )
{
GetTriggerMap ().GetNextAssoc (pos, strName, pTrigger);
// calculate time taken to execute triggers
if (pTrigger->regexp)
iTimeTaken += pTrigger->regexp->iTimeTaken;
}
elapsed_time = ((double) iTimeTaken) /
((double) App.m_iCounterFrequency);
SetUpVariantDouble (vaResult, elapsed_time);
}
break;
case 234: // time taken doing aliases
if (App.m_iCounterFrequency)
{
LONGLONG iTimeTaken = 0;
CAlias * pAlias;
POSITION pos;
double elapsed_time;
CString strName;
// count number of triggers matched
for (pos = GetAliasMap ().GetStartPosition(); pos; )
{
GetAliasMap ().GetNextAssoc (pos, strName, pAlias);
// calculate time taken to execute triggers
if (pAlias->regexp)
iTimeTaken += pAlias->regexp->iTimeTaken;
}
elapsed_time = ((double) iTimeTaken) /
((double) App.m_iCounterFrequency);
SetUpVariantDouble (vaResult, elapsed_time);
}
break;
case 235:
{
long count = 0;
for(POSITION pos=GetFirstViewPosition();pos!=NULL;)
{
CView* pView = GetNextView(pos);
if (pView->IsKindOf(RUNTIME_CLASS(CSendView)))
count++;
} // end of loop
SetUpVariantLong (vaResult, count); // number of world windows open
} // end of 235
break;
case 236: // command selection start column
{
for(POSITION pos = GetFirstViewPosition(); pos != NULL; )
{
CView* pView = GetNextView(pos);
if (pView->IsKindOf(RUNTIME_CLASS(CSendView)))
{
CSendView* pmyView = (CSendView*)pView;
int nStartChar;
int nEndChar;
// find where cursor is
pmyView->GetEditCtrl().GetSel(nStartChar, nEndChar);
SetUpVariantLong (vaResult, nStartChar + 1); // start column
break;
} // end of being a CSendView
} // end of loop through views
}
break;
case 237: // command selection end column
{
for(POSITION pos = GetFirstViewPosition(); pos != NULL; )
{
CView* pView = GetNextView(pos);
if (pView->IsKindOf(RUNTIME_CLASS(CSendView)))
{
CSendView* pmyView = (CSendView*)pView;
int nStartChar;
int nEndChar;
// find where cursor is
pmyView->GetEditCtrl().GetSel(nStartChar, nEndChar);
if (nEndChar <= nStartChar)
nEndChar = 0; // zero indicates no text selected
SetUpVariantLong (vaResult, nEndChar); // end column
break;
} // end of being a CSendView
} // end of loop through views
}
break;
case 238:
{
WINDOWPLACEMENT wp;
for(POSITION pos=GetFirstViewPosition();pos!=NULL;)
{
CView* pView = GetNextView(pos);
if (pView->IsKindOf(RUNTIME_CLASS(CSendView)))
{
CSendView* pmyView = (CSendView*)pView;
pmyView->GetParentFrame ()->GetWindowPlacement(&wp);
SetUpVariantLong (vaResult, wp.showCmd); // window placement flags
break;
}
}
}
break;
case 239:
SetUpVariantShort (vaResult, m_iCurrentActionSource); // see enum
break;
case 240:
SetUpVariantLong (vaResult, m_FontWidth); // average character width
break;
case 241:
SetUpVariantLong (vaResult, m_FontHeight); // character height
break;
case 242:
SetUpVariantLong (vaResult, m_iUTF8ErrorCount); // errors in UTF-8
break;
case 243:
SetUpVariantLong (vaResult, App.m_iFixedPitchFontSize);
break;
case 244:
SetUpVariantLong (vaResult, m_iTriggersEvaluatedCount);
break;
case 245:
SetUpVariantLong (vaResult, m_iTriggersMatchedCount);
break;
case 246:
SetUpVariantLong (vaResult, m_iAliasesEvaluatedCount);
break;
case 247:
SetUpVariantLong (vaResult, m_iAliasesMatchedCount);
break;
case 248:
SetUpVariantLong (vaResult, m_iTimersFiredCount);
break;
case 249:
{
RECT rect;
Frame.GetClientRect(&rect);
SetUpVariantLong (vaResult, rect.bottom);
}
break;
case 250:
{
RECT rect;
Frame.GetClientRect(&rect);
SetUpVariantLong (vaResult, rect.right);
}
break;
case 251: GetWindowHeight (&Frame.m_wndToolBar, vaResult); break;
case 252: GetWindowWidth (&Frame.m_wndToolBar, vaResult); break;
case 253: GetWindowHeight (&Frame.m_wndGameToolBar, vaResult); break;
case 254: GetWindowWidth (&Frame.m_wndGameToolBar, vaResult); break;
case 255: GetWindowHeight (&Frame.m_wndActivityToolBar, vaResult); break;
case 256: GetWindowWidth (&Frame.m_wndActivityToolBar, vaResult); break;
case 257: GetWindowHeight (&Frame.m_wndInfoBar, vaResult); break;
case 258: GetWindowWidth (&Frame.m_wndInfoBar, vaResult); break;
case 259: GetWindowHeight (&Frame.m_wndStatusBar, vaResult); break;
case 260: GetWindowWidth (&Frame.m_wndStatusBar, vaResult); break;
case 261:
{
CChildFrame * pFrame = GetChildFrame ();
if (pFrame)
GetWindowHeight (pFrame, vaResult); break; // non-client height
break;
}
case 262:
{
CChildFrame * pFrame = GetChildFrame ();
if (pFrame)
GetWindowWidth (pFrame, vaResult); // non-client width
break;
}
case 263:
{
CChildFrame * pFrame = GetChildFrame ();
if (pFrame)
GetWindowHeight (pFrame, vaResult, true); break; // client height
break;
}
case 264:
{
CChildFrame * pFrame = GetChildFrame ();
if (pFrame)
GetWindowWidth (pFrame, vaResult, true); // client width
break;
}
case 265: SetUpVariantLong (vaResult, os_version.dwMajorVersion); break;
case 266: SetUpVariantLong (vaResult, os_version.dwMinorVersion); break;
case 267: SetUpVariantLong (vaResult, os_version.dwBuildNumber); break;
case 268: SetUpVariantLong (vaResult, os_version.dwPlatformId); break;
case 269: SetUpVariantLong (vaResult, m_iForegroundMode); break;
case 270: SetUpVariantLong (vaResult, m_iBackgroundMode); break;
case 271: SetUpVariantLong (vaResult, m_iBackgroundColour); break;
case 272: SetUpVariantLong (vaResult, m_TextRectangle.left); break;
case 273: SetUpVariantLong (vaResult, m_TextRectangle.top); break;
case 274: SetUpVariantLong (vaResult, m_TextRectangle.right); break;
case 275: SetUpVariantLong (vaResult, m_TextRectangle.bottom); break;
case 276: SetUpVariantLong (vaResult, m_TextRectangleBorderOffset); break;
case 277: SetUpVariantLong (vaResult, m_TextRectangleBorderWidth); break;
case 278: SetUpVariantLong (vaResult, m_TextRectangleOutsideFillColour); break;
case 279: SetUpVariantLong (vaResult, m_TextRectangleOutsideFillStyle); break;
case 280:
{
CMUSHView* pmyView = GetFirstOutputWindow ();
if (pmyView)
{
RECT rect;
pmyView->GetClientRect(&rect);
SetUpVariantLong (vaResult, rect.bottom);
break;
}
}
break;
case 281:
{
CMUSHView* pmyView = GetFirstOutputWindow ();
if (pmyView)
{
RECT rect;
pmyView->GetClientRect(&rect);
SetUpVariantLong (vaResult, rect.right);
break;
}
}
break;
case 282: SetUpVariantLong (vaResult, m_TextRectangleBorderColour); break;
case 283: SetUpVariantLong (vaResult, m_lastMousePosition.x); break; // last mouse x position
case 284: SetUpVariantLong (vaResult, m_lastMousePosition.y); break; // last mouse y position
case 285: SetUpVariantBool (vaResult, m_pCurrentLine != NULL); break; // is output window available?
case 286: SetUpVariantLong (vaResult, m_iTriggersMatchedThisSessionCount); break; // Triggers matched this session
case 287: SetUpVariantLong (vaResult, m_iAliasesMatchedThisSessionCount); break; // Aliases matched this session
case 288: SetUpVariantLong (vaResult, m_iTimersFiredThisSessionCount); break; // Timers fired this session
case 289: SetUpVariantLong (vaResult, m_last_line_with_IAC_GA); break; // Last line number that had an IAC/GA in it
case 290:
{
CMUSHView* pmyView = GetFirstOutputWindow ();
if (pmyView)
{
RECT rect = pmyView->GetTextRectangle ();
SetUpVariantLong (vaResult, rect.left);
break;
}
}
break;
case 291:
{
CMUSHView* pmyView = GetFirstOutputWindow ();
if (pmyView)
{
RECT rect = pmyView->GetTextRectangle ();
SetUpVariantLong (vaResult, rect.top);
break;
}
}
break;
case 292:
{
CMUSHView* pmyView = GetFirstOutputWindow ();
if (pmyView)
{
RECT rect = pmyView->GetTextRectangle ();
SetUpVariantLong (vaResult, rect.right);
break;
}
}
break;
case 293:
{
CMUSHView* pmyView = GetFirstOutputWindow ();
if (pmyView)
{
RECT rect = pmyView->GetTextRectangle ();
SetUpVariantLong (vaResult, rect.bottom);
break;
}
}
break;
case 294:
{
long result = 0;
if (GetKeyState (VK_SHIFT) & 0x8000)
result |= 0x01;
if (GetKeyState (VK_CONTROL) & 0x8000)
result |= 0x02;
if (GetKeyState (VK_MENU) & 0x8000)
result |= 0x04;
if (GetKeyState (VK_LSHIFT) & 0x8000)
result |= 0x08;
if (GetKeyState (VK_RSHIFT) & 0x8000)
result |= 0x10;
if (GetKeyState (VK_LCONTROL) & 0x8000)