namespace Server.Networking.Messages; /// /// Network message operation codes for client-server communication /// public static class OpCodes { /// /// Echo test message - server echoes back the received payload /// public const int ECHO = 1; /// /// Server -> Client: Keepalive ping message to prevent idle timeout /// Client should respond with PONG to reset idle timer /// public const int PING = 2; /// /// Client -> Server: Response to PING message /// Indicates client is still alive and responsive /// public const int PONG = 3; // ===== Authentication (100-119) ===== /// /// Client -> Server: Register new account /// Payload: { username: string, password: string } /// public const int AUTH_REGISTER = 100; /// /// Server -> Client: Registration result /// Payload: { success: bool, message: string, accountId?: int } /// public const int AUTH_REGISTER_RESULT = 101; /// /// Client -> Server: Login with username and password /// Payload: { username: string, password: string } /// public const int AUTH_LOGIN = 110; /// /// Server -> Client: Login result /// Payload: { success: bool, message: string, token?: string } /// public const int AUTH_LOGIN_RESULT = 111; /// /// Client -> Server: Authenticate using stored token /// Payload: { token: string } /// public const int AUTH_WITH_TOKEN = 112; /// /// Server -> Client: Token authentication result /// Payload: { success: bool, message: string } /// public const int AUTH_WITH_TOKEN_RESULT = 113; // ===== Character Management (200-219) ===== /// /// Client -> Server: Create new character /// Payload: { name: string } /// public const int CHAR_CREATE = 202; /// /// Server -> Client: Character creation result /// Payload: { success: bool, message: string, character?: object } /// public const int CHAR_CREATE_RESULT = 203; /// /// Client -> Server: Select character to play /// Payload: { characterId: int } /// public const int CHAR_SELECT = 204; /// /// Server -> Client: Character selection result /// Payload: { success: bool, message: string } /// public const int CHAR_SELECT_RESULT = 205; // ===== World/Overworld (700-719) ===== /// /// Client -> Server: Request to spawn in world after character selection /// public const int WORLD_SPAWN_REQUEST = 700; /// /// Server -> Client: Spawn notification (your own character or other players joining) /// public const int WORLD_SPAWN = 701; /// /// Server -> Client: Despawn notification (player leaving) /// public const int WORLD_DESPAWN = 702; /// /// Client -> Server: Player input (movement, actions) /// Sent at ~20 Hz or per tick /// public const int WORLD_INPUT = 710; /// /// Server -> Client: World state snapshot /// Sent at ~10-20 Hz /// public const int WORLD_STATE = 711; /// /// Server -> Client: Live chunk delta (tile/object/npc/mob added/removed/changed) /// Pushed immediately when an admin edits the world, to all players viewing that chunk. /// public const int WORLD_CHUNK_DELTA = 712; // ===== World Combat (720-739) ===== /// Server -> Client: Combat state update (mob states, damage events, deaths) public const int WORLD_COMBAT_STATE = 720; /// Client -> Server: Player attacks a mob, player, or object in the world public const int WORLD_ATTACK = 721; /// Client -> Server: Request loot from dead world mob public const int WORLD_MOB_LOOT_REQUEST = 722; /// Server -> Client: Loot contents from world mob public const int WORLD_MOB_LOOT_RESULT = 723; // ===== World NPC (740-749) ===== /// Client -> Server: Interact with world NPC public const int WORLD_NPC_INTERACT = 740; /// Server -> Client: NPC interaction state (dialog/shop) public const int WORLD_NPC_INTERACT_STATE = 741; /// Client -> Server: Select dialog option public const int WORLD_NPC_DIALOG_SELECT = 742; /// Server -> Client: Dialog result public const int WORLD_NPC_DIALOG_RESULT = 743; /// Client -> Server: NPC shop buy/sell public const int WORLD_NPC_SHOP_ACTION = 744; /// Server -> Client: Shop action result public const int WORLD_NPC_SHOP_RESULT = 745; /// Client -> Server: Request respawn after death public const int WORLD_RESPAWN_REQUEST = 724; /// Server -> Client: Respawn result (new position, invulnerability) public const int WORLD_RESPAWN_RESULT = 725; // ===== World Object (750-759) ===== /// Client -> Server: Interact with world object public const int WORLD_OBJECT_INTERACT = 750; /// Server -> Client: Object interaction result public const int WORLD_OBJECT_INTERACT_RESULT = 751; /// Server -> Client: Object state change broadcast public const int WORLD_OBJECT_STATE = 752; // ===== Error Messages (900-999) ===== /// /// Server -> Client: General error message /// Payload: { error: string } /// public const int ERROR = 900; }