# 项目

## 玩家数据

```protobuf
// 玩家资产
message ResPlayerAsset{
 int32 dwUin = 1;
 int32 energy = 2;
 int32 star = 3;
 int32 recover_time = 4; 
 int32 diamond = 5;
 int32 level = 6;
 int32 exp = 7;
 int32 Login = 8;
 int32 Logout = 9;
}

// 存储客户端信息
message ReqKv{
 int32 key = 1;
 string value = 2;
}

message ResKv{
 map<int32, string> kv = 1;
}


```

## 棋盘交互

同步逻辑：
每次更新棋盘信息时将玩家操作也一起发送，校验棋子的数量和类型以及能量的消耗是否一致。操作逻辑使用消息队列，每隔一段时间进行同步，服务端根据操作操作队列更新棋子池,客户端同步数据时会校验地图上的棋子和池子中棋子的种类和个数一致，否则无法更新地图信息

### 需要同步的情况

- 登录时校验棋子种类和数量，以服务端数据为准
- 获得新棋子
- 能量消耗少于上限
- 出售棋子
- 购买棋子
- 订单完成时
- 获得新棋子

**不需要额外调用ADD的接口：`ReqChessEx`,`ReqGetChessFromBuff`, `ReqTakeChessOutBag`**

**不需要额外调用REMOVE的接口：`ReqPutChessInBag`**

```protobuf
enum HANDLE_TYPE {
        ADD = 0; //增加棋子
        COMPOSE = 1; //合成棋子
        BUY = 2; //购买棋子
        SELL = 3; //出售棋子
        REMOVE = 4; //移除棋子
}

enum RES_CODE {
    FAIL = 0;
    SUCCESS = 1;
}
message ChessHandle{ 
    HANDLE_TYPE type = 1; //操作类型
    int32 Emit = 2; //发射器id
    int32 ChessId = 3; //棋子id
    int32 Id = 4; //排序id
    repeated int32 ActType = 5; // 活动类型
}

message UpdatePlayerChessData{
    int32 dwUin = 1; 
    map<string, int32> mChessData = 2;
    repeated ChessHandle handleList = 3; //操作列表
}

message ResUpdatePlayerChessData{
    RES_CODE code = 1;
    string msg = 2;
}

///响应棋盘数据
message ResPlayerChessData{
 int32 dwUin = 1;
 map<string, int32> mChessData = 2;
 repeated int32 ChessList = 3;
 repeated int32 ChessBuff = 4;
}

message ResPlayerChessInfo{
 repeated int32 ChessList = 1;
 repeated int32 ChessBuff = 2;
 ChessBag ChessBag = 3;
 repeated string RetireEmit = 4;
 repeated int32 Honor = 5;
}

// 棋子转换 用于气泡和宝箱解锁
message ReqChessEx{
 int32 OldChessId = 1;
 int32 NewChessId = 2;
 int32 CostDia = 3;
 int32 Type = 4; //1 气泡 2 宝箱解锁 3 快捷购买
 map<string, int32> mChessData = 5;
}

message ResChessEx{
 RES_CODE code = 1;
    string msg = 2;
}

// 从缓存中获取棋子
message ReqGetChessFromBuff{
 int32 ChessId = 1;
 map<string, int32> mChessData = 2;
}

message ResGetChessFromBuff{
 RES_CODE code = 1;
 string msg = 2;
}

// 棋盘背包
message ChessBag{
 repeated ChessBagGrid ChessBagGrids = 1; //已解锁棋盘背包格子
 int32 ChessBuyCnt = 2; //已购买棋盘格子数
 int32 ChessFreeCnt = 3; //剩余免费解锁次数
}

message ChessBagGrid{
 int32 Id = 1; //格子ID
 int32 ChessId = 2; //棋子ID
 int32 EmitId = 3; //发射器ID
}

// 放置棋子进背包
message ReqPutChessInBag{
 int32 ChessId = 1;
 int32 BagId = 2;
 int32 EmitId = 3; //发射器ID
 map<string, int32> mChessData = 4;
}

message ResPutChessInBag{
 RES_CODE code = 1;
 string msg = 2;
}

// 从背包取出棋子
message ReqTakeChessOutBag{
 int32 BagId = 1;
 map<string, int32> mChessData = 2;
}

message ResTakeChessOutBag{
 RES_CODE code = 1;
 string msg = 2;
}

// 购买棋盘格子
message ReqBuyChessBagGrid{
}

message ResBuyChessBagGrid{
 RES_CODE code = 1;
 string msg = 2;
}

```

## 设置能量发射倍数

