ddnet/datasrc/network.py
ChillerDragon 732798444c More detailed snapshot debug dump
The method CSnapShot::DebugDump() used to print just the raw snap items.
Without item names or field names:

```
2024-04-07 09:10:01 I snapshot: data_size=356 num_items=10
2024-04-07 09:10:01 I snapshot:         type=0 id=32767
2024-04-07 09:10:01 I snapshot:                   0  -1824658838        933dea6a
2024-04-07 09:10:01 I snapshot:                   1   -629591830        da7930ea
2024-04-07 09:10:01 I snapshot:                   2  -1450210576        a98f8af0
2024-04-07 09:10:01 I snapshot:                   3    914991429        3689a945
2024-04-07 09:10:01 I snapshot:         type=0 id=32766
2024-04-07 09:10:01 I snapshot:                   0    583701389        22ca938d
2024-04-07 09:10:01 I snapshot:                   1    327171627        13803e2b
2024-04-07 09:10:01 I snapshot:                   2  -1636052395        9e7bd255
2024-04-07 09:10:01 I snapshot:                   3  -1901674991        8ea6be11
2024-04-07 09:10:01 I snapshot:         type=0 id=32765
2024-04-07 09:10:01 I snapshot:                   0   1993229659        76ce455b
2024-04-07 09:10:01 I snapshot:                   1   -102024632        f9eb3a48
2024-04-07 09:10:01 I snapshot:                   2  -1378361269        add7e04b
2024-04-07 09:10:01 I snapshot:                   3  -1810037668        941d045c
2024-04-07 09:10:01 I snapshot:         type=6 id=0
2024-04-07 09:10:01 I snapshot:                   0            0        00000000
2024-04-07 09:10:01 I snapshot:                   1            0        00000000
2024-04-07 09:10:01 I snapshot:                   2            0        00000000
2024-04-07 09:10:01 I snapshot:                   3            0        00000000
2024-04-07 09:10:01 I snapshot:                   4            0        00000000
2024-04-07 09:10:01 I snapshot:                   5            0        00000000
2024-04-07 09:10:01 I snapshot:                   6            0        00000000
2024-04-07 09:10:01 I snapshot:                   7            1        00000001
2024-04-07 09:10:01 I snapshot:         type=32767 id=0
2024-04-07 09:10:01 I snapshot:                   0    247983155        0ec7ec33
2024-04-07 09:10:01 I snapshot:                   1            9        00000009
2024-04-07 09:10:01 I snapshot:                   2           64        00000040
2024-04-07 09:10:01 I snapshot:         type=11 id=0
2024-04-07 09:10:01 I snapshot:                   0  -1008145940        c3e8e9ec
2024-04-07 09:10:01 I snapshot:                   1   -320474428        ece5f2c4
2024-04-07 09:10:01 I snapshot:                   2   -220076049        f2e1e7ef
2024-04-07 09:10:01 I snapshot:                   3   -293568512        ee808000
2024-04-07 09:10:01 I snapshot:                   4  -1330727040        b0aeb780
2024-04-07 09:10:01 I snapshot:                   5  -2139062144        80808080
2024-04-07 09:10:01 I snapshot:                   6  -2139062272        80808000
2024-04-07 09:10:01 I snapshot:                   7           64        00000040
2024-04-07 09:10:01 I snapshot:                   8   -403511835        e7f2e5e5
2024-04-07 09:10:01 I snapshot:                   9   -286001183        eef3f7e1
2024-04-07 09:10:01 I snapshot:                  10   -219905920        f2e48080
2024-04-07 09:10:01 I snapshot:                  11  -2139062144        80808080
2024-04-07 09:10:01 I snapshot:                  12  -2139062144        80808080
2024-04-07 09:10:01 I snapshot:                  13  -2139062272        80808000
2024-04-07 09:10:01 I snapshot:                  14            0        00000000
2024-04-07 09:10:01 I snapshot:                  15      7199301        006dda45
2024-04-07 09:10:01 I snapshot:                  16      2345678        0023cace
2024-04-07 09:10:01 I snapshot:         type=10 id=0
2024-04-07 09:10:01 I snapshot:                   0            1        00000001
2024-04-07 09:10:01 I snapshot:                   1            0        00000000
2024-04-07 09:10:01 I snapshot:                   2            0        00000000
2024-04-07 09:10:01 I snapshot:                   3        -9999        ffffd8f1
2024-04-07 09:10:01 I snapshot:                   4            0        00000000
2024-04-07 09:10:01 I snapshot:         type=32766 id=0
2024-04-07 09:10:01 I snapshot:                   0            1        00000001
2024-04-07 09:10:01 I snapshot:                   1            0        00000000
2024-04-07 09:10:01 I snapshot:         type=9 id=0
2024-04-07 09:10:01 I snapshot:                   0          438        000001b6
2024-04-07 09:10:01 I snapshot:                   1         1968        000007b0
2024-04-07 09:10:01 I snapshot:                   2          913        00000391
2024-04-07 09:10:01 I snapshot:                   3            0        00000000
2024-04-07 09:10:01 I snapshot:                   4            0        00000000
2024-04-07 09:10:01 I snapshot:                   5            0        00000000
2024-04-07 09:10:01 I snapshot:                   6            0        00000000
2024-04-07 09:10:01 I snapshot:                   7            0        00000000
2024-04-07 09:10:01 I snapshot:                   8           -1        ffffffff
2024-04-07 09:10:01 I snapshot:                   9            0        00000000
2024-04-07 09:10:01 I snapshot:                  10            0        00000000
2024-04-07 09:10:01 I snapshot:                  11         1968        000007b0
2024-04-07 09:10:01 I snapshot:                  12          913        00000391
2024-04-07 09:10:01 I snapshot:                  13            0        00000000
2024-04-07 09:10:01 I snapshot:                  14            0        00000000
2024-04-07 09:10:01 I snapshot:                  15            1        00000001
2024-04-07 09:10:01 I snapshot:                  16           10        0000000a
2024-04-07 09:10:01 I snapshot:                  17           10        0000000a
2024-04-07 09:10:01 I snapshot:                  18            0        00000000
2024-04-07 09:10:01 I snapshot:                  19            1        00000001
2024-04-07 09:10:01 I snapshot:                  20            5        00000005
2024-04-07 09:10:01 I snapshot:                  21            0        00000000
2024-04-07 09:10:01 I snapshot:         type=32765 id=0
2024-04-07 09:10:01 I snapshot:                   0        49152        0000c000
2024-04-07 09:10:01 I snapshot:                   1            0        00000000
2024-04-07 09:10:01 I snapshot:                   2            2        00000002
2024-04-07 09:10:01 I snapshot:                   3            0        00000000
2024-04-07 09:10:01 I snapshot:                   4            0        00000000
2024-04-07 09:10:01 I snapshot:                   5            0        00000000
2024-04-07 09:10:01 I snapshot:                   6            0        00000000
2024-04-07 09:10:01 I snapshot:                   7            0        00000000
2024-04-07 09:10:01 I snapshot:                   8            1        00000001
2024-04-07 09:10:01 I snapshot:                   9            0        00000000
```

