963 lines
45 KiB
Lua
963 lines
45 KiB
Lua
CommonActPageManager = {}
|
||
local this = CommonActPageManager
|
||
local dataList = {}
|
||
this.TaSuiLingXiaoMsg = nil
|
||
this.TaSuiLingXiaoHistoryDmg = 0
|
||
this.DynamicActType = 0
|
||
this.powerRicePower = 0
|
||
|
||
function this.Initialize()
|
||
this.args = {}
|
||
end
|
||
|
||
--初始化活动的特殊数据(每个活动有单独处理方式,不需要单独处理就不用单独写)
|
||
local TypeUpdateFunc = {
|
||
[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.Sort = configData[j].Sort
|
||
curData.rewards[i].otherData.IsShowItem = configData[j].IsShowItem == 1 and true or false
|
||
curData.rewards[i].otherData.selectId = 0
|
||
end
|
||
end
|
||
end
|
||
table.sort(dataList[ActivityTypeDef.YunYouShangRen].rewards,function (a,b)
|
||
if a.progress == 0 and b.progress > 0 then
|
||
return false
|
||
end
|
||
if a.progress > 0 and b.progress == 0 then
|
||
return true
|
||
end
|
||
if (a.progress == 0 and b.progress == 0) or (a.progress > 0 and b.progress > 0) then
|
||
return a.otherData.Sort < b.otherData.Sort
|
||
end
|
||
end)
|
||
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 ()---日累计充值
|
||
local curData = dataList[ActivityTypeDef.AccumulativeRechargeExper]
|
||
local configData = ConfigManager.GetConfigData(ConfigName.GlobalActivity,curData.activityId)
|
||
if configData.ShowArt == FUNCTION_OPEN_TYPE.EXPERT then
|
||
this.GetExpertData(2,ActivityTypeDef.AccumulativeRechargeExper)
|
||
else
|
||
this.GetMissionData(1,ActivityTypeDef.AccumulativeRechargeExper)
|
||
end
|
||
end,
|
||
[ActivityTypeDef.UpLvAct] = function ()---升级限时
|
||
this.GetExpertData(4,ActivityTypeDef.UpLvAct)
|
||
end,
|
||
[ActivityTypeDef.DynamicAct_recharge] = function ()---周累计充值
|
||
this.GetMissionData(1,ActivityTypeDef.DynamicAct_recharge)
|
||
end,
|
||
[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
|
||
curData.rewards[i].otherData.Values = configData[j].Values
|
||
curData.rewards[i].otherData.Reward = configData[j].Reward
|
||
curData.rewards[i].otherData.Sort = configData[j].Sort
|
||
end
|
||
end
|
||
end
|
||
|
||
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)
|
||
end,
|
||
[ActivityTypeDef.DynamicAct] = function ()--主题活动任务
|
||
local curData = dataList[ActivityTypeDef.DynamicAct]
|
||
this.InitTaskData(curData,TaskTypeDef.DynamicActTask,ConfigName.ThemeActivityTaskConfig)
|
||
end,
|
||
[ActivityTypeDef.ChaoFanRuSheng] = function ()--超凡入圣
|
||
local curData = dataList[ActivityTypeDef.ChaoFanRuSheng]
|
||
this.InitMissionDdataUpStar(curData)
|
||
end,
|
||
[ActivityTypeDef.UpStarGift] = function ()--超凡入圣
|
||
local curData = dataList[ActivityTypeDef.UpStarGift]
|
||
this.InitMissionDdataUpStar(curData)
|
||
end,
|
||
|
||
[ActivityTypeDef.SurpriseBox] = function ()--惊喜礼盒
|
||
local curData = dataList[ActivityTypeDef.SurpriseBox]
|
||
local configData = ConfigManager.GetAllConfigsDataByKey(ConfigName.SurpriseBoxConfig,"ActivityId",curData.activityId)
|
||
local rechargeConfig = ConfigManager.GetConfig(ConfigName.RechargeCommodityConfig)
|
||
for i = 1, #curData.rewards do
|
||
for j = 1, #configData do
|
||
if curData.rewards[i].missionId == configData[j].Id then
|
||
curData.rewards[i].otherData.PackId = configData[j].PackId
|
||
curData.rewards[i].otherData.Sort = configData[j].Sort
|
||
curData.rewards[i].otherData.BuyDay = configData[j].BuyDay
|
||
curData.rewards[i].otherData.Name = rechargeConfig[configData[j].PackId].Name
|
||
curData.rewards[i].otherData.Reward = rechargeConfig[configData[j].PackId].RewardShow
|
||
curData.rewards[i].otherData.Price = rechargeConfig[configData[j].PackId].Price
|
||
curData.rewards[i].otherData.Warning = configData[j].Warning
|
||
curData.rewards[i].otherData.Rule = configData[j].Rule
|
||
end
|
||
end
|
||
end
|
||
for i = #curData.rewards, 1,-1 do
|
||
if curData.rewards[i].progress == 5 then
|
||
table.remove(curData.rewards,i)
|
||
end
|
||
end
|
||
table.sort(curData.rewards,function (a,b)
|
||
return a.otherData.Sort < b.otherData.Sort
|
||
end)
|
||
end,
|
||
|
||
[ActivityTypeDef.TeHuiShenZhuang] = function ()--特惠神装
|
||
local curData = dataList[ActivityTypeDef.TeHuiShenZhuang]
|
||
local configData = ConfigManager.GetAllConfigsDataByKey(ConfigName.SurpriseBoxConfig,"ActivityId",curData.activityId)
|
||
local rechargeConfig = ConfigManager.GetConfig(ConfigName.RechargeCommodityConfig)
|
||
for i = 1, #curData.rewards do
|
||
for j = 1, #configData do
|
||
if curData.rewards[i].missionId == configData[j].Id then
|
||
curData.rewards[i].otherData.PackId = configData[j].PackId
|
||
curData.rewards[i].otherData.Name = rechargeConfig[configData[j].PackId].Name
|
||
curData.rewards[i].otherData.Reward = rechargeConfig[configData[j].PackId].RewardShow
|
||
curData.rewards[i].otherData.Price = rechargeConfig[configData[j].PackId].Price
|
||
curData.rewards[i].otherData.skinArtId = tonumber(configData[1].Warning)
|
||
curData.rewards[i].otherData.canBuyDay = configData[j].BuyDay - curData.value
|
||
end
|
||
end
|
||
end
|
||
table.sort(curData.rewards,function (a,b)
|
||
return a.missionId < b.missionId
|
||
end)
|
||
end,
|
||
[ActivityTypeDef.ContinueGift] = function ()--连续礼包
|
||
local curData = dataList[ActivityTypeDef.ContinueGift]
|
||
local configData = ConfigManager.GetAllConfigsDataByKey(ConfigName.SurpriseBoxConfig,"ActivityId",curData.activityId)
|
||
local rechargeConfig = ConfigManager.GetConfig(ConfigName.RechargeCommodityConfig)
|
||
for i = 1, #curData.rewards do
|
||
for j = 1, #configData do
|
||
if curData.rewards[i].missionId == configData[j].Id then
|
||
curData.rewards[i].otherData.PackId = configData[j].PackId
|
||
curData.rewards[i].otherData.Name = rechargeConfig[configData[j].PackId].Name
|
||
curData.rewards[i].otherData.Reward = rechargeConfig[configData[j].PackId].RewardShow
|
||
curData.rewards[i].otherData.Price = rechargeConfig[configData[j].PackId].Price
|
||
curData.rewards[i].otherData.skinArtId = tonumber(configData[1].Warning)
|
||
curData.rewards[i].otherData.canBuyDay = configData[j].BuyDay - curData.value
|
||
curData.rewards[i].otherData.LinkActivityId = configData[j].LinkActivityId
|
||
end
|
||
end
|
||
end
|
||
table.sort(curData.rewards,function (a,b)
|
||
return a.missionId < b.missionId
|
||
end)
|
||
end,
|
||
--山河试炼
|
||
[ActivityTypeDef.ShanHeShiLian] = function ()--山河试炼
|
||
local curData = dataList[ActivityTypeDef.ShanHeShiLian]
|
||
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
|
||
curData.rewards[i].otherData.Values = configData[j].Values
|
||
curData.rewards[i].otherData.Reward = configData[j].Reward
|
||
curData.rewards[i].otherData.Sort = configData[j].Sort
|
||
end
|
||
end
|
||
end
|
||
|
||
table.sort(curData.rewards,function (a,b)
|
||
if a.state == b.state then
|
||
return a.otherData.Sort < b.otherData.Sort
|
||
else
|
||
return a.state < b.state
|
||
end
|
||
end)
|
||
end,
|
||
[ActivityTypeDef.XunBaoMiZong] = function () --寻宝迷踪
|
||
local curData = dataList[ActivityTypeDef.XunBaoMiZong]
|
||
local DiamondBoxContain = ConfigManager.GetConfigDataByKey(ConfigName.LotterySetting,"ActivityId",curData.activityId).DiamondBoxContain[1][1]
|
||
local rewards = ConfigManager.GetAllConfigsDataByKey(ConfigName.LotteryRewardConfig,"Pool",DiamondBoxContain)
|
||
local weightAll = 0
|
||
for i = 1, #rewards do
|
||
weightAll = weightAll + rewards[i].WeightShow
|
||
end
|
||
for i = 1, #rewards do
|
||
local data = {}
|
||
data.Id = rewards[i].Id
|
||
data.Reward = rewards[i].Reward
|
||
data.ItemName = rewards[i].ItemName
|
||
data.WeightShow = string.format("%.2f",rewards[i].WeightShow/weightAll*100).."%" --rewards[i].WeightShow/weightAll*100.."%"
|
||
table.insert(curData.FreelyData,data)
|
||
end
|
||
table.sort(curData.FreelyData,function (a,b)
|
||
return a.Id < b.Id
|
||
end)
|
||
end,
|
||
[ActivityTypeDef.TreasureStoreSeason2] = function ()--新百宝商会
|
||
local curData = dataList[ActivityTypeDef.TreasureStoreSeason2]
|
||
local configData = ConfigManager.GetAllConfigsDataByKey(ConfigName.SurpriseBoxConfig,"ActivityId",curData.activityId)
|
||
local rechargeConfig = ConfigManager.GetConfig(ConfigName.RechargeCommodityConfig)
|
||
for i = 1, #curData.rewards do
|
||
-- LogRed("missionId:"..tostring(curData.rewards[i].missionId).." progress:"..tostring(curData.rewards[i].progress).." state:"..tostring(curData.rewards[i].state))
|
||
for j = 1, #configData do
|
||
if curData.rewards[i].missionId == configData[j].Id then
|
||
if not curData.FreelyData[configData[j].Sort] then
|
||
curData.FreelyData[configData[j].Sort] = {}
|
||
end
|
||
local tempData = {}
|
||
tempData.Id = configData[j].Id
|
||
tempData.PackId = configData[j].PackId
|
||
tempData.Sort = configData[j].Sort
|
||
tempData.BuyDay = configData[j].BuyDay
|
||
if rechargeConfig[configData[j].PackId] then
|
||
tempData.Name = rechargeConfig[configData[j].PackId].Name
|
||
tempData.Reward = rechargeConfig[configData[j].PackId].RewardShow
|
||
tempData.Price = rechargeConfig[configData[j].PackId].Price
|
||
tempData.progress = curData.rewards[i].progress
|
||
tempData.canBuy = OperatingManager.GetLeftBuyTime(5,tempData.PackId)
|
||
--插入数据2维 [天数][第几个]
|
||
table.insert(curData.FreelyData[configData[j].Sort],tempData)
|
||
else
|
||
LogError("百宝商会:Recharge表中未找到礼包Id:"..tostring(configData[j].PackId))
|
||
end
|
||
end
|
||
end
|
||
end
|
||
for i = 1,#curData.FreelyData do
|
||
table.sort(curData.FreelyData[i],function (a,b)
|
||
return a.Id < b.Id
|
||
end)
|
||
end
|
||
end,
|
||
[ActivityTypeDef.DemonSlayerNew] = function ()--新三界降魔
|
||
local curData = dataList[ActivityTypeDef.DemonSlayerNew]
|
||
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
|
||
curData.rewards[i].otherData.Values = configData[j].Values
|
||
curData.rewards[i].otherData.Reward = configData[j].Reward
|
||
curData.rewards[i].otherData.Sort = configData[j].Sort
|
||
curData.rewards[i].otherData.State = 0
|
||
if curData.rewards[i].state == 0 then
|
||
if curData.rewards[i].otherData.Values[1][2] <= curData.rewards[i].progress then
|
||
curData.rewards[i].otherData.State = 2--可领取
|
||
else
|
||
curData.rewards[i].otherData.State = 1--未达成
|
||
end
|
||
elseif curData.rewards[i].state == 1 then
|
||
curData.rewards[i].otherData.State = 3--已经领取
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
table.sort(curData.rewards,function (a,b)
|
||
if a.state == b.state then
|
||
return a.otherData.Sort < b.otherData.Sort
|
||
else
|
||
return a.state < b.state
|
||
end
|
||
end)
|
||
end,
|
||
[ActivityTypeDef.ContinuePackage] = function ()--连购礼包
|
||
local curData = dataList[ActivityTypeDef.ContinuePackage]
|
||
local configData = ConfigManager.TryGetAllConfigsDataByDoubleKey(ConfigName.ThemeActivityShop,"ActivityId",curData.activityId,"LinkActivityId",this.args[1])
|
||
if #configData <= 0 then
|
||
curData = {}
|
||
return
|
||
end
|
||
local rechargeConfig = ConfigManager.GetConfig(ConfigName.RechargeCommodityConfig)
|
||
local goodsConfig = ConfigManager.GetConfig(ConfigName.GoodsConfig)
|
||
local tempDataList = {}
|
||
for i = 1, #curData.rewards do
|
||
for j = 1, #configData do
|
||
if curData.rewards[i].missionId == configData[j].Id then
|
||
local func = function()
|
||
local tempData = {}
|
||
tempData.missionId = configData[j].Id
|
||
tempData.state = curData.rewards[i].state
|
||
tempData.otherData = {}
|
||
tempData.otherData.GoodId = configData[j].GoodId
|
||
tempData.otherData.canBuyDay = configData[j].BuyDay - curData.value
|
||
tempData.otherData.GoodType = configData[j].GoodType
|
||
tempData.otherData.Type = configData[j].Type
|
||
if configData[j].GoodType == 1 then
|
||
tempData.otherData.Name = rechargeConfig[configData[j].GoodId].Name
|
||
tempData.otherData.Reward = rechargeConfig[configData[j].GoodId].RewardShow
|
||
tempData.otherData.Price = rechargeConfig[configData[j].GoodId].Price
|
||
tempData.progress = rechargeConfig[configData[j].GoodId].Limit - OperatingManager.GetGoodsBuyTime(5,configData[j].GoodId)
|
||
elseif configData[j].GoodType == 2 then
|
||
tempData.otherData.Name = goodsConfig[configData[j].GoodId].GoodsName
|
||
tempData.otherData.Reward = goodsConfig[configData[j].GoodId].Goods
|
||
tempData.otherData.Price = goodsConfig[configData[j].GoodId].Price
|
||
tempData.progress = goodsConfig[configData[j].GoodId].Limit - curData.rewards[i].progress
|
||
end
|
||
-- LogPink("missionId:"..tostring(tempData.missionId).." GoodId:"..tostring(tempData.otherData.GoodId).." Type(1:礼包、2商品):"..tostring(tempData.otherData.GoodType)
|
||
-- .." progress:"..tostring(tempData.progress).." Name:"..tostring(tempData.otherData.Name).." Price:"..tostring(tempData.otherData.Price))
|
||
if not tempDataList[configData[j].Type] then
|
||
tempDataList[configData[j].Type] = {}
|
||
end
|
||
table.insert(tempDataList[configData[j].Type],tempData)
|
||
end
|
||
--每日特惠类型为2每日只显示一个,前端手动关闭
|
||
-- LogGreen("Type:"..tostring(configData[j].Type).." UnlockDay:"..tostring(configData[j].UnlockDay).." value:"..tostring(curData.value))
|
||
if configData[j].Type == 2 and configData[j].UnlockDay == curData.value then
|
||
func()
|
||
elseif configData[j].Type ~= 2 then
|
||
func()
|
||
end
|
||
end
|
||
end
|
||
end
|
||
curData.rewards = tempDataList
|
||
for i = #curData.rewards, 1,-1 do
|
||
if curData.rewards[i].progress == 5 then
|
||
table.remove(curData.rewards,i)
|
||
end
|
||
end
|
||
for key, value in pairs(curData.rewards) do
|
||
for i = #value, 1,-1 do
|
||
if value[i].state == 5 then
|
||
table.remove(value,i)
|
||
end
|
||
end
|
||
table.sort(value,function (a,b)
|
||
return a.missionId < b.missionId
|
||
end)
|
||
-- for i = 1, #value do
|
||
-- LogGreen("Id:"..tostring(value[i].missionId))
|
||
-- end
|
||
end
|
||
end,
|
||
[ActivityTypeDef.zhongzhichengcheng] = function ()--秘宝达人
|
||
this.GetExpertData(5,ActivityTypeDef.zhongzhichengcheng)
|
||
end,
|
||
[ActivityTypeDef.ChaoZhiJiJin_128] = function ()--超值基金128
|
||
local curData = dataList[ActivityTypeDef.ChaoZhiJiJin_128]
|
||
--数据
|
||
local configData = ConfigManager.GetAllConfigsDataByKey(ConfigName.LuxuryFundConfig,"Type",ActivityTypeDef.ChaoZhiJiJin_128)
|
||
for i = 1, #curData.rewards do
|
||
for j = 1, #configData do
|
||
if curData.rewards[i].missionId == configData[j].Id then
|
||
curData.rewards[i].otherData.Day = configData[j].Day
|
||
curData.rewards[i].otherData.Reward = configData[j].reward
|
||
curData.rewards[i].otherData.State = curData.rewards[i].state + 1 --1未达成--2可领取--3已经领取
|
||
end
|
||
end
|
||
end
|
||
|
||
table.sort(curData.rewards,function (a,b)
|
||
return a.missionId < b.missionId
|
||
end)
|
||
--判断是否可领取
|
||
curData.FreelyData.isGet = false
|
||
curData.FreelyData.isAllGet = true
|
||
for i = 1,#curData.rewards do
|
||
if curData.rewards[i].otherData.State == 2 then
|
||
curData.FreelyData.isGet = true
|
||
end
|
||
if curData.rewards[i].otherData.State ~= 3 then
|
||
curData.FreelyData.isAllGet = false
|
||
end
|
||
end
|
||
end,
|
||
[ActivityTypeDef.ChaoZhiJiJin_328] = function ()--超值基金328
|
||
local curData = dataList[ActivityTypeDef.ChaoZhiJiJin_328]
|
||
--数据
|
||
local configData = ConfigManager.GetAllConfigsDataByKey(ConfigName.LuxuryFundConfig,"Type",ActivityTypeDef.ChaoZhiJiJin_328)
|
||
for i = 1, #curData.rewards do
|
||
for j = 1, #configData do
|
||
if curData.rewards[i].missionId == configData[j].Id then
|
||
curData.rewards[i].otherData.Day = configData[j].Day
|
||
curData.rewards[i].otherData.Reward = configData[j].reward
|
||
curData.rewards[i].otherData.State = curData.rewards[i].state + 1 --1未达成--2可领取--3已经领取
|
||
end
|
||
end
|
||
end
|
||
table.sort(curData.rewards,function (a,b)
|
||
return a.missionId < b.missionId
|
||
end)
|
||
--判断是否可领取
|
||
curData.FreelyData.isGet = false
|
||
curData.FreelyData.isAllGet = true
|
||
for i = 1,#curData.rewards do
|
||
if curData.rewards[i].otherData.State == 2 then
|
||
curData.FreelyData.isGet = true
|
||
end
|
||
if curData.rewards[i].otherData.State ~= 3 then
|
||
curData.FreelyData.isAllGet = false
|
||
end
|
||
end
|
||
end,
|
||
[ActivityTypeDef.PowerRice] = function ()--战力冲刺
|
||
local curData = dataList[ActivityTypeDef.PowerRice]
|
||
--数据
|
||
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
|
||
curData.rewards[i].otherData.Values = configData[j].Values
|
||
curData.rewards[i].otherData.Reward = configData[j].Reward
|
||
curData.rewards[i].otherData.Sort = configData[j].Sort
|
||
end
|
||
end
|
||
end
|
||
table.sort(curData.rewards,function (a,b)
|
||
if a.state == b.state then
|
||
return a.otherData.Sort < b.otherData.Sort
|
||
else
|
||
return a.state < b.state
|
||
end
|
||
end)
|
||
end,
|
||
[ActivityTypeDef.EastSeaFindGod] = function ()--主题活动任务
|
||
local curData = dataList[ActivityTypeDef.EastSeaFindGod]
|
||
this.InitTaskDataBySmallType(curData,TaskTypeDef.EastSeaFindGod,ConfigName.ThemeActivityTaskConfig,this.args[1])
|
||
end,
|
||
}
|
||
|
||
--超凡入圣
|
||
function this.InitMissionDdataUpStar(curData)
|
||
local actRewardConfigs = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig, "ActivityId", curData.activityId)
|
||
for i = 1, #curData.rewards do
|
||
for j = 1, #actRewardConfigs do
|
||
if curData.rewards[i].missionId == actRewardConfigs[j].Id then
|
||
curData.rewards[i].state = curData.rewards[i].state
|
||
curData.rewards[i].targetId = actRewardConfigs[j].Values[1][1]
|
||
curData.rewards[i].targetStar = actRewardConfigs[j].Values[1][2]
|
||
curData.rewards[i].targetNum = actRewardConfigs[j].Values[2][1]
|
||
curData.rewards[i].heroShows = {[1] = {curData.rewards[i].targetId,0,nil,curData.rewards[i].targetStar}}
|
||
curData.rewards[i].giftId = actRewardConfigs[j].Values[3][1]
|
||
curData.rewards[i].giftConfig = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig,curData.rewards[i].giftId)
|
||
curData.rewards[i].giftShows = curData.rewards[i].giftConfig.RewardShow
|
||
curData.rewards[i].giftData = OperatingManager.GetGiftGoodsInfo(curData.rewards[i].giftConfig.Type,curData.rewards[i].giftId)
|
||
curData.rewards[i].freeShows = actRewardConfigs[j].Reward
|
||
break
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
--主题活动任务
|
||
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
|
||
-- LogGreen("this.DynamicActType:"..this.DynamicActType)
|
||
if allListData[i].Id == allMissionData[j].missionId and (this.DynamicActType == 0 or allListData[i].Type == this.DynamicActType) 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]
|
||
-- LogGreen("missionId:"..tostring(data.missionId).." taskType:"..tostring(data.taskType).." itemName:"..tostring(data.itemName))
|
||
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.InitTaskDataBySmallType(curData,taskType,configName,smallType)
|
||
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 and (not smallType or allListData[i].Type == smallType) then
|
||
local data = {}
|
||
data.missionId = allListData[i].Id
|
||
data.type = smallType
|
||
data.otherData = {}
|
||
data.otherData.missionType = 0
|
||
data.otherData.taskType = taskType
|
||
data.otherData.Values = allListData[i].TaskValue[2][1]
|
||
data.progress = allMissionData[j].progress
|
||
data.value = allListData[i].TaskValue[2][1]
|
||
data.state = allMissionData[j].state
|
||
if data.state == 0 then
|
||
if data.progress < data.value then
|
||
data.otherData.state = 1
|
||
else
|
||
data.otherData.state = 0
|
||
end
|
||
elseif data.state == 1 then
|
||
data.otherData.state = 0
|
||
else
|
||
data.otherData.state = 2
|
||
end
|
||
data.otherData.ContentsShow = allListData[i].Show
|
||
|
||
if data.otherData.state == 2 or data.otherData.state == 0 then
|
||
data.otherData.info = string.format("(%s/%s)",data.value,data.value)
|
||
else
|
||
data.otherData.info = string.format("(%s/%s)",(data.progress > data.value and data.value or data.progress),data.value)
|
||
end
|
||
data.otherData.Reward = allListData[i].Integral
|
||
data.otherData.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 or actType == ActivityTypeDef.AccumulativeRechargeExper 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].title = string.format("累计充值金额:%s元",curData.rewards[i].value)
|
||
curData.rewards[i].buyInfo = string.format("(%s/%s)",curData.rewards[i].progress,curData.rewards[i].value)
|
||
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
|
||
|
||
--达人活动
|
||
function this.GetExpertData(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 == 3 then -- 3 积天豪礼
|
||
curData.rewards[i].otherData.Values = actRewardConfigs[j].Values[1][2]
|
||
curData.rewards[i].otherData.info = ""
|
||
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
|
||
else
|
||
curData.rewards[i].otherData.state = 1
|
||
end
|
||
elseif indexType == 4 then --升级限量豪礼
|
||
curData.rewards[i].otherData.Values = actRewardConfigs[j].Values[2][1]
|
||
curData.rewards[i].otherData.info = ""
|
||
if curData.rewards[i].state == 1 then
|
||
curData.rewards[i].otherData.state = 2
|
||
else
|
||
if curData.rewards[i].progress > 0 then
|
||
if PlayerManager.level >= curData.rewards[i].otherData.Values then
|
||
curData.rewards[i].otherData.state = 0
|
||
else
|
||
curData.rewards[i].otherData.state = 1
|
||
end
|
||
else
|
||
curData.rewards[i].otherData.state = 3
|
||
end
|
||
if PlayerManager.level >= 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)
|
||
else
|
||
curData.rewards[i].otherData.info = string.format("%s/%s",PlayerManager.level,curData.rewards[i].otherData.Values)
|
||
end
|
||
end
|
||
if PlayerManager.level >= 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)
|
||
else
|
||
curData.rewards[i].otherData.info = string.format("%s/%s",PlayerManager.level,curData.rewards[i].otherData.Values)
|
||
end
|
||
elseif indexType == 5 then
|
||
curData.rewards[i].otherData.Values = actRewardConfigs[j].Values[1][1]
|
||
curData.rewards[i].otherData.info = ""
|
||
if curData.rewards[i].state == 1 then
|
||
curData.rewards[i].otherData.state = 2
|
||
curData.rewards[i].otherData.info = string.format("%s/%s",curData.rewards[i].otherData.Values,curData.rewards[i].otherData.Values)
|
||
else
|
||
if MyGuildManager.GetMyGuildExploreNums() >= curData.rewards[i].otherData.Values then
|
||
curData.rewards[i].otherData.state = 0
|
||
curData.rewards[i].otherData.info = string.format("%s/%s",curData.rewards[i].otherData.Values,curData.rewards[i].otherData.Values)
|
||
else
|
||
curData.rewards[i].otherData.state = 1
|
||
curData.rewards[i].otherData.info = string.format("%s/%s",MyGuildManager.GetMyGuildExploreNums(),curData.rewards[i].otherData.Values)
|
||
end
|
||
end
|
||
else --日累计充值 达人
|
||
if actType == ActivityTypeDef.AccumulativeRechargeExper or actType == ActivityTypeDef.DynamicAct_recharge then
|
||
curData.rewards[i].otherData.Values = actRewardConfigs[j].Values[1][1]
|
||
else
|
||
curData.rewards[i].otherData.Values = actRewardConfigs[j].Values[2][1]
|
||
end
|
||
if curData.rewards[i].state == 1 then
|
||
curData.rewards[i].otherData.state = 2
|
||
curData.rewards[i].otherData.info = string.format("%s/%s",curData.rewards[i].otherData.Values,curData.rewards[i].otherData.Values)
|
||
else
|
||
if indexType == 1 then
|
||
if curData.rewards[i].progress < curData.rewards[i].otherData.Values then
|
||
curData.rewards[i].otherData.state = 1
|
||
else
|
||
curData.rewards[i].otherData.state = 0
|
||
end
|
||
curData.rewards[i].otherData.info = string.format("%s/%s",curData.rewards[i].progress,curData.rewards[i].otherData.Values)
|
||
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
|
||
elseif indexType == 2 then
|
||
-- LogPink("curData.value:"..tostring(curData.value).." "..tostring(curData.rewards[i].otherData.Values))
|
||
if curData.value < curData.rewards[i].otherData.Values then
|
||
curData.rewards[i].otherData.state = 1
|
||
else
|
||
curData.rewards[i].otherData.state = 0
|
||
end
|
||
curData.rewards[i].otherData.info = string.format("%s/%s",curData.value,curData.rewards[i].otherData.Values)
|
||
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
|
||
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
|
||
if actRewardConfigs[j].Jump then
|
||
curData.rewards[i].otherData.Jump = actRewardConfigs[j].Jump[1]
|
||
end
|
||
end
|
||
end
|
||
end
|
||
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)
|
||
end
|
||
|
||
--==============================以下为通用逻辑=====================================
|
||
--对外的接口,获取活动信息,如果没有活动信息就初始化
|
||
function this.GetData(actType,...)
|
||
this.args = {...}
|
||
--每次都重新生成数据
|
||
if dataList[actType] then
|
||
dataList[actType] = nil
|
||
end
|
||
--构造活动的通用数据格式
|
||
dataList[actType] = this.InitSingleTypeData(actType)
|
||
--针对不同的活动有不同的操作
|
||
if TypeUpdateFunc[actType] and dataList[actType] then
|
||
TypeUpdateFunc[actType]()
|
||
end
|
||
return dataList[actType]
|
||
end
|
||
|
||
--如果没获取过,就初始化获取信息
|
||
function this.InitSingleTypeData(actType)
|
||
local singleTypeData = nil
|
||
local data = ActivityGiftManager.GetActivityTypeInfo(actType)
|
||
if data then
|
||
singleTypeData = {}
|
||
Log("初始化数据,activityId:"..tostring(data.activityId).." value:"..tostring(data.value).." startTime:"..tostring(data.startTime).." endTime:"..tostring(data.endTime).." mission:"..tostring(#data.mission))
|
||
singleTypeData.activityId = data.activityId --活动ID
|
||
singleTypeData.value = data.value --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 --任务Id
|
||
reward.progress = data.mission[i].progress or 0 --进度
|
||
reward.state = data.mission[i].state or 0 --状态
|
||
reward.otherData = {} --其他数据(单条奖励信息或显示文字)
|
||
table.insert(singleTypeData.rewards,reward)
|
||
end
|
||
end
|
||
singleTypeData.FreelyData = {} --其他信息(整个活动的一些信息)
|
||
end
|
||
return singleTypeData
|
||
end
|
||
|
||
--=====================================检测逻辑============================
|
||
|
||
--红点检测(云游商人)
|
||
function this.CheckSingleRed(data)
|
||
local NeedCost = ConfigManager.GetConfigData(ConfigName.ComposeBook,data.otherData.needItems[1]).NeedCost
|
||
local ComposeBook = ConfigManager.GetConfig(ConfigName.ComposeBook)
|
||
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 ComposeBook[data.otherData.needItems[i]].NeedItems[1][1] == list[j].itemConfig.Id then
|
||
return true
|
||
end
|
||
end
|
||
end
|
||
for i = 1, #data.otherData.needItems do
|
||
for j = 1, #EquipedEquipList do
|
||
if ComposeBook[data.otherData.needItems[i]].NeedItems[1][1] == EquipedEquipList[j] then
|
||
return true
|
||
end
|
||
end
|
||
end
|
||
end
|
||
end
|
||
return false
|
||
end
|
||
|
||
--新三界降魔红点检测
|
||
function this.DemonSlayerNewRedCheck()
|
||
local data = this.GetData(ActivityTypeDef.DemonSlayerNew)
|
||
if data then
|
||
for i = 1, #data.rewards do
|
||
if data.rewards[i].otherData.State == 2 then
|
||
return true
|
||
end
|
||
end
|
||
end
|
||
return false
|
||
end
|
||
|
||
-- 判断是否有连续充值的礼包
|
||
function this.HasContinueGift(linkActId)
|
||
local activityId = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.ContinueGift)
|
||
if not activityId then
|
||
return false
|
||
end
|
||
local actData = this.GetData(ActivityTypeDef.ContinueGift)
|
||
if not actData then
|
||
return false
|
||
end
|
||
if not actData.rewards or #actData.rewards == 0 then
|
||
return false
|
||
end
|
||
for _, r in ipairs(actData.rewards) do
|
||
if r.otherData.LinkActivityId == linkActId then
|
||
return true
|
||
end
|
||
end
|
||
return false
|
||
end
|
||
|
||
-- 判断是否显示连购礼包入口
|
||
function this.ShowIcon(Obj,linkActId)
|
||
if linkActId and Obj then
|
||
local actData = this.GetData(ActivityTypeDef.ContinuePackage,linkActId)
|
||
if actData then
|
||
for index, value in ipairs(actData.rewards) do
|
||
if #value > 0 then
|
||
Obj:SetActive(true)
|
||
return
|
||
end
|
||
end
|
||
end
|
||
end
|
||
Obj:SetActive(false)
|
||
return
|
||
end
|
||
|
||
function this.ChaoZhiJiJin128Red()
|
||
local data = this.GetData(ActivityTypeDef.ChaoZhiJiJin_128)
|
||
if data then
|
||
for i = 1, #data.rewards do
|
||
if data.rewards[i].otherData.State == 2 then
|
||
return true
|
||
end
|
||
end
|
||
end
|
||
return false
|
||
end
|
||
|
||
function this.ChaoZhiJiJin328Red()
|
||
local data = this.GetData(ActivityTypeDef.ChaoZhiJiJin_328)
|
||
if data then
|
||
for i = 1, #data.rewards do
|
||
if data.rewards[i].otherData.State == 2 then
|
||
return true
|
||
end
|
||
end
|
||
end
|
||
return false
|
||
end
|
||
|
||
--获取战力冲刺战力
|
||
function this.GetPowerRicePower(func)
|
||
if ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.PowerRice) then
|
||
RankingManager.InitData(RANK_TYPE.POWER_RICE,function ()
|
||
local allRankData,myRankData = RankingManager.GetRankingInfo()
|
||
this.powerRicePower = myRankData.param1
|
||
end,0)
|
||
end
|
||
if func then
|
||
func()
|
||
end
|
||
end
|
||
function this.PowerRiceRedCheck()
|
||
local data = this.GetData(ActivityTypeDef.PowerRice)
|
||
if data then
|
||
for i = 1, #data.rewards do
|
||
if data.rewards[i].state == 0 and data.rewards[i].otherData.Values[1][1] <= this.powerRicePower then
|
||
return true
|
||
end
|
||
end
|
||
return false
|
||
end
|
||
end
|
||
|
||
function this.GetRedPointEastSeaFindGodnew(red)
|
||
return this.GetRedPointEastSeaFindGod(red%98000)
|
||
end
|
||
|
||
function this.GetRedPointEastSeaFindGod(indexType)
|
||
local data = this.GetData(ActivityTypeDef.EastSeaFindGod,indexType)
|
||
if data then
|
||
for i = 1, #data.rewards do
|
||
if data.rewards[i].state ~= 2 and data.rewards[i].progress >= data.rewards[i].value then
|
||
return true
|
||
end
|
||
end
|
||
return false
|
||
end
|
||
end
|
||
|
||
function this.GetRedPointEastSeaFindGodNew()
|
||
CheckRedPointStatus(RedPointType.eastSeaFindGod1)
|
||
CheckRedPointStatus(RedPointType.eastSeaFindGod2)
|
||
CheckRedPointStatus(RedPointType.eastSeaFindGod3)
|
||
CheckRedPointStatus(RedPointType.eastSeaFindGod4)
|
||
end
|
||
|
||
return CommonActPageManager |