@amxts/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.
Files changed (247) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +162 -0
  3. package/README.ru.md +162 -0
  4. package/amxmodx/base/include/amxconst.inc +594 -0
  5. package/amxmodx/base/include/amxmisc.inc +902 -0
  6. package/amxmodx/base/include/amxmodx.inc +3447 -0
  7. package/amxmodx/base/include/amxmodx_version.inc +20 -0
  8. package/amxmodx/base/include/cellarray.inc +525 -0
  9. package/amxmodx/base/include/cellstack.inc +166 -0
  10. package/amxmodx/base/include/celltrie.inc +412 -0
  11. package/amxmodx/base/include/core.inc +202 -0
  12. package/amxmodx/base/include/csstats.inc +298 -0
  13. package/amxmodx/base/include/csstats_const.inc +29 -0
  14. package/amxmodx/base/include/cstrike.inc +1287 -0
  15. package/amxmodx/base/include/cstrike_const.inc +521 -0
  16. package/amxmodx/base/include/csx.inc +259 -0
  17. package/amxmodx/base/include/cvars.inc +547 -0
  18. package/amxmodx/base/include/datapack.inc +161 -0
  19. package/amxmodx/base/include/dbi.inc +154 -0
  20. package/amxmodx/base/include/dodconst.inc +152 -0
  21. package/amxmodx/base/include/dodfun.inc +152 -0
  22. package/amxmodx/base/include/dodstats.inc +69 -0
  23. package/amxmodx/base/include/dodx.inc +161 -0
  24. package/amxmodx/base/include/engine.inc +1343 -0
  25. package/amxmodx/base/include/engine_const.inc +310 -0
  26. package/amxmodx/base/include/engine_stocks.inc +248 -0
  27. package/amxmodx/base/include/esf.inc +70 -0
  28. package/amxmodx/base/include/esf_const.inc +74 -0
  29. package/amxmodx/base/include/fakemeta.inc +1127 -0
  30. package/amxmodx/base/include/fakemeta_const.inc +793 -0
  31. package/amxmodx/base/include/fakemeta_stocks.inc +395 -0
  32. package/amxmodx/base/include/fakemeta_util.inc +882 -0
  33. package/amxmodx/base/include/file.inc +666 -0
  34. package/amxmodx/base/include/float.inc +422 -0
  35. package/amxmodx/base/include/fun.inc +333 -0
  36. package/amxmodx/base/include/gameconfig.inc +93 -0
  37. package/amxmodx/base/include/geoip.inc +264 -0
  38. package/amxmodx/base/include/ham_const.inc +4352 -0
  39. package/amxmodx/base/include/hamsandwich.inc +439 -0
  40. package/amxmodx/base/include/hlsdk_const.inc +808 -0
  41. package/amxmodx/base/include/json.inc +777 -0
  42. package/amxmodx/base/include/lang.inc +119 -0
  43. package/amxmodx/base/include/message_const.inc +1130 -0
  44. package/amxmodx/base/include/message_stocks.inc +161 -0
  45. package/amxmodx/base/include/messages.inc +604 -0
  46. package/amxmodx/base/include/newmenus.inc +387 -0
  47. package/amxmodx/base/include/ns.inc +754 -0
  48. package/amxmodx/base/include/ns_const.inc +196 -0
  49. package/amxmodx/base/include/nvault.inc +154 -0
  50. package/amxmodx/base/include/regex.inc +348 -0
  51. package/amxmodx/base/include/sockets.inc +183 -0
  52. package/amxmodx/base/include/sorting.inc +107 -0
  53. package/amxmodx/base/include/sqlx.inc +582 -0
  54. package/amxmodx/base/include/string.inc +786 -0
  55. package/amxmodx/base/include/string_const.inc +156 -0
  56. package/amxmodx/base/include/string_stocks.inc +325 -0
  57. package/amxmodx/base/include/textparse_ini.inc +214 -0
  58. package/amxmodx/base/include/textparse_smc.inc +261 -0
  59. package/amxmodx/base/include/tfcconst.inc +84 -0
  60. package/amxmodx/base/include/tfcstats.inc +62 -0
  61. package/amxmodx/base/include/tfcx.inc +148 -0
  62. package/amxmodx/base/include/time.inc +118 -0
  63. package/amxmodx/base/include/tsconst.inc +154 -0
  64. package/amxmodx/base/include/tsfun.inc +198 -0
  65. package/amxmodx/base/include/tsstats.inc +65 -0
  66. package/amxmodx/base/include/tsx.inc +88 -0
  67. package/amxmodx/base/include/vault.inc +60 -0
  68. package/amxmodx/base/include/vector.inc +131 -0
  69. package/amxmodx/base/include/xs.inc +1570 -0
  70. package/as/amxts.d.ts +153 -0
  71. package/as/constants.ts +4730 -0
  72. package/as/effects.ts +1449 -0
  73. package/as/entities.ts +5482 -0
  74. package/as/events.ts +3054 -0
  75. package/as/facade.ts +4639 -0
  76. package/as/flags.ts +299 -0
  77. package/as/fs.ts +287 -0
  78. package/as/hooks.ts +18536 -0
  79. package/as/kit.ts +25 -0
  80. package/as/lib/check.ts +86 -0
  81. package/as/modules/http.ts +184 -0
  82. package/as/natives.ts +11845 -0
  83. package/as/os.ts +30 -0
  84. package/as/promise.ts +1392 -0
  85. package/as/promise.types.d.ts +82 -0
  86. package/as/remote.ts +288 -0
  87. package/as/tsconfig.json +22 -0
  88. package/as/vector.ts +65 -0
  89. package/bin/amxts.mjs +10 -0
  90. package/includes/menu_core.inc +355 -0
  91. package/includes/order.txt +54 -0
  92. package/includes/sources.json +27 -0
  93. package/includes/universal_config.inc +355 -0
  94. package/lint/oxlint-plugin.mjs +77 -0
  95. package/node_modules/assemblyscript/LICENSE +201 -0
  96. package/node_modules/assemblyscript/NOTICE +93 -0
  97. package/node_modules/assemblyscript/package.json +63 -0
  98. package/node_modules/assemblyscript/std/README.md +6 -0
  99. package/node_modules/assemblyscript/std/assembly/array.ts +526 -0
  100. package/node_modules/assemblyscript/std/assembly/arraybuffer.ts +77 -0
  101. package/node_modules/assemblyscript/std/assembly/atomics.ts +127 -0
  102. package/node_modules/assemblyscript/std/assembly/bindings/asyncify.ts +16 -0
  103. package/node_modules/assemblyscript/std/assembly/bindings/dom.ts +291 -0
  104. package/node_modules/assemblyscript/std/assembly/bindings/node.ts +6 -0
  105. package/node_modules/assemblyscript/std/assembly/builtins.ts +2631 -0
  106. package/node_modules/assemblyscript/std/assembly/compat.ts +2 -0
  107. package/node_modules/assemblyscript/std/assembly/console.ts +42 -0
  108. package/node_modules/assemblyscript/std/assembly/crypto.ts +9 -0
  109. package/node_modules/assemblyscript/std/assembly/dataview.ts +181 -0
  110. package/node_modules/assemblyscript/std/assembly/date.ts +373 -0
  111. package/node_modules/assemblyscript/std/assembly/diagnostics.ts +11 -0
  112. package/node_modules/assemblyscript/std/assembly/error.ts +44 -0
  113. package/node_modules/assemblyscript/std/assembly/function.ts +38 -0
  114. package/node_modules/assemblyscript/std/assembly/index.d.ts +2822 -0
  115. package/node_modules/assemblyscript/std/assembly/iterator.ts +35 -0
  116. package/node_modules/assemblyscript/std/assembly/map.ts +260 -0
  117. package/node_modules/assemblyscript/std/assembly/math.ts +3289 -0
  118. package/node_modules/assemblyscript/std/assembly/memory.ts +123 -0
  119. package/node_modules/assemblyscript/std/assembly/number.ts +388 -0
  120. package/node_modules/assemblyscript/std/assembly/object.ts +36 -0
  121. package/node_modules/assemblyscript/std/assembly/performance.ts +9 -0
  122. package/node_modules/assemblyscript/std/assembly/polyfills.ts +27 -0
  123. package/node_modules/assemblyscript/std/assembly/process.ts +50 -0
  124. package/node_modules/assemblyscript/std/assembly/reference.ts +48 -0
  125. package/node_modules/assemblyscript/std/assembly/regexp.ts +12 -0
  126. package/node_modules/assemblyscript/std/assembly/rt/README.md +83 -0
  127. package/node_modules/assemblyscript/std/assembly/rt/common.ts +81 -0
  128. package/node_modules/assemblyscript/std/assembly/rt/index-incremental.ts +2 -0
  129. package/node_modules/assemblyscript/std/assembly/rt/index-minimal.ts +2 -0
  130. package/node_modules/assemblyscript/std/assembly/rt/index-stub.ts +1 -0
  131. package/node_modules/assemblyscript/std/assembly/rt/index.d.ts +37 -0
  132. package/node_modules/assemblyscript/std/assembly/rt/itcms.ts +419 -0
  133. package/node_modules/assemblyscript/std/assembly/rt/rtrace.ts +15 -0
  134. package/node_modules/assemblyscript/std/assembly/rt/stub.ts +133 -0
  135. package/node_modules/assemblyscript/std/assembly/rt/tcms.ts +254 -0
  136. package/node_modules/assemblyscript/std/assembly/rt/tlsf.ts +592 -0
  137. package/node_modules/assemblyscript/std/assembly/rt.ts +87 -0
  138. package/node_modules/assemblyscript/std/assembly/set.ts +220 -0
  139. package/node_modules/assemblyscript/std/assembly/shared/feature.ts +65 -0
  140. package/node_modules/assemblyscript/std/assembly/shared/runtime.ts +11 -0
  141. package/node_modules/assemblyscript/std/assembly/shared/target.ts +11 -0
  142. package/node_modules/assemblyscript/std/assembly/shared/tsconfig.json +11 -0
  143. package/node_modules/assemblyscript/std/assembly/shared/typeinfo.ts +72 -0
  144. package/node_modules/assemblyscript/std/assembly/staticarray.ts +401 -0
  145. package/node_modules/assemblyscript/std/assembly/string.ts +847 -0
  146. package/node_modules/assemblyscript/std/assembly/symbol.ts +114 -0
  147. package/node_modules/assemblyscript/std/assembly/table.ts +16 -0
  148. package/node_modules/assemblyscript/std/assembly/tsconfig.json +6 -0
  149. package/node_modules/assemblyscript/std/assembly/typedarray.ts +1945 -0
  150. package/node_modules/assemblyscript/std/assembly/uri.ts +17 -0
  151. package/node_modules/assemblyscript/std/assembly/util/bytes.ts +107 -0
  152. package/node_modules/assemblyscript/std/assembly/util/casemap.ts +497 -0
  153. package/node_modules/assemblyscript/std/assembly/util/error.ts +54 -0
  154. package/node_modules/assemblyscript/std/assembly/util/hash.ts +117 -0
  155. package/node_modules/assemblyscript/std/assembly/util/math.ts +1922 -0
  156. package/node_modules/assemblyscript/std/assembly/util/memory.ts +290 -0
  157. package/node_modules/assemblyscript/std/assembly/util/number.ts +873 -0
  158. package/node_modules/assemblyscript/std/assembly/util/sort.ts +313 -0
  159. package/node_modules/assemblyscript/std/assembly/util/string.ts +1202 -0
  160. package/node_modules/assemblyscript/std/assembly/util/uri.ts +275 -0
  161. package/node_modules/assemblyscript/std/assembly/vector.ts +4 -0
  162. package/node_modules/assemblyscript/std/assembly.json +16 -0
  163. package/node_modules/assemblyscript/std/portable/index.d.ts +462 -0
  164. package/node_modules/assemblyscript/std/portable/index.js +416 -0
  165. package/node_modules/assemblyscript/std/portable.json +11 -0
  166. package/node_modules/assemblyscript/std/types/assembly/index.d.ts +1 -0
  167. package/node_modules/assemblyscript/std/types/assembly/package.json +3 -0
  168. package/node_modules/assemblyscript/std/types/portable/index.d.ts +1 -0
  169. package/node_modules/assemblyscript/std/types/portable/package.json +3 -0
  170. package/node_modules/assemblyscript/tsconfig-base.json +13 -0
  171. package/package.json +112 -0
  172. package/runtime/deps/assemblyscript/LICENSE +201 -0
  173. package/runtime/deps/assemblyscript/NOTICE +93 -0
  174. package/runtime/deps/assemblyscript/bin/asc.js +35 -0
  175. package/runtime/deps/assemblyscript/dist/asc.js +25035 -0
  176. package/runtime/deps/assemblyscript/dist/assemblyscript.js +337 -0
  177. package/runtime/deps/assemblyscript/node_modules/binaryen/LICENSE +201 -0
  178. package/runtime/deps/assemblyscript/node_modules/binaryen/index.js +28905 -0
  179. package/runtime/deps/assemblyscript/node_modules/binaryen/package.json +50 -0
  180. package/runtime/deps/assemblyscript/node_modules/long/LICENSE +202 -0
  181. package/runtime/deps/assemblyscript/node_modules/long/index.js +1581 -0
  182. package/runtime/deps/assemblyscript/node_modules/long/package.json +58 -0
  183. package/runtime/deps/assemblyscript/package.json +114 -0
  184. package/runtime/host/amxts.inc +85 -0
  185. package/runtime/licenses/AMXX-LICENSE.txt +34 -0
  186. package/runtime/licenses/AssemblyScript-LICENSE +201 -0
  187. package/runtime/licenses/AssemblyScript-NOTICE +93 -0
  188. package/runtime/licenses/Binaryen-LICENSE +201 -0
  189. package/runtime/licenses/Bun-LICENSE.md +84 -0
  190. package/runtime/licenses/GPL-3.0.txt +674 -0
  191. package/runtime/licenses/LLVM-LICENSE.TXT +279 -0
  192. package/runtime/licenses/README.md +25 -0
  193. package/runtime/licenses/WAMR-LICENSE +219 -0
  194. package/runtime/natives.txt +1095 -0
  195. package/runtime/patches/README.md +59 -0
  196. package/runtime/patches/assemblyscript-0.28.20-amxts.patch +14174 -0
  197. package/runtime/patches/wamr-2.4.5-amxts.patch +364 -0
  198. package/scripts/apply-docs.ts +508 -0
  199. package/scripts/asc.ts +27 -0
  200. package/scripts/auto-imports.ts +258 -0
  201. package/scripts/build-wasm.ts +595 -0
  202. package/scripts/check.ts +93 -0
  203. package/scripts/compile-cache.ts +179 -0
  204. package/scripts/compile.ts +401 -0
  205. package/scripts/docker-server.ts +73 -0
  206. package/scripts/docs/as/amxts.ts +210 -0
  207. package/scripts/docs/as/effects.ts +1684 -0
  208. package/scripts/docs/as/facade.ts +3302 -0
  209. package/scripts/docs/as/fs.ts +173 -0
  210. package/scripts/docs/as/lib/check.ts +68 -0
  211. package/scripts/docs/as/modules/http.ts +66 -0
  212. package/scripts/docs/as/os.ts +16 -0
  213. package/scripts/docs/as/promise.ts +132 -0
  214. package/scripts/docs/as/promise.types.ts +63 -0
  215. package/scripts/docs/as/vector.ts +48 -0
  216. package/scripts/docs/entities.ts +2338 -0
  217. package/scripts/docs/events.ts +245 -0
  218. package/scripts/docs/game.ts +497 -0
  219. package/scripts/docs/messages.ts +148 -0
  220. package/scripts/file-contents.ts +74 -0
  221. package/scripts/includes.ts +134 -0
  222. package/scripts/player-fields.ts +866 -0
  223. package/scripts/plugin-cache.ts +92 -0
  224. package/scripts/plugin-natives.ts +1157 -0
  225. package/scripts/prebuilt.ts +268 -0
  226. package/scripts/prepare.ts +134 -0
  227. package/scripts/project.ts +973 -0
  228. package/scripts/run.ts +28 -0
  229. package/scripts/shared-modules.ts +906 -0
  230. package/scripts/system.ts +33 -0
  231. package/scripts/tracked-fs.ts +115 -0
  232. package/scripts/typed-configs.ts +788 -0
  233. package/scripts/ui.ts +77 -0
  234. package/src/cli-api.mjs +175 -0
  235. package/src/parser/include-parser.ts +506 -0
  236. package/src/system.mjs +155 -0
  237. package/src/testing/compile-cache.ts +31 -0
  238. package/src/testing/compile.ts +222 -0
  239. package/src/testing/coroutines.ts +191 -0
  240. package/src/testing/index.ts +39 -0
  241. package/src/testing/kits.ts +55 -0
  242. package/src/testing/memory.ts +125 -0
  243. package/src/testing/natives.ts +925 -0
  244. package/src/testing/server.ts +1874 -0
  245. package/src/testing/setup.ts +63 -0
  246. package/src/testing/tables.ts +139 -0
  247. package/src/types.ts +51 -0
