import "google/protobuf/descriptor.proto";
import "network_connection.proto";

extend .google.protobuf.MessageOptions {
	optional int32 maximum_size_bytes = 50000;
}

enum SignonState_t {
	SIGNONSTATE_NONE = 0;
	SIGNONSTATE_CHALLENGE = 1;
	SIGNONSTATE_CONNECTED = 2;
	SIGNONSTATE_NEW = 3;
	SIGNONSTATE_PRESPAWN = 4;
	SIGNONSTATE_SPAWN = 5;
	SIGNONSTATE_FULL = 6;
	SIGNONSTATE_CHANGELEVEL = 7;
}

enum NET_Messages {
	net_NOP = 0;
	net_Disconnect_Legacy = 1;
	net_SplitScreenUser = 3;
	net_Tick = 4;
	net_StringCmd = 5;
	net_SetConVar = 6;
	net_SignonState = 7;
	net_SpawnGroup_Load = 8;
	net_SpawnGroup_ManifestUpdate = 9;
	net_SpawnGroup_SetCreationTick = 11;
	net_SpawnGroup_Unload = 12;
	net_SpawnGroup_LoadCompleted = 13;
	net_DebugOverlay = 15;
}

enum SpawnGroupFlags_t {
	SPAWN_GROUP_LOAD_ENTITIES_FROM_SAVE = 1;
	SPAWN_GROUP_DONT_SPAWN_ENTITIES = 2;
	SPAWN_GROUP_SYNCHRONOUS_SPAWN = 4;
	SPAWN_GROUP_IS_INITIAL_SPAWN_GROUP = 8;
	SPAWN_GROUP_CREATE_CLIENT_ONLY_ENTITIES = 16;
	SPAWN_GROUP_BLOCK_UNTIL_LOADED = 64;
	SPAWN_GROUP_LOAD_STREAMING_DATA = 128;
	SPAWN_GROUP_CREATE_NEW_SCENE_WORLD = 256;
}

message CMsgVector {
	optional float x = 1;
	optional float y = 2;
	optional float z = 3;
	optional float w = 4;
}

message CMsgVector2D {
	optional float x = 1;
	optional float y = 2;
}

message CMsgQAngle {
	optional float x = 1;
	optional float y = 2;
	optional float z = 3;
}

message CMsgQuaternion {
	optional float x = 1;
	optional float y = 2;
	optional float z = 3;
	optional float w = 4;
}

message CMsgTransform {
	optional .CMsgVector position = 1;
	optional float scale = 2;
	optional .CMsgQuaternion orientation = 3;
}

message CMsgRGBA {
	optional int32 r = 1;
	optional int32 g = 2;
	optional int32 b = 3;
	optional int32 a = 4;
}

message CMsgPlayerInfo {
	optional string name = 1;
	optional fixed64 xuid = 2;
	optional int32 userid = 3;
	optional fixed64 steamid = 4;
	optional bool fakeplayer = 5;
	optional bool ishltv = 6;
}

message CEntityMsg {
	optional uint32 target_entity = 1 [default = 16777215];
}

message CMsg_CVars {
	message CVar {
		optional string name = 1;
		optional string value = 2;
	}

	repeated .CMsg_CVars.CVar cvars = 1;
}

message CNETMsg_NOP {
}

message CNETMsg_SplitScreenUser {
	optional int32 slot = 1;
}

message CNETMsg_Tick {
	optional uint32 tick = 1;
	optional uint32 host_computationtime = 4;
	optional uint32 host_computationtime_std_deviation = 5;
	optional uint32 legacy_host_loss = 7;
	optional uint32 host_unfiltered_frametime = 8;
	optional uint32 hltv_replay_flags = 9;
	optional uint32 expected_long_tick = 10;
	optional string expected_long_tick_reason = 11;
	optional uint32 host_frame_dropped_pct_x10 = 12;
	optional uint32 host_frame_irregular_arrival_pct_x10 = 13;
}

message CNETMsg_StringCmd {
	optional string command = 1;
	optional uint32 prediction_sync = 2;
}