```protobuf
// 设置
message ReqSetEnergyMul{
 int32 EnergyMul = 1; //能量倍数（1，2，3）
}
// 返回
message ResSetEnergyMul{
 RES_CODE ResultCode = 1;
 string Msg = 2;
}

// 基础信息
message BaseInfo {
 int32 EenegyMul = 1;
 bool IsFirstBuy = 2;  // 是否已第一次购买体力商店
 int32 EnergyBuy = 3; // 今日体力商店购买次数
}

message ReqUserInfo{}

message UserInfo {
 int32 Uid = 1; // Uid
 string Nickname = 2; // 昵称
 int32 Avatar = 3; // 头像框
 int32 Face = 4; // 头像
 int32 DecorateCnt = 5; // 总装饰次数
 repeated AvatarInfo AvatarList = 6; // 解锁头像框
 repeated FaceInfo FaceList = 7; // 解锁头像
 int32 Login = 8; // 登录
 string PetName = 9; //宠物名字
}

// 设置昵称
message ReqSetName {
 string Name = 1;
}

message ResSetName {
 RES_CODE ResultCode = 1;
 string Msg = 2;
}

message ReqSetPetName {
    string Name = 1;
}

message ResSetPetName {
    RES_CODE ResultCode = 1;
    string Msg = 2;
}
//体力商店购买体力
message ReqBuyEnergy{
 int32 Energy = 1; // 购买体力
}

message ResBuyEnergy{
 RES_CODE ResultCode = 1;
 string Msg = 2;
}
```

## 图鉴

### 领取图鉴奖励

```protobuf
message ReqGetHandbookReward {
 int32 ChessId = 1; //棋子id
}

message ResGetHandbookReward{
 RES_CODE Code = 1;
 string Msg = 2;
}

message HandbookInfo {
 int32 ChessId = 1;
 int32 Status = 2; //图鉴领取状态 0 未领取 1已领取
}

message Handbook {
 repeated HandbookInfo Handbooks = 1;  //图鉴列表 不在列表中未解锁
}
```

## 装饰

```protobuf
message ReqDecorate{
 int32 AreaId = 1; // 区域id
 int32 DecorateId = 2; //装饰唯一id
}

message ResDecorate{
 RES_CODE Code = 1;
 string Msg = 2;
}

message ResDecorateInfo {
 int32 AreaId = 1; // 区域id
 repeated int32 mFinishList = 2; //当前区域已完成装饰id
}
// 一键装饰
message ReqDecorateAll{}

message ResDecorateAll{
    RES_CODE Code = 1;
    string Msg = 2;
}

```

## 订单

```protobuf

message ReqRewardOrder{
 int32 OrderId = 1;
 map<string, int32> mChessData = 2;
}

message ResRewardOrder{
 RES_CODE Code = 1;
 string Msg = 2;
}

message Order{
 int32 Id = 1; // 订单id 自增唯一
 repeated int32 ChessId = 2;  //订单所需棋子
 int32 type = 3; // 订单类型 （1普通，2额外 3超级 4预热）
}

message ResOrderList{
 repeated Order OrderList = 1;
}
```

## gm命令

```protobuf
message ReqGmCommand{
 string Command = 1; //gm指令
 string args = 2;
}
// GM Command
// additem 2 1000 : additem 道具id 道具数量
// zeroUpdate 0点更新
// pay 1 : pay ChargeId 充值
// subitem 2 1000 : 扣除道具
// reset_order : 重置订单
// add_card_star 1 : 增加卡牌兑换星星
// addexp 1 : 增加玩家经验
// setlv 1 : 设置玩家等级
// setSevenLoginActive 1 ： 设置七天登录进度
// resetCardReq ： 重置卡牌请求
```

## 卡牌收集类

### 卡牌交换

好友赠送  status 1直接赠送  任务直接完成，过期也不能删除，直至被赠送好友接受
好友交换 1发起交换请求 2好友选择交换的卡牌后发起回执 3发起方同意交换 4接收方领取卡牌（状态124 时间过期后可以删除，3不能删除，只能等接收方领取完卡牌，状态变成4后才能删除）
好友请求 1 同时发起多名好友 2 有其中一名好友同意请求 （状态1过期直接作废删除，2不能删除直到发起者接受卡牌）

