game2006go/server/imserver/proto/cs_proto.proto
aozhiwei 2977d97800 1
2024-04-15 11:03:02 +08:00

722 lines
15 KiB
Protocol Buffer
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.

syntax = "proto2";
package cs;
option go_package = ".;cs";
//用来指定出生的lua模块名, lua_package不支持!!!
option java_package = "cs_friend_proto_pb";
/*
约定:
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
*/
//常量
enum Constant_e
{
ProtoVersion = 2023051601; //系统版本
}
//心跳
message CMPing
{
}
message SMPing
{
optional int32 param1 = 1;
optional int32 source = 2 [default = 0]; //0:tcp 1:udp
}
//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
}
//int32元组
message MFTuple
{
repeated int32 values = 1; //values
}
//string元组
message MFTupleString
{
repeated string values = 1; //values
}
//聊天消息
message MFChatMsg
{
/*
消息唯一id递增序列,客户端可以用chat_channel + msg_uuid作为主键
!!!不同的频道msg_uuid可能重复
*/
optional uint64 msg_uuid = 1;
optional MFChatUser sender = 2; //发送者
optional MFChatUser receiver = 3; //接收者
optional int32 chat_channel = 4; //聊天频道
optional int32 msg_type = 5; //消息类型 0文本消息(json) 1自定义协议 (json) 2:纯文本(但是任会做屏蔽字替换)
optional string msg_body = 6; //消息内容(json类型里的字段!开头的会做屏蔽替换)
optional int64 send_time = 7; //消息发送时间
}
// 聊天用户
message MFChatUser
{
optional string account_id = 1;
optional string username = 2;
optional int32 avatar = 3;
optional int32 avatar_head = 4;
optional int64 guild_id = 5;
optional string guild_name = 6;
optional int32 guild_level = 7;
optional int32 online_status = 8;
optional int32 last_login_time = 9;
}
message MFGuildLog
{
optional int64 guild_id = 1;
optional string account_id = 2;
optional int32 log_type = 3;
optional string content = 4;
}
message MFGuild
{
optional int64 auto_id = 1;
optional int64 guild_id = 2;
optional string name = 3;
optional string leader_id = 4;
optional int32 avatar = 5;
optional string notice = 6;
optional int32 join_cond = 7; // 公会加入条件 default:0, free:1, star: 2
optional int32 join_cond_value = 8; // star value
optional int32 total_stars = 9; // 公会统计信息, 总星星数量
optional int32 total_kills = 10; // 公会统计信息, 单局总击杀数
optional int32 chicken_dinners = 11; // 公会统计信息, 单局第一名数
optional int32 max_members = 13; // 成员上限
repeated MFGuildMember members = 14;
}
message MFGuildMember
{
optional string account_id = 1;
optional string username = 2;
optional int32 avatar = 3;
optional int32 avatar_head = 4;
optional int32 rank = 7;
optional int32 online_status = 8;
optional int32 last_login_time = 9;
optional int32 level = 10;
optional int32 star = 11;
}
message MFUser {
optional string account_id = 1;
optional string username = 2;
optional int32 avatar = 3;
optional int32 avatar_head = 4;
optional int64 guild_id = 5;
optional string guild_name = 6;
optional int32 rank = 7;
optional int32 online_status = 8;
optional int32 last_login_time = 9;
optional int32 is_friendship = 10; // 是否成为好友关系 default:0, friend:1
optional int32 is_pending_request = 11; // 是否发送添加好友请求 default:0, pending:1
optional int32 battling = 12;
}
//end mfmsg
//登录
message CMLogin
{
optional int32 server_id = 1; //保留
optional string team_uuid = 2; //保留
optional string account_id = 3; //账号id
optional int32 proto_version = 5; //协议版本号Constant_e.ProtoVersion
optional string session_id = 20; //账号id
}
message SMLogin
{
optional string server_info = 1; //服务器信息(重连时使用)
optional string account_id = 2;
optional int32 errcode = 3; //错误码 0成功 1:重连失败
optional string errmsg = 4; //错误描述
}
//断线重连
message CMReconnect
{
optional int32 server_id = 1; //保留
optional string team_uuid = 2; //保留
optional string account_id = 3; //账号id
optional string session_id = 4; //session_id
optional string room_uuid = 5; //房间唯一id
optional string server_info = 6; //服务器信息
}
message SMReconnect
{
optional int32 errcode = 1; //错误码 0成功 1:重连失败
optional string errmsg = 2; //错误描述
}
// 请求搜索用户
message CMSearchUser
{
optional int64 since_id = 1; //为0时表示从第一条数据开始
optional string username = 2; //搜索用户名
}
message SMSearchUser
{
optional int32 errcode = 1;
optional string errmsg = 2;
optional int64 since_id = 3; //客户端需缓存
repeated MFUser users = 4;
}
// 请求搜索用户 CMSearchUserByAccountId
message CMSearchUserByAccountId
{
optional string account_id = 1; //搜索account id
}
message SMSearchUserByAccountId
{
optional int32 errcode = 1;
optional string errmsg = 2;
optional MFUser users = 3;
}
// 请求发送添加好友请求
message CMAddFriendRequest
{
optional string target_account_id = 1; // 账号id
}
message SMAddFriendRequest
{
optional int32 errcode = 1;
optional string errmsg = 2;
optional int32 is_friendship = 3;
}
// 请求接受好友请求
message CMAcceptFriendRequest
{
optional string target_account_id = 1; // 账号id
}
message SMAcceptFriendRequest
{
optional int32 errcode = 1;
optional string errmsg = 2;
optional int32 is_friendship = 3;
}
// 请求拒绝好友请求
message CMRejectFriendRequest
{
optional string target_account_id = 1; // 账号id
}
message SMRejectFriendRequest
{
optional int32 errcode = 1;
optional string errmsg = 2;
optional int32 is_friendship = 3;
}
// 请求等待验证的好友请求
message CMListPendingFriendRequest
{
}
message SMListPendingFriendRequest
{
optional int32 errcode = 1;
optional string errmsg = 2;
repeated MFUser users = 3;
}
// 请求我的好友列表
message CMListFriend
{
}
// 回复我的好友列表
message SMListFriend
{
optional int32 errcode = 1;
optional string errmsg = 2;
repeated MFUser users = 3;
}
// 请求删除好友
message CMDeleteFriendShip
{
optional string target_account_id = 1; // 账号id
}
message SMDeleteFriendShip
{
optional int32 errcode = 1;
optional string errmsg = 2;
optional int32 is_delete_friendship = 3; // default value:0, deleted: 1
}
// 请求我的黑名单列表
message CMBlacklist
{
}
message SMBlacklist
{
optional int32 errcode = 1;
optional string errmsg = 2;
repeated MFUser users = 3;
}
// 请求加入黑名单
message CMAddBlacklist
{
optional string target_account_id = 1; // 账号id
}
message SMAddBlacklist
{
optional int32 errcode = 1;
optional string errmsg = 2;
}
// 请求移除黑名单
message CMRemoveBlacklist
{
optional string target_account_id = 1; // 账号id
}
message SMRemoveBlacklist
{
optional int32 errcode = 1;
optional string errmsg = 2;
}
// 请求邀请好友消息
message CMInviteFriendMsg
{
optional string invite_account_id = 1;
optional string msg = 2;
}
message SMInviteFriendMsg
{
optional int32 errcode = 1;
optional string errmsg = 2;
optional string msg = 3;
}
// 推荐列表
message CMRecommendList
{
optional int32 type = 1; //0:全部 1:推荐战斗 2最近游戏
}
message SMRecommendList
{
optional int32 errcode = 1;
optional string errmsg = 2;
repeated MFUser users = 3;
}
// --- 聊天 ---
// 发送聊天消息
message CMSendChatMsg
{
optional int32 chat_channel = 1; //聊天频道 1: 世界 2好友 3战队 4:小队这时target表示队伍Id 5大喇叭 6跑马灯只能收不能发
optional string targetAccountId = 2; //目标
optional int32 msg_type = 3; ////消息类型 0文本消息(json) 1自定义协议 (json) 2:纯文本(但是任会做屏蔽字替换)
optional string msg_body = 4; //消息内容
repeated string members = 5; //小队成员列表(包含自己)
}
//读取聊天消息列表并且开启聊天通知
message CMReadMsgAndOpenChatNotify
{
optional int32 curr_channel = 1; //当前频道
repeated MFPair64 last_ids = 2; //所有频道 key聊天频道 val该频道最后一次收到的消息id
}
//设置当前私聊目标
message CMSetCurrPrivateChatTarget
{
optional string target_account_id = 1; //私聊对象id, 只有当前聊频道是私聊时字段才有意义
optional int64 last_id = 2; //最后收到想消息id
}
//关闭聊天通知
message CMCloseChatNotify
{
}
//更新聊天红点信息
message SMUpdateChatRedPointNotify
{
repeated int32 has_unread_msg_channels = 1; //含有未读消息的渠道id列表不在列表里的渠道默认不含有
}
message SMChatMsgNotify
{
repeated MFChatMsg msg_list = 1; //消息列表客户端需要根据chat_channel和msg_uuid更新本地的last_ids
}
//更新红点信息
message SMUpdateRedPointNotify
{
optional int32 red_point_flags = 1; //红点信息 1<<0:好友申请 1<<1:公会申请 1<<2聊天红点
}
//更新私聊红点信息
message SMUpdatePrivateChatRedPointNotify
{
repeated string has_unread_msg_accounts = 1; //有未读消息的账号列表不在列表里的好友more不含有
}
//更新频道最后一次收到的消息id
message SMUpdateChatChannelLastId
{
repeated MFPair64 last_ids = 1; //所有频道 key聊天频道 val该频道最后一次收到的消息id
}
// 请求公会信息
message CMGuildInfo
{
optional string account_id = 1;
}
// 回复公会信息
message SMGuildInfo
{
optional int32 errcode = 1;
optional string errmsg = 2;
optional MFGuild guild = 3;
}
// 请求推荐公会列表
message CMRecommendGuildList
{
}
message SMRecommendGuildList
{
optional int32 errcode = 1;
optional string errmsg = 2;
repeated MFGuild recommend_guilds = 3;
}
//公会排行榜 总星星数排行
message CMGetTopGuildsByTotalStars
{
optional int32 guilds_num = 1;
}
message SMGetTopGuildsByTotalStars
{
optional int32 errcode = 1;
optional string errmsg = 2;
repeated MFGuild guilds = 3;
}
//创建公会
message CMCreateGuild
{
optional int32 avatar = 1;
optional string name = 2;
}
message SMCreateGuild
{
optional int32 errcode = 1;
optional string errmsg = 2;
optional MFGuild guild = 3;
}
//申请加入公会
message CMApplyToGuild
{
optional int64 guild_id = 1;
}
message SMApplyToGuild
{
optional int32 errcode = 1;
optional string errmsg = 2;
}
//申请加入公会
message SMApplyToGuildNotify
{
optional int64 guild_id = 1;
optional string name = 2;
optional string accountId = 3;
optional string username = 4;
}
// 请求申请者列表
message CMApplyList
{
}
message SMApplyList
{
optional int32 errcode = 1;
optional string errmsg = 2;
repeated MFGuildMember members = 3;
}
//批准申请加入公会
message CMApprove
{
optional string applicant_account_id = 1;
}
message SMApprove
{
optional int32 errcode = 1;
optional string errmsg = 2;
}
//批准加入公会
message SMApproveJoinGuildNotify
{
optional int64 guild_id = 1;
optional string name = 2;
optional string accountId = 3;
optional string username = 4;
}
//拒绝加入公会
message CMReject
{
optional string applicant_account_id = 1;
}
message SMReject
{
optional int32 errcode = 1;
optional string errmsg = 2;
}
//离开公会
message CMLeaveGuild
{
}
message SMLeaveGuild
{
optional int32 errcode = 1;
optional string errmsg = 2;
}
//离开公会
message SMLeaveGuildNotify
{
optional int64 guild_id = 1;
optional string name = 2;
optional string accountId = 3;
optional string username = 4;
}
//开除成员
message CMDismissMember
{
optional string dismissAccountId = 1;
}
message SMDismissMember
{
optional int32 errcode = 1;
optional string errmsg = 2;
}
//开除成员
message SMDismissMemberNotify
{
optional int64 guild_id = 1;
optional string name = 2;
optional string accountId = 3;
optional string username = 4;
}
//设置公会成员等级
message CMSetMemberLevel
{
optional string memberAccountId = 1;
optional int32 memberLevel = 2;
}
message SMSetMemberLevel
{
optional int32 errcode = 1;
optional string errmsg = 2;
}
//设置公会成员等级
message SMSetMemberLevelNotify
{
optional int64 guild_id = 1;
optional string name = 2;
optional int32 memberLevel = 3;
optional string accountId = 4;
optional string username = 5;
}
// 请求公会成员列表
message CMGuildMembersList
{
}
// 回复公会成员列表
message SMGuildMembersList
{
optional int32 errcode = 1;
optional string errmsg = 2;
repeated MFGuildMember members = 3;
}
// 请求解散公会
message CMDisband
{
}
message SMDisband
{
optional int32 errcode = 1;
optional string errmsg = 2;
}
//搜索公会
message CMSearchGuilds
{
optional int64 since_id = 1; //为0时表示从第一条数据开始
optional string name = 2;
}
message SMSearchGuilds
{
optional int32 errcode = 1;
optional string errmsg = 2;
optional int64 since_id = 3; //客户端需缓存
repeated MFGuild guilds = 4;
}
//公会日志
message CMGuildLogs
{
}
message SMGuildLogs
{
optional int32 errcode = 1;
optional string errmsg = 2;
repeated MFGuildLog guildLogs = 3;
}
//修改公会名称
message CMSetName
{
optional string name = 1;
optional int32 item_id = 2;
optional int32 item_num = 3;
}
message SMSetName
{
optional int32 errcode = 1;
optional string errmsg = 2;
}
//修改公会头像
message CMSetAvatar
{
optional int32 avatar = 1;
}
message SMSetAvatar
{
optional int32 errcode = 1;
optional string errmsg = 2;
}
//设置公告
message CMSetNotice
{
optional string content = 1;
}
message SMSetNotice
{
optional int32 errcode = 1;
optional string errmsg = 2;
}
//设置公会加入条件
message CMSetJoinCond
{
optional int32 join_cond = 1; // default: 0 Approval required , free:1, star: 2
optional int32 join_cond_value = 2; // only cond star, value:
}
message SMSetJoinCond
{
optional int32 errcode = 1;
optional string errmsg = 2;
}