|
|
@@ -131,7 +131,7 @@ function NewProto(human, type, param)
|
|
|
|
|
|
human.db.heroBag = human.db.heroBag or {}
|
|
|
|
|
|
- local itemId = 178 --生命雨露
|
|
|
+ local itemId = 178 --生命雨露
|
|
|
local fatherHeroBagIndex = tonumber(tb[1]) or 0
|
|
|
local motherHeroBagIndex = tonumber(tb[2]) or 0
|
|
|
|
|
|
@@ -225,7 +225,6 @@ function NewProto(human, type, param)
|
|
|
local mergeTime = 0
|
|
|
local heroSimple = {}
|
|
|
local xLv = human.db.mergeInfo.heroInfo.xLv or 0
|
|
|
- local heroIndex = 0
|
|
|
local sonHeroID = human.db.mergeInfo.heroInfo.heroID or 0
|
|
|
local isHatch = 2
|
|
|
|
|
|
@@ -246,15 +245,6 @@ function NewProto(human, type, param)
|
|
|
-- 孵化成功
|
|
|
mergeTime = 0
|
|
|
isHatch = 3
|
|
|
- Log.write(Log.LOGID_TEST, "孵化成功: " .. Json.Encode(human.db.mergeInfo))
|
|
|
- heroIndex = hatchHero(human)
|
|
|
- end
|
|
|
-
|
|
|
- if heroIndex ~= 0 then
|
|
|
- local heroGrid = human.db.heroBag[heroIndex]
|
|
|
- if not heroGrid 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 ""
|
|
|
@@ -267,53 +257,30 @@ function NewProto(human, type, param)
|
|
|
mergeInfo.isHatch = isHatch
|
|
|
mergeInfo.adHatchRewardCnt = getResetAdHatchCnt(human)
|
|
|
|
|
|
- Log.write(Log.LOGID_TEST, "融合中 mergeInfo: " .. Json.Encode(mergeInfo))
|
|
|
-
|
|
|
- msgRet.ret = QUERY_MERGE_INFO_TYPE
|
|
|
- msgRet.tip = Json.Encode(mergeInfo)
|
|
|
+ msgRet.ret = QUERY_MERGE_INFO_TYPE
|
|
|
+ msgRet.tip = Json.Encode(mergeInfo)
|
|
|
+ Log.write(Log.LOGID_TEST, "融合中 msgRet: " .. Json.Encode(msgRet))
|
|
|
Msg.send(msgRet, human.fd)
|
|
|
return
|
|
|
end
|
|
|
|
|
|
-- 获取融合英雄
|
|
|
if type == GET_MERGE_HERO_TYPE then
|
|
|
- human.db.adHatchRewardCnt = human.db.adHatchRewardCnt or 0
|
|
|
-
|
|
|
- if human.db.adHatchRewardCnt > 4 then
|
|
|
- Broadcast.sendErr(human, Lang.AD_DRAW_REWARD_LIMIT_ERROR)
|
|
|
- return
|
|
|
- end
|
|
|
-
|
|
|
- local itemSpeedTime = 30 * 60
|
|
|
- local nowTime = os.time()
|
|
|
- local mergeInfo = {}
|
|
|
- local mergeTime = 0
|
|
|
- local heroSimple = {}
|
|
|
- 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 cf = sonHeroID and HeroExcel.hero[sonHeroID]
|
|
|
- heroSimple.name = cf and cf.name or ""
|
|
|
-
|
|
|
- --增加今日观看次数
|
|
|
- human.db.adHatchRewardCnt = (human.db.adHatchRewardCnt or 0) + 1
|
|
|
-
|
|
|
- human.db.mergeInfo.endTime = human.db.mergeInfo.endTime - itemSpeedTime
|
|
|
-
|
|
|
- Log.write(Log.LOGID_TEST, "human.db.mergeInfo.endTime: " .. human.db.mergeInfo.endTime)
|
|
|
-
|
|
|
- local hatchTime = human.db.mergeInfo.endTime - nowTime
|
|
|
-
|
|
|
- if hatchTime < 0 then
|
|
|
+ local nowTime = os.time()
|
|
|
+ local mergeInfo = {}
|
|
|
+ local heroSimple = {}
|
|
|
+ local xLv = human.db.mergeInfo.heroInfo.xLv or 0
|
|
|
+ local sonHeroID = human.db.mergeInfo.heroInfo.heroID or 0
|
|
|
+ local hatchTime = human.db.mergeInfo.endTime - nowTime
|
|
|
+ local isHatch = 2
|
|
|
+ local heroIndex = 0
|
|
|
+ local msgTyep = GET_MERGE_HERO_TYPE
|
|
|
+
|
|
|
+ if hatchTime <= 0 then
|
|
|
-- 孵化成功
|
|
|
- mergeTime = 0
|
|
|
+ hatchTime = 0
|
|
|
isHatch = 3
|
|
|
- Log.write(Log.LOGID_TEST, "孵化成功: " .. Json.Encode(human.db.mergeInfo))
|
|
|
heroIndex = hatchHero(human)
|
|
|
- end
|
|
|
-
|
|
|
- if heroIndex ~= 0 then
|
|
|
local heroGrid = human.db.heroBag[heroIndex]
|
|
|
if not heroGrid then return end
|
|
|
heroSimple.general = heroSimple.general or {}
|
|
|
@@ -322,18 +289,19 @@ function NewProto(human, type, param)
|
|
|
local cf = sonHeroID and HeroExcel.hero[sonHeroID]
|
|
|
heroSimple.name = cf and cf.name or ""
|
|
|
isHatch = 1
|
|
|
+ msgTyep = QUERY_MERGE_INFO_TYPE
|
|
|
end
|
|
|
|
|
|
- mergeInfo.mergeTime = mergeTime
|
|
|
+ mergeInfo.mergeTime = hatchTime
|
|
|
mergeInfo.xLv = xLv
|
|
|
mergeInfo.heroData = heroSimple
|
|
|
mergeInfo.isHatch = isHatch
|
|
|
mergeInfo.adHatchRewardCnt = getResetAdHatchCnt(human)
|
|
|
|
|
|
- Log.write(Log.LOGID_TEST, "看广告 mergeInfo: " .. Json.Encode(mergeInfo))
|
|
|
+ msgRet.ret = msgTyep
|
|
|
+ msgRet.tip = Json.Encode(mergeInfo)
|
|
|
|
|
|
- msgRet.ret = GET_MERGE_HERO_TYPE
|
|
|
- msgRet.tip = Json.Encode(mergeInfo)
|
|
|
+ Log.write(Log.LOGID_TEST, "获取英雄 ret: " .. Json.Encode(msgRet))
|
|
|
Msg.send(msgRet, human.fd)
|
|
|
return
|
|
|
end
|
|
|
@@ -343,7 +311,7 @@ function NewProto(human, type, param)
|
|
|
local tb = Util.split(param, "|")
|
|
|
local quickType = tonumber(tb[1]) or 0
|
|
|
local cnt = tonumber(tb[2]) or 0
|
|
|
- local isHatch = 2
|
|
|
+ local isHatch = 1
|
|
|
|
|
|
if tb[1] and tb[2] then
|
|
|
-- 初始化
|
|
|
@@ -355,6 +323,7 @@ function NewProto(human, type, param)
|
|
|
|
|
|
if hatchTime <= 0
|
|
|
then
|
|
|
+ Broadcast.sendErr(human, Lang.QUICK_HATCH_TIME_OUT)
|
|
|
return
|
|
|
end
|
|
|
|
|
|
@@ -412,9 +381,6 @@ function NewProto(human, type, param)
|
|
|
end
|
|
|
|
|
|
human.db.mergeInfo.endTime = human.db.mergeInfo.endTime - itemSpeedTime
|
|
|
-
|
|
|
- Log.write(Log.LOGID_TEST, "human.db.mergeInfo.endTime: " .. human.db.mergeInfo.endTime)
|
|
|
-
|
|
|
local hatchTime = human.db.mergeInfo.endTime - nowTime
|
|
|
|
|
|
-- 孵化成功
|
|
|
@@ -423,8 +389,6 @@ function NewProto(human, type, param)
|
|
|
isHatch = 3
|
|
|
end
|
|
|
|
|
|
- Broadcast.sendErr(human, Lang.QUICK_HATCH_SUCCESS)
|
|
|
-
|
|
|
local mergeInfo = {}
|
|
|
local heroSimple = {}
|
|
|
mergeInfo.mergeTime = hatchTime
|
|
|
@@ -433,10 +397,11 @@ function NewProto(human, type, param)
|
|
|
mergeInfo.isHatch = isHatch
|
|
|
mergeInfo.adHatchRewardCnt = getResetAdHatchCnt(human)
|
|
|
|
|
|
- Log.write(Log.LOGID_TEST, "加速孵化 mergeInfo: " .. Json.Encode(mergeInfo))
|
|
|
+ msgRet.ret = QUICK_HATCH_TYPE
|
|
|
+ msgRet.tip = Json.Encode(mergeInfo)
|
|
|
+
|
|
|
+ Log.write(Log.LOGID_TEST, "加速孵化 ret: " .. Json.Encode(ret))
|
|
|
|
|
|
- msgRet.ret = QUICK_HATCH_TYPE
|
|
|
- msgRet.tip = Json.Encode(mergeInfo)
|
|
|
Msg.send(msgRet, human.fd)
|
|
|
return
|
|
|
end
|
|
|
@@ -453,7 +418,6 @@ function hatchHero(human)
|
|
|
Log.write(Log.LOGID_TEST, "孵化英雄成功 下标" .. heroIndex)
|
|
|
|
|
|
local attrs = RoleDefine.PANEL_ATTR_KEY
|
|
|
-
|
|
|
for key, value in pairs(attrs) do
|
|
|
attrs[key] = 1
|
|
|
end
|