|
|
@@ -17,6 +17,7 @@ local HeroEquip = require("hero.HeroEquip")
|
|
|
local HeroDefine = require("hero.HeroDefine")
|
|
|
local FenjieLogic = require("hecheng.FenjieLogic")
|
|
|
local FuwenLogic = require("fuwen.FuwenLogic")
|
|
|
+local SkinLogic = require("skin.SkinLogic")
|
|
|
|
|
|
MATERIAL1_NEED_STAR = 10 -- 材料1,需要10星以上的英雄
|
|
|
MATERIAL2_NEED_STAR = 5 -- 材料2,需要5星的英雄
|
|
|
@@ -105,6 +106,7 @@ function zhihuan(human, material2ID, heroIndexList)
|
|
|
local materialList = {}
|
|
|
local material2Cnt = 0
|
|
|
local material1Star = 0
|
|
|
+ local nCreateHeroSkinId = nil
|
|
|
for i = 1, heroIndexList[0] do
|
|
|
local heroIndex = heroIndexList[i]
|
|
|
local heroID = HeroLogic.getHeroIdByIndex(human, heroIndex)
|
|
|
@@ -122,13 +124,21 @@ function zhihuan(human, material2ID, heroIndexList)
|
|
|
return Broadcast.sendErr(human, Lang.TENSTAR_ERR_MATERIAL)
|
|
|
end
|
|
|
|
|
|
+ if heroGrid.skinOn and nil == nCreateHeroSkinId then
|
|
|
+ nCreateHeroSkinId = heroGrid.skinOn
|
|
|
+ end
|
|
|
+
|
|
|
local materialHeroConfig = HeroExcel.hero[material1Config.heroID]
|
|
|
if materialHeroConfig.camp ~= materialHeroConfig.camp then
|
|
|
return Broadcast.sendErr(human, Lang.TENSTAR_ERR_CAMP)
|
|
|
end
|
|
|
material1Star = math.max(material1Star, material1Config.star)
|
|
|
end
|
|
|
- end
|
|
|
+ end
|
|
|
+
|
|
|
+ if nCreateHeroSkinId then
|
|
|
+ print("[zhihuan] nCreateHeroSkinId = "..nCreateHeroSkinId)
|
|
|
+ end
|
|
|
|
|
|
local config = UpNeedExcel.zhihuan[material1Star]
|
|
|
if not config then
|
|
|
@@ -173,6 +183,10 @@ function zhihuan(human, material2ID, heroIndexList)
|
|
|
BagLogic.sendItemGetList3(human, outItems, "tenStar_displace")
|
|
|
|
|
|
newHeroGrid.id = attrConfig.heroID
|
|
|
+ if nCreateHeroSkinId then
|
|
|
+ newHeroGrid.skinOn = nCreateHeroSkinId
|
|
|
+ end
|
|
|
+
|
|
|
local newIndex = HeroLogic.addHeroByGrid(human, newHeroGrid, "tenStar_displace")
|
|
|
|
|
|
if equipTb ~= nil then
|
|
|
@@ -191,6 +205,14 @@ function zhihuan(human, material2ID, heroIndexList)
|
|
|
end
|
|
|
end
|
|
|
|
|
|
+ if nCreateHeroSkinId then
|
|
|
+ -- 先脱
|
|
|
+ SkinLogic.skinOp(human, newIndex, 0)
|
|
|
+
|
|
|
+ -- 再穿
|
|
|
+ SkinLogic.skinOp(human, newIndex, nCreateHeroSkinId)
|
|
|
+ end
|
|
|
+
|
|
|
-- 发送给前端用来显示获得的英雄
|
|
|
local msgRet = Msg.gc.GC_HERO_TEN_ZHIHUAN
|
|
|
HeroGrid.makeHeroSimple(msgRet.heroSimple, newHeroGrid, newIndex, human)
|