Skip to content

Commit 5ef604d

Browse files
Krilliacclaude
andcommitted
Add server-side anti-cheat framework (movement/physics/spell/item detection + enforcement)
Introduces a config-gated, server-side anti-cheat / movement-validation framework. OFF by default (AntiCheat.Enable = 0) — fully inert until enabled. Core pieces: - AntiCheatMgr: central scoring manager. Detectors only observe and score via a single RecordViolation() ingress; the manager owns ALL enforcement. Score decays over time and escalates through capped actions (log -> GM alert -> rubberband to last validated position -> kick), with an optional account-level autoban accumulator (escalating ban durations, slow hourly decay). - MovementAnticheat: per-player validator running cheap, event-driven detectors on each movement packet — fly/flag-spoof (water-walk/hover/slow-fall/transport/ swim, aura- or grant-aware), teleport/blink, speed, acceleration gate, vertical climb, root/stun-break, opcode-legality, no-clip (VMap LoS), jump (infinite/ mid-air), fall-damage suppression, packet burst, client-timestamp regression, bot-movement heuristic, and spell-cast timing (GCD bypass + cast spam). - PhysicsValidator: side-effect-free terrain-plausibility stage (float-above / below-surface), invoked only on suspicion to stay off the hot path. Integration: movement validation in the movement opcode handler; spell-injection, item-in-trade, GO-use and NPC interaction-distance hooks; cast-timing hook; server-granted movement flags recorded in the Player Set* setters so the flag-spoof detectors don't fire on legit grants; a rolling latency EWMA fed from CMSG_PING for latency-aware tolerances. GM commands: .anticheat status / report / reload / warn / jail / unjail / delete. Violations persist to character_anticheat_violation; account autoban state to account_anticheat. Time-sync, the spoof/test GM tooling, and the violation-marker visualizer are follow-ups that build additively on this core. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 2fb5905 commit 5ef604d

25 files changed

Lines changed: 1940 additions & 5 deletions

cmake/MangosParams.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
set(MANGOS_EXP "CLASSIC")
22
set(MANGOS_PKG "Mangos Zero")
3-
set(MANGOS_WORLD_VER 2026061702)
3+
set(MANGOS_WORLD_VER 2026062002)
44
set(MANGOS_REALM_VER 2026060300)
55
set(MANGOS_AHBOT_VER 2021010100)
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
* Anti-Cheat / Movement-Validation framework — shared definitions.
3+
* Slice 1 (core detection pipeline). See
4+
* docs/superpowers/specs/2026-06-17-anticheat-detection-framework-slice1-design.md
5+
*
6+
* This header carries only enums and small constants so it can be included
7+
* widely without pulling heavy dependencies.
8+
*/
9+
10+
#ifndef MANGOS_ANTICHEAT_DEFINES_H
11+
#define MANGOS_ANTICHEAT_DEFINES_H
12+
13+
#include "Common.h"
14+
15+
// Types of detected violations. Persisted as the `type` column and used as the
16+
// index into the (config-driven) scoring weights.
17+
enum AntiCheatViolationType
18+
{
19+
AC_VIOLATION_NONE = 0,
20+
AC_VIOLATION_SPEED = 1, // horizontal speed beyond allowed + tolerance
21+
AC_VIOLATION_TELEPORT = 2, // single-packet jump beyond latency-adjusted max
22+
AC_VIOLATION_VERTICAL = 3, // unexplained upward Z movement (no jump/levitate/fly)
23+
AC_VIOLATION_FLAG_CONTRADICT = 4, // movement flags that the server never granted
24+
AC_VIOLATION_PHYSICS = 5, // position implausible vs terrain/liquid/collision
25+
AC_VIOLATION_DESYNC = 6, // latency drift / time-sync anomaly (informational)
26+
AC_VIOLATION_JUMP = 7, // illegal mid-air / infinite jump (re-jump while airborne)
27+
AC_VIOLATION_FALL = 8, // fall-damage suppression (big drop, no FALL_LAND)
28+
AC_VIOLATION_BURST = 9, // abnormal burst of movement packets (flood/timing)
29+
AC_VIOLATION_PACKETTIMING = 10, // client movement timestamp inconsistency
30+
AC_VIOLATION_SPELL = 11, // cast of a spell the player does not have (injection)
31+
AC_VIOLATION_ITEM = 12, // illegitimate item use (e.g. using an item in the trade window)
32+
AC_VIOLATION_INTERACT = 13, // interaction beyond range (remote loot/use/interact attempt)
33+
AC_VIOLATION_BOT = 14, // bot-like movement (snap-to-waypoint + metronomic timing)
34+
35+
AC_VIOLATION_MAX
36+
};
37+
38+
// Escalation actions. Also the meaning of the AntiCheat.Action config ceiling:
39+
// the manager never applies an action above the configured maximum.
40+
enum AntiCheatAction
41+
{
42+
AC_ACTION_NONE = 0, // disabled
43+
AC_ACTION_LOG = 1, // record only (log + DB)
44+
AC_ACTION_GM_ALERT = 2, // notify online GMs
45+
AC_ACTION_RUBBERBAND = 3, // teleport player back to last validated position
46+
AC_ACTION_KICK = 4 // disconnect the session
47+
};
48+
49+
// Result of the physics-plausibility stage.
50+
enum AntiCheatPhysicsResult
51+
{
52+
AC_PHYS_OK = 0, // position is plausible for the current move state
53+
AC_PHYS_SUSPECT = 1, // borderline; raise confidence but light weight
54+
AC_PHYS_IMPOSSIBLE = 2 // cannot legitimately occupy this position
55+
};
56+
57+
// Normalised movement state derived once from MovementInfo flags, so every
58+
// detector reasons over the same interpretation rather than re-reading flags.
59+
enum AntiCheatMoveState
60+
{
61+
AC_MOVE_GROUND = 0,
62+
AC_MOVE_SWIM = 1,
63+
AC_MOVE_FALL = 2,
64+
AC_MOVE_FLY = 3,
65+
AC_MOVE_TRANSPORT = 4
66+
};
67+
68+
#endif // MANGOS_ANTICHEAT_DEFINES_H

0 commit comments

Comments
 (0)