local ItemData = require("bag.Proto").ItemData
local RoleBase = require("role.Proto").RoleBase 
local HeroSimple = require("hero.Proto").HeroSimple
local Attr = require("role.Proto").Attr
local BuyItem = require("topup.Proto").BuyItem

--------------------- 基础公会信息及操作 ---------------------
UnionMember = {
    {"roleBase",		1,RoleBase},
    {"post",			1,"byte"},                  -- 玩家职位  1：会长，2：官员，3：成员
    {"inUnionWar",		1,"byte"},                  -- 玩家是否在公会战中  0:不在，1：在
    {"lastLogoutTime",	1,"int"},                   -- 最近一次离线时间 在线时为0，不在线时为上次离线时间到现在的时间
    {"totalDonate",1,"int"},                        -- 玩家累计捐赠
    {"todayDonate",1,"int"},                        -- 玩家当日捐赠
    {"liveLv",1,"byte"},                            -- 玩家活跃等级
}

UnionMsg = {
    {"unionIdentity",1,"string"},       --公会identity
    {"unionUuid",	 1,"string"},       --公会uuid
    {"name",		 1,"string"},       --公会名称
    {"lv",			 1,"byte"},         --公会等级
    {"curCnt",		 1,"byte"},			--公会当前人数
    {"maxCnt",		 1,"byte"},			--公会最大人数
    {"bannerID",	 1,"byte"},			--公会旗帜ID
    {"needLv",		 1,"short"},        --等级要求
    {"notice",		 1,"string"},		--公会公告
    {"exp",			 1,"int"},          --公会当前经验
    {"maxExp",		 1,"int"},			--公会升级经验
    {"presidentName",1,"string"},       --会长名字
    {"isApply",      1,"byte"},         --申请状态
}

UnionApplyMsg = {
    {"roleBase",1,RoleBase},
    {"flag",	1,"byte"},          --处理信息
}

UnionLogMsg = {
    {"logMsg",	1,"string"},         --公会日志
}
-- 创建公会
CG_UNION_CREATE = 
{
    {"name",	 1,"string"},       --公会名
    {"bannerID", 1,"byte"},          --公会旗帜
    {"notice",	 1,"string"},       --公告
    {"needLv",	 1,"short"},        --等级要求
    {"needAgree",1,"byte"},         --入会验证
}

-- 解散公会
CG_UNION_DISMISS = {}

-- 公会查询
CG_UNION_QUERY = {
}
-- 已加入公会玩家查询公会信息
GC_UNION_QUERY = {
    {"post",1,"byte"},                -- 查询人的职位
    {"unionMember",30,UnionMember},   -- 公会成员
    {"unionMsg",1,UnionMsg},          -- 公会信息
    {"hasApply",1,"byte"},            -- 公会申请信息
    {"logDot", 1,"byte"},             -- 公会日志红点
    {"leaveUnion",1,"byte"},          -- 是否退出过公会
}


CG_UNION_FIND = {
    {"val",1,"string"},            --公会查找
}
-- 公会推荐和查找公用同一条协议
GC_UNION_RECOMMEND = {
    {"type",1,"byte"},              -- 消息类型，1推荐，2查询,3创建
    {"unionMsg",10,UnionMsg},       -- 公会信息
}


-- 加入公会
CG_UNION_APPLY_JOIN = {
    {"unionUuid",1,"string"},              --申请加入公会
}
GC_UNION_APPLY_JOIN = {
    {"unionUuid",1,"string"},       
}

CG_UNION_CANCEL_APPLY = {
    {"unionUuid",1,"string"},       
}
-- 同意或拒绝加入公会
CG_UNION_AGREE_JOIN = {
    {"uuid",1,"string"},                --玩家ID
    {"unionUuid",1,"string"},           --公会ID xxxxx
    {"flag",1,"byte"},                  --同意与否标识，0不同意，1同意
}

GC_UNION_AGREE_JOIN_UPDATE_MEMBER = {
    {"unionMember",30,UnionMember},      -- 公会成员
}

-- 成员主动离开
CG_UNION_LEAVE = {}
GC_UNION_LEAVE = {}

