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) 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.trumpList,singBookData.maxLv,singBookData.lv,singBookData.skillList = this.GetTailsmanSoulDataById(singBookData.id) singBookData.skillConfig = v.SkillList table.insert(datas,singBookData) end end return datas 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 = {} for k,v in pairs(this.TailsmanList) do 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 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 heroConfig[_heroData.tId].PropertyName == 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.CheckRedData(red) local list = {} if red == RedPointType.tailsmanSoul_gold then list = this.GetTailsmanSoulDatas(5) elseif red == RedPointType.tailsmanSoul_red then list = this.GetTailsmanSoulDatas(6) elseif red == RedPointType.tailsmanSoul_whiteGold then list = this.GetTailsmanSoulDatas(7) end 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