双端交互

交互流程与协议说明

老版奖励

  • 不做修改,领取奖励协议号:
    // 领取赛季奖励
    CLIENT_SS_GET_SEASON_REWARD_REQ=23665,
    CLIENT_SS_GET_SEASON_REWARD_REP=23666,
    // 领取大段位奖励
    CLIENT_SS_GET_SEASON_DIVISION_REWARD_REQ=23671,
    CLIENT_SS_GET_SEASON_DIVISION_REWARD_REP=23672,
    

新版奖励

奖励类型与状态定义

enum emArenaNewAwardType
{
    ARENA_NEWAWARD_DIVISION = 0,   // 段位奖励,赛季内手动领取
    ARENA_NEWAWARD_WINBOUT,        // 胜局奖励,赛季内手动领取
    ARENA_NEWAWARD_ALL,            // 段位+胜局奖励,赛季结束后领取未领取的奖励
};

enum emArenaNewAwardState
{
    ARENA_NEWAWARD_NOT_FINISH = 0,   // 奖励条件未完成
    ARENA_NEWAWARD_CAN_TAKE,         // 奖励可领取
    ARENA_NEWAWARD_HAD_TAKE,         // 奖励已领取
};

查询新版奖励信息

ABROAD_ARENA_NEWAWARD_INFO_REQ = 48422,        // 排位赛新版奖励信息
ABROAD_ARENA_NEWAWARD_INFO_REP = 48423,

// 排位赛新版奖励信息
struct ClientArenaAwardInfoReq : public PacketBase
{
    ClientArenaAwardInfoReq() : PacketBase(ABROAD_ARENA_NEWAWARD_INFO_REQ, sizeof(ClientArenaAwardInfoReq))
    {
        PRO_ZERO_MEMORY(this, sizeof(ClientArenaAwardInfoReq));
    }
};

struct ClientArenaAwardInfoRep : public PacketBase
{
    static const unsigned int sc_max_division_count = 50;

    enum
    {
        result_ok = 0,
        result_failed,            // 没有比赛数据 
    };

    struct AwardState
    {
        unsigned int id;
        unsigned int state;  // emArenaNewAwardState
    };

    unsigned int    result;
    unsigned int    useNewAward;            // 是否使用新版奖励,0:老版(后面的数据无效),1:新版
    unsigned int    lastPrize;              // 上个赛季是否有奖励可以领取 0:没有,1:有, 2: 已领取,客户端根据这个判断请求上个赛季奖励

    // 以下是新版奖励数据
    unsigned int    winBout;                // 当前胜局数
    unsigned int    nextAwardWinBout;       // 下一档胜局奖励的胜局数
    unsigned int    winBoutAwardState;      // 当前胜局奖励状态 emArenaNewAwardState

    unsigned int    divisionCount;          // 段位奖励数目
    AwardState        divisionAwardState[sc_max_division_count];  // 段位奖励状态
    ClientArenaAwardInfoRep() : PacketBase(ABROAD_ARENA_NEWAWARD_INFO_REP, sizeof(ClientArenaAwardInfoRep))
    {
        PRO_ZERO_MEMORY(this, sizeof(ClientArenaAwardInfoRep));
    }

    friend bostream& operator<<(bostream& bos, const ClientArenaAwardInfoRep& t)
    {
        bos << t.result;
        bos << t.useNewAward;
        bos << t.winBout;
        bos << t.nextAwardWinBout;
        bos << t.winBoutAwardState;
        bos << t.divisionCount;
        for (unsigned int i = 0; i < t.divisionCount && i < sc_max_division_count; ++i)
        {
            bos << t.divisionAwardState[i].id;
            bos << t.divisionAwardState[i].state;
        }
        return bos;
    }
};

奖励领取

ABROAD_ARENA_NEWAWARD_TAKE_REQ = 48424,        // 排位赛新版奖励领取
ABROAD_ARENA_NEWAWARD_TAKE_REP = 48425,

// 领取排位赛新版奖励
struct ClientArenaAwardTakeReq : public PacketBase
{
    unsigned int    awardType;        // 奖励类型 emArenaNewAwardType,领取上个赛季奖励时awardType=ARENA_NEWAWARD_ALL
    unsigned int    divisionId;       // 领取段位奖励时的段位
    ClientArenaAwardTakeReq() : PacketBase(ABROAD_ARENA_NEWAWARD_TAKE_REQ, sizeof(ClientArenaAwardTakeReq))
    {
        PRO_ZERO_MEMORY(this, sizeof(ClientArenaAwardTakeReq));
    }
};