```protobuf
message Card {
 int32 Id = 1;
 int32 Count = 2;
}
message ReqCardInfo{}
message ResCardInfo{
 repeated Card CardList = 1; // 卡牌列表
 int32 ExStar = 2; // 额外星级
 int32 Status = 3; // 全收集奖励0:未领取 1:已领取
 repeated int32 CollectId = 4; // 已领取的收集奖励
 int32 ExTimes = 5; //剩余兑换次数
 int32 ReqTimes = 6; //剩余请求次数
 map<int32, int32> AllCard = 7; // 万能卡牌
 int32 EndTime = 8; //周期结束时间
 repeated int32 ReqUid = 9; // 今日已请求的Uid
 repeated int32 ExUid = 10; // 今日已置换的Uid
 int32 GoldTimes = 11; //剩余金卡交换次数
 int32 Round  = 12; // 轮次
}

message ResNotifyCardTimes{
    int32 ExTimes = 1; //剩余兑换次数
    int32 ReqTimes = 2; //剩余请求次数
    repeated int32 ReqUid = 3; // 今日已请求的Uid
    repeated int32 ExUid = 4; // 今日已置换的Uid
    int32 GoldTimes = 5; //剩余金卡交换次数
}

// 卡牌通知
message ResNotifyCard{
 map<int32, int32> Card = 1; //  卡牌
 map<int32, int32> Master = 1; //  万能卡牌
 int32 ExStar = 3; // 额外星星
}


// 万能卡兑换
message ReqMasterCard{
    int32 Id = 1; // 万能卡id 6 普通 7 金卡
    int32 CardId = 2; // 兑换的卡id
}
message ResMasterCard{
    RES_CODE Code = 1;
    string Msg = 2;
    int32 MasterId = 3;
    int32 CardId = 4;
}

// 领取卡牌系列收集奖励
message ReqCardCollectReward{
 int32 Color = 1;
}

message ResCardCollectReward{
 RES_CODE Code = 1;
 string Msg = 2;
} 

// 兑换收集星星奖励
message ReqExStarReward{
 int32 Id = 1;
}

message ResExStarReward{
 RES_CODE Code = 1;
 string Msg = 2;
}

// 领取全收集奖励
message ReqAllCollectReward{
 
}

message ResAllCollectReward{
 RES_CODE Code = 1;
 string Msg = 2;
}

// 请求赠送卡片
message ReqCardGive{
 repeated int32 Uid = 1;
 int32 CardId = 2;
}

message ResCardGive{
 RES_CODE Code = 1;
 string Msg = 2;
}

// 同意请求卡牌
message ReqAgreeCardGive{
 string Id = 1; // Id
}

message ResAgreeCardGive{
 RES_CODE Code = 1;
 string Msg = 2;
 string Id = 3;
}

// 拒绝请求卡牌
message ReqRefuseCardGive{
 int32 Uid = 1;
}

message ResRefuseCardGive{
 RES_CODE Code = 1;
 string Msg = 2;
 string Id = 3;
}

// 赠送卡牌
message ReqCardSend{
 int32 Uid = 1;
 int32 CardId = 2;
}

message ResCardSend{
 RES_CODE Code = 1;
 string Msg = 2;
}

// 请求卡牌交换
message ReqCardExchange{
 int32 Uid = 1;
 int32 CardId = 2;
}

message ResCardExchange{
 RES_CODE Code = 1;
 string Msg = 2;
}

// 选择交换的卡牌
message ReqSelectCardExchange{
 int32 Uid = 1;
 int32 CardId = 2;
}

message ResSelectCardExchange{
 RES_CODE Code = 1;
 string Msg = 2;
 string Id = 3;
}

// 同意卡牌交换
message ReqAgreeCardExchange{
 string Id = 1;
}
message ResAgreeCardExchange{
 RES_CODE Code = 1;
 string Msg = 2;
 string Id = 3;
}

// 拒绝选择卡牌进行交换
message ReqRefuseCardSelect{
 string Id = 1;
}
message ResRefuseCardSelect{
 RES_CODE Code = 1;
 string Msg = 2;
 string Id = 3;
}
// 拒绝卡牌交换
message ReqRefuseCardExchange{
 int32 Uid = 1;
}
message ResRefuseCardExchange{
 RES_CODE Code = 1;
 string Msg = 2;
 string Id = 3;
}

// 领取卡牌
message ReqGetFriendCard{
    string Id = 1;
}

message ResGetFriendCard{
    RES_CODE Code = 1;
    string Msg = 2;
    string Id = 3;
    int32 CardId = 4;
}

// 获取可以交换的金卡
message ReqGetGoldCard{}
message ResGetGoldCard{
    int32 Four = 1; // 四星金卡
    int32 Five = 2; // 五星金卡
}
```

## 引导

```protobuf
// 领取引导奖励
message ReqGuideReward{
 int32 Id = 1; //奖励id
}

message ResGuideReward{
 RES_CODE Code = 1;
 string Msg = 2;
}

message ResGuildInfo{
 map<int32, int32> Reward = 1;
}

// 弹窗


message ResItemPop{
 int32 Id = 1;
 repeated ItemInfo Items = 2; // 道具
 repeated CardPack CardPacks = 3; // 卡包
 string Lable = 4; // 标签
}

message ItemInfo{
 int32 Id = 1;
 int32 Num = 2;
}

message CardPack{
 int32 Id = 1; //卡包id
 repeated int32 Card = 2;
}
```

## 日常任务