-- 成员管理
CG_UNION_MEMBER_MAN = {
    {"type",1,"byte"},          --操作类型，1，删除玩家，2设置官员 3 转让会长
    {"uuid",1,"string"},        --被操作人
}

-- 申请
CG_UNION_APPLY_MSG = {}
GC_UNION_APPLY_MSG = {
    {"applyMsg",30,UnionApplyMsg}
}

-- 查询公会改名相关
CG_UNION_CHANGE_NAME_QUERY = {}
GC_UNION_CHANGE_NAME_QUERY = {
    {"needCost",    1,      "int"},     -- 改名需要花费钻石
}

-- 修改公会名
CG_UNION_CHANGE_NAME = {
    {"name",1,"string"},            --新的公会名
}

-- 修改公会旗帜
CG_UNION_CHANGE_BANNERID = {
    {"bannerID",1,"byte"},            --新的公会旗帜
}

-- 修改工会信息
CG_UNION_CHANGE_MSG = {
    {"notice",1,"string"},            --公告
}
GC_UNION_CHANGE_MSG = {
    {"unionMsg",1,UnionMsg},          -- 公会信息 
}

-- 入会设置查询
CG_UNION_CHANGE_LIMIT_QUERY = {}
GC_UNION_CHANGE_LIMIT_QUERY = {
    {"needLv",   1,"short"},        --等级要求
    {"needAgree",1,"byte"},         --入会验证
}

-- 修改入会设置
CG_UNION_CHANGE_LIMIT = {
	{"needLv",	 1,"short"},        --等级要求
    {"needAgree",1,"byte"},         --入会验证
}

-- 获得日志信息
CG_UNION_GET_LOG = {
    {"type",1,"byte"},              -- 日志类型  0全部  1基础  2公会战  3公会boss  4公会捐赠 5其他
} 

GC_UNION_GET_LOG = {
    {"logMsg",50,UnionLogMsg},
}


-- 邮件
CG_UNION_MAIL = {
    {"content",1,"string"},         -- 邮件内容
} 
GC_UNION_MAIL = {
    {"flag",1,"byte"},              -- f是否发送成功
}

-- 招募查询
CG_UNION_RECRUIT_QUERY = {}
GC_UNION_RECRUIT_QUERY = {
    {"costValue",   1,     "int"},      -- 消耗钻石
}

-- 发布招募
CG_UNION_RECRUIT = {
    {"str",1,"string"},    
}


-- 给加入公会的成员返回公会信息
GC_UNION_MSG = {
    {"unionIdentity",1,"string"},
    {"unionUuid",	 1,"string"},
    {"unionName",	 1,"string"},   
    {"bannerID",	 1,"byte"},
}

-- 一键拒绝申请
CG_UNION_ONE_KEY_DISAGREE = {}

-- 弹劾会长
CG_UNION_IMPEACH_PRESIDENT = {}

-- 公会日志界面详情查询
CG_UNION_LOG_DETAIL_QUERY = {
    {"type",1,"byte"},   -- 日志类型  2公会战  3公会boss  4公会捐赠
}

GC_UNION_LOG_DETAIL_QUERY = {
    {"maxCnt",1,"byte"},                    -- 公会最大人数
    {"leftCnt",1,"byte"},                    -- 剩余人数
    {"memberDetail",30,UnionMember},        -- 日志详情
}

------------------------------------公会副本---------------------
UnionOneEctypeRankReward = {
    {"minRank", 1, "int"},
    {"maxRank", 1, "int"},
    {"reward",	2,ItemData},              --奖励
}
UnionOneEctypeRankList = {
    {"roleBase",1,RoleBase},
    {"damage",	1,"double"},             -- 造成伤害
    {"like",    1,  "int"},         -- 点赞数
    {"isLike",  1,  "byte"},        -- 是否点过赞  1 今日点过攒
    {"reward",	2,ItemData},        -- 奖励
    {"post",    1,  "byte"},        -- 职位
}

UnionOneEctypeMsg = {
    {"level",        1,  "int"},
    {"monsterName",         1,  "string"},
    {"body",         1,   "int"},
    {"rankList",30,UnionOneEctypeRankList},           --伤害排行榜
    {"bloodVolume",1,"double"},            --剩余血量
    {"allBlood",1,"double"},               --总血量
    {"comEff",1,"double"},                 --战斗力
    {"reward",2,ItemData},                 --一次挑战奖励
    {"killReward",   3,  ItemData},        -- 击杀奖励
    {"rankReward",10,UnionOneEctypeRankReward},       --排名奖励
}