struct ClientArenaAwardTakeRep : PacketBase
{
    static const unsigned int sc_max_rewardcnt = 100;

    struct Reward
    {
        unsigned int id;
        unsigned int count;
    };

    enum
    {
        result_ok = 0,
        result_failed,            // 没有比赛数据
        result_geted,             // 已领取
        result_fail_addgoods,     // 增加物品失败 
        result_time_error,        // 不在领取时间内
        result_not_finish,        // 未完成
    };

    unsigned int    result;
    unsigned int    awardType;                // 奖励类型 emArenaNewAwardType,awardType不同,客户端提示语可能也不相同

    // 段位奖励数据
    unsigned int    divisionId;                // 领取段位奖励时的段位

    // 胜局奖励数据
    unsigned int    winBout;                // 当前胜局数
    unsigned int    nextAwardWinBout;       // 下一档胜局奖励的胜局数
    unsigned int    winBoutAwardState;      // 当前胜局奖励状态

    unsigned int    rewardCount;            // 奖励个数
    Reward          rewards[sc_max_rewardcnt];

    ClientArenaAwardTakeRep() : PacketBase(ABROAD_ARENA_NEWAWARD_TAKE_REP, sizeof(ClientArenaAwardTakeRep))
    {
        PRO_ZERO_MEMORY(this, sizeof(ClientArenaAwardTakeRep));
    }

    friend bostream& operator<<(bostream& bos, const ClientArenaAwardTakeRep& t)
    {
        bos << t.result;
        bos << t.awardType;
        bos << t.divisionId;
        bos << t.winBout;
        bos << t.nextAwardWinBout;
        bos << t.winBoutAwardState;
        bos << t.rewardCount;
        for (unsigned int i = 0; i < t.rewardCount && i < sc_max_rewardcnt; ++i)
        {
            bos << t.rewards[i].id;
            bos << t.rewards[i].count;
        }
        return bos;
    }
};

奖励状态变更通知

  • 一般是由不可领取变为可领取
  • 增量更新通知

    ABROAD_ARENA_NEWAWARD_STATE_NTF = 48426// 排位赛新版奖励状态更新
    // 奖励状态更新通知
    struct ClientArenaAwardStateNtf : PacketBase
    {
      static const unsigned int sc_max_division_count = 50;
    
      struct AwardState
      {
          unsigned int id;
          unsigned int state;  // emArenaNewAwardState
      };
    
      unsigned int    awardType;                // 更新的奖励类型 emArenaNewAwardType,根据奖励类型更新对应的数据
      // 胜局奖励更新数据
      unsigned int    winBout;                // 当前胜局数
      unsigned int    nextAwardWinBout;       // 下一档胜局奖励的胜局数
      unsigned int    winBoutAwardState;      // 当前胜局奖励状态
      // 段位奖励更新数据
      unsigned int    divisionCount;          // 段位奖励数目
      AwardState        divisionAwardState[sc_max_division_count];  // 段位奖励状态
    
      ClientArenaAwardStateNtf() : PacketBase(ABROAD_ARENA_NEWAWARD_STATE_NTF, sizeof(ClientArenaAwardStateNtf))
      {
          PRO_ZERO_MEMORY(this, sizeof(ClientArenaAwardStateNtf));
      }
    
      friend bostream& operator<<(bostream& bos, const ClientArenaAwardStateNtf& t)
      {
          bos << t.awardType;
          bos << t.winBout;
          bos << t.nextAwardWinBout;
          bos << t.winBoutAwardState;
          bos << t.divisionCount;
          for (unsigned int i = 0; i < t.divisionCount && i < sc_max_division_count; ++i)
          {
              bos << t.divisionAwardState[i].id;
              bos << t.divisionAwardState[i].state;
          }
          return bos;
      }
    };
    

注意

  • 客户端在拉取了新版奖励数据后,根据useNewAward来判断使用新版还是老版奖励以及交互的协议;
  • 新版段位奖励可以不按顺序领取,但胜局奖励一定是按顺序领取的;