流程设计

名师宝册流程设计

  • 师徒系统的配套功能

名师宝册名师值

  • 师徒通过做任务、游戏等途径可以增加师父的名师值;
  • 通过师徒游戏增加的名师值每日增加有上限(数值通过配置控制),达到上限后,名师值增加无效,直到次日0点重置;

名师宝册特权

  • 达到对应的名师等级后,可能有相应的特权,名师宝册配置控制;
  • 名师宝册配置中的虚拟道具用于给客户端显示,实际另有特权配置,需要与此一一对应;

增加徒弟席位

  • 名师宝册配置达到对应的等级,每次增加名师值时,可以额外添加多少百分比,取最大百分比;
  • 需要与名师宝册等级奖励的虚拟道具配置对应;

名师值增加系数

  • 师徒系统配置fs_memtor_system.xml中配置了徒弟席位的解锁,达到对应的名师等级可解锁对应的徒弟席位;
  • 需要与名师宝册等级奖励的虚拟道具配置对应;

双端交互

请求回复的结果

enum emMentorBookResult
{
    mentorbook_ok = 0,                            // 成功
    mentorbook_fail = 1,                        // 未知错误
    mentorbook_not_load_complete = 2,            // 数据未加载完毕
    mentorbook_no_config = 3,                    // 未找到配置
    mentorbook_take_already = 4,                // 已领取
    mentorbook_add_goods_error = 5,             // 奖励发放失败
    mentorbook_yb_not_enough = 6,               // 元宝不足
    mentorbook_consume_error = 7,               // 扣元宝失败
    mentorbook_condition_not_match = 8,         // 为达到条件
};

数据查询

ABROAD_MENTORBOOK_DATA_REQ = 48780,
struct ClientMentorBookDataReq : public PacketBase
{
    ClientMentorBookDataReq() : PacketBase(ABROAD_MENTORBOOK_DATA_REQ, sizeof(ClientMentorBookDataReq))
    {
        PRO_ZERO_MEMORY(this, sizeof(ClientMentorBookDataReq));
    }
};

ABROAD_MENTORBOOK_DATA_REP = 48781,
struct ClientMentorBookDataRep : public PacketBase
{
    static const unsigned int sc_max_prize_count = 400;
    struct TPrizeItem
    {
        unsigned short level;
        unsigned short id;
    };

    unsigned int result;   // emMentorBookResult
    unsigned int level;  // 等级
    unsigned int exp;  // 当前经验值
    unsigned int dayExp;  // 当填增加的经验值
    unsigned int upgradeNeedExp;  // 到下一等级需要的经验值
    unsigned int params[4];  // 预留字段
    unsigned short count;
    TPrizeItem takePrizes[sc_max_prize_count];  // 已领取的奖励

    ClientMentorBookDataRep() : PacketBase(ABROAD_MENTORBOOK_DATA_REP, sizeof(ClientMentorBookDataRep))
    {
        PRO_ZERO_MEMORY(this, sizeof(ClientMentorBookDataRep));
    }

    friend bostream& operator<<(bostream& bos, const ClientMentorBookDataRep& t)
    {
        bos << t.result << t.level << t.exp << t.dayExp << t.upgradeNeedExp;
        for (unsigned int i = 0; i < 4; i++)
        {
            bos << t.params[i];
        }
        bos << t.count;
        for (unsigned char i = 0; i < t.count && i < sc_max_prize_count; ++i)
        {
            bos << t.takePrizes[i].level;
            bos << t.takePrizes[i].id;
        }
        return bos;
    }
};

奖励领取

ABROAD_MENTORBOOK_PRIZE_TAKE_REQ = 48782,
struct ClientMentorBookPrizeTakeReq : public PacketBase
{
    unsigned short level;
    unsigned short id;
    ClientMentorBookPrizeTakeReq() : PacketBase(ABROAD_MENTORBOOK_PRIZE_TAKE_REQ, sizeof(ClientMentorBookPrizeTakeReq))
    {
        PRO_ZERO_MEMORY(this, sizeof(ClientMentorBookPrizeTakeReq));
    }
};

ABROAD_MENTORBOOK_PRIZE_TAKE_REP = 48783,
struct ClientMentorBookPrizeTakeRep : public PacketBase
{
    unsigned int result;
    unsigned short level;
    unsigned short id;
    ClientMentorBookPrizeTakeRep() : PacketBase(ABROAD_MENTORBOOK_PRIZE_TAKE_REP, sizeof(ClientMentorBookPrizeTakeRep))
    {
        PRO_ZERO_MEMORY(this, sizeof(ClientMentorBookPrizeTakeRep));
    }
};

排行榜数据

周期类型

enum emGameRankType
{
    kDailyRank = 0,   // 日榜
    kWeeklyRank = 1,  // 周榜
    kMonthlyRank = 2,  // 月榜
    kTotalRank = 3,    // 总榜
    kVipActivity = 4,
    kRankCount,
};

