|
|
@@ -1,33 +1,39 @@
|
|
|
-local Msg = require("core.Msg")
|
|
|
-local Broadcast = require("broadcast.Broadcast")
|
|
|
-local Lang = require("common.Lang")
|
|
|
-local Grid = require("bag.Grid")
|
|
|
-local MergeRule = require("excel.mergeConfig").rule
|
|
|
-local BagLogic = require("bag.BagLogic")
|
|
|
-local Log = require("common.Log")
|
|
|
-local Util = require("common.Util")
|
|
|
-local ItemLogic = require("bag.ItemLogic")
|
|
|
-local HeroLogic = require("hero.HeroLogic")
|
|
|
-local HeroExcel = require("excel.hero")
|
|
|
-local RoleDefine = require("role.RoleDefine")
|
|
|
-local ObjHuman = require("core.ObjHuman")
|
|
|
-local HeroGrid = require("hero.HeroGrid")
|
|
|
-local Json = require("common.Json")
|
|
|
-local FenjieLogic = require("hecheng.FenjieLogic")
|
|
|
-local HeroBook = require("hero.HeroBook")
|
|
|
-local FuwenLogic = require("fuwen.FuwenLogic")
|
|
|
-local HeroEquip = require("hero.HeroEquip")
|
|
|
-
|
|
|
-AD_DRAW_REWARD_TYPE = 10 --观看广告领取召唤券
|
|
|
-QUERY_MERGE_INFO_TYPE = 11 --获取融合信息
|
|
|
-HATCH_SCCUESS_TYPE = 12 -- 孵化成功
|
|
|
-MERGE_HERO_TYPE = 13 --融合
|
|
|
-QUICK_HATCH_TYPE = 14 --加速
|
|
|
+local Msg = require("core.Msg")
|
|
|
+local Broadcast = require("broadcast.Broadcast")
|
|
|
+local Lang = require("common.Lang")
|
|
|
+local Grid = require("bag.Grid")
|
|
|
+local MergeRule = require("excel.mergeConfig").rule
|
|
|
+local BagLogic = require("bag.BagLogic")
|
|
|
+local Log = require("common.Log")
|
|
|
+local Util = require("common.Util")
|
|
|
+local ItemLogic = require("bag.ItemLogic")
|
|
|
+local HeroLogic = require("hero.HeroLogic")
|
|
|
+local HeroExcel = require("excel.hero")
|
|
|
+local RoleDefine = require("role.RoleDefine")
|
|
|
+local ObjHuman = require("core.ObjHuman")
|
|
|
+local HeroGrid = require("hero.HeroGrid")
|
|
|
+local Json = require("common.Json")
|
|
|
+local FenjieLogic = require("hecheng.FenjieLogic")
|
|
|
+local HeroBook = require("hero.HeroBook")
|
|
|
+local FuwenLogic = require("fuwen.FuwenLogic")
|
|
|
+local HeroEquip = require("hero.HeroEquip")
|
|
|
+local PaomaExcel = require("excel.paoma")
|
|
|
+local HeroDefine = require("hero.HeroDefine")
|
|
|
+local SkinLogic = require("skin.SkinLogic")
|
|
|
+local XingYaoGongMing = require("xingYaoMen.XingYaoGongMing")
|
|
|
+local SkillExcel = require("excel.skill")
|
|
|
+local BufferExcel = require("excel.buffer")
|
|
|
+
|
|
|
+AD_DRAW_REWARD_TYPE = 10 --观看广告领取召唤券
|
|
|
+QUERY_MERGE_INFO_TYPE = 11 --获取融合信息
|
|
|
+HATCH_SCCUESS_TYPE = 12 -- 孵化成功
|
|
|
+MERGE_HERO_TYPE = 13 --融合
|
|
|
+QUICK_HATCH_TYPE = 14 --加速
|
|
|
QUERY_MERGE_BEFORE_INFO_TYPE = 15 --获取融合前信息
|
|
|
-GET_MERGE_HERO_TYPE = 16 --获取融合英雄
|
|
|
-QUERY_QUICK_HATCH_ZUANSHI = 17 --查询加速孵化需要的钻石
|
|
|
+GET_MERGE_HERO_TYPE = 16 --获取融合英雄
|
|
|
+QUERY_QUICK_HATCH_ZUANSHI = 17 --查询加速孵化需要的钻石
|
|
|
|
|
|
-AD_HATCH_RESET_FREECNT = 4 --看广告加速孵化次数
|
|
|
+AD_HATCH_RESET_FREECNT = 4 --看广告加速孵化次数
|
|
|
|
|
|
function NewProto(human, type, param)
|
|
|
-- print("newProto:",type,param)
|
|
|
@@ -59,7 +65,6 @@ function NewProto(human, type, param)
|
|
|
msgRet.tip = Lang.AD_DRAW_REWARD_SUCCESS
|
|
|
Msg.send(msgRet, human.fd)
|
|
|
|
|
|
- Broadcast.sendErr(human, Lang.AD_DRAW_REWARD_SUCCESS)
|
|
|
return
|
|
|
end
|
|
|
|
|
|
@@ -97,6 +102,7 @@ function NewProto(human, type, param)
|
|
|
|
|
|
local fatherHeroGrid = human.db.heroBag[fatherHeroBagIndex]
|
|
|
if not fatherHeroGrid then
|
|
|
+ Log.write(Log.LOGID_TEST, "查询融合前的 fatherHeroGrid: 不存在下标:" .. fatherHeroBagIndex)
|
|
|
return
|
|
|
end
|
|
|
|
|
|
@@ -104,6 +110,7 @@ function NewProto(human, type, param)
|
|
|
|
|
|
local motherHeroGrid = human.db.heroBag[motherHeroBagIndex]
|
|
|
if not motherHeroGrid then
|
|
|
+ Log.write(Log.LOGID_TEST, "查询融合前的 motherHeroGrid: 不存在下标:" .. motherHeroBagIndex)
|
|
|
return
|
|
|
end
|
|
|
|
|
|
@@ -331,99 +338,8 @@ function NewProto(human, type, param)
|
|
|
local heroIndex = 0
|
|
|
local msgTyep = GET_MERGE_HERO_TYPE
|
|
|
local cf = sonHeroID and HeroExcel.hero[sonHeroID]
|
|
|
- local heroNiceNet = {
|
|
|
- itemData = {},
|
|
|
- heroStatic = {
|
|
|
- [1] = {
|
|
|
- skillList = {
|
|
|
- [1] = {
|
|
|
- cd = {
|
|
|
- [1] = {},
|
|
|
- [2] = {}
|
|
|
- },
|
|
|
- buff = {
|
|
|
- [1] = {},
|
|
|
- [2] = {},
|
|
|
- [3] = {},
|
|
|
- [4] = {},
|
|
|
- [5] = {},
|
|
|
- }
|
|
|
- },
|
|
|
- [2] = {
|
|
|
- cd = {
|
|
|
- [1] = {},
|
|
|
- [2] = {}
|
|
|
- },
|
|
|
- buff = {
|
|
|
- [1] = {},
|
|
|
- [2] = {},
|
|
|
- [3] = {},
|
|
|
- [4] = {},
|
|
|
- [5] = {},
|
|
|
- }
|
|
|
- },
|
|
|
- },
|
|
|
- beSkill = {
|
|
|
- [1] = {
|
|
|
- cd = {
|
|
|
- [1] = {},
|
|
|
- [2] = {}
|
|
|
- },
|
|
|
- buff = {
|
|
|
- [1] = {},
|
|
|
- [2] = {},
|
|
|
- [3] = {},
|
|
|
- [4] = {},
|
|
|
- [5] = {},
|
|
|
- }
|
|
|
- },
|
|
|
- [2] = {
|
|
|
- cd = {
|
|
|
- [1] = {},
|
|
|
- [2] = {}
|
|
|
- },
|
|
|
- buff = {
|
|
|
- [1] = {},
|
|
|
- [2] = {},
|
|
|
- [3] = {},
|
|
|
- [4] = {},
|
|
|
- [5] = {},
|
|
|
- }
|
|
|
- },
|
|
|
- [3] = {
|
|
|
- cd = {
|
|
|
- [1] = {},
|
|
|
- [2] = {}
|
|
|
- },
|
|
|
- buff = {
|
|
|
- [1] = {},
|
|
|
- [2] = {},
|
|
|
- [3] = {},
|
|
|
- [4] = {},
|
|
|
- [5] = {},
|
|
|
- }
|
|
|
- },
|
|
|
- }
|
|
|
- },
|
|
|
- },
|
|
|
- heroSimple = {
|
|
|
- [1] = {
|
|
|
- general = {}
|
|
|
- },
|
|
|
- },
|
|
|
- attrs = {
|
|
|
- [1] = {},
|
|
|
- [2] = {},
|
|
|
- [3] = {},
|
|
|
- [4] = {},
|
|
|
- },
|
|
|
- attrsMax = {
|
|
|
- [1] = {},
|
|
|
- [2] = {},
|
|
|
- [3] = {},
|
|
|
- [4] = {},
|
|
|
- }
|
|
|
- }
|
|
|
+ local heroNiceNet = {}
|
|
|
+
|
|
|
if hatchTime <= 0 then
|
|
|
-- 孵化成功
|
|
|
hatchTime = 0
|
|
|
@@ -435,7 +351,7 @@ function NewProto(human, type, param)
|
|
|
|
|
|
local heroID = heroGrid.id or 0
|
|
|
local isNew = not HeroBook.isGet(human, cf.id, cf.star)
|
|
|
- HeroGrid.makeHeroNiceToJson(heroNiceNet, heroID, nil, isNew, heroIndex)
|
|
|
+ makeHeroNice(heroNiceNet, heroID, nil, isNew, heroIndex)
|
|
|
else
|
|
|
heroSimple.name = cf and cf.name or ""
|
|
|
if cf.grade >= 6 then
|
|
|
@@ -696,3 +612,203 @@ function getTodayIsTip(human)
|
|
|
local isTip = human.db.isTip or 1
|
|
|
return tonumber(isTip)
|
|
|
end
|
|
|
+
|
|
|
+-- 封装客户端需要的json格式
|
|
|
+function makeHeroNice(net, id, cnt, isNew, index)
|
|
|
+ net.heroSimple = net.heroSimple or {}
|
|
|
+ net.itemData = net.itemData or {}
|
|
|
+ net.heroStatic = net.heroStatic or {}
|
|
|
+ net.attrs = net.attrs or {}
|
|
|
+ net.attrsMax = net.attrsMax or {}
|
|
|
+
|
|
|
+ if cnt then
|
|
|
+ net.itemData[1] = net.itemData[1] or {}
|
|
|
+ Grid.makeItem(net.itemData[1], id, cnt)
|
|
|
+ end
|
|
|
+ local heroConfig = HeroExcel.hero[id]
|
|
|
+ local specialConfig = HeroExcel.specialHero[id]
|
|
|
+ if heroConfig then
|
|
|
+ net.heroSimple[1] = net.heroSimple[1] or {}
|
|
|
+ net.heroStatic[1] = net.heroStatic[1] or {}
|
|
|
+ makeHeroSimpleByID(net.heroSimple[1], id, index)
|
|
|
+ makeHeroStatic(net.heroStatic[1], id)
|
|
|
+ end
|
|
|
+
|
|
|
+ net.body = specialConfig and (heroConfig and heroConfig.body or 0) or 0
|
|
|
+ net.isNew = isNew and 1 or 0
|
|
|
+ net.weightLv = heroConfig and heroConfig.grade or 0
|
|
|
+
|
|
|
+ net.bubble = ""
|
|
|
+ local attrsNum = 0
|
|
|
+ local attrsMaxNum = 0
|
|
|
+ if heroConfig then
|
|
|
+ local bubble = PaomaExcel.bubble[heroConfig.id]
|
|
|
+ net.bubble = bubble and bubble.drawCard or ""
|
|
|
+ local heroGrid = HeroGrid.getCacheHeroGridTujian(id)
|
|
|
+ for key = RoleDefine.ATK, RoleDefine.SPEED do
|
|
|
+ local value = heroGrid.attrs[key]
|
|
|
+ attrsNum = attrsNum + 1
|
|
|
+ net.attrs[attrsNum] = net.attrs[attrsNum] or {}
|
|
|
+ net.attrs[attrsNum].key = key
|
|
|
+ net.attrs[attrsNum].value = value
|
|
|
+
|
|
|
+ attrsMaxNum = attrsMaxNum + 1
|
|
|
+ net.attrsMax[attrsMaxNum] = net.attrs[attrsMaxNum] or {}
|
|
|
+ net.attrsMax[attrsMaxNum].key = key
|
|
|
+ net.attrsMax[attrsMaxNum].value = HeroDefine.getTujianMaxValue(key)
|
|
|
+ end
|
|
|
+ end
|
|
|
+end
|
|
|
+
|
|
|
+-- 根据英雄id封装英雄信息heroSimple 额外处理
|
|
|
+function makeHeroSimpleByID(net, id, index, others, human, tujian)
|
|
|
+ local star = others and others.star or nil
|
|
|
+ local grid = HeroGrid.getCacheHeroGrid(id, star, others)
|
|
|
+ makeHeroSimple(net, grid, index, human, others, tujian)
|
|
|
+end
|
|
|
+
|
|
|
+-- 填充英雄详细信息:静态 额外格式
|
|
|
+function makeHeroStatic(net, id, tuJian)
|
|
|
+ net.skillList = net.skillList or {}
|
|
|
+ net.beSkill = net.beSkill or {}
|
|
|
+
|
|
|
+ local cf = id and HeroExcel.hero[id]
|
|
|
+ if not cf then
|
|
|
+ net.id = 0
|
|
|
+ net.name = ""
|
|
|
+ net.body = 0
|
|
|
+ net.job = 0
|
|
|
+ net.weightLv = 0
|
|
|
+ net.normalAtkID = 0
|
|
|
+ net.skillList[0] = 0
|
|
|
+ net.beSkill[0] = 0
|
|
|
+ net.skin = 0
|
|
|
+ return
|
|
|
+ end
|
|
|
+
|
|
|
+ local star = cf.star
|
|
|
+ if tuJian and tuJian == 1 then
|
|
|
+ local tuJianConfig = HeroExcel.tujian[id]
|
|
|
+ if tuJianConfig then
|
|
|
+ local maxStarIndex = #tuJianConfig.star
|
|
|
+ star = tuJianConfig.star[maxStarIndex]
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ net.id = id
|
|
|
+ net.name = cf.name
|
|
|
+ net.body = cf.body
|
|
|
+ net.job = cf.job
|
|
|
+ net.weightLv = cf.grade
|
|
|
+
|
|
|
+ local attrConfig = HeroDefine.getAttrConfig(id, star)
|
|
|
+ net.normalAtkID = attrConfig.normalAtkID
|
|
|
+
|
|
|
+ for i = 1, #attrConfig.skillList do
|
|
|
+ net.skillList[i] = net.skillList[i] or {}
|
|
|
+ makeSkillNet(net.skillList[i], attrConfig.skillList[i])
|
|
|
+ end
|
|
|
+
|
|
|
+ for i = 1, #attrConfig.beSkillList do
|
|
|
+ net.beSkill[i] = net.beSkill[i] or {}
|
|
|
+ makeSkillNet(net.beSkill[i], attrConfig.beSkillList[i])
|
|
|
+ end
|
|
|
+ net.skin = #cf.skin > 0 and 1 or 0
|
|
|
+end
|
|
|
+
|
|
|
+-- 封装英雄信息 额外处理
|
|
|
+function makeHeroSimple(net, grid, index, human, others, tuJian)
|
|
|
+ local id = grid and (grid.id or grid.heroID)
|
|
|
+ local cf = id and HeroExcel.hero[id]
|
|
|
+ local star = grid and grid.star or (cf and cf.star or 1)
|
|
|
+ local upStarConfig = HeroDefine.getNextAttrConfig(id, star)
|
|
|
+ local jobConfig = cf and cf.job and HeroExcel.job[cf.job]
|
|
|
+ local isGongMing = XingYaoGongMing.isGongMing(human, index)
|
|
|
+
|
|
|
+ net.id = id or 0
|
|
|
+ net.index = index or 0
|
|
|
+ net.uuid = grid and grid.uuid or ""
|
|
|
+ net.gl = cf and cf.gl or 0
|
|
|
+ net.camp = cf and cf.camp or 0
|
|
|
+ net.job = cf and cf.job or 0
|
|
|
+ net.star = others and others.star or star --cf and cf.star or 0 星级调整 dxzeng
|
|
|
+ net.icon = grid and grid.head or (cf and cf.head or 0)
|
|
|
+ net.body = grid and grid.body or (cf and cf.body or 0)
|
|
|
+ if grid and human and index then -- todo 皮肤这个以后可能还是需要继续整理
|
|
|
+ local skinConf = SkinLogic.getHeroSkin(human, index)
|
|
|
+ if skinConf then
|
|
|
+ net.icon = skinConf.head
|
|
|
+ net.body = skinConf.body
|
|
|
+ end
|
|
|
+ end
|
|
|
+ net.up = upStarConfig == nil and 0 or 1 --是否能够升星
|
|
|
+
|
|
|
+ net.lv = others and others.lv or (grid and grid.lv or 1)
|
|
|
+ net.xLv = others and others.xLv or (grid and grid.xLv or 0)
|
|
|
+ net.zhandouli = grid and grid.zhandouli or 0
|
|
|
+ net.quality = grid and grid.quality or 0
|
|
|
+ net.isLock = (grid and grid.isLock) and 1 or 0
|
|
|
+ net.hp = others and others.hp or 0
|
|
|
+ net.hpMax = others and others.hpMax or 0
|
|
|
+ net.cnt = others and others.cnt or 1
|
|
|
+ net.isget = HeroBook.isGetHero(human, id) or 0
|
|
|
+ net.weightLv = cf and cf.grade or 0
|
|
|
+ net.name = cf and cf.name or ""
|
|
|
+ net.grade = cf and cf.grade or 0
|
|
|
+ net.jobDesc = jobConfig and jobConfig.desc or ""
|
|
|
+ net.label = cf and cf.label or ""
|
|
|
+ net.order = cf and cf.order or 0
|
|
|
+ net.isGongMing = isGongMing or 0
|
|
|
+ net.general = net.general or {}
|
|
|
+
|
|
|
+ --是否发送图鉴信息
|
|
|
+ if tuJian then
|
|
|
+ local tj = HeroExcel.tujian[id]
|
|
|
+ if tj ~= nil then
|
|
|
+ net.general[1] = net.general[1] or {}
|
|
|
+ net.general[1].cm = tj.cm or 0
|
|
|
+ net.general[1].kg = tj.kg or 0
|
|
|
+ net.general[1].age = tj.age or 0
|
|
|
+ net.general[1].cup = tj.cup or ""
|
|
|
+ net.general[1].character = tj.character or ""
|
|
|
+ net.general[1].interest = tj.interest or ""
|
|
|
+ net.general[1].desc = tj.desc or ""
|
|
|
+ end
|
|
|
+ end
|
|
|
+end
|
|
|
+
|
|
|
+-- 获取技能信息
|
|
|
+function makeSkillNet(net, id)
|
|
|
+ local skillConfig = SkillExcel.skill[id]
|
|
|
+ if not skillConfig then return end
|
|
|
+ net.id = id
|
|
|
+ net.icon = skillConfig.icon
|
|
|
+ net.name = skillConfig.name
|
|
|
+ net.type = skillConfig.type
|
|
|
+ net.desc = skillConfig.desc
|
|
|
+ net.need = skillConfig.need or 0
|
|
|
+ net.lv = skillConfig.skillLv or 0
|
|
|
+ -- todo
|
|
|
+
|
|
|
+ net.cd = net.cd or {}
|
|
|
+ net.buff = net.buff or {}
|
|
|
+
|
|
|
+ if #skillConfig.cd ~= 0 then
|
|
|
+ net.cd[1] = net.cd[1] or {}
|
|
|
+ net.cd[2] = net.cd[2] or {}
|
|
|
+ net.cd[1] = skillConfig.cd[1]
|
|
|
+ net.cd[2] = skillConfig.cd[2]
|
|
|
+ end
|
|
|
+
|
|
|
+ local len = #skillConfig.buffers
|
|
|
+ for i = 1, len do
|
|
|
+ local buffId = skillConfig.buffers[i][1]
|
|
|
+ local buffConfig = BufferExcel.buffer[buffId]
|
|
|
+ net.buff[i] = net.buff[i] or {}
|
|
|
+ net.buff[i].id = buffId
|
|
|
+ net.buff[i].name = buffConfig.name
|
|
|
+ net.buff[i].desc = buffConfig.desc
|
|
|
+ end
|
|
|
+ net.lvUpDesc = skillConfig.lvUpDesc
|
|
|
+ -- todo
|
|
|
+end
|