UnionEctypeState ={
    {"level",   1,  "int"},            -- 副本 等级
    {"statu",1,"byte"},             -- 状态   0 死亡   1 正在打  2 还未解锁
--    {"freeTime",1,"int"},           -- 下次可以免费战斗剩余时间
    {"bossID",1,"int"},             -- 主Boss 头像id
    {"name",  1, "string"},
}

UnionEctypeBuff = {
    {"lv",      1,    "byte"},   --公会BUF 等级
    {"maxLv",   1,    "byte"},   --公会BUF 最大等级
    {"endTime", 1,    "int"},    --BUF 倒数计时 (秒)
    {"attr",    2,     Attr},    
    {"upNeed",  1,    "int"},    -- 升级BUF 所需要钻石
    {"nextAttr", 2,   Attr},
}

CG_UNION_ECTYPE_QUERY = {
}
GC_UNION_ECTYPE_QUERY = {
    {"isStart",     1,   "byte"},           --是否是开始
    {"isEnd",       1,    "byte"},          --是否结束发送  (俩个字段 防止 副本 不足50)    
    {"ectypeState",50,UnionEctypeState},          -- 副本状态 
}

-- 查询 关卡 副本
CG_UNION_ONE_ECTYPE_QUERY = {
     {"level",1,"int"},                -- 查询的关卡
}

GC_UNION_ONE_ECTYPE_QUERY = {
    {"ectypeMsg",1,UnionOneEctypeMsg},    -- 关卡信息
    {"needZuanShi",1,"int"},                -- 挑战需要钻石
    {"curCnt",    1,    "int"},             -- 剩余挑战次数
    {"curBuy",    1,   "int"},           -- 剩余购买次数
    {"praiseCnt", 1, "byte"},               -- 可赞次数
    {"jijieTime", 1, "int"},               -- 集结倒计时
    {"lastHurt",  1,  "double"},              -- 当日最近的一次伤害 (关卡不匹配为0)
    {"buffMsg", 1 ,UnionEctypeBuff},       -- 公会BUF 相关
}

GC_UNION_ECTYPE_REWARD ={
    {"result",1,"byte"},                -- 0:输了，1: 胜利
    {"hurt",1,"double"},                   -- 伤害
    {"reward",2,ItemData},              -- 奖励物品
    {"double",1,"byte"},
}

-- 升级或者激活 公会BUF
CG_UNION_UP_ECTYPE_BUFF = {
    {"level",1,"byte"},                -- 当时停留的页面
}

CG_UNION_ONE_ECTYPE_SAODANG = {
    {"level",    1,   "int"},
    {"touch",    1,   "byte"},
}

-- 公会副本伤害排行点赞
CG_UNION_ECTYPE_RANK_DO_LIKE = {
    {"level",       1,   "int"},
    {"uuid",        1,  "string"},
}

-- 公会副本集结
CG_UNION_ECTYPE_JIJIE = {
    {"level",       1,   "int"},
    {"str",       1,   "string"},
}

------------------------------------公会科技----------------------------

UnionTechnology = {
    {"lv",1,"byte"},                        -- 该科技的等级
    {"maxLV",  1,"byte"},                   -- 该科技最高等级
    {"canLvUp",1,"byte"},                   -- 是否能升级，1，可以升级，2，已经达到等级，3，不可升级
    {"tier",1,"byte"},                      -- 层级
    {"techMsgNext",2, Attr},              -- 升级后效果
    {"name",1,"string"},                    -- 科技名称
    {"lvUpNeed",2,ItemData},                -- 升级所需
    {"banner",   1,      "string"},         -- 科技图标
    {"techMsg",2, Attr},                  -- 当前效果
}

-- 公会科技
CG_UNION_TECHNOLOGY_QUERY = {
    {"occu",1,"byte"},                  -- 根据职业来查询，默认点击工会科技时，发送1，点击其他职业按钮是发送职业代号，1 战士，2 法师，3游侠，4刺客，5治疗
}

