@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.
- package/LICENSE +21 -0
- package/README.md +162 -0
- package/README.ru.md +162 -0
- package/amxmodx/base/include/amxconst.inc +594 -0
- package/amxmodx/base/include/amxmisc.inc +902 -0
- package/amxmodx/base/include/amxmodx.inc +3447 -0
- package/amxmodx/base/include/amxmodx_version.inc +20 -0
- package/amxmodx/base/include/cellarray.inc +525 -0
- package/amxmodx/base/include/cellstack.inc +166 -0
- package/amxmodx/base/include/celltrie.inc +412 -0
- package/amxmodx/base/include/core.inc +202 -0
- package/amxmodx/base/include/csstats.inc +298 -0
- package/amxmodx/base/include/csstats_const.inc +29 -0
- package/amxmodx/base/include/cstrike.inc +1287 -0
- package/amxmodx/base/include/cstrike_const.inc +521 -0
- package/amxmodx/base/include/csx.inc +259 -0
- package/amxmodx/base/include/cvars.inc +547 -0
- package/amxmodx/base/include/datapack.inc +161 -0
- package/amxmodx/base/include/dbi.inc +154 -0
- package/amxmodx/base/include/dodconst.inc +152 -0
- package/amxmodx/base/include/dodfun.inc +152 -0
- package/amxmodx/base/include/dodstats.inc +69 -0
- package/amxmodx/base/include/dodx.inc +161 -0
- package/amxmodx/base/include/engine.inc +1343 -0
- package/amxmodx/base/include/engine_const.inc +310 -0
- package/amxmodx/base/include/engine_stocks.inc +248 -0
- package/amxmodx/base/include/esf.inc +70 -0
- package/amxmodx/base/include/esf_const.inc +74 -0
- package/amxmodx/base/include/fakemeta.inc +1127 -0
- package/amxmodx/base/include/fakemeta_const.inc +793 -0
- package/amxmodx/base/include/fakemeta_stocks.inc +395 -0
- package/amxmodx/base/include/fakemeta_util.inc +882 -0
- package/amxmodx/base/include/file.inc +666 -0
- package/amxmodx/base/include/float.inc +422 -0
- package/amxmodx/base/include/fun.inc +333 -0
- package/amxmodx/base/include/gameconfig.inc +93 -0
- package/amxmodx/base/include/geoip.inc +264 -0
- package/amxmodx/base/include/ham_const.inc +4352 -0
- package/amxmodx/base/include/hamsandwich.inc +439 -0
- package/amxmodx/base/include/hlsdk_const.inc +808 -0
- package/amxmodx/base/include/json.inc +777 -0
- package/amxmodx/base/include/lang.inc +119 -0
- package/amxmodx/base/include/message_const.inc +1130 -0
- package/amxmodx/base/include/message_stocks.inc +161 -0
- package/amxmodx/base/include/messages.inc +604 -0
- package/amxmodx/base/include/newmenus.inc +387 -0
- package/amxmodx/base/include/ns.inc +754 -0
- package/amxmodx/base/include/ns_const.inc +196 -0
- package/amxmodx/base/include/nvault.inc +154 -0
- package/amxmodx/base/include/regex.inc +348 -0
- package/amxmodx/base/include/sockets.inc +183 -0
- package/amxmodx/base/include/sorting.inc +107 -0
- package/amxmodx/base/include/sqlx.inc +582 -0
- package/amxmodx/base/include/string.inc +786 -0
- package/amxmodx/base/include/string_const.inc +156 -0
- package/amxmodx/base/include/string_stocks.inc +325 -0
- package/amxmodx/base/include/textparse_ini.inc +214 -0
- package/amxmodx/base/include/textparse_smc.inc +261 -0
- package/amxmodx/base/include/tfcconst.inc +84 -0
- package/amxmodx/base/include/tfcstats.inc +62 -0
- package/amxmodx/base/include/tfcx.inc +148 -0
- package/amxmodx/base/include/time.inc +118 -0
- package/amxmodx/base/include/tsconst.inc +154 -0
- package/amxmodx/base/include/tsfun.inc +198 -0
- package/amxmodx/base/include/tsstats.inc +65 -0
- package/amxmodx/base/include/tsx.inc +88 -0
- package/amxmodx/base/include/vault.inc +60 -0
- package/amxmodx/base/include/vector.inc +131 -0
- package/amxmodx/base/include/xs.inc +1570 -0
- package/as/amxts.d.ts +153 -0
- package/as/constants.ts +4730 -0
- package/as/effects.ts +1449 -0
- package/as/entities.ts +5482 -0
- package/as/events.ts +3054 -0
- package/as/facade.ts +4639 -0
- package/as/flags.ts +299 -0
- package/as/fs.ts +287 -0
- package/as/hooks.ts +18536 -0
- package/as/kit.ts +25 -0
- package/as/lib/check.ts +86 -0
- package/as/modules/http.ts +184 -0
- package/as/natives.ts +11845 -0
- package/as/os.ts +30 -0
- package/as/promise.ts +1392 -0
- package/as/promise.types.d.ts +82 -0
- package/as/remote.ts +288 -0
- package/as/tsconfig.json +22 -0
- package/as/vector.ts +65 -0
- package/bin/amxts.mjs +10 -0
- package/includes/menu_core.inc +355 -0
- package/includes/order.txt +54 -0
- package/includes/sources.json +27 -0
- package/includes/universal_config.inc +355 -0
- package/lint/oxlint-plugin.mjs +77 -0
- package/node_modules/assemblyscript/LICENSE +201 -0
- package/node_modules/assemblyscript/NOTICE +93 -0
- package/node_modules/assemblyscript/package.json +63 -0
- package/node_modules/assemblyscript/std/README.md +6 -0
- package/node_modules/assemblyscript/std/assembly/array.ts +526 -0
- package/node_modules/assemblyscript/std/assembly/arraybuffer.ts +77 -0
- package/node_modules/assemblyscript/std/assembly/atomics.ts +127 -0
- package/node_modules/assemblyscript/std/assembly/bindings/asyncify.ts +16 -0
- package/node_modules/assemblyscript/std/assembly/bindings/dom.ts +291 -0
- package/node_modules/assemblyscript/std/assembly/bindings/node.ts +6 -0
- package/node_modules/assemblyscript/std/assembly/builtins.ts +2631 -0
- package/node_modules/assemblyscript/std/assembly/compat.ts +2 -0
- package/node_modules/assemblyscript/std/assembly/console.ts +42 -0
- package/node_modules/assemblyscript/std/assembly/crypto.ts +9 -0
- package/node_modules/assemblyscript/std/assembly/dataview.ts +181 -0
- package/node_modules/assemblyscript/std/assembly/date.ts +373 -0
- package/node_modules/assemblyscript/std/assembly/diagnostics.ts +11 -0
- package/node_modules/assemblyscript/std/assembly/error.ts +44 -0
- package/node_modules/assemblyscript/std/assembly/function.ts +38 -0
- package/node_modules/assemblyscript/std/assembly/index.d.ts +2822 -0
- package/node_modules/assemblyscript/std/assembly/iterator.ts +35 -0
- package/node_modules/assemblyscript/std/assembly/map.ts +260 -0
- package/node_modules/assemblyscript/std/assembly/math.ts +3289 -0
- package/node_modules/assemblyscript/std/assembly/memory.ts +123 -0
- package/node_modules/assemblyscript/std/assembly/number.ts +388 -0
- package/node_modules/assemblyscript/std/assembly/object.ts +36 -0
- package/node_modules/assemblyscript/std/assembly/performance.ts +9 -0
- package/node_modules/assemblyscript/std/assembly/polyfills.ts +27 -0
- package/node_modules/assemblyscript/std/assembly/process.ts +50 -0
- package/node_modules/assemblyscript/std/assembly/reference.ts +48 -0
- package/node_modules/assemblyscript/std/assembly/regexp.ts +12 -0
- package/node_modules/assemblyscript/std/assembly/rt/README.md +83 -0
- package/node_modules/assemblyscript/std/assembly/rt/common.ts +81 -0
- package/node_modules/assemblyscript/std/assembly/rt/index-incremental.ts +2 -0
- package/node_modules/assemblyscript/std/assembly/rt/index-minimal.ts +2 -0
- package/node_modules/assemblyscript/std/assembly/rt/index-stub.ts +1 -0
- package/node_modules/assemblyscript/std/assembly/rt/index.d.ts +37 -0
- package/node_modules/assemblyscript/std/assembly/rt/itcms.ts +419 -0
- package/node_modules/assemblyscript/std/assembly/rt/rtrace.ts +15 -0
- package/node_modules/assemblyscript/std/assembly/rt/stub.ts +133 -0
- package/node_modules/assemblyscript/std/assembly/rt/tcms.ts +254 -0
- package/node_modules/assemblyscript/std/assembly/rt/tlsf.ts +592 -0
- package/node_modules/assemblyscript/std/assembly/rt.ts +87 -0
- package/node_modules/assemblyscript/std/assembly/set.ts +220 -0
- package/node_modules/assemblyscript/std/assembly/shared/feature.ts +65 -0
- package/node_modules/assemblyscript/std/assembly/shared/runtime.ts +11 -0
- package/node_modules/assemblyscript/std/assembly/shared/target.ts +11 -0
- package/node_modules/assemblyscript/std/assembly/shared/tsconfig.json +11 -0
- package/node_modules/assemblyscript/std/assembly/shared/typeinfo.ts +72 -0
- package/node_modules/assemblyscript/std/assembly/staticarray.ts +401 -0
- package/node_modules/assemblyscript/std/assembly/string.ts +847 -0
- package/node_modules/assemblyscript/std/assembly/symbol.ts +114 -0
- package/node_modules/assemblyscript/std/assembly/table.ts +16 -0
- package/node_modules/assemblyscript/std/assembly/tsconfig.json +6 -0
- package/node_modules/assemblyscript/std/assembly/typedarray.ts +1945 -0
- package/node_modules/assemblyscript/std/assembly/uri.ts +17 -0
- package/node_modules/assemblyscript/std/assembly/util/bytes.ts +107 -0
- package/node_modules/assemblyscript/std/assembly/util/casemap.ts +497 -0
- package/node_modules/assemblyscript/std/assembly/util/error.ts +54 -0
- package/node_modules/assemblyscript/std/assembly/util/hash.ts +117 -0
- package/node_modules/assemblyscript/std/assembly/util/math.ts +1922 -0
- package/node_modules/assemblyscript/std/assembly/util/memory.ts +290 -0
- package/node_modules/assemblyscript/std/assembly/util/number.ts +873 -0
- package/node_modules/assemblyscript/std/assembly/util/sort.ts +313 -0
- package/node_modules/assemblyscript/std/assembly/util/string.ts +1202 -0
- package/node_modules/assemblyscript/std/assembly/util/uri.ts +275 -0
- package/node_modules/assemblyscript/std/assembly/vector.ts +4 -0
- package/node_modules/assemblyscript/std/assembly.json +16 -0
- package/node_modules/assemblyscript/std/portable/index.d.ts +462 -0
- package/node_modules/assemblyscript/std/portable/index.js +416 -0
- package/node_modules/assemblyscript/std/portable.json +11 -0
- package/node_modules/assemblyscript/std/types/assembly/index.d.ts +1 -0
- package/node_modules/assemblyscript/std/types/assembly/package.json +3 -0
- package/node_modules/assemblyscript/std/types/portable/index.d.ts +1 -0
- package/node_modules/assemblyscript/std/types/portable/package.json +3 -0
- package/node_modules/assemblyscript/tsconfig-base.json +13 -0
- package/package.json +112 -0
- package/runtime/deps/assemblyscript/LICENSE +201 -0
- package/runtime/deps/assemblyscript/NOTICE +93 -0
- package/runtime/deps/assemblyscript/bin/asc.js +35 -0
- package/runtime/deps/assemblyscript/dist/asc.js +25035 -0
- package/runtime/deps/assemblyscript/dist/assemblyscript.js +337 -0
- package/runtime/deps/assemblyscript/node_modules/binaryen/LICENSE +201 -0
- package/runtime/deps/assemblyscript/node_modules/binaryen/index.js +28905 -0
- package/runtime/deps/assemblyscript/node_modules/binaryen/package.json +50 -0
- package/runtime/deps/assemblyscript/node_modules/long/LICENSE +202 -0
- package/runtime/deps/assemblyscript/node_modules/long/index.js +1581 -0
- package/runtime/deps/assemblyscript/node_modules/long/package.json +58 -0
- package/runtime/deps/assemblyscript/package.json +114 -0
- package/runtime/host/amxts.inc +85 -0
- package/runtime/licenses/AMXX-LICENSE.txt +34 -0
- package/runtime/licenses/AssemblyScript-LICENSE +201 -0
- package/runtime/licenses/AssemblyScript-NOTICE +93 -0
- package/runtime/licenses/Binaryen-LICENSE +201 -0
- package/runtime/licenses/Bun-LICENSE.md +84 -0
- package/runtime/licenses/GPL-3.0.txt +674 -0
- package/runtime/licenses/LLVM-LICENSE.TXT +279 -0
- package/runtime/licenses/README.md +25 -0
- package/runtime/licenses/WAMR-LICENSE +219 -0
- package/runtime/natives.txt +1095 -0
- package/runtime/patches/README.md +59 -0
- package/runtime/patches/assemblyscript-0.28.20-amxts.patch +14174 -0
- package/runtime/patches/wamr-2.4.5-amxts.patch +364 -0
- package/scripts/apply-docs.ts +508 -0
- package/scripts/asc.ts +27 -0
- package/scripts/auto-imports.ts +258 -0
- package/scripts/build-wasm.ts +595 -0
- package/scripts/check.ts +93 -0
- package/scripts/compile-cache.ts +179 -0
- package/scripts/compile.ts +401 -0
- package/scripts/docker-server.ts +73 -0
- package/scripts/docs/as/amxts.ts +210 -0
- package/scripts/docs/as/effects.ts +1684 -0
- package/scripts/docs/as/facade.ts +3302 -0
- package/scripts/docs/as/fs.ts +173 -0
- package/scripts/docs/as/lib/check.ts +68 -0
- package/scripts/docs/as/modules/http.ts +66 -0
- package/scripts/docs/as/os.ts +16 -0
- package/scripts/docs/as/promise.ts +132 -0
- package/scripts/docs/as/promise.types.ts +63 -0
- package/scripts/docs/as/vector.ts +48 -0
- package/scripts/docs/entities.ts +2338 -0
- package/scripts/docs/events.ts +245 -0
- package/scripts/docs/game.ts +497 -0
- package/scripts/docs/messages.ts +148 -0
- package/scripts/file-contents.ts +74 -0
- package/scripts/includes.ts +134 -0
- package/scripts/player-fields.ts +866 -0
- package/scripts/plugin-cache.ts +92 -0
- package/scripts/plugin-natives.ts +1157 -0
- package/scripts/prebuilt.ts +268 -0
- package/scripts/prepare.ts +134 -0
- package/scripts/project.ts +973 -0
- package/scripts/run.ts +28 -0
- package/scripts/shared-modules.ts +906 -0
- package/scripts/system.ts +33 -0
- package/scripts/tracked-fs.ts +115 -0
- package/scripts/typed-configs.ts +788 -0
- package/scripts/ui.ts +77 -0
- package/src/cli-api.mjs +175 -0
- package/src/parser/include-parser.ts +506 -0
- package/src/system.mjs +155 -0
- package/src/testing/compile-cache.ts +31 -0
- package/src/testing/compile.ts +222 -0
- package/src/testing/coroutines.ts +191 -0
- package/src/testing/index.ts +39 -0
- package/src/testing/kits.ts +55 -0
- package/src/testing/memory.ts +125 -0
- package/src/testing/natives.ts +925 -0
- package/src/testing/server.ts +1874 -0
- package/src/testing/setup.ts +63 -0
- package/src/testing/tables.ts +139 -0
- package/src/types.ts +51 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
// vim: set ts=4 sw=4 tw=99 noet:
|
|
2
|
+
//
|
|
3
|
+
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
|
4
|
+
// Copyright (C) The AMX Mod X Development Team.
|
|
5
|
+
//
|
|
6
|
+
// This software is licensed under the GNU General Public License, version 3 or higher.
|
|
7
|
+
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
|
8
|
+
// https://alliedmods.net/amxmodx-license
|
|
9
|
+
|
|
10
|
+
//
|
|
11
|
+
// Natural Selection Module Constants
|
|
12
|
+
//
|
|
13
|
+
|
|
14
|
+
#if defined NS_CONST_INC
|
|
15
|
+
#endinput
|
|
16
|
+
#endif
|
|
17
|
+
#define NS_CONST_INC
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
enum NSGameplay
|
|
21
|
+
{
|
|
22
|
+
NSGame_CantTell, /**< It is too soon to tell (can't find avhgameplay
|
|
23
|
+
entity or it doesn't have private data) */
|
|
24
|
+
|
|
25
|
+
NSGame_MarineVAlien, /**< Marine vs Aliens (standard) gameplay */
|
|
26
|
+
NSGame_MarineVMarine, /**< Marine vs Marine */
|
|
27
|
+
NSGame_AlienVAlien, /**< Alien vs Alien */
|
|
28
|
+
|
|
29
|
+
NSGame_Unknown, /**< Can find the gameplay entity, but can't
|
|
30
|
+
determine gameplay type. */
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// entity pev->iuser4 fields
|
|
34
|
+
enum {
|
|
35
|
+
MASK_NONE = 0,
|
|
36
|
+
MASK_SIGHTED = 1,
|
|
37
|
+
MASK_DETECTED = 2,
|
|
38
|
+
MASK_BUILDABLE = 4,
|
|
39
|
+
MASK_BASEBUILD0 = 8, // Base build slot #0
|
|
40
|
+
MASK_WEAPONS1 = 8, // Marine weapons 1
|
|
41
|
+
MASK_CARAPACE = 8, // Alien carapace
|
|
42
|
+
MASK_WEAPONS2 = 16, // Marines weapons 2
|
|
43
|
+
MASK_REGENERATION = 16, // Alien regeneration
|
|
44
|
+
MASK_BASEBUILD1 = 16, // Base build slot #1
|
|
45
|
+
MASK_WEAPONS3 = 32, // Marine weapons 3
|
|
46
|
+
MASK_REDEMPTION = 32, // Alien redemption
|
|
47
|
+
MASK_BASEBUILD2 = 32, // Base build slot #2
|
|
48
|
+
MASK_ARMOR1 = 64, // Marine armor 1
|
|
49
|
+
MASK_CELERITY = 64, // Alien celerity
|
|
50
|
+
MASK_BASEBUILD3 = 64, // Base build slot #3
|
|
51
|
+
MASK_ARMOR2 = 128, // Marine armor 2
|
|
52
|
+
MASK_ADRENALINE = 128, // Alien adrenaline
|
|
53
|
+
MASK_BASEBUILD4 = 128, // Base build slot #4
|
|
54
|
+
MASK_ARMOR3 = 256, // Marine armor 3
|
|
55
|
+
MASK_SILENCE = 256, // Alien silence
|
|
56
|
+
MASK_BASEBUILD5 = 256, // Base build slot #5
|
|
57
|
+
MASK_JETPACK = 512, // Marine jetpacks
|
|
58
|
+
MASK_CLOAKING = 512, // Alien cloaking
|
|
59
|
+
MASK_BASEBUILD6 = 512, // Base build slot #6
|
|
60
|
+
MASK_FOCUS = 1024, // Alien focus
|
|
61
|
+
MASK_MOTION = 1024, // Marine motion tracking
|
|
62
|
+
MASK_BASEBUILD7 = 1024, // Base build slot #7
|
|
63
|
+
MASK_SCENTOFFEAR = 2048, // Alien scent of fear
|
|
64
|
+
MASK_DEFENSE2 = 4096, // Defense level 2
|
|
65
|
+
MASK_DEFENSE3 = 8192, // Defense level 3
|
|
66
|
+
MASK_ELECTRICITY = 8192, // Electricy
|
|
67
|
+
MASK_MOVEMENT2 = 16384, // Movement level 2,
|
|
68
|
+
MASK_MOVEMENT3 = 32768, // Movement level 3
|
|
69
|
+
MASK_HEAVYARMOR = 32768, // Marine heavy armor
|
|
70
|
+
MASK_SENSORY2 = 65536, // Sensory level 2
|
|
71
|
+
MASK_SENSORY3 = 131072, // Sensory level 3
|
|
72
|
+
MASK_ALIEN_MOVEMENT = 262144, // Onos is charging
|
|
73
|
+
MASK_WALLSTICKING = 524288, // Flag for wall-sticking
|
|
74
|
+
MASK_PRIMALSCREAM = 1048576, // Alien is in range of active primal scream
|
|
75
|
+
MASK_UMBRA = 2097152, // In umbra
|
|
76
|
+
MASK_DIGESTING = 4194304, // When set on a visible player, player is digesting. When set on invisible player, player is being digested
|
|
77
|
+
MASK_RECYCLING = 8388608, // Building is recycling
|
|
78
|
+
MASK_TOPDOWN = 16777216, // Commander view
|
|
79
|
+
MASK_PLAYER_STUNNED = 33554432, // Player has been stunned by stomp
|
|
80
|
+
MASK_ENSNARED = 67108864, // Webbed
|
|
81
|
+
MASK_ALIEN_EMBRYO = 134217728, // Gestating
|
|
82
|
+
MASK_SELECTABLE = 268435456, // ???
|
|
83
|
+
MASK_PARASITED = 536870912, // Parasite flag
|
|
84
|
+
MASK_SENSORY_NEARBY = 1073741824 // Sensory chamber in range
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
enum {
|
|
89
|
+
CLASS_UNKNOWN = 0,
|
|
90
|
+
CLASS_SKULK,
|
|
91
|
+
CLASS_GORGE,
|
|
92
|
+
CLASS_LERK,
|
|
93
|
+
CLASS_FADE,
|
|
94
|
+
CLASS_ONOS,
|
|
95
|
+
CLASS_MARINE,
|
|
96
|
+
CLASS_JETPACK,
|
|
97
|
+
CLASS_HEAVY,
|
|
98
|
+
CLASS_COMMANDER,
|
|
99
|
+
CLASS_GESTATE,
|
|
100
|
+
CLASS_DEAD,
|
|
101
|
+
CLASS_NOTEAM
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
enum {
|
|
105
|
+
WEAPON_NONE = 0,
|
|
106
|
+
WEAPON_CLAWS,
|
|
107
|
+
WEAPON_SPIT,
|
|
108
|
+
WEAPON_SPORES,
|
|
109
|
+
WEAPON_SPIKE,
|
|
110
|
+
WEAPON_BITE,
|
|
111
|
+
WEAPON_BITE2,
|
|
112
|
+
WEAPON_SWIPE,
|
|
113
|
+
WEAPON_WEBSPINNER,
|
|
114
|
+
WEAPON_METABOLIZE,
|
|
115
|
+
WEAPON_PARASITE,
|
|
116
|
+
WEAPON_BLINK,
|
|
117
|
+
WEAPON_DIVINEWIND,
|
|
118
|
+
WEAPON_KNIFE,
|
|
119
|
+
WEAPON_PISTOL,
|
|
120
|
+
WEAPON_LMG,
|
|
121
|
+
WEAPON_SHOTGUN,
|
|
122
|
+
WEAPON_HMG,
|
|
123
|
+
WEAPON_WELDER,
|
|
124
|
+
WEAPON_MINE,
|
|
125
|
+
WEAPON_GRENADE_GUN,
|
|
126
|
+
WEAPON_LEAP,
|
|
127
|
+
WEAPON_CHARGE,
|
|
128
|
+
WEAPON_UMBRA,
|
|
129
|
+
WEAPON_PRIMALSCREAM,
|
|
130
|
+
WEAPON_BILEBOMB,
|
|
131
|
+
WEAPON_ACIDROCKET,
|
|
132
|
+
WEAPON_HEALINGSPRAY,
|
|
133
|
+
WEAPON_GRENADE,
|
|
134
|
+
WEAPON_STOMP,
|
|
135
|
+
WEAPON_DEVOUR,
|
|
136
|
+
WEAPON_MAX
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
enum {
|
|
140
|
+
HIVETRAIT_NONE = 0,
|
|
141
|
+
HIVETRAIT_DC = 92,
|
|
142
|
+
HIVETRAIT_SC = 93,
|
|
143
|
+
HIVETRAIT_MC = 94
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
enum NSPS_VelShape
|
|
147
|
+
{
|
|
148
|
+
NSPS_VS_POINT = 1,
|
|
149
|
+
NSPS_VS_BOX,
|
|
150
|
+
NSPS_VS_SPHERE,
|
|
151
|
+
NSPS_VS_BLOB
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
/* Genshape used in ns_set_ps_genshape
|
|
155
|
+
* NOTE: The following are in the ns.ps file but
|
|
156
|
+
* are not listed in the .fgd file. Use
|
|
157
|
+
* at your own risk!
|
|
158
|
+
* Line, Triangle, Plane, Cylinder,
|
|
159
|
+
* Cone, Disc, Rectangle and None
|
|
160
|
+
*/
|
|
161
|
+
enum NSPS_GenShape
|
|
162
|
+
{
|
|
163
|
+
NSPS_GS_POINT = 0,
|
|
164
|
+
NSPS_GS_LINE,
|
|
165
|
+
NSPS_GS_TRIANGLE,
|
|
166
|
+
NSPS_GS_PLANE,
|
|
167
|
+
NSPS_GS_BOX,
|
|
168
|
+
NSPS_GS_CYLINDER,
|
|
169
|
+
NSPS_GS_CONE,
|
|
170
|
+
NSPS_GS_BLOB,
|
|
171
|
+
NSPS_GS_DISC,
|
|
172
|
+
NSPS_GS_RECTANGLE,
|
|
173
|
+
NSPS_GS_NONE
|
|
174
|
+
};
|
|
175
|
+
enum NSPS_RenderMode
|
|
176
|
+
{
|
|
177
|
+
NSPS_R_NORMAL = 0,
|
|
178
|
+
NSPS_R_TRANSCOLOR,
|
|
179
|
+
NSPS_R_TRANSTEXTURE,
|
|
180
|
+
NSPS_R_GLOW,
|
|
181
|
+
NSPS_R_TRANSALPHA,
|
|
182
|
+
NSPS_R_ADDITIVE
|
|
183
|
+
};
|
|
184
|
+
enum NSPS_Flags
|
|
185
|
+
{
|
|
186
|
+
NSPS_FL_START_ON = 1,
|
|
187
|
+
NSPS_FL_PARTICLE_DENSITY = 2,
|
|
188
|
+
NSPS_FL_FADE_IN = 4,
|
|
189
|
+
NSPS_FL_FADE_OUT = 8,
|
|
190
|
+
NSPS_FL_USE_GRAVITY = 16,
|
|
191
|
+
NSPS_FL_USE_TRI = 32,
|
|
192
|
+
NSPS_FL_CONSTRAIN_PITCH = 128,
|
|
193
|
+
NSPS_FL_COLLIDE = 256,
|
|
194
|
+
NSPS_FL_HI_DETAIL = 512,
|
|
195
|
+
NSPS_FL_FACE_UP = 1024
|
|
196
|
+
};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
// vim: set ts=4 sw=4 tw=99 noet:
|
|
2
|
+
//
|
|
3
|
+
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
|
4
|
+
// Copyright (C) The AMX Mod X Development Team.
|
|
5
|
+
//
|
|
6
|
+
// This software is licensed under the GNU General Public License, version 3 or higher.
|
|
7
|
+
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
|
8
|
+
// https://alliedmods.net/amxmodx-license
|
|
9
|
+
|
|
10
|
+
//
|
|
11
|
+
// NVault Functions
|
|
12
|
+
//
|
|
13
|
+
|
|
14
|
+
#if defined _nvault_included
|
|
15
|
+
#endinput
|
|
16
|
+
#endif
|
|
17
|
+
#define _nvault_included
|
|
18
|
+
|
|
19
|
+
#pragma reqlib nvault
|
|
20
|
+
#if !defined AMXMODX_NOAUTOLOAD
|
|
21
|
+
#pragma loadlib nvault
|
|
22
|
+
#endif
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @global All timestamps are in UNIX epoch form.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Opens a vault by name. Creates a vault if it doesn't exist yet.
|
|
30
|
+
*
|
|
31
|
+
* @param name Name of the vault. The vault will be created in
|
|
32
|
+
* ${amxx_datadir}/vault directory.
|
|
33
|
+
*
|
|
34
|
+
* @return The vault handle to be used in other natives.
|
|
35
|
+
* INVALID_HANDLE (-1) if not successfully opened.
|
|
36
|
+
*/
|
|
37
|
+
native nvault_open(const name[]);
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Retrieves a value from the given key.
|
|
41
|
+
*
|
|
42
|
+
* @note An example of retrieving a string:
|
|
43
|
+
* nvault_get(vaultHandle, "myKey", myString, charsmax(myString));
|
|
44
|
+
*
|
|
45
|
+
* @param vault A vault handle returned from nvault_open()
|
|
46
|
+
* @param key A key to get the value from
|
|
47
|
+
* @param ... If three argument are given, gets a float value and
|
|
48
|
+
* puts it in the third argument by reference.
|
|
49
|
+
* If four arguments are given, gets a string from the
|
|
50
|
+
* vault and copies it to the third argument, up to
|
|
51
|
+
* 4th argument characters.
|
|
52
|
+
*
|
|
53
|
+
* @return Result as integer if only the first two arguments
|
|
54
|
+
* of the function are used.
|
|
55
|
+
* 1 if only the first three arguments are used.
|
|
56
|
+
* String length if all four parameters are used.
|
|
57
|
+
* @error On invalid vault handle.
|
|
58
|
+
*/
|
|
59
|
+
native nvault_get(vault, const key[], any:...);
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Retrieves full information about a vault entry.
|
|
63
|
+
*
|
|
64
|
+
* @param vault A vault handle returned from nvault_open()
|
|
65
|
+
* @param key A key to get information from
|
|
66
|
+
* @param value A string where the value should be stored
|
|
67
|
+
* @param maxlen Maximum length of the @value string
|
|
68
|
+
* @param timestamp The timestamp of the entry
|
|
69
|
+
*
|
|
70
|
+
* @return 1 if an entry was found, 0 otherwise.
|
|
71
|
+
* @error On invalid vault handle.
|
|
72
|
+
*/
|
|
73
|
+
native nvault_lookup(vault, const key[], value[], maxlen, ×tamp);
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Sets value of a vault entry and updates the timestamp.
|
|
77
|
+
*
|
|
78
|
+
* @note A new entry is created if one with the given key doesn't exist.
|
|
79
|
+
*
|
|
80
|
+
* @param vault A vault handle returned from nvault_open()
|
|
81
|
+
* @param key A key to set the value for
|
|
82
|
+
* @param value A value to set
|
|
83
|
+
*
|
|
84
|
+
* @noreturn
|
|
85
|
+
* @error On invalid vault handle.
|
|
86
|
+
*/
|
|
87
|
+
native nvault_set(vault, const key[], const value[]);
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Sets value of a vault entry and makes it permanent (non-erasable with nvault_prune()).
|
|
91
|
+
*
|
|
92
|
+
* @note A new entry is created if one with the given key doesn't exist.
|
|
93
|
+
* @note Permanent entries have no timestamp.
|
|
94
|
+
*
|
|
95
|
+
* @param vault A vault handle returned from nvault_open()
|
|
96
|
+
* @param key A key to set the permanent value for
|
|
97
|
+
* @param value A permanent value to set
|
|
98
|
+
*
|
|
99
|
+
* @noreturn
|
|
100
|
+
* @error On invalid vault handle.
|
|
101
|
+
*/
|
|
102
|
+
native nvault_pset(vault, const key[], const value[]);
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Prunes the vault for entries that are within the given timestamps.
|
|
106
|
+
*
|
|
107
|
+
* @note This will not erase values set with nvault_pset().
|
|
108
|
+
* @note An example of pruning all entries that are older than 24 hours:
|
|
109
|
+
* nvault_prune(vaultHandle, 0, get_systime() - (60 * 60 * 24));
|
|
110
|
+
*
|
|
111
|
+
* @param vault A vault handle returned from nvault_open()
|
|
112
|
+
* @param start The timestamp to start erasing from
|
|
113
|
+
* @param end The timestamp to erase to
|
|
114
|
+
*
|
|
115
|
+
* @return Number of erased values.
|
|
116
|
+
* @error On invalid vault handle.
|
|
117
|
+
*/
|
|
118
|
+
native nvault_prune(vault, start, end);
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Closes a vault.
|
|
122
|
+
*
|
|
123
|
+
* @param vault A vault handle returned from nvault_open()
|
|
124
|
+
*
|
|
125
|
+
* @noreturn
|
|
126
|
+
* @error On invalid vault handle.
|
|
127
|
+
*/
|
|
128
|
+
native nvault_close(vault);
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Removes an entry from the vault by its key.
|
|
132
|
+
*
|
|
133
|
+
* @param vault A vault handle returned from nvault_open()
|
|
134
|
+
* @param key The key to remove from the vault
|
|
135
|
+
*
|
|
136
|
+
* @noreturn
|
|
137
|
+
* @error On invalid vault handle.
|
|
138
|
+
*/
|
|
139
|
+
native nvault_remove(vault, const key[]);
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* "Touches" an entry in the vault, updating its timestamp.
|
|
143
|
+
*
|
|
144
|
+
* @note If timestamp is equal to -1, it will use the current time.
|
|
145
|
+
* @note An empty entry is created if one with the given key doesn't exist.
|
|
146
|
+
*
|
|
147
|
+
* @param vault A vault handle returned from nvault_open()
|
|
148
|
+
* @param key The key to search for
|
|
149
|
+
* @param timestamp Update an entry's timestamp to this one. Default is -1.
|
|
150
|
+
*
|
|
151
|
+
* @noreturn
|
|
152
|
+
* @error On invalid vault handle.
|
|
153
|
+
*/
|
|
154
|
+
native nvault_touch(vault, const key[], timestamp=-1);
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
// vim: set ts=4 sw=4 tw=99 noet:
|
|
2
|
+
//
|
|
3
|
+
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
|
4
|
+
// Copyright (C) The AMX Mod X Development Team.
|
|
5
|
+
//
|
|
6
|
+
// This software is licensed under the GNU General Public License, version 3 or higher.
|
|
7
|
+
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
|
8
|
+
// https://alliedmods.net/amxmodx-license
|
|
9
|
+
|
|
10
|
+
//
|
|
11
|
+
// Regular Expressions API
|
|
12
|
+
//
|
|
13
|
+
|
|
14
|
+
#if defined _regex_included
|
|
15
|
+
#endinput
|
|
16
|
+
#endif
|
|
17
|
+
#define _regex_included
|
|
18
|
+
|
|
19
|
+
#pragma reqlib regex
|
|
20
|
+
#if !defined AMXMODX_NOAUTOLOAD
|
|
21
|
+
#pragma loadlib regex
|
|
22
|
+
#endif
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
enum Regex
|
|
26
|
+
{
|
|
27
|
+
REGEX_MATCH_FAIL = -2,
|
|
28
|
+
REGEX_PATTERN_FAIL = -1,
|
|
29
|
+
REGEX_NO_MATCH = 0,
|
|
30
|
+
REGEX_OK = 1
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Flags for compiling regex expressions.
|
|
35
|
+
* These come directly from the pcre library and can be used in regex_compile_ex.
|
|
36
|
+
*/
|
|
37
|
+
#define PCRE_CASELESS 0x00000001 /* Ignore Case */
|
|
38
|
+
#define PCRE_MULTILINE 0x00000002 /* Multilines (affects ^ and $ so that they match the start/end of a line rather than matching the start/end of the string). */
|
|
39
|
+
#define PCRE_DOTALL 0x00000004 /* Single line (affects . so that it matches any character, even new line characters). */
|
|
40
|
+
#define PCRE_EXTENDED 0x00000008 /* Pattern extension (ignore whitespace and # comments). */
|
|
41
|
+
#define PCRE_ANCHORED 0x00000010 /* Force pattern anchoring. */
|
|
42
|
+
#define PCRE_DOLLAR_ENDONLY 0x00000020 /* $ not to match newline at end. */
|
|
43
|
+
#define PCRE_UNGREEDY 0x00000200 /* Invert greediness of quantifiers */
|
|
44
|
+
#define PCRE_NOTEMPTY 0x00000400 /* An empty string is not a valid match. */
|
|
45
|
+
#define PCRE_UTF8 0x00000800 /* Use UTF-8 Chars */
|
|
46
|
+
#define PCRE_NO_UTF8_CHECK 0x00002000 /* Do not check the pattern for UTF-8 validity (only relevant if PCRE_UTF8 is set) */
|
|
47
|
+
#define PCRE_NEVER_UTF 0x00010000 /* Lock out interpretation of the pattern as UTF-8 */
|
|
48
|
+
#define PCRE_FIRSTLINE 0x00040000 /* Force matching to be before newline */
|
|
49
|
+
#define PCRE_DUPNAMES 0x00080000 /* Allow duplicate names for subpattern */
|
|
50
|
+
#define PCRE_NEWLINE_CR 0x00100000 /* Specify that a newline is indicated by a single character CR ) */
|
|
51
|
+
#define PCRE_NEWLINE_CRLF 0x00300000 /* specify that a newline is indicated by the two-character CRLF sequence ) Overrides the default */
|
|
52
|
+
#define PCRE_NEWLINE_ANY 0x00400000 /* Specify that any Unicode newline sequence should be recognized. ) newline definition (LF) */
|
|
53
|
+
#define PCRE_NEWLINE_ANYCRLF 0x00500000 /* Specify that any of CR, LF and CRLF sequences should be recognized ) */
|
|
54
|
+
#define PCRE_UCP 0x20000000 /* Change the way PCRE processes \B, \b, \D, \d, \S, \s, \W, \w etc. to use Unicode properties */
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Regex expression error codes.
|
|
58
|
+
* This can be used with regex_compile_ex and regex_match_ex.
|
|
59
|
+
*/
|
|
60
|
+
enum /*RegexError*/
|
|
61
|
+
{
|
|
62
|
+
REGEX_ERROR_NONE = 0, /* No error */
|
|
63
|
+
REGEX_ERROR_NOMATCH = -1, /* No match was found */
|
|
64
|
+
REGEX_ERROR_NULL = -2,
|
|
65
|
+
REGEX_ERROR_BADOPTION = -3,
|
|
66
|
+
REGEX_ERROR_BADMAGIC = -4,
|
|
67
|
+
REGEX_ERROR_UNKNOWN_OPCODE = -5,
|
|
68
|
+
REGEX_ERROR_NOMEMORY = -6,
|
|
69
|
+
REGEX_ERROR_NOSUBSTRING = -7,
|
|
70
|
+
REGEX_ERROR_MATCHLIMIT = -8,
|
|
71
|
+
REGEX_ERROR_CALLOUT = -9, /* Never used by PCRE itself */
|
|
72
|
+
REGEX_ERROR_BADUTF8 = -10,
|
|
73
|
+
REGEX_ERROR_BADUTF8_OFFSET = -11,
|
|
74
|
+
REGEX_ERROR_PARTIAL = -12,
|
|
75
|
+
REGEX_ERROR_BADPARTIAL = -13,
|
|
76
|
+
REGEX_ERROR_INTERNAL = -14,
|
|
77
|
+
REGEX_ERROR_BADCOUNT = -15,
|
|
78
|
+
REGEX_ERROR_DFA_UITEM = -16,
|
|
79
|
+
REGEX_ERROR_DFA_UCOND = -17,
|
|
80
|
+
REGEX_ERROR_DFA_UMLIMIT = -18,
|
|
81
|
+
REGEX_ERROR_DFA_WSSIZE = -19,
|
|
82
|
+
REGEX_ERROR_DFA_RECURSE = -20,
|
|
83
|
+
REGEX_ERROR_RECURSIONLIMIT = -21,
|
|
84
|
+
REGEX_ERROR_NULLWSLIMIT = -22, /* No longer actually used */
|
|
85
|
+
REGEX_ERROR_BADNEWLINE = -23,
|
|
86
|
+
REGEX_ERROR_BADOFFSET = -24,
|
|
87
|
+
REGEX_ERROR_SHORTUTF8 = -25,
|
|
88
|
+
REGEX_ERROR_RECURSELOOP = -26,
|
|
89
|
+
REGEX_ERROR_JIT_STACKLIMIT = -27,
|
|
90
|
+
REGEX_ERROR_BADMODE = -28,
|
|
91
|
+
REGEX_ERROR_BADENDIANNESS = -29,
|
|
92
|
+
REGEX_ERROR_DFA_BADRESTART = -30,
|
|
93
|
+
REGEX_ERROR_JIT_BADOPTION = -31,
|
|
94
|
+
REGEX_ERROR_BADLENGTH = -32,
|
|
95
|
+
REGEX_ERROR_UNSET = -33
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Precompile a regular expression.
|
|
100
|
+
*
|
|
101
|
+
* @note Use this if you intend on using the same expression multiple times.
|
|
102
|
+
* Pass the regex handle returned here to regex_match_c to check for matches.
|
|
103
|
+
*
|
|
104
|
+
* @note This handle is automatically freed on map change. However,
|
|
105
|
+
* if you are completely done with it before then, you should
|
|
106
|
+
* call regex_free on this handle.
|
|
107
|
+
*
|
|
108
|
+
* @note Consider using regex_compile_ex instead if you want to use PCRE_* flags.
|
|
109
|
+
*
|
|
110
|
+
* @param pattern The regular expression pattern.
|
|
111
|
+
* @param ret Error code encountered, if applicable.
|
|
112
|
+
* @param error Error message encountered, if applicable.
|
|
113
|
+
* @param maxLen Maximum string length of the error buffer.
|
|
114
|
+
* @param flags General flags for the regular expression.
|
|
115
|
+
* i = Ignore case
|
|
116
|
+
* m = Multilines (affects ^ and $ so that they match
|
|
117
|
+
* the start/end of a line rather than matching the
|
|
118
|
+
* start/end of the string).
|
|
119
|
+
* s = Single line (affects . so that it matches any character,
|
|
120
|
+
* even new line characters).
|
|
121
|
+
* x = Pattern extension (ignore whitespace and # comments).
|
|
122
|
+
*
|
|
123
|
+
* @return -1 on error in the pattern, > valid regex handle (> 0) on success.
|
|
124
|
+
*/
|
|
125
|
+
native Regex:regex_compile(const pattern[], &ret = 0, error[] = "", maxLen = 0, const flags[]="");
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Matches a string against a pre-compiled regular expression pattern.
|
|
129
|
+
*
|
|
130
|
+
* @note You should free the returned handle with regex_free()
|
|
131
|
+
* when you are done with this pattern.
|
|
132
|
+
*
|
|
133
|
+
* @note Use the regex handle passed to this function to extract
|
|
134
|
+
* matches with regex_substr().
|
|
135
|
+
*
|
|
136
|
+
* @param string The string to check.
|
|
137
|
+
* @param pattern The regular expression pattern.
|
|
138
|
+
* @param ret Error code, if applicable, or number of results on success. See REGEX_ERROR_* defines.
|
|
139
|
+
*
|
|
140
|
+
* @return -2 = Matching error (error code is stored in ret)
|
|
141
|
+
* 0 = No match.
|
|
142
|
+
* >1 = Number of results.
|
|
143
|
+
*/
|
|
144
|
+
native regex_match_c(const string[], Regex:pattern, &ret = 0);
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Matches a string against a regular expression pattern.
|
|
148
|
+
*
|
|
149
|
+
* @note If you intend on using the same regular expression pattern
|
|
150
|
+
* multiple times, consider using regex_compile and regex_match_ex
|
|
151
|
+
* instead of making this function reparse the expression each time.
|
|
152
|
+
*
|
|
153
|
+
* @note Flags only exist in amxmodx 1.8 and later.
|
|
154
|
+
*
|
|
155
|
+
* @note You should free the returned handle with regex_free()
|
|
156
|
+
* when you are done extracting all of the substrings.
|
|
157
|
+
*
|
|
158
|
+
* @param string The string to check.
|
|
159
|
+
* @param pattern The regular expression pattern.
|
|
160
|
+
* @param ret Error code, or result state of the match.
|
|
161
|
+
* @param error Error message, if applicable.
|
|
162
|
+
* @param maxLen Maximum length of the error buffer.
|
|
163
|
+
* @param flags General flags for the regular expression.
|
|
164
|
+
* i = Ignore case
|
|
165
|
+
* m = Multilines (affects ^ and $ so that they match
|
|
166
|
+
* the start/end of a line rather than matching the
|
|
167
|
+
* start/end of the string).
|
|
168
|
+
* s = Single line (affects . so that it matches any character,
|
|
169
|
+
* even new line characters).
|
|
170
|
+
* x = Pattern extension (ignore whitespace and # comments).
|
|
171
|
+
*
|
|
172
|
+
* @return -2 = Matching error (error code is stored in ret)
|
|
173
|
+
* -1 = Error in pattern (error message and offset # in error and ret)
|
|
174
|
+
* 0 = No match.
|
|
175
|
+
* >1 = Handle for getting more information (via regex_substr)
|
|
176
|
+
*/
|
|
177
|
+
native Regex:regex_match(const string[], const pattern[], &ret = 0, error[] = "", maxLen = 0, const flags[] = "");
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Returns a matched substring from a regex handle.
|
|
181
|
+
*
|
|
182
|
+
* @note Substring ids start at 0 and end at ret - 1, where ret is from the corresponding
|
|
183
|
+
* regex_match* function call.
|
|
184
|
+
*
|
|
185
|
+
* @param id The regex handle to extract data from.
|
|
186
|
+
* @param str_id The index of the expression to get - starts at 0, and ends at ret - 1.
|
|
187
|
+
* @param buffer The buffer to set to the matching substring.
|
|
188
|
+
* @param maxLen The maximum string length of the buffer.
|
|
189
|
+
*
|
|
190
|
+
* @return 1 on success, otherwise 0 on failure.
|
|
191
|
+
*/
|
|
192
|
+
native regex_substr(Regex:id, str_id, buffer[], maxLen);
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Frees the memory associated with a regex result, and sets the handle to 0.
|
|
196
|
+
*
|
|
197
|
+
* @note This must be called on all results from regex_match() when you are done extracting
|
|
198
|
+
* the results with regex_substr().
|
|
199
|
+
*
|
|
200
|
+
* @note The results of regex_compile() or regex_compile_ex() (and subsequently, regex_match_c())
|
|
201
|
+
* only need to be freed when you are done using the pattern.
|
|
202
|
+
*
|
|
203
|
+
* @note Do not use the handle again after freeing it!
|
|
204
|
+
*
|
|
205
|
+
* @param id The regex handle to free.
|
|
206
|
+
* @noreturn
|
|
207
|
+
*/
|
|
208
|
+
native regex_free(&Regex:id);
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* The following natives are only available in 1.8.3 and above.
|
|
213
|
+
*/
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Precompile a regular expression.
|
|
217
|
+
*
|
|
218
|
+
* @note Use this if you intend on using the same expression multiple times.
|
|
219
|
+
* Pass the regex handle returned here to regex_match_c() to check for matches.
|
|
220
|
+
*
|
|
221
|
+
* @note Unlike regex_compile(), this allows you to use PCRE flags directly.
|
|
222
|
+
*
|
|
223
|
+
* @param pattern The regular expression pattern.
|
|
224
|
+
* @param flags General flags for the regular expression, see PCRE_* defines.
|
|
225
|
+
* @param error Error message encountered, if applicable.
|
|
226
|
+
* @param maxLen Maximum string length of the error buffer.
|
|
227
|
+
* @param errcode Regex type error code encountered, if applicable. See REGEX_ERROR_* defines.
|
|
228
|
+
*
|
|
229
|
+
* @return Valid regex handle (> 0) on success, or -1 on failure.
|
|
230
|
+
*/
|
|
231
|
+
native Regex:regex_compile_ex(const pattern[], flags = 0, error[]= "", maxLen = 0, &errcode = 0);
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Matches a string against a pre-compiled regular expression pattern, matching all
|
|
235
|
+
* occurrences of the pattern inside the string. This is similar to using the "g" flag
|
|
236
|
+
* in perl regex.
|
|
237
|
+
*
|
|
238
|
+
* @note You should free the returned handle (with regex_free())
|
|
239
|
+
* when you are done with this pattern.
|
|
240
|
+
*
|
|
241
|
+
* @note Use the regex handle passed to this function to extract
|
|
242
|
+
* matches with regex_substr().
|
|
243
|
+
*
|
|
244
|
+
* @param pattern The regular expression pattern.
|
|
245
|
+
* @param string The string to check.
|
|
246
|
+
* @param ret Error code, if applicable, or number of results on success.
|
|
247
|
+
* See REGEX_ERROR_* defines.
|
|
248
|
+
*
|
|
249
|
+
* @return -2 = Matching error (error code is stored in ret)
|
|
250
|
+
* 0 = No match.
|
|
251
|
+
* >1 = Number of results.
|
|
252
|
+
*/
|
|
253
|
+
native regex_match_all_c(const string[], Regex:pattern, &ret = 0);
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Matches a string against a regular expression pattern, matching all occurrences of the
|
|
257
|
+
* pattern inside the string. This is similar to using the "g" flag in perl regex.
|
|
258
|
+
*
|
|
259
|
+
* @note If you intend on using the same regular expression pattern
|
|
260
|
+
* multiple times, consider using regex_compile and regex_match_ex
|
|
261
|
+
* instead of making this function reparse the expression each time.
|
|
262
|
+
*
|
|
263
|
+
* @note Flags only exist in amxmodx 1.8 and later.
|
|
264
|
+
*
|
|
265
|
+
* @note You should free the returned handle with regex_free()
|
|
266
|
+
* when you are done extracting all of the substrings.
|
|
267
|
+
*
|
|
268
|
+
* @param string The string to check.
|
|
269
|
+
* @param pattern The regular expression pattern.
|
|
270
|
+
* @param flags General flags for the regular expression, see PCRE_* defines.
|
|
271
|
+
* @param error Error message encountered, if applicable.
|
|
272
|
+
* @param maxLen Maximum string length of the error buffer.
|
|
273
|
+
* @param errcode Regex type error code encountered, if applicable. See REGEX_ERROR_* defines.
|
|
274
|
+
*
|
|
275
|
+
* @return -2 = Matching error (error code is stored in ret)
|
|
276
|
+
* -1 = Error in pattern (error message and offset # in error and ret)
|
|
277
|
+
* 0 = No match.
|
|
278
|
+
* >1 = Handle for getting more information (via regex_substr)
|
|
279
|
+
*/
|
|
280
|
+
native Regex:regex_match_all(const string[], const pattern[], flags = 0, error[]= "", maxLen = 0, &errcode = 0);
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Matches a string against a regular expression pattern.
|
|
284
|
+
*
|
|
285
|
+
* @note If you intend on using the same regular expression pattern
|
|
286
|
+
* multiple times, consider using compile regex_compile_ex and regex_match*
|
|
287
|
+
* instead of making this function reparse the expression each time.
|
|
288
|
+
*
|
|
289
|
+
* @param str The string to check.
|
|
290
|
+
* @param pattern The regular expression pattern.
|
|
291
|
+
* @param flags General flags for the regular expression.
|
|
292
|
+
* @param error Error message, if applicable.
|
|
293
|
+
* @param maxLen Maximum length of the error buffer.
|
|
294
|
+
* @param errcode Regex type error code encountered, if applicable. See REGEX_ERROR_* defines.
|
|
295
|
+
*
|
|
296
|
+
* @return -2 = Matching error (error code is stored in ret)
|
|
297
|
+
* -1 = Pattern error (error code is stored in ret)
|
|
298
|
+
* 0 = No match.
|
|
299
|
+
* >1 = Number of results.
|
|
300
|
+
*/
|
|
301
|
+
stock regex_match_simple(const str[], const pattern[], flags = 0, error[]= "", maxLen = 0, &errcode = 0)
|
|
302
|
+
{
|
|
303
|
+
new Regex:regex = regex_compile_ex(pattern, flags, error, maxLen, errcode);
|
|
304
|
+
if (regex < REGEX_OK)
|
|
305
|
+
{
|
|
306
|
+
return -1;
|
|
307
|
+
}
|
|
308
|
+
new substrings = regex_match_c(str, regex);
|
|
309
|
+
regex_free(regex);
|
|
310
|
+
return substrings;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Flags used with regex_replace to control the replacement behavior.
|
|
315
|
+
*/
|
|
316
|
+
#define REGEX_FORMAT_DEFAULT 0 /* Uses the standard formatting rules to replace matches */
|
|
317
|
+
#define REGEX_FORMAT_NOCOPY (1<<0) /* The sections that do not match the regular expression are not copied when replacing matches. */
|
|
318
|
+
#define REGEX_FORMAT_FIRSTONLY (1<<1) /* Only the first occurrence of a regular expression is replaced. */
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Perform a regular expression search and replace.
|
|
322
|
+
*
|
|
323
|
+
* An optional parameter, flags, allows you to specify options on how the replacement is performed.
|
|
324
|
+
* Supported format specifiers for replace parameter:
|
|
325
|
+
* $number : Substitutes the substring matched by group number.
|
|
326
|
+
* n must be an integer value designating a valid backreference, greater than 0, and of two digits at most.
|
|
327
|
+
* ${name} : Substitutes the substring matched by the named group name (a maximum of 32 characters).
|
|
328
|
+
* $& : Substitutes a copy of the whole match.
|
|
329
|
+
* $` : Substitutes all the text of the input string before the match.
|
|
330
|
+
* $' : Substitutes all the text of the input string after the match.
|
|
331
|
+
* $+ : Substitutes the last group that was captured.
|
|
332
|
+
* $_ : Substitutes the entire input string.
|
|
333
|
+
* $$ : Substitutes a literal "$".
|
|
334
|
+
* As note, the character \ can be also used with format specifier, this is same hehavior as $.
|
|
335
|
+
*
|
|
336
|
+
* @param pattern The regular expression pattern.
|
|
337
|
+
* @param string The string to check.
|
|
338
|
+
* @param error Error message, if applicable.
|
|
339
|
+
* @param maxLen Maximum length of the error buffer.
|
|
340
|
+
* @param replace The string will be used to replace any matches. See above for format specifiers.
|
|
341
|
+
* @param flags General flags to control how the string is replaced. See REGEX_FORMAT_* defines.
|
|
342
|
+
* @param errcode Regex type error code encountered, if applicable. See REGEX_ERROR_* defines.
|
|
343
|
+
*
|
|
344
|
+
* @return -2 = Matching error (error code is stored in ret)
|
|
345
|
+
* 0 = No match.
|
|
346
|
+
* >1 = Number of matches.
|
|
347
|
+
*/
|
|
348
|
+
native regex_replace(Regex:pattern, string[], maxLen, const replace[], flags = REGEX_FORMAT_DEFAULT, &errcode = 0);
|