```protobuf

message ResDailyTask{
 map<int32, DailyWeek> WeekReward = 1; //周奖励
 map<int32, DailyTask> DailyTask = 2; //任务进度
 int32 Active = 3; //活跃度
 int32 DayEnd = 4; // 日结束时间戳
 int32 WeekEnd = 5; //周结束时间戳
}

message DailyWeek{
 repeated ItemInfo Items = 1; //奖励
 bool Status = 2; //状态 0:未领取 1:已领取
 int32 NeedActive = 3; //需要的活跃度
}

message DailyTask{
 int32 Status = 1; //状态 0:未完成， 1已完成 2已领取
 bool UnLock = 2; //是否解锁 0:未解锁 1:已解锁
 QuestProgress Progress = 3; //任务进度
 repeated ItemInfo Items = 4; //奖励
}

message QuestProgress{
 string Label = 1; //任务标签
 int32 Num = 2; //当前进度
 int32 Target = 3; //目标
 bool Status = 4; //状态 0:未完成， 1已完成
 int32 Param = 5; //参数
}

// 领取日常任务奖励
message ReqGetDailyTaskReward{
 int32 Id = 1;
}

message ResGetDailyTaskReward{
 RES_CODE Code = 1;
 string Msg = 2;
}

// 领取日常周奖励
message ReqGetDailyWeekReward{
 int32 Id = 1;
}

message ResGetDailyWeekReward{
 RES_CODE Code = 1;
 string Msg = 2;
}

message ReqDailyUnlock{}

```

## 头像

```protobuf
message ResFaceInfo{
 repeated int32 FaceList = 1; // 头像列表
 int32 CurFace = 2; // 设置的头像
}

// 设置头像
message ReqSetFace{
 int32 Face = 1;
}

message ResSetFace{
 RES_CODE Code = 1;
 string Msg = 2;
}

```

## 头像框

```protobuf

message ResAvatarInfo{
 repeated AvatarInfo AvatarList = 1; // 头像框列表
 int32 CurAvatar = 2; // 设置的头像
}

message AvatarInfo{
 int32 Id = 1;
 int64 EndTime = 2;
}

// 设置头像框
message ReqSetAvatar{
 int32 Avatar = 1; 
}

message ResSetAvatar{
 RES_CODE Code = 1;
 string Msg = 2;
}
```

## 七日签到

```protobuf
// 七日签到
message ResSevenLogin{
 repeated SevenLoginReward WeekReward = 1; //周奖励
 repeated SevenLoginReward MonthReward = 2; //月奖励
 int32 Active = 3; //活跃度
 bool IsBack = 4; //是否召回
}

message SevenLoginReward{
 repeated ItemInfo Item1 = 1; //奖励1
 repeated ItemInfo Item2 = 2; //奖励2
 repeated ItemInfo Item3 = 3; //奖励3
 int32 Status = 4; //状态 0:未领取 1:可领取 2：已领取
 int32 Id = 5; //id
}
// 领取周奖励
message ReqGetSevenLoginReward{
 int32 Id = 1;
}

message ResGetSevenLoginReward{
 RES_CODE Code = 1;
 string Msg = 2;
}

// 领取月奖励
message ReqGetMonthLoginReward{
 int32 Id = 1;
}

message ResGetMonthLoginReward{
 RES_CODE Code = 1;
 string Msg = 2;
}
```

## 限时事件

```protobuf
// 限时事件
message ReqLimitEvent{}

message ResLimitEvent{
 map<int32, LimitEvent> LimitEventList = 1;
}
message ResLimitEventProgress{
 int32 Progress = 2; //进度
 map<int32, int32> ProgressReward = 3; //奖励 可以选择的奖励 Id =》 RewardId
}
message ReqLimitEventReward{ // 领取限时事件奖励
 int32 Id = 1;
}

message ResLimitEventReward{
 RES_CODE Code = 1;
 string Msg = 2;
}
message ReqSelectLimitEvent{
    int32 Id = 1;
}

message LimitEvent {
 int32 EndTime = 1; //结束时间
 int32 Cd = 2; //cd
}

message LimitEventNotify {
 int32 Id = 1; // 限时事件类型
 int32 Type = 2; // 0 开始 1 结束
 int32 EndTime = 3; //结束时间
 int32 Cd = 4; //cd
}
message ReqLimitSenceReward{}

message ResLimitSenceReward{
 RES_CODE Code = 1;
 string Msg = 2;
}
message ResChessRainReward{
  int32 Chest = 1; // 宝箱id
}


// 连技快手奖励
message ReqFastProduceReward{
 int32 Energy = 1; 
}

message ResFastProduceReward{
 RES_CODE Code = 1;
 string Msg = 2;
}
```

### 事件类型

```golang
const (
 EVENT_TYPE_HIGH_ROLLER   = 1  // high roller
 EVENT_TYPE_SUPER_EMIT    = 2  // 超级发射器
 EVENT_TYPE_METEOR_SHOW   = 3  // 流星雨
 EVENT_TYPE_CHEST_RAIN    = 4  // 宝箱雨
 EVENT_TYPE_SUPER_ORDER   = 5  // 超级订单
 EVENT_TYPE_SENCE_DASH    = 6  // 场景冲刺
 EVENT_TYPE_CARD_FESTIVAL = 7  // 卡牌节
 EVENT_TYPE_GOLDCARD_EX   = 8  // 金卡交换
 EVENT_TYPE_PET_THIEF     = 9  // 宠物小偷
 EVENT_TYPE_FAST_PRODUCE  = 10 // 连击快手
)
```


## 好友