GC_UNION_TECHNOLOGY_QUERY = {
    {"techLv",    1,  "int"},
    {"technology",8,UnionTechnology},            -- 科技信息
    {"tRed",      6, "byte"},                    -- 红点信息 1 存在红点 0 不存在红点
}

-- 工会科技升级
CG_UNION_TECHNOLOGY_LV_UP = {
    {"occu",1,"byte"},                  -- 传入需要升级的科技类型
    {"tier",1,"byte"},                  -- 传入需要升级的科技层
}

-- 公会科技重置 查询
CG_UNION_TECHNOLOGY_RESET_QUERY = {
    {"occu",     1,   "byte"}           -- 要重置的科技类型
}

GC_UNION_TECHNOLOGY_RESET_QUERY = {
    {"zuanshiCnt",     1, "int"},
    {"item",           5, ItemData}
}

-- 公会科技重置
CG_UNION_TECHNOLOGY_RESET = {
    {"occu",1,"byte"},                  -- 重置职业科技
}

GC_UNION_TECHNOLOGY_RESET = {
    {"flag",1,"byte"},                  -- 重置是否成功
}

------------------------------------------------公会捐赠---------------------------
UnionDonate = {
    {"unionContr",1,ItemData},         -- 公会贡献
    {"unionExp",1,"int"},              -- 公会经验
    {"needCost",1,ItemData},           -- 捐赠花费
    {"type",1,"byte"},                 -- 捐赠类型
    {"state",1,"byte"},                -- 捐赠状态   0 已捐献  1 可捐献  2 ✔
}
DonateReward = {
    {"id",1,"byte"},                    -- 达标ID
    {"reward",5,ItemData},              -- 奖励
    {"needExp",1,"int"},                -- 达标经验
    {"state",1,"byte"},                 -- 状态  0 不可领  1 可领  2 已领
}

-- 公会捐赠
CG_UNION_DONATE_QUERY = {}

GC_UNION_DONATE_QUERY = {
    {"unionLv",1,"byte"},               -- 公会等级
    {"unionExp",1,"int"},               -- 公会经验
    {"lvUpExp",1,"int"},                -- 升级经验
    {"nextMemCnt",1,"byte"},            -- 下一级公会人数
    {"todayExp",1,"int"},               -- 今日已获取经验
    {"donate",3,UnionDonate},           -- 捐献
    {"reach",3,DonateReward},           -- 达标奖励
}

CG_UNION_DONATE_DO = {
    {"type",1,"byte"},                  -- 捐赠类型
}

CG_UNION_DONATE_REWARD_GET = {
    {"id",1,"byte"},            -- 领取ID
}

--------------------------公会活跃度任务
UnionLiveness = {
    {"taskID",1,"byte"},                -- 活跃度任务ID
    {"type",1,"byte"},                  -- 活跃度任务类型  1 日常 2 周常
    {"nowReach",1,"int"},               -- 当前达标次数
    {"need",1,"int"},                   -- 达标所需次数
    {"nowCnt",1,"int"},                 -- 当前完成总次数
    {"maxCnt",1,"byte"},                -- 最大完成次数
    {"liveness",1,"int"},               -- 活跃度
    {"pageID",1,"int"},                 -- 跳转页面
    {"status",1,"byte"},                -- 0 未完成  1 已完成
    {"name",    1,  "string"},          -- 任务名
    {"desc",    1,  "string"},          -- 任务描述
}

LivenessReward = {
    {"reward",5,ItemData},          -- 等级奖励
    {"lv",1,"byte"},                -- 第几级
    {"status",1,"byte"},            -- 0 不可领  1 可领
}

-- 公会活跃度任务查询
CG_UNION_LIVENESS_QUERY = {
}

GC_UNION_LIVENESS_QUERY = {
    {"lv",1,"byte"},                        -- 活跃等级
    {"maxLiveness",1,"int"},                -- 升级所需总活跃度
    {"nowLiveness",1,"int"},                -- 当前活跃度
    {"reward",1,LivenessReward},            -- 活跃等级奖励
    {"attr",5,Attr},                        -- 活跃等级属性
    {"nextAttr",5,Attr},                    -- 活跃等级下级属性
    {"unionLiveness",10,UnionLiveness},     -- 活跃度任务
    {"todayLiveness",1,"int"},              -- 今日活跃度
    {"weekLiveness",1,"int"},               -- 本周活跃度
}

