zhanwencai hace 1 año
padre
commit
1e8f531de4

BIN
script/file3.tar.gz


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

@@ -39,6 +39,8 @@ local UnionTecLogic = require("union.UnionTecLogic")
 local HeroBook = require("hero.HeroBook")
 local XingYaoGongMing = require("xingYaoMen.XingYaoGongMing")
 local FuwenExcel = require("excel.fuwen").fuwen
+local Log = require("common.Log")
+local Json = require("common.Json")
 
 HERO_GRID_CACHE = HERO_GRID_CACHE or {} -- 为静态英雄数据使用
 HERO_GRID_CACHE_TUJIAN = HERO_GRID_CACHE_TUJIAN or {}
@@ -450,6 +452,7 @@ function makeHeroDynamic(net, grid, index, human)
 	local id = grid and grid.id 
 	local cf = id and HeroExcel.hero[id]
 	local lv = grid and grid.lv or 1
+	local xLv = grid and grid.xLv or 0
 	local star = grid and grid.star or 1 -- 星级调整成动态值 dxzeng --cf and cf.star or 0
 	local quality = grid and grid.quality or 0 
 	local maxLv = getMaxLv(star, quality)
@@ -458,6 +461,7 @@ function makeHeroDynamic(net, grid, index, human)
     net.maxQuality = getMaxQuality(star)
 	net.id = id or 0
 	net.lv = lv
+	net.xLv = xLv
     net.uuid = grid and grid.uuid or ""
 	net.head = cf and cf.head or 0
 	net.quality = quality

+ 1 - 0
script/module/hero/Proto.lua

@@ -128,6 +128,7 @@ HeroDynamic = {
     {"maxQuality",  1,      "byte"},	 --最高品阶
     {"skillList",   2,      SkillNet},    --主动技能:2个
 	{"beSkill",     3,      SkillNet},    --被动技能:最多3个
+    {"xLv",        1,      "int"},   	 --xLv 初始值0
 }
 
 

+ 59 - 24
script/module/role/NewLogic.lua

@@ -184,7 +184,7 @@ function NewProto(human, type, param)
             local mergeInfo  = {}
             local heroSimple = {}
             local xLv        = getxLv(fatherHeroGrid, motherHeroGrid)
-            local cnt        = math.floor(xLv / 2) + 1
+            local isHatch    = 2
 
             local sonHeroID  = mergeHero(fatherHeroGrid.id, motherHeroGrid.id)
             if sonHeroID <= 0 then
@@ -196,6 +196,7 @@ function NewProto(human, type, param)
             mergeInfo.mergeTime = human.db.mergeInfo.mergeTime
             mergeInfo.xLv       = xLv
             mergeInfo.heroData  = heroSimple
+            mergeInfo.isHatch   = isHatch
 
             Log.write(Log.LOGID_TEST, "mergeInfo: " .. Json.Encode(mergeInfo))
 
@@ -218,10 +219,19 @@ function NewProto(human, type, param)
         local nowTime    = os.time()
         local mergeTime  = 0
         local heroSimple = {}
-        local xLv        = human.db.mergeInfo.heroInfo.xLv
+        local xLv        = human.db.mergeInfo.heroInfo.xLv or 0
+        local heroIndex  = 0
+        local sonHeroID  = human.db.mergeInfo.heroInfo.heroID or 0
+        local isHatch    = 2
 
-        local sonHeroID  = human.db.mergeInfo.heroInfo.heroID
         if sonHeroID <= 0 then
+            mergeInfo.mergeTime = human.db.mergeInfo.mergeTime
+            mergeInfo.xLv       = xLv
+            mergeInfo.heroData  = heroSimple
+            mergeInfo.isHatch   = isHatch
+            msgRet.ret          = QUERY_MERGE_INFO_TYPE
+            msgRet.tip          = Json.Encode(mergeInfo)
+            Msg.send(msgRet, human.fd)
             return
         end
 
@@ -229,17 +239,27 @@ function NewProto(human, type, param)
             mergeTime = human.db.mergeInfo.mergeEndTime - nowTime
             -- 孵化成功
             if mergeTime <= 0 then
-                hatchHero(human)
+                heroIndex = hatchHero(human)
                 return
             end
         end
 
