zhanwencai 1 سال پیش
والد
کامیت
0a7fe33861
4فایلهای تغییر یافته به همراه301 افزوده شده و 20 حذف شده
  1. BIN
      script/file3.tar.gz
  2. 146 0
      script/module/hero/HeroGrid.lua
  3. 30 0
      script/module/hero/HeroLogic.lua
  4. 125 20
      script/module/role/NewLogic.lua

BIN
script/file3.tar.gz


+ 146 - 0
script/module/hero/HeroGrid.lua

@@ -262,6 +262,66 @@ function makeHeroSimple(net, grid, index, human, others, tuJian)
     end
 end
 
+-- 封装英雄信息 额外处理
+function makeHeroSimpleToJson(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
+    
+    
+    --是否发送图鉴信息
+    if tuJian then
+        local tj = HeroExcel.tujian[id]
+        if tj ~= nil then
+            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 fontHeroDetailInfo(net, grid, index, human, others, tuJian)
 	makeHeroSimple(net,grid, index, human, others, tuJian)
@@ -296,6 +356,13 @@ function makeHeroSimpleByID(net, id, index, others, human, tujian)
 	makeHeroSimple(net, grid, index, human, others,tujian)
 end
 
+-- 根据英雄id封装英雄信息heroSimple 额外处理
+function makeHeroSimpleByIDToJson(net, id, index, others, human, tujian)
+    local star = others and others.star or nil
+	local grid = getCacheHeroGrid(id, star, others)
+	makeHeroSimpleToJson(net, grid, index, human, others,tujian)
+end
+
 -- 根据怪物id封装英雄信息
 function makeHeroSimpleByMonsterID(net, id, others)
 	makeHeroSimpleByID(net, nil, nil, others)
@@ -368,6 +435,41 @@ function makeHeroNice(net, id, cnt, isNew, index)
 	end
 end
 
+function makeHeroNiceToJson(net, id, cnt, isNew, index)
+	if cnt then
+		Grid.makeItem(net.itemData[1], id, cnt)	
+	end
+	local heroConfig = HeroExcel.hero[id]
+	local specialConfig = HeroExcel.specialHero[id]
+	if heroConfig then
+		makeHeroSimpleByIDToJson(net.heroSimple[1], id, index)
+		makeHeroStaticToJson(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 = getCacheHeroGridTujian(id)
+		for key = RoleDefine.ATK, RoleDefine.SPEED do
+			local value = heroGrid.attrs[key]
+            attrsNum = attrsNum + 1
+			net.attrs[attrsNum].key = key
+			net.attrs[attrsNum].value = value
+
+            attrsMaxNum = attrsMaxNum + 1
+			net.attrsMax[attrsMaxNum].key = key
+			net.attrsMax[attrsMaxNum].value = HeroDefine.getTujianMaxValue(key)
+		end			
+	end
+end
+
 -- 填充英雄详细信息:静态
 function makeHeroStatic(net, id, tuJian)
 	local cf = id and HeroExcel.hero[id]
@@ -414,6 +516,50 @@ function makeHeroStatic(net, id, tuJian)
 	net.skin = #cf.skin > 0 and 1 or 0	
 end
 
+-- 填充英雄详细信息:静态 额外格式
+function makeHeroStaticToJson(net, id, tuJian)
+	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
+		HeroLogic.makeSkillNetToJson(net.skillList[i], attrConfig.skillList[i])
+	end
+
+	for i = 1, #attrConfig.beSkillList do
+		HeroLogic.makeSkillNetToJson(net.beSkill[i], attrConfig.beSkillList[i])
+	end
+	net.skin = #cf.skin > 0 and 1 or 0	
+end
+
+
 -- 最多连续升x级
 function getLevelUpCnt(human, nowLv, maxLv)	
 	local cnt = 0

+ 30 - 0
script/module/hero/HeroLogic.lua

@@ -107,6 +107,36 @@ function makeSkillNet(net, id)
     -- todo
 end
 
+-- 获取技能信息
+function makeSkillNetToJson(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
+
+    if #skillConfig.cd ~= 0 then
+        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].id = buffId
+        net.buff[i].name = buffConfig.name
+        net.buff[i].desc = buffConfig.desc
+    end
+    net.lvUpDesc = skillConfig.lvUpDesc
+    -- todo
+end
+
 -- 封装UpStarCond协议结构体
 function makeUpStarCond(net, cond)
     local ttype = cond[1]

+ 125 - 20
script/module/role/NewLogic.lua

@@ -107,7 +107,7 @@ function NewProto(human, type, param)
                 return
             end
 
-            Log.write(Log.LOGID_TEST, "查询融合前的 motherHeroGrid: " .. Json.Encode(motherHeroBagIndex))
+            Log.write(Log.LOGID_TEST, "查询融合前的 motherHeroGrid: " .. Json.Encode(motherHeroGrid))
 
             local mergeInfo  = {}
             local heroSimple = {}
@@ -159,20 +159,30 @@ function NewProto(human, type, param)
 
             human.db.heroBag = human.db.heroBag or {}
 
+            Log.write(Log.LOGID_TEST, "融合 human.db.heroBag: " .. Json.Encode(human.db.heroBag))
+
+
             local itemId = 178 --生命雨露
             local fatherHeroBagIndex = tonumber(tb[1]) or 0
             local motherHeroBagIndex = tonumber(tb[2]) or 0
 
+            Log.write(Log.LOGID_TEST, "融合 fatherHeroBagIndex: " .. fatherHeroBagIndex)
+            Log.write(Log.LOGID_TEST, "融合  motherHeroBagIndex: " .. motherHeroBagIndex)
+
             local fatherHeroGrid = human.db.heroBag[fatherHeroBagIndex]
             if not fatherHeroGrid then
                 return
             end
 
+            Log.write(Log.LOGID_TEST, "融合 fatherHeroGrid: " .. Json.Encode(fatherHeroGrid))
+
             local motherHeroGrid = human.db.heroBag[motherHeroBagIndex]
             if not motherHeroGrid then
                 return
             end
 
+            Log.write(Log.LOGID_TEST, "融合 motherHeroGrid: " .. Json.Encode(motherHeroGrid))
+
             local fatherHeroAttr = ObjHuman.getHeroAttrs(human, fatherHeroBagIndex)
             local motherHeroAttr = ObjHuman.getHeroAttrs(human, motherHeroBagIndex)
 
@@ -209,22 +219,14 @@ function NewProto(human, type, param)
             --使用道具
             ItemLogic.use(human, itemId, cnt)
 
-            local outItems = {}
             local delHeroList = { [1] = fatherHeroBagIndex, [2] = motherHeroBagIndex }
-            for heroIndex in pairs(delHeroList) do
+            for key, heroIndex in pairs(delHeroList) do
                 local heroID = HeroLogic.getHeroIdByIndex(human, heroIndex)
+
                 HeroEquip.putOffQuick(human, heroID, heroIndex, true)
                 FuwenLogic.putOffQuick(human, heroID, heroIndex, true)
-                local inputIDList = { [0] = 1, [1] = heroID }
-                local inputIndexList = { [0] = 1, [1] = heroIndex }
-                outItems[#outItems + 1] = FenjieLogic.fenjie(human, FenjieLogic.FENJIE_DO_MERGE, inputIDList,
-                    inputIndexList, nil, "hero_merge")
+                HeroLogic.delHeroByIndex(human, heroIndex, "hero_merge")
             end
-            BagLogic.sendItemGetList3(human, outItems, "tenStar_displace")
-
-            -- 删除英雄
-            -- HeroLogic.delHeroByIndex(human, fatherHeroBagIndex, "hero_merge")
-            -- HeroLogic.delHeroByIndex(human, motherHeroBagIndex, "hero_merge")
 
             -- 记录融合英雄
             human.db.mergeInfo.heroInfo.heroID             = sonHeroID
@@ -328,7 +330,114 @@ function NewProto(human, type, param)
         local isHatch     = 2
         local heroIndex   = 0
         local msgTyep     = GET_MERGE_HERO_TYPE
-        local heroNiceNet = {}
+        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] = {},
+                            }
+                        },
+                    }
+                },
+                [2] = {
+                    skillList = {
+                        [1] = {},
+                        [2] = {},
+                    },
+                    beSkill = {
+                        [1] = {},
+                        [2] = {},
+                        [3] = {},
+                    }
+                },
+            },
+            heroSimple = {
+                [1] = {
+                    general = {}
+                },
+                [2] = {
+                    general = {}
+                }
+            },
+            attrs = {
+                [1] = {},
+                [2] = {},
+                [3] = {},
+                [4] = {},
+            },
+            attrsMax = {
+                [1] = {},
+                [2] = {},
+                [3] = {},
+                [4] = {},
+            }
+        }
         if hatchTime <= 0 then
             -- 孵化成功
             hatchTime = 0
@@ -338,14 +447,10 @@ function NewProto(human, type, param)
             heroSimple.general = heroSimple.general or {}
             HeroGrid.makeHeroSimple(heroSimple, heroGrid, heroIndex, human)
 
-            for i = 1, 1 do
-                local heroID = heroGrid.id or heroGrid.heroID
-                local heroConfig = heroID or HeroExcel.hero[heroID]
-                local isNew = not HeroBook.isGet(human, heroConfig.id, heroConfig.star)
-                HeroGrid.makeHeroNice(heroNiceNet, heroID, nil, isNew, heroIndex)
-            end
+            local heroID = heroGrid.id or 0
+            local isNew = not HeroBook.isGet(human, cf.id, cf.star)
+            HeroGrid.makeHeroNiceToJson(heroNiceNet, heroID, nil, isNew, heroIndex)
         else
-            local cf        = sonHeroID and HeroExcel.hero[sonHeroID]
             heroSimple.name = cf and cf.name or ""
             if cf.grade >= 6 then
                 heroSimple.name = "?????"