-- 公会活跃度奖励预览
CG_UNION_LIVENESS_REWARD_QUERY = {
}

GC_UNION_LIVENESS_REWARD_QUERY = {
    {"reward",50,LivenessReward},            -- 活跃等级奖励
}

-- 公会活跃度等级奖励领取

CG_UNION_LIVENESS_REWARD_GET = {
    {"lv",1,"byte"},
}

------------------------ 公会红包 ----------------------------------------------
-- 公会红包查询
-- 发红包基础信息
RedBagInfo = {
    {"type",1,"byte"},                  -- 红包类型     
    {"index",1,"int"},                  -- 金额类型 
    {"name",1,"string"},                -- 红包名字
    {"reward",5,ItemData},              -- 发送者奖励
    {"item",2,ItemData},                -- 红包内容
    {"maxSendCnt",1,"byte"},            -- 单日最大发送次数
    {"bagCnt",1,"byte"},                -- 红包个数
    {"desc",1,"string"},                -- 红包寄语
    {"buttonTxt",1,"string"},           -- 红包按钮文本
    {"rewardTxt",1,"string"},           -- 红包奖励文本
    {"buyItem",1,BuyItem},              -- 红包发送buyItem
}

-- 红包记录
UnionRedBag = {
    {"id",1,"int"},                     -- 红包ID
    {"type",1,"byte"},                  -- 红包类型
    {"name",1,"string"},                -- 红包名字
    {"sender",1,RoleBase},              -- 发红包者角色信息
    {"senderPost",1,"byte"},            -- 发红包者职务
    {"statu",1,"byte"},                 -- 红包状态   1 可领取  2 已领取  3 已过期 4红包被领光
    {"bagCnt",1,"byte"},                -- 红包个数
    {"nowCnt",1,"byte"},                -- 已领个数
    {"time",1,"int"},                   -- 红包剩余时间
    {"desc",1,"string"},                -- 红包寄语
    {"item",2,ItemData},                -- 红包内容
}

GetRedBagList = {
    {"role",1,RoleBase},                -- 角色信息
    {"time",1,"int"},                   -- 抢到红包的时间
    {"item",1,ItemData},                -- 抢到的物品
}

RedBagBillboard = {
    {"role",1,RoleBase},                -- 玩家
    {"totalMoney",1,"int"},             -- 红包价值总额（真钱）
    {"bagCnt",1,"int"},                 -- 红包个数
    {"post",1,"byte"},                  -- 职位
}

CG_UNION_RED_BAG_QUERY = {}

GC_UNION_RED_BAG_QUERY = {
    {"redBagList",50,UnionRedBag},              -- 红包列表
}

-- 单个红包查询
CG_UNION_SINGLE_RED_BAG_QUERY = {
    {"id",1,"int"},                             -- 红包ID
}

GC_UNION_SINGLE_RED_BAG_QUERY = {
    {"getRedBagList",20,GetRedBagList},         -- 抢红包记录
}

-- 发红包
CG_UNION_SEND_RED_BAG_QUERY = {
}

GC_UNION_SEND_RED_BAG_QUERY = {
    {"redBag",6,RedBagInfo},                    -- 红包        
}
-- 抢红包
CG_UNION_GET_RED_BAG = {
    {"id",1,"int"},                             -- 红包ID
}
-- 红包榜
CG_UNION_RED_BAG_BILLBOARD = {}

GC_UNION_RED_BAG_BILLBOARD = {
    {"redBagRank",50,RedBagBillboard},          -- 红包排行榜
}


-------------------------------------------- 公会战 start ------------------------------------------
-- 公会战 查询 玩家
CG_UNION_WAR_QUERY = {}

UnionWarMemberNet = {
    {"index",    1,  "short"},--位置
    {"uuid",    1,  "string"},--成员uuid
    {"name",    1,  "string"},--成员名字
    {"star",    1,  "byte"},--挑战可获得星数
    {"zhandouli",    1,  "double"},--战斗力
    {"rank",    1,  "short"},--排名，0为未上榜
    {"x",    1,  "int"},
    {"y",    1,  "int"},
}

