@amxts/menu-core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,703 @@
1
+ {
2
+ "format": 1,
3
+ "module": "@amxts/menu-core",
4
+ "version": "0.1.0",
5
+ "from": {
6
+ "@amxts/core": {
7
+ "version": "0.1.0",
8
+ "hash": "e3b12482fd1df1dcadee7e27a12ba915d97bf859"
9
+ },
10
+ "@amxts/config-core": {
11
+ "version": "0.1.0",
12
+ "hash": "fcdce20fc0fa51cce2d963ef408be861e44da388"
13
+ },
14
+ "@amxts/menu-core": {
15
+ "version": "0.1.0",
16
+ "hash": "68d0866205e1d840d37924f519429eaf11b6f778"
17
+ }
18
+ },
19
+ "options": {
20
+ "@amxts/config-core": {
21
+ "baseDir": ""
22
+ },
23
+ "@amxts/menu-core": {
24
+ "file": "menu",
25
+ "fallback": ""
26
+ }
27
+ },
28
+ "forwards": {},
29
+ "places": [
30
+ "constants.ts",
31
+ "effects.ts",
32
+ "entities.ts",
33
+ "events.ts",
34
+ "facade.ts",
35
+ "flags.ts",
36
+ "fs.ts",
37
+ "hooks.ts",
38
+ "kit.ts",
39
+ "menu-core.ts",
40
+ "modules/config-core.ts",
41
+ "modules/config-core/src/files.ts",
42
+ "modules/config-core/src/ini-tree.ts",
43
+ "modules/config-core/src/ini.ts",
44
+ "modules/config-core/src/internal.ts",
45
+ "modules/config-core/src/json.ts",
46
+ "modules/config-core/src/tree.ts",
47
+ "modules/config-core/src/types.ts",
48
+ "modules/config-core/src/yaml.ts",
49
+ "modules/menu-core.ts",
50
+ "modules/menu-core/src/internal.ts",
51
+ "modules/menu-core/src/menu-file.ts",
52
+ "modules/menu-core/src/types.ts",
53
+ "natives.ts",
54
+ "os.ts",
55
+ "promise.ts",
56
+ "vector.ts"
57
+ ],
58
+ "natives": [
59
+ {
60
+ "name": "mc_register_condition",
61
+ "params": [
62
+ {
63
+ "name": "name",
64
+ "kind": "string",
65
+ "pawnDefault": null
66
+ },
67
+ {
68
+ "name": "callback",
69
+ "kind": "string",
70
+ "pawnDefault": null
71
+ }
72
+ ],
73
+ "result": "int",
74
+ "doc": "/**\n * Registers a condition menus refer to - an item's condition, ACTIVE_ON, a\n * FILTER. The first plugin to register a name answers for it (case-insensitive).\n * Callback: public callback(id, viewerId, const name[]) - true when it holds.\n * Returns the condition's id.\n */"
75
+ },
76
+ {
77
+ "name": "mc_register_action",
78
+ "params": [
79
+ {
80
+ "name": "name",
81
+ "kind": "string",
82
+ "pawnDefault": null
83
+ },
84
+ {
85
+ "name": "callback",
86
+ "kind": "string",
87
+ "pawnDefault": null
88
+ },
89
+ {
90
+ "name": "_isCritical",
91
+ "kind": "bool",
92
+ "pawnDefault": "false"
93
+ }
94
+ ],
95
+ "result": "int",
96
+ "doc": "/**\n * Registers an action run when an item is chosen. Built in, not registered:\n * SHOW_<SECTION> opens that menu, CLOSE_MENU closes it; an action line may\n * list several, space-separated. Names are case-sensitive; the first wins.\n * Callback: public callback(id, const action[]) in an items menu,\n * public callback(id, targetId) in a LIST_ menu. isCritical is accepted and\n * does nothing. Returns the action's id.\n */"
97
+ },
98
+ {
99
+ "name": "mc_register_placeholder",
100
+ "params": [
101
+ {
102
+ "name": "name",
103
+ "kind": "string",
104
+ "pawnDefault": null
105
+ },
106
+ {
107
+ "name": "callback",
108
+ "kind": "string",
109
+ "pawnDefault": null
110
+ }
111
+ ],
112
+ "result": "int",
113
+ "doc": "/**\n * Registers a placeholder, %name% in titles and items, without the %.\n * Callback: public callback(id, targetId, value[], len) - fills value[].\n * A name registered again keeps the first. Returns the placeholder's id.\n */"
114
+ },
115
+ {
116
+ "name": "mc_register_menu",
117
+ "params": [
118
+ {
119
+ "name": "section",
120
+ "kind": "string",
121
+ "pawnDefault": null
122
+ }
123
+ ],
124
+ "result": "int",
125
+ "doc": "/**\n * Registers the config file's [section] as a menu. Returns the menu's id, or\n * -1 when the section is missing, has no TITLE or no items, or is MAIN.\n */"
126
+ },
127
+ {
128
+ "name": "mc_show_menu",
129
+ "params": [
130
+ {
131
+ "name": "player",
132
+ "kind": "player",
133
+ "pawnDefault": null
134
+ },
135
+ {
136
+ "name": "section",
137
+ "kind": "string",
138
+ "pawnDefault": null
139
+ },
140
+ {
141
+ "name": "time",
142
+ "kind": "int",
143
+ "pawnDefault": "-1"
144
+ },
145
+ {
146
+ "name": "targetId",
147
+ "kind": "int",
148
+ "pawnDefault": "0"
149
+ },
150
+ {
151
+ "name": "resetHistory",
152
+ "kind": "bool",
153
+ "pawnDefault": "false"
154
+ },
155
+ {
156
+ "name": "forceOpen",
157
+ "kind": "bool",
158
+ "pawnDefault": "false"
159
+ },
160
+ {
161
+ "name": "ignoreHistory",
162
+ "kind": "bool",
163
+ "pawnDefault": "false"
164
+ }
165
+ ],
166
+ "result": "int",
167
+ "doc": "/**\n * Shows a menu. time: countdown seconds, -1 for the menu's TIME (or the\n * countdown running). targetId: who a LIST_ menu is about. resetHistory\n * starts the way back anew; forceOpen opens over a menu that holds on (a\n * countdown, a lock); ignoreHistory leaves this menu out of the way back.\n * Returns 1 when it opened; 0 when the player is not in the game, there is no\n * such menu, a show filter or ACTIVE_ON stopped it.\n */"
168
+ },
169
+ {
170
+ "name": "mc_set_menu_timer",
171
+ "params": [
172
+ {
173
+ "name": "section",
174
+ "kind": "string",
175
+ "pawnDefault": null
176
+ },
177
+ {
178
+ "name": "time",
179
+ "kind": "int",
180
+ "pawnDefault": null
181
+ }
182
+ ],
183
+ "result": "int",
184
+ "doc": "/**\n * Sets the menu's shared countdown: starts one of `time` seconds when none\n * runs, or changes the seconds left (0 stops it). Returns 1, or 0 when there\n * is no such menu or nothing to change.\n */"
185
+ },
186
+ {
187
+ "name": "mc_notify_condition_changed",
188
+ "params": [
189
+ {
190
+ "name": "condition",
191
+ "kind": "string",
192
+ "pawnDefault": null
193
+ }
194
+ ],
195
+ "result": "void",
196
+ "doc": "/** Draws again every menu that uses the condition, for whoever looks at it. */"
197
+ },
198
+ {
199
+ "name": "mc_refresh_menu",
200
+ "params": [
201
+ {
202
+ "name": "sections",
203
+ "kind": "string",
204
+ "pawnDefault": null
205
+ }
206
+ ],
207
+ "result": "int",
208
+ "doc": "/** Draws the menus again (space-separated names) for whoever looks at them. Returns how many were drawn. */"
209
+ },
210
+ {
211
+ "name": "mc_register_restriction",
212
+ "params": [
213
+ {
214
+ "name": "name",
215
+ "kind": "string",
216
+ "pawnDefault": null
217
+ },
218
+ {
219
+ "name": "callback",
220
+ "kind": "string",
221
+ "pawnDefault": null
222
+ },
223
+ {
224
+ "name": "message",
225
+ "kind": "string",
226
+ "pawnDefault": "\"\""
227
+ }
228
+ ],
229
+ "result": "int",
230
+ "doc": "/**\n * Registers a restriction items name in their restriction column; \"*\"\n * answers for every name no other restriction does. Callback:\n * public callback(id, const restrictName[], targetId) - true when the player\n * passes. message is said beside an item it greys out, when the item has no\n * message of its own. Returns the restriction's id.\n */"
231
+ },
232
+ {
233
+ "name": "mc_register_action_condition",
234
+ "params": [
235
+ {
236
+ "name": "menuSection",
237
+ "kind": "string",
238
+ "pawnDefault": null
239
+ },
240
+ {
241
+ "name": "actionName",
242
+ "kind": "string",
243
+ "pawnDefault": null
244
+ },
245
+ {
246
+ "name": "callback",
247
+ "kind": "string",
248
+ "pawnDefault": null
249
+ }
250
+ ],
251
+ "result": "int",
252
+ "doc": "/**\n * Greys out items whose action is actionName in menuSection while the\n * callback says no; \"\" for either matches all. Callback:\n * public callback(id, const menuSection[], const actionName[]). Returns 1.\n */"
253
+ },
254
+ {
255
+ "name": "mc_register_condition_filter",
256
+ "params": [
257
+ {
258
+ "name": "condition",
259
+ "kind": "string",
260
+ "pawnDefault": null
261
+ },
262
+ {
263
+ "name": "callback",
264
+ "kind": "string",
265
+ "pawnDefault": null
266
+ }
267
+ ],
268
+ "result": "int",
269
+ "doc": "/**\n * Registers a filter over a condition someone else registered: it gets the\n * condition's value and returns the one to use. Callback:\n * public bool:callback(id, viewerId, const condition[], bool:currentVal).\n * Returns the filter's id.\n */"
270
+ },
271
+ {
272
+ "name": "mc_register_list_data_source",
273
+ "params": [
274
+ {
275
+ "name": "menuName",
276
+ "kind": "string",
277
+ "pawnDefault": null
278
+ },
279
+ {
280
+ "name": "callback",
281
+ "kind": "string",
282
+ "pawnDefault": null
283
+ }
284
+ ],
285
+ "result": "int",
286
+ "doc": "/**\n * The rows of a LIST_ menu, instead of the players. Callback:\n * public callback(id, Array:items) - pushes 289-cell items and returns 1:\n * [0] the target the action gets (-2: a line of text), [1..64] an action of\n * its own, [65..128] the text (%name%), [129..160] a restriction,\n * [161..288] the message when it greys the row out. A second source for the\n * menu replaces the first. Returns the source's id.\n */"
287
+ },
288
+ {
289
+ "name": "mc_register_menu_open_callback",
290
+ "params": [
291
+ {
292
+ "name": "callback",
293
+ "kind": "string",
294
+ "pawnDefault": null
295
+ }
296
+ ],
297
+ "result": "int",
298
+ "doc": "/** Called when a menu opens. Callback: public callback(id, const section[]). Returns its id. */"
299
+ },
300
+ {
301
+ "name": "mc_register_menu_close_callback",
302
+ "params": [
303
+ {
304
+ "name": "callback",
305
+ "kind": "string",
306
+ "pawnDefault": null
307
+ }
308
+ ],
309
+ "result": "int",
310
+ "doc": "/**\n * Called when a menu closes - by a key, a timeout, another menu opening over\n * it, the player leaving. Callback: public callback(id, const section[], bool:isTimeout).\n * Returns its id.\n */"
311
+ },
312
+ {
313
+ "name": "mc_register_show_filter",
314
+ "params": [
315
+ {
316
+ "name": "callback",
317
+ "kind": "string",
318
+ "pawnDefault": null
319
+ }
320
+ ],
321
+ "result": "int",
322
+ "doc": "/**\n * Asked before any menu opens; returning false stops it (mc_show_menu returns\n * 0) - the place to tell the player why. Callback:\n * public bool:callback(id, const section[]). Returns its id.\n */"
323
+ },
324
+ {
325
+ "name": "mc_cancel_menu_timer",
326
+ "params": [
327
+ {
328
+ "name": "section",
329
+ "kind": "string",
330
+ "pawnDefault": null
331
+ }
332
+ ],
333
+ "result": "int",
334
+ "doc": "/** Stops the menu's shared countdown and closes it for everyone. Returns 1, or 0 when none ran. */"
335
+ },
336
+ {
337
+ "name": "mc_lock_menu",
338
+ "params": [
339
+ {
340
+ "name": "player",
341
+ "kind": "player",
342
+ "pawnDefault": null
343
+ },
344
+ {
345
+ "name": "lock",
346
+ "kind": "bool",
347
+ "pawnDefault": "true"
348
+ }
349
+ ],
350
+ "result": "void",
351
+ "doc": "/** Locks (or unlocks) the player's menu: nothing can be chosen, and no other menu replaces it. */"
352
+ },
353
+ {
354
+ "name": "mc_hide_menu",
355
+ "params": [
356
+ {
357
+ "name": "player",
358
+ "kind": "player",
359
+ "pawnDefault": null
360
+ }
361
+ ],
362
+ "result": "void",
363
+ "doc": "/** Closes the player's menu. */"
364
+ },
365
+ {
366
+ "name": "mc_is_menu_locked",
367
+ "params": [
368
+ {
369
+ "name": "player",
370
+ "kind": "player",
371
+ "pawnDefault": null
372
+ }
373
+ ],
374
+ "result": "bool",
375
+ "doc": "/** Whether the player's menu is locked. */"
376
+ },
377
+ {
378
+ "name": "mc_get_active_menu",
379
+ "params": [
380
+ {
381
+ "name": "id",
382
+ "kind": "int",
383
+ "pawnDefault": null
384
+ }
385
+ ],
386
+ "result": "int",
387
+ "doc": "/** The id of the menu the player looks at, or -1. */"
388
+ },
389
+ {
390
+ "name": "mc_get_menu_property_string",
391
+ "params": [
392
+ {
393
+ "name": "menuIdx",
394
+ "kind": "int",
395
+ "pawnDefault": null
396
+ },
397
+ {
398
+ "name": "property",
399
+ "kind": "tag",
400
+ "pawnDefault": null,
401
+ "tag": "MenuProperty"
402
+ }
403
+ ],
404
+ "result": "string",
405
+ "doc": "/**\n * A string property of a menu by its id (mc_get_active_menu): MP_SECTION, the\n * section name, into out[]. Returns its length; 0 when the id or the property\n * is not one.\n */"
406
+ },
407
+ {
408
+ "name": "mc_set_menu_property",
409
+ "params": [
410
+ {
411
+ "name": "section",
412
+ "kind": "string",
413
+ "pawnDefault": null
414
+ },
415
+ {
416
+ "name": "property",
417
+ "kind": "tag",
418
+ "pawnDefault": null,
419
+ "tag": "MenuProperty"
420
+ },
421
+ {
422
+ "name": "value",
423
+ "kind": "int",
424
+ "pawnDefault": null
425
+ }
426
+ ],
427
+ "result": "int",
428
+ "doc": "/**\n * Sets MP_LOCKED, MP_GLOBAL_TIMER, MP_TIMER_DURATION, MP_HIDE_BACK or\n * MP_HIDE_EXIT. Returns 1, or 0 when there is no such menu or property.\n */"
429
+ },
430
+ {
431
+ "name": "mc_set_menu_property_string",
432
+ "params": [
433
+ {
434
+ "name": "section",
435
+ "kind": "string",
436
+ "pawnDefault": null
437
+ },
438
+ {
439
+ "name": "property",
440
+ "kind": "tag",
441
+ "pawnDefault": null,
442
+ "tag": "MenuProperty"
443
+ },
444
+ {
445
+ "name": "value",
446
+ "kind": "string",
447
+ "pawnDefault": null
448
+ }
449
+ ],
450
+ "result": "int",
451
+ "doc": "/**\n * Sets MP_ON_TIMEOUT (the action when the countdown ends), MP_ACTIVE_ON (the\n * condition the menu opens under) or MP_FILTER (\"CONDITION|MESSAGE\", added to\n * a LIST_ menu's filters). Returns 1, or 0 when there is no such menu or\n * property.\n */"
452
+ },
453
+ {
454
+ "name": "mc_add_menu_item",
455
+ "params": [
456
+ {
457
+ "name": "section",
458
+ "kind": "string",
459
+ "pawnDefault": null
460
+ },
461
+ {
462
+ "name": "name",
463
+ "kind": "string",
464
+ "pawnDefault": null
465
+ },
466
+ {
467
+ "name": "placeholder",
468
+ "kind": "string",
469
+ "pawnDefault": "\"\""
470
+ },
471
+ {
472
+ "name": "condition",
473
+ "kind": "string",
474
+ "pawnDefault": "\"\""
475
+ },
476
+ {
477
+ "name": "action",
478
+ "kind": "string",
479
+ "pawnDefault": "\"\""
480
+ },
481
+ {
482
+ "name": "restriction",
483
+ "kind": "string",
484
+ "pawnDefault": "\"\""
485
+ },
486
+ {
487
+ "name": "restrictMsg",
488
+ "kind": "string",
489
+ "pawnDefault": "\"\""
490
+ },
491
+ {
492
+ "name": "iPosition",
493
+ "kind": "int",
494
+ "pawnDefault": "-1"
495
+ },
496
+ {
497
+ "name": "emptyBefore",
498
+ "kind": "int",
499
+ "pawnDefault": "0"
500
+ },
501
+ {
502
+ "name": "emptyAfter",
503
+ "kind": "int",
504
+ "pawnDefault": "0"
505
+ }
506
+ ],
507
+ "result": "int",
508
+ "doc": "/**\n * Adds an item to a menu. name, condition and action take \"A|B\" variants: the\n * first whose condition holds is shown. iPosition: its place among the items,\n * -1 the end; emptyBefore/emptyAfter: blank lines around it. Returns 1, or 0\n * when there is no such menu or the name gives no item.\n */"
509
+ },
510
+ {
511
+ "name": "mc_add_fixed_menu_item",
512
+ "params": [
513
+ {
514
+ "name": "section",
515
+ "kind": "string",
516
+ "pawnDefault": null
517
+ },
518
+ {
519
+ "name": "slot",
520
+ "kind": "int",
521
+ "pawnDefault": null
522
+ },
523
+ {
524
+ "name": "name",
525
+ "kind": "string",
526
+ "pawnDefault": null
527
+ },
528
+ {
529
+ "name": "placeholder",
530
+ "kind": "string",
531
+ "pawnDefault": "\"\""
532
+ },
533
+ {
534
+ "name": "action",
535
+ "kind": "string",
536
+ "pawnDefault": "\"\""
537
+ },
538
+ {
539
+ "name": "condition",
540
+ "kind": "string",
541
+ "pawnDefault": "\"\""
542
+ },
543
+ {
544
+ "name": "restriction",
545
+ "kind": "string",
546
+ "pawnDefault": "\"\""
547
+ },
548
+ {
549
+ "name": "emptyBefore",
550
+ "kind": "int",
551
+ "pawnDefault": "0"
552
+ },
553
+ {
554
+ "name": "emptyAfter",
555
+ "kind": "int",
556
+ "pawnDefault": "0"
557
+ }
558
+ ],
559
+ "result": "int",
560
+ "doc": "/**\n * Adds an item that always takes slot 1-7 of every page. Returns 1, or 0 when\n * there is no such menu or the name gives no item.\n */"
561
+ },
562
+ {
563
+ "name": "mc_add_list_text",
564
+ "params": [
565
+ {
566
+ "name": "aItems",
567
+ "kind": "int",
568
+ "pawnDefault": null
569
+ },
570
+ {
571
+ "name": "text",
572
+ "kind": "string",
573
+ "pawnDefault": null
574
+ },
575
+ {
576
+ "name": "centered",
577
+ "kind": "bool",
578
+ "pawnDefault": "false"
579
+ }
580
+ ],
581
+ "result": "int",
582
+ "doc": "/**\n * Adds a line of text - a header, a separator - to the items a data source\n * fills; call it from the data source callback. Returns 1.\n */"
583
+ },
584
+ {
585
+ "name": "mc_clear_menu_items",
586
+ "params": [
587
+ {
588
+ "name": "section",
589
+ "kind": "string",
590
+ "pawnDefault": null
591
+ }
592
+ ],
593
+ "result": "int",
594
+ "doc": "/** Removes every item of a menu, fixed ones too. Returns 1, or 0 when there is no such menu. */"
595
+ },
596
+ {
597
+ "name": "mc_create_menu",
598
+ "params": [
599
+ {
600
+ "name": "section",
601
+ "kind": "string",
602
+ "pawnDefault": null
603
+ },
604
+ {
605
+ "name": "title",
606
+ "kind": "string",
607
+ "pawnDefault": null
608
+ }
609
+ ],
610
+ "result": "int",
611
+ "doc": "/**\n * Makes a menu in code, without a config section; a name starting with LIST_\n * makes a list menu. Returns 1, or 0 when a menu of that name is there.\n */"
612
+ },
613
+ {
614
+ "name": "mc_set_menu_page",
615
+ "params": [
616
+ {
617
+ "name": "player",
618
+ "kind": "player",
619
+ "pawnDefault": null
620
+ },
621
+ {
622
+ "name": "page",
623
+ "kind": "int",
624
+ "pawnDefault": null
625
+ }
626
+ ],
627
+ "result": "void",
628
+ "doc": "/** The page, from 0, the player's menu is drawn at next. */"
629
+ },
630
+ {
631
+ "name": "mc_get_menu_text",
632
+ "params": [
633
+ {
634
+ "name": "player",
635
+ "kind": "player",
636
+ "pawnDefault": null
637
+ }
638
+ ],
639
+ "result": "string",
640
+ "doc": "/**\n * The text the player's menu shows at the moment, colour codes and all (\"\"\n * when none is open) - for a test or a log to see what the player sees.\n */"
641
+ }
642
+ ],
643
+ "beside": {
644
+ "enums": [
645
+ {
646
+ "name": "MenuProperty",
647
+ "members": [
648
+ {
649
+ "name": "MP_LOCKED",
650
+ "value": 0
651
+ },
652
+ {
653
+ "name": "MP_GLOBAL_TIMER",
654
+ "value": 1
655
+ },
656
+ {
657
+ "name": "MP_TIMER_DURATION",
658
+ "value": 2
659
+ },
660
+ {
661
+ "name": "MP_HIDE_BACK",
662
+ "value": 3
663
+ },
664
+ {
665
+ "name": "MP_HIDE_EXIT",
666
+ "value": 4
667
+ },
668
+ {
669
+ "name": "MP_SECTION",
670
+ "value": 5
671
+ },
672
+ {
673
+ "name": "MP_ON_TIMEOUT",
674
+ "value": 5
675
+ },
676
+ {
677
+ "name": "MP_ACTIVE_ON",
678
+ "value": 6
679
+ },
680
+ {
681
+ "name": "MP_FILTER",
682
+ "value": 7
683
+ }
684
+ ],
685
+ "doc": "/**\n * Menu properties: mc_set_menu_property takes MP_LOCKED .. MP_HIDE_EXIT,\n * mc_set_menu_property_string MP_ON_TIMEOUT .. MP_FILTER, and\n * mc_get_menu_property_string MP_SECTION.\n */"
686
+ }
687
+ ],
688
+ "contract": null,
689
+ "author": "kukson777"
690
+ },
691
+ "systems": {
692
+ "windows": {
693
+ "file": "prebuilt/windows/menu-core.aot",
694
+ "size": 1128304,
695
+ "sha256": "8f478200e882ce19bdea88c8b7cdf2d4b7c8697993a05848a95b6c8268ee746e"
696
+ },
697
+ "linux": {
698
+ "file": "prebuilt/linux/menu-core.aot",
699
+ "size": 1140072,
700
+ "sha256": "3207bb5fdca8963b1edbece735772bfa074960ca0b3927ec424fe82f8d6c8a8e"
701
+ }
702
+ }
703
+ }
Binary file