TailsManSoulManager = {} local this = TailsManSoulManager local trumpBook = ConfigManager.GetConfig(ConfigName.TrumpBook) local Trump = ConfigManager.GetConfig(ConfigName.Trump) local TrumpLevelupPool = ConfigManager.GetConfig(ConfigName.TrumpLevelupPool) local passiveSkillConfig = ConfigManager.GetConfig(ConfigName.XiuXianSkillConfig) local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig) local propertyConfig=ConfigManager.GetConfig(ConfigName.PropertyConfig) this.TailsmanList = {} function this.Initialize() end --法宝之魂界面列表数据 function this.GetTailsmanSoulDatas(qua) local datas = {} for k,v in ConfigPairs(trumpBook) do if not qua or (qua and qua > 0 and qua == v.Quality) then local singBookData = {} singBookData.id = v.Id singBookData.name = v.Name singBookData.icon = v.Icon singBookData.quality = v.Quality singBookData.PropertyName = v.PropertyName singBookData.trumpList,singBookData.maxLv,singBookData.lv,singBookData.skillList = this.GetTailsmanSoulDataById(singBookData.id) singBookData.trumpChipList = v.ItemList singBookData.skillConfig = v.SkillList table.insert(datas,singBookData) end end return datas end --根据职业获取法宝之魂界面列表数据 function this.GetTailsmanSoulDatasByPro(pro) local datas = {} for k,v in ConfigPairs(trumpBook) do if v.PropertyName==pro then local singBookData = {} singBookData.id = v.Id singBookData.name = v.Name singBookData.icon = v.Icon singBookData.quality = v.Quality singBookData.PropertyName = v.PropertyName singBookData.trumpList,singBookData.maxLv,singBookData.lv,singBookData.skillList = this.GetTailsmanSoulDataById(singBookData.id) singBookData.trumpChipList = v.ItemList singBookData.skillConfig = v.SkillList table.insert(datas,singBookData) end end return datas end --法宝之魂界面列表数据 function this.GetTailsmanSoulDatas1(qua) local datas = this.GetTailsmanSoulDatas(qua) local datas1 = {} for i = 1,#datas do local isup = false for j = 1,#datas[i].trumpList do if datas[i].trumpList[j].config.CanUp and datas[i].trumpList[j].config.CanUp == 1 then isup = true break end end if isup then table.insert(datas1,datas[i]) end end return datas1 end --根据法宝之魂id 获取 法宝之魂数据 function this.GetTailsmanSoulDataById(id) local skillList = {} local trumpList = {} local lv = -1 local maxLv = -1 for i = 1,#trumpBook[id].TrumpList do trumpList[i] = {} trumpList[i].id = trumpBook[id].TrumpList[i] trumpList[i].lv = this.GetTailsmanLvById(trumpBook[id].TrumpList[i]) trumpList[i].config = Trump[trumpBook[id].TrumpList[i]] if lv > trumpList[i].lv or lv < 0 then lv = trumpList[i].lv end if maxLv > trumpList[i].config.LvMax or maxLv < 0 then maxLv = trumpList[i].config.LvMax end end for i = 1,#trumpBook[id].SkillList do if not skillList[trumpBook[id].SkillList[i][1]] then skillList[trumpBook[id].SkillList[i][1]] = "" end skillList[trumpBook[id].SkillList[i][1]] = string.format("四种羁绊全部到达%s星:\n%s",trumpBook[id].SkillList[i][1],GetSkillConfigDesc(passiveSkillConfig[trumpBook[id].SkillList[i][2]])) end return trumpList,maxLv,lv,skillList end --根据法宝id 获取法宝等级 function this.GetTailsmanLvById(id) return this.TailsmanList[id] or 0 end function this.SetTailsmanLv(data) for i = 1,#data do this.SetTailsmanLvById(data[i].id,data[i].level) end HeroPropManager.SetFuncPropDirty(Func_Prop_Type.TailsManSou) local herodata = HeroManager.GetAllHeroList() for k,v in pairs(herodata) do HeroPropManager.SetDirtyByType(v.dynamicId, Hero_Prop_Type.TailsManSou) end end --根据法宝id 获取设置等级 function this.SetTailsmanLvById(id,lv) if not this.TailsmanList[id] then this.TailsmanList[id] = 0 end this.TailsmanList[id] = lv end function this.GetTailsmanTotalPro() local proList = {} local special=ConfigManager.GetConfigData(ConfigName.SpecialConfig,177) local num=tonumber(special.Value)/10000 for k,v in pairs(this.TailsmanList) do --LogError("Trump[k].LvupPool==========="..Trump[k].LvupPool.." level==="..v) local tempPro = ConfigManager.GetConfigDataByDoubleKey(ConfigName.TrumpLevelupPool,"PoolId",Trump[k].LvupPool,"Level",v).LvupProps if tempPro then for i = 1,#tempPro do if not proList[tempPro[i][1]] then proList[tempPro[i][1]] = 0 end proList[tempPro[i][1]] = proList[tempPro[i][1]] + tempPro[i][2] end end end --获取所有技能加成属性 local addLv=0 for i=1,5 do local curData = TailsManSoulManager.GetTailsmanSoulDatasByPro(i) for j=1,#curData do --LogError("curData.lv=========="..curData[j].lv) if curData[j].lv>0 then addLv=addLv+curData[j].lv end end end --屏蔽星数加成属性 -- local tempPro = this.GetTotalStarPro() -- if tempPro then -- for i = 1,#tempPro do -- if not proList[tempPro[i][1]] then -- proList[tempPro[i][1]] = 0 -- end -- proList[tempPro[i][1]] = proList[tempPro[i][1]] + tempPro[i][2] -- end -- end -- for k, v in pairs(proList) do -- LogError("属性 v========================================="..v) -- end -- LogError("addlv============================"..addLv) if addLv>0 then for k, v in pairs(proList) do if propertyConfig[k].Style==1 then proList[k]=math.floor(v*(1+addLv*num)+0.5) end end end return proList end function this.GetTailsmanTotalProNoAdd() local proList = {} local special=ConfigManager.GetConfigData(ConfigName.SpecialConfig,177) local num=tonumber(special.Value)/10000 for k,v in pairs(this.TailsmanList) do --LogError("Trump[k].LvupPool==========="..Trump[k].LvupPool.." level==="..v) local tempPro = ConfigManager.GetConfigDataByDoubleKey(ConfigName.TrumpLevelupPool,"PoolId",Trump[k].LvupPool,"Level",v).LvupProps if tempPro then for i = 1,#tempPro do if not proList[tempPro[i][1]] then proList[tempPro[i][1]] = 0 end proList[tempPro[i][1]] = proList[tempPro[i][1]] + tempPro[i][2] end end end --屏蔽星数加成属性 -- local tempPro = this.GetTotalStarPro() -- if tempPro then -- for i = 1,#tempPro do -- if not proList[tempPro[i][1]] then -- proList[tempPro[i][1]] = 0 -- end -- proList[tempPro[i][1]] = proList[tempPro[i][1]] + tempPro[i][2] -- end -- end -- for k, v in pairs(proList) do -- LogError("属性 v========================================="..v) -- end -- LogError("addlv============================"..addLv) return proList end function this.GetTailsmanCost(id,lv) local num = ConfigManager.GetConfigDataByDoubleKey(ConfigName.TrumpLevelupPool,"PoolId",Trump[id].LvupPool,"Level",lv).LvupCostItemNum local costId = Trump[id].LvupCostItem return costId,num end function this.GetTailsmanPassivePower() local datas = this.GetTailsmanSoulDatas() local data = {} for i = 1,#datas do for j = 1,#datas[i].skillConfig do if datas[i].lv == datas[i].skillConfig[j][1] then table.insert(data,datas[i].skillConfig[j][2]) end end end return data end function this.GetTailsmanPassivePower1(_heroData) local idList = {} local SingleProVal = this.GetTailsmanPassivePower() if SingleProVal and #SingleProVal > 0 then --talismanConFig.OpenSkillRules and #talismanConFig.OpenSkillRules > 0 then for i = 1,#SingleProVal do if passiveSkillConfig[SingleProVal[i]] then local config = passiveSkillConfig[SingleProVal[i]] if config.FitList[1] == 0 or (config.FitList[1] == 1 and _heroData.zhenYingId == config.FitList[2]) or (config.FitList[1] == 2 and heroConfig[_heroData.tId].Profession == config.FitList[2]) then for i = 1,#config.SkillId do table.insert(idList,config.SkillId[i]) end end end end end return idList end function this.GetTotalStar() local star = 0 for k,v in pairs(this.TailsmanList) do star = star + v end return star end function this.GetTotalStarPro() local star = this.GetTotalStar() local data = {} for k,v in ConfigPairs(ConfigManager.GetConfig(ConfigName.TrumpStar)) do if star < v.StarNum then break end data = v.PropList end return data end function this.CheckRedData(red) local list = {} local pro=1 if red == RedPointType.tailsmanSoul_gold then pro=1 elseif red == RedPointType.tailsmanSoul_red then pro=2 elseif red == RedPointType.tailsmanSoul_whiteGold then pro=3 elseif red == RedPointType.tailsmanSoul_blue then pro=4 elseif red == RedPointType.tailsmanSoul_whiteBlue then pro=5 end list = this.GetTailsmanSoulDatasByPro(pro) for i = 1,#list do if list[i] and list[i].trumpList then for k,v in pairs(list[i].trumpList) do local costId,num = this.GetTailsmanCost(v.id,v.lv) if num and num > 0 then if BagManager.GetItemCountById(costId) >= num then return true end end end end end return false end return this