game2001/server/tools/protobuild/cs_proto.proto
aozhiwei 0d15b79606 1
2019-03-11 20:18:54 +08:00

333 lines
7.4 KiB
Protocol Buffer
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package cs;
/*
约定:
CM前缀客户端发给服务器的消息(client message)
SM前缀服务器发给客户的的消息(server message)
MF前缀消息的内嵌字段只能作为其他消息的内嵌字段不能send(message field)
_e后缀枚举类型
_uniid后缀唯一id
union_前缀联合体
_前缀该字段仅服务器使用客户端无需处理
网络包格式msghead + msgbody
msghead: packagelen + msgid + seqid + magiccode + reserved = 2 + 2 + 4 + 2 + 2 = 12字节
msgbody protobuf数据
msghead说明
packagelenunsigned short 双字节网络包长度,
msgid(unsigned short): 双字节消息id
seqid(unsigned int): 4字节序号id
magiccode(unsigned short): 2字节魔数并且为固定常数KS占位符客户端不需什么处理
reserved(unsigned short): 保留
十六进制位运算数据表示法
0x01 == 1<<0
0x02 == 1<<1
0x04 == 1<<2
*/
//心跳
message CMPing
{
}
message SMPing
{
optional int32 param1 = 1;
}
//rpc调用错误
message SMRpcError
{
optional int32 error_code = 1;
optional string error_msg = 2;
optional string debug_msg = 3;
optional string file = 4;
optional int32 lineno = 5;
optional int32 error_param = 6;
}
//int32键值对
message MFPair
{
optional int32 key = 1; //key
optional int32 value = 2; //val
}
//int64键值对
message MFPair64
{
optional int64 key = 1; //key
optional int64 value = 2; //val
}
//向量
message MFVector2D
{
optional float x = 1; //x轴
optional float y = 2; //y轴
}
message MFPlace
{
optional string name = 1; //名字
}
message MFObject
{
//type
optional MFVector2D pos = 1; //位置
optional int32 ori = 2; //zzzzz
optional int32 scale = 3; //缩放比
}
message MFPlayerInfo
{
optional int32 id = 1;
optional int32 team_id = 2;
optional string name = 3;
}
message MFGoods
{
optional string name = 1;
optional int32 num = 2;
}
//xx
message MFPlayerStats
{
optional int32 player_id = 1;
optional string player_icon = 2;
optional int32 time_alive = 3;
optional int32 kills = 4;
optional int32 dead = 5;
optional int32 damage_type = 6;
//source_type
optional int32 killer_id = 7;
optional int32 damage_given = 8;
optional int32 damage_taken = 9;
optional int32 gold = 10;
optional int32 all_score = 11;
optional int32 score_rank = 12;
optional int32 score_kill = 13;
optional int32 score_dmg_given = 14;
optional int32 heal_cnt = 15;
optional int32 score_alivetm = 16;
optional int32 old_elo = 17;
optional int32 new_elo = 18;
optional int32 chg_elo = 19;
optional int32 heal_heath = 20;
optional string uuid = 21;
repeated MFGoods annual_goods = 22;
}
//end mfmsg
//登录
message CMLogin
{
optional int32 server_id = 1; //serverid
optional string account_id = 2; //用户id
optional string session_id = 3; //session_id
optional string device_id = 4; //device_id
}
message SMLogin
{
}
//断线重连
message CMReConnect
{
optional int32 server_id = 1; //serverid
optional string account_id = 2; //用户id
optional string session_id = 3; //session_id
}
message SMReConnect
{
}
//地图信息
message SMMapInfo
{
optional int32 width = 1; //地图宽度
optional int32 height = 2; //地图高度
optional int32 speed = 3; //地图移动速度
repeated MFPlace places = 4; //建筑物
repeated MFObject objects = 5; //地图对象
}
//加入
message CMJoin
{
optional int32 protocol = 1; //协议版本号
optional string team_uuid = 2; //队伍唯一id
optional int32 team_mode = 3; //队伍模式
optional int32 player_count = 4; //玩家数
optional int32 auto_fill = 5; //是否自动填充玩家
optional int32 bot = 6; //是否机器人
optional string name = 7; //角色名
optional int32 use_touch = 8; //zzz
optional string uuid = 9; //账号id account_id
repeated int32 emotes = 10; //表情列表
optional string icon = 11; //头像
optional int32 energy_shield = 12; //能量护盾
optional int32 baseskin = 13; //皮肤id
optional int32 basemelee = 14; //xx
optional int32 elo_score = 15;
//plugs
optional string channel = 20; //渠道编号
optional string gmode = 21;
}
//移动
message CMMove
{
optional int32 seq = 1; //序号
optional bool move_left = 2; //zzz
optional bool move_right = 3; //zz
optional bool move_up = 4; //zzz
optional bool move_down = 5; //zzz
optional bool shoot_start = 6; //zzz
optional bool shoot_hold = 7; //zzz
optional bool reload = 8; //zzzz
optional bool interaction = 9; //zzz
optional bool equip_primary = 10; //zzz
optional bool equip_secondary = 11; //zz
optional bool equip_throwable = 12; //zz
optional bool equip_melee = 13; //zz
optional bool equip_last = 14; //zz
optional bool cancel_action = 15; //zz
optional bool edit_mode = 16; //zz
optional bool scroll_down = 17; //zzz
optional bool scroll_up = 18; //zz
optional bool portrait = 19; //zz
optional MFVector2D to_mouse_dir = 20; //zz
optional float to_mouse_len = 21; //
//use_item
//use_scope
optional int32 move_len = 22; //zz
optional int32 interaction_objid = 23; //zz
optional MFVector2D to_move_dir = 24; //移动方向
}
//xxx
message CMEditMsg
{
optional bool cull = 1; //zz
optional float zoom = 2; //zz
}
//丢弃道具
message CMDropItem
{
optional int32 item_id = 1;
optional int32 weapon_idx = 2;
}
//发送表情
message CMSendEmote
{
optional int32 type = 1;
optional MFVector2D pos = 2;
//optional bool use_loadout = 3;
optional bool team_only = 4;
//optional bool is_ping = 5;
}
//自杀
message CMSpectate
{
optional int32 spec_next = 1;
optional int32 spec_prev = 2;
}
//语音
message CMSendVoice
{
optional int32 mode = 1; //模式
optional string uuid = 2; //唯一id
optional string msg = 3; //语音内容
}
//endcmmsg
//语音通知
message SMVoiceNotify
{
optional int32 mode = 1; //模式
optional string uuid = 2; //唯一id
optional string msg = 3; //语音内容
}
//加入成功
message SMJoinedNotify
{
optional int32 team_mode = 1;
optional int32 player_id = 2;
optional bool started = 3;
repeated MFPlayerInfo player_infos = 4;
optional int32 map_type = 5;
optional bool elo_start = 6;
}
//玩家信息
message SMPlayerInfo
{
optional MFPlayerInfo info = 1; //玩家信息
}
//帧事件
message SMUpdate
{
repeated int32 del_objids = 1;
}
//xx
message SMKillMsg
{
optional int32 damage_type = 1;
//source_type
optional int32 target_id = 2;
optional int32 killer_id =3;
optional int32 kill_credit_id = 4;
optional int32 killer_kills = 5;
optional int32 downed = 6;
optional int32 killed =7;
}
//个人信息统计
message SMPlayerStats
{
optional MFPlayerStats player_stats = 1;
}
//游戏结束
message SMGameOver
{
optional int32 team_id = 1;
optional int32 team_rank = 2;
optional int32 team_allcnt = 3;
optional int32 game_over = 4;
optional int32 victory = 5;
repeated MFPlayerStats player_stats = 6;
}
//拾取
message SMPickup
{
optional int32 type = 1;
optional int32 item_id = 2;
optional int32 count = 3;
}
//断线通知
message SMDisconnectNotify
{
optional string reason = 1; //断线原因
}