类型

enum emGameRankId
{
    kRankId_GameScore = 0,
    kRankId_OfficialPower = 1,
    kRankId_MobileHappy1v2 = 2,


    kRankId_Roguelike = 10,
    kRankId_MentorBook = 11,  // 名师宝册
};

获取名师宝册排行版数据

  • 原协议
  • rank_type=kWeeklyRank/kTotalRank
  • rank_id=kRankId_MentorBook
CLIENT_RKS_GAME_RANKING_REQ=45517
struct ClientRksGameRankingReq : PacketBase
{
    BYTE    rank_type;
    unsigned int rank_id;
    unsigned int count;

    unsigned int req_param1;
    unsigned int req_param2;
    ClientRksGameRankingReq() : PacketBase(CLIENT_RKS_GAME_RANKING_REQ, sizeof(ClientRksGameRankingReq))
    {
        PRO_ZERO_MEMORY(this, sizeof(ClientRksGameRankingReq));
    }
};

CLIENT_RKS_GAME_RANKING_REP=45518
struct ClientRksGameRankingRep : public PacketBase
{
    ClientRksGameRankingRep() : PacketBase(CLIENT_RKS_GAME_RANKING_REP, sizeof(ClientRksGameRankingRep))
    {
        PRO_ZERO_MEMORY(this, sizeof(ClientRksGameRankingRep));
    }
    static const unsigned int sc_max_count = 200; // 分页请求,每次10个
    static const unsigned int sc_max_param_cnt = 3;
    struct TRankInfo
    {
        char            nickname[sc_max_nickname_len];
        int                score;
        BYTE            paramcnt;
        unsigned int    param[sc_max_param_cnt];

        friend bistream& operator>>(bistream& bis, TRankInfo& t)
        {
            bis >> t.nickname;
            bis >> t.score;
            bis >> t.paramcnt;
            for (BYTE i = 0; i < t.paramcnt; ++i)
                bis >> t.param[i];
            return bis;
        }

        friend bostream& operator<<(bostream& bos, const TRankInfo& t)
        {
            bos << t.nickname;
            bos << t.score;
            bos << t.paramcnt;
            for (BYTE i = 0; i < t.paramcnt; ++i)
                bos << t.param[i];
            return bos;
        }
    };
    friend bistream& operator>>(bistream& bis, ClientRksGameRankingRep& t)
    {
        //bis >> t.nickname;
        bis >> t.result;
        bis >> t.rank_type;
        bis >> t.rank_id;
        bis >> t.count;
        for (BYTE i = 0; i < t.count; ++i)
            bis >> t.rankinfo[i];
        bis >> t.rep_param1 >> t.rep_param2;
        return bis;
    }

    friend bostream& operator<<(bostream& bos, const ClientRksGameRankingRep& t)
    {
        //bos << t.nickname;
        bos << t.result;
        bos << t.rank_type;
        bos << t.rank_id;
        bos << t.count;
        for (BYTE i = 0; i < t.count; ++i)
            bos << t.rankinfo[i];
        bos << t.rep_param1 << t.rep_param2;
        return bos;
    }
    BYTE    result;
    BYTE    rank_type;
    unsigned int rank_id;
    unsigned int count; //返回的结果数量,如果<sc_page_count说明到最后一页了
    TRankInfo rankinfo[sc_max_count];

    unsigned int rep_param1;
    unsigned int rep_param2;
};

获取名师宝册排名数据

  • 原协议
  • rank_type=kWeeklyRank/kTotalRank
  • rank_id=kRankId_MentorBook
CLIENT_RKS_MY_GAME_RANKING_REQ=45519
struct ClientMyGameRankingReq : public PacketBase
{
    ClientMyGameRankingReq() : PacketBase(CLIENT_RKS_MY_GAME_RANKING_REQ, sizeof(ClientMyGameRankingReq))
    {
        PRO_ZERO_MEMORY(this, sizeof(ClientMyGameRankingReq));
    }
    char acc[sc_max_account_len];
    BYTE    rank_type;
    unsigned int rank_id;

    unsigned int req_param1;
    unsigned int req_param2;
};

CLIENT_RKS_MY_GAME_RANKING_REP=45520
struct ClientMyGameRankingRep : public PacketBase
{
    ClientMyGameRankingRep() : PacketBase(CLIENT_RKS_MY_GAME_RANKING_REP, sizeof(ClientMyGameRankingRep))
    {
        PRO_ZERO_MEMORY(this, sizeof(ClientMyGameRankingRep));
    }
    BYTE    result;
    BYTE    rank_type;
    unsigned int rank_id;
    unsigned int curpos;
    int score;

    unsigned int rep_param1;
    unsigned int rep_param2;
};