UnionWarRankNet = {
    {"uuid",    1,  "string"},
    {"rank",    1,  "short"},
    {"roleBase",1,RoleBase},
    {"job",     1,  "byte"},
    {"items",   5,  ItemData},
    {"jifen",    1,  "short"},
    {"star",     1,  "int"},
}

UnionWarThreeRankNet = {
    {"name",    1,  "string"},
    {"rank",    1,  "short"},
}

UnionWarTeamNet = {
    {"unionUuid",    1,  "string"},--公会uuid
    {"name",    1,  "string"},--公会名
    {"bannerID",    1,   "byte"},--公会旗帜ID
    {"star",    1,  "short"},--公会获得总星数
    {"svrName",  1,  "string"}, -- 公会所在服务器名
    {"list",    30, UnionWarMemberNet}--公会成员
}
GC_UNION_WAR_QUERY = {
    {"attacker",    1,  UnionWarTeamNet},--挑战方公会信息
    {"defender",    1,  UnionWarTeamNet},--被挑战方公会信息
    {"threeRank",    3,   UnionWarThreeRankNet}, -- 我方战绩前3名
    {"leftTime",    1,  "int"},--剩余时间
    {"cnt",         1,  "short"},
    {"maxCnt",         1,  "short"},
}

-- 公会 废墟BUF 
CG_UNION_WAR_BUFF = {
}

GC_UNION_WAR_BUFF = {
    {"buffLv",      1,   "int"},        -- 公会战BUF 等级
    {"maxBuff",     1,   "int"},        -- 公会战BUF 最大等级
    {"nowAttr",     5,   Attr},
    {"nextAttr",    5,   Attr},
}

CG_UNION_WAR_END_STATE_QUERY = {
}

GC_UNION_WAR_END_STATE_QUERY = {
    {"winState",      1,  "byte"},   -- 0 默认   1 我赢了  2  我输了
}
-- 公会战 状态
GC_UNION_WAR_STATE = {
    {"actState",     1,   "byte"}, --活动状态 0 非活动阶段 1 确认 2 匹配 3 战斗 4 结算
    {"unionState",     1,   "byte"}, --公会状态 1 匹配成功 2 确认不成功 3 匹配不成功  4 我未参战
    {"winState",      1,  "byte"},   -- 0 默认   1 我赢了  2  我输了
    {"cjDot",        1,  "byte"},   -- 成就 红点
    {"zgDot",        1,   "byte"},  -- 战果红点
    {"shopDot",      1,   "byte"},  -- 公会商店红点
    {"fightDot",     1,  "byte"}, -- 战斗次数红点
    {"pipeiDot",     1,  "byte"},  -- 匹配红点
}

-- 单独更新 公会战 主板子上的红点  (目的 不用请求中心服 得到返回)
GC_UNION_WAR_RED = {
    {"cjDot",        1,  "byte"},   -- 成就 红点
    {"zgDot",        1,   "byte"},  -- 战果红点
    {"shopDot",      1,   "byte"},  -- 公会商店红点
    {"fightDot",     1,  "byte"}, -- 战斗次数红点
    {"pipeiDot",     1,  "byte"},  -- 匹配红点
}

CG_UNION_WAR_TIME = {}
GC_UNION_WAR_TIME = {
    {"actState",     1,   "byte"}, --活动状态 0 非活动阶段 1 确认 2 匹配 3 战斗 4 结算
    {"time",         1 , "int"},
}

-- 请求 具体玩家 信息
CG_UNION_WAR_INFO = {
    {"unionUuid",            1,  "string"},--玩家所在公会id
    {"uuid",            1,  "string"},--玩家uuid
}

UnionWarDiff = {
    {"diff",      1,   "int"},--难度
    {"rate",      1,   "int"},--属性比例
    {"star",      1,   "byte"},--星数
    {"jifen",    1,   "int"},--战绩
    {"item",      5,  ItemData},        -- 胜利获得
}

