|
@@ -14,6 +14,7 @@ local HeroExcel = require("excel.hero")
|
|
|
local RoleDefine = require("role.RoleDefine")
|
|
local RoleDefine = require("role.RoleDefine")
|
|
|
local ObjHuman = require("core.ObjHuman")
|
|
local ObjHuman = require("core.ObjHuman")
|
|
|
local HeroGrid = require("hero.HeroGrid")
|
|
local HeroGrid = require("hero.HeroGrid")
|
|
|
|
|
+local Json = require("common.Json")
|
|
|
|
|
|
|
|
AD_DRAW_REWARD_TYPE = 10 --观看广告领取召唤券
|
|
AD_DRAW_REWARD_TYPE = 10 --观看广告领取召唤券
|
|
|
QUERY_MERGE_INFO_TYPE = 11 --获取融合信息
|
|
QUERY_MERGE_INFO_TYPE = 11 --获取融合信息
|
|
@@ -29,6 +30,8 @@ function NewProto(human, type, param)
|
|
|
-- msgRet.tip = "test data"
|
|
-- msgRet.tip = "test data"
|
|
|
-- Msg.send(msgRet,human.fd)
|
|
-- Msg.send(msgRet,human.fd)
|
|
|
|
|
|
|
|
|
|
+ local msgRet = Msg.gc.GC_ROLE_CHANGE_BASEINFO
|
|
|
|
|
+
|
|
|
-- 观看广告获取召唤券
|
|
-- 观看广告获取召唤券
|
|
|
if type == AD_DRAW_REWARD_TYPE then
|
|
if type == AD_DRAW_REWARD_TYPE then
|
|
|
human.db.adRewardCnt = human.db.adRewardCnt or 0
|
|
human.db.adRewardCnt = human.db.adRewardCnt or 0
|
|
@@ -41,15 +44,17 @@ function NewProto(human, type, param)
|
|
|
--增加今日观看次数
|
|
--增加今日观看次数
|
|
|
human.db.adRewardCnt = (human.db.adRewardCnt or 0) + 1
|
|
human.db.adRewardCnt = (human.db.adRewardCnt or 0) + 1
|
|
|
|
|
|
|
|
|
|
+ Log.write(Log.LOGID_TEST, "adRewardCnt: " .. human.db.adRewardCnt)
|
|
|
|
|
+
|
|
|
-- 添加高级召唤卷
|
|
-- 添加高级召唤卷
|
|
|
BagLogic.addItem(human, 118, 1, "draw_ad_reward")
|
|
BagLogic.addItem(human, 118, 1, "draw_ad_reward")
|
|
|
|
|
|
|
|
- local msgRet = Msg.gc.GC_ROLE_CHANGE_BASEINFO
|
|
|
|
|
- msgRet.ret = AD_DRAW_REWARD_TYPE
|
|
|
|
|
- msgRet.tip = Lang.AD_DRAW_REWARD_SUCCESS
|
|
|
|
|
|
|
+ msgRet.ret = AD_DRAW_REWARD_TYPE
|
|
|
|
|
+ msgRet.tip = Lang.AD_DRAW_REWARD_SUCCESS
|
|
|
Msg.send(msgRet, human.fd)
|
|
Msg.send(msgRet, human.fd)
|
|
|
|
|
|
|
|
Broadcast.sendErr(human, Lang.AD_DRAW_REWARD_SUCCESS)
|
|
Broadcast.sendErr(human, Lang.AD_DRAW_REWARD_SUCCESS)
|
|
|
|
|
+ return
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
-- 开始融合
|
|
-- 开始融合
|
|
@@ -69,12 +74,12 @@ function NewProto(human, type, param)
|
|
|
"开始融合 fatherHeroBagIndex: " .. fatherHeroBagIndex .. "motherHeroBagIndex: " .. motherHeroBagIndex)
|
|
"开始融合 fatherHeroBagIndex: " .. fatherHeroBagIndex .. "motherHeroBagIndex: " .. motherHeroBagIndex)
|
|
|
|
|
|
|
|
local fatherHeroGrid = human.db.heroBag[fatherHeroBagIndex]
|
|
local fatherHeroGrid = human.db.heroBag[fatherHeroBagIndex]
|
|
|
- if not heroGrid then
|
|
|
|
|
|
|
+ if not fatherHeroGrid then
|
|
|
return
|
|
return
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
local motherHeroGrid = human.db.heroBag[motherHeroBagIndex]
|
|
local motherHeroGrid = human.db.heroBag[motherHeroBagIndex]
|
|
|
- if not heroGrid then
|
|
|
|
|
|
|
+ if not motherHeroGrid then
|
|
|
return
|
|
return
|
|
|
end
|
|
end
|
|
|
|
|
|
|
@@ -144,9 +149,8 @@ function NewProto(human, type, param)
|
|
|
|
|
|
|
|
Broadcast.sendErr(human, Lang.MERGE_SUCCESS)
|
|
Broadcast.sendErr(human, Lang.MERGE_SUCCESS)
|
|
|
|
|
|
|
|
- local msgRet = Msg.gc.GC_ROLE_CHANGE_BASEINFO
|
|
|
|
|
- msgRet.ret = MERGE_HERO_TYPE
|
|
|
|
|
- msgRet.tip = Json.Encode(mergeInfo)
|
|
|
|
|
|
|
+ msgRet.ret = MERGE_HERO_TYPE
|
|
|
|
|
+ msgRet.tip = Json.Encode(mergeInfo)
|
|
|
Msg.send(msgRet, human.fd)
|
|
Msg.send(msgRet, human.fd)
|
|
|
end
|
|
end
|
|
|
return
|
|
return
|
|
@@ -165,12 +169,12 @@ function NewProto(human, type, param)
|
|
|
local motherHeroBagIndex = tonumber(tb[2]) or 0
|
|
local motherHeroBagIndex = tonumber(tb[2]) or 0
|
|
|
|
|
|
|
|
local fatherHeroGrid = human.db.heroBag[fatherHeroBagIndex]
|
|
local fatherHeroGrid = human.db.heroBag[fatherHeroBagIndex]
|
|
|
- if not heroGrid then
|
|
|
|
|
|
|
+ if not fatherHeroGrid then
|
|
|
return
|
|
return
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
local motherHeroGrid = human.db.heroBag[motherHeroBagIndex]
|
|
local motherHeroGrid = human.db.heroBag[motherHeroBagIndex]
|
|
|
- if not heroGrid then
|
|
|
|
|
|
|
+ if not motherHeroGrid then
|
|
|
return
|
|
return
|
|
|
end
|
|
end
|
|
|
|
|
|
|
@@ -206,9 +210,8 @@ function NewProto(human, type, param)
|
|
|
|
|
|
|
|
Log.write(Log.LOGID_TEST, "mergeInfo: " .. Json.Encode(mergeInfo))
|
|
Log.write(Log.LOGID_TEST, "mergeInfo: " .. Json.Encode(mergeInfo))
|
|
|
|
|
|
|
|
- local msgRet = Msg.gc.QUERY_MERGE_BEFORE_INFO_TYPE
|
|
|
|
|
- msgRet.ret = QUERY_MERGE_INFO_TYPE
|
|
|
|
|
- msgRet.tip = Json.Encode(mergeInfo)
|
|
|
|
|
|
|
+ msgRet.ret = QUERY_MERGE_BEFORE_INFO_TYPE
|
|
|
|
|
+ msgRet.tip = Json.Encode(mergeInfo)
|
|
|
Msg.send(msgRet, human.fd)
|
|
Msg.send(msgRet, human.fd)
|
|
|
end
|
|
end
|
|
|
return
|
|
return
|
|
@@ -251,7 +254,7 @@ function NewProto(human, type, param)
|
|
|
|
|
|
|
|
if heroIndex ~= 0 then
|
|
if heroIndex ~= 0 then
|
|
|
local heroGrid = human.db.heroBag[heroIndex]
|
|
local heroGrid = human.db.heroBag[heroIndex]
|
|
|
- if type(heroGrid) ~= "table" then return end
|
|
|
|
|
|
|
+ if not heroGrid then return end
|
|
|
heroSimple.general = heroSimple.general or {}
|
|
heroSimple.general = heroSimple.general or {}
|
|
|
HeroGrid.makeHeroSimple(heroSimple, heroGrid, nil, human)
|
|
HeroGrid.makeHeroSimple(heroSimple, heroGrid, nil, human)
|
|
|
else
|
|
else
|
|
@@ -266,9 +269,8 @@ function NewProto(human, type, param)
|
|
|
mergeInfo.isHatch = isHatch
|
|
mergeInfo.isHatch = isHatch
|
|
|
Log.write(Log.LOGID_TEST, "mergeInfo: " .. Json.Encode(mergeInfo))
|
|
Log.write(Log.LOGID_TEST, "mergeInfo: " .. Json.Encode(mergeInfo))
|
|
|
|
|
|
|
|
- local msgRet = Msg.gc.GC_ROLE_CHANGE_BASEINFO
|
|
|
|
|
- msgRet.ret = QUERY_MERGE_INFO_TYPE
|
|
|
|
|
- msgRet.tip = Json.Encode(mergeInfo)
|
|
|
|
|
|
|
+ msgRet.ret = QUERY_MERGE_INFO_TYPE
|
|
|
|
|
+ msgRet.tip = Json.Encode(mergeInfo)
|
|
|
Msg.send(msgRet, human.fd)
|
|
Msg.send(msgRet, human.fd)
|
|
|
return
|
|
return
|
|
|
end
|
|
end
|
|
@@ -345,7 +347,6 @@ function NewProto(human, type, param)
|
|
|
|
|
|
|
|
local mergeInfo = {}
|
|
local mergeInfo = {}
|
|
|
local heroSimple = {}
|
|
local heroSimple = {}
|
|
|
- local msgRet = Msg.gc.GC_ROLE_CHANGE_BASEINFO
|
|
|
|
|
mergeInfo.mergeTime = hatchTime
|
|
mergeInfo.mergeTime = hatchTime
|
|
|
mergeInfo.heroData = heroSimple
|
|
mergeInfo.heroData = heroSimple
|
|
|
mergeInfo.xLv = human.db.mergeInfo.heroInfo.xLv
|
|
mergeInfo.xLv = human.db.mergeInfo.heroInfo.xLv
|
|
@@ -426,7 +427,9 @@ end
|
|
|
|
|
|
|
|
-- 获取xlv
|
|
-- 获取xlv
|
|
|
function getxLv(fatherHeroGrid, motherHeroGrid)
|
|
function getxLv(fatherHeroGrid, motherHeroGrid)
|
|
|
- local params1 = math.max(fatherHeroGrid.xLv, motherHeroGrid.xLv)
|
|
|
|
|
|
|
+ local fatherHeroXLv = fatherHeroGrid.xLv or 0
|
|
|
|
|
+ local motherHeroXLv = motherHeroGrid.xLv or 0
|
|
|
|
|
+ local params1 = math.max(fatherHeroXLv, motherHeroXLv)
|
|
|
local params2 = math.floor((fatherHeroGrid.lv + motherHeroGrid.lv) / 200) + 1
|
|
local params2 = math.floor((fatherHeroGrid.lv + motherHeroGrid.lv) / 200) + 1
|
|
|
|
|
|
|
|
return params1 + params2
|
|
return params1 + params2
|