-        local cf            = sonHeroID and HeroExcel.hero[sonHeroID]
-        heroSimple.name     = cf and cf.name or ""
+        if heroIndex ~= 0 then
+            local isHatch = 3
+            local heroGrid = human.db.heroBag[heroIndex]
+            if type(heroGrid) ~= "table" then return end
+            heroSimple.general = heroSimple.general or {}
+            HeroGrid.makeHeroSimple(heroSimple, heroGrid, nil, human)
+        else
+            local cf        = sonHeroID and HeroExcel.hero[sonHeroID]
+            heroSimple.name = cf and cf.name or ""
+            isHatch         = 1
+        end
+
         mergeInfo.mergeTime = human.db.mergeInfo.mergeTime
         mergeInfo.xLv       = xLv
         mergeInfo.heroData  = heroSimple
-
+        mergeInfo.isHatch   = isHatch
         Log.write(Log.LOGID_TEST, "mergeInfo: " .. Json.Encode(mergeInfo))
 
         local msgRet = Msg.gc.GC_ROLE_CHANGE_BASEINFO
@@ -254,21 +274,36 @@ function NewProto(human, type, param)
         local tb = Util.split(param, "|")
         local itemId = tonumber(tb[1]) or 0
         local cnt = tonumber(tb[2]) or 0
+        local isHatch = 2
 
         if tb[1] and tb[2] then
             -- 初始化
             initMergeInfo(human)
 
-            --使用道具
-            ItemLogic.use(human, itemId, cnt)
-
-            local remainingTime = human.db.mergeInfo.mergeTime - (60 * cnt)
+            local remainingTime = 0
+            if itemId == 179 then
+                --使用道具
+                ItemLogic.use(human, itemId, cnt)
+                remainingTime = human.db.mergeInfo.mergeTime - (60 * 5 * cnt)
+            else
+                -- 判断消耗
+                local needZuanshi = cnt
+                if not ObjHuman.checkRMB(human, needZuanshi) then
+                    return
+                end
+
+                -- 扣钻石
+                ObjHuman.decZuanshi(human, -needZuanshi, "hero_merge")
+                remainingTime = human.db.mergeInfo.mergeTime - (30 * needZuanshi)
+            end
 
             Log.write(Log.LOGID_TEST, "remainingTime: " .. remainingTime)
 
             -- 孵化成功
             if remainingTime <= 0 then
-                hatchHero(human)
+                -- hatchHero(human)
+                human.db.mergeInfo.mergeTime = 0
+                isHatch = 3
                 -- return
             end
 
@@ -278,11 +313,10 @@ function NewProto(human, type, param)
 
             local mergeInfo     = {}
             local heroSimple    = {}
-            -- heroSimple.general = heroSimple.general or {}
-            -- HeroGrid.makeHeroSimpleByID(heroSimple, human.db.mergeInfo.heroId, nil, nil, human)
-
             mergeInfo.mergeTime = human.db.mergeInfo.mergeTime
             mergeInfo.heroData  = heroSimple
+            mergeInfo.xLv       = human.db.mergeInfo.heroInfo.xLv
+            mergeInfo.isHatch   = isHatch
 
             local msgRet        = Msg.gc.GC_ROLE_CHANGE_BASEINFO
             msgRet.ret          = QUICK_HATCH_TYPE
@@ -314,18 +348,19 @@ function hatchHero(human)
     human.db.mergeInfo.heroInfo.heroAttrs          = RoleDefine.PANEL_ATTR_KEY
     human.db.heroBag                               = human.db.heroBag or {}
 
-    local heroGrid                                 = human.db.heroBag[heroIndex]
-    if type(heroGrid) ~= "table" then return end
+    return heroIndex
+    -- local heroGrid                                 = human.db.heroBag[heroIndex]
+    -- if type(heroGrid) ~= "table" then return end
 
-    heroSimple.general = heroSimple.general or {}
-    HeroGrid.makeHeroSimple(heroSimple, heroGrid, nil, human)
+    -- heroSimple.general = heroSimple.general or {}
+    -- HeroGrid.makeHeroSimple(heroSimple, heroGrid, nil, human)
 
-    data.heroData  = heroSimple
-    data.mergeTime = human.db.mergeInfo.mergeTime
+    -- data.heroData  = heroSimple
+    -- data.mergeTime = human.db.mergeInfo.mergeTime
 
-    msgRet.ret     = HATCH_SCCUESS_TYPE
-    msgRet.tip     = Json.Encode(data)
-    Msg.send(msgRet, human.fd)
+    -- msgRet.ret     = HATCH_SCCUESS_TYPE
+    -- msgRet.tip     = Json.Encode(data)
+    -- Msg.send(msgRet, human.fd)
 end
 
 -- 初始化融合信息