```protobuf
// 好友

// 搜索好友
message ReqSearchPlayer{
 string Uid = 1;
}

message ResSearchPlayer{
 int32 Code = 1; // 0 
 repeated ResPlayerSimple List = 2;
}
// 好友推荐
message ReqFriendRecommend{}

// 好友推荐
message ResFriendRecommend{
 repeated ResPlayerSimple List = 1;
}

// 隐藏
message ReqFriendIgnore{
 int32 Uid = 1;
}

message ResFriendIgnore{
 RES_CODE Code = 1;
 string Msg = 2;   
}

// 好友基础信息
message ResPlayerSimple{
 int32 Uid = 1;
 string Name = 2;
 int32 Face = 3;
 int32 Avatar = 4;
 int32 Level = 5;
 int32 Decorate = 6;
 int32 login = 7; 
 int32 loginout = 8;
 string Facebook = 9;
}

// 好友日志
message ResFriendLog{
 int32 Uid = 1;
 string Name = 2;
 int32 Face = 3;
 int32 Avatar = 4;
 int32 Level = 5;
 int32 Type =6;
 int32 Time = 7;
}

message NotifyFriendCard{
 ResFriendCard Info = 1;
}

message NotifyFriendLog{
    ResFriendLog info = 1;
}

// 好友卡牌申请
message ResFriendCard{
 int32 Uid = 1; 
 string Name = 2;
 int32 Face = 3;
 int32 Avatar = 4;
 int32 Level = 5;
 int32 Type = 6;
 int32 Time = 7;
 int32 CardId = 8;
 int32 ExCardId = 9;
 int32 Status = 10;
 string Id = 11;
}

message ReqFriendList{}

// 好友基础信息
message ResFriendList{
 repeated ResPlayerSimple FriendList = 1;
}
// 好友申请列表
message ReqFriendApply{}
message ResFriendApply{
 repeated ResFriendApplyInfo ApplyList = 1; 
}
message ResFriendApplyInfo{
    ResPlayerSimple Player = 1;
    int32 Time = 2;
}
// 好友卡牌交换信息
message ReqFriendCardMsg{}
message ReqFriendCardMsg{
 repeated ResFriendCard MsgList = 1;
}
// 好友时间线
message ReqFriendTimeLine{}
message ResFriendTimeLine{
 repeated ResFriendLog Log = 1;
}

message ResFriendApplyNotify{
 ResPlayerSimple Player = 1;
 int32 Type = 2; // 1:申请 2:同意 3:拒绝 4:删除
 int32 Time = 3; 
}

// 申请好友
message ReqApplyFriend{
 int32 Uid = 1;
}

message ResApplyFriend{
 RES_CODE Code = 1;
 string Msg = 2;
}

// 同意申请
message ReqAgreeFriend{
 int32 Uid = 1;
}

message ResAgreeFriend{
 RES_CODE Code = 1;
 string Msg = 2;
 int32 Uid = 3;
 ResPlayerSimple Player = 4;
}

// 拒绝申请
message ReqRefuseFriend{
 int32 Uid = 1;
}

message ResRefuseFriend{
 RES_CODE Code = 1;
 string Msg = 2;
 int32 Uid = 3;
}

// 删除好友
message ReqDelFriend{
 int32 Uid = 1;
}

message ResDelFriend{
 RES_CODE Code = 1;
 string Msg = 2;
 int32 Uid = 3;
}
```

## 邮件

```protobuf

// 邮件列表
message ReqMailList{}
message ResMailList{
 map<int32, MailInfo> MailList = 1;
}
message MailInfo{
 int32 Id = 1; // 邮件id
 string Title = 2; // 标题
 string Content = 3; // 内容
 int32 Time = 4; // 时间
 int32 Status = 5; // 0 未读 1 已读 2 已领取 3 已删除
 repeated ItemInfo Items = 6; // 奖励
}
message MailNotify {
    MailInfo Info = 1;
}

// 读邮件
message ReqReadMail{
 int32 Id = 1;
}

message ResReadMail{
 RES_CODE Code = 1;
 string Msg = 2;
 int32 Id = 3;
}

// 领取邮件
message ReqGetMailReward{
 int32 Id = 1;
}

message ResGetMailReward{
 RES_CODE Code = 1;
 string Msg = 2;
 int32 Id = 3;
}

// 删除邮件
message ReqDeleteMail{
 int32 Id = 1;
}

message ResDeleteMail{
 RES_CODE Code = 1;
 string Msg = 2;
 int32 Id = 3;
}

```

## 充值礼包

