|
|
@@ -1,9 +1,7 @@
|
|
|
local Msg = require("core.Msg")
|
|
|
local Broadcast = require("broadcast.Broadcast")
|
|
|
local Lang = require("common.Lang")
|
|
|
-local ItemDefine = require("bag.ItemDefine")
|
|
|
local Grid = require("bag.Grid")
|
|
|
-local DrawCardLogic = require("drawCard.DrawCardLogic")
|
|
|
local MergeRule = require("excel.mergeConfig").rule
|
|
|
local BagLogic = require("bag.BagLogic")
|
|
|
local Log = require("common.Log")
|
|
|
@@ -23,6 +21,7 @@ MERGE_HERO_TYPE = 13 --融合
|
|
|
QUICK_HATCH_TYPE = 14 --加速
|
|
|
QUERY_MERGE_BEFORE_INFO_TYPE = 15 --获取融合前信息
|
|
|
GET_MERGE_HERO_TYPE = 16 --获取融合英雄
|
|
|
+QUERY_QUICK_HATCH_ZUANSHI = 17 --查询加速孵化需要的钻石
|
|
|
|
|
|
AD_HATCH_RESET_FREECNT = 4 --看广告加速孵化次数
|
|
|
|
|
|
@@ -60,6 +59,22 @@ function NewProto(human, type, param)
|
|
|
return
|
|
|
end
|
|
|
|
|
|
+ -- 查询加速孵化需要的钻石
|
|
|
+ if type == QUERY_QUICK_HATCH_ZUANSHI then
|
|
|
+ -- 初始化
|
|
|
+ initMergeInfo(human)
|
|
|
+ local info = {}
|
|
|
+ local nowTime = os.time
|
|
|
+ local hatchTime = human.db.mergeInfo.endTime - nowTime
|
|
|
+
|
|
|
+ info.zuanshi = doCalcNeedZuanshi(hatchTime)
|
|
|
+
|
|
|
+ msgRet.ret = QUERY_QUICK_HATCH_ZUANSHI
|
|
|
+ msgRet.tip = Json.Encode(info)
|
|
|
+ Msg.send(msgRet, human.fd)
|
|
|
+ return
|
|
|
+ end
|
|
|
+
|
|
|
-- 获取融合前的信息
|
|
|
if type == QUERY_MERGE_BEFORE_INFO_TYPE then
|
|
|
local tb = Util.split(param, "|")
|
|
|
@@ -106,12 +121,16 @@ function NewProto(human, type, param)
|
|
|
|
|
|
local cf = sonHeroID and HeroExcel.hero[sonHeroID]
|
|
|
heroSimple.name = cf and cf.name or ""
|
|
|
+ if cf.grade >= 6 then
|
|
|
+ heroSimple.name = "?????"
|
|
|
+ end
|
|
|
mergeInfo.mergeTime = 0
|
|
|
mergeInfo.xLv = xLv
|
|
|
mergeInfo.mergeItem = mergeItem
|
|
|
mergeInfo.heroData = heroSimple
|
|
|
mergeInfo.isHatch = isHatch
|
|
|
mergeInfo.adHatchRewardCnt = getResetAdHatchCnt(human)
|
|
|
+ mergeInfo.isTip = getTodayIsTip(human)
|
|
|
|
|
|
Log.write(Log.LOGID_TEST, "查询融合前的 mergeInfo: " .. Json.Encode(mergeInfo))
|
|
|
|
|
|
@@ -197,11 +216,15 @@ function NewProto(human, type, param)
|
|
|
|
|
|
local cf = sonHeroID and HeroExcel.hero[sonHeroID]
|
|
|
heroSimple.name = cf and cf.name or ""
|
|
|
+ if cf.grade >= 6 then
|
|
|
+ heroSimple.name = "?????"
|
|
|
+ end
|
|
|
mergeInfo.mergeTime = human.db.mergeInfo.hatchTime
|
|
|
mergeInfo.xLv = xLv
|
|
|
mergeInfo.heroData = heroSimple
|
|
|
mergeInfo.isHatch = 1
|
|
|
mergeInfo.adHatchRewardCnt = getResetAdHatchCnt(human)
|
|
|
+ mergeInfo.isTip = getTodayIsTip(human)
|
|
|
|
|
|
Log.write(Log.LOGID_TEST, "融合 mergeInfo: " .. Json.Encode(mergeInfo))
|
|
|
|
|
|
@@ -248,6 +271,9 @@ function NewProto(human, type, param)
|
|
|
else
|
|
|
local cf = sonHeroID and HeroExcel.hero[sonHeroID]
|
|
|
heroSimple.name = cf and cf.name or ""
|
|
|
+ if cf.grade >= 6 then
|
|
|
+ heroSimple.name = "?????"
|
|
|
+ end
|
|
|
isHatch = 1
|
|
|
end
|
|
|
|
|
|
@@ -256,6 +282,7 @@ function NewProto(human, type, param)
|
|
|
mergeInfo.heroData = heroSimple
|
|
|
mergeInfo.isHatch = isHatch
|
|
|
mergeInfo.adHatchRewardCnt = getResetAdHatchCnt(human)
|
|
|
+ mergeInfo.isTip = getTodayIsTip(human)
|
|
|
|
|
|
msgRet.ret = QUERY_MERGE_INFO_TYPE
|
|
|
msgRet.tip = Json.Encode(mergeInfo)
|
|
|
@@ -275,7 +302,7 @@ function NewProto(human, type, param)
|
|
|
local isHatch = 2
|
|
|
local heroIndex = 0
|
|
|
local msgTyep = GET_MERGE_HERO_TYPE
|
|
|
-
|
|
|
+
|
|
|
if hatchTime <= 0 then
|
|
|
-- 孵化成功
|
|
|
hatchTime = 0
|
|
|
@@ -288,6 +315,9 @@ function NewProto(human, type, param)
|
|
|
else
|
|
|
local cf = sonHeroID and HeroExcel.hero[sonHeroID]
|
|
|
heroSimple.name = cf and cf.name or ""
|
|
|
+ if cf.grade >= 6 then
|
|
|
+ heroSimple.name = "?????"
|
|
|
+ end
|
|
|
isHatch = 1
|
|
|
msgTyep = QUERY_MERGE_INFO_TYPE
|
|
|
end
|
|
|
@@ -297,6 +327,7 @@ function NewProto(human, type, param)
|
|
|
mergeInfo.heroData = heroSimple
|
|
|
mergeInfo.isHatch = isHatch
|
|
|
mergeInfo.adHatchRewardCnt = getResetAdHatchCnt(human)
|
|
|
+ mergeInfo.isTip = getTodayIsTip(human)
|
|
|
|
|
|
msgRet.ret = msgTyep
|
|
|
msgRet.tip = Json.Encode(mergeInfo)
|
|
|
@@ -365,6 +396,11 @@ function NewProto(human, type, param)
|
|
|
|
|
|
-- 扣钻石
|
|
|
ObjHuman.decZuanshi(human, -zuanshiCnt, "hero_merge")
|
|
|
+
|
|
|
+ if tb[3] then
|
|
|
+ human.db.isTip = human.db.isTip or 1
|
|
|
+ human.db.isTip = tb[3]
|
|
|
+ end
|
|
|
elseif quickType == 3 then
|
|
|
human.db.adHatchRewardCnt = human.db.adHatchRewardCnt or 0
|
|
|
|
|
|
@@ -396,6 +432,7 @@ function NewProto(human, type, param)
|
|
|
mergeInfo.xLv = human.db.mergeInfo.heroInfo.xLv
|
|
|
mergeInfo.isHatch = isHatch
|
|
|
mergeInfo.adHatchRewardCnt = getResetAdHatchCnt(human)
|
|
|
+ mergeInfo.isTip = getTodayIsTip(human)
|
|
|
|
|
|
msgRet.ret = QUICK_HATCH_TYPE
|
|
|
msgRet.tip = Json.Encode(mergeInfo)
|
|
|
@@ -519,3 +556,9 @@ function getResetAdHatchCnt(human)
|
|
|
local adHatchRewardCnt = human.db.adHatchRewardCnt or 0
|
|
|
return math.max(AD_HATCH_RESET_FREECNT - adHatchRewardCnt, 0)
|
|
|
end
|
|
|
+
|
|
|
+-- 获取是否今日不再提示
|
|
|
+function getTodayIsTip(human)
|
|
|
+ local isTip = human.db.isTip or 1
|
|
|
+ return isTip
|
|
|
+end
|