GC_UNION_WAR_INFO = {
    {"unionUuid",            1,  "string"},--玩家所在公会id
    {"uuid",            1,  "string"},
    {"index",           1,  "short"},     -- index
    {"isRobot",     1,   "byte"},       -- 是否是机器人
    {"star",        1,   "byte"},       -- 剩余星级
    {"defendCnt",      1,   "int"},     -- 防守成功次数
    {"zhandouli",      1,   "double"},  -- 战斗力
    {"list",        6,  HeroSimple},    -- 战斗阵容
    {"diffList",      3,  UnionWarDiff},-- 难度列表
    {"cnt",       1,   "byte"},         -- 玩家 剩余挑战次数
    {"maxCnt",       1,   "byte"},      -- 玩家最大挑战次数
    {"canFight",    1,   "int"},        -- 1可以挑战 2 次数不足 3重复挑战 4对手被挑战中 5星数不足
    {"feixuCnt",    1,  "byte"},        -- 废墟被挑战次数
}

-- 请求 对战列表
CG_UNION_WAR_MATCH = {}

UnionWarMatchNet = {
   {"nameLeft",            1,  "string"}, 
   {"rankLeft",            1,  "short"},
   {"nameRight",            1,  "string"}, 
   {"rankRight",            1,  "short"},
   {"svrNameLeft",         1,   "string"},
   {"svrNameRight",         1,  "string"},
}

GC_UNION_WAR_MATCH = {
    {"list",    60, UnionWarMatchNet}--公会成员    
}

-- 公会战  挑战结束
GC_UNION_WAR_FIGHT_END = {
    {"unionStar",     1,   "byte"},--挑战后攻方公会的星数
    {"defendStar",     1,   "byte"},--挑战后防守用户的分数
    {"defendUuid",     1,   "string"},--防守用户uuid
    {"defIndex",       1,   "short"},
    {"cnt",     1,   "byte"},--挑战后攻方用户已挑战次数
    {"diff",     1,   "byte"},
    {"threeRank",    3,   UnionWarThreeRankNet}, -- 我方战绩前3名
}

-- 请求我的公会 进攻日志
CG_UNION_WAR_ATKLOG = {
    {"type",       1,   "byte"}, -- 0 所有  1 个人
}

--ret = 1 时间，xxxx在攻占了敌方据点，获得了x星以及xx积分
--ret = 2 时间，xxxx挑战了废墟据点，获得xx积分
--ret = 3 时间，时间，xxxx挑战了废墟据点，获得xx积分
--ret = 4 时间，时间，xxxx所在的据点被攻下3星
UnionWarAtkLogNet = {
    {"upTime",    1,  "int"},
    {"ret",     1,  "byte"},
    {"name",    1,  "string"},
    {"defName", 1,   "string"},
    {"star",    1,  "byte"},
    {"jifen",   1,  "short"},
    {"unionUuid", 1,  "string"},
    {"buffLv",   1,  "byte"},
    {"atkUnionStar", 1, "int"},
}

GC_UNION_WAR_ATKLOG = {
    {"list",    100,    UnionWarAtkLogNet},
    {"type",       1,   "byte"}, 
}

-- 请求 具体玩家的防守日志
CG_UNION_WAR_DEFLOG = {
    {"uuid",    1,      "string"},
    {"unionUuid", 1,    "string"},
}

UnionWarDefLogNet = {
    {"id",    1,    "int"},
    {"name",    1,  "string"},
    {"zhandouli",   1,  "double"},
    {"diff",    1,  "byte"},          -- 挑战难度
    {"result",    1,  "byte"},         -- 战果
    {"time",      1,   "int"},         -- 发生时间
    {"formation", 1,   "string"},        -- 进攻方 阵容
    {"videoIndex",  1,  "string"},     -- 录像下标
    {"list",        6,  HeroSimple},    -- 战斗阵容
}

-- 公会战  实况 更新
GC_UNION_WAR_SCENE_INFO = {
    {"unionUuid",         1,   "string"},   -- 挑战者的公会UUID
    {"unionStar",     1,   "byte"},--挑战后攻方公会的星数
    {"targetUnion",       1,  "string"},    -- 被挑战的公会UUID
    {"defendUuid",     1,   "string"},--防守用户uuid
    {"defendStar",     1,   "byte"},--挑战后防守用户的星级
    {"defIndex",       1,   "short"},
    {"threeRank",    3,   UnionWarThreeRankNet}, -- 我方战绩前3名
}