@@ -0,0 +1,355 @@
1
+ #if defined _universal_config_included
2
+ #endinput
3
+ #endif
4
+ #define _universal_config_included
5
+
6
+ /**
7
+ * Universal Config System — public API include
8
+ * Version: 1.6.1
9
+ * Author: kukson777
10
+ *
11
+ * A flexible configuration system for parsing, managing and writing INI-like
12
+ * files with support for nested sections, key-value pairs and block structures.
13
+ */
14
+
15
+ /**
16
+ * Configuration file handle.
17
+ */
18
+ enum ConfigFile {
19
+ CFG_FILE_INVALID = -1
20
+ }
21
+
22
+ /**
23
+ * Configuration section handle.
24
+ */
25
+ enum ConfigSection {
26
+ CFG_SECTION_INVALID = -1
27
+ }
28
+
29
+ /**
30
+ * Entry structure type used inside a config section.
31
+ */
32
+ enum EntryType {
33
+ CFG_ENTRY_SIMPLE, // Simple key = value entry
34
+ CFG_ENTRY_BRACKET // Block entry: key { ... }
35
+ }
36
+
37
+ /**
38
+ * Content type of an entry's value.
39
+ */
40
+ enum ContentType {
41
+ CFG_CONTENT_SIMPLE = 0, // Single value
42
+ CFG_CONTENT_STRINGS, // Array of strings
43
+ CFG_CONTENT_ENTRIES // Array of nested entries
44
+ }
45
+
46
+ // ============================================================
47
+ // Loading and section lookup
48
+ // ============================================================
49
+
50
+ /**
51
+ * Loads a configuration file.
52
+ *
53
+ * @param fileName File name (e.g. "menu.ini"). If no extension is given,
54
+ * ".ini" is appended automatically.
55
+ * @return A ConfigFile handle on success, CFG_FILE_INVALID on failure.
56
+ */
57
+ native ConfigFile:cfg_load_file(const fileName[]);
58
+
59
+ /**
60
+ * Retrieves a section handle by name from a loaded configuration.
61
+ *
62
+ * @param cfg ConfigFile handle returned by cfg_load_file.
63
+ * @param sectionName Name of the section to look up.
64
+ * @return A ConfigSection handle on success,
65
+ * CFG_SECTION_INVALID if not found.
66
+ */
67
+ native ConfigSection:cfg_get_section(ConfigFile:cfg, const sectionName[]);
68
+
69
+ // ============================================================
70
+ // Reading values
71
+ // ============================================================
72
+
73
+ /**
74
+ * Retrieves a string value from a section.
75
+ *
76
+ * @param section ConfigSection handle.
77
+ * @param key Key name or path (e.g. "key" or "block/subkey").
78
+ * @param value Output buffer (recommended size: 512).
79
+ * @param len Maximum buffer length.
80
+ * @param index Value index for multi-value keys (default: 0).
81
+ * @return true if the value was found and written, false otherwise.
82
+ */
83
+ native bool:cfg_get_value(ConfigSection:section, const key[], value[], len, index = 0);
84
+
85
+ /**
86
+ * Retrieves a string value by its hierarchical path.
87
+ *
88
+ * @param section ConfigSection handle.
89
+ * @param path Path to the value (e.g. "MAIN/HUD").
90
+ * @param value Output buffer.
91
+ * @param len Maximum buffer length.
92
+ * @param index Value index (default: 0).
93
+ * @param lineIndex Line index within a block (default: 0).
94
+ * @return true if the value was found, false otherwise.
95
+ */
96
+ native bool:cfg_get_value_by_path(ConfigSection:section, const path[], value[], len, index = 0, lineIndex = 0);
97
+
98
+ /**
99
+ * Retrieves an integer value from a section.
100
+ *
101
+ * @param section ConfigSection handle.
102
+ * @param key Key name or path.
103
+ * @param index Value index (default: 0).
104
+ * @return Integer value, or 0 if not found.
105
+ */
106
+ native cfg_get_int(ConfigSection:section, const key[], index = 0);
107
+
108
+ /**
109
+ * Retrieves a float value from a section.
110
+ *
111
+ * @param section ConfigSection handle.
112
+ * @param key Key name or path.
113
+ * @param index Value index (default: 0).
114
+ * @return Float value, or 0.0 if not found.
115
+ */
116
+ native Float:cfg_get_float(ConfigSection:section, const key[], index = 0);
117
+
118
+ /**
119
+ * Retrieves a boolean value from a section.
120
+ *
121
+ * @param section ConfigSection handle.
122
+ * @param key Key name or path.
123
+ * @param index Value index (default: 0).
124
+ * @return true if the value is non-zero, false if not found or zero.
125
+ */
126
+ native bool:cfg_get_bool(ConfigSection:section, const key[], index = 0);
127
+
128
+ /**
129
+ * Returns a dynamic array of string tokens split from a single config line
130
+ * (space-delimited, quote-aware).
131
+ *
132
+ * @param section ConfigSection handle.
133
+ * @param key Key name or path.
134
+ * @param index Line index for multi-value keys (default: 0).
135
+ * @return Array handle with string tokens, or Invalid_Array on failure.
136
+ * The caller is responsible for destroying the array.
137
+ */
138
+ native Array:cfg_get_value_array(ConfigSection:section, const key[], index = 0);
139
+
140
+ /**
141
+ * Returns a dynamic array of float values parsed from a single config line.
142
+ *
143
+ * @param section ConfigSection handle.
144
+ * @param key Key name or path.
145
+ * @param index Line index for multi-value keys (default: 0).
146
+ * @return Array handle with Float values, or Invalid_Array on failure.
147
+ * The caller is responsible for destroying the array.
148
+ */
149
+ native Array:cfg_get_float_array(ConfigSection:section, const key[], index = 0);
150
+
151
+ /**
152
+ * Returns a dynamic array of tokens split from a value found by hierarchical path.
153
+ *
154
+ * @param section ConfigSection handle.
155
+ * @param path Path to the block (e.g. "MAIN/HUD").
156
+ * @param index Part index within the value (default: 0).
157
+ * @param lineIndex Line index within a block (default: 0).
158
+ * @return Array handle with string tokens, or Invalid_Array on failure.
159
+ */
160
+ native Array:cfg_get_value_array_by_path(ConfigSection:section, const path[], index = 0, lineIndex = 0);
161
+
162
+ /**
163
+ * Returns a dynamic array containing all top-level key names in a section.
164
+ *
165
+ * @param section ConfigSection handle.
166
+ * @return Array handle with key strings, or Invalid_Array if empty.
167
+ */
168
+ native Array:cfg_get_top_level_keys(ConfigSection:section);
169
+
170
+ /**
171
+ * Returns the raw section data as an array.
172
+ * The array contains three sub-arrays: keys, values and pair-index mappings.
173
+ *
174
+ * @param section ConfigSection handle.
175
+ * @return Array handle, or Invalid_Array if the section is empty.
176
+ */
177
+ native Array:cfg_get_section_data(ConfigSection:section);
178
+
179
+ /**
180
+ * Returns the number of values associated with a key.
181
+ *
182
+ * @param section ConfigSection handle.
183
+ * @param key Key name or path.
184
+ * @return Value count, or 0 if the key is not found.
185
+ */
186
+ native cfg_get_array_size(ConfigSection:section, const key[]);
187
+
188
+ // ============================================================
189
+ // Writing values
190
+ // ============================================================
191
+
192
+ /**
193
+ * Sets a string value for a key.
194
+ *
195
+ * @param section ConfigSection handle.
196
+ * @param key Key name.
197
+ * @param value String value to set.
198
+ * @param index Value index (default: 0).
199
+ * @return true on success, false otherwise.
200
+ */
201
+ native bool:cfg_set_value(ConfigSection:section, const key[], const value[], index = 0, lineIndex = 0);
202
+
203
+ /**
204
+ * Sets an integer value for a key.
205
+ *
206
+ * @param section ConfigSection handle.
207
+ * @param key Key name.
208
+ * @param value Integer value.
209
+ * @param index Value index (default: 0).
210
+ * @return true on success, false otherwise.
211
+ */
212
+ native bool:cfg_set_int(ConfigSection:section, const key[], value, index = 0);
213
+
214
+ /**
215
+ * Sets a float value for a key.
216
+ *
217
+ * @param section ConfigSection handle.
218
+ * @param key Key name.
219
+ * @param value Float value.
220
+ * @param index Value index (default: 0).
221
+ * @return true on success, false otherwise.
222
+ */
223
+ native bool:cfg_set_float(ConfigSection:section, const key[], Float:value, index = 0);
224
+
225
+ /**
226
+ * Sets a boolean value for a key.
227
+ *
228
+ * @param section ConfigSection handle.
229
+ * @param key Key name.
230
+ * @param value Boolean value.
231
+ * @param index Value index (default: 0).
232
+ * @return true on success, false otherwise.
233
+ */
234
+ native bool:cfg_set_bool(ConfigSection:section, const key[], bool:value, index = 0);
235
+
236
+ // ============================================================
237
+ // Key and section management
238
+ // ============================================================
239
+
240
+ /**
241
+ * Deletes a key from a section.
242
+ *
243
+ * @param section ConfigSection handle.
244
+ * @param key Key to delete.
245
+ * @return true if deleted, false if not found or section is invalid.
246
+ */
247
+ native bool:cfg_delete_key(ConfigSection:section, const key[]);
248
+
249
+ /**
250
+ * Checks whether a key exists in a section.
251
+ *
252
+ * @param section ConfigSection handle.
253
+ * @param key Key to check.
254
+ * @return true if the key exists, false otherwise.
255
+ */
256
+ native bool:cfg_has_key(ConfigSection:section, const key[]);
257
+
258
+ /**
259
+ * Creates a new in-memory section (not backed by a file).
260
+ *
261
+ * @param sectionName Name of the new section.
262
+ * @return ConfigSection handle on success, CFG_SECTION_INVALID on failure.
263
+ */
264
+ native ConfigSection:cfg_create_section(ConfigFile:cfg, const sectionName[]);
265
+
266
+ /**
267
+ * Sets the EntryType for a key in a section.
268
+ *
269
+ * @param section ConfigSection handle.
270
+ * @param key Key name.
271
+ * @param entryType CFG_ENTRY_SIMPLE or CFG_ENTRY_BRACKET.
272
+ * @return true on success, false otherwise.
273
+ */
274
+ native bool:cfg_set_entry_type(ConfigSection:section, const key[], EntryType:entryType);
275
+
276
+ /**
277
+ * Sets the ContentType for a key in a section.
278
+ *
279
+ * @param section ConfigSection handle.
280
+ * @param key Key name.
281
+ * @param contentType CFG_CONTENT_SIMPLE, CFG_CONTENT_STRINGS or CFG_CONTENT_ENTRIES.
282
+ * @return true on success, false otherwise.
283
+ */
284
+ native bool:cfg_set_entry_content_type(ConfigSection:section, const key[], ContentType:contentType);
285
+
286
+ // ============================================================
287
+ // Saving and writing
288
+ // ============================================================
289
+
290
+ /**
291
+ * Writes a section to a file.
292
+ * Can be called with 2 arguments (fileName, sectionName) or with 3 arguments
293
+ * (ConfigFile:cfg, fileName, sectionName) when you need to target a specific
294
+ * loaded file handle.
295
+ *
296
+ * @param fileName Destination file name (e.g. "core.ini").
297
+ * @param sectionName Section name to write.
298
+ * @return true on success, false otherwise.
299
+ */
300
+ native bool:cfg_write_file(ConfigFile:cfg, const fileName[], const sectionName[]);
301
+
302
+ /**
303
+ * Saves a loaded configuration back to its source file.
304
+ *
305
+ * ';' comment lines are round-tripped: a comment block is re-emitted before the
306
+ * element it preceded in the source (section / top-level key / bracket row).
307
+ * Only comments that were present in the loaded file survive — elements created
308
+ * programmatically (e.g. via cfg_set_value) carry no comment unless one already
309
+ * existed on that row. Pass fileName explicitly for multi-section files.
310
+ *
311
+ * @param cfg ConfigFile handle returned by cfg_load_file.
312
+ * @return true on success, false otherwise.
313
+ */
314
+ native bool:cfg_save_config(ConfigFile:cfg, const fileName[] = "");
315
+
316
+ // ============================================================
317
+ // Utility
318
+ // ============================================================
319
+
320
+ /**
321
+ * Sets the base directory used when resolving relative config file names.
322
+ *
323
+ * @param dir Path to the directory (e.g. "addons/amxmodx/configs/jbe").
324
+ */
325
+ native cfg_set_base_dir(const dir[]);
326
+
327
+ /**
328
+ * Returns the total number of sections currently loaded in memory.
329
+ *
330
+ * @return Section count.
331
+ */
332
+ native cfg_get_sections_count();
333
+
334
+ /**
335
+ * Returns the name of a loaded section by its sequential index.
336
+ *
337
+ * @param index Zero-based section index (0 .. cfg_get_sections_count() - 1).
338
+ * @param name Output buffer for the section name.
339
+ * @param len Maximum buffer length.
340
+ * @return 1 on success, 0 if the index is out of range.
341
+ */
342
+ native cfg_get_section_name(index, name[], len);
343
+
344
+ /**
345
+ * Sets the leading "; ..." comment of a bracket-block row (e.g. the column hint
346
+ * shown above the first data row). Mirrors what a file round-trip preserves, so
347
+ * blocks created programmatically can carry the same in-block hint.
348
+ *
349
+ * @param section Section handle (cfg_get_section / cfg_create_section).
350
+ * @param key Top-level bracket key holding the rows (e.g. "3x3", "CVARS").
351
+ * @param row Zero-based row index inside the block.
352
+ * @param comment Single comment line incl. leading ';'; "" clears it.
353
+ * @return true on success, false if the row/key was not found.
354
+ */
355
+ native bool:cfg_set_row_comment(ConfigSection:section, const key[], row, const comment[]);
@@ -0,0 +1,77 @@
1
+ // The rules of the amxts repositories' lint that oxlint has no native rule
2
+ // for, and whose ESLint plugin it cannot load, as an oxlint JS plugin:
3
+ // "jsPlugins": [{ "name": "amxts", "specifier": "@amxts/core/lint/oxlint-plugin.mjs" }]
4
+
5
+ /**
6
+ * ESLint's no-restricted-syntax: each option is an AST selector, or
7
+ * `{ selector, message }`, and a node it matches is an error.
8
+ */
9
+ const noRestrictedSyntax = {
10
+ meta: {
11
+ type: 'suggestion',
12
+ docs: { description: 'Disallow the syntax the options name, by AST selector (ESLint\'s no-restricted-syntax).' },
13
+ schema: false,
14
+ },
15
+ create(context) {
16
+ const visitors = {};
17
+ for (const option of context.options) {
18
+ const { selector, message } = typeof option === 'string' ? { selector: option, message: undefined } : option;
19
+ visitors[selector] = node => context.report({ node, message: message ?? `Using '${selector}' is not allowed.` });
20
+ }
21
+ return visitors;
22
+ },
23
+ };
24
+
25
+ /**
26
+ * eslint-plugin-jsdoc's check-alignment: the asterisks of a JSDoc block stand
27
+ * under the first asterisk of its `/**`. (The plugin itself imports eslint,
28
+ * which oxlint does not have.)
29
+ */
30
+ const jsdocCheckAlignment = {
31
+ meta: {
32
+ type: 'layout',
33
+ fixable: 'whitespace',
34
+ docs: { description: 'The asterisks of a JSDoc block stand in one column (eslint-plugin-jsdoc\'s check-alignment).' },
35
+ schema: [],
36
+ },
37
+ create(context) {
38
+ const source = context.sourceCode;
39
+ return {
40
+ Program() {
41
+ const text = source.text;
42
+ for (const comment of source.getAllComments()) {
43
+ if (comment.type !== 'Block' || !comment.value.startsWith('*')) continue;
44
+ const lineStart = text.lastIndexOf('\n', comment.range[0] - 1) + 1;
45
+ const indent = text.slice(lineStart, comment.range[0]);
46
+ // A block after code on its line has no column to keep.
47
+ if (/\S/.test(indent)) continue;
48
+ const wanted = `${indent} `;
49
+ const lines = comment.value.split('\n');
50
+ const wrong = [];
51
+ let at = comment.range[0] + 2;
52
+ for (const [index, line] of lines.entries()) {
53
+ // A line's own asterisk, or the last line's closing `*/`.
54
+ const lead = index === 0 ? null : index === lines.length - 1 && /^[ \t]*$/.test(line) ? [line, line] : /^([ \t]*)\*/.exec(line);
55
+ if (lead && lead[1] !== wanted) wrong.push([at, at + lead[1].length]);
56
+ at += line.length + 1;
57
+ }
58
+ // One report a block, as the plugin makes, and one fix for all its lines.
59
+ if (wrong.length === 0) continue;
60
+ context.report({
61
+ loc: { start: source.getLocFromIndex(wrong[0][0]), end: source.getLocFromIndex(wrong[0][1]) },
62
+ message: 'Expected JSDoc block to be aligned.',
63
+ fix: fixer => wrong.map(range => fixer.replaceTextRange(range, wanted)),
64
+ });
65
+ }
66
+ },
67
+ };
68
+ },
69
+ };
70
+
71
+ export default {
72
+ meta: { name: 'amxts' },
73
+ rules: {
74
+ 'no-restricted-syntax': noRestrictedSyntax,
75
+ 'jsdoc-check-alignment': jsdocCheckAlignment,
76
+ },
77
+ };
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright {yyyy} {name of copyright owner}
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.