Now there is also `CNetObjHandler::DebugDumpSnapshot(const CSnapshot *pSnap)`
which prints the name of the snap item and also the names of all fields:

```
2024-04-07 09:21:42 I snapshot: data_size=356 num_items=10
2024-04-07 09:21:42 I snapshot:         EX/UUID type=0 id=32767 size=16
2024-04-07 09:21:42 I snapshot:                   0  -1824658838        933dea6a
2024-04-07 09:21:42 I snapshot:                   1   -629591830        da7930ea
2024-04-07 09:21:42 I snapshot:                   2  -1450210576        a98f8af0
2024-04-07 09:21:42 I snapshot:                   3    914991429        3689a945
2024-04-07 09:21:42 I snapshot:         EX/UUID type=0 id=32766 size=16
2024-04-07 09:21:42 I snapshot:                   0    583701389        22ca938d
2024-04-07 09:21:42 I snapshot:                   1    327171627        13803e2b
2024-04-07 09:21:42 I snapshot:                   2  -1636052395        9e7bd255
2024-04-07 09:21:42 I snapshot:                   3  -1901674991        8ea6be11
2024-04-07 09:21:42 I snapshot:         EX/UUID type=0 id=32765 size=16
2024-04-07 09:21:42 I snapshot:                   0   1993229659        76ce455b
2024-04-07 09:21:42 I snapshot:                   1   -102024632        f9eb3a48
2024-04-07 09:21:42 I snapshot:                   2  -1378361269        add7e04b
2024-04-07 09:21:42 I snapshot:                   3  -1810037668        941d045c
2024-04-07 09:21:42 I snapshot:         GameInfo type=6 id=0 size=32
2024-04-07 09:21:42 I snapshot:                   0            0        00000000        m_GameFlags=0 (min=0 max=256)
2024-04-07 09:21:42 I snapshot:                   1            0        00000000        m_GameStateFlags=0 (min=0 max=256)
2024-04-07 09:21:42 I snapshot:                   2            0        00000000        m_RoundStartTick=0 (NetTick)
2024-04-07 09:21:42 I snapshot:                   3            0        00000000        m_WarmupTimer=0 (min=min_int(-2147483648) max=max_int(2147483647))
2024-04-07 09:21:42 I snapshot:                   4            0        00000000        m_ScoreLimit=0 (min=0 max=max_int(2147483647))
2024-04-07 09:21:42 I snapshot:                   5            0        00000000        m_TimeLimit=0 (min=0 max=max_int(2147483647))
2024-04-07 09:21:42 I snapshot:                   6            0        00000000        m_RoundNum=0 (min=0 max=max_int(2147483647))
2024-04-07 09:21:42 I snapshot:                   7            1        00000001        m_RoundCurrent=1 (min=0 max=max_int(2147483647))
2024-04-07 09:21:42 I snapshot:         (out of range) type=32767 id=0 size=12
2024-04-07 09:21:42 I snapshot:                   0    247983155        0ec7ec33
2024-04-07 09:21:42 I snapshot:                   1            9        00000009
2024-04-07 09:21:42 I snapshot:                   2           64        00000040
2024-04-07 09:21:42 I snapshot:         ClientInfo type=11 id=0 size=68
2024-04-07 09:21:42 I snapshot:                   0  -1008145940        c3e8e9ec        m_Name0=-1008145940     IntsToStr: Chil
2024-04-07 09:21:42 I snapshot:                   1   -320474428        ece5f2c4        m_Name1=-320474428      IntsToStr: lerD
2024-04-07 09:21:42 I snapshot:                   2   -220076049        f2e1e7ef        m_Name2=-220076049      IntsToStr: rago
2024-04-07 09:21:42 I snapshot:                   3   -293568512        ee808000        m_Name3=-293568512      IntsToStr: n
2024-04-07 09:21:42 I snapshot:                   4  -1330727040        b0aeb780        m_Clan0=-1330727040     IntsToStr: 0.7
2024-04-07 09:21:42 I snapshot:                   5  -2139062144        80808080        m_Clan1=-2139062144     IntsToStr:
2024-04-07 09:21:42 I snapshot:                   6  -2139062272        80808000        m_Clan2=-2139062272     IntsToStr:
2024-04-07 09:21:42 I snapshot:                   7           64        00000040        m_Country=64
2024-04-07 09:21:42 I snapshot:                   8   -403511835        e7f2e5e5        m_Skin0=-403511835      IntsToStr: gree
2024-04-07 09:21:42 I snapshot:                   9   -286001183        eef3f7e1        m_Skin1=-286001183      IntsToStr: nswa
2024-04-07 09:21:42 I snapshot:                  10   -219905920        f2e48080        m_Skin2=-219905920      IntsToStr: rd
2024-04-07 09:21:42 I snapshot:                  11  -2139062144        80808080        m_Skin3=-2139062144     IntsToStr:
2024-04-07 09:21:42 I snapshot:                  12  -2139062144        80808080        m_Skin4=-2139062144     IntsToStr:
2024-04-07 09:21:42 I snapshot:                  13  -2139062272        80808000        m_Skin5=-2139062272     IntsToStr:
2024-04-07 09:21:42 I snapshot:                  14            0        00000000        m_UseCustomColor=0 (min=0 max=1)
2024-04-07 09:21:42 I snapshot:                  15      7199301        006dda45        m_ColorBody=7199301
2024-04-07 09:21:42 I snapshot:                  16      2345678        0023cace        m_ColorFeet=2345678
2024-04-07 09:21:42 I snapshot:         PlayerInfo type=10 id=0 size=20
2024-04-07 09:21:42 I snapshot:                   0            1        00000001        m_Local=1 (min=0 max=1)
2024-04-07 09:21:42 I snapshot:                   1            0        00000000        m_ClientId=0 (min=0 max=MAX_CLIENTS-1(63))
2024-04-07 09:21:42 I snapshot:                   2            0        00000000        m_Team=0 (min=TEAM_SPECTATORS(-1) max=TEAM_BLUE(1))
2024-04-07 09:21:42 I snapshot:                   3        -9999        ffffd8f1        m_Score=-9999
2024-04-07 09:21:42 I snapshot:                   4            0        00000000        m_Latency=0
2024-04-07 09:21:42 I snapshot:         (out of range) type=32766 id=0 size=8
2024-04-07 09:21:42 I snapshot:                   0            1        00000001
2024-04-07 09:21:42 I snapshot:                   1            0        00000000
2024-04-07 09:21:42 I snapshot:         Character type=9 id=0 size=88
2024-04-07 09:21:42 I snapshot:                   0          176        000000b0        m_Tick=176
2024-04-07 09:21:42 I snapshot:                   1         1968        000007b0        m_X=1968
2024-04-07 09:21:42 I snapshot:                   2          913        00000391        m_Y=913
2024-04-07 09:21:42 I snapshot:                   3            0        00000000        m_VelX=0
2024-04-07 09:21:42 I snapshot:                   4            0        00000000        m_VelY=0
2024-04-07 09:21:42 I snapshot:                   5            0        00000000        m_Angle=0
2024-04-07 09:21:42 I snapshot:                   6            0        00000000        m_Direction=0 (min=-1 max=1)
2024-04-07 09:21:42 I snapshot:                   7            0        00000000        m_Jumped=0 (min=0 max=3)
2024-04-07 09:21:42 I snapshot:                   8           -1        ffffffff        m_HookedPlayer=-1 (min=-1 max=MAX_CLIENTS-1(63))
2024-04-07 09:21:42 I snapshot:                   9            0        00000000        m_HookState=0 (min=-1 max=5)
2024-04-07 09:21:42 I snapshot:                  10            0        00000000        m_HookTick=0 (NetTick)
2024-04-07 09:21:42 I snapshot:                  11         1968        000007b0        m_HookX=1968
2024-04-07 09:21:42 I snapshot:                  12          913        00000391        m_HookY=913
2024-04-07 09:21:42 I snapshot:                  13            0        00000000        m_HookDx=0
2024-04-07 09:21:42 I snapshot:                  14            0        00000000        m_HookDy=0
2024-04-07 09:21:42 I snapshot:                  15            1        00000001        m_PlayerFlags=1 (min=0 max=256)
2024-04-07 09:21:42 I snapshot:                  16           10        0000000a        m_Health=10 (min=0 max=10)
2024-04-07 09:21:42 I snapshot:                  17           10        0000000a        m_Armor=10 (min=0 max=10)
2024-04-07 09:21:42 I snapshot:                  18            0        00000000        m_AmmoCount=0 (min=0 max=10)
2024-04-07 09:21:42 I snapshot:                  19            1        00000001        m_Weapon=1 (min=0 max=NUM_WEAPONS-1(5))
2024-04-07 09:21:42 I snapshot:                  20            5        00000005        m_Emote=5 (min=0 max=6)
2024-04-07 09:21:42 I snapshot:                  21            0        00000000        m_AttackTick=0 (min=0 max=max_int(2147483647))
2024-04-07 09:21:42 I snapshot:         (out of range) type=32765 id=0 size=40
2024-04-07 09:21:42 I snapshot:                   0        49152        0000c000
2024-04-07 09:21:42 I snapshot:                   1            0        00000000
2024-04-07 09:21:42 I snapshot:                   2            2        00000002
2024-04-07 09:21:42 I snapshot:                   3            0        00000000
2024-04-07 09:21:42 I snapshot:                   4            0        00000000
2024-04-07 09:21:42 I snapshot:                   5            0        00000000
2024-04-07 09:21:42 I snapshot:                   6            0        00000000
2024-04-07 09:21:42 I snapshot:                   7            0        00000000
2024-04-07 09:21:42 I snapshot:                   8            1        00000001
2024-04-07 09:21:42 I snapshot:                   9            0        00000000
```
2024-09-07 15:28:25 +08:00