```protobuf
// 充值

测试充值
GM "pay 1" // pay ChargeId

message ResCharge{
 float Charge = 1; // 总充值金额
 int32 Total = 2; // 总充值次数
 repeated int32 First = 3;  //已首充档次
 map<int32, ResSpecialShop> SpecialShop = 4; // 特惠礼包
 int32 FreeShop = 5; // 已领取免费礼包档次  
 map<int32, ResChessShop> ChessShop = 6; // 棋子商店
 map<int32, int32> Gift = 7; // 礼包 礼包id =》 礼包数量
 bool Ad = 8; // 是否有广告礼包
}

message ResSpecialShop {
 int32 Grade = 1; //挡位
 int32 Count = 2; //剩余购买次数
}

message ResChessShop {
 int32 Diamond = 1; // 需要花费钻石
 int32 Count = 2; // 剩余购买数量
}

message ReqFreeShop{} // 领取免费奖励

message ResFreeShop{
 RES_CODE Code = 1;
 string Msg = 2;
}

// 商店购买棋子
message ReqBuyChessShop{
 int32 Id = 1;
}


message ResBuyChessShop{
 RES_CODE Code = 1;
 string Msg = 2;
}

// 商店购买棋子
message ReqBuyChessShop2{
    int32 Id = 1;
    map<string, int32> mChessData = 2;
}
message ResBuyChessShop2{
    RES_CODE Code = 1;
    string Msg = 2;
}
// 刷新棋子商店
message ReqRefreshChessShop{}

message ResRefreshChessShop{
 RES_CODE Code = 1;
 string Msg = 2;
}

// 请求无尽礼包数据
message ReqEndless{}

message ResEndless{
 int32 Id = 1; // 当前解锁的id
 map<int32, ResEndlessInfo> EndlessList = 2; // 礼包列表 id自增
}

message ResEndlessInfo{
 int32 ChargeId = 1; // 充值id
 int32 Type = 2; // 礼包类型 1 AD礼包 2 充值礼包 3 免费礼包
 repeated ItemInfo Items = 3; // 礼包道具
}

// 领取免费和AD礼包
message ReqEndlessReward{}

message ResEndlessReward{
 RES_CODE Code = 1;
 string Msg = 2;
}

```

## 小猪存钱罐

```protobuf
message ResPiggyBank{
 int32 Type = 1; // 存钱罐类型 1：充值 2：广告
 int32 Diamond = 2; // 存钱罐中的钻石
 int32 Count = 3; // 剩余可以触发的次数
 int32 EndTime = 4; // 结束时间 当前存钱罐结束时间
}

message ReqPiggyBankReward{} // 领取猪猪银行奖励

message ResPiggyBankReward{
 RES_CODE Code = 1;
 string Msg = 2;
}

```

## 锦标赛

```protobuf
message ReqChampship{}

message ResChampship{
 int32 Score = 1; // 获得的总积分
 int32 Reward = 2; // 当前已领取的档次
 int32 EndTime = 3; // 结束时间
 int32 Period = 4; //周期
 int32 Rank = 5;// 自身排行
 int32 RankReward = 6; // 0 不能领 1 可以领 2 已领取
 int32 Status = 7; // 0 关闭 1 开放 0.00 0.30 全服推送 
}

message ReqChampshipReward{}

message ResChampshipReward{
 RES_CODE Code = 1;
 string Msg = 2;
}

message ReqChampshipRankReward{}
message ResChampshipRankReward{
 RES_CODE Code = 1;
 string Msg = 2;
}


message ReqChampshipRank{}
message ResChampshipRank{
 map<int32, ResPlayerRank> RankList = 1; // 榜单数据
 int32 MyRank = 2; // 我的排行
 float MyScore = 3; //我的积分
}

message ReqChampshipPreRank{}
message ResChampshipPreRank{
 map<int32, ResPlayerRank> RankList = 1; // 榜单数据
 int32 MyRank = 2; // 我的排行
 float MyScore = 3; //我的积分
}
message ResPlayerRank{
 int32 Uid = 1;
 string Name = 2;
 int32 Face = 3;
 int32 Avatar = 4;
 int32 Level = 5;
 float score = 6;
}

```

## 排行榜

```protobuf

// 玩家榜单
message ReqRank{
 int32 Type = 1; // 1:玩家榜单 
}

message ResRank{
 int32 Type = 1; // 榜单类型
 map<int32, ResPlayerSimple> RankList = 2; // 榜单数据
 int32 MyRank = 3; // 我的排行
 float MyScore = 4; //我的积分
}

// 请求锦标赛榜单
message ReqChampshipRank{}
message ResChampshipRank{
 map<int32, ResPlayerSimple> RankList = 1; // 榜单数据
 int32 MyRank = 2; // 我的排行
 float MyScore = 3; //我的积分
}
```

## 活动类

```protobuf
message ResActivity{
 repeated ActivityInfo ActiveList = 1;
}

message ActivityInfo{
 int32 Id = 1; //id
 int32 Type = 2; //类型
 int32 StartTime = 3; //开始时间
 int32 EndTime = 4; //结束时间
 int32 Status = 5; //状态 0:未开始 1:进行中 2:已结束
 string Title = 6; //标题
 int32 Red = 7; //红点
}

// 活动更新通知
message ActivityNotify {
    ActivityInfo Info = 1;
}

message ResActRed{
    map<int32, int32> Red = 1; // 活动红点
}
// 活动红点通知
message NotifyActRed{
    int32 Id = 1;
    int32 Red = 2;
}

```

### 挖矿

