miduo_client/Assets/ManagedResources/~Lua/Modules/TailsManSoul/TailsManSoulManager.lua

161 lines
5.6 KiB
Lua
Raw Normal View History

2021-11-11 16:48:15 +08:00
TailsManSoulManager = {}
local this = TailsManSoulManager
2021-11-15 18:24:39 +08:00
local trumpBook = ConfigManager.GetConfig(ConfigName.TrumpBook)
local Trump = ConfigManager.GetConfig(ConfigName.Trump)
local TrumpLevelupPool = ConfigManager.GetConfig(ConfigName.TrumpLevelupPool)
2021-11-19 11:33:34 +08:00
local passiveSkillConfig = ConfigManager.GetConfig(ConfigName.XiuXianSkillConfig)
2021-11-22 15:02:42 +08:00
local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
2021-11-15 18:24:39 +08:00
this.TailsmanList = {}
2021-11-11 16:48:15 +08:00
function this.Initialize()
end
2021-11-15 18:24:39 +08:00
--法宝之魂界面列表数据
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)
2021-11-16 15:24:17 +08:00
singBookData.skillConfig = v.SkillList
2021-11-15 18:24:39 +08:00
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
2021-11-22 11:01:43 +08:00
skillList[trumpBook[id].SkillList[i][1]] = string.format("四种法宝之灵全部到达%s星:\n%s",trumpBook[id].SkillList[i][1],GetSkillConfigDesc(passiveSkillConfig[trumpBook[id].SkillList[i][2]]))
2021-11-15 18:24:39 +08:00
end
return trumpList,maxLv,lv,skillList
end
--根据法宝id 获取法宝等级
function this.GetTailsmanLvById(id)
return this.TailsmanList[id] or 0
end
2021-11-16 09:33:10 +08:00
function this.SetTailsmanLv(data)
for i = 1,#data do
this.SetTailsmanLvById(data[i].id,data[i].level)
end
2021-11-16 15:24:17 +08:00
HeroPropManager.SetFuncPropDirty(Func_Prop_Type.TailsManSou)
2021-11-22 15:02:42 +08:00
local herodata = HeroManager.GetAllHeroList()
for k,v in pairs(herodata) do
HeroPropManager.SetDirtyByType(v.dynamicId, Hero_Prop_Type.TailsManSou)
end
2021-11-16 09:33:10 +08:00
end
2021-11-15 18:24:39 +08:00
--根据法宝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()
2021-11-16 15:24:17 +08:00
local datas = this.GetTailsmanSoulDatas()
local data = {}
for i = 1,#datas do
for j = 1,#datas[i].skillConfig do
2021-11-22 15:02:42 +08:00
if datas[i].lv >= datas[i].skillConfig[j][1] then
2021-11-16 15:24:17 +08:00
table.insert(data,datas[i].skillConfig[j][2])
end
end
end
return data
2021-11-15 18:24:39 +08:00
end
2021-11-22 15:02:42 +08:00
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
2021-11-15 18:24:39 +08:00
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
2021-11-11 16:48:15 +08:00
end
return this