598 lines
16 KiB
Python

# pylint: skip-file
# See https://github.com/ddnet/ddnet/issues/3507
from datatypes import Enum, Flags, NetArray, NetBool, NetEvent, NetEventEx, NetIntAny, NetTwIntString, NetIntRange
from datatypes import NetMessage, NetMessageEx, NetObject, NetObjectEx, NetString, NetStringHalfStrict, NetStringStrict, NetTick
Emotes = ["NORMAL", "PAIN", "HAPPY", "SURPRISE", "ANGRY", "BLINK"]
PlayerFlags = ["PLAYING", "IN_MENU", "CHATTING", "SCOREBOARD", "AIM"]
GameFlags = ["TEAMS", "FLAGS"]
GameStateFlags = ["GAMEOVER", "SUDDENDEATH", "PAUSED", "RACETIME"]
CharacterFlags = ["SOLO", "JETPACK", "COLLISION_DISABLED", "ENDLESS_HOOK", "ENDLESS_JUMP", "SUPER",
"HAMMER_HIT_DISABLED", "SHOTGUN_HIT_DISABLED", "GRENADE_HIT_DISABLED", "LASER_HIT_DISABLED", "HOOK_HIT_DISABLED",
"TELEGUN_GUN", "TELEGUN_GRENADE", "TELEGUN_LASER",
"WEAPON_HAMMER", "WEAPON_GUN", "WEAPON_SHOTGUN", "WEAPON_GRENADE", "WEAPON_LASER", "WEAPON_NINJA",
"MOVEMENTS_DISABLED", "IN_FREEZE", "PRACTICE_MODE", "LOCK_MODE", "TEAM0_MODE"]
GameInfoFlags = [
"TIMESCORE", "GAMETYPE_RACE", "GAMETYPE_FASTCAP", "GAMETYPE_FNG",
"GAMETYPE_DDRACE", "GAMETYPE_DDNET", "GAMETYPE_BLOCK_WORLDS",
"GAMETYPE_VANILLA", "GAMETYPE_PLUS", "FLAG_STARTS_RACE", "RACE",
"UNLIMITED_AMMO", "DDRACE_RECORD_MESSAGE", "RACE_RECORD_MESSAGE",
"ALLOW_EYE_WHEEL", "ALLOW_HOOK_COLL", "ALLOW_ZOOM", "BUG_DDRACE_GHOST",
"BUG_DDRACE_INPUT", "BUG_FNG_LASER_RANGE", "BUG_VANILLA_BOUNCE",
"PREDICT_FNG", "PREDICT_DDRACE", "PREDICT_DDRACE_TILES", "PREDICT_VANILLA",
"ENTITIES_DDNET", "ENTITIES_DDRACE", "ENTITIES_RACE", "ENTITIES_FNG",
"ENTITIES_VANILLA", "DONT_MASK_ENTITIES", "ENTITIES_BW"
# Full, use GameInfoFlags2 for more flags
]
GameInfoFlags2 = [
"ALLOW_X_SKINS", "GAMETYPE_CITY", "GAMETYPE_FDDRACE", "ENTITIES_FDDRACE", "HUD_HEALTH_ARMOR", "HUD_AMMO",
"HUD_DDRACE", "NO_WEAK_HOOK", "NO_SKIN_CHANGE_FOR_FROZEN"
]
ExPlayerFlags = ["AFK", "PAUSED", "SPEC"]
LegacyProjectileFlags = [f"CLIENTID_BIT{i}" for i in range(8)] + [
"NO_OWNER", "IS_DDNET", "BOUNCE_HORIZONTAL", "BOUNCE_VERTICAL",
"EXPLOSIVE", "FREEZE",
]
ProjectileFlags = [
"BOUNCE_HORIZONTAL", "BOUNCE_VERTICAL", "EXPLOSIVE", "FREEZE", "NORMALIZE_VEL",
]
LaserFlags = [
"NO_PREDICT",
]
LaserTypes = ["RIFLE", "SHOTGUN", "DOOR", "FREEZE", "DRAGGER", "GUN", "PLASMA"]
DraggerTypes = ["WEAK", "WEAK_NW", "NORMAL", "NORMAL_NW", "STRONG", "STRONG_NW"]
GunTypes = ["UNFREEZE", "EXPLOSIVE", "FREEZE", "EXPFREEZE"]
Emoticons = ["OOP", "EXCLAMATION", "HEARTS", "DROP", "DOTDOT", "MUSIC", "SORRY", "GHOST", "SUSHI", "SPLATTEE", "DEVILTEE", "ZOMG", "ZZZ", "WTF", "EYES", "QUESTION"]
Powerups = ["HEALTH", "ARMOR", "WEAPON", "NINJA", "ARMOR_SHOTGUN", "ARMOR_GRENADE", "ARMOR_NINJA", "ARMOR_LASER"]
Authed = ["NO", "HELPER", "MOD", "ADMIN"]
EntityClasses = ["PROJECTILE", "DOOR", "DRAGGER_WEAK", "DRAGGER_NORMAL", "DRAGGER_STRONG", "GUN_NORMAL", "GUN_EXPLOSIVE", "GUN_FREEZE", "GUN_UNFREEZE", "LIGHT", "PICKUP"]
Teams = ["ALL", "SPECTATORS", "RED", "BLUE", "WHISPER_SEND", "WHISPER_RECV"]
RawHeader = '''
#include <engine/shared/teehistorian_ex.h>
enum
{
INPUT_STATE_MASK=0x3f
};
enum
{
FLAG_MISSING=-3,
FLAG_ATSTAND,
FLAG_TAKEN,
SPEC_FREEVIEW=-1,
SPEC_FOLLOW=-2,
};
enum
{
GAMEINFO_CURVERSION=9,
};
'''
Enums = [
Enum("EMOTE", Emotes),
Enum("POWERUP", Powerups),
Enum("EMOTICON", Emoticons),
Enum("AUTHED", Authed),
Enum("ENTITYCLASS", EntityClasses),
Enum("LASERTYPE", LaserTypes),
Enum("LASERDRAGGERTYPE", DraggerTypes),
Enum("LASERGUNTYPE", GunTypes),
Enum("TEAM", Teams, -2),
]
Flags = [
Flags("PLAYERFLAG", PlayerFlags),
Flags("GAMEFLAG", GameFlags),
Flags("GAMESTATEFLAG", GameStateFlags),
Flags("CHARACTERFLAG", CharacterFlags),
Flags("GAMEINFOFLAG", GameInfoFlags),
Flags("GAMEINFOFLAG2", GameInfoFlags2),
Flags("EXPLAYERFLAG", ExPlayerFlags),
Flags("LEGACYPROJECTILEFLAG", LegacyProjectileFlags),
Flags("PROJECTILEFLAG", ProjectileFlags),
Flags("LASERFLAG", LaserFlags),
]
Objects = [
NetObject("PlayerInput", [
NetIntAny("m_Direction"),
NetIntAny("m_TargetX"),
NetIntAny("m_TargetY"),
NetIntAny("m_Jump"),
NetIntAny("m_Fire"),
NetIntAny("m_Hook"),
NetIntRange("m_PlayerFlags", 0, 256),
NetIntAny("m_WantedWeapon"),
NetIntAny("m_NextWeapon"),
NetIntAny("m_PrevWeapon"),
]),
NetObject("Projectile", [
NetIntAny("m_X"),
NetIntAny("m_Y"),
NetIntAny("m_VelX"),
NetIntAny("m_VelY"),
NetIntRange("m_Type", 0, 'NUM_WEAPONS-1'),
NetTick("m_StartTick"),
]),
NetObject("Laser", [
NetIntAny("m_X"),
NetIntAny("m_Y"),
NetIntAny("m_FromX"),
NetIntAny("m_FromY"),
NetTick("m_StartTick"),
]),
NetObject("Pickup", [
NetIntAny("m_X"),
NetIntAny("m_Y"),
NetIntRange("m_Type", 0, 'max_int'),
NetIntRange("m_Subtype", 0, 'max_int'),
]),
NetObject("Flag", [
NetIntAny("m_X"),
NetIntAny("m_Y"),
NetIntRange("m_Team", 'TEAM_RED', 'TEAM_BLUE')
]),
NetObject("GameInfo", [
NetIntRange("m_GameFlags", 0, 256),
NetIntRange("m_GameStateFlags", 0, 256),
NetTick("m_RoundStartTick"),
NetIntRange("m_WarmupTimer", 'min_int', 'max_int'),
NetIntRange("m_ScoreLimit", 0, 'max_int'),
NetIntRange("m_TimeLimit", 0, 'max_int'),
NetIntRange("m_RoundNum", 0, 'max_int'),
NetIntRange("m_RoundCurrent", 0, 'max_int'),
]),
NetObject("GameData", [
NetIntAny("m_TeamscoreRed"),
NetIntAny("m_TeamscoreBlue"),
NetIntRange("m_FlagCarrierRed", 'FLAG_MISSING', 'MAX_CLIENTS-1'),
NetIntRange("m_FlagCarrierBlue", 'FLAG_MISSING', 'MAX_CLIENTS-1'),
]),
NetObject("CharacterCore", [
NetIntAny("m_Tick"),
NetIntAny("m_X"),
NetIntAny("m_Y"),
NetIntAny("m_VelX"),
NetIntAny("m_VelY"),
NetIntAny("m_Angle"),
NetIntRange("m_Direction", -1, 1),
NetIntRange("m_Jumped", 0, 3),
NetIntRange("m_HookedPlayer", -1, 'MAX_CLIENTS-1'),
NetIntRange("m_HookState", -1, 5),
NetIntAny("m_HookTick"),
NetIntAny("m_HookX"),
NetIntAny("m_HookY"),
NetIntAny("m_HookDx"),
NetIntAny("m_HookDy"),
]),
NetObject("Character:CharacterCore", [
NetIntRange("m_PlayerFlags", 0, 256),
NetIntRange("m_Health", 0, 10),
NetIntRange("m_Armor", 0, 10),
NetIntRange("m_AmmoCount", 0, 10),
NetIntRange("m_Weapon", 0, 'NUM_WEAPONS-1'),
NetIntRange("m_Emote", 0, len(Emotes)),
NetIntRange("m_AttackTick", 0, 'max_int'),
]),
NetObject("PlayerInfo", [
NetIntRange("m_Local", 0, 1),
NetIntRange("m_ClientId", 0, 'MAX_CLIENTS-1'),
NetIntRange("m_Team", 'TEAM_SPECTATORS', 'TEAM_BLUE'),
NetIntAny("m_Score"),
NetIntAny("m_Latency"),
]),
NetObject("ClientInfo", [
# 4*4 = 16 characters
NetTwIntString("m_Name0"), NetTwIntString("m_Name1"), NetTwIntString("m_Name2"),
NetTwIntString("m_Name3"),
# 4*3 = 12 characters
NetTwIntString("m_Clan0"), NetTwIntString("m_Clan1"), NetTwIntString("m_Clan2"),
NetIntAny("m_Country"),
# 4*6 = 24 characters
NetTwIntString("m_Skin0"), NetTwIntString("m_Skin1"), NetTwIntString("m_Skin2"),
NetTwIntString("m_Skin3"), NetTwIntString("m_Skin4"), NetTwIntString("m_Skin5"),
NetIntRange("m_UseCustomColor", 0, 1),
NetIntAny("m_ColorBody"),
NetIntAny("m_ColorFeet"),
]),
NetObject("SpectatorInfo", [
NetIntRange("m_SpectatorId", 'SPEC_FREEVIEW', 'MAX_CLIENTS-1'),
NetIntAny("m_X"),
NetIntAny("m_Y"),
]),
NetObjectEx("MyOwnObject", "my-own-object@heinrich5991.de", [
NetIntAny("m_Test"),
]),
NetObjectEx("DDNetCharacter", "character@netobj.ddnet.tw", [
NetIntAny("m_Flags", 0),
NetTick("m_FreezeEnd", 0),
NetIntRange("m_Jumps", -1, 255, 2),
NetIntAny("m_TeleCheckpoint", -1),
NetIntRange("m_StrongWeakId", 0, 'MAX_CLIENTS-1', 0),
# New data fields for jump display, freeze bar and ninja bar
# Default values indicate that these values should not be used
NetIntRange("m_JumpedTotal", -1, 255, -1),
NetTick("m_NinjaActivationTick", -1),
NetTick("m_FreezeStart", -1),
# New data fields for improved target accuracy
NetIntAny("m_TargetX", 0),
NetIntAny("m_TargetY", 0),
], validate_size=False),
NetObjectEx("DDNetPlayer", "player@netobj.ddnet.tw", [
NetIntAny("m_Flags"),
NetIntRange("m_AuthLevel", "AUTHED_NO", "AUTHED_ADMIN"),
]),
NetObjectEx("GameInfoEx", "gameinfo@netobj.ddnet.tw", [
NetIntAny("m_Flags", 0),
NetIntAny("m_Version", 0),
NetIntAny("m_Flags2", 0),
], validate_size=False),
# The code assumes that this has the same in-memory representation as
# the Projectile net object.
NetObjectEx("DDRaceProjectile", "projectile@netobj.ddnet.tw", [
NetIntAny("m_X"),
NetIntAny("m_Y"),
NetIntAny("m_Angle"),
NetIntAny("m_Data"),
NetIntRange("m_Type", 0, 'NUM_WEAPONS-1'),
NetTick("m_StartTick"),
]),
NetObjectEx("DDNetLaser", "laser@netobj.ddnet.tw", [
NetIntAny("m_ToX"),
NetIntAny("m_ToY"),
NetIntAny("m_FromX"),
NetIntAny("m_FromY"),
NetTick("m_StartTick"),
NetIntRange("m_Owner", -1, 'MAX_CLIENTS-1'),
NetIntAny("m_Type"),
NetIntAny("m_SwitchNumber", -1),
NetIntAny("m_Subtype", -1),
NetIntAny("m_Flags", 0),
]),
NetObjectEx("DDNetProjectile", "ddnet-projectile@netobj.ddnet.tw", [
NetIntAny("m_X"),
NetIntAny("m_Y"),
NetIntAny("m_VelX"),
NetIntAny("m_VelY"),
NetIntRange("m_Type", 0, 'NUM_WEAPONS-1'),
NetTick("m_StartTick"),
NetIntRange("m_Owner", -1, 'MAX_CLIENTS-1'),
NetIntAny("m_SwitchNumber"),
NetIntAny("m_TuneZone"),
NetIntAny("m_Flags"),
]),
NetObjectEx("DDNetPickup", "pickup@netobj.ddnet.tw", [
NetIntAny("m_X"),
NetIntAny("m_Y"),
NetIntRange("m_Type", 0, 'max_int'),
NetIntRange("m_Subtype", 0, 'max_int'),
NetIntAny("m_SwitchNumber"),
]),
## Events
NetEvent("Common", [
NetIntAny("m_X"),
NetIntAny("m_Y"),
]),
NetEvent("Explosion:Common", []),
NetEvent("Spawn:Common", []),
NetEvent("HammerHit:Common", []),
NetEvent("Death:Common", [
NetIntRange("m_ClientId", 0, 'MAX_CLIENTS-1'),
]),
NetEvent("SoundGlobal:Common", [ #TODO 0.7: remove me
NetIntRange("m_SoundId", 0, 'NUM_SOUNDS-1'),
]),
NetEvent("SoundWorld:Common", [
NetIntRange("m_SoundId", 0, 'NUM_SOUNDS-1'),
]),
NetEvent("DamageInd:Common", [
NetIntAny("m_Angle"),
]),
NetEventEx("Birthday:Common", "birthday@netevent.ddnet.org", []),
NetEventEx("Finish:Common", "finish@netevent.ddnet.org", []),
NetObjectEx("MyOwnEvent", "my-own-event@heinrich5991.de", [
NetIntAny("m_Test"),
]),
NetObjectEx("SpecChar", "spec-char@netobj.ddnet.tw", [
NetIntAny("m_X"),
NetIntAny("m_Y"),
]),
# Switch state for a player team.
NetObjectEx("SwitchState", "switch-state@netobj.ddnet.tw", [
NetIntAny("m_HighestSwitchNumber", 0),
# 256 switches / 32 bits = 8 int32
NetArray(NetIntAny("m_aStatus", 0), 8),
# send the endtick of up to 4 timed switchers
NetArray(NetIntAny("m_aSwitchNumbers", 0), 4),
NetArray(NetIntAny("m_aEndTicks", 0), 4),
], validate_size=False),
# Switch info for map items
NetObjectEx("EntityEx", "entity-ex@netobj.ddnet.tw", [
NetIntAny("m_SwitchNumber"),
NetIntAny("m_Layer"),
NetIntAny("m_EntityClass"),
]),
NetEventEx("MapSoundWorld:Common", "map-sound-world@netevent.ddnet.org", [
NetIntAny("m_SoundId"),
]),
]
Messages = [
### Server messages
NetMessage("Sv_Motd", [
NetString("m_pMessage"),
]),
NetMessage("Sv_Broadcast", [
NetString("m_pMessage"),
]),
NetMessage("Sv_Chat", [
NetIntRange("m_Team", -2, 3),
NetIntRange("m_ClientId", -1, 'MAX_CLIENTS-1'),
NetStringHalfStrict("m_pMessage"),
]),
NetMessage("Sv_KillMsg", [
NetIntRange("m_Killer", 0, 'MAX_CLIENTS-1'),
NetIntRange("m_Victim", 0, 'MAX_CLIENTS-1'),
NetIntRange("m_Weapon", -3, 'NUM_WEAPONS-1'),
NetIntAny("m_ModeSpecial"),
]),
NetMessage("Sv_SoundGlobal", [
NetIntRange("m_SoundId", 0, 'NUM_SOUNDS-1'),
]),
NetMessage("Sv_TuneParams", []),
NetMessage("Unused", []),
NetMessage("Sv_ReadyToEnter", []),
NetMessage("Sv_WeaponPickup", [
NetIntRange("m_Weapon", 0, 'NUM_WEAPONS-1'),
]),
NetMessage("Sv_Emoticon", [
NetIntRange("m_ClientId", 0, 'MAX_CLIENTS-1'),
NetIntRange("m_Emoticon", 0, 'NUM_EMOTICONS-1'),
]),
NetMessage("Sv_VoteClearOptions", [
]),
NetMessage("Sv_VoteOptionListAdd", [
NetIntRange("m_NumOptions", 1, 15),
NetStringStrict("m_pDescription0"), NetStringStrict("m_pDescription1"), NetStringStrict("m_pDescription2"),
NetStringStrict("m_pDescription3"), NetStringStrict("m_pDescription4"), NetStringStrict("m_pDescription5"),
NetStringStrict("m_pDescription6"), NetStringStrict("m_pDescription7"), NetStringStrict("m_pDescription8"),
NetStringStrict("m_pDescription9"), NetStringStrict("m_pDescription10"), NetStringStrict("m_pDescription11"),
NetStringStrict("m_pDescription12"), NetStringStrict("m_pDescription13"), NetStringStrict("m_pDescription14"),
]),
NetMessage("Sv_VoteOptionAdd", [
NetStringStrict("m_pDescription"),
]),
NetMessage("Sv_VoteOptionRemove", [
NetStringStrict("m_pDescription"),
]),
NetMessage("Sv_VoteSet", [
NetIntRange("m_Timeout", 0, 'max_int'),
NetStringStrict("m_pDescription"),
NetStringStrict("m_pReason"),
]),
NetMessage("Sv_VoteStatus", [
NetIntRange("m_Yes", 0, 'MAX_CLIENTS'),
NetIntRange("m_No", 0, 'MAX_CLIENTS'),
NetIntRange("m_Pass", 0, 'MAX_CLIENTS'),
NetIntRange("m_Total", 0, 'MAX_CLIENTS'),
]),
### Client messages
NetMessage("Cl_Say", [
NetBool("m_Team"),
NetStringHalfStrict("m_pMessage"),
], teehistorian=False),
NetMessage("Cl_SetTeam", [
NetIntRange("m_Team", 'TEAM_SPECTATORS', 'TEAM_BLUE'),
]),
NetMessage("Cl_SetSpectatorMode", [
NetIntRange("m_SpectatorId", 'SPEC_FREEVIEW', 'MAX_CLIENTS-1'),
]),
NetMessage("Cl_StartInfo", [
NetStringStrict("m_pName"),
NetStringStrict("m_pClan"),
NetIntAny("m_Country"),
NetStringStrict("m_pSkin"),
NetBool("m_UseCustomColor"),
NetIntAny("m_ColorBody"),
NetIntAny("m_ColorFeet"),
]),
NetMessage("Cl_ChangeInfo", [
NetStringStrict("m_pName"),
NetStringStrict("m_pClan"),
NetIntAny("m_Country"),
NetStringStrict("m_pSkin"),
NetBool("m_UseCustomColor"),
NetIntAny("m_ColorBody"),
NetIntAny("m_ColorFeet"),
]),
NetMessage("Cl_Kill", []),
NetMessage("Cl_Emoticon", [
NetIntRange("m_Emoticon", 0, 'NUM_EMOTICONS-1'),
]),
NetMessage("Cl_Vote", [
NetIntRange("m_Vote", -1, 1),
], teehistorian=False),
NetMessage("Cl_CallVote", [
NetStringStrict("m_pType"),
NetStringStrict("m_pValue"),
NetStringStrict("m_pReason"),
], teehistorian=False),
NetMessage("Cl_IsDDNetLegacy", []),
NetMessage("Sv_DDRaceTimeLegacy", [
NetIntAny("m_Time"),
NetIntAny("m_Check"),
NetIntRange("m_Finish", 0, 1),
]),
NetMessage("Sv_RecordLegacy", [
NetIntAny("m_ServerTimeBest"),
NetIntAny("m_PlayerTimeBest"),
]),
NetMessage("Unused2", []),
NetMessage("Sv_TeamsStateLegacy", []),
# deprecated, use showothers@netmsg.ddnet.tw instead
NetMessage("Cl_ShowOthersLegacy", [
NetBool("m_Show"),
]),
# Can't add any NetMessages here!
NetMessageEx("Sv_MyOwnMessage", "my-own-message@heinrich5991.de", [
NetIntAny("m_Test"),
]),
NetMessageEx("Cl_ShowDistance", "show-distance@netmsg.ddnet.tw", [
NetIntAny("m_X"),
NetIntAny("m_Y"),
]),
NetMessageEx("Cl_ShowOthers", "showothers@netmsg.ddnet.tw", [
NetIntRange("m_Show", 0, 2),
]),
NetMessageEx("Sv_TeamsState", "teamsstate@netmsg.ddnet.tw", []),
NetMessageEx("Sv_DDRaceTime", "ddrace-time@netmsg.ddnet.tw", [
NetIntAny("m_Time"),
NetIntAny("m_Check"),
NetIntRange("m_Finish", 0, 1),
]),
NetMessageEx("Sv_Record", "record@netmsg.ddnet.tw", [
NetIntAny("m_ServerTimeBest"),
NetIntAny("m_PlayerTimeBest"),
]),
NetMessageEx("Sv_KillMsgTeam", "killmsgteam@netmsg.ddnet.tw", [
NetIntRange("m_Team", 0, 'MAX_CLIENTS-1'),
NetIntRange("m_First", -1, 'MAX_CLIENTS-1'),
]),
NetMessageEx("Sv_YourVote", "yourvote@netmsg.ddnet.org", [
NetIntRange("m_Voted", -1, 1),
]),
NetMessageEx("Sv_RaceFinish", "racefinish@netmsg.ddnet.org", [
NetIntRange("m_ClientId", 0, 'MAX_CLIENTS-1'),
NetIntAny("m_Time"),
NetIntAny("m_Diff"),
NetBool("m_RecordPersonal"),
NetBool("m_RecordServer", default=False),
]),
NetMessageEx("Sv_CommandInfo", "commandinfo@netmsg.ddnet.org", [
NetStringStrict("m_pName"),
NetStringStrict("m_pArgsFormat"),
NetStringStrict("m_pHelpText")
]),
NetMessageEx("Sv_CommandInfoRemove", "commandinfo-remove@netmsg.ddnet.org", [
NetStringStrict("m_pName")
]),
NetMessageEx("Sv_VoteOptionGroupStart", "sv-vote-option-group-start@netmsg.ddnet.org", []),
NetMessageEx("Sv_VoteOptionGroupEnd", "sv-vote-option-group-end@netmsg.ddnet.org", []),
NetMessageEx("Sv_CommandInfoGroupStart", "sv-commandinfo-group-start@netmsg.ddnet.org", []),
NetMessageEx("Sv_CommandInfoGroupEnd", "sv-commandinfo-group-end@netmsg.ddnet.org", []),
NetMessageEx("Sv_ChangeInfoCooldown", "change-info-cooldown@netmsg.ddnet.org", [
NetTick("m_WaitUntil")
]),
NetMessageEx("Sv_MapSoundGlobal", "map-sound-global@netmsg.ddnet.org", [
NetIntAny("m_SoundId"),
]),
]