2021-05-10 10:06:53 +08:00
|
|
|
CommonActPageManager = {}
|
2021-04-16 14:58:40 +08:00
|
|
|
local this = CommonActPageManager
|
2021-04-16 16:21:34 +08:00
|
|
|
local dataList = {}
|
2021-04-25 15:07:36 +08:00
|
|
|
this.TaSuiLingXiaoMsg = nil
|
2021-04-26 16:20:22 +08:00
|
|
|
this.TaSuiLingXiaoHistoryDmg = 0
|
2021-04-16 14:58:40 +08:00
|
|
|
|
|
|
|
function this.Initialize()
|
|
|
|
end
|
|
|
|
|
2021-04-20 11:17:50 +08:00
|
|
|
--初始化活动的特殊数据
|
2021-04-21 11:37:55 +08:00
|
|
|
local TypeUpdateFunc = {
|
2021-04-20 11:17:50 +08:00
|
|
|
[ActivityTypeDef.YunYouShangRen] = function ()
|
|
|
|
local curData = dataList[ActivityTypeDef.YunYouShangRen]
|
|
|
|
local configData = ConfigManager.GetAllConfigsDataByKey(ConfigName.ComposeActivity,"ActivityId",curData.activityId)
|
|
|
|
for i = 1, #curData.rewards do
|
|
|
|
for j = 1, #configData do
|
|
|
|
if curData.rewards[i].missionId == configData[j].Id then
|
|
|
|
curData.rewards[i].otherData.needItems = configData[j].NeedItems
|
|
|
|
curData.rewards[i].otherData.count = configData[j].Count
|
|
|
|
curData.rewards[i].otherData.composeType = configData[j].ComposeType
|
|
|
|
curData.rewards[i].otherData.selectId = 0
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2021-04-21 11:37:55 +08:00
|
|
|
table.sort(dataList[ActivityTypeDef.YunYouShangRen].rewards,function (a,b)
|
2021-04-27 20:44:45 +08:00
|
|
|
if a.progress == 0 and b.progress > 0 then
|
|
|
|
return false
|
2021-04-21 11:37:55 +08:00
|
|
|
end
|
2021-04-27 20:44:45 +08:00
|
|
|
if a.progress > 0 and b.progress == 0 then
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
return a.missionId < b.missionId
|
|
|
|
-- if a.progress == b.progress then
|
|
|
|
-- else
|
|
|
|
-- return a.progress > b.progress
|
|
|
|
-- end
|
2021-04-21 11:37:55 +08:00
|
|
|
end)
|
2021-04-20 20:32:36 +08:00
|
|
|
end,
|
|
|
|
[ActivityTypeDef.ContinuityRecharge] = function ()
|
|
|
|
this.GetExpertData(3,ActivityTypeDef.ContinuityRecharge)
|
|
|
|
end,
|
|
|
|
[ActivityTypeDef.UpStarExper] = function ()--进阶达人
|
|
|
|
this.GetExpertData(1,ActivityTypeDef.UpStarExper)
|
|
|
|
end,
|
|
|
|
[ActivityTypeDef.Talisman] = function ()--法宝达人
|
|
|
|
this.GetExpertData(1,ActivityTypeDef.Talisman)
|
|
|
|
end,
|
|
|
|
[ActivityTypeDef.SoulPrint] = function ()--魂印达人
|
|
|
|
this.GetExpertData(1,ActivityTypeDef.SoulPrint)
|
|
|
|
end,
|
|
|
|
[ActivityTypeDef.EquipExper] = function ()--装备达人
|
|
|
|
this.GetExpertData(1,ActivityTypeDef.EquipExper)
|
|
|
|
end,
|
|
|
|
[ActivityTypeDef.EnergyExper] = function ()--体力达人
|
|
|
|
this.GetExpertData(2,ActivityTypeDef.EnergyExper)
|
|
|
|
end,
|
|
|
|
[ActivityTypeDef.FindTreasureExper] = function ()--寻宝达人
|
|
|
|
this.GetExpertData(1,ActivityTypeDef.FindTreasureExper)
|
|
|
|
end,
|
|
|
|
[ActivityTypeDef.ExpeditionExper] = function ()--天宫达人
|
|
|
|
this.GetExpertData(1,ActivityTypeDef.ExpeditionExper)
|
|
|
|
end,
|
|
|
|
[ActivityTypeDef.FastExplore] = function ()--极速达人
|
|
|
|
this.GetExpertData(2,ActivityTypeDef.FastExplore)
|
|
|
|
end,
|
|
|
|
[ActivityTypeDef.GoldExper] = function ()--点金达人
|
|
|
|
this.GetExpertData(2,ActivityTypeDef.GoldExper)
|
|
|
|
end,
|
|
|
|
[ActivityTypeDef.FightExper] = function ()--副本达人
|
|
|
|
this.GetExpertData(2,ActivityTypeDef.FightExper)
|
|
|
|
end,
|
|
|
|
[ActivityTypeDef.AreaExper] = function ()
|
|
|
|
this.GetExpertData(2,ActivityTypeDef.AreaExper)
|
|
|
|
end,
|
|
|
|
[ActivityTypeDef.slhjExper] = function ()--森罗幻境达人
|
|
|
|
this.GetExpertData(2,ActivityTypeDef.slhjExper)
|
|
|
|
end,
|
|
|
|
[ActivityTypeDef.LuckyTurnExper] = function ()--探宝达人
|
|
|
|
this.GetExpertData(2,ActivityTypeDef.LuckyTurnExper)
|
|
|
|
end,
|
|
|
|
[ActivityTypeDef.RecruitExper] = function ()--征募达人
|
|
|
|
this.GetExpertData(2,ActivityTypeDef.RecruitExper)
|
|
|
|
end,
|
|
|
|
[ActivityTypeDef.SecretBoxExper] = function ()--秘宝达人
|
|
|
|
this.GetExpertData(2,ActivityTypeDef.SecretBoxExper)
|
|
|
|
end,
|
|
|
|
[ActivityTypeDef.AccumulativeRechargeExper] = function ()---日累计充值
|
|
|
|
this.GetExpertData(2,ActivityTypeDef.AccumulativeRechargeExper)
|
|
|
|
end,
|
|
|
|
[ActivityTypeDef.UpLvAct] = function ()---日累计充值
|
2021-05-19 10:30:50 +08:00
|
|
|
this.GetMissionData(2,ActivityTypeDef.UpLvAct)
|
2021-05-10 10:06:53 +08:00
|
|
|
end,
|
|
|
|
[ActivityTypeDef.DynamicAct_recharge] = function ()---周累计充值
|
|
|
|
this.GetMissionData(1,ActivityTypeDef.DynamicAct_recharge)
|
2021-04-20 20:32:36 +08:00
|
|
|
end,
|
2021-04-23 15:39:46 +08:00
|
|
|
[ActivityTypeDef.TaSuiLingXiao] = function ()--踏碎凌霄
|
|
|
|
local curData = dataList[ActivityTypeDef.TaSuiLingXiao]
|
|
|
|
local configData = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig,"ActivityId",curData.activityId)
|
|
|
|
for i = 1, #curData.rewards do
|
|
|
|
for j = 1, #configData do
|
|
|
|
if curData.rewards[i].missionId == configData[j].Id then
|
2021-04-25 15:07:36 +08:00
|
|
|
curData.rewards[i].otherData.Values = configData[j].Values
|
|
|
|
curData.rewards[i].otherData.Reward = configData[j].Reward
|
|
|
|
curData.rewards[i].otherData.Sort = configData[j].Sort
|
2021-04-23 15:39:46 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2021-04-27 18:02:51 +08:00
|
|
|
|
|
|
|
table.sort(curData.rewards,function (a,b)
|
|
|
|
if a.state == b.state then
|
|
|
|
return a.missionId < b.missionId
|
|
|
|
else
|
|
|
|
return a.state < b.state
|
|
|
|
end
|
|
|
|
end)
|
2021-05-10 10:06:53 +08:00
|
|
|
end,
|
|
|
|
[ActivityTypeDef.DynamicAct] = function ()--主题活动任务
|
|
|
|
local curData = dataList[ActivityTypeDef.DynamicAct]
|
|
|
|
this.InitTaskData(curData,TaskTypeDef.DynamicActTask,ConfigName.ThemeActivityTaskConfig)
|
|
|
|
end,
|
2021-04-20 11:17:50 +08:00
|
|
|
}
|
|
|
|
|
2021-05-10 10:06:53 +08:00
|
|
|
function this.InitTaskData(curData,taskType,configName)
|
|
|
|
local allListData = ConfigManager.GetAllConfigsDataByKey(configName, "ActivityId", curData.activityId)
|
|
|
|
local allMissionData = TaskManager.GetTypeTaskList(taskType)
|
|
|
|
for i=1,#allListData do
|
|
|
|
for j=1,#allMissionData do
|
|
|
|
if allListData[i].Id == allMissionData[j].missionId then
|
|
|
|
local data = {}
|
|
|
|
data.missionId = allMissionData[j].missionId
|
|
|
|
data.taskType = taskType
|
|
|
|
local strs = string.split(GetLanguageStrById(allListData[i].Show),"#")
|
|
|
|
data.progress = allMissionData[j].progress
|
|
|
|
data.value = allListData[i].TaskValue[2][1]
|
|
|
|
data.state = allMissionData[j].state
|
|
|
|
|
|
|
|
if data.state == 2 or data.state == 1 then
|
|
|
|
data.itemName = string.format("%s(%s/%s)",strs[1],data.value,data.value)
|
|
|
|
else
|
|
|
|
data.itemName = string.format("%s(%s/%s)",strs[1],(data.progress > data.value and data.value or data.progress),data.value)
|
|
|
|
end
|
|
|
|
|
|
|
|
data.content = strs[2]
|
|
|
|
data.shows = {
|
|
|
|
[1] = {
|
|
|
|
allListData[i].Integral[1][1],
|
|
|
|
allListData[i].Integral[1][2]
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
data.type = allListData[i].Type
|
|
|
|
data.jump = allListData[i].Jump[1]
|
|
|
|
table.insert(curData.rewards,data)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
local typeIndex = {
|
|
|
|
[0] = 1,
|
|
|
|
[1] = 0,
|
|
|
|
[2] = 2,
|
|
|
|
}
|
|
|
|
table.sort(curData.rewards, function(a,b)
|
|
|
|
if typeIndex[a.state] == typeIndex[b.state] then
|
|
|
|
if a.type == b.type then
|
|
|
|
return a.missionId < b.missionId
|
|
|
|
else
|
|
|
|
return a.type < b.type
|
|
|
|
end
|
|
|
|
else
|
|
|
|
return typeIndex[a.state] < typeIndex[b.state]
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
|
|
|
|
function this.GetMissionData(indexType,actType)
|
|
|
|
local curData = dataList[actType]
|
|
|
|
local actId = ActivityGiftManager.GetActivityIdByType(actType)
|
|
|
|
local actRewardConfigs = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig,"ActivityId", actId)
|
|
|
|
for i = 1, #curData.rewards do
|
|
|
|
for j = 1, #actRewardConfigs do
|
|
|
|
if curData.rewards[i].missionId == actRewardConfigs[j].Id then
|
|
|
|
if indexType == 2 then
|
|
|
|
curData.rewards[i].progress = curData.rewards[i].progress
|
|
|
|
else
|
|
|
|
curData.rewards[i].progress = curData.value
|
|
|
|
end
|
|
|
|
if actType == ActivityTypeDef.DynamicAct_recharge then
|
|
|
|
curData.rewards[i].value = actRewardConfigs[j].Values[1][1]
|
|
|
|
else
|
|
|
|
curData.rewards[i].value = actRewardConfigs[j].Values[2][1]
|
|
|
|
end
|
|
|
|
if curData.rewards[i].state == 1 then
|
|
|
|
curData.rewards[i].state = 2
|
|
|
|
else
|
|
|
|
if curData.rewards[i].progress < curData.rewards[i].value then
|
|
|
|
curData.rewards[i].state = 0
|
|
|
|
else
|
|
|
|
curData.rewards[i].state = 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
curData.rewards[i].shows = actRewardConfigs[j].Reward
|
|
|
|
curData.rewards[i].jump = actRewardConfigs[j].Jump[1]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
local typeIndex = {
|
|
|
|
[0] = 1,
|
|
|
|
[1] = 0,
|
|
|
|
[2] = 2,
|
|
|
|
}
|
|
|
|
table.sort(dataList[actType].rewards,function (a,b)
|
|
|
|
if typeIndex[a.state] == typeIndex[b.state] then
|
|
|
|
return a.missionId < b.missionId
|
|
|
|
else
|
|
|
|
return typeIndex[a.state] < typeIndex[b.state]
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
|
2021-04-20 20:32:36 +08:00
|
|
|
function this.GetExpertData(indexType,actType)
|
|
|
|
local curData = dataList[actType]
|
2021-04-21 11:37:55 +08:00
|
|
|
local actId = ActivityGiftManager.GetActivityIdByType(actType)
|
|
|
|
local actRewardConfigs = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig,"ActivityId", actId)
|
2021-04-20 20:32:36 +08:00
|
|
|
for i = 1, #curData.rewards do
|
|
|
|
for j = 1, #actRewardConfigs do
|
|
|
|
if curData.rewards[i].missionId == actRewardConfigs[j].Id then
|
|
|
|
if indexType == 3 then -- 3 积天豪礼
|
|
|
|
curData.rewards[i].otherData.Values = actRewardConfigs[j].Values[1][2]
|
2021-04-26 18:46:19 +08:00
|
|
|
curData.rewards[i].otherData.info = ""
|
2021-04-20 20:32:36 +08:00
|
|
|
if curData.rewards[i].state == 1 then
|
|
|
|
curData.rewards[i].otherData.state = 2
|
|
|
|
elseif curData.rewards[i].progress == 1 then
|
|
|
|
curData.rewards[i].otherData.state = 0
|
2021-04-21 11:37:55 +08:00
|
|
|
else
|
|
|
|
curData.rewards[i].otherData.state = 1
|
2021-04-20 20:32:36 +08:00
|
|
|
end
|
|
|
|
else --日累计充值 达人
|
2021-05-10 10:06:53 +08:00
|
|
|
if actType == ActivityTypeDef.AccumulativeRechargeExper or actType == ActivityTypeDef.DynamicAct_recharge then
|
2021-04-20 20:32:36 +08:00
|
|
|
curData.rewards[i].otherData.Values = actRewardConfigs[j].Values[1][1]
|
2021-04-21 11:37:55 +08:00
|
|
|
else
|
2021-04-20 20:32:36 +08:00
|
|
|
curData.rewards[i].otherData.Values = actRewardConfigs[j].Values[2][1]
|
|
|
|
end
|
|
|
|
if curData.rewards[i].state == 1 then
|
|
|
|
curData.rewards[i].otherData.state = 2
|
2021-04-21 11:37:55 +08:00
|
|
|
curData.rewards[i].otherData.info = string.format("%s/%s",curData.rewards[i].otherData.Values,curData.rewards[i].otherData.Values)
|
2021-04-20 20:32:36 +08:00
|
|
|
else
|
|
|
|
if indexType == 1 then
|
|
|
|
if curData.rewards[i].progress < curData.rewards[i].otherData.Values then
|
|
|
|
curData.rewards[i].otherData.state = 1
|
2021-04-21 11:37:55 +08:00
|
|
|
else
|
|
|
|
curData.rewards[i].otherData.state = 0
|
2021-04-20 20:32:36 +08:00
|
|
|
end
|
2021-04-21 11:37:55 +08:00
|
|
|
curData.rewards[i].otherData.info = string.format("%s/%s",curData.rewards[i].progress,curData.rewards[i].otherData.Values)
|
2021-04-27 17:05:53 +08:00
|
|
|
if curData.rewards[i].progress > curData.rewards[i].otherData.Values then
|
|
|
|
curData.rewards[i].otherData.info = string.format("%s/%s",curData.rewards[i].otherData.Values,curData.rewards[i].otherData.Values)
|
|
|
|
end
|
2021-04-20 20:32:36 +08:00
|
|
|
elseif indexType == 2 then
|
2021-04-21 11:37:55 +08:00
|
|
|
-- LogPink("curData.value:"..tostring(curData.value).." "..tostring(curData.rewards[i].otherData.Values))
|
2021-04-20 20:32:36 +08:00
|
|
|
if curData.value < curData.rewards[i].otherData.Values then
|
|
|
|
curData.rewards[i].otherData.state = 1
|
2021-04-21 11:37:55 +08:00
|
|
|
else
|
|
|
|
curData.rewards[i].otherData.state = 0
|
2021-04-20 20:32:36 +08:00
|
|
|
end
|
|
|
|
curData.rewards[i].otherData.info = string.format("%s/%s",curData.value,curData.rewards[i].otherData.Values)
|
2021-04-27 17:05:53 +08:00
|
|
|
if curData.value > curData.rewards[i].otherData.Values then
|
|
|
|
curData.rewards[i].otherData.info = string.format("%s/%s",curData.rewards[i].otherData.Values,curData.rewards[i].otherData.Values)
|
|
|
|
end
|
2021-04-20 20:32:36 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
curData.rewards[i].otherData.Reward = actRewardConfigs[j].Reward
|
|
|
|
curData.rewards[i].otherData.ContentsShow = actRewardConfigs[j].ContentsShow
|
|
|
|
curData.rewards[i].otherData.Sort = actRewardConfigs[j].Sort
|
2021-04-21 16:36:12 +08:00
|
|
|
if actRewardConfigs[j].Jump then
|
|
|
|
curData.rewards[i].otherData.Jump = actRewardConfigs[j].Jump[1]
|
|
|
|
end
|
2021-04-20 20:32:36 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2021-04-22 15:53:47 +08:00
|
|
|
table.sort(dataList[actType].rewards,function (a,b)
|
|
|
|
if a.state == b.state then
|
|
|
|
return a.missionId < b.missionId
|
|
|
|
else
|
|
|
|
return a.state < b.state
|
|
|
|
end
|
|
|
|
end)
|
2021-04-20 20:32:36 +08:00
|
|
|
end
|
|
|
|
|
2021-04-16 14:58:40 +08:00
|
|
|
function this.GetData(actType)
|
2021-05-10 10:06:53 +08:00
|
|
|
if dataList[actType] then
|
|
|
|
dataList[actType] = nil
|
2021-04-16 14:58:40 +08:00
|
|
|
end
|
2021-05-10 10:06:53 +08:00
|
|
|
dataList[actType] = this.InitSingleTypeData(actType)
|
|
|
|
if TypeUpdateFunc[actType] and dataList[actType] then
|
2021-04-20 16:43:16 +08:00
|
|
|
TypeUpdateFunc[actType]()
|
|
|
|
end
|
2021-04-17 14:01:12 +08:00
|
|
|
return dataList[actType]
|
2021-04-16 14:58:40 +08:00
|
|
|
end
|
|
|
|
|
2021-04-16 16:21:34 +08:00
|
|
|
function this.InitSingleTypeData(actType)
|
2021-05-10 10:06:53 +08:00
|
|
|
local singleTypeData = nil
|
2021-04-17 14:01:12 +08:00
|
|
|
local data = ActivityGiftManager.GetActivityTypeInfo(actType)
|
2021-05-10 10:06:53 +08:00
|
|
|
if data then
|
|
|
|
singleTypeData = {}
|
|
|
|
LogYellow("InitData activityId:"..tostring(data.activityId).." value:"..tostring(data.value).." startTime:"..tostring(data.startTime).." endTime:"..tostring(data.endTime).." mission:"..tostring(#data.mission))
|
|
|
|
singleTypeData.activityId = data.activityId
|
|
|
|
singleTypeData.value = data.value
|
|
|
|
singleTypeData.startTime = data.startTime
|
|
|
|
singleTypeData.endTime = data.endTime
|
|
|
|
singleTypeData.rewards = {}
|
|
|
|
if data.mission and #data.mission > 0 then
|
|
|
|
for i = 1, #data.mission do
|
|
|
|
local reward = {}
|
|
|
|
reward.missionId = data.mission[i].missionId or 0
|
|
|
|
reward.progress = data.mission[i].progress or 0
|
|
|
|
reward.state = data.mission[i].state or 0
|
|
|
|
reward.otherData = {}
|
|
|
|
table.insert(singleTypeData.rewards,reward)
|
2021-04-19 19:44:54 +08:00
|
|
|
end
|
2021-04-17 14:01:12 +08:00
|
|
|
end
|
2021-05-10 10:06:53 +08:00
|
|
|
end
|
|
|
|
return singleTypeData
|
2021-04-16 14:58:40 +08:00
|
|
|
end
|
|
|
|
|
2021-04-22 10:59:32 +08:00
|
|
|
function this.CheckSingleRed(data)
|
2021-04-22 18:12:16 +08:00
|
|
|
local NeedCost = ConfigManager.GetConfigData(ConfigName.ComposeBook,data.otherData.needItems[1]).NeedCost
|
|
|
|
if data.progress > 0 then
|
|
|
|
if BagManager.GetTotalItemNum(NeedCost[1][1]) >= NeedCost[1][2] then
|
|
|
|
local list = BagManager.GetBagItemDataByItemType(ItemBaseType.Equip)
|
|
|
|
local EquipedEquipList = HeroManager.GetEquipedEquipList()
|
|
|
|
for i = 1, #data.otherData.needItems do
|
|
|
|
for j = 1, #list do
|
|
|
|
if data.otherData.needItems[i] == list[j].itemConfig.Id then
|
|
|
|
return true
|
|
|
|
end
|
2021-04-22 10:59:32 +08:00
|
|
|
end
|
|
|
|
end
|
2021-04-22 18:12:16 +08:00
|
|
|
for i = 1, #data.otherData.needItems do
|
|
|
|
for j = 1, #EquipedEquipList do
|
|
|
|
if data.otherData.needItems[i] == EquipedEquipList[j] then
|
|
|
|
return true
|
|
|
|
end
|
2021-04-22 10:59:32 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
2021-04-16 14:58:40 +08:00
|
|
|
return CommonActPageManager
|