```protobuf

message ReqMining{}
message ResMining{
    int32 Id = 1;  // 活动id
    int32 Status = 2; // 0 未开始 1 进行中 2 已结束
    int32 EndTime = 3; // 结束时间
    int32 Template = 4; // 模板
    int32 Pass = 5; // 关卡
    repeated int32 Gem = 6; // 宝石
    map<int32, string> Map = 7; // 地图
}
message ReqMiningTake{
    map<int32, string> Map = 1; // 地图
    int32 Gem = 2; // 解锁的宝石
}
message ResMiningTake{
    RES_CODE Code = 1;
    string Msg = 2;
}
message ReqMiningReward{}
message ResMiningReward{
    RES_CODE Code = 1;
    string Msg = 2;
}

重置GM miningReload

```

### 猜颜色

```protobuf
//猜颜色
message ReqGuessColor{}
message ResGuessColor{
    int32 Id = 1; // 活动id
    int32 Status = 2; // 0 未开始 1 进行中 2 已结束
    int32 EndTime = 3; // 结束时间
    int32 Template = 4; // 模板
    int32 Pass = 5; // 关卡
    repeated int32 Color = 6; // 剩余的颜色
    repeated int32 Pos = 7; // 已猜中的颜色 位置从左到右 从1开始
    opponent Opponent = 8; // 对手
}

message opponent{
    string Name = 2;
    int32 Face = 3;
    int32 Avatar = 4;
    int32 Progress = 5;
}

message ReqGuessColorTake{
    map<int32, int32> Map = 1; // 颜色 pos => color
}

message ResGuessColorTake{
    RES_CODE Code = 1;
    string Msg = 2;
}

message ReqGuessColorReward{}
message ResGuessColorReward{
    RES_CODE Code = 1;
    string Msg = 2;
}
```

### 三段竞赛

```protobuf

message ReqRace{}
message ResRace{
    int32 Id = 1; // 活动id
    int32 Status = 2; // 0 未开始 1 进行中 2 已结束
    int32 EndTime = 3; // 结束时间
    int32 Template = 4; // 模板
    int32 Pass = 5; // 关卡
    int32 GameStartTime = 6; // 游戏开始时间
    int32 GameEndTime = 7; // 游戏结束时间
    int32 Progress = 8; // 进度
    repeated raceopponent Opponent = 9; // 对手
}

message raceopponent{
    int32 Id = 1;
    int32 Image = 2;
    int32 Progress = 3;
}

message ReqRaceStart{}
message ResRaceStart{
    RES_CODE Code = 1;
    string Msg = 2;
}

message ReqRaceReward{}
message ResRaceReward{
    RES_CODE Code = 1;
    string Msg = 2;
}
```

## 玩家日志

## 支付订单处理

```protobuf

message ReqCreateOrderSn{
 int32 ChargeId = 1;
 string PlatForm = 2; // 平台标识 测试用test
 string channel = 3; // 支付渠道标识  测试用test 
}

message ResCreateOrderSn{
 string OrderSn = 1; // 订单号
}

message ReqShippingOrder{
 string OrderSn = 1; // 订单号
 string PayOrderSn = 2; // 支付订单号
 int32 Status = 3; // 1 成功 2 失败
}

message ResShippingOrder{
 RES_CODE Code = 1;
 string Msg = 2;
}
```

## 背包

```protobuf
message ResItem{
    map<int32, int32> Item = 1;
}

message ItemNotify{
    map<int32, int32> Item = 1;  // 道具id =》 变化的数量
}

```

## playroom