message CNETMsg_SetConVar {
	option (maximum_size_bytes) = 4096;

	optional .CMsg_CVars convars = 1;
}

message CNETMsg_SignonState {
	optional .SignonState_t signon_state = 1 [default = SIGNONSTATE_NONE];
	optional uint32 spawn_count = 2;
	optional uint32 num_server_players = 3;
	repeated string players_networkids = 4;
	optional string map_name = 5;
	optional string addons = 6;
}

message CSVCMsg_GameEvent {
	message key_t {
		optional int32 type = 1;
		optional string val_string = 2;
		optional float val_float = 3;
		optional int32 val_long = 4;
		optional int32 val_short = 5;
		optional int32 val_byte = 6;
		optional bool val_bool = 7;
		optional uint64 val_uint64 = 8;
	}

	optional string event_name = 1;
	optional int32 eventid = 2;
	repeated .CSVCMsg_GameEvent.key_t keys = 3;
}

message CSVCMsgList_GameEvents {
	message event_t {
		optional int32 tick = 1;
		optional .CSVCMsg_GameEvent event = 2;
	}

	repeated .CSVCMsgList_GameEvents.event_t events = 1;
}

message CNETMsg_SpawnGroup_Load {
	option (maximum_size_bytes) = 131072;

	optional string worldname = 1;
	optional string entitylumpname = 2;
	optional string entityfiltername = 3;
	optional uint32 spawngrouphandle = 4;
	optional uint32 spawngroupownerhandle = 5;
	optional .CMsgVector world_offset_pos = 6;
	optional .CMsgQAngle world_offset_angle = 7;
	optional bytes spawngroupmanifest = 8;
	optional uint32 flags = 9;
	optional int32 tickcount = 10;
	optional bool manifestincomplete = 11;
	optional string localnamefixup = 12;
	optional string parentnamefixup = 13;
	optional int32 manifestloadpriority = 14;
	optional uint32 worldgroupid = 15;
	optional uint32 creationsequence = 16;
	optional string savegamefilename = 17;
	optional uint32 spawngroupparenthandle = 18;
	optional bool leveltransition = 19;
	optional string worldgroupname = 20;
}

message CNETMsg_SpawnGroup_ManifestUpdate {
	optional uint32 spawngrouphandle = 1;
	optional bytes spawngroupmanifest = 2;
	optional bool manifestincomplete = 3;
}

message CNETMsg_SpawnGroup_SetCreationTick {
	optional uint32 spawngrouphandle = 1;
	optional int32 tickcount = 2;
	optional uint32 creationsequence = 3;
}

message CNETMsg_SpawnGroup_Unload {
	optional uint32 spawngrouphandle = 1;
	optional uint32 flags = 2;
	optional int32 tickcount = 3;
}

message CNETMsg_SpawnGroup_LoadCompleted {
	optional uint32 spawngrouphandle = 1;
}

message CSVCMsg_GameSessionConfiguration {
	optional bool is_multiplayer = 1;
	optional bool is_loadsavegame = 2;
	optional bool is_background_map = 3;
	optional bool is_headless = 4;
	optional uint32 min_client_limit = 5;
	optional uint32 max_client_limit = 6;
	optional uint32 max_clients = 7;
	optional fixed32 tick_interval = 8;
	optional string hostname = 9;
	optional string savegamename = 10;
	optional string s1_mapname = 11;
	optional string gamemode = 12;
	optional string server_ip_address = 13;
	optional bytes data = 14;
	optional bool is_localonly = 15;
	optional bool no_steam_server = 19;
	optional bool is_transition = 16;
	optional string previouslevel = 17;
	optional string landmarkname = 18;
}

message CNETMsg_DebugOverlay {
	optional int32 etype = 1;
	repeated .CMsgVector vectors = 2;
	repeated .CMsgRGBA colors = 3;
	repeated float dimensions = 4;
	repeated float times = 5;
	repeated bool bools = 6;
	repeated uint64 uint64s = 7;
	repeated string strings = 8;
}
