248 lines
9.5 KiB
Lua
248 lines
9.5 KiB
Lua
DynamicActivityManager = {}
|
|
local this = DynamicActivityManager
|
|
this.ZhenQiBaoGeIndex = 0
|
|
|
|
local SpiritAnimalSummonConfig = ConfigManager.GetConfig(ConfigName.SpiritAnimalSummon)
|
|
this.curLevel = 0--社稷大典的等级
|
|
|
|
function this.Initialize()
|
|
end
|
|
|
|
function this.SheJiGetRankData(type,activityId,fun)
|
|
local allRankData,myRankData
|
|
RankingManager.InitData(type,function ()
|
|
allRankData,myRankData = RankingManager.GetRankingInfo()
|
|
if fun then
|
|
fun(allRankData,myRankData)
|
|
end
|
|
end,activityId)
|
|
end
|
|
|
|
function this.SetCurLevel(level)--社稷大典的等级
|
|
this.curLevel = level
|
|
end
|
|
|
|
function this.SheJiCheckRedPoint()
|
|
local ActInfo = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.Celebration)--活动数据
|
|
local canGetRewardList={}
|
|
if ActInfo then
|
|
local curScore = ActInfo.mission[1].progress
|
|
local actReward = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig,"ActivityId",ActInfo.activityId)
|
|
local setting = ConfigManager.GetConfigDataByKey(ConfigName.GodSacrificeSetting,"ActivityId",ActInfo.activityId)
|
|
--检测宝箱是否有可领取
|
|
for i = 1, #ActInfo.mission do
|
|
local curLevel = curScore/actReward[1].Values[2][1]
|
|
if ActInfo.mission[i].state == 0 and curLevel >= i then
|
|
table.insert(canGetRewardList,ActInfo.mission[i])
|
|
end
|
|
end
|
|
|
|
local canGet = false
|
|
--检测中央大锅是否可领取
|
|
if GetTimeStamp() > ActInfo.value and GetTimeStamp() < (ActInfo.value + setting.LastTime * 60) then
|
|
--领过--进入倒计时
|
|
canGet = false
|
|
elseif GetTimeStamp() > ActInfo.value and GetTimeStamp() > (ActInfo.value + setting.LastTime * 60) then
|
|
--没到时间--进入倒计时
|
|
canGet = false
|
|
else
|
|
--可领取
|
|
canGet = true
|
|
end
|
|
if #canGetRewardList > 0 or canGet then
|
|
return true
|
|
else
|
|
return false
|
|
end
|
|
end
|
|
end
|
|
|
|
function this.GetBaoKuData()
|
|
|
|
local actData={}--全部数据
|
|
local initCardDatas = {}--35个矿坑的初始数据
|
|
local finalCardDatas = {}--35个矿坑抽取后的数据
|
|
local allData = {}--总奖励数据
|
|
local curBasicPool = 0
|
|
local curFinalPool = 0
|
|
|
|
local ActInfo = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.YiJingBaoKu)--活动数据
|
|
local BlessingConfigNew = ConfigManager.GetConfigDataByKey(ConfigName.BlessingConfigNew,"ActivityId",ActInfo.activityId)
|
|
local RewardAllConfig = ConfigManager.GetConfig(ConfigName.BlessingRewardPoolNew)
|
|
--领取过的35条数据
|
|
for i = 1, 99 do
|
|
if ActInfo.mission[i] then
|
|
local v = ActInfo.mission[i]
|
|
if v.missionId < 100 then
|
|
local data = {}
|
|
data.Id = v.missionId
|
|
data.rewardId = v.progress
|
|
data.reward = {}
|
|
if v.progress ~= 0 then
|
|
data.reward = RewardAllConfig[v.progress].Reward
|
|
data.configId = RewardAllConfig[v.progress].Id
|
|
end
|
|
-- LogGreen("Id:"..v.missionId.." rewardId:"..v.progress.." ")
|
|
table.insert(finalCardDatas,data)
|
|
end
|
|
end
|
|
end
|
|
|
|
--大奖和当前层数数据
|
|
for i = 1, 1100 do
|
|
if ActInfo.mission[i] then
|
|
local v = ActInfo.mission[i]
|
|
if v.missionId == 100 then
|
|
-- LogYellow("层数:"..v.progress)
|
|
actData.curLevel = v.progress
|
|
curBasicPool = BlessingConfigNew.BasicPoolId[v.progress]
|
|
curFinalPool = BlessingConfigNew.FinalPoolId
|
|
elseif v.missionId > 1000 then
|
|
local data = {}
|
|
data.rewardId = v.missionId-1000
|
|
data.progress = v.progress
|
|
-- LogYellow("rewardId:"..data.rewardId.." data.progress:"..data.progress)
|
|
data.configId = RewardAllConfig[data.rewardId].Id
|
|
table.insert(allData,data)
|
|
end
|
|
end
|
|
end
|
|
--初始的坑的35条数据
|
|
local RewardConfig = ConfigManager.GetAllConfigsDataByKey(ConfigName.BlessingRewardPoolNew,"PoolId",curBasicPool)
|
|
local index = 1
|
|
for i = 1, #RewardConfig do
|
|
local j = 1
|
|
while(j <= RewardConfig[i].InitializeNum) do
|
|
local data = {}
|
|
if index ~= 18 then
|
|
data.rewardId = RewardConfig[i].Id
|
|
data.reward = {}
|
|
data.reward = RewardConfig[i].Reward
|
|
j = j + 1
|
|
else
|
|
data.rewardId = 0
|
|
data.reward = nil
|
|
end
|
|
table.insert(initCardDatas,data)
|
|
index = index + 1
|
|
end
|
|
end
|
|
|
|
actData.activityId = ActInfo.activityId
|
|
actData.curBasicPool = curBasicPool
|
|
actData.curFinalPool = curFinalPool
|
|
actData.selectId = ActInfo.value
|
|
actData.endTime = ActInfo.endTime
|
|
-- LogPink("大奖Id:"..ActInfo.value)
|
|
|
|
actData.initCardDatas = initCardDatas
|
|
actData.finalCardDatas = finalCardDatas
|
|
actData.allData = allData
|
|
|
|
return actData
|
|
end
|
|
|
|
--宝库奖励的剩余数据
|
|
function this.GetLeftRewardData()
|
|
local actData = this.GetBaoKuData()
|
|
local finalCardDatas = actData.finalCardDatas
|
|
local RewardConfig = ConfigManager.GetAllConfigsDataByKey(ConfigName.BlessingRewardPoolNew,"PoolId",actData.curLevel)--初始所有奖励数据
|
|
local data={}
|
|
for i = 1, #RewardConfig do
|
|
data[RewardConfig[i].Id] = {}
|
|
data[RewardConfig[i].Id].id = RewardConfig[i].Id
|
|
data[RewardConfig[i].Id].reward = RewardConfig[i].Reward
|
|
data[RewardConfig[i].Id].progress = RewardConfig[i].InitializeNum
|
|
data[RewardConfig[i].Id].limit = RewardConfig[i].InitializeNum
|
|
end
|
|
|
|
-- LogYellow("#finalCardDatas:"..#finalCardDatas.." actData.selectId:"..actData.selectId)
|
|
for i = 1, #finalCardDatas do
|
|
if finalCardDatas[i].rewardId and finalCardDatas[i].rewardId ~= 0 and finalCardDatas[i].rewardId ~= actData.selectId then
|
|
-- LogYellow("i:"..i.." rewardId:"..tostring(finalCardDatas[i].rewardId) .." progress"..tonumber(data[finalCardDatas[i].rewardId].progress))
|
|
data[finalCardDatas[i].rewardId].progress = data[finalCardDatas[i].rewardId].progress - 1
|
|
end
|
|
end
|
|
return data
|
|
end
|
|
|
|
function this.LingShouBuildData()
|
|
local rewardData={}
|
|
local showData={}
|
|
local ActData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.LingShouBaoGe)
|
|
local activityId = ActData.activityId
|
|
local LSrewardData = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig,"ActivityId",activityId)
|
|
local array = ConfigManager.GetAllConfigsDataByKey(ConfigName.LotterySetting,"ActivityId",activityId)
|
|
local singleRecruit = array[1]
|
|
local tenRecruit = array[2]
|
|
local curScore = 0
|
|
--第一条为选择抽取的灵兽信息
|
|
for index, value in ipairs(ActData.mission) do
|
|
local v = ActData.mission[index]
|
|
if v.missionId == 0 then
|
|
if v.progress == 0 then
|
|
local mergePool = singleRecruit.MergePool
|
|
local poolId = ConfigManager.GetConfigDataByKey(ConfigName.LotterySpecialConfig,"Type",mergePool).pool_id
|
|
local tempData = ConfigManager.GetConfigDataByKey(ConfigName.LotteryRewardConfig,"Pool",poolId)
|
|
showData.sasId = 0
|
|
showData.monsterId = tempData.Reward[1]
|
|
showData.iconId = LSrewardData[1].Reward[1][1]
|
|
else
|
|
local tempData = SpiritAnimalSummonConfig[v.progress]
|
|
showData.sasId = tempData.Id
|
|
showData.monsterId = tempData.FocusID
|
|
showData.iconId = tempData.TargetItemList[2]
|
|
end
|
|
end
|
|
end
|
|
--剩下的是奖励信息
|
|
for i = 1, #LSrewardData do
|
|
local v = LSrewardData[i]
|
|
for index, value in ipairs(ActData.mission) do
|
|
if v.Id == value.missionId then
|
|
local data = {}
|
|
data.missionId = value.missionId
|
|
data.reward = {}
|
|
data.iconId = showData.iconId
|
|
data.num = v.Reward[1][2]
|
|
data.value = v.Values[1][1]
|
|
curScore = ActData.mission[index].progress
|
|
if curScore >= data.value then
|
|
if value.state == 0 then
|
|
data.state = 1--可领的
|
|
else
|
|
data.state = 2--领完的
|
|
end
|
|
else
|
|
data.state = 0--不可领的
|
|
end
|
|
table.insert(rewardData,data)
|
|
end
|
|
end
|
|
end
|
|
return rewardData,showData,curScore
|
|
end
|
|
|
|
function this.LingShouUpCheckRed()
|
|
local freeTime = 0
|
|
local lotterySetting=ConfigManager.GetConfig(ConfigName.LotterySetting)
|
|
local ActData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.LingShouBaoGe)
|
|
if not ActData then
|
|
return false
|
|
end
|
|
local array = ConfigManager.GetAllConfigsDataByKey(ConfigName.LotterySetting,"ActivityId",ActData.activityId)
|
|
local freeTimesId=lotterySetting[array[1].Id].FreeTimes
|
|
if freeTimesId > 0 then
|
|
freeTime = PrivilegeManager.GetPrivilegeRemainValue(freeTimesId)
|
|
end
|
|
|
|
local rewardData,showData,curScore = DynamicActivityManager.LingShouBuildData()
|
|
for i = 1, #rewardData do
|
|
if rewardData[i].state == 1 or freeTime >=1 then
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
return this |