```protobuf
message ReqPlayroom{} // 请求我的空间信息

message ResPlayroom{
    int32 status = 1; // 状态
    repeated ItemInfo Items = 2; // 触发式订单奖励
    repeated RoomOpponent Opponent = 3; // 对手
    repeated FriendRoom Friend = 4; // 好友
    map<int32, int32> Playroom = 5; // 空间装饰 位置 =》 装饰id
    repeated int32 collect = 6; // 已解锁的装饰
    map<int32, int32> Mood = 7; // 心情 <位置, 心情>
    repeated ItemInfo LoseItem = 8; // 损失的道具
    int32 StartTime = 9; // 开始时间
    int32 WorkStatus = 10; // 1 工作中 2 休息中
    int32 AllMood = 11; // 总心情
    int32 Chip = 12; // 碎片
    int32 WorkOutline = 13;// 离线打工状态 0 未离线 1 已离线
}
message ReqPlayroomWrokOutline{} // 处理离线打工
message ResPlayroomWrokOutline{
    RES_CODE Code = 1;
    string Msg = 2;
}
message NofiPlayroomStatus{
    int32 WorkOutline = 1; // 状态
}
message NotifyPlayroomWork{
    int32 StartTime = 1; // 开始时间
    int32 WorkStatus = 2; // 1 工作中 2 休息中
}

message NotifyPlayroomLose{
    repeated ItemInfo LoseItem = 1; // 损失的道具
    int32 Chip = 2;// 碎片
}
message NotifyPlayroomMood{
    int32 AllMood = 1; // 总心情
    map<int32, int32> Mood = 2; // 心情 <位置, 心情>
}
message FriendRoom{
    int32 Uid = 1;
    string Name = 2;
    int32 Face = 3;
    int32 Avatar = 4;
    int32 Times = 5; // 以你为目标的次数
}

message RoomOpponent{
    int32 Uid = 1;
    string Name = 2;
    int32 Face = 3;
    int32 Avatar = 4;
    int32 LastTime = 5; // 上次被攻击时间
}



// 请求拜访空间信息
message ReqPlayroomInfo{
    int32 Uid = 1;
} 
message ResPlayroomInfo{
    int32 Uid = 1;
    string name = 2;
    int32 Face = 3;
    int32 Avatar = 4;
    map<int32, int32> Playroom = 5; // 空间装饰 位置 =》 装饰id
    int32 GameId = 6; // 游戏id
    map<int32, ItemInfo> Items = 7; // 游戏奖励
    int32  Status = 8; // 状态 0 未开始 1 选择奖励 2 已结束
    bool defense = 9; // 是否有防御
    map<int32, int32> flip = 10; // 翻牌 <位置, 牌>
    int32 Chip = 11; // 碎片
    string PetName = 12; // 宠物名
}

// 请求翻牌
message ReqPlayroomFlip{
    int32 Id = 1; // 翻牌位置
}

message ResPlayroomFlip{
    RES_CODE Code = 1;
    string Msg = 2;
    int32 Id = 3; // 翻牌位置
    int32 CardId = 4; // 卡牌id
}

message ReqPlayroomGame{
    int32 Type = 1; // 1:绿色 2：黄色 3：红色
}

message ResPlayroomGame{
    RES_CODE Code = 1;
    string Msg = 2;
    int32 Type = 3;
    map<int32, ItemInfo> Items = 4; // 游戏奖励
}

message ReqPlayroomInteract{
    int32 Id = 1; // 互动类型
    int32 Type = 2; // 1 消耗道具1 2 消耗道具2
}

message ResPlayroomInteract{
    RES_CODE Code = 1;
    string Msg = 2;
}

message ReqPlayroomSetRoom{
    map<int32, int32> Playroom = 2; // 空间装饰 位置 =》 装饰id
}

message ResPlayroomSetRoom{
    RES_CODE Code = 1;
    string Msg = 2;
}

message ReqPlayroomSelectReward{
    int32 Id = 1; // 奖励id
}

message ResPlayroomSelectReward{
    RES_CODE Code = 1;
    string Msg = 2;
}

message ReqPlayroomLose{}

message ResPlayroomLose{
    RES_CODE Code = 1;
    string Msg = 2;
}

// 打工
message ReqPlayroomWork{}
message ResPlayroomWork{
    RES_CODE Code = 1;
    string Msg = 2;
}

// 休息
message ReqPlayroomRest{}
message ResPlayroomRest{
    RES_CODE Code = 1;
    string Msg = 2;
}

message ReqPlayroomDraw{}
message ResPlayroomDraw{
    RES_CODE Code = 1;
    string Msg = 2;
    int32 Id = 3; // 奖励Id
}

message ReqPlayroomChip{
    int32 Num = 1; // 要消除的层数
}

message ResPlayroomChip{
    RES_CODE Code = 1;
    string Msg = 2;
}

// playroom 打工离线
message ReqPlayroomOutline{
    int32 OldChessId = 1;
    int32 NewChessId = 2;
    int32 CostDia = 3;
    int32 Type = 4; //1 气泡 2 宝箱解锁 3 快捷购买 4 打工离线
    map<string, int32> mChessData = 5;
}

message ResPlayroomOutline{
    RES_CODE code = 1;
    string msg = 2;
}
```

## 宠物宝箱

```protobuf

// 宠物宝藏
message ReqFriendTreasure{}

message ResFriendTreasure{
    int32 Status = 1; // 0 未开始 1 进行中 2 已结束
    int32 Star = 2; // 星级
    int32 Shift = 3; // 当前挡位
    repeated TreasureInfo List = 4; // 列表
    repeated int32 List2 = 5; // 
}

message TreasureInfo{
    int32 Pos = 1; // 位置
    int32 Type = 2; // 类型
    int32 Face = 3; // 头像
    int32 Avatar = 4; // 头像框
    int32 Uid = 5; // Uid
    int32 Status = 6; // 0 未翻 1 已翻    
}

message ReqFriendTreasureStart{
    repeated TreasureInfo List = 1; // 列表
    repeated int32 List2 = 2;
}

message ResFriendTreasureStart{
    RES_CODE Code = 1;
    string Msg = 2;
}

message ReqFriendTreasureFilp{
    int32 Pos = 1;
}

message ResFriendTreasureFilp{
    RES_CODE Code = 1;
    string Msg = 2;
}

message ReqFriendTreasureEnd{
}

message ResFriendTreasureEnd{
    RES_CODE Code = 1;
    string Msg = 2;
}

message ResFriendTreasureStar{
    int32 Star = 1; // 星级
}

```

## 后台

## SDK