GC_UNION_WAR_DEFLOG = {
    {"zhandouli",   1,  "double"},    -- 战斗力
    {"heroList",        6,  HeroSimple},    -- 防守阵容
    {"logList",    3,  UnionWarDefLogNet},--防守记录
}

--  查看 公会战 日志 战斗回放
CG_UNION_WAR_VIDEO = {
    {"defendUuid",  1,    "string"},
    {"videoIndex",  1,  "string"},     -- 录像
}

-- 查询公会战荣耀宝箱
CG_UNION_WAR_BOX = {}

UnionWarBoxNet = {
    {"isOpen",  1,  "byte"},--1 已开 2 未开
    {"item",    2, ItemData},
    {"name",    1, "string"},
}
GC_UNION_WAR_BOX = {
    {"isWin",    1,  "byte"},--1 胜者 2 败者
    {"leftTime",    1,  "int"},
    {"list",   30,  UnionWarBoxNet},
}

-- 打开荣耀宝箱
CG_UNION_WAR_BOX_GET = {
    {"ind",         1,  "short"},
}
GC_UNION_WAR_BOX_GET = {
    {"ind",         1,  "short"},
    {"box",        1, UnionWarBoxNet},
}

-- 查询 公会战成就
CG_UNION_WAR_CHENGJIU = {
    {"type",         1,  "short"},      -- 1 个人成就   2  公会成就
}

UnionWarChengjiuNet = {
    {"id",         1,  "short"},
    {"title",       1,  "string"},  
    {"state",       1,  "byte"},-- 0 不可领取 1 可以领取 2 已经领取
    {"cnt",         1,  "short"},
    {"maxCnt",         1,  "short"},
    {"item",           6, ItemData},
}

GC_UNION_WAR_CHENGJIU = {
    {"type",         1,  "short"},  -- 1 个人成就 22  2  公会成就           
    {"list",        60,  UnionWarChengjiuNet},  
}

-- 领取公会战成就奖励
CG_UNION_WAR_CHENGJIU_GET = {
    {"type",         1,  "short"},
    {"id",         1,  "short"},
}

GC_UNION_WAR_CHENGJIU_GET = {
    {"type",         1,  "short"},
    {"id",         1,  "short"},
}

-- 公会战 商店查询
CG_UNION_WAR_SHOP_QUERY = {
    {"type",         1,  "short"},
}

UnionWarShopNet  = {
    {"id",          1,    "byte"},       -- 商品id
    {"cnt",            1,    "int"},        -- 已购买数量
    {"maxCnt",         1,    "int"},        -- 限购数量
    {"needLv",         1,    "int"},        -- 需要等级
    {"item",           1,    ItemData},     -- 商品道具 
    {"cost",           1,    "int"},
    {"discount",       1,    "int"},
}

GC_UNION_WAR_SHOP_QUERY = {
    {"type",         1,  "short"},
    {"shopLv",         1,    "int"},
    {"exp",            1,    "int"},
    {"maxExp",         1,    "int"},
    {"list",          30,  UnionWarShopNet},
}

-- 公会战商店购买
CG_UNION_WAR_SHOP_BUY = {
    {"type",         1,  "short"},
    {"id",          1,    "byte"}, 
    {"cnt",         1,  "short"},
}

GC_UNION_WAR_SHOP_BUY = {
    {"type",         1,  "short"},
    {"id",          1,    "byte"}, 
    {"cnt",            1,    "int"}, 
}

-- 查询 公会战 战绩排名
CG_UNION_WAR_RANK = {
}

GC_UNION_WAR_RANK = {
    {"list",    30, UnionWarRankNet}
}

-- 公会战 战绩排名奖励展示
CG_UNION_WAR_RANK_REWARD = {
}

UnionWarRankRewardNet = {
    {"id",          1,   "byte"},
    {"minRank",     1,   "int"},
    {"maxRank",     1,   "int"},
    {"items",       5,  ItemData},
}
GC_UNION_WAR_RANK_REWARD = {
    {"list",        6,  UnionWarRankRewardNet},
}
--------------------------------------------new end----------------------------------

