2021-09-06 17:21:53 +08:00
|
|
|
|
QiJieShiLianManager = {}
|
|
|
|
|
local this = QiJieShiLianManager
|
|
|
|
|
local QijieHolyConfig = ConfigManager.GetConfig(ConfigName.QijieHolyConfig)
|
|
|
|
|
local QijieRanking = ConfigManager.GetConfig(ConfigName.QijieRanking)
|
|
|
|
|
local QijieStage = ConfigManager.GetConfig(ConfigName.QijieStage)
|
|
|
|
|
local QijieStageBuff = ConfigManager.GetConfig(ConfigName.QijieStageBuff)
|
|
|
|
|
local QijieTreasure = ConfigManager.GetConfig(ConfigName.QijieTreasure)
|
|
|
|
|
local QijieUpgrade = ConfigManager.GetConfig(ConfigName.QijieUpgrade)
|
2021-09-07 18:09:33 +08:00
|
|
|
|
local HeroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
|
2021-09-13 11:42:14 +08:00
|
|
|
|
local PassiveSkillConfig = ConfigManager.GetConfig(ConfigName.PassiveSkillConfig)
|
|
|
|
|
local PassiveSkillLogicConfig = ConfigManager.GetConfig(ConfigName.PassiveSkillLogicConfig)
|
2021-09-06 17:21:53 +08:00
|
|
|
|
|
|
|
|
|
function this.Initialize()
|
2021-09-07 18:09:33 +08:00
|
|
|
|
this.curLevelId = 3004
|
|
|
|
|
this.curRank = 999
|
|
|
|
|
this.curScore = 1
|
2021-09-10 10:30:50 +08:00
|
|
|
|
this.QijieType = 1
|
2021-09-08 16:26:40 +08:00
|
|
|
|
this.curProgress = 0
|
2021-09-16 21:05:43 +08:00
|
|
|
|
this.curMaxStage = 0
|
|
|
|
|
this.curLockStageId = 0
|
|
|
|
|
this.IsLock = false
|
2021-09-08 16:26:40 +08:00
|
|
|
|
|
|
|
|
|
this.treasureList = {}
|
2021-09-13 13:54:58 +08:00
|
|
|
|
this.treasureActiveList = {}
|
2021-09-08 16:26:40 +08:00
|
|
|
|
this.InitTreasureData()
|
2021-09-10 18:36:39 +08:00
|
|
|
|
this.battleResult = {}
|
2021-09-08 16:26:40 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.InitTreasureData()
|
|
|
|
|
for _, configInfo in ConfigPairs(QijieHolyConfig) do
|
|
|
|
|
if configInfo.Id ~= 0 then
|
|
|
|
|
local data = {}
|
|
|
|
|
data.Id = configInfo.Id
|
|
|
|
|
data.Name = configInfo.Name
|
|
|
|
|
data.Quality = configInfo.Quality
|
|
|
|
|
data.Icon = configInfo.Icon
|
2021-09-13 11:42:14 +08:00
|
|
|
|
data.Type = configInfo.Type
|
2021-09-08 16:26:40 +08:00
|
|
|
|
data.Position = configInfo.Position
|
2021-09-13 11:42:14 +08:00
|
|
|
|
data.AttriType = configInfo.AttriType
|
2021-09-08 16:26:40 +08:00
|
|
|
|
data.Cost = configInfo.Cost
|
2021-09-15 18:09:21 +08:00
|
|
|
|
-- data.ConditionValue[1][2] = configInfo.ConditionValue[1][2]
|
2021-09-13 11:42:14 +08:00
|
|
|
|
data.Desc = configInfo.Desc
|
|
|
|
|
data.Buff = configInfo.Buff
|
2021-09-10 10:30:50 +08:00
|
|
|
|
data.state = 2 --0未激活,1已激活,2未购买
|
2021-09-08 16:26:40 +08:00
|
|
|
|
this.treasureList[data.Id] = data
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-09-06 17:21:53 +08:00
|
|
|
|
end
|
|
|
|
|
|
2021-09-07 18:09:33 +08:00
|
|
|
|
--界面获取信息
|
2021-09-16 21:05:43 +08:00
|
|
|
|
function this.GetQiJieData()
|
2021-09-07 18:09:33 +08:00
|
|
|
|
--上阵列表赋值
|
2021-09-15 14:02:39 +08:00
|
|
|
|
local curFormation = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_NORMAL)
|
|
|
|
|
if FormationManager.GetFormationByID(FormationTypeDef.FORMATION_QIJIESHILIAN) then
|
2021-09-10 10:30:50 +08:00
|
|
|
|
curFormation = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_QIJIESHILIAN)
|
2021-09-15 14:02:39 +08:00
|
|
|
|
end
|
2021-09-07 18:09:33 +08:00
|
|
|
|
this.formationList ={}
|
|
|
|
|
for j = 1, #curFormation.teamHeroInfos do
|
2021-09-15 14:02:39 +08:00
|
|
|
|
this.formationList[j] = curFormation.teamHeroInfos[j]
|
2021-09-07 18:09:33 +08:00
|
|
|
|
end
|
|
|
|
|
--界面信息
|
|
|
|
|
local data = {}
|
|
|
|
|
data.curLevelId = this.curLevelId
|
|
|
|
|
data.curRank = this.curRank
|
|
|
|
|
data.curScore = this.curScore
|
2021-09-08 16:26:40 +08:00
|
|
|
|
data.curProgress = this.curProgress
|
2021-09-07 18:09:33 +08:00
|
|
|
|
data.curStageData = QijieStage[this.curLevelId]
|
|
|
|
|
return data
|
2021-09-06 17:21:53 +08:00
|
|
|
|
end
|
|
|
|
|
|
2021-09-10 10:30:50 +08:00
|
|
|
|
--获取服务器信息
|
|
|
|
|
function this.GetServerData(msg)
|
|
|
|
|
this.curLevelId = msg.id
|
|
|
|
|
this.curRank = msg.ranking
|
|
|
|
|
this.curScore = msg.integral
|
|
|
|
|
this.curProgress = msg.totalTier
|
2021-09-16 21:05:43 +08:00
|
|
|
|
this.curMaxStage = this.curMaxStage >= msg.id and this.curMaxStage or msg.id
|
|
|
|
|
-- LogRed("id:"..tostring(msg.id).." ranking:"..tostring(msg.ranking).." integral:"..tostring(msg.integral).." totalTier:"..tostring(msg.totalTier))
|
2021-09-07 18:09:33 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--获取下方滑动条数据
|
|
|
|
|
function this.GetTabList()
|
|
|
|
|
local tabList = {}
|
|
|
|
|
for _, configInfo in ConfigPairs(QijieStage) do
|
|
|
|
|
if not tabList[configInfo.QijieType] then
|
|
|
|
|
tabList[configInfo.QijieType] = configInfo
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return tabList
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--检测该条目是否达成
|
2021-09-10 15:23:15 +08:00
|
|
|
|
function this.CheckGoalIsFinish(_dataId,_obj,_formationList)
|
2021-09-07 18:09:33 +08:00
|
|
|
|
local goalData = QijieUpgrade[_dataId]
|
|
|
|
|
local tempList = {}
|
|
|
|
|
local final = true
|
2021-09-10 15:23:15 +08:00
|
|
|
|
local heroList = {}
|
|
|
|
|
-- LogRed("Id:"..tostring(goalData.Id).." Describe:"..tostring(goalData.Describe).." PropertyName:"..tostring(goalData.PropertyName).." Profession:"..tostring(goalData.Profession).." Min:"..tostring(goalData.Min).." Max:"..tostring(goalData.Max))
|
|
|
|
|
heroList = _formationList and _formationList or this.formationList
|
|
|
|
|
if #heroList == 0 then
|
|
|
|
|
-- LogYellow("final = false0")
|
|
|
|
|
final = false
|
|
|
|
|
end
|
2021-09-15 18:09:21 +08:00
|
|
|
|
-- LogRed("##heroList:"..tostring(#heroList))
|
2021-09-10 15:23:15 +08:00
|
|
|
|
for i = 1, #heroList do
|
2021-09-15 18:09:21 +08:00
|
|
|
|
-- LogGreen("heroList[i].heroId:"..tostring(heroList[i].heroId))
|
2021-09-10 15:23:15 +08:00
|
|
|
|
table.insert(tempList,HeroConfig[HeroManager.GetSingleHeroData(heroList[i].heroId).id])
|
2021-09-07 18:09:33 +08:00
|
|
|
|
end
|
2021-09-10 15:23:15 +08:00
|
|
|
|
if #tempList > 0 and final and goalData.PropertyName and goalData.PropertyName > 0 then
|
2021-09-07 18:09:33 +08:00
|
|
|
|
for i = #tempList, 1,-1 do
|
|
|
|
|
if goalData.PropertyName ~= tempList[i].PropertyName then
|
|
|
|
|
table.remove(tempList,i)
|
2021-09-10 15:23:15 +08:00
|
|
|
|
if #tempList == 0 then
|
|
|
|
|
final = true
|
|
|
|
|
end
|
2021-09-07 18:09:33 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-09-10 10:30:50 +08:00
|
|
|
|
-- LogGreen("#tempList1:"..tostring(#tempList))
|
2021-09-10 15:23:15 +08:00
|
|
|
|
if #tempList > 0 and final and goalData.Profession and goalData.Profession > 0 then
|
2021-09-07 18:09:33 +08:00
|
|
|
|
for i = #tempList, 1,-1 do
|
|
|
|
|
if goalData.Profession ~= tempList[i].Profession then
|
|
|
|
|
table.remove(tempList,i)
|
2021-09-10 15:23:15 +08:00
|
|
|
|
if #tempList == 0 then
|
|
|
|
|
final = true
|
|
|
|
|
end
|
2021-09-07 18:09:33 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-09-10 10:30:50 +08:00
|
|
|
|
-- LogGreen("#tempList1:"..tostring(#tempList))
|
2021-09-10 15:23:15 +08:00
|
|
|
|
if final and goalData.Min and goalData.Min >= 0 then
|
2021-09-07 18:09:33 +08:00
|
|
|
|
if #tempList < goalData.Min then
|
2021-09-10 10:30:50 +08:00
|
|
|
|
-- LogYellow("final = false1")
|
2021-09-07 18:09:33 +08:00
|
|
|
|
final = false
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-09-10 15:23:15 +08:00
|
|
|
|
if final and goalData.Max and goalData.Max >= 0 then
|
2021-09-07 18:09:33 +08:00
|
|
|
|
if #tempList > goalData.Max then
|
2021-09-10 10:30:50 +08:00
|
|
|
|
-- LogYellow("final = false2")
|
2021-09-07 18:09:33 +08:00
|
|
|
|
final = false
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
_obj.text = string.format( "<color=#BAAF98>%s</color>",goalData.Describe)
|
|
|
|
|
if final then
|
|
|
|
|
_obj.text = string.format( "<color=#27DD65>%s</color>",goalData.Describe)
|
|
|
|
|
end
|
|
|
|
|
return final
|
|
|
|
|
end
|
|
|
|
|
|
2021-09-10 10:30:50 +08:00
|
|
|
|
--把服务器发来的遗物数据加到本地数据中
|
|
|
|
|
function this.MixTreasureServerAndLocalData(msg)
|
2021-09-17 19:57:45 +08:00
|
|
|
|
this.treasureActiveList = {}
|
2021-09-10 15:23:15 +08:00
|
|
|
|
for i = 1, #msg.info do
|
2021-09-17 19:57:45 +08:00
|
|
|
|
table.insert(this.treasureActiveList,msg.info[i].id)
|
2021-09-10 15:23:15 +08:00
|
|
|
|
if this.treasureList[msg.info[i].id] then
|
|
|
|
|
this.treasureList[msg.info[i].id].state = msg.info[i].status
|
2021-09-10 10:30:50 +08:00
|
|
|
|
else
|
2021-09-10 15:23:15 +08:00
|
|
|
|
LogError("服务器发来了前端不存在的遗物Id:"..tostring(msg.info[i].id))
|
2021-09-10 10:30:50 +08:00
|
|
|
|
end
|
2021-09-08 16:26:40 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
2021-09-07 18:09:33 +08:00
|
|
|
|
|
2021-09-08 17:32:48 +08:00
|
|
|
|
--把1维的List换成2维的。并且增加稀有度条件
|
|
|
|
|
function this.FormatTreasureData(_tabNum)
|
|
|
|
|
local list = {}
|
|
|
|
|
for k,v in pairs(this.treasureList) do
|
2021-09-17 19:29:58 +08:00
|
|
|
|
table.insert(list,v)
|
2021-09-08 17:32:48 +08:00
|
|
|
|
end
|
2021-09-17 19:29:58 +08:00
|
|
|
|
if _tabNum and _tabNum > 0 then
|
|
|
|
|
for i = #list, 1,-1 do
|
|
|
|
|
if list[i].Quality ~= _tabNum then
|
|
|
|
|
table.remove(list,i)
|
2021-09-08 17:32:48 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
local num = math.ceil( LengthOfTable(list)/4 )
|
2021-09-08 16:26:40 +08:00
|
|
|
|
local dataList = {}
|
|
|
|
|
for i = 1, num do
|
|
|
|
|
dataList[i] = {}
|
|
|
|
|
for j = 1, 4 do
|
2021-09-08 17:32:48 +08:00
|
|
|
|
if list[(i-1)*4+j] then
|
|
|
|
|
dataList[i][j] = list[(i-1)*4+j]
|
2021-09-08 16:26:40 +08:00
|
|
|
|
else
|
|
|
|
|
return dataList
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return dataList
|
|
|
|
|
end
|
2021-09-07 18:09:33 +08:00
|
|
|
|
|
2021-09-11 15:47:19 +08:00
|
|
|
|
--获取战斗结束后信息(拼接)
|
2021-09-10 18:36:39 +08:00
|
|
|
|
function this.GetBattleResult()
|
|
|
|
|
local config = QijieStage[this.curLevelId]
|
|
|
|
|
local data = {}
|
2021-09-17 13:42:27 +08:00
|
|
|
|
data[1] = "<color=#F9E7D3>阵容加成:</color> <color=#3DE181>"..(#this.battleResult.teamBuffIds)*(config.ConditionValue[1][2]/100).."%</color>\n<color=#AE7B20>("..#this.battleResult.teamBuffIds.."条)</color>"
|
|
|
|
|
data[2] = "<color=#F9E7D3>遗物加成:</color> <color=#3DE181>"..(#this.battleResult.relicIds*10).."%</color>\n<color=#AE7B20>("..#this.battleResult.relicIds.."个)</color>"
|
2021-09-10 18:36:39 +08:00
|
|
|
|
local bonue = config.RoundReward[1][2]
|
|
|
|
|
for i = 1, #config.RoundReward do
|
|
|
|
|
if this.battleResult.round > config.RoundReward[i][1] then
|
|
|
|
|
bonue = config.RoundReward[i][2]
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-09-17 13:42:27 +08:00
|
|
|
|
data[3] = "<color=#F9E7D3>回合加成:</color> <color=#3DE181>"..(bonue/100).."%</color>\n<color=#AE7B20>("..this.battleResult.round.."回合)</color>"
|
2021-09-10 18:36:39 +08:00
|
|
|
|
return data
|
|
|
|
|
end
|
|
|
|
|
|
2021-09-11 15:47:19 +08:00
|
|
|
|
--获取遗物效果
|
|
|
|
|
function this.GetTreasureEffect(treasureList)
|
|
|
|
|
local moneyString = ""
|
|
|
|
|
local attriString = ""
|
2021-09-13 11:42:14 +08:00
|
|
|
|
local attriTitle = ""
|
|
|
|
|
local moneyNum = 0
|
|
|
|
|
local attriList1 = {}
|
|
|
|
|
local attriList2 = {}
|
2021-09-17 19:57:45 +08:00
|
|
|
|
LogYellow(tostring(#treasureList))
|
2021-09-13 11:42:14 +08:00
|
|
|
|
for i = 1, #treasureList do
|
2021-09-17 19:57:45 +08:00
|
|
|
|
LogYellow(tostring(treasureList[i]))
|
2021-09-13 11:42:14 +08:00
|
|
|
|
local tData = QijieHolyConfig[treasureList[i]]
|
|
|
|
|
--界灵数量加成
|
2021-09-15 18:09:21 +08:00
|
|
|
|
moneyNum = moneyNum + tData.Addition
|
2021-09-13 18:06:39 +08:00
|
|
|
|
-- LogYellow("moneyNum"..tostring(moneyNum))
|
2021-09-13 11:42:14 +08:00
|
|
|
|
--属性加成
|
|
|
|
|
if not attriList1[tData.AttriType] then
|
2021-09-13 18:06:39 +08:00
|
|
|
|
-- LogGreen("1")
|
2021-09-13 11:42:14 +08:00
|
|
|
|
attriList1[tData.AttriType] = {}
|
|
|
|
|
end
|
2021-09-13 18:06:39 +08:00
|
|
|
|
-- LogGreen("2")
|
2021-09-13 11:42:14 +08:00
|
|
|
|
attriList1[tData.AttriType].title = tData.Desc
|
|
|
|
|
if not attriList1[tData.AttriType].ValueList then
|
2021-09-16 21:05:43 +08:00
|
|
|
|
-- LogGreen("3,tData.AttriType:"..tostring(tData.AttriType))
|
2021-09-13 11:42:14 +08:00
|
|
|
|
attriList1[tData.AttriType].ValueList = {}
|
|
|
|
|
end
|
2021-09-13 18:06:39 +08:00
|
|
|
|
-- LogGreen("4,tData.Buff:"..tostring(tData.Buff))
|
2021-09-13 11:42:14 +08:00
|
|
|
|
table.insert(attriList1[tData.AttriType].ValueList,tData)
|
|
|
|
|
end
|
|
|
|
|
for k,v in pairs(attriList1) do
|
|
|
|
|
for m,n in pairs(v.ValueList) do
|
|
|
|
|
local buffData = PassiveSkillLogicConfig[n.Buff]
|
|
|
|
|
if not attriList2[k] then
|
|
|
|
|
attriList2[k] = {}
|
|
|
|
|
end
|
|
|
|
|
attriList2[k].title = attriList1[k].title
|
2021-09-13 18:06:39 +08:00
|
|
|
|
-- LogGreen("5,Desc:"..tostring(attriList2[k].title))
|
2021-09-13 11:42:14 +08:00
|
|
|
|
if not attriList2[k][buffData.Value[1]] then
|
|
|
|
|
attriList2[k][buffData.Value[1]] = {}
|
|
|
|
|
end
|
2021-09-13 18:06:39 +08:00
|
|
|
|
-- LogYellow("Desc:"..tostring(PassiveSkillConfig[n.Buff].Desc))
|
2021-09-13 11:42:14 +08:00
|
|
|
|
attriList2[k][buffData.Value[1]].Desc = PassiveSkillConfig[n.Buff].Desc
|
|
|
|
|
if attriList2[k][buffData.Value[1]].Value then
|
|
|
|
|
attriList2[k][buffData.Value[1]].Value = attriList2[k][buffData.Value[1]].Value + tonumber(PassiveSkillConfig[n.Buff].DescValue[1])/100
|
|
|
|
|
else
|
|
|
|
|
attriList2[k][buffData.Value[1]].Value = tonumber(PassiveSkillConfig[n.Buff].DescValue[1])/100
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
moneyString = string.format( "挑战获得界灵数量<color=#4ab47a>+%s</color>",tostring(moneyNum/100).."%")
|
|
|
|
|
return moneyString,attriList2
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.GetSring(stringList,type)
|
|
|
|
|
local str = ""
|
|
|
|
|
for k,v in pairs(stringList) do
|
2021-09-13 18:06:39 +08:00
|
|
|
|
-- LogPink("Desc1:"..tostring(v.title))
|
2021-09-13 11:42:14 +08:00
|
|
|
|
str = str..v.title
|
|
|
|
|
for m,n in pairs(v) do
|
|
|
|
|
if tonumber(m) then
|
2021-09-13 18:06:39 +08:00
|
|
|
|
-- LogBlue("m2:"..tostring(tonumber(m)))
|
|
|
|
|
-- LogBlue("Desc2:"..tostring(n.Desc))
|
|
|
|
|
-- LogBlue("Value2:"..tostring(n.Value))
|
2021-09-13 11:42:14 +08:00
|
|
|
|
str = str..string.format(n.Desc,"<color=#d70f09>"..n.Value.."%</color>")
|
|
|
|
|
if type and type == 1 then
|
|
|
|
|
str = str.."\n"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return str
|
2021-09-11 15:47:19 +08:00
|
|
|
|
end
|
|
|
|
|
|
2021-09-16 21:05:43 +08:00
|
|
|
|
--左右切换检测
|
|
|
|
|
function this.SwitchBtnCheck(num,func)
|
|
|
|
|
if num == -1 then
|
|
|
|
|
this.IsLock = true
|
|
|
|
|
if not QijieStage[this.curLockStageId - 1] then
|
2021-09-17 13:42:27 +08:00
|
|
|
|
-- LogPink("最低层"..this.curLockStageId)
|
2021-09-16 21:05:43 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
this.curLockStageId = this.curLockStageId - 1
|
|
|
|
|
elseif num == 1 then
|
|
|
|
|
if not QijieStage[this.curLockStageId + 1] then
|
2021-09-17 13:42:27 +08:00
|
|
|
|
-- LogPink("最高层"..this.curLockStageId)
|
2021-09-16 21:05:43 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
if this.curLockStageId + 1 > this.curMaxStage then
|
2021-09-17 13:42:27 +08:00
|
|
|
|
-- LogPink("最大层"..this.curLockStageId.." "..this.curMaxStage)
|
2021-09-16 21:05:43 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
if this.curMaxStage == this.curLevelId then
|
|
|
|
|
this.IsLock = false
|
|
|
|
|
end
|
|
|
|
|
this.curLockStageId = this.curLockStageId + 1
|
|
|
|
|
end
|
2021-09-17 13:42:27 +08:00
|
|
|
|
-- LogYellow("请求的Id:"..tostring(this.curLockStageId))
|
2021-09-16 21:05:43 +08:00
|
|
|
|
NetManager.SevenWorldInfoRequest(this.curLockStageId,function ()
|
|
|
|
|
if func then
|
|
|
|
|
func()
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
2021-09-06 17:21:53 +08:00
|
|
|
|
return QiJieShiLianManager
|