Major Update - 2.0.0.143
EN: 2.0.0.143 CN: 2.0.0.142 JP: 2.0.0.145 KR: 2.0.0.150
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -154,4 +154,7 @@ function ActivityDataBase:RefreshStateData(bRedDot, bBanner)
|
||||
end
|
||||
function ActivityDataBase:UpdateStatus()
|
||||
end
|
||||
function ActivityDataBase:GetSpecialParam()
|
||||
return self.actCfg.SpecialParam
|
||||
end
|
||||
return ActivityDataBase
|
||||
|
||||
@@ -66,16 +66,16 @@ function ActivityLevelTypeData:RefreshActivityLevelGameActData(actId, msgData)
|
||||
if tmpData.Type == GameEnum.ActivityLevelType.Explore then
|
||||
if self.levelTabExplore[v.Id] then
|
||||
self.levelTabExplore[v.Id].Star = v.Star
|
||||
self.levelTabExplore[v.Id].BuildId = v.BuildId
|
||||
self.levelTabExplore[v.Id].BuildId = v.Build.BuildId
|
||||
end
|
||||
elseif tmpData.Type == GameEnum.ActivityLevelType.Adventure then
|
||||
if self.levelTabAdventure[v.Id] then
|
||||
self.levelTabAdventure[v.Id].Star = v.Star
|
||||
self.levelTabAdventure[v.Id].BuildId = v.BuildId
|
||||
self.levelTabAdventure[v.Id].BuildId = v.Build.BuildId
|
||||
end
|
||||
elseif tmpData.Type == GameEnum.ActivityLevelType.HARD and self.levelTabHard[v.Id] then
|
||||
self.levelTabHard[v.Id].Star = v.Star
|
||||
self.levelTabHard[v.Id].BuildId = v.BuildId
|
||||
self.levelTabHard[v.Id].BuildId = v.Build.BuildId
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -449,10 +449,13 @@ function ActivityLevelTypeData:SendEnterActivityLevelsApplyReq(nActivityId, nLev
|
||||
end
|
||||
self.entryLevelId = nLevelId
|
||||
self.entryBuildId = nBuildId
|
||||
local mapBuildData = PlayerData.Build:GetBuildData(nBuildId)
|
||||
local bTrial = mapBuildData.nBuildSource == AllEnum.BuildSource.Trial or mapBuildData.nBuildSource == AllEnum.BuildSource.LimitedTrial
|
||||
local nBuildType = bTrial and 2 or 1
|
||||
local msg = {}
|
||||
msg.ActivityId = nActivityId
|
||||
msg.LevelId = nLevelId
|
||||
msg.BuildId = nBuildId
|
||||
msg.Build = {Type = nBuildType, BuildId = nBuildId}
|
||||
self._EntryTime = CS.ClientManager.Instance.serverTimeStampWithTimeZone
|
||||
local msgCallback = function(_, msgData)
|
||||
self:SetCachedSelBuildId(nBuildId, nLevelId)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,8 @@ local AdvertiseActData = class("AdvertiseActData", ActivityDataBase)
|
||||
function AdvertiseActData:Init()
|
||||
self.nStatus = 0
|
||||
self.jointDrillActCfg = nil
|
||||
self.bIsMove = ConfigTable.GetData("AdControl", self.actCfg.Id).IsMove
|
||||
self.adCfg = ConfigTable.GetData("AdControl", self.actCfg.Id)
|
||||
self.bIsMove = self.adCfg.IsMove
|
||||
self:InitConfig()
|
||||
end
|
||||
function AdvertiseActData:InitConfig()
|
||||
@@ -19,6 +20,25 @@ function AdvertiseActData:CheckHideFromActList()
|
||||
end
|
||||
return true
|
||||
end
|
||||
function AdvertiseActData:GetActivityRedDot()
|
||||
if self.bRedDot then
|
||||
return true
|
||||
end
|
||||
if self.adCfg == nil or self.bCheckIncludeRedDot then
|
||||
return false
|
||||
end
|
||||
self.bCheckIncludeRedDot = true
|
||||
local bRedDot = false
|
||||
for _, nActId in ipairs(self.adCfg.IncludeAct or {}) do
|
||||
local actData = PlayerData.Activity:GetActivityDataById(nActId)
|
||||
if actData ~= nil and actData:CheckActShow() and actData:GetActivityRedDot() then
|
||||
bRedDot = true
|
||||
break
|
||||
end
|
||||
end
|
||||
self.bCheckIncludeRedDot = false
|
||||
return bRedDot
|
||||
end
|
||||
function AdvertiseActData:CheckShowBanner()
|
||||
if self.bIsMove and self:isFinishAllTasks() then
|
||||
return false
|
||||
|
||||
@@ -4,6 +4,7 @@ local LocalData = require("GameCore.Data.LocalData")
|
||||
local RapidJson = require("rapidjson")
|
||||
local RedDotManager = require("GameCore.RedDot.RedDotManager")
|
||||
local BreakOutLevelData = require("GameCore.Data.DataClass.Activity.BreakOutLevelData")
|
||||
local ModuleManager = require("GameCore.Module.ModuleManager")
|
||||
function BreakOutData:Init()
|
||||
self.allLevelData = {}
|
||||
self.cacheEnterLevelList = {}
|
||||
@@ -390,7 +391,12 @@ function BreakOutData:ShowActivityClosedAlert()
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function BreakOutData:ForceExitOnFinishFail()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.BreakOutPlayPanelS4)
|
||||
local bInAdventure = ModuleManager.GetIsAdventure()
|
||||
if bInAdventure then
|
||||
CS.AdventureModuleHelper.LevelStateChanged(true, 0, true)
|
||||
else
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.BreakOutPlayPanelS4)
|
||||
end
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.BreakOutLevelDetailPanelS4)
|
||||
end
|
||||
return BreakOutData
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
local ActivityGroupDataBase = require("GameCore.Data.DataClass.Activity.ActivityGroupDataBase")
|
||||
local DustDawn_20104Data = class("DustDawn_20104Data", ActivityGroupDataBase)
|
||||
function DustDawn_20104Data:Init()
|
||||
self.tbAllActivity = {}
|
||||
self.nCGActivityId = 0
|
||||
self.sCGPath = ""
|
||||
self.bPlayedCG = false
|
||||
self:ParseActivity()
|
||||
end
|
||||
function DustDawn_20104Data:ParseActivity()
|
||||
if self.actGroupConfig == nil then
|
||||
self.actGroupConfig = ConfigTable.GetData("ActivityGroup", self.nActGroupId)
|
||||
end
|
||||
local sJson = self.actGroupConfig.Enter
|
||||
local tbJson = decodeJson(sJson)
|
||||
for _, activity in pairs(tbJson) do
|
||||
local data = {
|
||||
ActivityId = activity[1],
|
||||
Index = activity[2],
|
||||
PanelId = activity[3]
|
||||
}
|
||||
table.insert(self.tbAllActivity, data)
|
||||
end
|
||||
local sCgJson = self.actGroupConfig.CG
|
||||
if sCgJson ~= nil then
|
||||
local tbCGJson = decodeJson(sCgJson)
|
||||
self.nCGActivityId = tonumber(tbCGJson[1])
|
||||
self.sCGPath = tbCGJson[2]
|
||||
end
|
||||
end
|
||||
function DustDawn_20104Data:GetActivityDataByIndex(nIndex)
|
||||
for _, activity in pairs(self.tbAllActivity) do
|
||||
if activity.Index == nIndex then
|
||||
return activity
|
||||
end
|
||||
end
|
||||
end
|
||||
function DustDawn_20104Data:PlayCG()
|
||||
self:SendMsg_CG_READ(self.nCGActivityId)
|
||||
end
|
||||
function DustDawn_20104Data:GetActivityGroupCGPlayed()
|
||||
if self.bPlayedCG then
|
||||
return true
|
||||
end
|
||||
return PlayerData.Activity:IsCGPlayed(self.nCGActivityId)
|
||||
end
|
||||
function DustDawn_20104Data:IsActivityInActivityGroup(nActivityId)
|
||||
for _, activity in pairs(self.tbAllActivity) do
|
||||
if activity.ActivityId == nActivityId then
|
||||
return true, self.nActGroupId
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
function DustDawn_20104Data:SendMsg_CG_READ(nActivityId)
|
||||
local Callback = function()
|
||||
self.bPlayedCG = true
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.activity_cg_read_req, {nActivityId}, nil, Callback)
|
||||
end
|
||||
return DustDawn_20104Data
|
||||
@@ -63,4 +63,10 @@ function LoginRewardActData:GetActSortId()
|
||||
return self.actCfg.SortId
|
||||
end
|
||||
end
|
||||
function LoginRewardActData:GetActivityRedDot()
|
||||
if self.nActId == 301053 and self:CheckCanReceive() then
|
||||
return true
|
||||
end
|
||||
return self.bRedDot
|
||||
end
|
||||
return LoginRewardActData
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
local ActivityDataBase = require("GameCore.Data.DataClass.Activity.ActivityDataBase")
|
||||
local MailBindActData = class("MailBindActData", ActivityDataBase)
|
||||
local SDKManager = CS.SDKManager.Instance
|
||||
function MailBindActData:Init()
|
||||
self.bBind = false
|
||||
self.bGettedReward = false
|
||||
self.bRequestState = false
|
||||
self.bQueryEmailBindState = false
|
||||
self:AddListeners()
|
||||
end
|
||||
function MailBindActData:AddListeners()
|
||||
EventManager.Add("OnQueryEmailBindState", self, self.On_QueryEmailBindState)
|
||||
EventManager.Add("OnBindEmail", self, self.On_BindEmail)
|
||||
end
|
||||
function MailBindActData:On_QueryEmailBindState(nCode, sLog, bBind)
|
||||
self.bBind = bBind
|
||||
if self.bRequestState then
|
||||
if bBind then
|
||||
local callback = function(_, msgData)
|
||||
self.bGettedReward = true
|
||||
UTILS.OpenReceiveByChangeInfo(msgData)
|
||||
EventManager.Hit("MailBind_RequestUpdate")
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.activity_mail_bind_reward_receive_req, {
|
||||
Value = self.nActId
|
||||
}, nil, callback)
|
||||
self.bRequestState = false
|
||||
elseif self.bQueryEmailBindState then
|
||||
SDKManager:ShowBindEmail()
|
||||
end
|
||||
end
|
||||
self.bQueryEmailBindState = false
|
||||
end
|
||||
local UploadLinkMail = function()
|
||||
local tab = {}
|
||||
table.insert(tab, {
|
||||
"role_id",
|
||||
tostring(PlayerData.Base._nPlayerId)
|
||||
})
|
||||
table.insert(tab, {"action", "1"})
|
||||
NovaAPI.UserEventUpload("link_mail", tab)
|
||||
end
|
||||
function MailBindActData:On_BindEmail(nCode, sLog)
|
||||
if nCode == 0 and self.bBind ~= true then
|
||||
self.bBind = true
|
||||
local callback = function(_, msgData)
|
||||
self.bGettedReward = true
|
||||
UTILS.OpenReceiveByChangeInfo(msgData)
|
||||
EventManager.Hit("MailBind_RequestUpdate")
|
||||
UploadLinkMail()
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.activity_mail_bind_reward_receive_req, {
|
||||
Value = self.nActId
|
||||
}, nil, callback)
|
||||
end
|
||||
self.bRequestState = false
|
||||
end
|
||||
function MailBindActData:RefreshMailBindActData(actId, msgData)
|
||||
self:Init()
|
||||
self.bGettedReward = msgData.Bind
|
||||
end
|
||||
function MailBindActData:GetRewardData()
|
||||
return self.bGettedReward
|
||||
end
|
||||
function MailBindActData:GetRequestState()
|
||||
return self.bRequestState
|
||||
end
|
||||
function MailBindActData:GetBindState()
|
||||
return self.bBind
|
||||
end
|
||||
function MailBindActData:RequestReward()
|
||||
if self.bGettedReward then
|
||||
return
|
||||
end
|
||||
if self.bRequestState then
|
||||
return
|
||||
end
|
||||
self.bRequestState = true
|
||||
self.bQueryEmailBindState = true
|
||||
SDKManager:QueryEmailBindState()
|
||||
end
|
||||
function MailBindActData:CheckActShow()
|
||||
if NovaAPI.IsReviewServerEnv() then
|
||||
return false
|
||||
end
|
||||
if self.actCfg.PreLimit == GameEnum.activityPreLimit.WorldClass then
|
||||
local nCurWorldClass = PlayerData.Base:GetWorldClass()
|
||||
local nNeedWorldClass = tonumber(self.actCfg.LimitParam)
|
||||
if nCurWorldClass < nNeedWorldClass then
|
||||
return false
|
||||
end
|
||||
elseif self.actCfg.PreLimit == GameEnum.activityPreLimit.questLimit then
|
||||
local nStoryId = tonumber(self.actCfg.LimitParam)
|
||||
local bReaded = PlayerData.Avg:IsStoryReaded(nStoryId)
|
||||
if not bReaded then
|
||||
return false
|
||||
end
|
||||
end
|
||||
if self.bGettedReward then
|
||||
return false
|
||||
end
|
||||
if self.actCfg.EndType == GameEnum.activityEndType.NoLimit then
|
||||
return not self.bBanner and self:CheckActivityOpen()
|
||||
else
|
||||
return self:CheckActivityOpen()
|
||||
end
|
||||
end
|
||||
function MailBindActData:CheckShowBanner()
|
||||
if NovaAPI.IsReviewServerEnv() then
|
||||
return false
|
||||
end
|
||||
if self.actCfg.PreLimit == GameEnum.activityPreLimit.WorldClass then
|
||||
local nCurWorldClass = PlayerData.Base:GetWorldClass()
|
||||
local nNeedWorldClass = tonumber(self.actCfg.LimitParam)
|
||||
if nCurWorldClass < nNeedWorldClass then
|
||||
return false
|
||||
end
|
||||
elseif self.actCfg.PreLimit == GameEnum.activityPreLimit.questLimit then
|
||||
local nStoryId = tonumber(self.actCfg.LimitParam)
|
||||
local bReaded = PlayerData.Avg:IsStoryReaded(nStoryId)
|
||||
if not bReaded then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return not self.bGettedReward and self.actCfg.BannerRes ~= "" and self.bBanner == false
|
||||
end
|
||||
return MailBindActData
|
||||
@@ -0,0 +1,87 @@
|
||||
local ActivityDataBase = require("GameCore.Data.DataClass.Activity.ActivityDataBase")
|
||||
local MallCheckInActData = class("MallCheckInActData", ActivityDataBase)
|
||||
function MallCheckInActData:Init()
|
||||
self.nCanReceives = 0
|
||||
self.nActual = 0
|
||||
self.tbRewardList = {}
|
||||
self.loginRewardActCfg = nil
|
||||
self.bIsMove = false
|
||||
self.bActive = false
|
||||
self:InitRewardList()
|
||||
end
|
||||
function MallCheckInActData:InitRewardList()
|
||||
local mapActCfg = ConfigTable.GetData("LoginRewardControl", self.nActId)
|
||||
if nil == mapActCfg then
|
||||
return
|
||||
end
|
||||
self.loginRewardActCfg = mapActCfg
|
||||
local tbRewardList = CacheTable.GetData("_LoginRewardGroup", mapActCfg.RewardsGroup)
|
||||
if tbRewardList == nil then
|
||||
printError(string.format("LoginRewardGroup表中不存在奖励组id为 %s 的配置!!!", mapActCfg.RewardsGroup))
|
||||
return
|
||||
end
|
||||
table.sort(tbRewardList, function(a, b)
|
||||
return a.Order < b.Order
|
||||
end)
|
||||
self.tbRewardList = tbRewardList
|
||||
self.bIsMove = self.loginRewardActCfg.IsMove or false
|
||||
end
|
||||
function MallCheckInActData:HitMallChangeEvent()
|
||||
PlayerData.Mall:UpdateMallActivityRedDot()
|
||||
EventManager.Hit("MallActivityChange", self.nActId)
|
||||
end
|
||||
function MallCheckInActData:RefreshActivityData(mapActData)
|
||||
ActivityDataBase.RefreshActivityData(self, mapActData)
|
||||
self:HitMallChangeEvent()
|
||||
end
|
||||
function MallCheckInActData:RefreshStateData(bRedDot, bBanner)
|
||||
ActivityDataBase.RefreshStateData(self, bRedDot, bBanner)
|
||||
self:HitMallChangeEvent()
|
||||
end
|
||||
function MallCheckInActData:RefreshMallLoginData(mapMsgData)
|
||||
self.bActive = mapMsgData.active == true
|
||||
self:RefreshLoginData(mapMsgData.LoginDays or 0, mapMsgData.Received or 0)
|
||||
self:HitMallChangeEvent()
|
||||
end
|
||||
function MallCheckInActData:RefreshLoginData(nReceive, nActual)
|
||||
self.nCanReceives = nReceive
|
||||
self.nActual = nActual
|
||||
for k, v in ipairs(self.tbRewardList) do
|
||||
v.Status = 0
|
||||
if k <= nReceive then
|
||||
v.Status = 1
|
||||
end
|
||||
if k <= nActual then
|
||||
v.Status = 2
|
||||
end
|
||||
end
|
||||
end
|
||||
function MallCheckInActData:ReceiveRewardSuc()
|
||||
self:RefreshLoginData(self.nCanReceives, self.nCanReceives)
|
||||
self:HitMallChangeEvent()
|
||||
end
|
||||
function MallCheckInActData:GetActLoginRewardList()
|
||||
return self.tbRewardList
|
||||
end
|
||||
function MallCheckInActData:GetCanReceive()
|
||||
return self.nCanReceives
|
||||
end
|
||||
function MallCheckInActData:GetReceived()
|
||||
return self.nActual
|
||||
end
|
||||
function MallCheckInActData:GetActive()
|
||||
return self.bActive
|
||||
end
|
||||
function MallCheckInActData:CheckCanReceive()
|
||||
return self.bActive and self.nCanReceives > self.nActual
|
||||
end
|
||||
function MallCheckInActData:CheckMallRedDot()
|
||||
return self:CheckCanReceive()
|
||||
end
|
||||
function MallCheckInActData:GetActivityRedDot()
|
||||
return self.bRedDot or self:CheckCanReceive()
|
||||
end
|
||||
function MallCheckInActData:GetLoginRewardControlCfg()
|
||||
return self.loginRewardActCfg
|
||||
end
|
||||
return MallCheckInActData
|
||||
@@ -0,0 +1,170 @@
|
||||
local ActivityDataBase = require("GameCore.Data.DataClass.Activity.ActivityDataBase")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local MathParkourActData = class("MathParkourActData", ActivityDataBase)
|
||||
local RapidJson = require("rapidjson")
|
||||
local RedDotManager = require("GameCore.RedDot.RedDotManager")
|
||||
function MathParkourActData:Init()
|
||||
self:AddListeners()
|
||||
end
|
||||
function MathParkourActData:AddListeners()
|
||||
EventManager.Add(EventId.IsNewDay, self, self.OnEvent_NewDay)
|
||||
EventManager.Add("ClearAllMathParkourLevels", self, self.OnEvent_GMClearAllLevels)
|
||||
end
|
||||
function MathParkourActData:OnEvent_NewDay()
|
||||
end
|
||||
function MathParkourActData:OnEvent_GMClearAllLevels(mapMsgData)
|
||||
if mapMsgData == nil then
|
||||
return
|
||||
end
|
||||
if mapMsgData.ActivityId ~= nil and mapMsgData.ActivityId ~= 0 and mapMsgData.ActivityId ~= self.nActId then
|
||||
return
|
||||
end
|
||||
local tbLevels = mapMsgData.Levels or mapMsgData.levels
|
||||
if tbLevels ~= nil then
|
||||
self:CacheAllLevelData(tbLevels)
|
||||
self:RefreshNewLevelRedDot()
|
||||
end
|
||||
EventManager.Hit("MathParkourLevelUpdate")
|
||||
end
|
||||
function MathParkourActData:CacheAllLevelData(LevelDataList)
|
||||
self.tbLevelData = {}
|
||||
self.cacheEnterLevelList = {}
|
||||
local sJson = LocalData.GetPlayerLocalData("MathParkourLevel")
|
||||
local tb = decodeJson(sJson)
|
||||
if type(tb) == "table" then
|
||||
self.cacheEnterLevelList = tb
|
||||
end
|
||||
local GetLevelData = function(lineData)
|
||||
if lineData.ActivityId == self.nActId then
|
||||
local levelData = {
|
||||
nId = lineData.Id,
|
||||
nScore = 0,
|
||||
nStar = 0
|
||||
}
|
||||
self.tbLevelData[levelData.nId] = levelData
|
||||
end
|
||||
end
|
||||
ForEachTableLine(DataTable.MathParkourLevel, GetLevelData)
|
||||
for _, v in pairs(LevelDataList) do
|
||||
if self.tbLevelData[v.LevelId] == nil then
|
||||
local levelData = {
|
||||
nId = v.LevelId,
|
||||
nScore = 0,
|
||||
nStar = 0
|
||||
}
|
||||
self.tbLevelData[levelData.nId] = levelData
|
||||
end
|
||||
self.tbLevelData[v.LevelId].nScore = v.Score
|
||||
self.tbLevelData[v.LevelId].nStar = v.Star
|
||||
end
|
||||
end
|
||||
function MathParkourActData:GetLevelData(nLevelId)
|
||||
return self.tbLevelData[nLevelId]
|
||||
end
|
||||
function MathParkourActData:GetAllLevelData()
|
||||
local tbLevelList = {}
|
||||
for _, v in pairs(self.tbLevelData) do
|
||||
table.insert(tbLevelList, v)
|
||||
end
|
||||
table.sort(tbLevelList, function(a, b)
|
||||
return a.nId < b.nId
|
||||
end)
|
||||
return tbLevelList
|
||||
end
|
||||
function MathParkourActData:GetLevelUnlock(nLevelId)
|
||||
local tbLevelList = self:GetAllLevelData()
|
||||
local nLevelIndex = 1
|
||||
local levelData = self.tbLevelData[nLevelId]
|
||||
if levelData == nil then
|
||||
return false
|
||||
end
|
||||
nLevelIndex = table.indexof(tbLevelList, levelData)
|
||||
if nLevelIndex == 1 then
|
||||
return true
|
||||
else
|
||||
return tbLevelList[nLevelIndex - 1].nStar > 0
|
||||
end
|
||||
end
|
||||
function MathParkourActData:GetNextLevelId(nLevelId)
|
||||
local tbLevelList = self:GetAllLevelData()
|
||||
local nLevelIndex = 1
|
||||
for i, v in ipairs(tbLevelList) do
|
||||
if v.nId == nLevelId then
|
||||
nLevelIndex = i
|
||||
break
|
||||
end
|
||||
end
|
||||
if nLevelIndex == #tbLevelList then
|
||||
return nil
|
||||
else
|
||||
return tbLevelList[nLevelIndex + 1].nId
|
||||
end
|
||||
end
|
||||
function MathParkourActData:RefreshMathParkourActData(actId, msgData)
|
||||
self:Init()
|
||||
self.nActId = actId
|
||||
self:CacheAllLevelData(msgData.Levels)
|
||||
self:RefreshNewLevelRedDot()
|
||||
end
|
||||
function MathParkourActData:RefreshNewLevelRedDot()
|
||||
local tbLevelList = self:GetAllLevelData()
|
||||
for _, v in ipairs(tbLevelList) do
|
||||
if table.indexof(self.cacheEnterLevelList, v.nId) == 0 and self:GetLevelUnlock(v.nId) then
|
||||
RedDotManager.SetValid(RedDotDefine.Activity_MathParkour_New_Level, {
|
||||
self.nActId,
|
||||
v.nId
|
||||
}, true)
|
||||
else
|
||||
RedDotManager.SetValid(RedDotDefine.Activity_MathParkour_New_Level, {
|
||||
self.nActId,
|
||||
v.nId
|
||||
}, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
function MathParkourActData:OpenTempChangeInfo()
|
||||
if self.tempChangeInfo ~= nil then
|
||||
UTILS.OpenReceiveByChangeInfo(self.tempChangeInfo)
|
||||
end
|
||||
self.tempChangeInfo = nil
|
||||
end
|
||||
function MathParkourActData:GetCacheLevelId()
|
||||
return self.cacheLevelId
|
||||
end
|
||||
function MathParkourActData:ClearCacheLevelId()
|
||||
self.cacheLevelId = nil
|
||||
end
|
||||
function MathParkourActData:EnterLevel(nLevelId)
|
||||
if table.indexof(self.cacheEnterLevelList, nLevelId) == 0 then
|
||||
table.insert(self.cacheEnterLevelList, nLevelId)
|
||||
end
|
||||
LocalData.SetPlayerLocalData("MathParkourLevel", RapidJson.encode(self.cacheEnterLevelList))
|
||||
self:RefreshNewLevelRedDot()
|
||||
end
|
||||
function MathParkourActData:GetLevelIsNew(nLevelId)
|
||||
if table.indexof(self.cacheEnterLevelList, nLevelId) == 0 then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
function MathParkourActData:DoResult(nLevelId, bResult, nScore, nStar, nPropCount)
|
||||
self.cacheLevelId = nLevelId
|
||||
local msgData = {
|
||||
ActivityId = self.nActId,
|
||||
LevelId = nLevelId,
|
||||
TotalScore = bResult == true and nScore or 0,
|
||||
State = bResult,
|
||||
PropCount = nPropCount
|
||||
}
|
||||
local callback = function(_, callbackData)
|
||||
if bResult then
|
||||
local levelData = self:GetLevelData(nLevelId)
|
||||
levelData.nScore = math.max(levelData.nScore, nScore)
|
||||
levelData.nStar = math.max(levelData.nStar, nStar)
|
||||
self.tempChangeInfo = callbackData.Change
|
||||
EventManager.Hit("MathParkourLevelUpdate")
|
||||
end
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.activity_math_parkour_level_settle_req, msgData, nil, callback)
|
||||
end
|
||||
return MathParkourActData
|
||||
@@ -5,6 +5,11 @@ local PenguinLevel_Normal = require("Game.UI.Play_PenguinCard.NormalMode.Penguin
|
||||
local PenguinLevel_Endless = require("Game.UI.Play_PenguinCard.EndlessMode.PenguinLevel_Endless")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
local RapidJson = require("rapidjson")
|
||||
local tbGuideGroupId = {
|
||||
301,
|
||||
302,
|
||||
303
|
||||
}
|
||||
function PenguinCardActData:Init()
|
||||
self.mapLevelData = {}
|
||||
self.tbLevelList = {}
|
||||
@@ -186,6 +191,37 @@ function PenguinCardActData:CheckLevelLockByPrev(nLevelId)
|
||||
end
|
||||
return true
|
||||
end
|
||||
function PenguinCardActData:CheckLevelSkipAble(nLevelId)
|
||||
local mapCfg = ConfigTable.GetData("ActivityPenguinCardLevel", nLevelId)
|
||||
if not mapCfg then
|
||||
return false
|
||||
end
|
||||
for _, nGroupId in ipairs(tbGuideGroupId) do
|
||||
if not PlayerData.Guide:CheckGuideFinishById(nGroupId) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
local mapLevel = self:GetLevelData(nLevelId)
|
||||
local bComplete = false
|
||||
if mapCfg.Type == GameEnum.ActivityPenguinCardLevelType.Endless then
|
||||
bComplete = mapLevel.nScore > 0
|
||||
else
|
||||
bComplete = 0 < mapLevel.nStar
|
||||
end
|
||||
return mapCfg.Skip and not bComplete
|
||||
end
|
||||
function PenguinCardActData:CheckEndlessLevelUnlock()
|
||||
for _, nLevelId in ipairs(self.tbLevelList) do
|
||||
local mapCfg = ConfigTable.GetData("ActivityPenguinCardLevel", nLevelId)
|
||||
if mapCfg and mapCfg.Type == GameEnum.ActivityPenguinCardLevelType.Endless then
|
||||
local bLock = self:CheckLevelLock(nLevelId)
|
||||
if not bLock then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
function PenguinCardActData:GetLevelData(nId)
|
||||
return self.mapLevelData[nId] or {
|
||||
nScore = 0,
|
||||
@@ -256,7 +292,7 @@ function PenguinCardActData:RefreshLevelRedDot()
|
||||
end
|
||||
else
|
||||
local bLock = self:CheckLevelLock(nId)
|
||||
local bHasScore = self.mapLevelData[nId] and 0 < self.mapLevelData[nId].nScore
|
||||
local bHasScore = self.mapLevelData[nId] and (0 < self.mapLevelData[nId].nScore or 0 < self.mapLevelData[nId].nStar)
|
||||
local bNew = not bLock and not bHasScore
|
||||
if bNew then
|
||||
table.insert(self.tbNewLevel, nId)
|
||||
@@ -282,6 +318,13 @@ function PenguinCardActData:SkipLevelRedDot()
|
||||
end
|
||||
LocalData.SetPlayerLocalData("PenguinCardLevel", RapidJson.encode(self.tbSkipNewLevel))
|
||||
end
|
||||
function PenguinCardActData:SendSkipLevelReq(nLevelId, callback)
|
||||
local bAble = self:CheckLevelSkipAble(nLevelId)
|
||||
if not bAble then
|
||||
return
|
||||
end
|
||||
self:SendActivityPenguinCardSettleReq(nLevelId, 3, 0, 0, callback)
|
||||
end
|
||||
function PenguinCardActData:SendActivityPenguinCardSettleReq(nLevelId, nStar, nScore, nDifficulty, callback)
|
||||
nScore = math.floor(nScore)
|
||||
local msgData = {
|
||||
@@ -293,11 +336,12 @@ function PenguinCardActData:SendActivityPenguinCardSettleReq(nLevelId, nStar, nS
|
||||
local successCallback = function(_, mapMainData)
|
||||
local bEmpty = self.mapLevelData[nLevelId] == nil
|
||||
local bBetterDifficulty = not bEmpty and nDifficulty > self.mapLevelData[nLevelId].nDifficulty
|
||||
local bBetterScore = not bEmpty and nDifficulty == self.mapLevelData[nLevelId].nDifficulty and nScore > self.mapLevelData[nLevelId].nScore
|
||||
local bBetterStar = not bEmpty and nDifficulty == self.mapLevelData[nLevelId].nDifficulty and nStar > self.mapLevelData[nLevelId].nStar
|
||||
local bBetterScore = not bEmpty and nDifficulty == self.mapLevelData[nLevelId].nDifficulty and nStar == self.mapLevelData[nLevelId].nStar and nScore > self.mapLevelData[nLevelId].nScore
|
||||
if not bEmpty then
|
||||
self.mapLevelData[nLevelId].sData = ""
|
||||
end
|
||||
if bEmpty or bBetterDifficulty or bBetterScore then
|
||||
if bEmpty or bBetterDifficulty or bBetterStar or bBetterScore then
|
||||
self.mapLevelData[nLevelId] = {
|
||||
nScore = nScore,
|
||||
nStar = nStar,
|
||||
|
||||
@@ -172,7 +172,20 @@ function PeriodicQuestActData:GetQuestProgress()
|
||||
return curProgress, allProgress, canReceive
|
||||
end
|
||||
function PeriodicQuestActData:CheckFinalReward()
|
||||
return self.bFinalStatus
|
||||
local bHasFinalReward = false
|
||||
if self.perQuestActCfg ~= nil then
|
||||
for i = 1, 3 do
|
||||
if self.perQuestActCfg["FinalReward" .. i] ~= 0 then
|
||||
bHasFinalReward = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if bHasFinalReward then
|
||||
return self.bFinalStatus
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
function PeriodicQuestActData:CheckAllQuestComplete()
|
||||
local bAllComplete = true
|
||||
@@ -208,7 +221,7 @@ function PeriodicQuestActData:RefreshRedDot()
|
||||
}, 0 < v and bOpen)
|
||||
end
|
||||
local nCur, nAll = self:GetQuestProgress()
|
||||
local bFinalReward = nAll <= nCur and not self.bFinalStatus
|
||||
local bFinalReward = nAll <= nCur and not self:CheckFinalReward()
|
||||
RedDotManager.SetValid(RedDotDefine.Activity_Periodic_Final_Reward, self.nActId, bFinalReward and bOpen)
|
||||
RedDotManager.SetValid(RedDotDefine.Activity_Tab, self.nActId, (bQuestReward or bFinalReward) and bOpen)
|
||||
end
|
||||
|
||||
@@ -40,6 +40,11 @@ local Summer_20103Data = require("GameCore.Data.DataClass.Activity.Summer_20103D
|
||||
local IceCreamActData = require("GameCore.Data.DataClass.Activity.IceCreamActData")
|
||||
local SoldierActData = require("GameCore.Data.DataClass.Activity.SoldierActData")
|
||||
local LongestDay_10112Data = require("GameCore.Data.DataClass.Activity.LongestDay_10112Data")
|
||||
local MathParkourActData = require("GameCore.Data.DataClass.Activity.MathParkourActData")
|
||||
local DustDawn_20104Data = require("GameCore.Data.DataClass.Activity.DustDawn_20104Data")
|
||||
local MailBindActData = require("GameCore.Data.DataClass.Activity.MailBindActData")
|
||||
local MallCheckInActData = require("GameCore.Data.DataClass.Activity.MallCheckInActData")
|
||||
local UnchartedMap_10113Data = require("GameCore.Data.DataClass.Activity.UnchartedMap_10113Data")
|
||||
function PlayerActivityData:Init()
|
||||
self.bCacheActData = false
|
||||
self.tbAllActivity = {}
|
||||
@@ -47,6 +52,7 @@ function PlayerActivityData:Init()
|
||||
self.tbActivityPopUp = {}
|
||||
self.tbLoginRewardPopUp = {}
|
||||
self.tbReadedCG = {}
|
||||
self.mapMallActType = {}
|
||||
self:InitActivityCfg()
|
||||
EventManager.Add(EventId.IsNewDay, self, self.OnEvent_NewDay)
|
||||
EventManager.Add(EventId.UpdateWorldClass, self, self.OnEvent_UpdateWorldClass)
|
||||
@@ -90,6 +96,10 @@ function PlayerActivityData:InitActivityCfg()
|
||||
CacheTable.SetData("_ActivityTaskControl", line.ActivityId, line)
|
||||
end
|
||||
ForEachTableLine(DataTable.ActivityTaskControl, foreachTableLine)
|
||||
self.mapMallActType = {}
|
||||
for _, nType in ipairs(ConfigTable.GetConfigNumberArray("MallActType") or {}) do
|
||||
self.mapMallActType[nType] = true
|
||||
end
|
||||
end
|
||||
function PlayerActivityData:CacheAllActivityData(mapNetMsg)
|
||||
if mapNetMsg.List ~= nil then
|
||||
@@ -97,17 +107,13 @@ function PlayerActivityData:CacheAllActivityData(mapNetMsg)
|
||||
for _, v in ipairs(mapNetMsg.List) do
|
||||
local nActId = v.Id
|
||||
local actCfg = ConfigTable.GetData("Activity", nActId)
|
||||
if nil ~= actCfg then
|
||||
if actCfg.ActivityType == GameEnum.activityType.Story then
|
||||
PlayerData.ActivityAvg:CacheAvgData(v.StoryChapter, nActId)
|
||||
elseif actCfg.ActivityType == GameEnum.activityType.HistoryStory then
|
||||
PlayerData.ActivityAvg:CacheAvgData(v.HistoryStoryChapter, nActId)
|
||||
end
|
||||
if nil ~= actCfg and v.HistoryStoryChapter ~= nil then
|
||||
PlayerData.ActivityAvg:CacheAvgData(v.HistoryStoryChapter, nActId)
|
||||
end
|
||||
if nil ~= actCfg then
|
||||
if actCfg.ActivityType == GameEnum.activityType.PeriodicQuest then
|
||||
self:RefreshPeriodicActQuest(nActId, v.Periodic)
|
||||
elseif actCfg.ActivityType == GameEnum.activityType.LoginReward then
|
||||
elseif actCfg.ActivityType == GameEnum.activityType.LoginReward or actCfg.ActivityType == GameEnum.activityType.SignIn then
|
||||
self:RefreshLoginRewardActData(nActId, v.Login)
|
||||
elseif actCfg.ActivityType == GameEnum.activityType.Mining then
|
||||
self:RefreshMiningGameActData(nActId, v.Mining)
|
||||
@@ -159,6 +165,12 @@ function PlayerActivityData:CacheAllActivityData(mapNetMsg)
|
||||
self:RefreshIceCreamActData(nActId, v.IceCream)
|
||||
elseif actCfg.ActivityType == GameEnum.activityType.Soldier then
|
||||
self:RefreshSoldierActData(nActId, v.Soldier)
|
||||
elseif actCfg.ActivityType == GameEnum.activityType.MathParkour then
|
||||
self:RefreshMathParkourActData(nActId, v.MathParkour)
|
||||
elseif actCfg.ActivityType == GameEnum.activityType.MailBind then
|
||||
self:RefreshMailBindActData(nActId, v.MailBind)
|
||||
elseif actCfg.ActivityType == GameEnum.activityType.MallLogin then
|
||||
self:RefreshMallLoginActData(nActId, v.MallLogin)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -222,7 +234,7 @@ function PlayerActivityData:CreateActivityIns(actData)
|
||||
end
|
||||
if actCfg.ActivityType == GameEnum.activityType.PeriodicQuest then
|
||||
actIns = PeriodicQuestActData.new(actData)
|
||||
elseif actCfg.ActivityType == GameEnum.activityType.LoginReward then
|
||||
elseif actCfg.ActivityType == GameEnum.activityType.LoginReward or actCfg.ActivityType == GameEnum.activityType.SignIn then
|
||||
actIns = LoginRewardActData.new(actData)
|
||||
elseif actCfg.ActivityType == GameEnum.activityType.Mining then
|
||||
actIns = MiningGameData.new(actData)
|
||||
@@ -236,7 +248,7 @@ function PlayerActivityData:CreateActivityIns(actData)
|
||||
actIns = JointDrillActData.new(actData)
|
||||
elseif actCfg.ActivityType == GameEnum.activityType.Levels then
|
||||
actIns = ActivityLevelTypeData.new(actData)
|
||||
elseif actCfg.ActivityType == GameEnum.activityType.HistoryStory or actCfg.ActivityType == GameEnum.activityType.Story then
|
||||
elseif actCfg.ActivityType == GameEnum.activityType.HistoryStory or actCfg.ActivityType == GameEnum.activityType.Story or actCfg.ActivityType == GameEnum.activityType.NewStory then
|
||||
PlayerData.ActivityAvg:CacheActivityAvgData(actData)
|
||||
elseif actCfg.ActivityType == GameEnum.activityType.Task then
|
||||
actIns = ActivityTaskData.new(actData)
|
||||
@@ -264,6 +276,12 @@ function PlayerActivityData:CreateActivityIns(actData)
|
||||
actIns = IceCreamActData.new(actData)
|
||||
elseif actCfg.ActivityType == GameEnum.activityType.Soldier then
|
||||
actIns = SoldierActData.new(actData)
|
||||
elseif actCfg.ActivityType == GameEnum.activityType.MathParkour then
|
||||
actIns = MathParkourActData.new(actData)
|
||||
elseif actCfg.ActivityType == GameEnum.activityType.MailBind then
|
||||
actIns = MailBindActData.new(actData)
|
||||
elseif actCfg.ActivityType == GameEnum.activityType.MallLogin then
|
||||
actIns = MallCheckInActData.new(actData)
|
||||
end
|
||||
if actIns ~= nil then
|
||||
self.tbAllActivity[actData.Id] = actIns
|
||||
@@ -271,6 +289,8 @@ function PlayerActivityData:CreateActivityIns(actData)
|
||||
end
|
||||
function PlayerActivityData:RefreshActivityRedDot()
|
||||
local bHasNewRedDot = false
|
||||
local mapEntranceRedDot = {}
|
||||
local mapEntranceNewRedDot = {}
|
||||
for _, v in pairs(self.tbAllActivity) do
|
||||
RedDotManager.SetValid(RedDotDefine.Activity_Tab, v:GetActId(), v:CheckActShow() and v:GetActivityRedDot() and not v:CheckHideFromActList())
|
||||
if type(v.RefreshRedDot) == "function" then
|
||||
@@ -289,16 +309,42 @@ function PlayerActivityData:RefreshActivityRedDot()
|
||||
bHasNewRedDot = true
|
||||
end
|
||||
RedDotManager.SetValid(RedDotDefine.Activity_New_Tab, v:GetActId(), bNewRedDot)
|
||||
local nEntranceId = v:GetActCfgData().EntranceId or 0
|
||||
mapEntranceRedDot[nEntranceId] = mapEntranceRedDot[nEntranceId] or bTabRedDot
|
||||
mapEntranceNewRedDot[nEntranceId] = mapEntranceNewRedDot[nEntranceId] or bNewRedDot
|
||||
end
|
||||
end
|
||||
local bHasGroupNewRedDot = false
|
||||
for nId, v in pairs(self.tbAllActivityGroup) do
|
||||
if v:CheckActGroupShow() and RedDotManager.GetValid(RedDotDefine.Activity_New_Tab, nId) then
|
||||
bHasGroupNewRedDot = true
|
||||
if v:CheckActGroupShow() then
|
||||
local bGroupNewRedDot = RedDotManager.GetValid(RedDotDefine.Activity_New_Tab, nId)
|
||||
if bGroupNewRedDot then
|
||||
bHasGroupNewRedDot = true
|
||||
end
|
||||
local nEntranceId = v:GetActGroupCfgData().EntranceId or 0
|
||||
mapEntranceRedDot[nEntranceId] = mapEntranceRedDot[nEntranceId] or RedDotManager.GetValid(RedDotDefine.Activity_Group, nId)
|
||||
mapEntranceNewRedDot[nEntranceId] = mapEntranceNewRedDot[nEntranceId] or bGroupNewRedDot
|
||||
end
|
||||
end
|
||||
local bHasRedDot = RedDotManager.GetValid(RedDotDefine.Activity)
|
||||
RedDotManager.SetValid(RedDotDefine.Activity_New, nil, not bHasRedDot and (bHasNewRedDot or bHasGroupNewRedDot))
|
||||
self:RefreshActivityEntranceRedDot(mapEntranceRedDot, mapEntranceNewRedDot)
|
||||
end
|
||||
function PlayerActivityData:RefreshActivityEntranceRedDot(mapEntranceRedDot, mapEntranceNewRedDot)
|
||||
local mapEntranceId = self.mapLastEntranceRedDotId or {}
|
||||
for nEntranceId in pairs(mapEntranceRedDot) do
|
||||
mapEntranceId[nEntranceId] = true
|
||||
end
|
||||
for nEntranceId in pairs(mapEntranceNewRedDot) do
|
||||
mapEntranceId[nEntranceId] = true
|
||||
end
|
||||
for nEntranceId in pairs(mapEntranceId) do
|
||||
local bRedDot = mapEntranceRedDot[nEntranceId] == true
|
||||
local bNewRedDot = not bRedDot and mapEntranceNewRedDot[nEntranceId] == true
|
||||
RedDotManager.SetValid(RedDotDefine.Activity_Entrance, nEntranceId, bRedDot)
|
||||
RedDotManager.SetValid(RedDotDefine.Activity_Entrance_New, nEntranceId, bNewRedDot)
|
||||
end
|
||||
self.mapLastEntranceRedDotId = mapEntranceId
|
||||
end
|
||||
function PlayerActivityData:GetActivityList()
|
||||
return self.tbAllActivity
|
||||
@@ -324,6 +370,34 @@ function PlayerActivityData:GetSortedActList()
|
||||
end)
|
||||
return tbActList
|
||||
end
|
||||
function PlayerActivityData:GetActivitySubEntranceId()
|
||||
local tbEntranceIds = {}
|
||||
local mapHasEntrance = {}
|
||||
local collect = function(nEntranceId)
|
||||
nEntranceId = nEntranceId or 0
|
||||
if nEntranceId <= 0 or mapHasEntrance[nEntranceId] then
|
||||
return
|
||||
end
|
||||
mapHasEntrance[nEntranceId] = true
|
||||
table.insert(tbEntranceIds, nEntranceId)
|
||||
end
|
||||
for _, actData in ipairs(self:GetSortedActList()) do
|
||||
local actCfg = actData:GetActCfgData()
|
||||
if actCfg ~= nil then
|
||||
collect(actCfg.EntranceId)
|
||||
end
|
||||
end
|
||||
for _, actGroupData in ipairs(self:GetSortedActGroupList()) do
|
||||
local actGroupCfg = actGroupData:GetActGroupCfgData()
|
||||
if actGroupCfg ~= nil then
|
||||
collect(actGroupCfg.EntranceId)
|
||||
end
|
||||
end
|
||||
if 1 < #tbEntranceIds then
|
||||
printError(string.format("同时开放了%d个活动列表子入口(EntranceId: %s),只显示第一个", #tbEntranceIds, table.concat(tbEntranceIds, ", ")))
|
||||
end
|
||||
return tbEntranceIds[1] or 0
|
||||
end
|
||||
function PlayerActivityData:GetActivityDataById(nActId)
|
||||
return self.tbAllActivity[nActId] or nil
|
||||
end
|
||||
@@ -334,6 +408,25 @@ function PlayerActivityData:GetActivityDataByType(nActType)
|
||||
end
|
||||
end
|
||||
end
|
||||
function PlayerActivityData:GetMallActivityData()
|
||||
local tbActList = {}
|
||||
for _, actData in pairs(self.tbAllActivity) do
|
||||
if self.mapMallActType[actData:GetActType()] and actData:CheckActShow() then
|
||||
table.insert(tbActList, actData)
|
||||
end
|
||||
end
|
||||
if 1 < #tbActList then
|
||||
table.sort(tbActList, function(a, b)
|
||||
return a:GetActId() < b:GetActId()
|
||||
end)
|
||||
local tbActIds = {}
|
||||
for _, actData in ipairs(tbActList) do
|
||||
table.insert(tbActIds, actData:GetActId())
|
||||
end
|
||||
printError(string.format("同时开放了%d个商城活动(ActivityId: %s),只显示id最小的那个", #tbActList, table.concat(tbActIds, ", ")))
|
||||
end
|
||||
return tbActList[1]
|
||||
end
|
||||
function PlayerActivityData:CacheActivityGroupData()
|
||||
local foreachActGroup = function(mapData)
|
||||
self:CreateActivityGroupIns(mapData)
|
||||
@@ -388,6 +481,10 @@ function PlayerActivityData:CreateActivityGroupIns(actData)
|
||||
actIns = CultivationManual_10111Data.new(actData)
|
||||
elseif actCfg.ActivityThemeType == GameEnum.activityThemeType.LongestDay_10112 then
|
||||
actIns = LongestDay_10112Data.new(actData)
|
||||
elseif actCfg.ActivityThemeType == GameEnum.activityThemeType.DustDawn_20104 then
|
||||
actIns = DustDawn_20104Data.new(actData)
|
||||
elseif actCfg.ActivityThemeType == GameEnum.activityThemeType.UnchartedMap_10113 then
|
||||
actIns = UnchartedMap_10113Data.new(actData)
|
||||
end
|
||||
self.tbAllActivityGroup[actData.Id] = actIns
|
||||
PlayerData.ActivityAvg:RefreshAvgRedDot()
|
||||
@@ -508,8 +605,10 @@ function PlayerActivityData:RefreshSingleQuest(questData)
|
||||
elseif actCfg.ActivityType == GameEnum.activityType.JointDrill then
|
||||
self.tbAllActivity[questData.ActivityId]:RefreshQuestData(questData)
|
||||
elseif actCfg.ActivityType == GameEnum.activityType.Task then
|
||||
self.tbAllActivity[questData.ActivityId]:RefreshSingleQuest(questData)
|
||||
EventManager.Hit("RefreshActivityTask")
|
||||
if self.tbAllActivity[questData.ActivityId] ~= nil then
|
||||
self.tbAllActivity[questData.ActivityId]:RefreshSingleQuest(questData)
|
||||
EventManager.Hit("RefreshActivityTask")
|
||||
end
|
||||
elseif actCfg.ActivityType == GameEnum.activityType.BDConvert then
|
||||
if nil ~= self.tbAllActivity[questData.ActivityId] then
|
||||
self.tbAllActivity[questData.ActivityId]:RefreshQuestData(questData)
|
||||
@@ -552,6 +651,23 @@ function PlayerActivityData:ReceiveLoginRewardSuc(nActId)
|
||||
self.tbAllActivity[nActId]:ReceiveRewardSuc()
|
||||
end
|
||||
end
|
||||
function PlayerActivityData:CacheMallLoginActData(nActId, mapMsgData)
|
||||
self:RefreshMallLoginActData(nActId, mapMsgData)
|
||||
self:RefreshActivityRedDot()
|
||||
end
|
||||
function PlayerActivityData:RefreshMallLoginActData(nActId, actData)
|
||||
if nil == actData or nil == self.tbAllActivity[nActId] then
|
||||
return
|
||||
end
|
||||
self.tbAllActivity[nActId]:RefreshMallLoginData(actData)
|
||||
end
|
||||
function PlayerActivityData:ReceiveMallLoginRewardSuc(nActId)
|
||||
if nil == self.tbAllActivity[nActId] then
|
||||
return
|
||||
end
|
||||
self.tbAllActivity[nActId]:ReceiveRewardSuc()
|
||||
self:RefreshActivityRedDot()
|
||||
end
|
||||
function PlayerActivityData:RefreshPopUpList()
|
||||
self.tbActivityPopUp = {}
|
||||
local bFuncOpen = PlayerData.Base:CheckFunctionUnlock(GameEnum.OpenFuncType.Activity)
|
||||
@@ -580,7 +696,7 @@ function PlayerActivityData:RefreshLoginRewardPopUpList()
|
||||
end
|
||||
for nActId, data in pairs(self.tbAllActivity) do
|
||||
local nActType = data:GetActType()
|
||||
if nActType == GameEnum.activityType.LoginReward and data:CheckCanReceive() and data:CheckActivityOpen() and data:CheckActPlay() then
|
||||
if (nActType == GameEnum.activityType.LoginReward or nActType == GameEnum.activityType.SignIn) and data:CheckCanReceive() and data:CheckActivityOpen() and data:CheckActPlay() then
|
||||
table.insert(self.tbLoginRewardPopUp, data)
|
||||
end
|
||||
end
|
||||
@@ -664,6 +780,11 @@ function PlayerActivityData:RefreshActivityLevelGameActData(nActId, msgData)
|
||||
self.tbAllActivity[nActId]:RefreshActivityLevelGameActData(nActId, msgData)
|
||||
end
|
||||
end
|
||||
function PlayerActivityData:RefreshMailBindActData(nActId, msgData)
|
||||
if nil ~= self.tbAllActivity[nActId] then
|
||||
self.tbAllActivity[nActId]:RefreshMailBindActData(nActId, msgData)
|
||||
end
|
||||
end
|
||||
function PlayerActivityData:SetActivityLevelActId(nActId)
|
||||
self.nActivityLevelActId = nActId
|
||||
end
|
||||
@@ -697,6 +818,11 @@ function PlayerActivityData:RefreshDoubleDropsActData(nActId, msgData)
|
||||
self.tbAllActivity[nActId]:RefreshDoubleDropsActData(nActId, msgData)
|
||||
end
|
||||
end
|
||||
function PlayerActivityData:RefreshMathParkourActData(nActId, msgData)
|
||||
if nil ~= self.tbAllActivity[nActId] then
|
||||
self.tbAllActivity[nActId]:RefreshMathParkourActData(nActId, msgData)
|
||||
end
|
||||
end
|
||||
function PlayerActivityData:GetActivityBannerList()
|
||||
local tbList = {}
|
||||
for _, v in pairs(self.tbAllActivity) do
|
||||
@@ -761,7 +887,14 @@ function PlayerActivityData:SendReceiveLoginRewardMsg(nActId, callFunc, mapNpc)
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.activity_login_reward_receive_req, {Value = nActId}, nil, callback)
|
||||
end
|
||||
function PlayerActivityData:OpenActivityPanel(nActId)
|
||||
function PlayerActivityData:SendReceiveMallLoginRewardMsg(nActId, callFunc, mapNpc)
|
||||
local callback = function(_, mapMsgData)
|
||||
self:ReceiveMallLoginRewardSuc(nActId)
|
||||
UTILS.OpenReceiveByChangeInfo(mapMsgData, callFunc, nil, nil, mapNpc)
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.activity_malllogin_reward_receive_req, {Value = nActId}, nil, callback)
|
||||
end
|
||||
function PlayerActivityData:OpenActivityPanel(nActId, nEntranceId)
|
||||
local tbList = self:GetSortedActList()
|
||||
if nil == next(tbList) then
|
||||
self:RefreshActivityRedDot()
|
||||
@@ -770,7 +903,7 @@ function PlayerActivityData:OpenActivityPanel(nActId)
|
||||
end
|
||||
local openFunc = function()
|
||||
local func = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.ActivityList, nActId)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.ActivityList, nActId or 0, nEntranceId)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, 5, func)
|
||||
end
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
local ActivityDataBase = require("GameCore.Data.DataClass.Activity.ActivityDataBase")
|
||||
local ReengagementData = class("ReengagementData", ActivityDataBase)
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local RedDotManager = require("GameCore.RedDot.RedDotManager")
|
||||
function ReengagementData:Init()
|
||||
self:InitData()
|
||||
end
|
||||
function ReengagementData:InitData()
|
||||
end
|
||||
function ReengagementData:CheckCanReceive()
|
||||
return true
|
||||
end
|
||||
function ReengagementData:GetQuestListByGroup()
|
||||
return {}
|
||||
end
|
||||
function ReengagementData:GetActCfgData()
|
||||
return {}
|
||||
end
|
||||
function ReengagementData:GetWeeklyCardData()
|
||||
return {}
|
||||
end
|
||||
function ReengagementData:GetActLoginRewardList()
|
||||
return {}
|
||||
end
|
||||
return ReengagementData
|
||||
@@ -42,8 +42,8 @@ function TrekkerVersusData:RefreshTrekkerVersusData(nActId, msgData)
|
||||
self.tbDuelRewardIds = msgData.DuelRewardIds
|
||||
self.tbDuelHistory = msgData.Results
|
||||
self.bFirstBattlePlayed = self.nIdleRewardStartTime ~= nil and self.nIdleRewardStartTime > 0
|
||||
self.nLastBuildId = msgData.BuildId
|
||||
self.nCachedBuildId = msgData.BuildId
|
||||
self.nLastBuildId = msgData.Build.BuildId
|
||||
self.nCachedBuildId = msgData.Build.BuildId
|
||||
self.nRecord = msgData.Show.Difficult or 0
|
||||
self.nRivalCount = 0
|
||||
local foreachRival = function(mapData)
|
||||
@@ -70,10 +70,13 @@ function TrekkerVersusData:EnterTrekkerVersus(nActId, nLevelId, nBuildId, tbAffi
|
||||
self:SetCachedBuildId(nBuildId)
|
||||
self:EnterGame(nLevelId, nBuildId, tbAffix)
|
||||
end
|
||||
local mapBuildData = PlayerData.Build:GetBuildData(nBuildId)
|
||||
local bTrial = mapBuildData.nBuildSource == AllEnum.BuildSource.Trial or mapBuildData.nBuildSource == AllEnum.BuildSource.LimitedTrial
|
||||
local nBuildType = bTrial and 2 or 1
|
||||
local msg = {
|
||||
ActivityId = nActId,
|
||||
LevelId = nLevelId,
|
||||
BuildId = nBuildId,
|
||||
Build = {Type = nBuildType, BuildId = nBuildId},
|
||||
AffixIds = tbAffix
|
||||
}
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.activity_trekker_versus_apply_req, msg, nil, callback)
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
local ActivityGroupDataBase = require("GameCore.Data.DataClass.Activity.ActivityGroupDataBase")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local UnchartedMap_10113Data = class("UnchartedMap_10113Data", ActivityGroupDataBase)
|
||||
function UnchartedMap_10113Data:Init()
|
||||
self.tbAllActivity = {}
|
||||
self.nCGActivityId = 0
|
||||
self.sCGPath = ""
|
||||
self.bPlayedCG = false
|
||||
self:ParseActivity()
|
||||
end
|
||||
function UnchartedMap_10113Data:ParseActivity()
|
||||
if self.actGroupConfig == nil then
|
||||
self.actGroupConfig = ConfigTable.GetData("ActivityGroup", self.nActGroupId)
|
||||
end
|
||||
if self.actGroupConfig == nil then
|
||||
printError("ActivityGroup config not found for id: " .. tostring(self.nActGroupId))
|
||||
return
|
||||
end
|
||||
local sJson = self.actGroupConfig.Enter
|
||||
local tbJson = decodeJson(sJson)
|
||||
if tbJson == nil then
|
||||
printError("ActivityGroup Enter json is nil for id: " .. tostring(self.nActGroupId))
|
||||
end
|
||||
for _, activity in pairs(tbJson) do
|
||||
local data = {
|
||||
ActivityId = activity[1],
|
||||
Index = activity[2],
|
||||
PanelId = activity[3]
|
||||
}
|
||||
table.insert(self.tbAllActivity, data)
|
||||
end
|
||||
local sCgJson = self.actGroupConfig.CG
|
||||
if sCgJson ~= nil then
|
||||
local tbCGJson = decodeJson(sCgJson)
|
||||
if tbCGJson and 2 <= #tbCGJson then
|
||||
self.nCGActivityId = tonumber(tbCGJson[1])
|
||||
self.sCGPath = tbCGJson[2]
|
||||
end
|
||||
end
|
||||
end
|
||||
function UnchartedMap_10113Data:GetActivityDataByIndex(nIndex)
|
||||
for _, activity in pairs(self.tbAllActivity) do
|
||||
if activity.Index == nIndex then
|
||||
return activity
|
||||
end
|
||||
end
|
||||
end
|
||||
function UnchartedMap_10113Data:PlayCG()
|
||||
self:SendMsg_CG_READ(self.nCGActivityId)
|
||||
end
|
||||
function UnchartedMap_10113Data:GetActivityGroupCGPlayed()
|
||||
if self.bPlayedCG then
|
||||
return true
|
||||
end
|
||||
return PlayerData.Activity:IsCGPlayed(self.nCGActivityId)
|
||||
end
|
||||
function UnchartedMap_10113Data:IsActivityInActivityGroup(nActivityId)
|
||||
for _, activity in pairs(self.tbAllActivity) do
|
||||
if activity.ActivityId == nActivityId then
|
||||
return true, self.nActGroupId
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
function UnchartedMap_10113Data:OnOpenMiniGameEntrance(actData)
|
||||
LocalData.SetPlayerLocalData("Activity_MiniGame_10112_New", true)
|
||||
RedDotManager.SetValid(RedDotDefine.Activity_GroupNew_MiniGame, {
|
||||
actData.ActivityId
|
||||
}, false)
|
||||
end
|
||||
function UnchartedMap_10113Data:SendMsg_CG_READ(nActivityId)
|
||||
local Callback = function()
|
||||
self.bPlayedCG = true
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.activity_cg_read_req, {nActivityId}, nil, Callback)
|
||||
end
|
||||
return UnchartedMap_10113Data
|
||||
@@ -154,12 +154,14 @@ function AvgData:Init()
|
||||
EventManager.Add("StoryDialog_DialogEnd", self, self.OnEvent_AvgSTEnd)
|
||||
end
|
||||
self.bSkip = false
|
||||
self.nJustReadStoryId = 0
|
||||
end
|
||||
function AvgData:UnInit()
|
||||
EventManager.Remove(EventId.UpdateWorldClass, self, self.CheckNewStoryRedDot)
|
||||
if AVG_EDITOR == true then
|
||||
EventManager.Remove("StoryDialog_DialogEnd", self, self.OnEvent_AvgSTEnd)
|
||||
end
|
||||
self.nJustReadStoryId = 0
|
||||
end
|
||||
function AvgData:ClearTempData()
|
||||
self.tbTempStoryIds = {}
|
||||
@@ -215,14 +217,14 @@ function AvgData:CacheAvgData(StoryInfo)
|
||||
if StoryInfo == nil then
|
||||
return
|
||||
end
|
||||
if StoryInfo.BuildId then
|
||||
self:SetSelBuildId(StoryInfo.BuildId)
|
||||
if StoryInfo.Build then
|
||||
self:SetSelBuildId(StoryInfo.Build.BuildId or 0)
|
||||
end
|
||||
for i, nEvId in ipairs(StoryInfo.Evidences) do
|
||||
local cfgData_Evidence = ConfigTable.GetData("StoryEvidence", nEvId)
|
||||
if cfgData_Evidence ~= nil then
|
||||
local sEvid = cfgData_Evidence.EvId
|
||||
if table.indexof(self.tbEvIds, sEvid) <= 0 then
|
||||
if 0 >= table.indexof(self.tbEvIds, sEvid) then
|
||||
table.insert(self.tbEvIds, sEvid)
|
||||
end
|
||||
end
|
||||
@@ -293,8 +295,8 @@ function AvgData:AvgLuaNameToStoryId(sAvgId)
|
||||
return nId, storyId
|
||||
end
|
||||
function AvgData:CheckIfTrue(bIsMajor, sAvgId, nGroupId, nIndex, nCheckount)
|
||||
if self.IsActivityAvg == true then
|
||||
return PlayerData.ActivityAvg:CheckIfTrue(bIsMajor, sAvgId, nGroupId, nIndex, nCheckount)
|
||||
if self.storySource ~= nil then
|
||||
return self.storySource:CheckIfTrue(bIsMajor, sAvgId, nGroupId, nIndex, nCheckount)
|
||||
end
|
||||
local n, sCheckTarget = self:AvgLuaNameToStoryId(sAvgId)
|
||||
if table.indexof(self.tbTempStoryIds, sCheckTarget) > 0 then
|
||||
@@ -348,8 +350,8 @@ function AvgData:CheckIfTrue_Client(bIsMajor, sAvgId, nGroupId, nIndex, nCheckou
|
||||
return nCheckount <= nCount
|
||||
end
|
||||
function AvgData:IsUnlock(sConditionId, avgId)
|
||||
if self.IsActivityAvg == true then
|
||||
return PlayerData.ActivityAvg:IsUnlock(sConditionId)
|
||||
if self.storySource ~= nil then
|
||||
return self.storySource:IsUnlock(sConditionId)
|
||||
end
|
||||
if type(sConditionId) == "string" and sConditionId == "" then
|
||||
return true
|
||||
@@ -496,8 +498,8 @@ function AvgData:GetLockReasonText(tbResult, bHasAchievementData)
|
||||
return lockTxt
|
||||
end
|
||||
function AvgData:MarkStoryId(sAvgId)
|
||||
if self.IsActivityAvg == true then
|
||||
PlayerData.ActivityAvg:MarkStoryId(sAvgId)
|
||||
if self.storySource ~= nil then
|
||||
self.storySource:MarkStoryId(sAvgId)
|
||||
return
|
||||
end
|
||||
if AVG_EDITOR == true then
|
||||
@@ -518,8 +520,8 @@ function AvgData:MarkStoryId(sAvgId)
|
||||
end
|
||||
end
|
||||
function AvgData:MarkEvId(sId)
|
||||
if self.IsActivityAvg == true then
|
||||
PlayerData.ActivityAvg:MarkEvId(sId)
|
||||
if self.storySource ~= nil then
|
||||
self.storySource:MarkEvId(sId)
|
||||
return
|
||||
end
|
||||
if table.indexof(self.tbTempEvIds, sId) <= 0 and 0 >= table.indexof(self.tbEvIds, sId) then
|
||||
@@ -527,8 +529,8 @@ function AvgData:MarkEvId(sId)
|
||||
end
|
||||
end
|
||||
function AvgData:IsChosen(sAvgId, nGroupId, nIndex)
|
||||
if self.IsActivityAvg == true then
|
||||
return PlayerData.ActivityAvg:IsChosen(sAvgId, nGroupId, nIndex)
|
||||
if self.storySource ~= nil then
|
||||
return self.storySource:IsChosen(sAvgId, nGroupId, nIndex)
|
||||
end
|
||||
if self.mapChosen[sAvgId] == nil then
|
||||
return false
|
||||
@@ -548,8 +550,8 @@ function AvgData:IsChosen(sAvgId, nGroupId, nIndex)
|
||||
return bIsChosen, bIsChosen_Temp
|
||||
end
|
||||
function AvgData:MarkChosen(sAvgId, nGroupId, nIndex)
|
||||
if self.IsActivityAvg == true then
|
||||
PlayerData.ActivityAvg:MarkChosen(sAvgId, nGroupId, nIndex)
|
||||
if self.storySource ~= nil then
|
||||
self.storySource:MarkChosen(sAvgId, nGroupId, nIndex)
|
||||
return
|
||||
end
|
||||
if self.mapTempCL[sAvgId] == nil then
|
||||
@@ -603,12 +605,25 @@ function AvgData:IsChapterAllRead(nChapterId)
|
||||
end
|
||||
return true
|
||||
end
|
||||
function AvgData:IsChapterLastStoryRead(nChapterId)
|
||||
local chapterStoryIds = self.CFG_ChapterStoryNumIds[nChapterId]
|
||||
if chapterStoryIds == nil or #chapterStoryIds == 0 then
|
||||
return false
|
||||
end
|
||||
for _, nStoryId in ipairs(chapterStoryIds) do
|
||||
local mapStoryCfg = ConfigTable.GetData_Story(nStoryId)
|
||||
if mapStoryCfg ~= nil and mapStoryCfg.IsLast == true then
|
||||
return self:IsStoryReaded(nStoryId)
|
||||
end
|
||||
end
|
||||
return self:IsStoryReaded(chapterStoryIds[#chapterStoryIds])
|
||||
end
|
||||
function AvgData:MarkSkip(_bSkip)
|
||||
self.bSkip = _bSkip == true
|
||||
end
|
||||
function AvgData:GetHistoryChoosedPersonality(sAvgId, nGroupId)
|
||||
if self.IsActivityAvg == true then
|
||||
return PlayerData.ActivityAvg:GetHistoryChoosedPersonality(sAvgId, nGroupId)
|
||||
if self.storySource ~= nil then
|
||||
return self.storySource:GetHistoryChoosedPersonality(sAvgId, nGroupId)
|
||||
end
|
||||
if self.mapPersonality[sAvgId] == nil then
|
||||
return nil
|
||||
@@ -626,8 +641,8 @@ function AvgData:GetHistoryChoosedPersonality(sAvgId, nGroupId)
|
||||
return 0
|
||||
end
|
||||
function AvgData:MarkChoosedPersonality(sAvgId, nGroupId, nIndex, nFactor)
|
||||
if self.IsActivityAvg == true then
|
||||
PlayerData.ActivityAvg:MarkChoosedPersonality(sAvgId, nGroupId, nIndex, nFactor)
|
||||
if self.storySource ~= nil then
|
||||
self.storySource:MarkChoosedPersonality(sAvgId, nGroupId, nIndex, nFactor)
|
||||
return
|
||||
end
|
||||
if self.mapTempPersonality[sAvgId] == nil then
|
||||
@@ -727,22 +742,12 @@ function AvgData:CalcPersonality(nId)
|
||||
for i, v in ipairs(tbPData) do
|
||||
tbPData[i].nPercent = tbPData[i].nCount / nTotalCount
|
||||
end
|
||||
local tbRetPercent = {
|
||||
tbPData[1].nPercent,
|
||||
tbPData[2].nPercent,
|
||||
tbPData[3].nPercent
|
||||
}
|
||||
local sTitle, sFace, sHead
|
||||
table.sort(tbPData, function(a, b)
|
||||
return a.nCount > b.nCount
|
||||
end)
|
||||
if self.TempLocalData ~= nil then
|
||||
tbPData = self.TempLocalData
|
||||
tbRetPercent = {
|
||||
tbPData[1].nPercent,
|
||||
tbPData[2].nPercent,
|
||||
tbPData[3].nPercent
|
||||
}
|
||||
table.sort(tbPData, function(a, b)
|
||||
return a.nPercent > b.nPercent
|
||||
end)
|
||||
@@ -945,7 +950,15 @@ function AvgData:SendMsg_STORY_ENTER(nStoryId, nBuildId, bNewestStory)
|
||||
EventManager.Hit("StoryDialog_DialogStart", mapCfgData_Story.AvgLuaName, nil, nil, nil, nil, mapCfgData_Story.AvgMotion)
|
||||
end
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.story_apply_req, {Idx = nStoryId, BuildId = nBuildId}, nil, func_cb)
|
||||
local nBuildType = 0
|
||||
local buildPackge
|
||||
local mapBuildData = PlayerData.Build:GetBuildData(nBuildId)
|
||||
if mapBuildData ~= nil then
|
||||
local bTrial = mapBuildData.nBuildSource == AllEnum.BuildSource.Trial or mapBuildData.nBuildSource == AllEnum.BuildSource.LimitedTrial
|
||||
nBuildType = bTrial and 2 or 1
|
||||
buildPackge = {Type = nBuildType, BuildId = nBuildId}
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.story_apply_req, {Idx = nStoryId, Build = buildPackge}, nil, func_cb)
|
||||
end
|
||||
function AvgData:SendMsg_STORY_DONE(callBack, tbBattleEvents)
|
||||
local mapSendMsgData = {
|
||||
@@ -1075,8 +1088,8 @@ function AvgData:SendMsg_STORY_DONE(callBack, tbBattleEvents)
|
||||
PlayerData.Base:UserEventUpload_PC("pc_mainstory_2_clear")
|
||||
end
|
||||
if 1 < #self.tbTempStoryIds then
|
||||
local nRecentChapterId = self.CFG_Story[self.tbTempStoryIds[#self.tbTempStoryIds]]
|
||||
self:SetRecentStoryId(nRecentChapterId)
|
||||
local nRecentStoryId = self.CFG_Story[self.tbTempStoryIds[#self.tbTempStoryIds]]
|
||||
self:SetRecentStoryId(nRecentStoryId)
|
||||
end
|
||||
if self.tbLastEndStoryIds ~= nil then
|
||||
for _, nLastEndStoryId in ipairs(self.tbLastEndStoryIds) do
|
||||
@@ -1174,6 +1187,7 @@ function AvgData:SendMsg_STORY_DONE(callBack, tbBattleEvents)
|
||||
printLog("通关结算完成")
|
||||
end
|
||||
printLog("发送通关消息")
|
||||
self.nJustReadStoryId = self.CURRENT_STORY_ID
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.story_settle_req, mapSendMsgData, nil, func_succ)
|
||||
self.CURRENT_STORY_ID = 0
|
||||
end
|
||||
@@ -1231,22 +1245,24 @@ end
|
||||
function AvgData:GetRecentStoryId(nChapterId)
|
||||
local nStoryId = self.mapRecentStoryId[tostring(nChapterId)]
|
||||
if nStoryId == nil then
|
||||
local tbChapterList = self.CFG_ChapterStoryNumIds[nChapterId]
|
||||
if tbChapterList ~= nil then
|
||||
table.sort(tbChapterList, function(a, b)
|
||||
local tbStoryNumId = self.CFG_ChapterStoryNumIds[nChapterId]
|
||||
if tbStoryNumId ~= nil then
|
||||
table.sort(tbStoryNumId, function(a, b)
|
||||
return a < b
|
||||
end)
|
||||
for i = #tbChapterList, 1, -1 do
|
||||
local v = tbChapterList[i]
|
||||
for i = #tbStoryNumId, 1, -1 do
|
||||
local v = tbStoryNumId[i]
|
||||
if self.tbStoryIds[v] then
|
||||
nStoryId = v
|
||||
break
|
||||
end
|
||||
end
|
||||
local chapterConfig = ConfigTable.GetData("StoryChapter", nChapterId)
|
||||
nStoryId = chapterConfig.UnlockShowStoryId
|
||||
end
|
||||
end
|
||||
if nStoryId == nil then
|
||||
local chapterConfig = ConfigTable.GetData("StoryChapter", nChapterId)
|
||||
nStoryId = chapterConfig.UnlockShowStoryId
|
||||
end
|
||||
return nStoryId
|
||||
end
|
||||
function AvgData:SetRecentStoryId(nStoryId)
|
||||
@@ -1254,19 +1270,9 @@ function AvgData:SetRecentStoryId(nStoryId)
|
||||
if cfgData ~= nil then
|
||||
self.mapRecentStoryId[tostring(cfgData.Chapter)] = nStoryId
|
||||
local sJson = RapidJson.encode(self.mapRecentStoryId)
|
||||
printLog(sJson)
|
||||
LocalData.SetPlayerLocalData("RecentStoryId", sJson)
|
||||
end
|
||||
end
|
||||
function AvgData:GetRecentChapterId()
|
||||
local nRecentChapterId = 1
|
||||
for k, v in pairs(self.mapRecentStoryId) do
|
||||
if nRecentChapterId < tonumber(k) then
|
||||
nRecentChapterId = tonumber(k)
|
||||
end
|
||||
end
|
||||
return nRecentChapterId
|
||||
end
|
||||
function AvgData:CheckNewStoryRedDot()
|
||||
local _, data = self:GetChapterCount()
|
||||
for k, v in ipairs(data) do
|
||||
@@ -1280,7 +1286,12 @@ function AvgData:CheckNewStoryRedDot()
|
||||
end
|
||||
end
|
||||
end
|
||||
RedDotManager.SetValid(RedDotDefine.Map_MainLine_Chapter, v.Id, bHasNew)
|
||||
local nChapterId = v.Id
|
||||
local cfg = ConfigTable.GetData("StoryChapter", nChapterId)
|
||||
RedDotManager.SetValid(RedDotDefine.Map_MainLine_Chapter, {
|
||||
cfg.StoryLineId,
|
||||
nChapterId
|
||||
}, bHasNew)
|
||||
end
|
||||
end
|
||||
function AvgData:CheckNewStory(nChapterId)
|
||||
@@ -1318,15 +1329,30 @@ function AvgData:SetLastEndState(nStoryId)
|
||||
if storyConifg == nil then
|
||||
return
|
||||
end
|
||||
if self.tbLastEndStateMap == nil then
|
||||
self.tbLastEndStateMap = {}
|
||||
end
|
||||
local isUnlock = self:IsUnlock(storyConifg.ConditionId, storyConifg.StoryId)
|
||||
if isUnlock then
|
||||
local isReaded = self:IsStoryReaded(nStoryId)
|
||||
local nState = AllEnum.MainlineLastEndState.Unlock
|
||||
if isReaded then
|
||||
self.LastEndState = AllEnum.MainlineLastEndState.Fobidden
|
||||
else
|
||||
self.LastEndState = AllEnum.MainlineLastEndState.Unlock
|
||||
nState = AllEnum.MainlineLastEndState.Fobidden
|
||||
local nResetChapterId = ConfigTable.GetConfigNumber("StoryLastEnd_UnlockCondition_Chapter" .. tostring(storyConifg.Chapter))
|
||||
if nResetChapterId ~= nil and 0 < nResetChapterId and self:IsChapterLastStoryRead(nResetChapterId) then
|
||||
nState = AllEnum.MainlineLastEndState.Unlock
|
||||
end
|
||||
end
|
||||
self.tbLastEndStateMap[nStoryId] = nState
|
||||
self.LastEndState = nState
|
||||
for _, nSt in pairs(self.tbLastEndStateMap) do
|
||||
if nSt == AllEnum.MainlineLastEndState.Fobidden then
|
||||
self.LastEndState = AllEnum.MainlineLastEndState.Fobidden
|
||||
break
|
||||
end
|
||||
end
|
||||
else
|
||||
self.tbLastEndStateMap[nStoryId] = nil
|
||||
local chapterId = storyConifg.Chapter
|
||||
local allReaded = true
|
||||
local map = self.CFG_ChapterStoryNumIds[chapterId]
|
||||
@@ -1350,8 +1376,8 @@ function AvgData:GetLastEndState()
|
||||
end
|
||||
return self.LastEndState
|
||||
end
|
||||
function AvgData:ChangeActivityAvgState(IsActivityAvg)
|
||||
self.IsActivityAvg = IsActivityAvg
|
||||
function AvgData:SetStorySource(dataObj)
|
||||
self.storySource = dataObj
|
||||
end
|
||||
function AvgData:AvgEditorTempData(sConditionIds, bAdd)
|
||||
if self.tbAvgEditorTempData_Unlocked_sConditionIds == nil then
|
||||
|
||||
@@ -15,6 +15,8 @@ function FilterData:Init()
|
||||
self.bFormationCharOrder = false
|
||||
self.nFormationDiscSrotType = AllEnum.SortType.Level
|
||||
self.bFormationDiscOrder = false
|
||||
self.nDormCharSrotType = AllEnum.SortType.Rarity
|
||||
self.bDormCharOrder = true
|
||||
self.tbCacheOptionData = {}
|
||||
end
|
||||
function FilterData:Reset(tbOption)
|
||||
@@ -295,14 +297,24 @@ function FilterData:CacheDiscSort(nType, bOrder)
|
||||
LocalData.SetPlayerLocalData("FormationDiscSrotType", self.nFormationDiscSrotType)
|
||||
LocalData.SetPlayerLocalData("FormationDiscOrder", self.bFormationDiscOrder)
|
||||
end
|
||||
function FilterData:CacheDormSort(nType, bOrder)
|
||||
self.nDormCharSrotType = nType
|
||||
self.bDormCharOrder = bOrder
|
||||
LocalData.SetPlayerLocalData("DormCharSrotType", self.nDormCharSrotType)
|
||||
LocalData.SetPlayerLocalData("DormCharOrder", self.bDormCharOrder)
|
||||
end
|
||||
function FilterData:InitSortData()
|
||||
self.nFormationCharSrotType = AllEnum.SortType.Level
|
||||
self.bFormationCharOrder = false
|
||||
self.nFormationDiscSrotType = AllEnum.SortType.Level
|
||||
self.bFormationDiscOrder = false
|
||||
self.nDormCharSrotType = AllEnum.SortType.Rarity
|
||||
self.bDormCharOrder = true
|
||||
self.nFormationCharSrotType = LocalData.GetPlayerLocalData("FormationCharSrotType") or AllEnum.SortType.Level
|
||||
self.bFormationCharOrder = LocalData.GetPlayerLocalData("FormationCharOrder") or false
|
||||
self.nFormationDiscSrotType = LocalData.GetPlayerLocalData("FormationDiscSrotType") or AllEnum.SortType.Level
|
||||
self.bFormationDiscOrder = LocalData.GetPlayerLocalData("FormationDiscOrder") or false
|
||||
self.nDormCharSrotType = LocalData.GetPlayerLocalData("DormCharSrotType") or AllEnum.SortType.Rarity
|
||||
self.bDormCharOrder = LocalData.GetPlayerLocalData("DormCharOrder") or true
|
||||
end
|
||||
return FilterData
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
local GuideMissionData = class("GuideMissionData")
|
||||
function GuideMissionData:Init()
|
||||
self.tbChapter = {}
|
||||
self.tbServerUnlockTime = {}
|
||||
self:InitConfig()
|
||||
end
|
||||
function GuideMissionData:CacheServerUnlockTime(nChapterId, nUnlockTime)
|
||||
self.tbServerUnlockTime[nChapterId] = nUnlockTime
|
||||
end
|
||||
function GuideMissionData:UnInit()
|
||||
end
|
||||
function GuideMissionData:InitConfig()
|
||||
local forEachChapter = function(mapData)
|
||||
table.insert(self.tbChapter, mapData)
|
||||
end
|
||||
ForEachTableLine(ConfigTable.Get("GuideMissionChapter"), forEachChapter)
|
||||
table.sort(self.tbChapter, function(a, b)
|
||||
return a.Id < b.Id
|
||||
end)
|
||||
end
|
||||
function GuideMissionData:GetChapterList()
|
||||
return self.tbChapter
|
||||
end
|
||||
function GuideMissionData:IsChapterUnlock(nChapterId)
|
||||
local mapChapter
|
||||
for _, v in ipairs(self.tbChapter) do
|
||||
if v.Id == nChapterId then
|
||||
mapChapter = v
|
||||
break
|
||||
end
|
||||
end
|
||||
if mapChapter == nil then
|
||||
return false, nil
|
||||
end
|
||||
local unlockTime = self.tbServerUnlockTime[mapChapter.Id]
|
||||
if unlockTime == nil then
|
||||
unlockTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(mapChapter.UnlockTime)
|
||||
end
|
||||
if unlockTime ~= nil and 0 < unlockTime then
|
||||
local nServerTimeStamp = CS.ClientManager.Instance.serverTimeStamp
|
||||
if unlockTime > nServerTimeStamp then
|
||||
local remainTime = unlockTime - nServerTimeStamp
|
||||
return false, self:GetChapterUnlockTimeText(remainTime)
|
||||
end
|
||||
end
|
||||
if mapChapter.PreChapterId ~= nil and mapChapter.PreChapterId ~= 0 and not self:IsChapterComplete(mapChapter.PreChapterId) then
|
||||
return false, orderedFormat(ConfigTable.GetUIText("Guide_Mission_PreChapter_UnComplete") or "", mapChapter.PreChapterId)
|
||||
end
|
||||
local storyConfig = ConfigTable.GetData_Story(mapChapter.StoryIdx)
|
||||
if storyConfig ~= nil then
|
||||
local bStoryReaded = PlayerData.Avg:IsStoryReaded(storyConfig.Id)
|
||||
if not bStoryReaded then
|
||||
return false, orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyConfig.Title)
|
||||
end
|
||||
end
|
||||
return true, nil
|
||||
end
|
||||
function GuideMissionData:GetChapterUnlockTimeText(remainTime)
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
return orderedFormat(ConfigTable.GetUIText("GuideMission_UnlockTime_Sec") or "", "08d3d4", sec)
|
||||
elseif remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
return orderedFormat(ConfigTable.GetUIText("GuideMission_UnlockTime_Min") or "", "08d3d4", min)
|
||||
elseif remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
return orderedFormat(ConfigTable.GetUIText("GuideMission_UnlockTime_Hour") or "", "08d3d4", hour)
|
||||
else
|
||||
local day = math.floor(remainTime / 86400)
|
||||
return orderedFormat(ConfigTable.GetUIText("GuideMission_UnlockTime_Day") or "", "08d3d4", day)
|
||||
end
|
||||
end
|
||||
function GuideMissionData:IsChapterComplete(nChapterId)
|
||||
local tbGroupList = PlayerData.Quest:GetGuideMissionQuestGroupByChapter(nChapterId)
|
||||
if tbGroupList == nil or next(tbGroupList) == nil then
|
||||
return false
|
||||
end
|
||||
for _, mapGroup in pairs(tbGroupList) do
|
||||
local tbQuestList = PlayerData.Quest:GetGuideMissionQuestListByGroup(mapGroup.Id)
|
||||
if tbQuestList == nil or next(tbQuestList) == nil then
|
||||
return false
|
||||
end
|
||||
for _, mapQuest in pairs(tbQuestList) do
|
||||
local mapQuestData = PlayerData.Quest:GetGuideMissionQuestDataById(mapQuest.Id)
|
||||
local nStatus = mapQuestData ~= nil and mapQuestData.nStatus or 0
|
||||
if nStatus ~= 2 then
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
function GuideMissionData:HasReceivableQuest(nGroupId)
|
||||
local tbQuestList = PlayerData.Quest:GetGuideMissionQuestListByGroup(nGroupId)
|
||||
if tbQuestList == nil then
|
||||
return false
|
||||
end
|
||||
for _, mapQuest in pairs(tbQuestList) do
|
||||
local mapQuestData = PlayerData.Quest:GetGuideMissionQuestDataById(mapQuest.Id)
|
||||
if mapQuestData ~= nil and mapQuestData.nStatus == 1 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
function GuideMissionData:FindReceivableChapter()
|
||||
for _, mapChapter in ipairs(self.tbChapter) do
|
||||
local bChapterUnlock = self:IsChapterUnlock(mapChapter.Id)
|
||||
if bChapterUnlock then
|
||||
local tbGroupListRef = PlayerData.Quest:GetGuideMissionQuestGroupByChapter(mapChapter.Id)
|
||||
if tbGroupListRef ~= nil then
|
||||
for _, mapGroup in pairs(tbGroupListRef) do
|
||||
local bGroupUnlock = self:IsGroupUnlock(mapChapter.Id, mapGroup.Id)
|
||||
if bGroupUnlock and self:HasReceivableQuest(mapGroup.Id) then
|
||||
return mapChapter.Id
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
function GuideMissionData:IsGroupUnlock(nChapterId, nGroupId)
|
||||
local mapChapter
|
||||
for _, v in ipairs(self.tbChapter) do
|
||||
if v.Id == nChapterId then
|
||||
mapChapter = v
|
||||
break
|
||||
end
|
||||
end
|
||||
if mapChapter == nil then
|
||||
return false
|
||||
end
|
||||
local mapGroup = ConfigTable.GetData("GuideMissionQuestGroup", nGroupId)
|
||||
if mapGroup == nil then
|
||||
return false
|
||||
end
|
||||
local unlockTime = self.tbServerUnlockTime[mapChapter.Id]
|
||||
if unlockTime == nil then
|
||||
unlockTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(mapChapter.UnlockTime)
|
||||
end
|
||||
if unlockTime == nil or unlockTime <= 0 then
|
||||
return true, 0
|
||||
end
|
||||
local nDayOpen = mapGroup.DayOpen or 0
|
||||
local nGroupUnlockTime = unlockTime
|
||||
for _i = 1, nDayOpen do
|
||||
nGroupUnlockTime = CS.ClientManager.Instance:GetNextRefreshTime(nGroupUnlockTime)
|
||||
end
|
||||
local nServerTimeStamp = CS.ClientManager.Instance.serverTimeStamp
|
||||
return nGroupUnlockTime <= nServerTimeStamp, nGroupUnlockTime
|
||||
end
|
||||
return GuideMissionData
|
||||
@@ -0,0 +1,17 @@
|
||||
local HandbookDataBase = require("GameCore.Data.DataClass.HandBookData.HandbookDataBase")
|
||||
local HandbookDormFurnitureData = class("HandbookDormFurnitureData", HandbookDataBase)
|
||||
function HandbookDormFurnitureData:Init()
|
||||
self.nFurnitureId = self.tbCfgData.SkinId
|
||||
end
|
||||
function HandbookDormFurnitureData:GetFurnitureId()
|
||||
return self.nFurnitureId
|
||||
end
|
||||
function HandbookDormFurnitureData:GetFurnitureCfgData()
|
||||
local cfgData = ConfigTable.GetData("DormFurniture", self.nFurnitureId)
|
||||
if nil == cfgData then
|
||||
printError("Get Furniture cfg fail!!! Furniture = " .. self.nFurnitureId)
|
||||
return
|
||||
end
|
||||
return cfgData
|
||||
end
|
||||
return HandbookDormFurnitureData
|
||||
@@ -0,0 +1,29 @@
|
||||
local HandbookDataBase = require("GameCore.Data.DataClass.HandBookData.HandbookDataBase")
|
||||
local HandbookDormSkinData = class("HandbookDormSkinData", HandbookDataBase)
|
||||
function HandbookDormSkinData:Init()
|
||||
self.nSkinId = self.tbCfgData.SkinId
|
||||
self.nCharId = self.tbCfgData.CharId
|
||||
end
|
||||
function HandbookDormSkinData:GetSkinId()
|
||||
return self.nSkinId
|
||||
end
|
||||
function HandbookDormSkinData:GetSkinCfgData()
|
||||
local cfgData = ConfigTable.GetData("DormRoleSkin", self.nSkinId)
|
||||
if nil == cfgData then
|
||||
printError("Get skin cfg fail!!! charId = " .. self.nSkinId)
|
||||
return
|
||||
end
|
||||
return cfgData
|
||||
end
|
||||
function HandbookDormSkinData:GetCharId()
|
||||
return self.nCharId
|
||||
end
|
||||
function HandbookDormSkinData:GetCharCfgData()
|
||||
local cfgData = ConfigTable.GetData_Character(self.nCharId)
|
||||
if nil == cfgData then
|
||||
printError("Get char cfg fail!!! charId = " .. self.nCharId)
|
||||
return
|
||||
end
|
||||
return cfgData
|
||||
end
|
||||
return HandbookDormSkinData
|
||||
@@ -0,0 +1,27 @@
|
||||
local HandbookDataBase = require("GameCore.Data.DataClass.HandBookData.HandbookDataBase")
|
||||
local HandbookStoryReviewData = class("HandbookStoryReviewData", HandbookDataBase)
|
||||
function HandbookStoryReviewData:Init()
|
||||
self.nStoryReviewId = self:GetId()
|
||||
end
|
||||
function HandbookStoryReviewData:GetPlotId()
|
||||
return self.nStoryReviewId
|
||||
end
|
||||
function HandbookStoryReviewData:GetPlotCfgData()
|
||||
local plotCfgData = ConfigTable.GetData("MainScreenCG", self.nStoryReviewId)
|
||||
if nil == plotCfgData then
|
||||
printError("Get plot data fail!!! id = " .. self.nStoryReviewId)
|
||||
return
|
||||
end
|
||||
return plotCfgData
|
||||
end
|
||||
function HandbookStoryReviewData:CheckPlotL2d()
|
||||
local config = self:GetPlotCfgData()
|
||||
if config == nil then
|
||||
return false
|
||||
end
|
||||
if config.FullScreenL2D == "" then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
return HandbookStoryReviewData
|
||||
@@ -192,12 +192,10 @@ function PlayerBaseData:CacheEnergyInfo(mapData)
|
||||
end
|
||||
end
|
||||
function PlayerBaseData:CacheTitleInfo(mapData)
|
||||
self._tbTitle = {}
|
||||
if not mapData then
|
||||
return
|
||||
end
|
||||
if not self._tbTitle then
|
||||
self._tbTitle = {}
|
||||
end
|
||||
for _, v in pairs(mapData) do
|
||||
table.insert(self._tbTitle, v.TitleId)
|
||||
end
|
||||
@@ -212,12 +210,10 @@ function PlayerBaseData:CacheHonorTitleInfo(mapData)
|
||||
end
|
||||
end
|
||||
function PlayerBaseData:CacheHonorTitleList(mapData)
|
||||
self._tbHonorTitleList = {}
|
||||
if not mapData then
|
||||
return
|
||||
end
|
||||
if not self._tbHonorTitleList then
|
||||
self._tbHonorTitleList = {}
|
||||
end
|
||||
for _, v in pairs(mapData) do
|
||||
local data = {Id = v}
|
||||
table.insert(self._tbHonorTitleList, data)
|
||||
@@ -726,7 +722,7 @@ function PlayerBaseData:BackToHome()
|
||||
if PanelManager.GetCurPanelId() == PanelId.MainView then
|
||||
return
|
||||
end
|
||||
PanelManager.Home()
|
||||
self:GoHomeFromCurModule()
|
||||
end
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
@@ -735,6 +731,50 @@ function PlayerBaseData:BackToHome()
|
||||
end
|
||||
end
|
||||
end
|
||||
function PlayerBaseData:GoHomeFromCurModule()
|
||||
if ModuleManager.GetCurModuleName() == "DormModuleScene" then
|
||||
local transitionOpenCallback = function()
|
||||
local function OnEventAfterEnterMain()
|
||||
EventManager.Remove(EventId.AfterEnterMain, self, OnEventAfterEnterMain)
|
||||
PanelManager.IGNORE_CS_TRANS_EVENT = false
|
||||
local wait = function()
|
||||
PanelManager.Home()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
local function OnEventDormLevelFinish()
|
||||
EventManager.Remove("DORM_LEVEL_FINISH", self, OnEventDormLevelFinish)
|
||||
PanelManager.IGNORE_CS_TRANS_EVENT = true
|
||||
NovaAPI.EnterModule("MainMenuModuleScene", true)
|
||||
end
|
||||
EventManager.Add("DORM_LEVEL_FINISH", self, OnEventDormLevelFinish)
|
||||
EventManager.Add(EventId.AfterEnterMain, self, OnEventAfterEnterMain)
|
||||
NovaAPI.DispatchEventWithData("DORM_LEVEL_STATE_CHANGED", nil, {true, 0})
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, 6, transitionOpenCallback, AllEnum.MainViewCorner.Dorm)
|
||||
return
|
||||
elseif ModuleManager.GetCurModuleName() == "MathParkourModuleScene" then
|
||||
local function OnEventEnterModule(_, _, sEnterModuleName)
|
||||
EventManager.Remove("EnterModule", self, OnEventEnterModule)
|
||||
if sEnterModuleName ~= "MainMenuModuleScene" then
|
||||
return
|
||||
end
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
PanelManager.Home()
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
EventManager.Add("EnterModule", self, OnEventEnterModule)
|
||||
NovaAPI.EnterModule("MainMenuModuleScene", true)
|
||||
return
|
||||
end
|
||||
PanelManager.Home()
|
||||
end
|
||||
function PlayerBaseData:SetSkipNewDayWindow(bSkip)
|
||||
self.bSkipNewDayWind = bSkip
|
||||
end
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local ConfigData = require("GameCore.Data.ConfigData")
|
||||
local RapidJson = require("rapidjson")
|
||||
local PlayerBuildData = class("PlayerBuildData")
|
||||
local newDayTime = UTILS.GetDayRefreshTimeOffset()
|
||||
function PlayerBuildData:Init()
|
||||
self._MapBuildData = {}
|
||||
self._mapBattleCharSkinId = {}
|
||||
self._MapLimitedTrialBuildData = {}
|
||||
self._tbLimitedTrialBuildId = {}
|
||||
self._sLimitedTrialBuildCacheKey = nil
|
||||
self.hasData = false
|
||||
self:InitBuildRank()
|
||||
end
|
||||
@@ -37,6 +40,73 @@ end
|
||||
function PlayerBuildData:GetBuildSourceByData(mapBuildData)
|
||||
return mapBuildData and mapBuildData.nBuildSource or AllEnum.BuildSource.Normal
|
||||
end
|
||||
function PlayerBuildData:GetBuildCharSkinId(mapBuildData, mapBuildChar)
|
||||
local nBuildSource = self:GetBuildSourceByData(mapBuildData)
|
||||
if nBuildSource == AllEnum.BuildSource.LimitedTrial or nBuildSource == AllEnum.BuildSource.Trial or mapBuildData ~= nil and mapBuildData.bTrial == true then
|
||||
local mapTrialChar = ConfigTable.GetData("TrialCharacter", mapBuildChar.nTrialId)
|
||||
if mapTrialChar ~= nil then
|
||||
return mapTrialChar.CharacterSkin
|
||||
end
|
||||
local mapCharCfg = ConfigTable.GetData_Character(mapBuildChar.nTid)
|
||||
return mapCharCfg ~= nil and mapCharCfg.DefaultSkinId or 0
|
||||
end
|
||||
return PlayerData.Char:GetCharSkinId(mapBuildChar.nTid)
|
||||
end
|
||||
function PlayerBuildData:PrioritizeLimitedTrialBuilds(tbBuildData, funcGetPriority)
|
||||
local mapGroups = {}
|
||||
for nIndex, mapBuild in ipairs(tbBuildData) do
|
||||
local mapCharCfg = ConfigTable.GetData_Character(mapBuild.tbChar[1].nTid)
|
||||
local nPriority = funcGetPriority and funcGetPriority(mapBuild) or 0
|
||||
local sGroupKey = table.concat({
|
||||
mapBuild.mapRank.Level,
|
||||
mapCharCfg.EET,
|
||||
nPriority
|
||||
}, ":")
|
||||
local mapGroup = mapGroups[sGroupKey]
|
||||
if mapGroup == nil then
|
||||
mapGroup = {
|
||||
tbIndices = {},
|
||||
tbLimitedTrial = {},
|
||||
tbOther = {}
|
||||
}
|
||||
mapGroups[sGroupKey] = mapGroup
|
||||
end
|
||||
table.insert(mapGroup.tbIndices, nIndex)
|
||||
if self:GetBuildSourceByData(mapBuild) == AllEnum.BuildSource.LimitedTrial then
|
||||
table.insert(mapGroup.tbLimitedTrial, mapBuild)
|
||||
else
|
||||
table.insert(mapGroup.tbOther, mapBuild)
|
||||
end
|
||||
end
|
||||
for _, mapGroup in pairs(mapGroups) do
|
||||
local nLimitedTrialCount = #mapGroup.tbLimitedTrial
|
||||
if 0 < nLimitedTrialCount then
|
||||
for nIndex, nListIndex in ipairs(mapGroup.tbIndices) do
|
||||
if nIndex <= nLimitedTrialCount then
|
||||
tbBuildData[nListIndex] = mapGroup.tbLimitedTrial[nIndex]
|
||||
else
|
||||
tbBuildData[nListIndex] = mapGroup.tbOther[nIndex - nLimitedTrialCount]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function PlayerBuildData:GetBuildDiscByData(mapBuildData, nDiscId)
|
||||
if mapBuildData == nil or nDiscId == nil or nDiscId == 0 then
|
||||
return nil
|
||||
end
|
||||
local nBuildSource = self:GetBuildSourceByData(mapBuildData)
|
||||
if nBuildSource == AllEnum.BuildSource.LimitedTrial then
|
||||
return PlayerData.Disc:GetLimitedTrialDiscById(nDiscId)
|
||||
elseif nBuildSource == AllEnum.BuildSource.Trial or mapBuildData.bTrial == true then
|
||||
return PlayerData.Disc:GetTrialDiscById(nDiscId)
|
||||
end
|
||||
local mapDisc = PlayerData.Disc:GetDiscById(nDiscId)
|
||||
if mapDisc == nil and mapBuildData.bRankPreview == true and ConfigTable.GetData("Disc", nDiscId) ~= nil and ConfigTable.GetData_Item(nDiscId) ~= nil then
|
||||
mapDisc = PlayerData.Disc:GetRankDetailDisc(nDiscId)
|
||||
end
|
||||
return mapDisc
|
||||
end
|
||||
function PlayerBuildData:GetBuildSource(nBuildId)
|
||||
return self:GetBuildSourceByData(self:GetBuildData(nBuildId))
|
||||
end
|
||||
@@ -66,7 +136,7 @@ function PlayerBuildData:FilterEditableBuildIds(tbBuildId)
|
||||
return tbRet
|
||||
end
|
||||
function PlayerBuildData:IsLimitedTrialBuildActivityOpen()
|
||||
return false
|
||||
return PlayerData.Reengagement ~= nil and PlayerData.Reengagement:GetActIsOpen()
|
||||
end
|
||||
function PlayerBuildData:IsLimitedTrialBuildAllowedType(nType)
|
||||
if nType == AllEnum.RegionBossFormationType.ScoreBoss or nType == AllEnum.RegionBossFormationType.ScoreBoss_GM or nType == AllEnum.RegionBossFormationType.JointDrill or nType == AllEnum.RegionBossFormationType.JointDrill_2 then
|
||||
@@ -74,6 +144,13 @@ function PlayerBuildData:IsLimitedTrialBuildAllowedType(nType)
|
||||
end
|
||||
return true
|
||||
end
|
||||
function PlayerBuildData:IsLimitedTrialBuildValid(nBuildId, nType)
|
||||
if not self:IsLimitedTrialBuildActivityOpen() or not self:IsLimitedTrialBuildAllowedType(nType) then
|
||||
return false
|
||||
end
|
||||
local tbBuildId = PlayerData.Reengagement:GetLimitedTrialBuildList() or {}
|
||||
return table.indexof(tbBuildId, nBuildId) > 0
|
||||
end
|
||||
function PlayerBuildData:CreateBuildBriefData(mapBuildBriefMsg)
|
||||
if nil ~= self._MapBuildData[mapBuildBriefMsg.Id] then
|
||||
printLog(string.format("编队信息重复!!!id= [%s]", mapBuildBriefMsg.Id))
|
||||
@@ -92,7 +169,8 @@ function PlayerBuildData:CreateBuildBriefData(mapBuildBriefMsg)
|
||||
tbSecondarySkill = {},
|
||||
tbPotentials = {},
|
||||
tbNotes = {},
|
||||
nTowerId = mapBuildBriefMsg.StarTowerId
|
||||
nTowerId = mapBuildBriefMsg.StarTowerId,
|
||||
nModifierState = AllEnum.BuildModifierState.NotModified
|
||||
}
|
||||
for i = 1, 3 do
|
||||
table.insert(mapBuildData.tbChar, {
|
||||
@@ -130,8 +208,40 @@ function PlayerBuildData:CreateBuildDetailData(nBuildId, mapBuildDetailMsg)
|
||||
tbNotes[v.Tid] = v.Qty
|
||||
end
|
||||
self._MapBuildData[nBuildId].tbNotes = tbNotes
|
||||
self._MapBuildData[nBuildId].nModifierState = mapBuildDetailMsg.ModifierState
|
||||
self._MapBuildData[nBuildId].bDetail = true
|
||||
end
|
||||
function PlayerBuildData:RefreshBuildInfo(mapBuildInfo)
|
||||
if nil == mapBuildInfo or nil == mapBuildInfo.Brief then
|
||||
return
|
||||
end
|
||||
local mapBuildBriefMsg = mapBuildInfo.Brief
|
||||
local nBuildId = mapBuildBriefMsg.Id
|
||||
if nil == self._MapBuildData[nBuildId] then
|
||||
printLog(string.format("找不到编队信息,无法刷新!!!id= [%s]", nBuildId))
|
||||
return
|
||||
end
|
||||
local mapBuildData = self._MapBuildData[nBuildId]
|
||||
mapBuildData.sName = mapBuildBriefMsg.Name
|
||||
mapBuildData.nScore = mapBuildBriefMsg.Score
|
||||
mapBuildData.mapRank = self:CalBuildRank(mapBuildBriefMsg.Score)
|
||||
mapBuildData.bLock = mapBuildBriefMsg.Lock
|
||||
mapBuildData.bPreference = mapBuildBriefMsg.Preference
|
||||
mapBuildData.nTowerId = mapBuildBriefMsg.StarTowerId
|
||||
mapBuildData.tbDisc = mapBuildBriefMsg.DiscIds
|
||||
if mapBuildInfo.Detail ~= nil then
|
||||
end
|
||||
local tbChar = {}
|
||||
for i = 1, 3 do
|
||||
table.insert(tbChar, {
|
||||
nTid = mapBuildBriefMsg.Chars[i].CharId,
|
||||
nPotentialCount = mapBuildBriefMsg.Chars[i].PotentialCnt
|
||||
})
|
||||
end
|
||||
mapBuildData.tbChar = tbChar
|
||||
mapBuildData.tbPotentials = {}
|
||||
self:CreateBuildDetailData(nBuildId, mapBuildInfo.Detail)
|
||||
end
|
||||
function PlayerBuildData:GetAllBuildBriefData(callback)
|
||||
if not self.hasData then
|
||||
self:NetMsg_GetBuildBriefData(self.GetBuildBriefDataCallback, callback)
|
||||
@@ -230,17 +340,76 @@ function PlayerBuildData:SaveBuild(nBuildID, bDelete, bLock, bPreference, sName,
|
||||
end
|
||||
self:NetMsg_SaveBuild(nBuildID, bDelete, bLock, bPreference, sName, callback)
|
||||
end
|
||||
function PlayerBuildData:ModifyBuildNote(nBuildId, tbNoteChange, callback)
|
||||
local mapBuildData = self:GetBuildData(nBuildId)
|
||||
local nModifierState = mapBuildData and mapBuildData.nModifierState
|
||||
local bNoteModifiable = nModifierState == AllEnum.BuildModifierState.NotModified or nModifierState == AllEnum.BuildModifierState.PotentialModified
|
||||
if not bNoteModifiable then
|
||||
if callback then
|
||||
callback(false)
|
||||
end
|
||||
return
|
||||
end
|
||||
local msg = {
|
||||
BuildId = nBuildId,
|
||||
NoteChange = {Items = tbNoteChange}
|
||||
}
|
||||
local callBack = function(_, mapMainData)
|
||||
self:RefreshBuildInfo(mapMainData.Info)
|
||||
if callback ~= nil then
|
||||
callback(mapMainData.Change)
|
||||
end
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.star_tower_build_note_modify_req, msg, nil, callBack)
|
||||
end
|
||||
function PlayerBuildData:ModifyBuildPotential(nBuildId, tbPotentialChange, callback)
|
||||
local mapBuildData = self:GetBuildData(nBuildId)
|
||||
local nModifierState = mapBuildData and mapBuildData.nModifierState
|
||||
local bPotentialModifiable = nModifierState == AllEnum.BuildModifierState.NotModified or nModifierState == AllEnum.BuildModifierState.NoteModified
|
||||
if not bPotentialModifiable then
|
||||
if callback then
|
||||
callback(false)
|
||||
end
|
||||
return
|
||||
end
|
||||
local msg = {
|
||||
BuildId = nBuildId,
|
||||
PotentialChange = {Items = tbPotentialChange}
|
||||
}
|
||||
local callBack = function(_, mapMainData)
|
||||
self:RefreshBuildInfo(mapMainData.Info)
|
||||
if callback ~= nil then
|
||||
callback(mapMainData.Change)
|
||||
end
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.star_tower_build_potential_modify_req, msg, nil, callBack)
|
||||
end
|
||||
function PlayerBuildData:CheckHasBuild()
|
||||
return next(self._MapBuildData) ~= nil
|
||||
end
|
||||
function PlayerBuildData:ClearBattleCharSkinIds()
|
||||
self._mapBattleCharSkinId = {}
|
||||
end
|
||||
function PlayerBuildData:GetBattleCharSkinId(nCharId)
|
||||
return self._mapBattleCharSkinId[nCharId] or PlayerData.Char:GetCharSkinId(nCharId)
|
||||
end
|
||||
function PlayerBuildData:CalBuildCharacterAttrBattle(nBuildId, nCharId, nTrialId, stActorInfo, bMainChar, tbDiscId)
|
||||
local nSource = self:GetBuildSource(nBuildId)
|
||||
if nSource == AllEnum.BuildSource.LimitedTrial then
|
||||
return PlayerData.Char:CalCharacterLimitedTrialAttrBattle(nTrialId, stActorInfo, bMainChar, tbDiscId, nBuildId)
|
||||
elseif nSource == AllEnum.BuildSource.Trial then
|
||||
return PlayerData.Char:CalCharacterTrialAttrBattle(nTrialId, stActorInfo, bMainChar, tbDiscId, nBuildId)
|
||||
if bMainChar then
|
||||
self:ClearBattleCharSkinIds()
|
||||
end
|
||||
return PlayerData.Char:CalCharacterAttrBattle(nCharId, stActorInfo, bMainChar, tbDiscId, nBuildId)
|
||||
local nSource = self:GetBuildSource(nBuildId)
|
||||
local mapAttr
|
||||
if nSource == AllEnum.BuildSource.LimitedTrial then
|
||||
mapAttr = PlayerData.Char:CalCharacterLimitedTrialAttrBattle(nTrialId, stActorInfo, bMainChar, tbDiscId, nBuildId)
|
||||
elseif nSource == AllEnum.BuildSource.Trial then
|
||||
mapAttr = PlayerData.Char:CalCharacterTrialAttrBattle(nTrialId, stActorInfo, bMainChar, tbDiscId, nBuildId)
|
||||
else
|
||||
mapAttr = PlayerData.Char:CalCharacterAttrBattle(nCharId, stActorInfo, bMainChar, tbDiscId, nBuildId)
|
||||
end
|
||||
if stActorInfo.skinId ~= nil and stActorInfo.skinId > 0 then
|
||||
self._mapBattleCharSkinId[nCharId] = stActorInfo.skinId
|
||||
end
|
||||
return mapAttr
|
||||
end
|
||||
function PlayerBuildData:GetBuildDiscInfoInBuild(nBuildId, nDiscId, tbSecondarySkill)
|
||||
local nSource = self:GetBuildSource(nBuildId)
|
||||
@@ -516,6 +685,7 @@ function PlayerBuildData:NetMsg_GetBuildDetailData(nBuildId, func, ...)
|
||||
end
|
||||
self._MapBuildData[nBuildId].tbNotes = tbNotes
|
||||
self._MapBuildData[nBuildId].bDetail = true
|
||||
self._MapBuildData[nBuildId].nModifierState = msgData.Detail.ModifierState
|
||||
func(self, table.unpack(arg))
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.star_tower_build_detail_get_req, {BuildId = nBuildId}, nil, MsgCallBack)
|
||||
@@ -608,7 +778,8 @@ function PlayerBuildData:CreateLimitedTrialBuild(nTrialId)
|
||||
tbSecondarySkill = {},
|
||||
tbPotentials = {},
|
||||
tbNotes = {},
|
||||
nTowerId = mapTrialData.StarTowerId or 0
|
||||
nTowerId = mapTrialData.StarTowerId or 0,
|
||||
nModifierState = AllEnum.BuildModifierState.CannotModify
|
||||
}
|
||||
local tbCharTrialId = {}
|
||||
local tbCharPotentialCount = {}
|
||||
@@ -618,7 +789,6 @@ function PlayerBuildData:CreateLimitedTrialBuild(nTrialId)
|
||||
nTid = 0,
|
||||
nPotentialCount = 0
|
||||
})
|
||||
tbCharPotentialCount[v] = 0
|
||||
table.insert(tbCharTrialId, v)
|
||||
end
|
||||
mapBuildData.tbDisc = mapTrialData.Disc
|
||||
@@ -631,22 +801,13 @@ function PlayerBuildData:CreateLimitedTrialBuild(nTrialId)
|
||||
if not mapBuildData.tbPotentials[nCharId] then
|
||||
mapBuildData.tbPotentials[nCharId] = {}
|
||||
end
|
||||
if tbCharPotentialCount[nCharId] ~= nil then
|
||||
tbCharPotentialCount[nCharId] = tbCharPotentialCount[nCharId] + v.Level
|
||||
end
|
||||
tbCharPotentialCount[nCharId] = (tbCharPotentialCount[nCharId] or 0) + v.Level
|
||||
table.insert(mapBuildData.tbPotentials[nCharId], {
|
||||
nPotentialId = v.Tid,
|
||||
nLevel = v.Level
|
||||
})
|
||||
end
|
||||
end
|
||||
for nCharId, nCount in pairs(tbCharPotentialCount) do
|
||||
for _, v in pairs(mapBuildData.tbChar) do
|
||||
if v.nTrialId == nCharId then
|
||||
v.nPotentialCount = nCount
|
||||
end
|
||||
end
|
||||
end
|
||||
local tbNoteJson = decodeJson(mapTrialData.Note)
|
||||
local tbNotes = {}
|
||||
for _, v in pairs(tbNoteJson) do
|
||||
@@ -658,6 +819,7 @@ function PlayerBuildData:CreateLimitedTrialBuild(nTrialId)
|
||||
for k, v in pairs(mapBuildData.tbChar) do
|
||||
local mapTrialChar = PlayerData.Char:GetLimitedTrialCharById(v.nTrialId)
|
||||
mapBuildData.tbChar[k].nTid = mapTrialChar ~= nil and mapTrialChar.nId or 0
|
||||
mapBuildData.tbChar[k].nPotentialCount = tbCharPotentialCount[mapBuildData.tbChar[k].nTid] or 0
|
||||
end
|
||||
self._MapLimitedTrialBuildData[nTrialId] = mapBuildData
|
||||
if 0 >= table.indexof(self._tbLimitedTrialBuildId, nTrialId) then
|
||||
@@ -668,6 +830,7 @@ end
|
||||
function PlayerBuildData:ClearLimitedTrialBuildCache()
|
||||
self._MapLimitedTrialBuildData = {}
|
||||
self._tbLimitedTrialBuildId = {}
|
||||
self._sLimitedTrialBuildCacheKey = nil
|
||||
PlayerData.Char:DeleteLimitedTrialChar()
|
||||
PlayerData.Disc:DeleteLimitedTrialDisc()
|
||||
end
|
||||
@@ -676,14 +839,30 @@ function PlayerBuildData:RefreshLimitedTrialBuildCache(tbTrialBuildId)
|
||||
if type(tbTrialBuildId) ~= "table" then
|
||||
return
|
||||
end
|
||||
self._sLimitedTrialBuildCacheKey = table.concat(tbTrialBuildId, ",")
|
||||
for _, nTrialId in ipairs(tbTrialBuildId) do
|
||||
self:CreateLimitedTrialBuild(nTrialId)
|
||||
end
|
||||
end
|
||||
function PlayerBuildData:GetActiveLimitedTrialBuilds(nType)
|
||||
function PlayerBuildData:SyncLimitedTrialBuildCache()
|
||||
local tbTrialBuildId = {}
|
||||
if self:IsLimitedTrialBuildActivityOpen() then
|
||||
tbTrialBuildId = PlayerData.Reengagement:GetLimitedTrialBuildList() or {}
|
||||
end
|
||||
local sKey = table.concat(tbTrialBuildId, ",")
|
||||
if self._sLimitedTrialBuildCacheKey == sKey then
|
||||
return
|
||||
end
|
||||
self:RefreshLimitedTrialBuildCache(tbTrialBuildId)
|
||||
end
|
||||
function PlayerBuildData:GetActiveLimitedTrialBuilds(nType, bIncludeUnsupported)
|
||||
local tbRet = {}
|
||||
local mapRet = {}
|
||||
if not self:IsLimitedTrialBuildActivityOpen() or not self:IsLimitedTrialBuildAllowedType(nType) then
|
||||
self:SyncLimitedTrialBuildCache()
|
||||
if not self:IsLimitedTrialBuildActivityOpen() then
|
||||
return tbRet, mapRet
|
||||
end
|
||||
if not bIncludeUnsupported and not self:IsLimitedTrialBuildAllowedType(nType) then
|
||||
return tbRet, mapRet
|
||||
end
|
||||
for _, nBuildId in ipairs(self._tbLimitedTrialBuildId) do
|
||||
@@ -695,11 +874,17 @@ function PlayerBuildData:GetActiveLimitedTrialBuilds(nType)
|
||||
end
|
||||
return tbRet, mapRet
|
||||
end
|
||||
function PlayerBuildData:GetSelectableBuildBriefData(callback, nType)
|
||||
function PlayerBuildData:GetSelectableBuildBriefData(callback, nType, bIncludeUnsupported)
|
||||
local onGetBuildBrief = function(tbBuildData, mapAllBuild)
|
||||
local tbRet = clone(tbBuildData)
|
||||
local mapRet = clone(mapAllBuild)
|
||||
local tbLimitedBuild, mapLimitedBuild = self:GetActiveLimitedTrialBuilds(nType)
|
||||
local tbRet = {}
|
||||
local mapRet = {}
|
||||
for _, mapBuildData in ipairs(tbBuildData) do
|
||||
table.insert(tbRet, mapBuildData)
|
||||
end
|
||||
for nBuildId, mapBuildData in pairs(mapAllBuild) do
|
||||
mapRet[nBuildId] = mapBuildData
|
||||
end
|
||||
local tbLimitedBuild, mapLimitedBuild = self:GetActiveLimitedTrialBuilds(nType, bIncludeUnsupported)
|
||||
for _, mapBuildData in ipairs(tbLimitedBuild) do
|
||||
table.insert(tbRet, mapBuildData)
|
||||
end
|
||||
@@ -734,6 +919,7 @@ function PlayerBuildData:CreateTrialBuild(nTrialId)
|
||||
tbPotentials = {},
|
||||
tbNotes = {},
|
||||
nTowerId = mapTrialData.StarTowerId or 0,
|
||||
nModifierState = AllEnum.BuildModifierState.CannotModify,
|
||||
bTrial = true
|
||||
}
|
||||
local tbCharTrialId = {}
|
||||
@@ -744,7 +930,6 @@ function PlayerBuildData:CreateTrialBuild(nTrialId)
|
||||
nTid = 0,
|
||||
nPotentialCount = 0
|
||||
})
|
||||
tbCharPotentialCount[v] = 0
|
||||
table.insert(tbCharTrialId, v)
|
||||
end
|
||||
self._mapTrialBuild.tbDisc = mapTrialData.Disc
|
||||
@@ -757,22 +942,13 @@ function PlayerBuildData:CreateTrialBuild(nTrialId)
|
||||
if not self._mapTrialBuild.tbPotentials[nCharId] then
|
||||
self._mapTrialBuild.tbPotentials[nCharId] = {}
|
||||
end
|
||||
if tbCharPotentialCount[nCharId] ~= nil then
|
||||
tbCharPotentialCount[nCharId] = tbCharPotentialCount[nCharId] + v.Level
|
||||
end
|
||||
tbCharPotentialCount[nCharId] = (tbCharPotentialCount[nCharId] or 0) + v.Level
|
||||
table.insert(self._mapTrialBuild.tbPotentials[nCharId], {
|
||||
nPotentialId = v.Tid,
|
||||
nLevel = v.Level
|
||||
})
|
||||
end
|
||||
end
|
||||
for nCharId, nCount in pairs(tbCharPotentialCount) do
|
||||
for _, v in pairs(self._mapTrialBuild.tbChar) do
|
||||
if v.nTrialId == nCharId then
|
||||
v.nPotentialCount = nCount
|
||||
end
|
||||
end
|
||||
end
|
||||
local tbNoteJson = decodeJson(mapTrialData.Note)
|
||||
local tbNotes = {}
|
||||
for _, v in pairs(tbNoteJson) do
|
||||
@@ -784,6 +960,7 @@ function PlayerBuildData:CreateTrialBuild(nTrialId)
|
||||
for k, v in pairs(self._mapTrialBuild.tbChar) do
|
||||
local mapTrialChar = PlayerData.Char:GetTrialCharById(v.nTrialId)
|
||||
self._mapTrialBuild.tbChar[k].nTid = mapTrialChar ~= nil and mapTrialChar.nId or 0
|
||||
self._mapTrialBuild.tbChar[k].nPotentialCount = tbCharPotentialCount[self._mapTrialBuild.tbChar[k].nTid] or 0
|
||||
end
|
||||
return self._mapTrialBuild
|
||||
end
|
||||
@@ -899,8 +1076,8 @@ function PlayerBuildData:GetTrialBuildAllEft()
|
||||
end, "体验build")
|
||||
end
|
||||
function PlayerBuildData:SetBuildReportInfo(nBuildId)
|
||||
local mapDetailData = self._MapBuildData[nBuildId]
|
||||
if mapDetailData == nil or not self._MapBuildData[nBuildId].bDetail then
|
||||
local mapDetailData = self:GetBuildData(nBuildId)
|
||||
if mapDetailData == nil or not mapDetailData.bDetail then
|
||||
printError("No Build Detail Data")
|
||||
return
|
||||
end
|
||||
@@ -914,7 +1091,7 @@ function PlayerBuildData:SetBuildReportInfo(nBuildId)
|
||||
local stBuildDisc = CS.BuildDiscData()
|
||||
stBuildDisc.discId = nDiscId
|
||||
local mapDiscData = PlayerData.Disc:GetDiscById(nDiscId)
|
||||
if mapDetailData ~= nil then
|
||||
if mapDiscData ~= nil then
|
||||
stBuildDisc.level = mapDiscData.nLevel
|
||||
stBuildDisc.breakCount = mapDiscData.nStar
|
||||
stBuildDisc.advance = mapDiscData.nPhase
|
||||
@@ -939,6 +1116,22 @@ function PlayerBuildData:SetBuildReportInfo(nBuildId)
|
||||
stBuildCharData.potentialIds = tbPotentials
|
||||
table.insert(tbCharData, stBuildCharData)
|
||||
end
|
||||
NovaAPI.SetBuildReportInfo(nBuildId, mapDetailData.sName or "", tbCharData, tbDiscData, tbSkills, tbNotes)
|
||||
local fnStringKeyMap = function(map)
|
||||
local tb = {}
|
||||
if map == nil then
|
||||
return tb
|
||||
end
|
||||
for k, v in pairs(map) do
|
||||
tb[tostring(k)] = v
|
||||
end
|
||||
return tb
|
||||
end
|
||||
local mapEncode = {}
|
||||
for k, v in pairs(mapDetailData) do
|
||||
mapEncode[k] = v
|
||||
end
|
||||
mapEncode.tbPotentials = fnStringKeyMap(mapDetailData.tbPotentials)
|
||||
mapEncode.tbNotes = fnStringKeyMap(mapDetailData.tbNotes)
|
||||
NovaAPI.SetBuildReportInfo(RapidJson.encode(mapEncode), mapDetailData.sName or "", tbCharData, tbDiscData, tbSkills, tbNotes)
|
||||
end
|
||||
return PlayerBuildData
|
||||
|
||||
@@ -39,6 +39,65 @@ function PlayerCoinData:ChangeCoin(mapCoinChange)
|
||||
end
|
||||
end
|
||||
end
|
||||
function PlayerCoinData:ExchangeFurnitureCoin(nAllNeedFurniture, funcOpenBuyGem)
|
||||
local nHasFurniture = self:GetCoinCount(AllEnum.CoinItemId.Furniture)
|
||||
if nAllNeedFurniture <= nHasFurniture then
|
||||
return
|
||||
end
|
||||
local nHasJade = self:GetCoinCount(AllEnum.CoinItemId.Jade)
|
||||
local nHasStone = self:GetCoinCount(AllEnum.CoinItemId.FREESTONE) + self:GetCoinCount(AllEnum.CoinItemId.STONE)
|
||||
local nFurnitureConvertProp = ConfigTable.GetConfigNumber("DormBlocksConvertProp")
|
||||
local nJadeConvertCount = nHasJade * nFurnitureConvertProp
|
||||
local nStoneConvertCount = nHasStone * nFurnitureConvertProp
|
||||
local nNeedFurniture = nAllNeedFurniture - nHasFurniture
|
||||
local nAllNeedJade = math.ceil(nNeedFurniture / nFurnitureConvertProp)
|
||||
local nNeedJade = nAllNeedJade - nHasJade
|
||||
local nAllNeedStone = nNeedJade
|
||||
local stone_warn = function()
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = orderedFormat(ConfigTable.GetUIText("Recruit_Charge"), AllEnum.CoinItemId.STONE),
|
||||
callbackConfirm = funcOpenBuyGem,
|
||||
bBlur = false
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
local jade_warn = function(callbackConfirm)
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = orderedFormat(ConfigTable.GetUIText("Coin_Exchange"), AllEnum.CoinItemId.Jade, nAllNeedStone, AllEnum.CoinItemId.STONE, nNeedJade, AllEnum.CoinItemId.Jade),
|
||||
callbackConfirm = callbackConfirm,
|
||||
bBlur = false
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
local furniture_warn = function(callbackConfirm)
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = orderedFormat(ConfigTable.GetUIText("Coin_Exchange"), AllEnum.CoinItemId.Furniture, nAllNeedJade, AllEnum.CoinItemId.Jade, nNeedFurniture, AllEnum.CoinItemId.Furniture),
|
||||
callbackConfirm = callbackConfirm,
|
||||
bBlur = false
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
local convert_furniture = function()
|
||||
self:SendDormBlocksConvertReq(nAllNeedJade)
|
||||
end
|
||||
local convert_jade = function()
|
||||
self:SendGemConvertReqReq(nAllNeedStone)
|
||||
end
|
||||
if nJadeConvertCount >= nNeedFurniture then
|
||||
furniture_warn(convert_furniture)
|
||||
elseif nNeedFurniture <= nJadeConvertCount + nStoneConvertCount then
|
||||
furniture_warn(function()
|
||||
jade_warn(convert_jade)
|
||||
end)
|
||||
else
|
||||
furniture_warn(function()
|
||||
jade_warn(stone_warn)
|
||||
end)
|
||||
end
|
||||
end
|
||||
function PlayerCoinData:SendGemConvertReqReq(nCount, callback)
|
||||
local mapMsg = {Value = nCount}
|
||||
local successCallback = function(_, mapData)
|
||||
@@ -49,4 +108,14 @@ function PlayerCoinData:SendGemConvertReqReq(nCount, callback)
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.gem_convert_req, mapMsg, nil, successCallback)
|
||||
end
|
||||
function PlayerCoinData:SendDormBlocksConvertReq(nCount, callback)
|
||||
local mapMsg = {Value = nCount}
|
||||
local successCallback = function(_, mapData)
|
||||
if callback then
|
||||
callback(mapData)
|
||||
end
|
||||
UTILS.OpenReceiveByChangeInfo(mapData)
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.dorm_blocks_convert_req, mapMsg, nil, successCallback)
|
||||
end
|
||||
return PlayerCoinData
|
||||
|
||||
@@ -104,9 +104,13 @@ function PlayerDailyInstanceData:CacheDailyInstanceLevel(tbData)
|
||||
local t2 = mapData.Star & b2 > 0
|
||||
local t3 = mapData.Star & b3 > 0
|
||||
local nStar = self.CalStar(mapData.Star)
|
||||
local nBuildId = 0
|
||||
if mapData.Build ~= nil then
|
||||
nBuildId = mapData.Build.BuildId or 0
|
||||
end
|
||||
self.mapAllLevel[mapData.Id] = {
|
||||
nStar = nStar,
|
||||
nBuildId = mapData.BuildId,
|
||||
nBuildId = nBuildId,
|
||||
tbTarget = {
|
||||
t1,
|
||||
t2,
|
||||
@@ -174,9 +178,12 @@ function PlayerDailyInstanceData:GetDailyInstanceStar(nLevelId)
|
||||
} or self.mapAllLevel[nLevelId].tbTarget
|
||||
end
|
||||
function PlayerDailyInstanceData:MsgEnterDailyInstance(nLevelId, nBuildId, callback)
|
||||
local mapBuildData = PlayerData.Build:GetBuildData(nBuildId)
|
||||
local bTrial = mapBuildData.nBuildSource == AllEnum.BuildSource.Trial or mapBuildData.nBuildSource == AllEnum.BuildSource.LimitedTrial
|
||||
local nBuildType = bTrial and 2 or 1
|
||||
local msg = {}
|
||||
msg.Id = nLevelId
|
||||
msg.BuildId = nBuildId
|
||||
msg.Build = {Type = nBuildType, BuildId = nBuildId}
|
||||
msg.RewardType = self.lastRewardType
|
||||
self._EntryTime = CS.ClientManager.Instance.serverTimeStampWithTimeZone
|
||||
local msgCallback = function()
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
local PlayerDatingData = class("PlayerDatingData")
|
||||
local FREE_DATING_COUNT = 99
|
||||
function PlayerDatingData:Init()
|
||||
self.tbDatingCharIds = 0
|
||||
self.nAllDatingCount = 0
|
||||
self.bFreeDating = false
|
||||
self.tbLandmarkCfg = {}
|
||||
self.mapCharLimitedEvent = {}
|
||||
self.mapCharStartEvent = {}
|
||||
@@ -79,6 +81,9 @@ function PlayerDatingData:RefreshDatingCharIds(tbChar)
|
||||
self.tbDatingCharIds = tbChar
|
||||
end
|
||||
function PlayerDatingData:AddDatingCharId(nCharId)
|
||||
if self:IsFreeDating() then
|
||||
return
|
||||
end
|
||||
for _, v in ipairs(self.tbDatingCharIds) do
|
||||
if v == nCharId then
|
||||
printError("重复邀约!!!")
|
||||
@@ -90,6 +95,12 @@ end
|
||||
function PlayerDatingData:CacheDatingCharIds(tbChar)
|
||||
self.tbDatingCharIds = tbChar
|
||||
end
|
||||
function PlayerDatingData:SetFreeDating(bFree)
|
||||
self.bFreeDating = bFree == true
|
||||
end
|
||||
function PlayerDatingData:IsFreeDating()
|
||||
return self.bFreeDating == true
|
||||
end
|
||||
function PlayerDatingData:GetRandomLandmark(nCharId)
|
||||
local mapCharData = ConfigTable.GetData("DatingCharTag", nCharId)
|
||||
local nCharSetTag = 0
|
||||
@@ -175,9 +186,15 @@ function PlayerDatingData:GetLimitedEventList(nCharId)
|
||||
return mapData
|
||||
end
|
||||
function PlayerDatingData:GetDatingCount()
|
||||
if self:IsFreeDating() then
|
||||
return FREE_DATING_COUNT, FREE_DATING_COUNT
|
||||
end
|
||||
return #self.tbDatingCharIds, self.nAllDatingCount
|
||||
end
|
||||
function PlayerDatingData:CheckDating(nCharId)
|
||||
if self:IsFreeDating() then
|
||||
return false
|
||||
end
|
||||
local bDating = false
|
||||
for _, v in ipairs(self.tbDatingCharIds) do
|
||||
if v == nCharId then
|
||||
@@ -207,6 +224,7 @@ function PlayerDatingData:GetCharStartEventId(nCharId)
|
||||
end
|
||||
function PlayerDatingData:GetCharBranchEventId(nCharId, bFirstBranch)
|
||||
local nEventId = 0
|
||||
local nBranchType = bFirstBranch and GameEnum.DatingEventType.BranchA or GameEnum.DatingEventType.BranchB
|
||||
local funcForeachEvent = function(mapData)
|
||||
if #mapData.DatingEventParams > 0 and mapData.DatingEventParams[1] == self.nCurSelectLandmark then
|
||||
for k, v in pairs(mapData.DatingEventExclude) do
|
||||
@@ -214,9 +232,7 @@ function PlayerDatingData:GetCharBranchEventId(nCharId, bFirstBranch)
|
||||
return
|
||||
end
|
||||
end
|
||||
local last_digit = math.abs(mapData.Id) % 10
|
||||
local nBranchFlag = bFirstBranch and 0 or 1
|
||||
if last_digit == nBranchFlag then
|
||||
if mapData.DatingEventType == nBranchType then
|
||||
nEventId = mapData.Id
|
||||
end
|
||||
end
|
||||
@@ -230,6 +246,18 @@ function PlayerDatingData:GetCharEndEventId(nCharId)
|
||||
return self.mapCharEndEvent[nCharId][nRandom]
|
||||
end
|
||||
end
|
||||
function PlayerDatingData:CheckSpecialOption(nOptId, nCharId, nLandmarkId)
|
||||
if self.mapCharLandmark[nCharId] ~= nil and self.mapCharLandmark[nCharId][nLandmarkId] ~= nil then
|
||||
local tbEvent = self.mapCharLandmark[nCharId][nLandmarkId]
|
||||
for _, nId in ipairs(tbEvent) do
|
||||
local mapCfg = ConfigTable.GetData("DatingCharacterEvent", nId)
|
||||
if mapCfg ~= nil and mapCfg.DatingEventType == GameEnum.DatingEventType.LimitedLandmark and mapCfg.BranchTag == nOptId then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
function PlayerDatingData:SendDatingLandmarkSelectMsg(nCharId, nLandmarkId, callback)
|
||||
local successCallback = function(_, msgData)
|
||||
self:SetCurLandmarkId(nLandmarkId)
|
||||
|
||||
@@ -72,6 +72,9 @@ function PlayerDictionaryData:CacheDictionaryData(tbData)
|
||||
end
|
||||
function PlayerDictionaryData:ChangeDictionaryData(mapData)
|
||||
local nId = self._tbEntryId[mapData.TabId][mapData.Index]
|
||||
if nId == nil then
|
||||
return
|
||||
end
|
||||
if not self._tbEntryStatus[nId] or self._tbEntryStatus[nId] == Status.Uncompleted then
|
||||
local mapCfg = ConfigTable.GetData("DictionaryEntry", nId)
|
||||
if mapCfg ~= nil and mapCfg.Popup == true then
|
||||
|
||||
@@ -99,6 +99,71 @@ function PlayerDiscData:GetDiscSkillScore(nId, tbNote)
|
||||
end
|
||||
return nScore
|
||||
end
|
||||
function PlayerDiscData:GetDiscSkill(tbDisc, tbHasNote)
|
||||
local mapSkill = {}
|
||||
for _, nDiscId in pairs(tbDisc) do
|
||||
local mapData = self:GetDiscById(nDiscId)
|
||||
if mapData == nil then
|
||||
return {}
|
||||
end
|
||||
for _, nSubSkillGroupId in pairs(mapData.tbSubSkillGroupId) do
|
||||
local tbGroup = CacheTable.GetData("_SecondarySkill", nSubSkillGroupId)
|
||||
if tbGroup then
|
||||
local nCurLayer = 0
|
||||
local nMaxLayer = #tbGroup
|
||||
for i = nMaxLayer, 1, -1 do
|
||||
if tbGroup[i] then
|
||||
local bActive = mapData:CheckSubSkillActive(tbHasNote, tbGroup[i])
|
||||
if bActive then
|
||||
nCurLayer = i
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
local nNextLayer = nCurLayer == nMaxLayer and nMaxLayer or nCurLayer + 1
|
||||
if tbGroup[nNextLayer] then
|
||||
local nSubSkillId = tbGroup[nNextLayer].Id
|
||||
local tbActiveNote = CacheTable.GetData("_SecondarySkillNeedNotes", nSubSkillId)
|
||||
if tbActiveNote == nil then
|
||||
local mapJsonData = decodeJson(tbGroup[nNextLayer].NeedSubNoteSkills)
|
||||
tbActiveNote = {}
|
||||
for key, nCount in pairs(mapJsonData) do
|
||||
local nId = tonumber(key)
|
||||
table.insert(tbActiveNote, {nId, nCount})
|
||||
end
|
||||
local sort = function(a, b)
|
||||
return a[1] < b[1]
|
||||
end
|
||||
table.sort(tbActiveNote, sort)
|
||||
CacheTable.SetData("_SecondarySkillNeedNotes", nSubSkillId, tbActiveNote)
|
||||
end
|
||||
local tbMaxLayerActiveNote = CacheTable.GetData("_SecondarySkillNeedNotes", tbGroup[nMaxLayer].Id)
|
||||
if tbMaxLayerActiveNote == nil then
|
||||
local mapJsonData = decodeJson(tbGroup[nMaxLayer].NeedSubNoteSkills)
|
||||
tbMaxLayerActiveNote = {}
|
||||
for key, nCount in pairs(mapJsonData) do
|
||||
local nId = tonumber(key)
|
||||
table.insert(tbMaxLayerActiveNote, {nId, nCount})
|
||||
end
|
||||
local sort = function(a, b)
|
||||
return a[1] < b[1]
|
||||
end
|
||||
table.sort(tbMaxLayerActiveNote, sort)
|
||||
CacheTable.SetData("_SecondarySkillNeedNotes", tbGroup[nMaxLayer].Id, tbMaxLayerActiveNote)
|
||||
end
|
||||
mapSkill[tbGroup[nNextLayer].GroupId] = {
|
||||
nCurLevel = nCurLayer,
|
||||
nId = nSubSkillId,
|
||||
tbNote = tbActiveNote,
|
||||
tbMaxLayerActiveNote = tbMaxLayerActiveNote,
|
||||
nDiscId = nDiscId
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return mapSkill
|
||||
end
|
||||
function PlayerDiscData:GetDiscSkillByNote(tbDisc, tbHasNote, nNeedNote)
|
||||
local tbSkill = {}
|
||||
local sNote = tostring(nNeedNote)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -103,9 +103,13 @@ function PlayerEquipmentInstanceData:CacheEquipmentInstanceLevel(tbData)
|
||||
local t2 = mapData.Star >= 2
|
||||
local t3 = mapData.Star >= 3
|
||||
local nStar = mapData.Star
|
||||
local nBuildId = 0
|
||||
if mapData.Build ~= nil then
|
||||
nBuildId = mapData.Build.BuildId or 0
|
||||
end
|
||||
self.mapAllLevel[mapData.Id] = {
|
||||
nStar = nStar,
|
||||
nBuildId = mapData.BuildId,
|
||||
nBuildId = nBuildId,
|
||||
tbTarget = {
|
||||
t1,
|
||||
t2,
|
||||
@@ -207,9 +211,13 @@ function PlayerEquipmentInstanceData:MsgEnterEquipmentInstance(nLevelId, nBuildI
|
||||
self._EntryTime = CS.ClientManager.Instance.serverTimeStampWithTimeZone
|
||||
self._Build_id = nBuildId
|
||||
self._Level_id = nLevelId
|
||||
local mapBuildData = PlayerData.Build:GetBuildData(nBuildId)
|
||||
local bTrial = mapBuildData.nBuildSource == AllEnum.BuildSource.Trial or mapBuildData.nBuildSource == AllEnum.BuildSource.LimitedTrial
|
||||
local nBuildType = bTrial and 2 or 1
|
||||
local bBuildId = nBuildId
|
||||
local msg = {}
|
||||
msg.Id = nLevelId
|
||||
msg.BuildId = nBuildId
|
||||
msg.Build = {Type = nBuildType, BuildId = bBuildId}
|
||||
msg.RewardType = self.lastRewardType
|
||||
local msgCallback = function(_, mapChangeInfo)
|
||||
self:EnterEquipmentInstance(nLevelId, nBuildId)
|
||||
|
||||
@@ -78,6 +78,9 @@ function PlayerFriendData:GetFriendListData()
|
||||
end)
|
||||
return tbList
|
||||
end
|
||||
function PlayerFriendData:GetFriendDetailData(nUid)
|
||||
return self._tbFriendList[nUid]
|
||||
end
|
||||
function PlayerFriendData:GetFriendListNum()
|
||||
return self._nFriendListNum
|
||||
end
|
||||
|
||||
@@ -72,6 +72,24 @@ function PlayerGachaData:CheckPoolOpen(nPoolId)
|
||||
return IsOpenCardPool(mapPoolCfgData.StartTime, mapPoolCfgData.EndTime)
|
||||
end
|
||||
function PlayerGachaData:CacheGachaData(mapData)
|
||||
if self._mapGachaReward == nil then
|
||||
self._mapGachaReward = {}
|
||||
local foreach_GachaReward = function(mapCfgData)
|
||||
printLog(mapCfgData.Id)
|
||||
if self._mapGachaReward[mapCfgData.GachaId] == nil then
|
||||
self._mapGachaReward[mapCfgData.GachaId] = {}
|
||||
end
|
||||
table.insert(self._mapGachaReward[mapCfgData.GachaId], {
|
||||
nId = mapCfgData.Id,
|
||||
nIdx = mapCfgData.Index,
|
||||
nNum = mapCfgData.Num,
|
||||
nItemId = mapCfgData.Tid,
|
||||
bRec = false,
|
||||
bCan = false
|
||||
})
|
||||
end
|
||||
ForEachTableLine(DataTable.GachaReward, foreach_GachaReward)
|
||||
end
|
||||
for k, v in pairs(mapData) do
|
||||
self._mapGachaCount[v.Id] = v.DaysCount
|
||||
self._mapAupMissTimes[v.Id] = v.AupMissTimes
|
||||
@@ -81,7 +99,21 @@ function PlayerGachaData:CacheGachaData(mapData)
|
||||
self._mapRecvGuaranteeReward[v.Id] = v.RecvGuaranteeReward
|
||||
self._mapGachaTotalTimes[v.Id] = v.GachaTotalTimes
|
||||
self._mapAMissTimes[v.Id] = v.AMissTimes
|
||||
if type(self._mapGachaReward[v.Id]) == "table" then
|
||||
local data = UTILS.ParseByteString(v.RewardsRecords)
|
||||
for ii, vv in ipairs(self._mapGachaReward[v.Id]) do
|
||||
vv.bRec = UTILS.IsBitSet(data, vv.nIdx) == true
|
||||
vv.bCan = self._mapGachaTotalTimes[v.Id] >= vv.nNum
|
||||
end
|
||||
else
|
||||
local cfg = ConfigTable.GetData("Gacha", v.Id)
|
||||
local nStorageId = cfg.StorageId
|
||||
if nStorageId == GameEnum.gachaStorageType.CharacterCardRewardPool then
|
||||
printError("角色卡池累抽赠奖数据错误:数据。卡池id" .. tostring(v.Id))
|
||||
end
|
||||
end
|
||||
end
|
||||
self:CheckRedDot()
|
||||
end
|
||||
function PlayerGachaData:CacheGachaHistory(nSaveId, mapData)
|
||||
if self._mapGachaHistory[nSaveId] == nil then
|
||||
@@ -244,6 +276,13 @@ function PlayerGachaData:RecvGuaranteeReward(nPoolID, bValue)
|
||||
end
|
||||
function PlayerGachaData:GachaTotalTimes(nPoolID, nCount)
|
||||
self._mapGachaTotalTimes[nPoolID] = nCount
|
||||
local tbData = self._mapGachaReward[nPoolID]
|
||||
if type(tbData) == "table" then
|
||||
for _, mapData in ipairs(tbData) do
|
||||
mapData.bCan = nCount >= mapData.nNum
|
||||
end
|
||||
self:CheckRedDot()
|
||||
end
|
||||
end
|
||||
function PlayerGachaData:GetGachaInfomation(callback)
|
||||
local GetInfoCallback = function(_, mapData)
|
||||
@@ -654,4 +693,37 @@ function PlayerGachaData:SendGachaNewbieObtainReq(nId, idx, callback)
|
||||
local mapMsgData = {Id = nId, Idx = idx}
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.gacha_newbie_obtain_req, mapMsgData, nil, GachaCallback)
|
||||
end
|
||||
function PlayerGachaData:GetGachaReward(nPoolID)
|
||||
return self._mapGachaReward[nPoolID]
|
||||
end
|
||||
function PlayerGachaData:GetReward(nPoolID, nId, nIndex, callback)
|
||||
local GetRewardCallback = function(_, mapData)
|
||||
if type(self._mapGachaReward[nPoolID]) == "table" then
|
||||
for k, v in pairs(self._mapGachaReward[nPoolID]) do
|
||||
if v.nId == nId and v.nIdx == nIndex then
|
||||
self._mapGachaReward[nPoolID][k].bRec = true
|
||||
end
|
||||
end
|
||||
else
|
||||
printError("角色卡池累抽赠奖数据错误:数据,领奖消息返回。卡池id" .. tostring(nPoolID))
|
||||
end
|
||||
self:CheckRedDot()
|
||||
if type(callback) == "function" then
|
||||
callback(mapData)
|
||||
end
|
||||
end
|
||||
local mapMsgData = {Value = nId}
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.gacha_reward_get_req, mapMsgData, nil, GetRewardCallback)
|
||||
end
|
||||
function PlayerGachaData:CheckRedDot()
|
||||
for nPoolId, tbData in pairs(self._mapGachaReward) do
|
||||
for _, mapData in ipairs(tbData) do
|
||||
local bOn = mapData.bRec == false and mapData.bCan == true
|
||||
RedDotManager.SetValid(RedDotDefine.Gacha_Reward, {
|
||||
nPoolId,
|
||||
mapData.nIdx
|
||||
}, bOn)
|
||||
end
|
||||
end
|
||||
end
|
||||
return PlayerGachaData
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
local PlayerGuideData = class("PlayerGuideData")
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
PanelId = require("GameCore.UI.PanelId")
|
||||
function PlayerGuideData:Init()
|
||||
self.isProcessing = false
|
||||
@@ -58,7 +59,7 @@ end
|
||||
function PlayerGuideData:CheckInGuideGroup(nId)
|
||||
return self.isProcessing and self.runGroupId == nId
|
||||
end
|
||||
function PlayerGuideData:SetPlayerLearnReq(groupId, stepId)
|
||||
function PlayerGuideData:SetPlayerLearnReq(groupId, stepId, type, season)
|
||||
self.tabGuideNewbie[groupId] = stepId
|
||||
if stepId == -1 then
|
||||
local callallback = function()
|
||||
@@ -66,13 +67,30 @@ function PlayerGuideData:SetPlayerLearnReq(groupId, stepId)
|
||||
self:CheckHaveGuideData()
|
||||
end
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.player_learn_req, {GroupId = groupId, StepId = stepId}, nil, callallback)
|
||||
if type and type == AllEnum.GuideType.Dorm then
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.dorm_learn_req, {GroupId = groupId, StepId = stepId}, nil, callallback)
|
||||
elseif type and type == AllEnum.GuideType.Soldier then
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.soldier_learn_req, {
|
||||
Season = season,
|
||||
GroupId = groupId,
|
||||
StepId = stepId
|
||||
}, nil, callallback)
|
||||
else
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.player_learn_req, {GroupId = groupId, StepId = stepId}, nil, callallback)
|
||||
end
|
||||
end
|
||||
end
|
||||
function PlayerGuideData:OnEvent_PanelOnEnableById(_panelId)
|
||||
if EditorSettings and EditorSettings.bJumpGuide then
|
||||
return
|
||||
end
|
||||
if PopUpManager.IsQueueOccupied() then
|
||||
if _panelId ~= PanelId.MainView then
|
||||
self.openPanelId = _panelId
|
||||
self:_ReleaseLoginGuideQueue()
|
||||
end
|
||||
return
|
||||
end
|
||||
if _panelId == PanelId.MainView then
|
||||
return
|
||||
end
|
||||
@@ -88,30 +106,64 @@ function PlayerGuideData:OnEvent_CloseDisposablePanel(nPanelId)
|
||||
end
|
||||
end
|
||||
function PlayerGuideData:Event_PopUpEndCheckMainView()
|
||||
if EditorSettings and EditorSettings.bJumpGuide then
|
||||
return
|
||||
end
|
||||
if self.isProcessing then
|
||||
return
|
||||
end
|
||||
if PanelManager.GetCurPanelId() == PanelId.MainView then
|
||||
if PlayerData.State:CheckState() then
|
||||
return
|
||||
end
|
||||
self.openPanelId = PanelId.MainView
|
||||
self:CheckHaveGuideData()
|
||||
end
|
||||
end
|
||||
function PlayerGuideData:OnEvent_UpdateWorldClass()
|
||||
if EditorSettings and EditorSettings.bJumpGuide then
|
||||
return
|
||||
end
|
||||
if PopUpManager.IsQueueOccupied() then
|
||||
return
|
||||
end
|
||||
if self.isProcessing then
|
||||
return
|
||||
end
|
||||
self:CheckHaveGuideData()
|
||||
end
|
||||
function PlayerGuideData:_ReleaseLoginGuideQueue()
|
||||
if self._fnLoginGuideDone == nil then
|
||||
return
|
||||
end
|
||||
local fnLoginGuideDone = self._fnLoginGuideDone
|
||||
self._fnLoginGuideDone = nil
|
||||
fnLoginGuideDone()
|
||||
end
|
||||
function PlayerGuideData:RunLoginGuide(callback)
|
||||
if EditorSettings and EditorSettings.bJumpGuide then
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
return
|
||||
end
|
||||
self._fnLoginGuideDone = callback
|
||||
self.openPanelId = PanelId.MainView
|
||||
self:CheckHaveGuideData()
|
||||
if not self.isProcessing then
|
||||
self._fnLoginGuideDone = nil
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
end
|
||||
function PlayerGuideData:NoteDormAbort(nGroupId)
|
||||
self._mapDormAbortCd = self._mapDormAbortCd or {}
|
||||
self._mapDormAbortCd[nGroupId] = TimerManager.GetUnscaledTime() + 3
|
||||
self._nDormAbortFrame = CS.UnityEngine.Time.frameCount
|
||||
self._nDormAbortGroup = nGroupId
|
||||
end
|
||||
function PlayerGuideData:_DormBlocked(nGroupId)
|
||||
if self._nDormAbortGroup == nGroupId and self._nDormAbortFrame == CS.UnityEngine.Time.frameCount then
|
||||
return true
|
||||
end
|
||||
local nCd = self._mapDormAbortCd and self._mapDormAbortCd[nGroupId]
|
||||
if nCd ~= nil and nCd > TimerManager.GetUnscaledTime() then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
function PlayerGuideData:CheckHaveGuideData()
|
||||
if self.isProcessing then
|
||||
return
|
||||
end
|
||||
for i, v in pairs(self._guideInitiativeTableData) do
|
||||
if (self.tabGuideNewbie[v.Id] == nil or self.tabGuideNewbie[v.Id] ~= -1) and v.IsActive then
|
||||
local bGuide = true
|
||||
@@ -122,7 +174,7 @@ function PlayerGuideData:CheckHaveGuideData()
|
||||
bGuide = self:CheckGuidePrePose(v.GuidePrepose2, v.PreposeParams2)
|
||||
end
|
||||
bGuide = bGuide and self:CheckGuidePost(v) and self:CheckGuidetrigger(v)
|
||||
if bGuide then
|
||||
if bGuide and not self:_DormBlocked(v.Id) then
|
||||
self.runGroupId = v.Id
|
||||
self.runStepId = self.tabGuideNewbie[v.Id] or 0
|
||||
self:OpenGuidePanel()
|
||||
@@ -186,6 +238,24 @@ function PlayerGuideData:CheckGuidePrePose(nPoseType, param)
|
||||
if isFinish == false then
|
||||
return true
|
||||
end
|
||||
elseif nPoseType == (GameEnum.guideprepose.FinishDormQuest or 8) then
|
||||
local _prepose = decodeJson(param)
|
||||
local DormGuideAdapter = require("Game.UI.Dorm.DormGuideAdapter")
|
||||
return DormGuideAdapter.QuestStatus(_prepose[1]) == 2
|
||||
elseif nPoseType == (GameEnum.guideprepose.FinishDormQuestGroup or 9) then
|
||||
local _prepose = decodeJson(param)
|
||||
local nGroupId = _prepose[1]
|
||||
local objDorm = PlayerData.PlayerDormData
|
||||
if objDorm == nil or objDorm.bHasRoomData ~= true then
|
||||
return false
|
||||
end
|
||||
local nCurGroup, nGroupState = objDorm:GetDormQuestDataWithGroup()
|
||||
if nCurGroup == 0 or nGroupId < nCurGroup then
|
||||
return true
|
||||
end
|
||||
if nCurGroup == nGroupId and nGroupState == 1 then
|
||||
return true
|
||||
end
|
||||
else
|
||||
return true
|
||||
end
|
||||
@@ -254,7 +324,10 @@ function PlayerGuideData:FinishCurrentGroup(isCheck)
|
||||
if isCheck then
|
||||
self:CheckHaveGuideData()
|
||||
end
|
||||
if PanelManager.GetCurPanelId() == PanelId.MainView then
|
||||
local DormGuideAdapter = require("Game.UI.Dorm.DormGuideAdapter")
|
||||
DormGuideAdapter.OnGuideReleased()
|
||||
if not self.isProcessing then
|
||||
self:_ReleaseLoginGuideQueue()
|
||||
end
|
||||
end
|
||||
function PlayerGuideData:Event_PassiveCheckMsg(msg)
|
||||
@@ -262,6 +335,10 @@ function PlayerGuideData:Event_PassiveCheckMsg(msg)
|
||||
return
|
||||
end
|
||||
if self.isProcessing then
|
||||
if msg == "Guide_DormEnter" or msg == "Guide_DormEnterRoom2" then
|
||||
local DormGuideAdapter = require("Game.UI.Dorm.DormGuideAdapter")
|
||||
DormGuideAdapter.NotePassive(msg)
|
||||
end
|
||||
return
|
||||
end
|
||||
for i, v in pairs(self._guidePassiveTableData) do
|
||||
@@ -274,7 +351,7 @@ function PlayerGuideData:Event_PassiveCheckMsg(msg)
|
||||
bGuide = self:CheckGuidePrePose(v.GuidePrepose2, v.PreposeParams2)
|
||||
end
|
||||
bGuide = bGuide and self:CheckGuidePost(v) and self:CheckGuidetrigger(v)
|
||||
if bGuide then
|
||||
if bGuide and not self:_DormBlocked(v.Id) then
|
||||
self.runGroupId = v.Id
|
||||
self.runStepId = self.tabGuideNewbie[v.Id] or 0
|
||||
self:OpenGuidePanel()
|
||||
|
||||
@@ -6,6 +6,9 @@ local HandbookSkinData = require("GameCore.Data.DataClass.HandBookData.HandbookS
|
||||
local HandbookDiscData = require("GameCore.Data.DataClass.HandBookData.HandbookDiscData")
|
||||
local HandbookPlotData = require("GameCore.Data.DataClass.HandBookData.HandbookPlotData")
|
||||
local HandbookStorySetData = require("GameCore.Data.DataClass.HandBookData.HandbookStorySetData")
|
||||
local HandbookDormFurnitureData = require("GameCore.Data.DataClass.HandBookData.HandbookDormFurnitureData")
|
||||
local HandbookDormSkinData = require("GameCore.Data.DataClass.HandBookData.HandbookDormSkinData")
|
||||
local HandbookStoryReviewData = require("GameCore.Data.DataClass.HandBookData.HandbookStoryReviewData")
|
||||
function PlayerHandbookData:ParseBitMapData(bitMap)
|
||||
local bitMapData = {}
|
||||
for k, v in ipairs(bitMap) do
|
||||
@@ -42,6 +45,12 @@ function PlayerHandbookData:CreateHandbook(type, id, unlock)
|
||||
handbookData = HandbookPlotData.new(id, unlock)
|
||||
elseif type == GameEnum.handbookType.StorySet then
|
||||
handbookData = HandbookStorySetData.new(id, unlock)
|
||||
elseif type == GameEnum.handbookType.DormFurniture then
|
||||
handbookData = HandbookDormFurnitureData.new(id, unlock)
|
||||
elseif type == GameEnum.handbookType.DormSkin then
|
||||
handbookData = HandbookDormSkinData.new(id, unlock)
|
||||
elseif type == GameEnum.handbookType.StoryReview then
|
||||
handbookData = HandbookStoryReviewData.new(id, unlock)
|
||||
end
|
||||
return handbookData
|
||||
end
|
||||
|
||||
@@ -180,9 +180,13 @@ function PlayerInfinityTowerData:SendEnterITApplyReq(nLevelId, nBuildId, isAgain
|
||||
self._EntryTime = CS.ClientManager.Instance.serverTimeStampWithTimeZone
|
||||
self._Build_id = nBuildId
|
||||
self._Level_id = nLevelId
|
||||
local msg = {}
|
||||
msg.LevelId = nLevelId
|
||||
msg.BuildId = nBuildId
|
||||
local mapBuildData = PlayerData.Build:GetBuildData(nBuildId)
|
||||
local bTrial = mapBuildData.nBuildSource == AllEnum.BuildSource.Trial or mapBuildData.nBuildSource == AllEnum.BuildSource.LimitedTrial
|
||||
local nBuildType = bTrial and 2 or 1
|
||||
local msg = {
|
||||
LevelId = nLevelId,
|
||||
Build = {Type = nBuildType, BuildId = nBuildId}
|
||||
}
|
||||
local msgCallback = function()
|
||||
if isAgainNext then
|
||||
EventManager.Hit("Infinity_Tower_AgainOrNext")
|
||||
|
||||
@@ -888,6 +888,14 @@ function PlayerItemData:ProcessRewardChangeInfo(mapChangeInfo)
|
||||
end
|
||||
end
|
||||
end
|
||||
if type(mapDecodeInfo["proto.DormItem"]) == "table" then
|
||||
for _, mapData in ipairs(mapDecodeInfo["proto.DormItem"]) do
|
||||
local itemInfo = ConfigTable.GetData_Item(mapData.Tid)
|
||||
if itemInfo then
|
||||
add_reward(mapData.Tid, mapData.Qty)
|
||||
end
|
||||
end
|
||||
end
|
||||
for nId, nCount in pairs(tbRewardById) do
|
||||
if nCount <= 0 then
|
||||
tbRewardById[nId] = nil
|
||||
|
||||
@@ -34,11 +34,15 @@ function PlayerMallData:Init()
|
||||
self._tbPackagePage = {}
|
||||
self._tbExchangeShop = {}
|
||||
self._tbPackage = {}
|
||||
self._mapActivityProduct = {}
|
||||
self._mapActivityCfgByActId = {}
|
||||
self._sActivityNewId = nil
|
||||
EventManager.Add("OnSdkPaySuc", PlayerMallData, self.OnEvent_PayRespone)
|
||||
EventManager.Add("OnSdkPayFail", PlayerMallData, self.OnEvent_PayRespone)
|
||||
EventManager.Add(EventId.IsNewDay, self, self.OnEvent_NewDay)
|
||||
self:ProcessExchangeShop()
|
||||
self:ProcessPackagePage()
|
||||
self:ProcessMallActivityCfg()
|
||||
end
|
||||
function PlayerMallData:UnInit()
|
||||
self._tbNextMallPackage = nil
|
||||
@@ -57,6 +61,9 @@ function PlayerMallData:UnInit()
|
||||
self._tbPackagePage = nil
|
||||
self._tbExchangeShop = nil
|
||||
self._tbPackage = nil
|
||||
self._mapActivityProduct = nil
|
||||
self._mapActivityCfgByActId = nil
|
||||
self._sActivityNewId = nil
|
||||
EventManager.Remove("OnSdkPaySuc", PlayerMallData, self.OnEvent_PayRespone)
|
||||
EventManager.Remove("OnSdkPayFail", PlayerMallData, self.OnEvent_PayRespone)
|
||||
EventManager.Remove(EventId.IsNewDay, self, self.OnEvent_NewDay)
|
||||
@@ -67,6 +74,70 @@ end
|
||||
function PlayerMallData:GetPackagePage(nType)
|
||||
return self._tbPackagePage[nType] or {}
|
||||
end
|
||||
function PlayerMallData:GetGroupSubType(nGroupId)
|
||||
local groupCfg = ConfigTable.GetData("MallPackagePage", nGroupId)
|
||||
if groupCfg == nil then
|
||||
return nil
|
||||
end
|
||||
return groupCfg.SubType
|
||||
end
|
||||
function PlayerMallData:IsFurnitureGroup(nGroupId)
|
||||
return self:GetGroupSubType(nGroupId) == GameEnum.MallItemSubType.Furniture
|
||||
end
|
||||
function PlayerMallData:IsFurnitureValueGroup(nGroupId)
|
||||
local nSubType = self:GetGroupSubType(nGroupId)
|
||||
return nSubType == GameEnum.MallItemSubType.Furniture or nSubType == GameEnum.MallItemSubType.FurnitureSet
|
||||
end
|
||||
function PlayerMallData:GetPackageSubType(sId)
|
||||
local mapCfg = ConfigTable.GetData("MallPackage", sId)
|
||||
if mapCfg == nil then
|
||||
return nil
|
||||
end
|
||||
return self:GetGroupSubType(mapCfg.GroupId)
|
||||
end
|
||||
function PlayerMallData:GetPackageCollectionValue(mapCfg)
|
||||
if mapCfg == nil or mapCfg.Items == nil then
|
||||
return 0
|
||||
end
|
||||
local nValue = 0
|
||||
for sItemId in pairs(decodeJson(mapCfg.Items) or {}) do
|
||||
local furnitureCfg = ConfigTable.GetData("DormFurniture", tonumber(sItemId))
|
||||
if furnitureCfg ~= nil then
|
||||
nValue = nValue + furnitureCfg.CollectionValue
|
||||
end
|
||||
end
|
||||
return nValue
|
||||
end
|
||||
function PlayerMallData:GetFurnitureSetCollectionValue(mapCfg)
|
||||
if mapCfg == nil or mapCfg.Items == nil then
|
||||
return 0
|
||||
end
|
||||
if self:GetGroupSubType(mapCfg.GroupId) ~= GameEnum.MallItemSubType.FurnitureSet then
|
||||
return 0
|
||||
end
|
||||
local nValue = 0
|
||||
for sSetId in pairs(decodeJson(mapCfg.Items) or {}) do
|
||||
local itemCfg = ConfigTable.GetData_Item(tonumber(sSetId))
|
||||
if itemCfg ~= nil then
|
||||
for sItemId in pairs(decodeJson(itemCfg.UseArgs) or {}) do
|
||||
local furnitureCfg = ConfigTable.GetData("DormFurniture", tonumber(sItemId))
|
||||
if furnitureCfg ~= nil then
|
||||
nValue = nValue + furnitureCfg.CollectionValue
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return nValue
|
||||
end
|
||||
function PlayerMallData:GetFurnitureValue(mapCfg)
|
||||
if mapCfg == nil then
|
||||
return 0
|
||||
end
|
||||
if self:GetGroupSubType(mapCfg.GroupId) == GameEnum.MallItemSubType.FurnitureSet then
|
||||
return self:GetFurnitureSetCollectionValue(mapCfg)
|
||||
end
|
||||
return self:GetPackageCollectionValue(mapCfg)
|
||||
end
|
||||
function PlayerMallData:CheckOrderProcess()
|
||||
return self._bProcessingOrder
|
||||
end
|
||||
@@ -108,6 +179,25 @@ function PlayerMallData:BuyPackage(sId, sStatistical)
|
||||
end
|
||||
self:SendMallPackageOrderReq(sId, callback)
|
||||
end
|
||||
function PlayerMallData:BuyReengagementPackage(sId, sStatistical)
|
||||
local tab = {}
|
||||
table.insert(tab, {
|
||||
"role_id",
|
||||
tostring(PlayerData.Base._nPlayerId)
|
||||
})
|
||||
NovaAPI.UserEventUpload("purchase_click", tab)
|
||||
local callback = function(mapData)
|
||||
self._mapOrderId[mapData.ExtraData] = {
|
||||
nOrderId = mapData.Id,
|
||||
StatisticalGroup = sStatistical,
|
||||
nType = AllEnum.RMBOrderType.Mall
|
||||
}
|
||||
EventManager.Hit(EventId.BlockInput, true)
|
||||
self._nOrderIdPaying = mapData.Id
|
||||
SDKManager:Pay(sId, mapData.NotifyUrl, mapData.ExtraData)
|
||||
end
|
||||
self:SendMallReengagementPackageOrderReq(sId, callback)
|
||||
end
|
||||
function PlayerMallData:BuyMonthlyCard(sId, sStatistical)
|
||||
local tab = {}
|
||||
table.insert(tab, {
|
||||
@@ -127,6 +217,44 @@ function PlayerMallData:BuyMonthlyCard(sId, sStatistical)
|
||||
end
|
||||
self:SendMallMonthlyCardOrderReq(sId, callback)
|
||||
end
|
||||
function PlayerMallData:BuyWeeklyCard(sId, sStatistical)
|
||||
local tab = {}
|
||||
table.insert(tab, {
|
||||
"role_id",
|
||||
tostring(PlayerData.Base._nPlayerId)
|
||||
})
|
||||
NovaAPI.UserEventUpload("purchase_click", tab)
|
||||
local callback = function(mapData)
|
||||
self._mapOrderId[mapData.ExtraData] = {
|
||||
nOrderId = mapData.Id,
|
||||
StatisticalGroup = sStatistical,
|
||||
nType = AllEnum.RMBOrderType.Mall
|
||||
}
|
||||
EventManager.Hit(EventId.BlockInput, true)
|
||||
self._nOrderIdPaying = mapData.Id
|
||||
SDKManager:Pay(sId, mapData.NotifyUrl, mapData.ExtraData)
|
||||
end
|
||||
self:SendWeeklyCardOrderReq(sId, callback)
|
||||
end
|
||||
function PlayerMallData:BuyMallActivity(sId, sStatistical)
|
||||
local tab = {}
|
||||
table.insert(tab, {
|
||||
"role_id",
|
||||
tostring(PlayerData.Base._nPlayerId)
|
||||
})
|
||||
NovaAPI.UserEventUpload("purchase_click", tab)
|
||||
local callback = function(mapData)
|
||||
self._mapOrderId[mapData.ExtraData] = {
|
||||
nOrderId = mapData.Id,
|
||||
StatisticalGroup = sStatistical,
|
||||
nType = AllEnum.RMBOrderType.Mall
|
||||
}
|
||||
EventManager.Hit(EventId.BlockInput, true)
|
||||
self._nOrderIdPaying = mapData.Id
|
||||
SDKManager:Pay(sId, mapData.NotifyUrl, mapData.ExtraData)
|
||||
end
|
||||
self:SendMallActivityOrderReq(sId, callback)
|
||||
end
|
||||
function PlayerMallData:BuyBattlePass(nMode, nVersion, sId, sStatistical)
|
||||
local tab = {}
|
||||
table.insert(tab, {
|
||||
@@ -146,34 +274,6 @@ function PlayerMallData:BuyBattlePass(nMode, nVersion, sId, sStatistical)
|
||||
end
|
||||
self:SendBattlePassOrderReq(nMode, nVersion, callback)
|
||||
end
|
||||
function PlayerMallData:TestBuyBattlePass(nMode, nVersion)
|
||||
local callback = function(mapData)
|
||||
self:CollectEnqueue(mapData.Id, AllEnum.RMBOrderType.BattlePass)
|
||||
self:ProcessOrder()
|
||||
end
|
||||
self:SendBattlePassOrderReq(nMode, nVersion, callback)
|
||||
end
|
||||
function PlayerMallData:TestBuyGemSuc(sId)
|
||||
local callback = function(mapData)
|
||||
self:CollectEnqueue(mapData.Id, AllEnum.RMBOrderType.Mall)
|
||||
self:ProcessOrder()
|
||||
end
|
||||
self:SendMallGemOrderReq(sId, callback)
|
||||
end
|
||||
function PlayerMallData:TestBuyPackageSuc(sId)
|
||||
local callback = function(mapData)
|
||||
self:CollectEnqueue(mapData.Id, AllEnum.RMBOrderType.Mall)
|
||||
self:ProcessOrder()
|
||||
end
|
||||
self:SendMallPackageOrderReq(sId, callback)
|
||||
end
|
||||
function PlayerMallData:TestBuyMonthlyCardSuc(sId)
|
||||
local callback = function(mapData)
|
||||
self:CollectEnqueue(mapData.Id, AllEnum.RMBOrderType.Mall)
|
||||
self:ProcessOrder()
|
||||
end
|
||||
self:SendMallMonthlyCardOrderReq(sId, callback)
|
||||
end
|
||||
function PlayerMallData:ProcessExchangeShop()
|
||||
self._tbExchangeShop = {}
|
||||
local func_ForEach_ExchangeShop = function(mapData)
|
||||
@@ -373,6 +473,105 @@ function PlayerMallData:UpdateNextMallPackage()
|
||||
end
|
||||
end
|
||||
end
|
||||
function PlayerMallData:GetPackageToggle(nTag)
|
||||
if nTag == nil then
|
||||
return nil
|
||||
elseif nTag == GameEnum.MallItemType.Package then
|
||||
return AllEnum.MallToggle.Package
|
||||
elseif nTag == GameEnum.MallItemType.Skin then
|
||||
return AllEnum.MallToggle.Skin
|
||||
elseif nTag == GameEnum.MallItemType.Furniture then
|
||||
return AllEnum.MallToggle.Furniture
|
||||
end
|
||||
return nil
|
||||
end
|
||||
function PlayerMallData:ProcessMallActivityCfg()
|
||||
self._mapActivityCfgByActId = {}
|
||||
local func_ForEach_MallActivity = function(mapData)
|
||||
local nActId = mapData.ActivityId
|
||||
if nActId == nil or nActId == 0 then
|
||||
return
|
||||
end
|
||||
local mapCur = self._mapActivityCfgByActId[nActId]
|
||||
if mapCur == nil or tostring(mapData.Id) < tostring(mapCur.Id) then
|
||||
self._mapActivityCfgByActId[nActId] = mapData
|
||||
end
|
||||
end
|
||||
ForEachTableLine(DataTable.MallActivity, func_ForEach_MallActivity)
|
||||
end
|
||||
function PlayerMallData:GetMallActivityCfgByActId(nActId)
|
||||
return self._mapActivityCfgByActId[nActId]
|
||||
end
|
||||
function PlayerMallData:GetMallActivityProduct(sId)
|
||||
return self._mapActivityProduct[sId]
|
||||
end
|
||||
function PlayerMallData:CheckMallActivityPurchased(sId)
|
||||
local mapInfo = self._mapActivityProduct[sId]
|
||||
return mapInfo ~= nil and mapInfo.Purchased == true
|
||||
end
|
||||
function PlayerMallData:GetCurMallActivityCfg()
|
||||
local actData = PlayerData.Activity:GetMallActivityData()
|
||||
if actData == nil then
|
||||
return nil
|
||||
end
|
||||
return self:GetMallActivityCfgByActId(actData:GetActId())
|
||||
end
|
||||
function PlayerMallData:CheckMallActivityRedDot(actData)
|
||||
actData = actData or PlayerData.Activity:GetMallActivityData()
|
||||
return actData ~= nil and actData.CheckMallRedDot ~= nil and actData:CheckMallRedDot() == true
|
||||
end
|
||||
function PlayerMallData:UpdateMallActivityFuncRedDot(actData)
|
||||
RedDotManager.SetValid(RedDotDefine.Mall_Activity_RedDot, {
|
||||
AllEnum.MallToggle.Activity
|
||||
}, self:CheckMallActivityRedDot(actData))
|
||||
end
|
||||
function PlayerMallData:CheckMallActivityNewRead(sId)
|
||||
local sCheckNew = LocalData.GetPlayerLocalData("Mall_Activity_New") or ""
|
||||
local tbCheckNew = string.split(sCheckNew, ",")
|
||||
return table.indexof(tbCheckNew, tostring(sId)) ~= 0
|
||||
end
|
||||
function PlayerMallData:UpdateMallActivityRedDot()
|
||||
local actData = PlayerData.Activity:GetMallActivityData()
|
||||
self:UpdateMallActivityFuncRedDot(actData)
|
||||
local mapCfg = actData ~= nil and self:GetMallActivityCfgByActId(actData:GetActId()) or nil
|
||||
local sId = mapCfg ~= nil and tostring(mapCfg.Id) or nil
|
||||
if self._sActivityNewId ~= nil and self._sActivityNewId ~= sId then
|
||||
RedDotManager.SetValid(RedDotDefine.Mall_Activity_New, {
|
||||
AllEnum.MallToggle.Activity,
|
||||
self._sActivityNewId
|
||||
}, false)
|
||||
self._sActivityNewId = nil
|
||||
end
|
||||
if mapCfg == nil then
|
||||
EventManager.Hit("Mall_Refresh_Reddot")
|
||||
return
|
||||
end
|
||||
local bNew = mapCfg.IsNew == true and not self:CheckMallActivityNewRead(sId)
|
||||
RedDotManager.SetValid(RedDotDefine.Mall_Activity_New, {
|
||||
AllEnum.MallToggle.Activity,
|
||||
sId
|
||||
}, bNew)
|
||||
self._sActivityNewId = bNew and sId or nil
|
||||
EventManager.Hit("Mall_Refresh_Reddot")
|
||||
end
|
||||
function PlayerMallData:RemoveMallActivityNew()
|
||||
local mapCfg = self:GetCurMallActivityCfg()
|
||||
if mapCfg == nil then
|
||||
return
|
||||
end
|
||||
local sId = tostring(mapCfg.Id)
|
||||
RedDotManager.SetValid(RedDotDefine.Mall_Activity_New, {
|
||||
AllEnum.MallToggle.Activity,
|
||||
sId
|
||||
}, false)
|
||||
self._sActivityNewId = nil
|
||||
local sCheckNew = LocalData.GetPlayerLocalData("Mall_Activity_New") or ""
|
||||
local tbCheckNew = string.split(sCheckNew, ",")
|
||||
if table.indexof(tbCheckNew, sId) == 0 then
|
||||
LocalData.SetPlayerLocalData("Mall_Activity_New", sCheckNew .. "," .. sId)
|
||||
end
|
||||
EventManager.Hit("Mall_Refresh_Reddot")
|
||||
end
|
||||
function PlayerMallData:CacheDailyMallReward(bDailyReward)
|
||||
self.bDailyReward = bDailyReward
|
||||
RedDotManager.SetValid(RedDotDefine.Mall_Daily, nil, self.bDailyReward)
|
||||
@@ -798,6 +997,37 @@ function PlayerMallData:SendMallMonthlyCardOrderReq(sId, callback)
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.mall_monthlyCard_order_req, mapMsg, nil, successCallback)
|
||||
end
|
||||
function PlayerMallData:SendMallActivityListReq(callback)
|
||||
local successCallback = function(_, mapData)
|
||||
self._mapActivityProduct = {}
|
||||
for _, v in ipairs(mapData.List or {}) do
|
||||
self._mapActivityProduct[v.Id] = v
|
||||
end
|
||||
if callback ~= nil then
|
||||
callback(self._mapActivityProduct)
|
||||
end
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.mall_activity_list_req, {}, nil, successCallback)
|
||||
end
|
||||
function PlayerMallData:SendMallActivityOrderReq(sId, callback)
|
||||
if type(sId) == "number" then
|
||||
sId = tostring(sId)
|
||||
end
|
||||
local mapMsg = {Value = sId}
|
||||
local successCallback = function(_, mapData)
|
||||
printLog("创建订单:" .. mapData.Id)
|
||||
callback(mapData)
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.mall_activity_order_req, mapMsg, nil, successCallback)
|
||||
end
|
||||
function PlayerMallData:SendWeeklyCardOrderReq(sId, callback)
|
||||
local mapMsg = {Value = sId}
|
||||
local successCallback = function(_, mapData)
|
||||
printLog("创建订单:" .. mapData.Id)
|
||||
callback(mapData)
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.activity_returnee_card_order_req, mapMsg, nil, successCallback)
|
||||
end
|
||||
function PlayerMallData:CacheMallPackageList()
|
||||
local callback = function(_, _)
|
||||
end
|
||||
@@ -831,6 +1061,20 @@ function PlayerMallData:SendMallPackageOrderReq(sId, callback)
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.mall_package_order_req, mapMsg, nil, successCallback)
|
||||
end
|
||||
function PlayerMallData:SendMallReengagementPackageOrderReq(sId, callback)
|
||||
local mapMsg = {Value = sId}
|
||||
local successCallback = function(_, mapData)
|
||||
if mapData ~= nil then
|
||||
printLog("创建订单:" .. mapData.Id)
|
||||
callback(mapData)
|
||||
else
|
||||
UTILS.OpenReceiveByChangeInfo(mapData.Change)
|
||||
local bMoney = false
|
||||
EventManager.Hit("MallOrderClear", bMoney)
|
||||
end
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.activity_returnee_pack_order_req, mapMsg, nil, successCallback)
|
||||
end
|
||||
function PlayerMallData:SendMallShopListReq(callback)
|
||||
local successCallback = function(_, mapData)
|
||||
self:UpdateNextMallShop()
|
||||
@@ -888,23 +1132,19 @@ function PlayerMallData:UpdateMallRedDot(tbPackageList)
|
||||
end
|
||||
function PlayerMallData:ResetPackageNew()
|
||||
local foreachFunc = function(mapCfg)
|
||||
local groupCfg = ConfigTable.GetData("MallPackagePage", mapCfg.GroupId)
|
||||
local groupCfg = ConfigTable.GetData("MallPackagePage", mapCfg.GroupId, true)
|
||||
if groupCfg == nil then
|
||||
return
|
||||
end
|
||||
if mapCfg.Tag == GameEnum.MallItemType.Package then
|
||||
RedDotManager.SetValid(RedDotDefine.Mall_Package_New, {
|
||||
AllEnum.MallToggle.Package,
|
||||
groupCfg.Sort,
|
||||
mapCfg.Id
|
||||
}, false)
|
||||
elseif mapCfg.Tag == GameEnum.MallItemType.Skin then
|
||||
RedDotManager.SetValid(RedDotDefine.Mall_Package_New, {
|
||||
AllEnum.MallToggle.Skin,
|
||||
groupCfg.Sort,
|
||||
mapCfg.Id
|
||||
}, false)
|
||||
local nTog = self:GetPackageToggle(mapCfg.Tag)
|
||||
if nTog == nil then
|
||||
return
|
||||
end
|
||||
RedDotManager.SetValid(RedDotDefine.Mall_Package_New, {
|
||||
nTog,
|
||||
groupCfg.Sort,
|
||||
mapCfg.Id
|
||||
}, false)
|
||||
end
|
||||
ForEachTableLine(DataTable.MallPackage, foreachFunc)
|
||||
end
|
||||
@@ -922,52 +1162,26 @@ function PlayerMallData:ClearDelistedSkinTrialRedDot()
|
||||
end
|
||||
ForEachTableLine(DataTable.MallPackage, foreachFunc)
|
||||
end
|
||||
function PlayerMallData:RemovePackageNew(nPage, nTab)
|
||||
function PlayerMallData:RemovePackageNew(nPage, nSort)
|
||||
if nSort == 0 then
|
||||
return
|
||||
end
|
||||
if #self._tbPackage == 0 then
|
||||
return
|
||||
end
|
||||
local tbPackage = {}
|
||||
if nPage == GameEnum.MallItemType.Package then
|
||||
for _, v in pairs(self._tbPackage) do
|
||||
local mapCfg = ConfigTable.GetData("MallPackage", v.sId)
|
||||
local groupCfg = ConfigTable.GetData("MallPackagePage", mapCfg.GroupId)
|
||||
if mapCfg.Tag == GameEnum.MallItemType.Package and groupCfg.Sort == nTab then
|
||||
table.insert(tbPackage, v)
|
||||
end
|
||||
end
|
||||
elseif nPage == GameEnum.MallItemType.Skin then
|
||||
for _, v in pairs(self._tbPackage) do
|
||||
local mapCfg = ConfigTable.GetData("MallPackage", v.sId)
|
||||
local groupCfg = ConfigTable.GetData("MallPackagePage", mapCfg.GroupId)
|
||||
if mapCfg.Tag == GameEnum.MallItemType.Skin then
|
||||
if nTab == nil then
|
||||
table.insert(tbPackage, v)
|
||||
elseif groupCfg.Sort == nTab then
|
||||
table.insert(tbPackage, v)
|
||||
end
|
||||
end
|
||||
end
|
||||
local nTog = self:GetPackageToggle(nPage)
|
||||
if nTog == nil then
|
||||
return
|
||||
end
|
||||
for _, v in pairs(tbPackage) do
|
||||
for _, v in pairs(self._tbPackage) do
|
||||
local mapCfg = ConfigTable.GetData("MallPackage", v.sId)
|
||||
if nil ~= mapCfg then
|
||||
local groupCfg = ConfigTable.GetData("MallPackagePage", mapCfg.GroupId)
|
||||
if groupCfg == nil then
|
||||
return
|
||||
end
|
||||
if mapCfg.Tag == GameEnum.MallItemType.Package then
|
||||
RedDotManager.SetValid(RedDotDefine.Mall_Package_New, {
|
||||
AllEnum.MallToggle.Package,
|
||||
groupCfg.Sort,
|
||||
mapCfg.Id
|
||||
}, false)
|
||||
elseif mapCfg.Tag == GameEnum.MallItemType.Skin then
|
||||
RedDotManager.SetValid(RedDotDefine.Mall_Package_New, {
|
||||
AllEnum.MallToggle.Skin,
|
||||
groupCfg.Sort,
|
||||
mapCfg.Id
|
||||
}, false)
|
||||
end
|
||||
local groupCfg = mapCfg ~= nil and ConfigTable.GetData("MallPackagePage", mapCfg.GroupId)
|
||||
if groupCfg and mapCfg.Tag == nPage and groupCfg.Sort == nSort then
|
||||
RedDotManager.SetValid(RedDotDefine.Mall_Package_New, {
|
||||
nTog,
|
||||
groupCfg.Sort,
|
||||
mapCfg.Id
|
||||
}, false)
|
||||
local sCheckNew = LocalData.GetPlayerLocalData("Mall_Package_New") or ""
|
||||
local tbCheckNew = string.split(sCheckNew, ",")
|
||||
if table.indexof(tbCheckNew, mapCfg.Id) == 0 then
|
||||
@@ -991,32 +1205,14 @@ function PlayerMallData:UpdateMallPackageRedDot(tbPackageList)
|
||||
if groupCfg == nil then
|
||||
return
|
||||
end
|
||||
if 0 < mallData.nCurStock and bPurchaseAble and not bNotNew then
|
||||
if mapCfg.Tag == GameEnum.MallItemType.Package then
|
||||
RedDotManager.SetValid(RedDotDefine.Mall_Package_New, {
|
||||
AllEnum.MallToggle.Package,
|
||||
groupCfg.Sort,
|
||||
mallData.sId
|
||||
}, true)
|
||||
elseif mapCfg.Tag == GameEnum.MallItemType.Skin then
|
||||
RedDotManager.SetValid(RedDotDefine.Mall_Package_New, {
|
||||
AllEnum.MallToggle.Skin,
|
||||
groupCfg.Sort,
|
||||
mallData.sId
|
||||
}, true)
|
||||
end
|
||||
elseif mapCfg.Tag == GameEnum.MallItemType.Package then
|
||||
local nTog = self:GetPackageToggle(mapCfg.Tag)
|
||||
if nTog ~= nil then
|
||||
local bNew = 0 < mallData.nCurStock and bPurchaseAble and not bNotNew
|
||||
RedDotManager.SetValid(RedDotDefine.Mall_Package_New, {
|
||||
AllEnum.MallToggle.Package,
|
||||
nTog,
|
||||
groupCfg.Sort,
|
||||
mallData.sId
|
||||
}, false)
|
||||
elseif mapCfg.Tag == GameEnum.MallItemType.Skin then
|
||||
RedDotManager.SetValid(RedDotDefine.Mall_Package_New, {
|
||||
AllEnum.MallToggle.Skin,
|
||||
groupCfg.Sort,
|
||||
mallData.sId
|
||||
}, false)
|
||||
}, bNew)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -191,7 +191,7 @@ function PlayerPhoneData:NewChatTrigger(mapMsgData)
|
||||
}
|
||||
table.insert(self.tbNewChatList, tbData)
|
||||
elseif chatCfg.AutoPopUp then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.PhonePopUp, nChatId)
|
||||
PopUpManager.PopUpEnQueue(GameEnum.PopUpSeqType.NewChat, nChatId)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -346,7 +346,10 @@ function PlayerPhoneData:CheckNewChat(nAddressId, callback)
|
||||
local bPhoneOpen = PanelManager.CheckPanelOpen(PanelId.Phone)
|
||||
if chatCfg ~= nil then
|
||||
if chatCfg.AutoPopUp and not bPhoneOpen then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.PhonePopUp, tbData.nChatId, false, callback)
|
||||
PopUpManager.PopUpEnQueue(GameEnum.PopUpSeqType.NewChat, tbData.nChatId)
|
||||
if nil ~= callback then
|
||||
callback()
|
||||
end
|
||||
else
|
||||
self:RefreshRedDot()
|
||||
EventManager.Hit("NewChatTrigger", tbData.nAddressId, tbData.nChatId)
|
||||
|
||||
@@ -271,7 +271,9 @@ function PlayerPotentialPreselectionData:SendDeletePreselection(tbIds, callback)
|
||||
if 0 < table.indexof(tbIds, v.nPreselectionId) then
|
||||
local tmpDisc = v.tbTeamDiscId
|
||||
local tbTeamMemberId = v.tbTeamMemberId
|
||||
PlayerData.Team:UpdateFormationInfo(nIdx, tbTeamMemberId, tmpDisc, 0)
|
||||
PlayerData.Team:UpdateFormationInfo(nIdx, tbTeamMemberId, tmpDisc, 0, function()
|
||||
EventManager.Hit("UpdateFormationInfoSuc", nIdx)
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -20,7 +20,9 @@ local QuestType = {
|
||||
Demon = 11,
|
||||
TowerEvent = 12,
|
||||
Weekly = 13,
|
||||
Assist = 14
|
||||
Assist = 14,
|
||||
Dorm = 15,
|
||||
GuideMission = 16
|
||||
}
|
||||
local QuestRedDotType = {
|
||||
TourGuide = RedDotDefine.Task_Guide,
|
||||
@@ -45,7 +47,10 @@ function PlayerQuestData:Init()
|
||||
self.tbTeamFormation = {}
|
||||
self.tbTeamFormationGroup = {}
|
||||
self.tbTeamFormationAttr = {}
|
||||
self.tbGuideMissionQuestGroup = {}
|
||||
self.tbGuideMissionQuest = {}
|
||||
self:InitConfig()
|
||||
self:UpdateQuestRedDot("GuideMission")
|
||||
EventManager.Add(EventId.IsNewDay, self, self.HandleExpire)
|
||||
EventManager.Add(EventId.UpdateWorldClass, self, self.UpdateDailyQuestRedDot)
|
||||
EventManager.Add(EventId.UpdateWorldClass, self, self.UpdateWeeklyQuestRedDot)
|
||||
@@ -78,6 +83,20 @@ function PlayerQuestData:InitConfig()
|
||||
table.insert(self.tbTourGuide[mapData.Order], mapData)
|
||||
end
|
||||
ForEachTableLine(DataTable.TourGuideQuest, foreachTourQuest)
|
||||
local foreachGuideMissionQuestGroup = function(mapData)
|
||||
if self.tbGuideMissionQuestGroup[mapData.ChapterId] == nil then
|
||||
self.tbGuideMissionQuestGroup[mapData.ChapterId] = {}
|
||||
end
|
||||
table.insert(self.tbGuideMissionQuestGroup[mapData.ChapterId], mapData)
|
||||
end
|
||||
ForEachTableLine(ConfigTable.Get("GuideMissionQuestGroup"), foreachGuideMissionQuestGroup)
|
||||
local foreachGuideMissionQuest = function(mapData)
|
||||
if self.tbGuideMissionQuest[mapData.GroupId] == nil then
|
||||
self.tbGuideMissionQuest[mapData.GroupId] = {}
|
||||
end
|
||||
table.insert(self.tbGuideMissionQuest[mapData.GroupId], mapData)
|
||||
end
|
||||
ForEachTableLine(ConfigTable.Get("GuideMissionQuest"), foreachGuideMissionQuest)
|
||||
local foreachDemonQuest = function(line)
|
||||
if nil == CacheTable.GetData("_DemonQuest", line.AdvanceGroup) then
|
||||
CacheTable.SetData("_DemonQuest", line.AdvanceGroup, {})
|
||||
@@ -1198,6 +1217,7 @@ function PlayerQuestData:HandleExpire()
|
||||
self:UpdateBattlePassRedDot()
|
||||
self:UpdateVampireQuestRedDot()
|
||||
self:UpdateTeamFormationRedDot()
|
||||
self:UpdateDormQuestRedDot()
|
||||
end
|
||||
function PlayerQuestData:IsQuestHasReceived(nType, nQuestId)
|
||||
if self._mapQuest[nType] == nil then
|
||||
@@ -1262,6 +1282,10 @@ function PlayerQuestData:UpdateQuestRedDot(questType)
|
||||
self:UpdateWeeklyQuestRedDot()
|
||||
elseif questType == "Assist" then
|
||||
self:UpdateTeamFormationRedDot()
|
||||
elseif questType == "GuideMission" then
|
||||
self:UpdateGuideMissionQuestRedDot()
|
||||
elseif questType == "Dorm" then
|
||||
self:UpdateDormQuestRedDot()
|
||||
end
|
||||
end
|
||||
function PlayerQuestData:UpdateDailyQuestRedDot()
|
||||
@@ -1354,6 +1378,41 @@ function PlayerQuestData:UpdateTeamFormationRedDot()
|
||||
local bTeamSelected = nSelectedTeam ~= nil
|
||||
RedDotManager.SetValid(RedDotDefine.TaskNewbie_TeamFormation, nil, bCanReceive or bChapterCanReceive or not bTeamSelected)
|
||||
end
|
||||
function PlayerQuestData:UpdateGuideMissionQuestRedDot()
|
||||
local tbGroupCanReceive = {}
|
||||
local questList = self._mapQuest[QuestType.GuideMission]
|
||||
if nil ~= questList then
|
||||
for _, v in pairs(questList) do
|
||||
local questCfg = ConfigTable.GetData("GuideMissionQuest", v.nTid)
|
||||
local groupCfg = questCfg ~= nil and ConfigTable.GetData("GuideMissionQuestGroup", questCfg.GroupId) or nil
|
||||
if nil ~= groupCfg then
|
||||
local nChapterId = groupCfg.ChapterId
|
||||
local nGroupId = groupCfg.Id
|
||||
if tbGroupCanReceive[nChapterId] == nil then
|
||||
tbGroupCanReceive[nChapterId] = {}
|
||||
end
|
||||
tbGroupCanReceive[nChapterId][nGroupId] = tbGroupCanReceive[nChapterId][nGroupId] or v.nStatus == 1
|
||||
end
|
||||
end
|
||||
end
|
||||
local tbChapterList = PlayerData.GuideMission ~= nil and PlayerData.GuideMission:GetChapterList() or nil
|
||||
if nil == tbChapterList then
|
||||
return
|
||||
end
|
||||
for _, mapChapter in ipairs(tbChapterList) do
|
||||
local tbChapterGroupList = PlayerData.Quest:GetGuideMissionQuestGroupByChapter(mapChapter.Id)
|
||||
if nil ~= tbChapterGroupList then
|
||||
for _, mapGroup in ipairs(tbChapterGroupList) do
|
||||
local bCanReceive = tbGroupCanReceive[mapChapter.Id] ~= nil and tbGroupCanReceive[mapChapter.Id][mapGroup.Id] or false
|
||||
local bUnlock = PlayerData.GuideMission:IsGroupUnlock(mapChapter.Id, mapGroup.Id)
|
||||
RedDotManager.SetValid(RedDotDefine.GuideMission_Group, {
|
||||
mapChapter.Id,
|
||||
mapGroup.Id
|
||||
}, bCanReceive and bUnlock)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function PlayerQuestData:UpdateTourGuideQuestRedDot()
|
||||
local bCanReceive = false
|
||||
local bAllReceive = true
|
||||
@@ -1582,4 +1641,165 @@ function PlayerQuestData:ClearVampireSeasonQuest(nCurSeason)
|
||||
end
|
||||
end
|
||||
end
|
||||
function PlayerQuestData:GetDormQuestData()
|
||||
return self._mapQuest[QuestType.Dorm] ~= nil and self._mapQuest[QuestType.Dorm] or {}
|
||||
end
|
||||
function PlayerQuestData:ReceiveDormQuest(nType, nId, callback)
|
||||
local tbQuestId = {}
|
||||
if nId == 0 then
|
||||
if self._mapQuest[QuestType.Dorm] ~= nil then
|
||||
for _, v in pairs(self._mapQuest[QuestType.Dorm]) do
|
||||
if v.nStatus == 1 then
|
||||
table.insert(tbQuestId, v.nTid)
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif nType == 0 then
|
||||
table.insert(tbQuestId, nId)
|
||||
end
|
||||
local NetCallback = function(_, msgData)
|
||||
for _, v in pairs(self._mapQuest[QuestType.Dorm]) do
|
||||
if table.indexof(tbQuestId, v.nTid) > 0 then
|
||||
v.nStatus = 2
|
||||
end
|
||||
end
|
||||
UTILS.OpenReceiveByChangeInfo(msgData.change_info, callback)
|
||||
EventManager.Hit(EventId.QuestDataRefresh, "Dorm")
|
||||
PlayerData.PlayerDormData:RefreshRedDotQuest()
|
||||
end
|
||||
local msg = {Value = 0, Version = 0}
|
||||
if nId ~= 0 then
|
||||
msg.Value = nId
|
||||
msg.Version = nType
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.quest_dorm_reward_receive_req, msg, nil, NetCallback)
|
||||
end
|
||||
function PlayerQuestData:GetDormQuestDataById(nId)
|
||||
if self._mapQuest[QuestType.Dorm] == nil then
|
||||
return nil
|
||||
end
|
||||
return self._mapQuest[QuestType.Dorm][nId]
|
||||
end
|
||||
function PlayerQuestData:UpdateDormQuestRedDot()
|
||||
local bHasQuest = false
|
||||
if self._mapQuest ~= nil and self._mapQuest[QuestType.Dorm] ~= nil then
|
||||
for _, v in pairs(self._mapQuest[QuestType.Dorm]) do
|
||||
if v.nStatus == 1 then
|
||||
bHasQuest = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
RedDotManager.SetValid(RedDotDefine.DormQuest, nil, bHasQuest)
|
||||
end
|
||||
function PlayerQuestData:GetGuideMissionQuestGroupByChapter(nChapterId)
|
||||
return self.tbGuideMissionQuestGroup[nChapterId]
|
||||
end
|
||||
function PlayerQuestData:GetGuideMissionQuestListByGroup(nGroupId)
|
||||
return self.tbGuideMissionQuest[nGroupId]
|
||||
end
|
||||
function PlayerQuestData:GetGuideMissionQuestData()
|
||||
return self._mapQuest[QuestType.GuideMission] ~= nil and self._mapQuest[QuestType.GuideMission] or {}
|
||||
end
|
||||
function PlayerQuestData:GetGuideMissionQuestDataById(nId)
|
||||
if self._mapQuest[QuestType.GuideMission] == nil then
|
||||
return nil
|
||||
end
|
||||
return self._mapQuest[QuestType.GuideMission][nId]
|
||||
end
|
||||
function PlayerQuestData:FillGuideMissionQuestDefault(nGroupId, bDone)
|
||||
local tbQuestCfgList = self.tbGuideMissionQuest[nGroupId]
|
||||
if tbQuestCfgList == nil then
|
||||
return
|
||||
end
|
||||
if self._mapQuest[QuestType.GuideMission] == nil then
|
||||
self._mapQuest[QuestType.GuideMission] = {}
|
||||
end
|
||||
local tbQuest = self._mapQuest[QuestType.GuideMission]
|
||||
for _, mapQuestCfg in ipairs(tbQuestCfgList) do
|
||||
if bDone then
|
||||
tbQuest[mapQuestCfg.Id] = {
|
||||
nTid = mapQuestCfg.Id,
|
||||
nGoal = mapQuestCfg.ClientCompleteCount or 0,
|
||||
nCurProgress = mapQuestCfg.ClientCompleteCount or 0,
|
||||
nStatus = 2,
|
||||
nExpire = 0
|
||||
}
|
||||
elseif tbQuest[mapQuestCfg.Id] == nil then
|
||||
tbQuest[mapQuestCfg.Id] = {
|
||||
nTid = mapQuestCfg.Id,
|
||||
nGoal = mapQuestCfg.ClientCompleteCount or 0,
|
||||
nCurProgress = 0,
|
||||
nStatus = 0,
|
||||
nExpire = 0
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
function PlayerQuestData:RequestGuideMissionInfo(callback)
|
||||
local processCb = function(_, mapDataCb)
|
||||
local tbDoneChapter = {}
|
||||
if mapDataCb.Chapters ~= nil then
|
||||
for _, mapChapterData in pairs(mapDataCb.Chapters) do
|
||||
PlayerData.GuideMission:CacheServerUnlockTime(mapChapterData.Id, mapChapterData.UnlockTime)
|
||||
if mapChapterData.Quests ~= nil and mapChapterData.Quests.List ~= nil then
|
||||
for _, mapQuestData in pairs(mapChapterData.Quests.List) do
|
||||
self:OnQuestProgressChanged(mapQuestData)
|
||||
end
|
||||
end
|
||||
if mapChapterData.Done then
|
||||
tbDoneChapter[mapChapterData.Id] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
for nGroupId, _ in pairs(self.tbGuideMissionQuest) do
|
||||
self:FillGuideMissionQuestDefault(nGroupId, false)
|
||||
end
|
||||
for nChapterId, _ in pairs(tbDoneChapter) do
|
||||
local tbChapterGroupList = self.tbGuideMissionQuestGroup[nChapterId]
|
||||
if tbChapterGroupList ~= nil then
|
||||
for _, mapGroupCfg in ipairs(tbChapterGroupList) do
|
||||
self:FillGuideMissionQuestDefault(mapGroupCfg.Id, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
self:UpdateQuestRedDot("GuideMission")
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.guide_mission_info_req, {}, nil, processCb)
|
||||
end
|
||||
function PlayerQuestData:ReceiveGuideMissionQuestReward(nTid, bGroup, callback)
|
||||
local msg = {
|
||||
QuestId = nTid,
|
||||
Group = bGroup or false
|
||||
}
|
||||
local Callback = function(_, mapMsgData)
|
||||
local tbQuest = self._mapQuest[QuestType.GuideMission]
|
||||
if tbQuest ~= nil then
|
||||
if bGroup then
|
||||
local questCfg = ConfigTable.GetData("GuideMissionQuest", nTid)
|
||||
local tbGroupQuestList = questCfg ~= nil and self.tbGuideMissionQuest[questCfg.GroupId] or nil
|
||||
if tbGroupQuestList ~= nil then
|
||||
for _, mapQuestCfg in ipairs(tbGroupQuestList) do
|
||||
if tbQuest[mapQuestCfg.Id] ~= nil and tbQuest[mapQuestCfg.Id].nStatus == 1 then
|
||||
tbQuest[mapQuestCfg.Id].nStatus = 2
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif tbQuest[nTid] ~= nil then
|
||||
tbQuest[nTid].nStatus = 2
|
||||
end
|
||||
end
|
||||
local mapDecodedChangeInfo = UTILS.DecodeChangeInfo(mapMsgData)
|
||||
HttpNetHandler.ProcChangeInfo(mapDecodedChangeInfo)
|
||||
UTILS.OpenReceiveByChangeInfo(mapMsgData)
|
||||
self:UpdateQuestRedDot("GuideMission")
|
||||
if callback ~= nil and type(callback) == "function" then
|
||||
callback(mapMsgData)
|
||||
end
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.guide_mission_quest_reward_receive_req, msg, nil, Callback)
|
||||
end
|
||||
return PlayerQuestData
|
||||
|
||||
@@ -0,0 +1,588 @@
|
||||
local PlayerReengagementData = class("PlayerReengagementData")
|
||||
local REENGAGEMENT_RETURN_AVG_ID = "STev_02_01"
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local RedDotManager = require("GameCore.RedDot.RedDotManager")
|
||||
local SDKManager = CS.SDKManager.Instance
|
||||
function PlayerReengagementData:Init()
|
||||
self:InitData()
|
||||
end
|
||||
function PlayerReengagementData:InitData()
|
||||
self._nActId = 0
|
||||
self._nOpenTime = 0
|
||||
self._nDoubleCount = 0
|
||||
self._nMaxDoubleCount = 0
|
||||
self._bDetailInited = false
|
||||
self._bReunionReceived = false
|
||||
self._mapLoginInfo = {}
|
||||
self._bAvgWatched = false
|
||||
self._mapQuestStateList = {}
|
||||
self._mapQuestPoint = {}
|
||||
self._mapMallInfo = {}
|
||||
self._tbBoughtBundles = {}
|
||||
self._mapWeeklyCard = {}
|
||||
self._mapQuestDataList = {}
|
||||
self._tbQuestConfig = {}
|
||||
end
|
||||
function PlayerReengagementData:CacheReturneeInfo(mapData)
|
||||
if mapData == nil then
|
||||
return
|
||||
end
|
||||
if mapData.Id == nil or mapData.Id == 0 then
|
||||
self:RefreshRedDot(true)
|
||||
self:InitData()
|
||||
return
|
||||
end
|
||||
if self._nActId ~= mapData.Id or self._nOpenTime ~= (mapData.OpenTime or 0) then
|
||||
self:RefreshRedDot(true)
|
||||
self:InitData()
|
||||
end
|
||||
self._nActId = mapData.Id or 0
|
||||
self._nOpenTime = mapData.OpenTime or 0
|
||||
self._bReunionReceived = mapData.ReunionReward == true
|
||||
self._bAvgWatched = mapData.Avg == true
|
||||
local mapActData = ConfigTable.GetData("ActivityReturnee", self._nActId)
|
||||
if mapActData ~= nil then
|
||||
self._nMaxDoubleCount = mapActData.DoubleCount or 0
|
||||
end
|
||||
self._nDoubleCount = math.max(self._nMaxDoubleCount - (mapData.DoubleCount or 0), 0)
|
||||
self:TryEnqueueReturnAvg()
|
||||
self:RefreshReengagementPopUp()
|
||||
local fet = function(mapDataTb)
|
||||
if self._tbQuestConfig[mapDataTb.Id] == nil then
|
||||
self._tbQuestConfig[mapDataTb.Id] = mapDataTb
|
||||
end
|
||||
if self._mapQuestDataList[mapDataTb.GroupId] == nil then
|
||||
self._mapQuestDataList[mapDataTb.GroupId] = {}
|
||||
end
|
||||
self._mapQuestDataList[mapDataTb.GroupId][mapDataTb.Id] = {
|
||||
nId = mapDataTb.Id,
|
||||
nStatus = 0,
|
||||
Progress = {
|
||||
Cur = 0,
|
||||
Max = self:GetQuestMaxProgress(mapDataTb.Id)
|
||||
}
|
||||
}
|
||||
end
|
||||
ForEachTableLine(ConfigTable.Get("ActivityReturneeQuest"), fet)
|
||||
self:RefreshRedDot()
|
||||
if self:GetActIsOpen() then
|
||||
self:RequestReengagementInfo()
|
||||
end
|
||||
self._mapQuestPointConfig = {}
|
||||
local ForeachActivity = function(mapQuestData)
|
||||
if mapQuestData.ReturneeId == self._nActId then
|
||||
table.insert(self._mapQuestPointConfig, mapQuestData)
|
||||
end
|
||||
end
|
||||
ForEachTableLine(ConfigTable.Get("ActivityReturneeQuestPoint"), ForeachActivity)
|
||||
table.sort(self._mapQuestPointConfig, function(a, b)
|
||||
return a.Point < b.Point
|
||||
end)
|
||||
end
|
||||
function PlayerReengagementData:RefreshRedDot(bClear)
|
||||
if self._nActId == 0 then
|
||||
return
|
||||
end
|
||||
local bActIsOpen = not bClear and self:GetActIsOpen()
|
||||
local nCurDay = 0
|
||||
if bActIsOpen then
|
||||
local nOpenDayStartTime = CS.ClientManager.Instance:GetNextRefreshTime(self._nOpenTime) - 86400
|
||||
nCurDay = math.floor((CS.ClientManager.Instance.serverTimeStamp - nOpenDayStartTime) / 86400)
|
||||
end
|
||||
for nGroupId, mapQuestList in pairs(self._mapQuestDataList) do
|
||||
local bCanReceive = false
|
||||
local mapGroupConfig = ConfigTable.GetData("ActivityReturneeQuestGroup", nGroupId)
|
||||
if bActIsOpen and mapGroupConfig ~= nil and mapGroupConfig.ReturneeId == self._nActId and nCurDay >= mapGroupConfig.DayOpen then
|
||||
for _, mapQuest in pairs(mapQuestList) do
|
||||
if mapQuest.nStatus == 1 then
|
||||
bCanReceive = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
RedDotManager.SetValid(RedDotDefine.Activity_Reengagement_Task_Group, {
|
||||
self._nActId,
|
||||
nGroupId
|
||||
}, bCanReceive)
|
||||
end
|
||||
local bQuestPointReward = false
|
||||
if bActIsOpen then
|
||||
local nPoint = tonumber(self._mapQuestPoint.Point) or 0
|
||||
local CheckQuestPointReward = function(mapConfig)
|
||||
if mapConfig.ReturneeId == self._nActId and nPoint >= mapConfig.Point and not self:CheckPointRewardReceived(mapConfig.Index) then
|
||||
bQuestPointReward = true
|
||||
end
|
||||
end
|
||||
ForEachTableLine(ConfigTable.Get("ActivityReturneeQuestPoint"), CheckQuestPointReward)
|
||||
end
|
||||
RedDotManager.SetValid(RedDotDefine.Activity_Reengagement_QuestPoint, self._nActId, bQuestPointReward)
|
||||
local mapLoginInfo = self._mapLoginInfo or {}
|
||||
local bLoginReward = bActIsOpen and (tonumber(mapLoginInfo.Receive) or 0) > (tonumber(mapLoginInfo.Actual) or 0)
|
||||
RedDotManager.SetValid(RedDotDefine.Activity_Reengagement_LoginReward, self._nActId, bLoginReward)
|
||||
local mapWeeklyCard = self._mapWeeklyCard or {}
|
||||
local bWeeklyCard = bActIsOpen and mapWeeklyCard.Id ~= nil and mapWeeklyCard.Id ~= "" and 0 < (tonumber(mapWeeklyCard.Remaining) or 0) and not mapWeeklyCard.Received
|
||||
RedDotManager.SetValid(RedDotDefine.Activity_Reengagement_WeeklyCard, self._nActId, bWeeklyCard)
|
||||
end
|
||||
function PlayerReengagementData:OnStateNotify()
|
||||
if self:GetActIsOpen() then
|
||||
self:RequestReengagementInfo()
|
||||
else
|
||||
self:RefreshRedDot()
|
||||
end
|
||||
end
|
||||
function PlayerReengagementData:RefreshReengagementPopUp()
|
||||
if not self:GetActIsOpen() then
|
||||
return
|
||||
end
|
||||
if not self:CheckCanReceive() then
|
||||
return
|
||||
end
|
||||
if ConfigTable.GetData("ActivityReturneeLoginRewardControl", self._nActId) == nil then
|
||||
return
|
||||
end
|
||||
PopUpManager.PopUpEnQueue(GameEnum.PopUpSeqType.Reengagement, {
|
||||
nActId = self._nActId
|
||||
})
|
||||
end
|
||||
function PlayerReengagementData:RequestReengagementInfo(callback)
|
||||
local nActId = self._nActId
|
||||
local nOpenTime = self._nOpenTime
|
||||
local processCb = function(_, mapDataCb)
|
||||
if self._nActId ~= nActId or self._nOpenTime ~= nOpenTime then
|
||||
return
|
||||
end
|
||||
self._bReunionReceived = mapDataCb.Reunion.ReunionReward == true
|
||||
self._bAvgWatched = mapDataCb.Avg.Avg == true
|
||||
self._mapLoginInfo = mapDataCb.Login
|
||||
self._mapQuestPoint = {}
|
||||
local tbReceived = UTILS.ParseByteString(mapDataCb.QuestPoint.Received)
|
||||
self._mapQuestPoint.Received = tbReceived or {}
|
||||
self._mapQuestPoint.Point = tonumber(mapDataCb.QuestPoint.Point) or 0
|
||||
self._mapQuestStateList = {}
|
||||
for _, mapQuestList in pairs(self._mapQuestDataList) do
|
||||
for _, mapQuest in pairs(mapQuestList) do
|
||||
mapQuest.nStatus = 0
|
||||
mapQuest.Progress = {
|
||||
Cur = 0,
|
||||
Max = self:GetQuestMaxProgress(mapQuest.nId)
|
||||
}
|
||||
end
|
||||
end
|
||||
if mapDataCb.Quests ~= nil and mapDataCb.Quests.List ~= nil then
|
||||
for k, mapQuestData in pairs(mapDataCb.Quests.List) do
|
||||
local questConfig = ConfigTable.GetData("ActivityReturneeQuest", mapQuestData.Id)
|
||||
if questConfig ~= nil then
|
||||
local mapProgress = mapQuestData.Progress and mapQuestData.Progress[1]
|
||||
if mapProgress == nil then
|
||||
mapProgress = {
|
||||
Cur = 0,
|
||||
Max = self:GetQuestMaxProgress(mapQuestData.Id)
|
||||
}
|
||||
end
|
||||
local dataToInsert = {
|
||||
nId = mapQuestData.Id,
|
||||
nStatus = mapQuestData.Status,
|
||||
Progress = mapProgress
|
||||
}
|
||||
self._mapQuestStateList[mapQuestData.Id] = dataToInsert
|
||||
self._mapQuestDataList[questConfig.GroupId] = self._mapQuestDataList[questConfig.GroupId] or {}
|
||||
self._mapQuestDataList[questConfig.GroupId][mapQuestData.Id] = dataToInsert
|
||||
end
|
||||
end
|
||||
else
|
||||
self._mapQuestStateList = {}
|
||||
end
|
||||
self._mapWeeklyCard = {}
|
||||
self._mapMallInfo = mapDataCb.MallInfo
|
||||
if self._mapMallInfo ~= nil then
|
||||
self._tbBoughtBundles = self._mapMallInfo.Ids
|
||||
self._mapWeeklyCard = self._mapMallInfo.Card
|
||||
end
|
||||
self._bDetailInited = true
|
||||
self:RefreshRedDot()
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.activity_returnee_info_req, {}, nil, processCb)
|
||||
end
|
||||
function PlayerReengagementData:GetAvgWatched()
|
||||
return self._bAvgWatched
|
||||
end
|
||||
function PlayerReengagementData:SetAvgWatched()
|
||||
local cb = function()
|
||||
self._bAvgWatched = true
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.activity_returnee_avg_req, {}, nil, cb)
|
||||
end
|
||||
function PlayerReengagementData:TryEnqueueReturnAvg()
|
||||
if self:GetAvgWatched() or not self:GetActIsOpen() then
|
||||
return
|
||||
end
|
||||
PopUpManager.PopUpEnQueue(GameEnum.PopUpSeqType.ReengagementAvg, true)
|
||||
end
|
||||
function PlayerReengagementData:PlayReturnAvg(callback)
|
||||
if self:GetAvgWatched() or not self:GetActIsOpen() then
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
return
|
||||
end
|
||||
local mapActData = ConfigTable.GetData("ActivityReturnee", self:GetActId())
|
||||
local sAvgId
|
||||
if mapActData ~= nil and mapActData.AVG ~= nil then
|
||||
sAvgId = mapActData.AVG
|
||||
else
|
||||
sAvgId = REENGAGEMENT_RETURN_AVG_ID
|
||||
end
|
||||
if type(sAvgId) ~= "string" or sAvgId == "" or sAvgId == "0" then
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
return
|
||||
end
|
||||
local bCallbackDone = false
|
||||
local func_Cancel
|
||||
local func_Continue = function()
|
||||
EventManager.Remove("ForceCloseAllBeforeBackLogin", self, func_Cancel)
|
||||
PlayerData.Voice:ResumeBoardFreeTimer()
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
local function func_LoadingClosed()
|
||||
EventManager.Remove(EventId.TransAnimOutClear, self, func_LoadingClosed)
|
||||
func_Continue()
|
||||
end
|
||||
local function func_AvgEnd()
|
||||
if bCallbackDone then
|
||||
return
|
||||
end
|
||||
bCallbackDone = true
|
||||
self:SetAvgWatched()
|
||||
EventManager.Remove("AvgSTEnd", self, func_AvgEnd)
|
||||
local sAvgIdHead = string.sub(sAvgId, 1, 2)
|
||||
if sAvgIdHead == "ST" or sAvgIdHead == "CG" then
|
||||
EventManager.Add(EventId.TransAnimOutClear, self, func_LoadingClosed)
|
||||
else
|
||||
func_Continue()
|
||||
end
|
||||
end
|
||||
function func_Cancel()
|
||||
bCallbackDone = true
|
||||
EventManager.Remove("AvgSTEnd", self, func_AvgEnd)
|
||||
EventManager.Remove(EventId.TransAnimOutClear, self, func_LoadingClosed)
|
||||
EventManager.Remove("ForceCloseAllBeforeBackLogin", self, func_Cancel)
|
||||
PlayerData.Voice:ClearTimer()
|
||||
PlayerData.Voice:ResumeBoardFreeTimer()
|
||||
end
|
||||
PlayerData.Voice:PauseBoardFreeTimer()
|
||||
EventManager.Add("ForceCloseAllBeforeBackLogin", self, func_Cancel)
|
||||
EventManager.Add("AvgSTEnd", self, func_AvgEnd)
|
||||
EventManager.Hit("StoryDialog_DialogStart", sAvgId, Settings.sCurrentTxtLanguage, Settings.sCurrentVoLanguage)
|
||||
end
|
||||
function PlayerReengagementData:CheckCanReceive()
|
||||
return not self._bReunionReceived
|
||||
end
|
||||
function PlayerReengagementData:CheckPointRewardReceived(nPointIndex)
|
||||
local tbReceived = self._mapQuestPoint.Received or {}
|
||||
for _, mapConfig in ipairs(self._mapQuestPointConfig or {}) do
|
||||
if nPointIndex <= mapConfig.Index and UTILS.IsBitSet(tbReceived, mapConfig.Index + 1) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
function PlayerReengagementData:IsQuestGroupAllReceived(nGroupIndex)
|
||||
local nGroupId = nGroupIndex + 100
|
||||
local nGroupQuestCount = 0
|
||||
for k, v in pairs(self._tbQuestConfig) do
|
||||
if v.GroupId == nGroupId then
|
||||
nGroupQuestCount = nGroupQuestCount + 1
|
||||
end
|
||||
end
|
||||
local nActual = 0
|
||||
local tbThisGroupQuestList = self:GetQuestListByGroup(nGroupId)
|
||||
if tbThisGroupQuestList == nil then
|
||||
return false
|
||||
end
|
||||
for _, v in pairs(tbThisGroupQuestList) do
|
||||
if v.nStatus == 2 then
|
||||
nActual = nActual + 1
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
if nGroupQuestCount > nActual then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
function PlayerReengagementData:GetQuestListByGroup(nGroupId)
|
||||
if self._mapQuestDataList == nil or next(self._mapQuestDataList) == nil then
|
||||
self:RequestReengagementInfo(function()
|
||||
return self._mapQuestDataList[nGroupId]
|
||||
end)
|
||||
else
|
||||
return self._mapQuestDataList[nGroupId]
|
||||
end
|
||||
end
|
||||
function PlayerReengagementData:GetQuestConfigDataByGroup(nGroupId)
|
||||
local tbThisGroup = {}
|
||||
for k, v in pairs(self._tbQuestConfig) do
|
||||
if v.GroupId == nGroupId then
|
||||
table.insert(tbThisGroup, v)
|
||||
end
|
||||
end
|
||||
return tbThisGroup
|
||||
end
|
||||
function PlayerReengagementData:GetQuestDataById(nQuestId)
|
||||
local func = function()
|
||||
local ret = self._mapQuestStateList[nQuestId]
|
||||
if ret == nil then
|
||||
self._mapQuestStateList[nQuestId] = {
|
||||
nId = nQuestId,
|
||||
nStatus = 0,
|
||||
Progress = {
|
||||
Cur = 0,
|
||||
Max = self:GetQuestMaxProgress(nQuestId)
|
||||
}
|
||||
}
|
||||
end
|
||||
return self._mapQuestStateList[nQuestId]
|
||||
end
|
||||
if not self._bDetailInited then
|
||||
self:RequestReengagementInfo(function()
|
||||
return func()
|
||||
end)
|
||||
else
|
||||
return func()
|
||||
end
|
||||
end
|
||||
function PlayerReengagementData:GetQuestConfigDataById(nQuestId)
|
||||
return self._tbQuestConfig[nQuestId]
|
||||
end
|
||||
function PlayerReengagementData:GetQuestMaxProgress(nQuestId)
|
||||
local mapQuestConfig = self:GetQuestConfigDataById(nQuestId)
|
||||
if mapQuestConfig == nil then
|
||||
return 1
|
||||
end
|
||||
local tbParams = decodeJson(mapQuestConfig.CompleteParams)
|
||||
local nParamIndex = mapQuestConfig.CompleteCond == GameEnum.questCompleteCond.ItemsDeplete and 2 or 1
|
||||
return tonumber(tbParams[nParamIndex]) or 1
|
||||
end
|
||||
function PlayerReengagementData:GetActCfgData()
|
||||
return {}
|
||||
end
|
||||
function PlayerReengagementData:GetWeeklyCardData()
|
||||
if not self._bDetailInited then
|
||||
self:RequestReengagementInfo(function()
|
||||
return self._mapWeeklyCard
|
||||
end)
|
||||
else
|
||||
return self._mapWeeklyCard
|
||||
end
|
||||
end
|
||||
function PlayerReengagementData:GetActLoginRewardList()
|
||||
if not self._bDetailInited then
|
||||
self:RequestReengagementInfo(function()
|
||||
return self._mapLoginInfo
|
||||
end)
|
||||
else
|
||||
return self._mapLoginInfo
|
||||
end
|
||||
end
|
||||
function PlayerReengagementData:GetQuestPointInfo()
|
||||
if not self._bDetailInited then
|
||||
self:RequestReengagementInfo(function()
|
||||
return self._mapQuestPoint
|
||||
end)
|
||||
else
|
||||
return self._mapQuestPoint
|
||||
end
|
||||
end
|
||||
function PlayerReengagementData:GetDoubleDropCount()
|
||||
return self._nDoubleCount
|
||||
end
|
||||
function PlayerReengagementData:GetMaxDoubleDropCount()
|
||||
return self._nMaxDoubleCount
|
||||
end
|
||||
function PlayerReengagementData:GetDoubleFuncType()
|
||||
return {
|
||||
GameEnum.instanceType.DailyInstance,
|
||||
GameEnum.instanceType.RegionBoss,
|
||||
GameEnum.instanceType.SkillInstance,
|
||||
GameEnum.instanceType.CharGemInstance
|
||||
}
|
||||
end
|
||||
function PlayerReengagementData:GetActId()
|
||||
return self._nActId
|
||||
end
|
||||
function PlayerReengagementData:GetActIsOpen()
|
||||
local nCurTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
if self._nOpenTime == 0 or self._nActId == 0 or nCurTime >= self:GetReengagementCloseTime() then
|
||||
return false
|
||||
end
|
||||
return CS.ClientManager.Instance.serverTimeStamp >= self._nOpenTime
|
||||
end
|
||||
function PlayerReengagementData:GetReengagementOpenTime()
|
||||
return self._nOpenTime
|
||||
end
|
||||
function PlayerReengagementData:SetOpenTime(nOpenTime)
|
||||
if nOpenTime == nil then
|
||||
return
|
||||
end
|
||||
self._nOpenTime = nOpenTime
|
||||
self:RefreshRedDot()
|
||||
end
|
||||
function PlayerReengagementData:GetReengagementRemainTime()
|
||||
return self:GetReengagementCloseTime() - CS.ClientManager.Instance.serverTimeStamp
|
||||
end
|
||||
function PlayerReengagementData:GetReengagementCloseTime()
|
||||
local nTime = self._nOpenTime + (ConfigTable.GetConfigNumber("ActivityReturneeDuration") or 0) * 24 * 60 * 60
|
||||
return CS.ClientManager.Instance:GetNextRefreshTime(nTime) - 86400
|
||||
end
|
||||
function PlayerReengagementData:GetLimitedTrialBuildList()
|
||||
if self:GetActIsOpen() == false then
|
||||
return {}
|
||||
end
|
||||
local nWorldLevel = PlayerData.Base:GetWorldClass()
|
||||
local mapTrialBuildData
|
||||
local foreachMapData = function(mapData)
|
||||
if nWorldLevel >= mapData.LevelMin and (mapData.LevelMax == -1 or nWorldLevel <= mapData.LevelMax) then
|
||||
mapTrialBuildData = mapData
|
||||
end
|
||||
end
|
||||
ForEachTableLine(ConfigTable.Get("ActivityReturneeTrialBuildGroup"), foreachMapData)
|
||||
if mapTrialBuildData == nil then
|
||||
return {}
|
||||
end
|
||||
local tbTrialBuildIds = {}
|
||||
local foreachMapData1 = function(mapData)
|
||||
if mapData ~= nil and mapData.Group == mapTrialBuildData.Id then
|
||||
table.insert(tbTrialBuildIds, mapData.TrialBuildId)
|
||||
end
|
||||
end
|
||||
ForEachTableLine(ConfigTable.Get("ActivityReturneeTrialBuild"), foreachMapData1)
|
||||
return tbTrialBuildIds
|
||||
end
|
||||
function PlayerReengagementData:GetPurchasedBundles()
|
||||
return self._tbBoughtBundles
|
||||
end
|
||||
function PlayerReengagementData:UpdateDoubleCount(nDoubleCount)
|
||||
self._nDoubleCount = math.max(self._nMaxDoubleCount - nDoubleCount, 0)
|
||||
end
|
||||
function PlayerReengagementData:BuyWeeklyCard(sId, sStatistical)
|
||||
PlayerData.Mall:BuyWeeklyCard(sId, sStatistical)
|
||||
end
|
||||
function PlayerReengagementData:BuyReengagementPack(sId, sStatistical)
|
||||
PlayerData.Mall:BuyReengagementPackage(sId, sStatistical)
|
||||
end
|
||||
function PlayerReengagementData:RequestReceiveReunionReward(callback)
|
||||
local cb = function(_, changeInfo)
|
||||
self._bReunionReceived = true
|
||||
local mapDecodedChangeInfo = UTILS.DecodeChangeInfo(changeInfo)
|
||||
HttpNetHandler.ProcChangeInfo(mapDecodedChangeInfo)
|
||||
UTILS.OpenReceiveByChangeInfo(changeInfo, callback)
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.activity_returnee_reunion_reward_req, {}, nil, cb)
|
||||
end
|
||||
function PlayerReengagementData:RequestReceiveWeeklyCard(callback)
|
||||
local cb = function(_, changeInfo)
|
||||
self._mapWeeklyCard.Received = true
|
||||
self:RefreshRedDot()
|
||||
local mapDecodedChangeInfo = UTILS.DecodeChangeInfo(changeInfo)
|
||||
HttpNetHandler.ProcChangeInfo(mapDecodedChangeInfo)
|
||||
UTILS.OpenReceiveByChangeInfo(changeInfo, callback)
|
||||
EventManager.Hit("RefreshReengagementWeeklyCard")
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.activity_returnee_card_reward_receive_req, {}, nil, cb)
|
||||
end
|
||||
function PlayerReengagementData:RequestReceiveQuestReward(nQuestId)
|
||||
local cb = function(_, changeInfo)
|
||||
local nGroupId = self._tbQuestConfig[nQuestId].GroupId
|
||||
for _, mapQuest in pairs(self._mapQuestStateList) do
|
||||
local nThisGroupId = self._tbQuestConfig[mapQuest.nId].GroupId
|
||||
if mapQuest.nStatus == 1 and nThisGroupId == nGroupId then
|
||||
mapQuest.nStatus = 2
|
||||
mapQuest.Progress.Cur = mapQuest.Progress.Max
|
||||
self._mapQuestPoint.Point = self._mapQuestPoint.Point + 1
|
||||
end
|
||||
end
|
||||
if self._mapQuestDataList[nGroupId] ~= nil then
|
||||
for k, v in pairs(self._mapQuestDataList[nGroupId]) do
|
||||
if v.nStatus == 1 then
|
||||
v.nStatus = 2
|
||||
v.Progress.Cur = v.Progress.Max
|
||||
end
|
||||
end
|
||||
end
|
||||
self:RefreshRedDot()
|
||||
local mapDecodedChangeInfo = UTILS.DecodeChangeInfo(changeInfo)
|
||||
HttpNetHandler.ProcChangeInfo(mapDecodedChangeInfo)
|
||||
UTILS.OpenReceiveByChangeInfo(changeInfo, function()
|
||||
EventManager.Hit("RefreshReengagementQuest")
|
||||
EventManager.Hit("RefreshReengagementQuestPoint")
|
||||
end)
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.activity_returnee_quest_reward_receive_req, {Value = nQuestId}, nil, cb)
|
||||
end
|
||||
function PlayerReengagementData:RequestReceiveQuestPointReward(nPointIndex)
|
||||
local cb = function(_, changeInfo)
|
||||
self._mapQuestPoint.Received = self._mapQuestPoint.Received or {}
|
||||
local nPoint = tonumber(self._mapQuestPoint.Point) or 0
|
||||
for _, mapConfig in ipairs(self._mapQuestPointConfig or {}) do
|
||||
if nPoint >= mapConfig.Point then
|
||||
UTILS.SetBit(self._mapQuestPoint.Received, mapConfig.Index + 1)
|
||||
end
|
||||
end
|
||||
self:RefreshRedDot()
|
||||
local mapDecodedChangeInfo = UTILS.DecodeChangeInfo(changeInfo)
|
||||
HttpNetHandler.ProcChangeInfo(mapDecodedChangeInfo)
|
||||
UTILS.OpenReceiveByChangeInfo(changeInfo)
|
||||
EventManager.Hit("RefreshReengagementQuestPoint")
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.activity_returnee_quest_point_reward_receive_req, {Value = nPointIndex}, nil, cb)
|
||||
end
|
||||
function PlayerReengagementData:RequestReceiveLoginReward(callback)
|
||||
local cb = function(_, changeInfo)
|
||||
self._mapLoginInfo.Actual = self._mapLoginInfo.Receive
|
||||
self:RefreshRedDot()
|
||||
local mapDecodedChangeInfo = UTILS.DecodeChangeInfo(changeInfo)
|
||||
HttpNetHandler.ProcChangeInfo(mapDecodedChangeInfo)
|
||||
UTILS.OpenReceiveByChangeInfo(changeInfo, callback)
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.activity_returnee_login_reward_receive_req, {}, nil, cb)
|
||||
end
|
||||
function PlayerReengagementData:OnQuestChangeNotify(mapQuestData)
|
||||
if self._nActId == 0 or mapQuestData == nil or mapQuestData.Id == nil then
|
||||
return
|
||||
end
|
||||
local questConfig = ConfigTable.GetData("ActivityReturneeQuest", mapQuestData.Id)
|
||||
if questConfig == nil then
|
||||
return
|
||||
end
|
||||
local mapProgress
|
||||
if mapQuestData.Progress ~= nil then
|
||||
mapProgress = mapQuestData.Progress[1]
|
||||
end
|
||||
if mapProgress == nil then
|
||||
mapProgress = {
|
||||
Cur = 0,
|
||||
Max = self:GetQuestMaxProgress(mapQuestData.Id)
|
||||
}
|
||||
end
|
||||
local dataToInsert = {
|
||||
nId = mapQuestData.Id,
|
||||
nStatus = mapQuestData.Status,
|
||||
Progress = mapProgress
|
||||
}
|
||||
self._mapQuestStateList[mapQuestData.Id] = dataToInsert
|
||||
if self._mapQuestDataList[questConfig.GroupId] == nil then
|
||||
self._mapQuestDataList[questConfig.GroupId] = {}
|
||||
end
|
||||
self._mapQuestDataList[questConfig.GroupId][mapQuestData.Id] = dataToInsert
|
||||
self:RefreshRedDot()
|
||||
EventManager.Hit("RefreshReengagementQuest")
|
||||
end
|
||||
return PlayerReengagementData
|
||||
@@ -304,7 +304,10 @@ function PlayerRogueBossData:CacheRogueBossData(tbData)
|
||||
tab.Star = v.Star
|
||||
tab.First = v.First
|
||||
tab.ThreeStar = v.ThreeStar
|
||||
tab.BuildId = v.BuildId
|
||||
tab.BuildId = 0
|
||||
if v.Build ~= nil then
|
||||
tab.BuildId = v.Build.BuildId or 0
|
||||
end
|
||||
tab.maxStar = v.ThreeStar and 3 or v.Star
|
||||
self.CacheBossLevelMsg[v.Id] = tab
|
||||
end
|
||||
|
||||
@@ -66,7 +66,19 @@ end
|
||||
function PlayerShopData:GetShopList()
|
||||
local tbList = {}
|
||||
for _, mapShop in pairs(self._tbShops) do
|
||||
if mapShop.bUnlock and mapShop.bOpenAble then
|
||||
if mapShop.bUnlock and mapShop.bOpenAble and mapShop.nType == GameEnum.ShopType.Resident then
|
||||
table.insert(tbList, mapShop)
|
||||
end
|
||||
end
|
||||
table.sort(tbList, function(a, b)
|
||||
return a.nSequence < b.nSequence
|
||||
end)
|
||||
return tbList
|
||||
end
|
||||
function PlayerShopData:GetShopListByType(nType)
|
||||
local tbList = {}
|
||||
for _, mapShop in pairs(self._tbShops) do
|
||||
if mapShop.bUnlock and mapShop.bOpenAble and mapShop.nType == nType then
|
||||
table.insert(tbList, mapShop)
|
||||
end
|
||||
end
|
||||
@@ -125,6 +137,21 @@ function PlayerShopData:GetShopFirstIn()
|
||||
end
|
||||
return bFirst
|
||||
end
|
||||
function PlayerShopData:CheckShopJumpAble(nShopId)
|
||||
local sLockTip = ""
|
||||
local mapCfg = ConfigTable.GetData("ResidentShop", nShopId)
|
||||
if not mapCfg then
|
||||
return false, sLockTip
|
||||
end
|
||||
if mapCfg.UnlockCondType == GameEnum.shopCond.WorldClassSpecific then
|
||||
local worldClass = PlayerData.Base:GetWorldClass()
|
||||
local tbParams = decodeJson(mapCfg.UnlockCondParams)
|
||||
local bAble = worldClass >= tbParams[1]
|
||||
sLockTip = orderedFormat(ConfigTable.GetUIText("Shop_Cond_WorldClass"), tbParams[1])
|
||||
return bAble, sLockTip
|
||||
end
|
||||
return true, sLockTip
|
||||
end
|
||||
function PlayerShopData:CreateData()
|
||||
local nServerTimeStamp = ClientManager.serverTimeStamp
|
||||
local func_ForEach_Shop = function(mapCfgData)
|
||||
@@ -158,7 +185,8 @@ function PlayerShopData:CreateShopData(mapCfgData, nServerTimeStamp)
|
||||
bUnlock = false,
|
||||
bOpenAble = false,
|
||||
nServerRefreshTime = 0,
|
||||
nNextRefreshTime = 0
|
||||
nNextRefreshTime = 0,
|
||||
nType = mapCfgData.Type
|
||||
}
|
||||
self._tbShops[mapCfgData.Id] = mapShop
|
||||
self:UpdateShopData(mapCfgData.Id)
|
||||
|
||||
@@ -95,9 +95,13 @@ function PlayerSkillInstanceData:CacheSkillInstanceLevel(tbData)
|
||||
local t2 = mapData.Star >= 2
|
||||
local t3 = mapData.Star >= 3
|
||||
local nStar = mapData.Star
|
||||
local nBuildId = 0
|
||||
if mapData.Build ~= nil then
|
||||
nBuildId = mapData.Build.BuildId or 0
|
||||
end
|
||||
self.mapAllLevel[mapData.Id] = {
|
||||
nStar = nStar,
|
||||
nBuildId = mapData.BuildId,
|
||||
nBuildId = nBuildId,
|
||||
tbTarget = {
|
||||
t1,
|
||||
t2,
|
||||
@@ -168,9 +172,12 @@ function PlayerSkillInstanceData:MsgEnterSkillInstance(nLevelId, nBuildId, callb
|
||||
self._EntryTime = CS.ClientManager.Instance.serverTimeStampWithTimeZone
|
||||
self._Build_id = nBuildId
|
||||
self._Level_id = nLevelId
|
||||
local mapBuildData = PlayerData.Build:GetBuildData(nBuildId)
|
||||
local bTrial = mapBuildData.nBuildSource == AllEnum.BuildSource.Trial or mapBuildData.nBuildSource == AllEnum.BuildSource.LimitedTrial
|
||||
local nBuildType = bTrial and 2 or 1
|
||||
local msg = {}
|
||||
msg.Id = nLevelId
|
||||
msg.BuildId = nBuildId
|
||||
msg.Build = {Type = nBuildType, BuildId = nBuildId}
|
||||
local msgCallback = function(_, mapChangeInfo)
|
||||
self:EnterSkillInstance(nLevelId, nBuildId)
|
||||
if self.mapAllLevel[nLevelId] == nil then
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -212,41 +212,43 @@ function PlayerStarTowerData:EnterTowerPrologue()
|
||||
applyCallback(nil, mapMsgData, mapLocalData)
|
||||
end
|
||||
function PlayerStarTowerData:EnterTowerFastBattle(nTowerId, nTeamIdx)
|
||||
local tbTeam = PlayerData.Team:GetTeamCharId(nTeamIdx)
|
||||
local tbCharSkinId = {}
|
||||
for _, nCharId in ipairs(tbTeam) do
|
||||
table.insert(tbCharSkinId, PlayerData.Char:GetCharSkinId(nCharId))
|
||||
end
|
||||
local applyCallback = function(_, mapMsgData)
|
||||
local mapStartowerCfg = ConfigTable.GetData("StarTower", nTowerId)
|
||||
if mapStartowerCfg ~= nil then
|
||||
self.mapGroupFormation[mapStartowerCfg.GroupId] = nTeamIdx
|
||||
PlayerData.StarTowerAutoPlan:EnsureInited(function()
|
||||
local tbTeam = PlayerData.Team:GetTeamCharId(nTeamIdx)
|
||||
local tbCharSkinId = {}
|
||||
for _, nCharId in ipairs(tbTeam) do
|
||||
table.insert(tbCharSkinId, PlayerData.Char:GetCharSkinId(nCharId))
|
||||
end
|
||||
local mapStateInfo = {
|
||||
local applyCallback = function(_, mapMsgData)
|
||||
local mapStartowerCfg = ConfigTable.GetData("StarTower", nTowerId)
|
||||
if mapStartowerCfg ~= nil then
|
||||
self.mapGroupFormation[mapStartowerCfg.GroupId] = nTeamIdx
|
||||
end
|
||||
local mapStateInfo = {
|
||||
Id = nTowerId,
|
||||
ReConnection = 0,
|
||||
BuildId = 0,
|
||||
CharIds = tbTeam,
|
||||
Floor = 0,
|
||||
Sweep = true
|
||||
}
|
||||
PlayerData.State:CacheStarTowerStateData(mapStateInfo)
|
||||
local starTowerInfo = mapMsgData.Info
|
||||
local mapDecodedChangeInfo = UTILS.DecodeChangeInfo(mapMsgData.Change)
|
||||
HttpNetHandler.ProcChangeInfo(mapDecodedChangeInfo)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.StarTowerFastBattle, starTowerInfo)
|
||||
end
|
||||
local mapMsg = {
|
||||
Id = nTowerId,
|
||||
ReConnection = 0,
|
||||
BuildId = 0,
|
||||
CharIds = tbTeam,
|
||||
Floor = 0,
|
||||
FormationId = nTeamIdx,
|
||||
CharHp = -1,
|
||||
MapId = -1,
|
||||
ParamId = -1,
|
||||
MapParam = "",
|
||||
MapTableId = -1,
|
||||
Sweep = true
|
||||
}
|
||||
PlayerData.State:CacheStarTowerStateData(mapStateInfo)
|
||||
local starTowerInfo = mapMsgData.Info
|
||||
local mapDecodedChangeInfo = UTILS.DecodeChangeInfo(mapMsgData.Change)
|
||||
HttpNetHandler.ProcChangeInfo(mapDecodedChangeInfo)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.StarTowerFastBattle, starTowerInfo)
|
||||
end
|
||||
local mapMsg = {
|
||||
Id = nTowerId,
|
||||
FormationId = nTeamIdx,
|
||||
CharHp = -1,
|
||||
MapId = -1,
|
||||
ParamId = -1,
|
||||
MapParam = "",
|
||||
MapTableId = -1,
|
||||
Sweep = true
|
||||
}
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.star_tower_apply_req, mapMsg, nil, applyCallback)
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.star_tower_apply_req, mapMsg, nil, applyCallback)
|
||||
end)
|
||||
end
|
||||
function PlayerStarTowerData:ReenterTower(nTowerId)
|
||||
local callback = function(_, msgData)
|
||||
@@ -272,15 +274,17 @@ function PlayerStarTowerData:ReenterTower(nTowerId)
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.star_tower_info_req, {}, nil, callback)
|
||||
end
|
||||
function PlayerStarTowerData:ReenterTowerFastBattle()
|
||||
local callback = function(_, msgData)
|
||||
local starTowerInfo = {
|
||||
Meta = msgData.Meta,
|
||||
Room = msgData.Room,
|
||||
Bag = msgData.Bag
|
||||
}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.StarTowerFastBattle, starTowerInfo)
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.star_tower_info_req, {}, nil, callback)
|
||||
PlayerData.StarTowerAutoPlan:EnsureInited(function()
|
||||
local callback = function(_, msgData)
|
||||
local starTowerInfo = {
|
||||
Meta = msgData.Meta,
|
||||
Room = msgData.Room,
|
||||
Bag = msgData.Bag
|
||||
}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.StarTowerFastBattle, starTowerInfo)
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.star_tower_info_req, {}, nil, callback)
|
||||
end)
|
||||
end
|
||||
function PlayerStarTowerData:StarTowerEnd()
|
||||
if self.LevelData ~= nil then
|
||||
|
||||
@@ -32,6 +32,13 @@ function PlayerStateData:CacheStateData(mapMsgData)
|
||||
PlayerData.Activity:UpdateActivityState(mapMsgData.Activities)
|
||||
PlayerData.StorySet:UpdateStorySetState(mapMsgData.StorySet)
|
||||
PlayerData.TraceHunt:UpdateBossRewardRedDot(mapMsgData.TraceHunt.BossRewardCanReceive)
|
||||
if mapMsgData.Soldier ~= nil then
|
||||
PlayerData.SoldierData:UpdateSoldierState(mapMsgData.Soldier)
|
||||
end
|
||||
if mapMsgData.GuideMission ~= nil then
|
||||
RedDotManager.SetValid(RedDotDefine.GuideMission_Server, nil, mapMsgData.GuideMission.New)
|
||||
end
|
||||
RedDotManager.SetValid(RedDotDefine.DormServer, nil, mapMsgData.DormStateFlag > 0)
|
||||
self.nVampireId = mapMsgData.VampireSurvivorId
|
||||
else
|
||||
self.bMailState = false
|
||||
@@ -112,14 +119,33 @@ function PlayerStateData:GetCanPickedAdvanceRewards(nCharId, nMaxAdvance)
|
||||
return 0
|
||||
end
|
||||
end
|
||||
function PlayerStateData:CheckState()
|
||||
if self.mapStarTowerState.BuildId ~= 0 then
|
||||
print("正在保存的BuildId" .. self.mapStarTowerState.BuildId)
|
||||
local buildDetailcallback = function(mapBuild)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.StarTowerBuildSave, false, mapBuild)
|
||||
self.mapStarTowerState.BuildId = 0
|
||||
function PlayerStateData:HasPendingStarTowerBuild()
|
||||
return self.mapStarTowerState ~= nil and self.mapStarTowerState.BuildId ~= 0
|
||||
end
|
||||
function PlayerStateData:OpenStarTowerBuildSave(callback)
|
||||
if not self:HasPendingStarTowerBuild() then
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
PlayerData.Build:GetBuildDetailData(buildDetailcallback, self.mapStarTowerState.BuildId)
|
||||
return
|
||||
end
|
||||
local nBuildId = self.mapStarTowerState.BuildId
|
||||
print("正在保存的BuildId" .. nBuildId)
|
||||
self.mapStarTowerState.BuildId = 0
|
||||
local buildDetailcallback = function(mapBuild)
|
||||
if type(mapBuild) ~= "table" then
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.StarTowerBuildSave, false, mapBuild, callback)
|
||||
end
|
||||
PlayerData.Build:GetBuildDetailData(buildDetailcallback, nBuildId)
|
||||
end
|
||||
function PlayerStateData:CheckState()
|
||||
if self:HasPendingStarTowerBuild() then
|
||||
self:OpenStarTowerBuildSave()
|
||||
return true
|
||||
end
|
||||
return false
|
||||
|
||||
@@ -14,10 +14,16 @@ function PlayerStoryData:CacheLastStory(msgData)
|
||||
if msgData.Story ~= nil then
|
||||
self.nLastMainlineStoryId = msgData.Story.Idx
|
||||
end
|
||||
if msgData.StorySet ~= nil then
|
||||
self.tbRecentStoryInfo.Type = GameEnum.StoryPreviewType.StorySet
|
||||
self.tbRecentStoryInfo.ChapterId = msgData.StorySet.ChapterId
|
||||
self.tbRecentStoryInfo.StoryId = msgData.StorySet.SectionId
|
||||
if msgData.Type == 1 then
|
||||
if msgData.StorySet ~= nil then
|
||||
self.tbRecentStoryInfo.Type = GameEnum.StoryPreviewType.StorySet
|
||||
self.tbRecentStoryInfo.ChapterId = msgData.StorySet.ChapterId
|
||||
self.tbRecentStoryInfo.StoryId = msgData.StorySet.SectionId
|
||||
end
|
||||
elseif msgData.Type == 2 and msgData.ActivityStory ~= nil then
|
||||
self.tbRecentStoryInfo.Type = GameEnum.StoryPreviewType.ActivityStory
|
||||
self.tbRecentStoryInfo.ChapterId = msgData.ActivityStory.ChapterId
|
||||
self.tbRecentStoryInfo.StoryId = msgData.ActivityStory.StoryId
|
||||
end
|
||||
end
|
||||
function PlayerStoryData:SetLastMainlineStoryId(storyId)
|
||||
@@ -34,11 +40,12 @@ function PlayerStoryData:GetRecentStoryInfo()
|
||||
if self.tbRecentStoryInfo.StoryId == nil or self.tbRecentStoryInfo.ChapterId == nil then
|
||||
return false
|
||||
end
|
||||
local config = ConfigTable.GetData("ActivityStoryChapter", self.tbRecentStoryInfo.ChapterId, "")
|
||||
local config = CacheTable.GetData("_ActivityStoryChapter", self.tbRecentStoryInfo.ChapterId, "")
|
||||
if config == nil then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
local title = config.Title
|
||||
return true, self.tbRecentStoryInfo, title, config.Banner
|
||||
elseif self.tbRecentStoryInfo.Type == GameEnum.StoryPreviewType.StorySet then
|
||||
if self.tbRecentStoryInfo.ChapterId == nil then
|
||||
return false
|
||||
@@ -49,6 +56,16 @@ function PlayerStoryData:GetRecentStoryInfo()
|
||||
end
|
||||
local title = ConfigTable.GetUIText("Nova_Story") .. " " .. config.Title
|
||||
return true, self.tbRecentStoryInfo, title, config.Banner
|
||||
elseif self.tbRecentStoryInfo.Type == GameEnum.StoryPreviewType.ActivityStory then
|
||||
if self.tbRecentStoryInfo.ChapterId == nil then
|
||||
return false
|
||||
end
|
||||
local config = CacheTable.GetData("_ActivityStoryChapter", self.tbRecentStoryInfo.ChapterId)
|
||||
if config == nil then
|
||||
return false
|
||||
end
|
||||
local title = ConfigTable.GetUIText("_ActivityStoryChapter") .. " " .. config.Title
|
||||
return true, self.tbRecentStoryInfo, title, config.Banner
|
||||
end
|
||||
end
|
||||
function PlayerStoryData:SetRecentStoryInfo(type, chapterId, storyId)
|
||||
@@ -61,7 +78,7 @@ function PlayerStoryData:SetRecentStoryInfo(type, chapterId, storyId)
|
||||
Type = 1,
|
||||
StorySet = {ChapterId = chapterId, SectionId = storyId}
|
||||
}
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.player_last_read_update_req, msgData)
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.player_last_read_update_req, msgData)
|
||||
end
|
||||
return PlayerStoryData
|
||||
|
||||
@@ -0,0 +1,295 @@
|
||||
local ActivityStoryDataBase = require("GameCore.Data.DataClass.Activity.ActivityStoryDataBase")
|
||||
local PlayerStoryReviewData = class("PlayerStoryReviewData", ActivityStoryDataBase)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
function PlayerStoryReviewData:Init()
|
||||
ActivityStoryDataBase.Init(self)
|
||||
self.mapReviewChapters = {}
|
||||
self.mapLoadedChapterIds = {}
|
||||
self.bOnlyShowUnRead = false
|
||||
self:InitConfig()
|
||||
end
|
||||
function PlayerStoryReviewData:InitConfig()
|
||||
self.mapReviewChapters = {}
|
||||
local funcForeachSection = function(mapData)
|
||||
CacheTable.SetData("_ActivityStoryChapter", mapData.ChapterId, mapData)
|
||||
end
|
||||
ForEachTableLine(ConfigTable.Get("ActivityStoryChapter"), funcForeachSection)
|
||||
end
|
||||
function PlayerStoryReviewData:CheckStoryInReview(nChapterId)
|
||||
local mapCfg = CacheTable.GetData("_ActivityStoryChapter", nChapterId)
|
||||
if mapCfg ~= nil then
|
||||
local nActivityId = mapCfg.Id
|
||||
local mapActCfg = ConfigTable.GetData("Activity", nActivityId)
|
||||
if mapActCfg ~= nil and mapActCfg.EndType == GameEnum.activityEndType.Date then
|
||||
local nEndTime = ClientManager:ISO8601StrToTimeStamp(mapActCfg.EndTime)
|
||||
local nCurTime = ClientManager.serverTimeStamp
|
||||
if nEndTime > nCurTime then
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
function PlayerStoryReviewData:GetAllStoryReview()
|
||||
local tbLineChapters = {}
|
||||
self.mapReviewChapters = {}
|
||||
local funcForeachSection = function(mapData)
|
||||
local nActivityId = mapData.Id
|
||||
local mapActCfg = ConfigTable.GetData("Activity", nActivityId)
|
||||
if mapActCfg ~= nil and mapActCfg.EndType == GameEnum.activityEndType.Date then
|
||||
local nEndTime = ClientManager:ISO8601StrToTimeStamp(mapActCfg.EndTime)
|
||||
local nCurTime = ClientManager.serverTimeStamp
|
||||
if nEndTime <= nCurTime then
|
||||
self.mapReviewChapters[mapData.ChapterId] = mapData
|
||||
end
|
||||
end
|
||||
end
|
||||
ForEachTableLine(ConfigTable.Get("ActivityStoryChapter"), funcForeachSection)
|
||||
for nChapterId, mapCfg in pairs(self.mapReviewChapters) do
|
||||
local nLineId = mapCfg.StoryLineId
|
||||
if tbLineChapters[nLineId] == nil then
|
||||
tbLineChapters[nLineId] = {}
|
||||
end
|
||||
table.insert(tbLineChapters[nLineId], nChapterId)
|
||||
end
|
||||
for _, tbIds in pairs(tbLineChapters) do
|
||||
table.sort(tbIds, function(a, b)
|
||||
local cfgA = CacheTable.GetData("_ActivityStoryChapter", a)
|
||||
local cfgB = CacheTable.GetData("_ActivityStoryChapter", b)
|
||||
return (cfgA and cfgA.SortOrder or 0) < (cfgB and cfgB.SortOrder or 0)
|
||||
end)
|
||||
end
|
||||
return tbLineChapters
|
||||
end
|
||||
function PlayerStoryReviewData:GetSortedStoryLineIds()
|
||||
local tbLineIds = {}
|
||||
local tbSeen = {}
|
||||
for _, mapCfg in pairs(self.mapReviewChapters) do
|
||||
local nLineId = mapCfg.StoryLineId
|
||||
if not tbSeen[nLineId] then
|
||||
tbSeen[nLineId] = true
|
||||
table.insert(tbLineIds, nLineId)
|
||||
end
|
||||
end
|
||||
table.sort(tbLineIds, function(a, b)
|
||||
local cfgA = ConfigTable.GetData("ActivityStoryLine", a)
|
||||
local cfgB = ConfigTable.GetData("ActivityStoryLine", b)
|
||||
return (cfgA and cfgA.SortOrder or 0) < (cfgB and cfgB.SortOrder or 0)
|
||||
end)
|
||||
return tbLineIds
|
||||
end
|
||||
function PlayerStoryReviewData:GetLastReadChapterId()
|
||||
if self.nLastChapterId == nil then
|
||||
self.nLastChapterId = LocalData.GetPlayerLocalData("StoryReview_LastRead_ChapterId") or 0
|
||||
end
|
||||
if self.nLastChapterId ~= 0 and self:CheckChapterRead(self.nLastChapterId) then
|
||||
self:SetLastReadChapterId(0)
|
||||
end
|
||||
return self.nLastChapterId
|
||||
end
|
||||
function PlayerStoryReviewData:GetOnlyShowUnRead()
|
||||
return self.bOnlyShowUnRead == true
|
||||
end
|
||||
function PlayerStoryReviewData:SetOnlyShowUnRead(bOnlyShowUnRead)
|
||||
self.bOnlyShowUnRead = bOnlyShowUnRead == true
|
||||
end
|
||||
function PlayerStoryReviewData:SetLastReadChapterId(nChapterId)
|
||||
self.nLastChapterId = nChapterId
|
||||
LocalData.SetPlayerLocalData("StoryReview_LastRead_ChapterId", nChapterId)
|
||||
end
|
||||
function PlayerStoryReviewData:GetChapterActivityId(nChapterId)
|
||||
local mapCfg = CacheTable.GetData("_ActivityStoryChapter", nChapterId)
|
||||
if mapCfg ~= nil then
|
||||
return mapCfg.Id
|
||||
end
|
||||
return 0
|
||||
end
|
||||
function PlayerStoryReviewData:IsChapterLoaded(nChapterId)
|
||||
return self.mapLoadedChapterIds[nChapterId] == true
|
||||
end
|
||||
function PlayerStoryReviewData:IsChapterRead(nChapterId)
|
||||
local bRead = true
|
||||
local tbStoryIds = self:GetChapterStoryNumIds(nChapterId)
|
||||
if tbStoryIds ~= nil then
|
||||
for _, v in ipairs(tbStoryIds) do
|
||||
bRead = bRead and self:IsStoryReaded(v)
|
||||
end
|
||||
end
|
||||
return bRead
|
||||
end
|
||||
function PlayerStoryReviewData:GetChapterHandBookId(nChapterId)
|
||||
local mapCfg = CacheTable.GetData("_ActivityStoryChapter", nChapterId)
|
||||
if mapCfg == nil then
|
||||
return 0
|
||||
end
|
||||
return mapCfg.HandBookId or 0
|
||||
end
|
||||
function PlayerStoryReviewData:IsChapterReadByHandbook(nChapterId)
|
||||
local nHandBookId = self:GetChapterHandBookId(nChapterId)
|
||||
if nHandBookId <= 0 then
|
||||
return false
|
||||
end
|
||||
return PlayerData.Handbook:CheckHandbookUnlock(nHandBookId)
|
||||
end
|
||||
function PlayerStoryReviewData:CheckChapterRead(nChapterId)
|
||||
if self:IsChapterLoaded(nChapterId) then
|
||||
return self:IsChapterRead(nChapterId)
|
||||
end
|
||||
return self:IsChapterReadByHandbook(nChapterId)
|
||||
end
|
||||
function PlayerStoryReviewData:GetChapterReadProgress(nChapterId)
|
||||
local tbStoryNumIds = self:GetChapterStoryNumIds(nChapterId)
|
||||
local nTotal = tbStoryNumIds ~= nil and #tbStoryNumIds or 0
|
||||
if not self:IsChapterLoaded(nChapterId) then
|
||||
return self:IsChapterReadByHandbook(nChapterId) and nTotal or 0, nTotal
|
||||
end
|
||||
local nRead = 0
|
||||
for _, nStoryNumId in ipairs(tbStoryNumIds) do
|
||||
if self:IsStoryReaded(nStoryNumId) then
|
||||
nRead = nRead + 1
|
||||
end
|
||||
end
|
||||
return nRead, nTotal
|
||||
end
|
||||
function PlayerStoryReviewData:GetChapterLastStoryNumId(nChapterId)
|
||||
local tbStoryNumIds = self:GetChapterStoryNumIds(nChapterId)
|
||||
if tbStoryNumIds == nil then
|
||||
return 0
|
||||
end
|
||||
for _, nStoryNumId in ipairs(tbStoryNumIds) do
|
||||
local mapCfg = ConfigTable.GetData("ActivityStory", nStoryNumId)
|
||||
if mapCfg ~= nil and mapCfg.IsLast == true then
|
||||
return nStoryNumId
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
function PlayerStoryReviewData:TryOpenStoryChapter(nChapterId)
|
||||
local mapCfg = CacheTable.GetData("_ActivityStoryChapter", nChapterId)
|
||||
if mapCfg == nil then
|
||||
return
|
||||
end
|
||||
local nPanelId = mapCfg.PanelId
|
||||
local nActId = mapCfg.Id
|
||||
local openPanel = function()
|
||||
EventManager.Hit(EventId.OpenPanel, nPanelId, nActId, true)
|
||||
end
|
||||
if self:IsChapterLoaded(nChapterId) then
|
||||
openPanel()
|
||||
else
|
||||
self:SendGetChapterInfo(nChapterId, openPanel)
|
||||
end
|
||||
end
|
||||
function PlayerStoryReviewData:_GetApplyMsgId(nActivityId)
|
||||
return NetMsgId.Id.activity_archive_story_apply_req
|
||||
end
|
||||
function PlayerStoryReviewData:_GetSettleMsgId(nActivityId)
|
||||
return NetMsgId.Id.activity_archive_story_settle_req, true
|
||||
end
|
||||
function PlayerStoryReviewData:IsOpen(sAvgId, nActivityId)
|
||||
return true, 0
|
||||
end
|
||||
function PlayerStoryReviewData:RefreshAvgRedDot()
|
||||
for nLineId, tbChapterIds in pairs(self:GetAllStoryReview()) do
|
||||
for _, nChapterId in ipairs(tbChapterIds) do
|
||||
local bValid = not self:IsChapterReadByHandbook(nChapterId)
|
||||
RedDotManager.SetValid(RedDotDefine.StoryReview_Chapter, {nLineId, nChapterId}, bValid)
|
||||
end
|
||||
end
|
||||
end
|
||||
function PlayerStoryReviewData:SendMsg_STORY_ENTER(nActivityId, nStoryId, nBuildId, bNewestStory)
|
||||
ActivityStoryDataBase.SendMsg_STORY_ENTER(self, nActivityId, nStoryId, nBuildId, bNewestStory)
|
||||
local mapChapterCfg = self:GetChapterIdByActivityId(nActivityId)
|
||||
if mapChapterCfg ~= nil then
|
||||
self:SetLastReadChapterId(mapChapterCfg.ChapterId)
|
||||
end
|
||||
end
|
||||
function PlayerStoryReviewData:_GetLocalReadKey(nActId, nStoryId)
|
||||
return "Review_Story_Read_" .. tostring(nActId) .. tostring(nStoryId)
|
||||
end
|
||||
function PlayerStoryReviewData:IsActivityAvgUnlock(nActivityId, nStoryId)
|
||||
return true, true, 0
|
||||
end
|
||||
function PlayerStoryReviewData:IsActivityAvgReaded(nActivityId, nStoryId)
|
||||
return true
|
||||
end
|
||||
function PlayerStoryReviewData:IsNew(nActivityId, nStoryId)
|
||||
return false
|
||||
end
|
||||
function PlayerStoryReviewData:GetRecentAcvitityIndex(nActivityId)
|
||||
return 1
|
||||
end
|
||||
function PlayerStoryReviewData:SendGetChapterInfo(nChapterId, callback)
|
||||
local netCallback = function(_, netData)
|
||||
local chapter = netData
|
||||
if chapter ~= nil and chapter.ChapterId ~= nil then
|
||||
local nActivityId = self:GetChapterActivityId(nChapterId)
|
||||
if 0 < nActivityId then
|
||||
self:CacheAvgData(chapter, nActivityId)
|
||||
end
|
||||
self.mapLoadedChapterIds[nChapterId] = true
|
||||
end
|
||||
if callback ~= nil then
|
||||
callback(chapter)
|
||||
end
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.activity_archive_story_info_req, {Value = nChapterId}, nil, netCallback)
|
||||
end
|
||||
function PlayerStoryReviewData:SendChapterPass(nChapterId, callback)
|
||||
local nLastStoryNumId = self:GetChapterLastStoryNumId(nChapterId)
|
||||
if nLastStoryNumId <= 0 then
|
||||
printError("ActivityStory 没配 IsLast 的收尾剧情,无法发送章节完成,章节 id:" .. tostring(nChapterId))
|
||||
return
|
||||
end
|
||||
local netCallback = function(_, netData)
|
||||
self:RefreshAvgRedDot()
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.activity_archive_story_chapter_pass_req, {ChapterId = nLastStoryNumId}, nil, netCallback)
|
||||
end
|
||||
function PlayerStoryReviewData:_MockChapterInfo(nChapterId)
|
||||
local tbStoryNumIds = self:GetChapterStoryNumIds(nChapterId) or {}
|
||||
local tbStories = {}
|
||||
local tbEvidences = {}
|
||||
local tbSeenEv = {}
|
||||
for _, nStoryId in ipairs(tbStoryNumIds) do
|
||||
local mapStoryCfg = ConfigTable.GetData("ActivityStory", nStoryId)
|
||||
if mapStoryCfg ~= nil then
|
||||
local mapCondCfg = ConfigTable.GetData("ActivityStoryCondition", mapStoryCfg.ConditionId)
|
||||
if mapCondCfg ~= nil then
|
||||
if mapCondCfg.EvIds_a ~= nil then
|
||||
for _, nEvNumId in ipairs(mapCondCfg.EvIds_a) do
|
||||
if not tbSeenEv[nEvNumId] then
|
||||
tbSeenEv[nEvNumId] = true
|
||||
table.insert(tbEvidences, nEvNumId)
|
||||
end
|
||||
end
|
||||
end
|
||||
if mapCondCfg.EvIds_b ~= nil then
|
||||
for _, nEvNumId in ipairs(mapCondCfg.EvIds_b) do
|
||||
if not tbSeenEv[nEvNumId] then
|
||||
tbSeenEv[nEvNumId] = true
|
||||
table.insert(tbEvidences, nEvNumId)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
table.insert(tbStories, {
|
||||
Id = nStoryId,
|
||||
Major = {},
|
||||
Personality = {},
|
||||
Receive = true
|
||||
})
|
||||
end
|
||||
end
|
||||
return {
|
||||
ChapterId = nChapterId,
|
||||
Build = {Type = 0, BuildId = 0},
|
||||
Evidences = tbEvidences,
|
||||
Stories = tbStories
|
||||
}
|
||||
end
|
||||
return PlayerStoryReviewData
|
||||
@@ -153,6 +153,21 @@ end
|
||||
function PlayerStorySetData:GetRecentChapterId()
|
||||
return self.nRecentChapterId
|
||||
end
|
||||
function PlayerStorySetData:IsChapterUnlock(nChapterId)
|
||||
local mapCfg = ConfigTable.GetData("StorySetChapter", nChapterId)
|
||||
if mapCfg == nil then
|
||||
return false, ""
|
||||
end
|
||||
if not mapCfg.IsShow then
|
||||
return false, ConfigTable.GetUIText("StorySet_Chapter_Empty")
|
||||
end
|
||||
local chapter = self.tbChapter[nChapterId]
|
||||
if chapter == nil or not chapter.bUnlock then
|
||||
local sLockText = mapCfg.LockText ~= "" and mapCfg.LockText or ConfigTable.GetUIText("StorySet_Chapter_Lock")
|
||||
return false, sLockText
|
||||
end
|
||||
return true, ""
|
||||
end
|
||||
function PlayerStorySetData:IsChapterAllRead(nChapterId)
|
||||
if self.tbChapter[nChapterId] == nil then
|
||||
return false
|
||||
|
||||
@@ -223,7 +223,7 @@ function PlayerTraceHuntData:CacheTraceHuntInfo(mapTraceHuntInfo)
|
||||
end
|
||||
self:UpdateControlData()
|
||||
self:UpdateLevel(mapTraceHuntInfo.Level, mapTraceHuntInfo.Exp)
|
||||
self:SetSelBuildId(mapTraceHuntInfo.BuildID)
|
||||
self:SetSelBuildId(mapTraceHuntInfo.Build and mapTraceHuntInfo.Build.BuildId or 0)
|
||||
local bComplete = self:CheckHuntComplete()
|
||||
local bInterrupt = self:CheckHuntInterrupt()
|
||||
self:UpdateBossRewardRedDot(bComplete or bInterrupt)
|
||||
@@ -766,10 +766,13 @@ function PlayerTraceHuntData:SendTraceHuntApplyReq(nOwnerUID, nBossID, nBuildId,
|
||||
local nDifficulty = self:GetDifficultyBySource(bSelfBoss)
|
||||
local mapBoss = ConfigTable.GetData("TraceHuntBoss", nBossID)
|
||||
local nFloorId = self.tbTraceHuntFloor[mapBoss.FloorGroup][nDifficulty].Id
|
||||
local mapBuildData = PlayerData.Build:GetBuildData(nBuildId)
|
||||
local bTrial = mapBuildData.nBuildSource == AllEnum.BuildSource.Trial or mapBuildData.nBuildSource == AllEnum.BuildSource.LimitedTrial
|
||||
local nBuildType = bTrial and 2 or 1
|
||||
local msgData = {
|
||||
OwnerUID = nOwnerUID,
|
||||
BossID = nBossID,
|
||||
BuildID = nBuildId,
|
||||
Build = {Type = nBuildType, BuildId = nBuildId},
|
||||
BossCreateTime = nBossCreateTime,
|
||||
Difficulty = nDifficulty
|
||||
}
|
||||
@@ -944,10 +947,8 @@ function PlayerTraceHuntData:UpdateTraceItemRedDot()
|
||||
RedDotManager.SetValid(RedDotDefine.TraceHunt_TraceItem, nil, bAble)
|
||||
end
|
||||
function PlayerTraceHuntData:UpdateItemEntranceRedDot()
|
||||
local bReward = RedDotManager.GetValid(RedDotDefine.TraceHunt_Reward_Boss)
|
||||
local bHuntMax = RedDotManager.GetValid(RedDotDefine.TraceHunt_HuntItem)
|
||||
local bTraceMax = RedDotManager.GetValid(RedDotDefine.TraceHunt_TraceItem)
|
||||
RedDotManager.SetValid(RedDotDefine.TraceHunt_Item, nil, not bReward and (bHuntMax or bTraceMax))
|
||||
RedDotManager.SetValid(RedDotDefine.TraceHunt_Item, nil, bTraceMax)
|
||||
end
|
||||
function PlayerTraceHuntData:EnterTraceHunt(nLevelId, nBuildId, nFloorId)
|
||||
self.entryLevelId = nLevelId
|
||||
|
||||
@@ -60,11 +60,19 @@ function PlayerVampireSurvivorData:EnterVampireSurvivor(nLevelId, nBuildId1, nBu
|
||||
self.curLevel:Init(self, nLevelId, nBuildId1, nBuildId2, netMsg.Events, netMsg.Reward, netMsg.Select)
|
||||
end
|
||||
end
|
||||
local BuildIds = {nBuildId1}
|
||||
local Builds = {
|
||||
{
|
||||
Type = PlayerData.Build:IsUseTrialRuntime(nBuildId1) and 2 or 1,
|
||||
BuildId = nBuildId1
|
||||
}
|
||||
}
|
||||
if 0 < nBuildId2 then
|
||||
table.insert(BuildIds, nBuildId2)
|
||||
table.insert(Builds, {
|
||||
Type = PlayerData.Build:IsUseTrialRuntime(nBuildId2) and 2 or 1,
|
||||
BuildId = nBuildId2
|
||||
})
|
||||
end
|
||||
local msg = {Id = nLevelId, BuildIds = BuildIds}
|
||||
local msg = {Id = nLevelId, Builds = Builds}
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.vampire_survivor_apply_req, msg, nil, NetCallback)
|
||||
end
|
||||
function PlayerVampireSurvivorData:ReEnterVampireSurvivor(nVampireId)
|
||||
@@ -81,11 +89,13 @@ function PlayerVampireSurvivorData:ReEnterVampireSurvivor(nVampireId)
|
||||
local nBuildId2 = 0
|
||||
local mapSceneFirst
|
||||
for _, mapScene in ipairs(netMsg.Scenes) do
|
||||
if mapScene.SceneType == 2 then
|
||||
nBuildId2 = mapScene.BuildId
|
||||
if mapScene.SceneType == 2 and mapScene.Build ~= nil then
|
||||
nBuildId2 = mapScene.Build.BuildId or 0
|
||||
end
|
||||
if mapScene.SceneType == 1 then
|
||||
nBuildId1 = mapScene.BuildId
|
||||
if mapScene.Build ~= nil then
|
||||
nBuildId1 = mapScene.Build.BuildId or 0
|
||||
end
|
||||
mapSceneFirst = mapScene
|
||||
end
|
||||
end
|
||||
@@ -127,7 +137,7 @@ function PlayerVampireSurvivorData:ReEnterVampireSurvivor(nVampireId)
|
||||
self.curLevel:InitReEnter(self, netMsg.Id, nBuildId1, nBuildId2, netMsg.Events, netMsg.Reward, netMsg.FateCardIds, netMsg.ClientData, mapSceneFirst)
|
||||
end
|
||||
end
|
||||
PlayerData.Build:GetAllBuildBriefData(GetAllBuildCallback)
|
||||
PlayerData.Build:GetSelectableBuildBriefData(GetAllBuildCallback, AllEnum.RegionBossFormationType.Vampire)
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.vampire_survivor_info_req, {}, nil, NetCallback)
|
||||
end
|
||||
|
||||
@@ -34,6 +34,7 @@ function PlayerVoiceData:Init()
|
||||
self.nNpcId = 0
|
||||
self.nNPCSkinId = 0
|
||||
self.bStartBoardClickTimer = false
|
||||
self._bBoardFreeTimerPaused = false
|
||||
self.nContinuousClickCount = 0
|
||||
self.nBoardClickTime = 0
|
||||
self.nBoardFreeTime = 0
|
||||
@@ -201,11 +202,17 @@ function PlayerVoiceData:StartBoardFreeTimer(nNpcId, nSkinId)
|
||||
self.nNPCSkinId = 0
|
||||
end
|
||||
self.bStartBoardClickTimer = true
|
||||
if self._bBoardFreeTimerPaused then
|
||||
return
|
||||
end
|
||||
if nil == self.boardFreeTimer and self.nTriggerFreeVoiceState ~= board_free_trigger_ex_hang then
|
||||
self.boardFreeTimer = TimerManager.Add(0, 0.1, self, self.CheckBoardFree, true, true, false)
|
||||
end
|
||||
end
|
||||
function PlayerVoiceData:CheckBoardFree()
|
||||
if self._bBoardFreeTimerPaused then
|
||||
return
|
||||
end
|
||||
self.nBoardFreeTime = self.nBoardFreeTime + 0.1
|
||||
if self.nBoardFreeTime >= getBoardClickFreeTime(self.bNpc) then
|
||||
self:ResetBoardFreeTimer()
|
||||
@@ -218,6 +225,20 @@ function PlayerVoiceData:CheckBoardFree()
|
||||
end
|
||||
end
|
||||
end
|
||||
function PlayerVoiceData:PauseBoardFreeTimer()
|
||||
self._bBoardFreeTimerPaused = true
|
||||
self:ResetBoardFreeTimer()
|
||||
self:ResetBoardPlayTimer()
|
||||
end
|
||||
function PlayerVoiceData:ResumeBoardFreeTimer()
|
||||
if not self._bBoardFreeTimerPaused then
|
||||
return
|
||||
end
|
||||
self._bBoardFreeTimerPaused = false
|
||||
if self.bStartBoardClickTimer then
|
||||
self:StartBoardFreeTimer()
|
||||
end
|
||||
end
|
||||
function PlayerVoiceData:ResetBoardFreeTimer()
|
||||
if nil ~= self.boardFreeTimer then
|
||||
TimerManager.Remove(self.boardFreeTimer, false)
|
||||
@@ -226,6 +247,9 @@ function PlayerVoiceData:ResetBoardFreeTimer()
|
||||
self.nBoardFreeTime = 0
|
||||
end
|
||||
function PlayerVoiceData:StartBoardPlayTimer()
|
||||
if self._bBoardFreeTimerPaused then
|
||||
return
|
||||
end
|
||||
if nil == self.boardPlayTimer then
|
||||
self.boardPlayTimer = TimerManager.Add(1, self.nVoiceDuration, nil, function()
|
||||
self:StartBoardFreeTimer()
|
||||
@@ -456,6 +480,9 @@ function PlayerVoiceData:OnEvent_UIOperate()
|
||||
end
|
||||
end
|
||||
function PlayerVoiceData:OnEvent_AvgVoiceDuration(nDuration)
|
||||
if self._bBoardFreeTimerPaused then
|
||||
return
|
||||
end
|
||||
self:ResetBoardPlayTimer()
|
||||
self.nVoiceDuration = nDuration
|
||||
if self.bStartBoardClickTimer and self.nTriggerFreeVoiceState ~= board_free_trigger_ex_hang then
|
||||
|
||||
@@ -1,18 +1,26 @@
|
||||
local PlayerSoldierData = class("PlayerSoldierData")
|
||||
local PlayerSoldierQuestData = require("GameCore.Data.DataClass.Soldier.PlayerSoldierQuestData")
|
||||
local PlayerSoldierRecommendData = require("GameCore.Data.DataClass.Soldier.PlayerSoldierRecommendData")
|
||||
local PlayerSoldierTechnologyData = require("GameCore.Data.DataClass.Soldier.PlayerSoldierTechnologyData")
|
||||
function PlayerSoldierData:Init()
|
||||
self.questData = PlayerSoldierQuestData.new()
|
||||
self.recommendData = PlayerSoldierRecommendData.new()
|
||||
self.questData:InitData()
|
||||
self.technologyData = PlayerSoldierTechnologyData.new()
|
||||
self.recommendData:InitData()
|
||||
self.technologyData:InitData()
|
||||
self.nCurSelectSeasonId = 0
|
||||
self.nSeasonType = 0
|
||||
self.nRewardLv = 0
|
||||
self.nReceivedRewardLv = 0
|
||||
self.nRewardExp = 0
|
||||
self.nHighestChallengeId = 0
|
||||
self.nGradeChallengeExp = 0
|
||||
self.curChallengeData = {
|
||||
nGradeChallengeId = 0,
|
||||
nStage = 0,
|
||||
nNodeIndex = 0
|
||||
}
|
||||
self.curLevel = nil
|
||||
self.nRewardExp = 0
|
||||
self.tbGuideData = {}
|
||||
self:InitConfig()
|
||||
end
|
||||
function PlayerSoldierData:UnInit()
|
||||
@@ -52,6 +60,27 @@ function PlayerSoldierData:InitConfig()
|
||||
CacheTable.SetData("_SoldierChessType", mapLine.ChessType, mapLine)
|
||||
end
|
||||
ForEachTableLine(ConfigTable.Get("SoldierChessType"), func_ForEach_SoldierChessType)
|
||||
local func_ForEach_SoldierCheckStageAddScore = function(mapLine)
|
||||
if nil == CacheTable.GetData("_SoldierCheckStageAddScore", mapLine.Group) then
|
||||
CacheTable.SetData("_SoldierCheckStageAddScore", mapLine.Group, {})
|
||||
end
|
||||
CacheTable.InsertData("_SoldierCheckStageAddScore", mapLine.Group, mapLine)
|
||||
end
|
||||
ForEachTableLine(ConfigTable.Get("SoldierCheckStageAddScore"), func_ForEach_SoldierCheckStageAddScore)
|
||||
end
|
||||
function PlayerSoldierData:UpdateSoldierState(mapMsgData)
|
||||
self.nCurSelectSeasonId = mapMsgData.CurSeasonId
|
||||
self:SetCurGradeChallengeData(mapMsgData.CurGradeChallengeId, mapMsgData.Stage, mapMsgData.NodeIndex)
|
||||
end
|
||||
function PlayerSoldierData:SetCurSelectSeasonId(nSeasonId)
|
||||
self.nCurSelectSeasonId = nSeasonId or 0
|
||||
local mapData = ConfigTable.GetData("SoldierSeason", nSeasonId) or {} or {}
|
||||
if mapData ~= nil then
|
||||
self.nSeasonType = mapData.Season
|
||||
end
|
||||
end
|
||||
function PlayerSoldierData:GetCurSelectSeasonId()
|
||||
return self.nCurSelectSeasonId or 0
|
||||
end
|
||||
function PlayerSoldierData:GetCurLevelData()
|
||||
return self.curLevel
|
||||
@@ -59,9 +88,38 @@ end
|
||||
function PlayerSoldierData:CheckInSoldierLevel()
|
||||
return self:GetCurGradeChallengeId() ~= 0
|
||||
end
|
||||
function PlayerSoldierData:EnterSoldier(nSeasonId, nGradeChallengeId, callback)
|
||||
function PlayerSoldierData:RefreshRewardRedDot()
|
||||
RedDotManager.SetValid(RedDotDefine.Soldier_TotalReward, nil, self.nReceivedRewardLv < self.nRewardLv)
|
||||
end
|
||||
function PlayerSoldierData:RequestSoldierSeasonInfo(callback)
|
||||
local cb = function(_, netMsg)
|
||||
self.nRewardLv = netMsg.RewardLv
|
||||
self.nReceivedRewardLv = netMsg.CurRewardLv
|
||||
self.nRewardExp = netMsg.RewardExp
|
||||
self.nHighestChallengeId = netMsg.CurGradeChallengeId
|
||||
self.nGradeChallengeExp = netMsg.CurGradeExp
|
||||
if self.nHighestChallengeId == nil or self.nHighestChallengeId == 0 then
|
||||
local nMinId = math.huge
|
||||
ForEachTableLine(ConfigTable.Get("SoldierGradeChallenge"), function(mapLine)
|
||||
if mapLine.Id < nMinId and mapLine.Season == self.nCurSelectSeasonId then
|
||||
nMinId = mapLine.Id
|
||||
end
|
||||
end)
|
||||
self.nHighestChallengeId = nMinId
|
||||
end
|
||||
PlayerData.Guide:SetGuideNewbie(netMsg.Newbies)
|
||||
self:RefreshRewardRedDot()
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.soldier_season_info_req, {
|
||||
Value = self.nCurSelectSeasonId
|
||||
}, nil, cb)
|
||||
end
|
||||
function PlayerSoldierData:EnterSoldier(nGradeChallengeId, callback)
|
||||
if self:GetCurGradeChallengeId() == 0 then
|
||||
self:SendApply(nSeasonId, nGradeChallengeId, callback)
|
||||
self:SendApply(self.nCurSelectSeasonId, nGradeChallengeId, callback)
|
||||
else
|
||||
self:SendInfo(callback)
|
||||
end
|
||||
@@ -83,7 +141,7 @@ function PlayerSoldierData:SendApply(nSeasonId, nGradeChallengeId, callback)
|
||||
if self.curLevel == nil then
|
||||
self.curLevel = require("Game.Adventure.Soldier.SoldierLevelData").new()
|
||||
end
|
||||
self.curLevel:Init(self, netMsg.Info, netMsg.Chess, netMsg.CoinQty)
|
||||
self.curLevel:Init(self, netMsg.Info, netMsg.Change, true)
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
@@ -103,32 +161,7 @@ function PlayerSoldierData:SendInfo(callback)
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.soldier_info_req, {}, nil, netCallback)
|
||||
end
|
||||
function PlayerSoldierData:SendStepOut(tbMain, tbSup, tbWaiting, callback)
|
||||
local tbDeploy = {}
|
||||
tbDeploy.Master = {}
|
||||
tbDeploy.Assist = {}
|
||||
tbDeploy.Waiting = {}
|
||||
for _, v in ipairs(tbMain) do
|
||||
table.insert(tbDeploy.Master, {
|
||||
Id = v.nId,
|
||||
Qty = 1,
|
||||
Star = v.nStar
|
||||
})
|
||||
end
|
||||
for _, v in ipairs(tbSup) do
|
||||
table.insert(tbDeploy.Assist, {
|
||||
Id = v.nId,
|
||||
Qty = 1,
|
||||
Star = v.nStar
|
||||
})
|
||||
end
|
||||
for _, v in ipairs(tbWaiting) do
|
||||
table.insert(tbDeploy.Waiting, {
|
||||
Id = v.nId,
|
||||
Qty = 1,
|
||||
Star = v.nStar
|
||||
})
|
||||
end
|
||||
function PlayerSoldierData:SendStepOut(callback)
|
||||
local netCallback = function(_, netMsg)
|
||||
if self.curLevel ~= nil then
|
||||
self.curLevel:StepOut()
|
||||
@@ -137,99 +170,50 @@ function PlayerSoldierData:SendStepOut(tbMain, tbSup, tbWaiting, callback)
|
||||
callback()
|
||||
end
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.soldier_step_out_req, {Deploy = tbDeploy}, nil, netCallback)
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.soldier_step_out_req, {}, nil, netCallback)
|
||||
end
|
||||
function PlayerSoldierData:SendGiveUp(callback)
|
||||
local netCallback = function(_, netMsg)
|
||||
self:SetCurGradeChallengeData(0, 0, 0)
|
||||
self:ClearInSoldierRecommendData()
|
||||
if netMsg.Change ~= nil then
|
||||
local mapDecodedChangeInfo = UTILS.DecodeChangeInfo(netMsg.Change)
|
||||
HttpNetHandler.ProcChangeInfo(mapDecodedChangeInfo)
|
||||
end
|
||||
if self.curLevel ~= nil then
|
||||
self.curLevel:GiveUp(netMsg)
|
||||
else
|
||||
local mapData = {
|
||||
nTotalScore = netMsg.TotalScore,
|
||||
nRewardScore = netMsg.RewardScore
|
||||
local tbSettle = {
|
||||
nPassedNode = netMsg.PassedNode,
|
||||
nRemainingHp = netMsg.RemainingHp,
|
||||
nCheckStageDps = netMsg.CheckStageDps,
|
||||
nCheckStageTime = netMsg.CheckStageTime,
|
||||
nChessTotalCost = netMsg.ChessTotalCost,
|
||||
nGetSchedule = netMsg.GetSchedule,
|
||||
nGetTechPoint = netMsg.GetTechPoint,
|
||||
nGetGradeExp = netMsg.GetGradeExp,
|
||||
nCurGradeChallengeId = netMsg.CurGradeChallengeId,
|
||||
nCurGradeExp = netMsg.CurGradeExp,
|
||||
nEndingId = netMsg.EndingId,
|
||||
nTotalCoinQty = netMsg.TotalCoinQty
|
||||
}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.SoldierBattleResult, AllEnum.SoldierResultType.ChallengeFail, mapData)
|
||||
end
|
||||
self.technologyData:RefreshRedDot(self.nCurSelectSeasonId)
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.soldier_give_up_req, {}, nil, netCallback)
|
||||
end
|
||||
function PlayerSoldierData:SetQuestDataList(questDataList)
|
||||
if questDataList == nil then
|
||||
return
|
||||
end
|
||||
self.questData:SetQuestDataList(questDataList)
|
||||
end
|
||||
function PlayerSoldierData:SetQuestData(questData)
|
||||
if questData == nil then
|
||||
return
|
||||
end
|
||||
self.questData:SetQuestData(questData)
|
||||
end
|
||||
function PlayerSoldierData:GetAllQuestData()
|
||||
if self.questData == nil then
|
||||
return {}
|
||||
end
|
||||
return self.questData:GetAllQuestData()
|
||||
end
|
||||
function PlayerSoldierData:GetQuestData()
|
||||
if self.questData == nil then
|
||||
return {}
|
||||
end
|
||||
return self.questData:GetAllQuestData()
|
||||
end
|
||||
function PlayerSoldierData:GetQuestDataByGroupId(nGroupId)
|
||||
if self.questData == nil then
|
||||
return {}
|
||||
end
|
||||
return self.questData:GetQuestDataListByGroupId(nGroupId)
|
||||
end
|
||||
function PlayerSoldierData:IsViewedGroupId(nGroupId)
|
||||
if self.questData == nil then
|
||||
return false
|
||||
end
|
||||
return self.questData:IsViewedGroupId(nGroupId)
|
||||
end
|
||||
function PlayerSoldierData:SetViewedGroupId(nGroupId)
|
||||
if self.questData == nil then
|
||||
return
|
||||
end
|
||||
self.questData:SetViewedGroupId(nGroupId)
|
||||
end
|
||||
function PlayerSoldierData:IsGroupLock(nGroupId)
|
||||
if self.questData == nil then
|
||||
return false
|
||||
end
|
||||
return self.questData:IsGroupLock(nGroupId)
|
||||
end
|
||||
function PlayerSoldierData:GetAllQuestCount()
|
||||
if self.questData == nil then
|
||||
return 0
|
||||
end
|
||||
return self.questData:GetAllQuestCount()
|
||||
end
|
||||
function PlayerSoldierData:GetAllReceivedCount()
|
||||
if self.questData == nil then
|
||||
return 0
|
||||
end
|
||||
return self.questData:GetAllReceivedCount()
|
||||
end
|
||||
function PlayerSoldierData:ReceiveQuestReward(nGroupId, nId, callback)
|
||||
if self.questData == nil then
|
||||
return
|
||||
end
|
||||
self.questData:ReceiveQuestReward(nGroupId, nId, callback)
|
||||
end
|
||||
function PlayerSoldierData:SetHighestChallengeId(nHighestChallengeId)
|
||||
self.nHighestChallengeId = math.max(self.nHighestChallengeId, nHighestChallengeId)
|
||||
end
|
||||
function PlayerSoldierData:GetHighestChallengeId()
|
||||
return self.nHighestChallengeId
|
||||
end
|
||||
function PlayerSoldierData:GetChallengeExp()
|
||||
return self.nGradeChallengeExp
|
||||
end
|
||||
function PlayerSoldierData:SetCurGradeChallengeData(nGradeChallengeId, nStage, nNodeIndex)
|
||||
self.curChallengeData = {
|
||||
nGradeChallengeId = nGradeChallengeId,
|
||||
@@ -241,7 +225,30 @@ function PlayerSoldierData:GetCurChallengeData()
|
||||
return self.curChallengeData
|
||||
end
|
||||
function PlayerSoldierData:GetCurGradeChallengeId()
|
||||
return self.curChallengeData.nGradeChallengeId
|
||||
return self.curChallengeData and self.curChallengeData.nGradeChallengeId or 0
|
||||
end
|
||||
function PlayerSoldierData:GetCheckStageAddScoreId(nDamage, nTime)
|
||||
local nGradeChallengeId = self.curChallengeData and self.curChallengeData.nGradeChallengeId or 0
|
||||
local mapChallenge = ConfigTable.GetData("SoldierGradeChallenge", nGradeChallengeId)
|
||||
if mapChallenge == nil then
|
||||
return 0, 0
|
||||
end
|
||||
local tbList = CacheTable.GetData("_SoldierCheckStageAddScore", mapChallenge.CheckStageGroupId)
|
||||
if tbList == nil then
|
||||
return 0, 0
|
||||
end
|
||||
nDamage = nDamage or 0
|
||||
nTime = nTime or 0
|
||||
local nDamageId, nTimeId = 0, 0
|
||||
for _, v in ipairs(tbList) do
|
||||
if nDamage >= v.DPS then
|
||||
nDamageId = v.Id
|
||||
end
|
||||
if nTime >= v.Duration then
|
||||
nTimeId = v.Id
|
||||
end
|
||||
end
|
||||
return nDamageId, nTimeId
|
||||
end
|
||||
function PlayerSoldierData:CheckChallengeUnlocked(nGradeChallengeId)
|
||||
local config = ConfigTable.GetData("SoldierGradeChallenge", nGradeChallengeId)
|
||||
@@ -260,6 +267,65 @@ function PlayerSoldierData:CheckChallengeUnlocked(nGradeChallengeId)
|
||||
end
|
||||
return config.UnlockGradeLevel <= highestChallengeConfig.Id
|
||||
end
|
||||
function PlayerSoldierData:GetTotalRewardLevel()
|
||||
local nPrevLevelExp = 0
|
||||
local nNextLevelExp = 0
|
||||
local nNextLevelTotalReward
|
||||
ForEachTableLine(ConfigTable.Get("SoldierTotalReward"), function(mapData)
|
||||
if mapData.Level == self.nRewardLv and self.nCurSelectSeasonId == mapData.SeasonId then
|
||||
nPrevLevelExp = mapData.NeedExp
|
||||
elseif self.nCurSelectSeasonId == mapData.SeasonId and mapData.Level == self.nRewardLv + 1 then
|
||||
nNextLevelExp = mapData.NeedExp
|
||||
nNextLevelTotalReward = {
|
||||
Tid = mapData.RewardId,
|
||||
Qty = mapData.RewardQty
|
||||
}
|
||||
end
|
||||
end)
|
||||
return self.nRewardLv, self.nRewardExp, nNextLevelExp, nNextLevelTotalReward
|
||||
end
|
||||
function PlayerSoldierData:GetReceivedTotalRewardLevel()
|
||||
return self.nReceivedRewardLv
|
||||
end
|
||||
function PlayerSoldierData:GetCurRewardLv()
|
||||
return self.nRewardLv or 0
|
||||
end
|
||||
function PlayerSoldierData:RequestGetTotalReward(callback)
|
||||
local cb = function(_, msg)
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
UTILS.OpenReceiveByChangeInfo(msg.Change)
|
||||
self.nReceivedRewardLv = msg.CurRewardLv
|
||||
self:RefreshRewardRedDot()
|
||||
EventManager.Hit(EventId.Soldier_Level_GetReward)
|
||||
end
|
||||
local cfg = ConfigTable.GetData("SoldierSeason", self.nCurSelectSeasonId)
|
||||
if cfg == nil then
|
||||
return
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.soldier_season_reward_receive_req, {
|
||||
Value = cfg.Season
|
||||
}, nil, cb)
|
||||
end
|
||||
function PlayerSoldierData:SendFavoriteRecommend(sCode, callback)
|
||||
self.recommendData:SendFavoriteRecommend(sCode, callback)
|
||||
end
|
||||
function PlayerSoldierData:SendUnfavoriteRecommend(sCode, callback)
|
||||
self.recommendData:SendUnfavoriteRecommend(sCode, callback)
|
||||
end
|
||||
function PlayerSoldierData:RequestRecommendList(callback)
|
||||
self.recommendData:RequestRecommendList(callback)
|
||||
end
|
||||
function PlayerSoldierData:GetCurRecommendList()
|
||||
return self.recommendData:GetCurRecommendList()
|
||||
end
|
||||
function PlayerSoldierData:GetSystemRecommendList()
|
||||
return self.recommendData:GetSystemRecommendList()
|
||||
end
|
||||
function PlayerSoldierData:GetCollectRecommendList()
|
||||
return self.recommendData:GetCollectRecommendList()
|
||||
end
|
||||
function PlayerSoldierData:SetRecommendData(nRecommendId, bInSoldier)
|
||||
self.recommendData:SetRecommendData(nRecommendId, bInSoldier)
|
||||
end
|
||||
@@ -278,15 +344,90 @@ end
|
||||
function PlayerSoldierData:CheckChessRecommendState(nChessId)
|
||||
return self.recommendData:CheckChessRecommendState(nChessId)
|
||||
end
|
||||
function PlayerSoldierData:CheckStarterCardRecommendState(nStarterCardId)
|
||||
return self.recommendData:CheckStarterCardRecommendState(nStarterCardId)
|
||||
end
|
||||
function PlayerSoldierData:CheckStrategyCardRecommendState(nStrategyCardId)
|
||||
return self.recommendData:CheckStrategyCardRecommendState(nStrategyCardId)
|
||||
end
|
||||
function PlayerSoldierData:CheckPartnerRecommendState(nPartnerType)
|
||||
return self.recommendData:CheckPartnerRecommendState(nPartnerType)
|
||||
end
|
||||
function PlayerSoldierData:GetTechActiveClientEffect()
|
||||
if self.nCurSelectSeasonId == 0 then
|
||||
return
|
||||
end
|
||||
return self.technologyData:GetActiveClientEffect(self.nCurSelectSeasonId)
|
||||
end
|
||||
function PlayerSoldierData:CheckTechNodeActiveById(nTechNodeId)
|
||||
if self.nCurSelectSeasonId == 0 then
|
||||
return
|
||||
end
|
||||
return self.technologyData:CheckTechNodeActiveById(self.nCurSelectSeasonId, nTechNodeId)
|
||||
end
|
||||
function PlayerSoldierData:GetClientBattleBuffList()
|
||||
if self.nCurSelectSeasonId == 0 then
|
||||
return
|
||||
end
|
||||
return self.technologyData:GetClientBattleBuffList(self.nCurSelectSeasonId)
|
||||
end
|
||||
function PlayerSoldierData:GetTechNodes()
|
||||
if self.nCurSelectSeasonId == 0 then
|
||||
return
|
||||
end
|
||||
return self.technologyData:GetTechNodesBySeason(self.nCurSelectSeasonId)
|
||||
end
|
||||
function PlayerSoldierData:GetTechNode(nId)
|
||||
if self.nCurSelectSeasonId == 0 then
|
||||
return
|
||||
end
|
||||
return self.technologyData:GetTechNode(nId, self.nCurSelectSeasonId)
|
||||
end
|
||||
function PlayerSoldierData:GetTechActiveNodeCount()
|
||||
if self.nCurSelectSeasonId == 0 then
|
||||
return 0, 0
|
||||
end
|
||||
return self.technologyData:GetActiveNodeCount(self.nCurSelectSeasonId)
|
||||
end
|
||||
function PlayerSoldierData:GetActiveNodePreview()
|
||||
if self.nCurSelectSeasonId == 0 then
|
||||
return
|
||||
end
|
||||
return self.technologyData:GetActiveNodePreview(self.nCurSelectSeasonId)
|
||||
end
|
||||
function PlayerSoldierData:SendSoldierTechDetailReq(callback)
|
||||
if self.nCurSelectSeasonId == 0 then
|
||||
return
|
||||
end
|
||||
self.technologyData:SendSoldierTechDetailReq(self.nCurSelectSeasonId, callback)
|
||||
end
|
||||
function PlayerSoldierData:SendSoldierTechNodeUnlockReq(nId, callback)
|
||||
return self.technologyData:SendSoldierTechNodeUnlockReq(nId, callback)
|
||||
end
|
||||
function PlayerSoldierData:CheckBossTemplateUnlocked(nId)
|
||||
local mapCfg = ConfigTable.GetData("SoldierBossTemplate", nId)
|
||||
if mapCfg ~= nil then
|
||||
if mapCfg.IsUnlock == true then
|
||||
return true
|
||||
end
|
||||
local nTechNodeId = mapCfg.TechNodeId
|
||||
if nTechNodeId ~= 0 then
|
||||
return self:CheckTechNodeActiveById(nTechNodeId)
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
function PlayerSoldierData:GetAllBossTemplates()
|
||||
local tbList = {}
|
||||
local collect = function(mapCfg)
|
||||
table.insert(tbList, {
|
||||
nId = mapCfg.Id,
|
||||
nUnlock = self:CheckBossTemplateUnlocked(mapCfg.Id) and 1 or 0
|
||||
})
|
||||
end
|
||||
ForEachTableLine(ConfigTable.Get("SoldierBossTemplate"), collect)
|
||||
table.sort(tbList, function(a, b)
|
||||
if a.nUnlock == b.nUnlock then
|
||||
return a.nId < b.nId
|
||||
end
|
||||
return a.nUnlock > b.nUnlock
|
||||
end)
|
||||
return tbList
|
||||
end
|
||||
function PlayerSoldierData:GetCurChallengeState()
|
||||
if self.curChallengeData == nil then
|
||||
return 0, 0
|
||||
@@ -337,7 +478,6 @@ function PlayerSoldierData:CheckGMSkipNodeRefreshAllowed()
|
||||
local tbBlockPanels = {
|
||||
PanelId.SoldierBattlePanel,
|
||||
PanelId.SoldierBattleEventPanel,
|
||||
PanelId.SoldierSelectPolicy,
|
||||
PanelId.SoldierBattleResult
|
||||
}
|
||||
for _, nPanelId in ipairs(tbBlockPanels) do
|
||||
@@ -366,16 +506,15 @@ function PlayerSoldierData:OnSoldierInfoNotify(mapSoldierInfo)
|
||||
self.curLevel = require("Game.Adventure.Soldier.SoldierLevelData").new()
|
||||
self.curLevel:Init(self, mapSoldierInfo)
|
||||
end
|
||||
function PlayerSoldierData:OnBuffCardAddNotify(mapCardData)
|
||||
if mapCardData == nil then
|
||||
function PlayerSoldierData:OnBuffAddNotify(mapBuffData)
|
||||
if mapBuffData == nil then
|
||||
return
|
||||
end
|
||||
if self.curLevel == nil then
|
||||
printWarn("[Soldier] receive buff card add notify, but curLevel is nil")
|
||||
printWarn("[Soldier] receive buff add notify, but curLevel is nil")
|
||||
return
|
||||
end
|
||||
self.curLevel:UpdateCardList(mapCardData)
|
||||
EventManager.Hit("SoldierBuffCardChange")
|
||||
self.curLevel:UpdateBuff(mapBuffData)
|
||||
end
|
||||
function PlayerSoldierData:OnItemChangeNotify(mapChangeInfo)
|
||||
if mapChangeInfo == nil then
|
||||
@@ -421,6 +560,18 @@ function PlayerSoldierData:ApplyGMSoldierHp(nHp)
|
||||
end
|
||||
self.curLevel:UpdateGMSoldierHp(nHp)
|
||||
end
|
||||
function PlayerSoldierData:RefreshRedDot()
|
||||
if self.nCurSelectSeasonId == 0 then
|
||||
return
|
||||
end
|
||||
self.technologyData:RefreshRedDot(self.nCurSelectSeasonId)
|
||||
end
|
||||
function PlayerSoldierData:SetGuideData(nGuideId, param)
|
||||
self.tbGuideData[nGuideId] = param
|
||||
end
|
||||
function PlayerSoldierData:GetGuideData(nGuideId)
|
||||
return self.tbGuideData[nGuideId]
|
||||
end
|
||||
function PlayerSoldierData:GMEnterSoldier(tbDeploy)
|
||||
if self.curLevel == nil then
|
||||
self.curLevel = require("Game.Adventure.Soldier.SoldierLevelData").new()
|
||||
|
||||
@@ -1,161 +0,0 @@
|
||||
local PlayerSoldierQuestData = class("PlayerSoldierQuestData")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local RapidJson = require("rapidjson")
|
||||
function PlayerSoldierQuestData:ctor()
|
||||
end
|
||||
function PlayerSoldierQuestData:InitData()
|
||||
self.tbAllQuestData = {}
|
||||
self.tbEnterQuestGroupId = nil
|
||||
self:InitConfig()
|
||||
end
|
||||
function PlayerSoldierQuestData:InitConfig()
|
||||
end
|
||||
function PlayerSoldierQuestData:GetEnterQuestGroupId()
|
||||
if self.tbEnterQuestGroupId ~= nil then
|
||||
return self.tbEnterQuestGroupId
|
||||
end
|
||||
local sJson = LocalData.GetPlayerLocalData("SoldierQuestGroupId")
|
||||
local tb = decodeJson(sJson)
|
||||
if type(tb) == "table" then
|
||||
self.tbEnterQuestGroupId = tb
|
||||
end
|
||||
return self.tbEnterQuestGroupId or {}
|
||||
end
|
||||
function PlayerSoldierQuestData:SetQuestDataList(questDataList)
|
||||
for _, questData in ipairs(questDataList) do
|
||||
self:SetQuestData(questData)
|
||||
end
|
||||
end
|
||||
function PlayerSoldierQuestData:SetQuestData(questData)
|
||||
local questConfig = ConfigTable.GetData("SoldierQuest", questData.Id)
|
||||
if questConfig == nil then
|
||||
return
|
||||
end
|
||||
if self:IsGroupLock(questConfig.Group) then
|
||||
return
|
||||
end
|
||||
if self.tbAllQuestData[questConfig.Group] == nil then
|
||||
self.tbAllQuestData[questConfig.Group] = {}
|
||||
end
|
||||
local nState = self:QuestStateServer2Client(questData.Status)
|
||||
self.tbAllQuestData[questConfig.Group][questData.Id] = {
|
||||
nId = questData.Id,
|
||||
nStatus = nState,
|
||||
Progress = questData.Progress
|
||||
}
|
||||
RedDotManager.SetValid(RedDotDefine.Solider_Quest, {
|
||||
questConfig.Group,
|
||||
questData.Id
|
||||
}, nState == AllEnum.ActQuestStatus.Complete)
|
||||
if not self:IsViewedGroupId(questConfig.Group) then
|
||||
RedDotManager.SetValid(RedDotDefine.Solider_Quest_New_Group, questConfig.Group, true)
|
||||
end
|
||||
end
|
||||
function PlayerSoldierQuestData:QuestStateServer2Client(nStatus)
|
||||
if nStatus == 0 then
|
||||
return AllEnum.ActQuestStatus.UnComplete
|
||||
elseif nStatus == 1 then
|
||||
return AllEnum.ActQuestStatus.Complete
|
||||
else
|
||||
return AllEnum.ActQuestStatus.Received
|
||||
end
|
||||
end
|
||||
function PlayerSoldierQuestData:GetAllQuestData()
|
||||
return self.tbAllQuestData
|
||||
end
|
||||
function PlayerSoldierQuestData:GetQuestData(nGroupId, nId)
|
||||
return self.tbAllQuestData[nGroupId][nId]
|
||||
end
|
||||
function PlayerSoldierQuestData:GetQuestDataListByGroupId(nGroupId)
|
||||
return self.tbAllQuestData[nGroupId]
|
||||
end
|
||||
function PlayerSoldierQuestData:IsViewedGroupId(nGroupId)
|
||||
local tbEnterQuestGroupId = self:GetEnterQuestGroupId()
|
||||
return table.indexof(tbEnterQuestGroupId, nGroupId) > 0
|
||||
end
|
||||
function PlayerSoldierQuestData:SetViewedGroupId(nGroupId)
|
||||
local tbEnterQuestGroupId = self:GetEnterQuestGroupId()
|
||||
if table.indexof(tbEnterQuestGroupId, nGroupId) > 0 then
|
||||
return
|
||||
else
|
||||
table.insert(tbEnterQuestGroupId, nGroupId)
|
||||
RedDotManager.SetValid(RedDotDefine.Solider_Quest_New_Group, nGroupId, false)
|
||||
end
|
||||
LocalData.SetPlayerLocalData("SoldierQuestGroupId", RapidJson.encode(tbEnterQuestGroupId))
|
||||
end
|
||||
function PlayerSoldierQuestData:IsGroupLock(nGroupId)
|
||||
return self:GetGroupStartTime(nGroupId) > ClientManager.serverTimeStamp
|
||||
end
|
||||
function PlayerSoldierQuestData:GetGroupStartTime(nGroupId)
|
||||
local groupConfig = ConfigTable.GetData("SoldierQuestGroup", nGroupId)
|
||||
if groupConfig == nil then
|
||||
return 0
|
||||
end
|
||||
if 0 >= groupConfig.OpenDay then
|
||||
return 0
|
||||
end
|
||||
local actData = PlayerData.Activity:GetActivityDataByType(GameEnum.activityType.Soldier)
|
||||
if actData == nil then
|
||||
return 0
|
||||
end
|
||||
return groupConfig.OpenDay * 86400 + actData.nOpenTime
|
||||
end
|
||||
function PlayerSoldierQuestData:GetAllQuestCount()
|
||||
local nCount = 0
|
||||
for _, v in pairs(self.tbAllQuestData) do
|
||||
for _, v2 in pairs(v) do
|
||||
nCount = nCount + 1
|
||||
end
|
||||
end
|
||||
return nCount
|
||||
end
|
||||
function PlayerSoldierQuestData:GetAllReceivedCount()
|
||||
local nCount = 0
|
||||
for _, v in pairs(self.tbAllQuestData) do
|
||||
for _, v2 in pairs(v) do
|
||||
if v2.nStatus == AllEnum.ActQuestStatus.Received then
|
||||
nCount = nCount + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
return nCount
|
||||
end
|
||||
function PlayerSoldierQuestData:ReceiveQuestReward(nGroupId, nId, callback)
|
||||
local msgCallback = function(_, msgData)
|
||||
local mapDecodedChangeInfo = UTILS.DecodeChangeInfo(msgData)
|
||||
HttpNetHandler.ProcChangeInfo(mapDecodedChangeInfo)
|
||||
UTILS.OpenReceiveByChangeInfo(msgData)
|
||||
if nId ~= 0 then
|
||||
self.tbAllQuestData[nGroupId][nId].nStatus = AllEnum.ActQuestStatus.Received
|
||||
self.tbAllQuestData[nGroupId][nId].Progress[1].Cur = 0
|
||||
self.tbAllQuestData[nGroupId][nId].Progress[1].Max = 0
|
||||
RedDotManager.SetValid(RedDotDefine.Solider_Quest, {nGroupId, nId}, false)
|
||||
else
|
||||
for _, v in pairs(self.tbAllQuestData[nGroupId]) do
|
||||
if v.nStatus == AllEnum.ActQuestStatus.Complete then
|
||||
v.nStatus = AllEnum.ActQuestStatus.Received
|
||||
v.Progress[1].Cur = 0
|
||||
v.Progress[1].Max = 0
|
||||
RedDotManager.SetValid(RedDotDefine.Solider_Quest, {
|
||||
nGroupId,
|
||||
v.nId
|
||||
}, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
local actData = PlayerData.Activity:GetActivityDataByType(GameEnum.activityType.Soldier)
|
||||
if actData == nil then
|
||||
return
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.activity_soldier_quest_reward_receive_req, {
|
||||
ActivityId = actData.nActId,
|
||||
GroupId = nGroupId,
|
||||
QuestId = nId
|
||||
}, nil, msgCallback)
|
||||
end
|
||||
return PlayerSoldierQuestData
|
||||
@@ -8,8 +8,10 @@ function PlayerSoldierRecommendData:InitData()
|
||||
self.nRecommendId = nil
|
||||
self.nInSoldierRecommendId = nil
|
||||
self.bInSoldierChanged = nil
|
||||
self.tbAllRecommendData = {}
|
||||
self:InitConfig()
|
||||
self.tbRecommendList = {}
|
||||
self.tbSystemRecommendList = {}
|
||||
self.mapRecommendDataById = {}
|
||||
self:PreloadSystemRecommendList()
|
||||
self.tbSoldierPositionEffectData = {}
|
||||
local func_ForEach_SoldierPositionEffect = function(mapLineData)
|
||||
if mapLineData.PositionType == GameEnum.SoldierPositionType.FightPosition then
|
||||
@@ -18,71 +20,6 @@ function PlayerSoldierRecommendData:InitData()
|
||||
end
|
||||
ForEachTableLine(DataTable.SoldierPositionEffect, func_ForEach_SoldierPositionEffect)
|
||||
end
|
||||
function PlayerSoldierRecommendData:InitConfig()
|
||||
local func_ForEach_Recommend = function(mapLineData)
|
||||
local RecommendData = {
|
||||
nRecommendId = mapLineData.Id,
|
||||
nCharId = mapLineData.CharacterId,
|
||||
charList = {},
|
||||
nStarterCardId = mapLineData.StarterCard,
|
||||
tbStrategyCardId = mapLineData.StrategyCard,
|
||||
tbPartner = {}
|
||||
}
|
||||
for i = 1, 3 do
|
||||
local charData = mapLineData["Front" .. i]
|
||||
if charData ~= nil then
|
||||
table.insert(RecommendData.charList, {
|
||||
nId = charData[1],
|
||||
nStar = charData[2],
|
||||
nPositionType = 1,
|
||||
nPosIndex = charData[4]
|
||||
})
|
||||
end
|
||||
end
|
||||
local backCharJson = mapLineData.Back
|
||||
local tbBackCharList = {}
|
||||
if backCharJson ~= nil then
|
||||
local tbBackChar = decodeJson(backCharJson)
|
||||
if type(tbBackChar) == "table" then
|
||||
for charId, star in pairs(tbBackChar) do
|
||||
table.insert(tbBackCharList, {
|
||||
nId = tonumber(charId),
|
||||
nStar = tonumber(star),
|
||||
nPositionType = 2,
|
||||
nPosIndex = 0
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
table.sort(tbBackCharList, function(a, b)
|
||||
local aConfig = ConfigTable.GetData("SoldierCharacter", a.nId)
|
||||
local bConfig = ConfigTable.GetData("SoldierCharacter", b.nId)
|
||||
if aConfig.Rarity ~= bConfig.Rarity then
|
||||
return aConfig.Rarity > bConfig.Rarity
|
||||
end
|
||||
return a.nId < b.nId
|
||||
end)
|
||||
for _, charData in ipairs(tbBackCharList) do
|
||||
table.insert(RecommendData.charList, charData)
|
||||
end
|
||||
local tbPartnerAdd = decodeJson(mapLineData.PartnerAdd)
|
||||
local mapExtraPartner = {}
|
||||
for k, v in pairs(tbPartnerAdd) do
|
||||
mapExtraPartner[tonumber(k)] = tonumber(v)
|
||||
end
|
||||
local tbExPartner = {}
|
||||
for partnerId, addLevel in pairs(mapExtraPartner) do
|
||||
local partnerCfg = ConfigTable.GetData("SoldierPartner", partnerId)
|
||||
if partnerCfg then
|
||||
tbExPartner[partnerCfg.PartnerType] = addLevel
|
||||
end
|
||||
end
|
||||
local _, tbUIData = SoldierAttrData.CalcActivePartners(RecommendData.charList, tbExPartner)
|
||||
RecommendData.tbPartner = tbUIData
|
||||
self.tbAllRecommendData[mapLineData.Id] = RecommendData
|
||||
end
|
||||
ForEachTableLine(DataTable.SoldierRecommendBuilds, func_ForEach_Recommend)
|
||||
end
|
||||
function PlayerSoldierRecommendData:SetRecommendData(nRecommendId, bInSoldier)
|
||||
if bInSoldier then
|
||||
self.nInSoldierRecommendId = nRecommendId
|
||||
@@ -101,18 +38,18 @@ function PlayerSoldierRecommendData:GetRecommendData(bInSoldier)
|
||||
if nInSoldierRecommendId == 0 then
|
||||
return nil
|
||||
end
|
||||
return self.tbAllRecommendData[nInSoldierRecommendId]
|
||||
return self:GetRecommendDataById(nInSoldierRecommendId)
|
||||
else
|
||||
if nRecommendId == 0 then
|
||||
return nil
|
||||
end
|
||||
return self.tbAllRecommendData[nRecommendId]
|
||||
return self:GetRecommendDataById(nRecommendId)
|
||||
end
|
||||
else
|
||||
if nRecommendId == 0 then
|
||||
return nil
|
||||
end
|
||||
return self.tbAllRecommendData[nRecommendId]
|
||||
return self:GetRecommendDataById(nRecommendId)
|
||||
end
|
||||
end
|
||||
function PlayerSoldierRecommendData:SaveData()
|
||||
@@ -127,7 +64,7 @@ function PlayerSoldierRecommendData:GetSoldierPositionEffectDataId(nIndex)
|
||||
return self.tbSoldierPositionEffectData[nIndex]
|
||||
end
|
||||
function PlayerSoldierRecommendData:GetAllRecommendData()
|
||||
return self.tbAllRecommendData
|
||||
return self.mapRecommendDataById
|
||||
end
|
||||
function PlayerSoldierRecommendData:ClearInSoldierRecommendData()
|
||||
self.nInSoldierRecommendId = 0
|
||||
@@ -135,13 +72,7 @@ function PlayerSoldierRecommendData:ClearInSoldierRecommendData()
|
||||
self:SaveData()
|
||||
end
|
||||
function PlayerSoldierRecommendData:CheckChessRecommendState(nChessId)
|
||||
local nRecommendId = 0
|
||||
if self:GetInSoldierRecommendId() == 0 then
|
||||
nRecommendId = self:GetRecommendId()
|
||||
else
|
||||
nRecommendId = self:GetInSoldierRecommendId()
|
||||
end
|
||||
local recommendData = self.tbAllRecommendData[nRecommendId]
|
||||
local recommendData = self:GetRecommendData(true)
|
||||
if recommendData == nil then
|
||||
return false
|
||||
end
|
||||
@@ -152,48 +83,8 @@ function PlayerSoldierRecommendData:CheckChessRecommendState(nChessId)
|
||||
end
|
||||
return false
|
||||
end
|
||||
function PlayerSoldierRecommendData:CheckStarterCardRecommendState(nStarterCardId)
|
||||
local nRecommendId = 0
|
||||
if self:GetInSoldierRecommendId() == 0 then
|
||||
nRecommendId = self:GetRecommendId()
|
||||
else
|
||||
nRecommendId = self:GetInSoldierRecommendId()
|
||||
end
|
||||
local recommendData = self.tbAllRecommendData[nRecommendId]
|
||||
if recommendData == nil then
|
||||
return false
|
||||
end
|
||||
if recommendData.nStarterCardId == nStarterCardId then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
function PlayerSoldierRecommendData:CheckStrategyCardRecommendState(nStrategyCardId)
|
||||
local nRecommendId = 0
|
||||
if self:GetInSoldierRecommendId() == 0 then
|
||||
nRecommendId = self:GetRecommendId()
|
||||
else
|
||||
nRecommendId = self:GetInSoldierRecommendId()
|
||||
end
|
||||
local recommendData = self.tbAllRecommendData[nRecommendId]
|
||||
if recommendData == nil then
|
||||
return false
|
||||
end
|
||||
for _, strategyCardId in ipairs(recommendData.tbStrategyCardId) do
|
||||
if strategyCardId == nStrategyCardId then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
function PlayerSoldierRecommendData:CheckPartnerRecommendState(nPartnerType)
|
||||
local nRecommendId = 0
|
||||
if self:GetInSoldierRecommendId() == 0 then
|
||||
nRecommendId = self:GetRecommendId()
|
||||
else
|
||||
nRecommendId = self:GetInSoldierRecommendId()
|
||||
end
|
||||
local recommendData = self.tbAllRecommendData[nRecommendId]
|
||||
local recommendData = self:GetRecommendData(true)
|
||||
if recommendData == nil then
|
||||
return false
|
||||
end
|
||||
@@ -209,25 +100,229 @@ function PlayerSoldierRecommendData:CheckPartnerRecommendState(nPartnerType)
|
||||
end
|
||||
function PlayerSoldierRecommendData:GetRecommendId()
|
||||
if self.nRecommendId == nil then
|
||||
local sJson = LocalData.GetPlayerLocalData("SoldierRecommend_Id") or "0"
|
||||
local nRecommendId = tonumber(decodeJson(sJson)) or 0
|
||||
self.nRecommendId = nRecommendId
|
||||
local sReportId = LocalData.GetPlayerLocalData("SoldierRecommend_Id") or ""
|
||||
self.nRecommendId = sReportId == "0" and 0 or sReportId
|
||||
end
|
||||
return self.nRecommendId
|
||||
end
|
||||
function PlayerSoldierRecommendData:GetInSoldierRecommendId()
|
||||
if self.nInSoldierRecommendId == nil then
|
||||
local sJson = LocalData.GetPlayerLocalData("SoldierInSoldierRecommend_Id") or "0"
|
||||
local nInSoldierRecommendId = tonumber(decodeJson(sJson)) or 0
|
||||
self.nInSoldierRecommendId = nInSoldierRecommendId
|
||||
local sReportId = LocalData.GetPlayerLocalData("SoldierInSoldierRecommend_Id") or ""
|
||||
self.nInSoldierRecommendId = sReportId == "0" and 0 or sReportId
|
||||
end
|
||||
return self.nInSoldierRecommendId
|
||||
end
|
||||
function PlayerSoldierRecommendData:GetInSoldierChanged()
|
||||
if self.bInSoldierChanged == nil then
|
||||
local sJson = LocalData.GetPlayerLocalData("SoldierInSoldierChanged")
|
||||
self.bInSoldierChanged = sJson == true
|
||||
local sValue = LocalData.GetPlayerLocalData("SoldierInSoldierChanged")
|
||||
self.bInSoldierChanged = sValue == true or sValue == "true"
|
||||
end
|
||||
return self.bInSoldierChanged
|
||||
end
|
||||
function PlayerSoldierRecommendData:RequestRecommendList(callback)
|
||||
local cb = function(_, netMsg)
|
||||
self:SetRecommendList(netMsg.Reports or {})
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.soldier_battle_report_favorite_list_req, {}, nil, cb)
|
||||
end
|
||||
function PlayerSoldierRecommendData:SendFavoriteRecommend(sCode, callback)
|
||||
local cb = function(_, netMsg)
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.soldier_battle_report_favorite_req, {Value = sCode}, nil, cb)
|
||||
end
|
||||
function PlayerSoldierRecommendData:SendUnfavoriteRecommend(sCode, callback)
|
||||
local cb = function(_, netMsg)
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.soldier_battle_report_unfavorite_req, {Value = sCode}, nil, cb)
|
||||
end
|
||||
function PlayerSoldierRecommendData:GetCurRecommendList()
|
||||
return self.tbRecommendList
|
||||
end
|
||||
function PlayerSoldierRecommendData:GetCollectRecommendList()
|
||||
return self.tbRecommendList
|
||||
end
|
||||
function PlayerSoldierRecommendData:GetSystemRecommendList()
|
||||
return self.tbSystemRecommendList
|
||||
end
|
||||
function PlayerSoldierRecommendData:SetRecommendList(tbReports)
|
||||
self.tbRecommendList = {}
|
||||
self.mapRecommendDataById = {}
|
||||
for _, mapRecommendData in ipairs(self.tbSystemRecommendList) do
|
||||
self.mapRecommendDataById[tostring(mapRecommendData.nRecommendId)] = mapRecommendData
|
||||
end
|
||||
for _, mapReport in ipairs(tbReports) do
|
||||
local mapRecommendData = self:CreateRecommendData(mapReport)
|
||||
if mapRecommendData ~= nil then
|
||||
table.insert(self.tbRecommendList, mapRecommendData)
|
||||
self.mapRecommendDataById[tostring(mapRecommendData.nRecommendId)] = mapRecommendData
|
||||
end
|
||||
end
|
||||
self:ClearInvalidRecommendData()
|
||||
end
|
||||
function PlayerSoldierRecommendData:ClearInvalidRecommendData()
|
||||
local bChanged = false
|
||||
if self:GetRecommendId() ~= 0 and self:GetRecommendDataById(self:GetRecommendId()) == nil then
|
||||
self.nRecommendId = 0
|
||||
bChanged = true
|
||||
end
|
||||
if self:GetInSoldierRecommendId() ~= 0 and self:GetRecommendDataById(self:GetInSoldierRecommendId()) == nil then
|
||||
self.nInSoldierRecommendId = 0
|
||||
bChanged = true
|
||||
end
|
||||
if bChanged then
|
||||
self:SaveData()
|
||||
EventManager.Hit("SoldierRecommend_Update")
|
||||
end
|
||||
end
|
||||
function PlayerSoldierRecommendData:PreloadSystemRecommendList()
|
||||
local funcForEachRecommend = function(mapLineData)
|
||||
local mapRecommendData = self:CreateSystemRecommendData(mapLineData)
|
||||
if mapRecommendData ~= nil then
|
||||
table.insert(self.tbSystemRecommendList, mapRecommendData)
|
||||
self.mapRecommendDataById[tostring(mapRecommendData.nRecommendId)] = mapRecommendData
|
||||
end
|
||||
end
|
||||
ForEachTableLine(DataTable.SoldierRecommendBuilds, funcForEachRecommend)
|
||||
end
|
||||
function PlayerSoldierRecommendData:CreateSystemRecommendData(mapLineData)
|
||||
if mapLineData == nil then
|
||||
return nil
|
||||
end
|
||||
local mapRecommendData = {
|
||||
nRecommendId = mapLineData.Id,
|
||||
nCharId = mapLineData.CharacterId,
|
||||
charList = {},
|
||||
tbStrategyCardId = mapLineData.StrategyCard or {},
|
||||
tbPartner = {},
|
||||
tbExtraPartner = {},
|
||||
sTitle = mapLineData.Title,
|
||||
sDesc = mapLineData.Desc or "",
|
||||
sVersion = "",
|
||||
bSystemRecommend = true
|
||||
}
|
||||
mapRecommendData.nBossTemplateId = mapLineData.BossTemplate
|
||||
for nIndex = 1, 3 do
|
||||
local tbCharData = mapLineData["Front" .. nIndex]
|
||||
if tbCharData ~= nil then
|
||||
table.insert(mapRecommendData.charList, {
|
||||
nId = tbCharData[1],
|
||||
nStar = tbCharData[2],
|
||||
nPositionType = 1,
|
||||
nPosIndex = tbCharData[4] or nIndex
|
||||
})
|
||||
end
|
||||
end
|
||||
local tbBackChar = mapLineData.Back and decodeJson(mapLineData.Back)
|
||||
if type(tbBackChar) == "table" then
|
||||
for nCharId, nStar in pairs(tbBackChar) do
|
||||
table.insert(mapRecommendData.charList, {
|
||||
nId = tonumber(nCharId),
|
||||
nStar = tonumber(nStar),
|
||||
nPositionType = 2,
|
||||
nPosIndex = 0
|
||||
})
|
||||
end
|
||||
end
|
||||
table.sort(mapRecommendData.charList, function(mapA, mapB)
|
||||
if mapA.nPositionType ~= mapB.nPositionType then
|
||||
return mapA.nPositionType < mapB.nPositionType
|
||||
end
|
||||
if mapA.nPositionType == 1 then
|
||||
return (mapA.nPosIndex or 0) < (mapB.nPosIndex or 0)
|
||||
end
|
||||
local mapCharCfgA = ConfigTable.GetData("SoldierCharacter", mapA.nId)
|
||||
local mapCharCfgB = ConfigTable.GetData("SoldierCharacter", mapB.nId)
|
||||
if mapCharCfgA.Rarity ~= mapCharCfgB.Rarity then
|
||||
return mapCharCfgA.Rarity > mapCharCfgB.Rarity
|
||||
end
|
||||
return mapA.nId < mapB.nId
|
||||
end)
|
||||
local tbPartnerAdd = mapLineData.PartnerAdd and decodeJson(mapLineData.PartnerAdd)
|
||||
if type(tbPartnerAdd) == "table" then
|
||||
for nPartnerId, nAddLevel in pairs(tbPartnerAdd) do
|
||||
local mapPartnerCfg = ConfigTable.GetData("SoldierPartner", tonumber(nPartnerId))
|
||||
if mapPartnerCfg ~= nil then
|
||||
mapRecommendData.tbExtraPartner[mapPartnerCfg.PartnerType] = tonumber(nAddLevel)
|
||||
end
|
||||
end
|
||||
end
|
||||
local _, tbUIData = SoldierAttrData.CalcActivePartners(mapRecommendData.charList, mapRecommendData.tbExtraPartner, {})
|
||||
mapRecommendData.tbPartner = tbUIData
|
||||
return mapRecommendData
|
||||
end
|
||||
function PlayerSoldierRecommendData:CreateRecommendData(mapReport)
|
||||
if mapReport == nil or mapReport.ReportId == nil or mapReport.ReportId == "" then
|
||||
return nil
|
||||
end
|
||||
local mapRecommendData = {
|
||||
nRecommendId = mapReport.ReportId,
|
||||
nCharId = 0,
|
||||
charList = {},
|
||||
tbStrategyCardId = mapReport.CardIds or {},
|
||||
tbPartner = {},
|
||||
tbExtraPartner = {},
|
||||
mapReport = mapReport,
|
||||
bSystemRecommend = false
|
||||
}
|
||||
mapRecommendData.nBossTemplateId = mapReport.BossAbilityId
|
||||
local mapChallengeCfg = ConfigTable.GetData("SoldierGradeChallenge", mapReport.GradeChallengeId)
|
||||
mapRecommendData.sTitle = mapChallengeCfg and mapChallengeCfg.Name or mapReport.ReportId
|
||||
mapRecommendData.sDesc = mapReport.Version or ""
|
||||
mapRecommendData.sVersion = mapReport.Version or ""
|
||||
for nIndex, mapChess in ipairs(mapReport.Chess or {}) do
|
||||
table.insert(mapRecommendData.charList, {
|
||||
nId = mapChess.Id,
|
||||
nStar = mapChess.Star,
|
||||
nPositionType = nIndex <= 3 and 1 or 2,
|
||||
nPosIndex = nIndex <= 3 and nIndex or 0
|
||||
})
|
||||
end
|
||||
if mapRecommendData.charList[1] ~= nil then
|
||||
mapRecommendData.nCharId = mapRecommendData.charList[1].nId
|
||||
end
|
||||
local _, tbUIData = SoldierAttrData.CalcActivePartners(mapRecommendData.charList, {}, {})
|
||||
mapRecommendData.tbPartner = tbUIData
|
||||
self:BuildCustomRecommendTitle(mapRecommendData)
|
||||
return mapRecommendData
|
||||
end
|
||||
function PlayerSoldierRecommendData:BuildCustomRecommendTitle(mapRecommendData)
|
||||
local tbActivePartner = {}
|
||||
for _, mapPartnerData in ipairs(mapRecommendData.tbPartner) do
|
||||
if mapPartnerData.nActiveLevel > 0 then
|
||||
table.insert(tbActivePartner, mapPartnerData)
|
||||
end
|
||||
end
|
||||
table.sort(tbActivePartner, function(mapA, mapB)
|
||||
if mapA.nActiveLevel ~= mapB.nActiveLevel then
|
||||
return mapA.nActiveLevel > mapB.nActiveLevel
|
||||
end
|
||||
return mapA.nType < mapB.nType
|
||||
end)
|
||||
local tbTitlePart = {}
|
||||
for nIndex = 1, math.min(2, #tbActivePartner) do
|
||||
local mapPartnerData = tbActivePartner[nIndex]
|
||||
local mapPartnerGroupCfg = CacheTable.GetData("_SoldierPartnerGroup", mapPartnerData.nType)
|
||||
if mapPartnerGroupCfg ~= nil then
|
||||
table.insert(tbTitlePart, tostring(mapPartnerData.nActiveNum) .. mapPartnerGroupCfg.Name)
|
||||
end
|
||||
end
|
||||
if 0 < #tbTitlePart then
|
||||
mapRecommendData.sTitle = table.concat(tbTitlePart, " ")
|
||||
end
|
||||
end
|
||||
function PlayerSoldierRecommendData:GetRecommendDataById(sReportId)
|
||||
if sReportId == nil or sReportId == 0 or sReportId == "" then
|
||||
return nil
|
||||
end
|
||||
return self.mapRecommendDataById[tostring(sReportId)]
|
||||
end
|
||||
return PlayerSoldierRecommendData
|
||||
|
||||
@@ -0,0 +1,284 @@
|
||||
local ConfigData = require("GameCore.Data.ConfigData")
|
||||
local SoldierAttrData = require("GameCore.Data.DataClass.Soldier.SoldierAttrData")
|
||||
local PlayerSoldierTechnologyData = class("PlayerSoldierTechnologyData")
|
||||
function PlayerSoldierTechnologyData:ctor()
|
||||
self.tbTechNodes = {}
|
||||
end
|
||||
function PlayerSoldierTechnologyData:InitData()
|
||||
self:InitConfig()
|
||||
end
|
||||
function PlayerSoldierTechnologyData:InitConfig()
|
||||
local create = function(mapLineData)
|
||||
local mapNode = self.tbTechNodes[mapLineData.Season][mapLineData.Id]
|
||||
if not mapNode then
|
||||
mapNode = {
|
||||
nId = mapLineData.Id,
|
||||
nNodeId = mapLineData.NodeId,
|
||||
tbPreNodes = mapLineData.PreNodes,
|
||||
tbNextNodes = {},
|
||||
bActive = false,
|
||||
bReady = false
|
||||
}
|
||||
self.tbTechNodes[mapLineData.Season][mapLineData.Id] = mapNode
|
||||
end
|
||||
return mapNode
|
||||
end
|
||||
local foreachNode = function(mapLineData)
|
||||
local nSeasonId = mapLineData.Season
|
||||
if not self.tbTechNodes[nSeasonId] then
|
||||
self.tbTechNodes[nSeasonId] = {}
|
||||
end
|
||||
create(mapLineData)
|
||||
if #mapLineData.PreNodes > 0 then
|
||||
for _, nPreId in ipairs(mapLineData.PreNodes) do
|
||||
local mapCfg = ConfigTable.GetData("SoldierTechNode", nPreId)
|
||||
if mapCfg then
|
||||
local mapPreNode = create(mapCfg)
|
||||
table.insert(mapPreNode.tbNextNodes, mapLineData.Id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
ForEachTableLine(ConfigTable.Get("SoldierTechNode"), foreachNode)
|
||||
end
|
||||
function PlayerSoldierTechnologyData:GetClientEffectByNode(nSeasonId, tbActiveNode)
|
||||
local tbEffectType = {}
|
||||
local tbNodes = UTILS.ParseByteString(tbActiveNode)
|
||||
if self.tbTechNodes[nSeasonId] ~= nil then
|
||||
for nId, mapLine in pairs(self.tbTechNodes[nSeasonId]) do
|
||||
local bActive = UTILS.IsBitSet(tbNodes, mapLine.NodeId)
|
||||
if bActive and (not tbEffectType[mapLine.EffectClient] or tbEffectType[mapLine.EffectClient].Priority < mapLine.Priority) then
|
||||
tbEffectType[mapLine.EffectClient] = {
|
||||
ClientParams = mapLine.ClientParams,
|
||||
Priority = mapLine.Priority
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
return tbEffectType
|
||||
end
|
||||
function PlayerSoldierTechnologyData:ParseServerData(nSeasonId, mapMsgData)
|
||||
if self.tbTechNodes[nSeasonId] ~= nil then
|
||||
local tbNodes = UTILS.ParseByteString(mapMsgData)
|
||||
for nId, v in pairs(self.tbTechNodes[nSeasonId]) do
|
||||
v.bActive = UTILS.IsBitSet(tbNodes, v.nNodeId)
|
||||
end
|
||||
self:RefreshNodesReady(nSeasonId)
|
||||
self:RefreshRedDot(nSeasonId)
|
||||
end
|
||||
end
|
||||
function PlayerSoldierTechnologyData:RefreshNodesReady(nSeasonId)
|
||||
local tbNodeList = self.tbTechNodes[nSeasonId]
|
||||
if not tbNodeList then
|
||||
return
|
||||
end
|
||||
for nId, mapNode in pairs(tbNodeList) do
|
||||
local mapCfg = ConfigTable.GetData("SoldierTechNode", nId)
|
||||
if mapCfg then
|
||||
local tbPre = mapCfg.PreNodes
|
||||
local bReady
|
||||
if #tbPre == 0 then
|
||||
bReady = true
|
||||
elseif mapCfg.PreNodesLogic then
|
||||
bReady = true
|
||||
for _, nPreId in ipairs(tbPre) do
|
||||
local mapPre = tbNodeList[nPreId]
|
||||
if not mapPre or not mapPre.bActive then
|
||||
bReady = false
|
||||
break
|
||||
end
|
||||
end
|
||||
else
|
||||
bReady = false
|
||||
for _, nPreId in ipairs(tbPre) do
|
||||
local mapPre = tbNodeList[nPreId]
|
||||
if mapPre and mapPre.bActive then
|
||||
bReady = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
mapNode.bReady = bReady
|
||||
end
|
||||
end
|
||||
end
|
||||
function PlayerSoldierTechnologyData:RefreshRedDot(nSeasonId)
|
||||
local bRedDot = false
|
||||
if self.tbTechNodes[nSeasonId] ~= nil then
|
||||
for nId, v in pairs(self.tbTechNodes[nSeasonId]) do
|
||||
if not v.bActive and v.bReady then
|
||||
local mapCfg = ConfigTable.GetData("SoldierTechNode", nId)
|
||||
if mapCfg ~= nil then
|
||||
local nHasCount = PlayerData.Item:GetItemCountByID(mapCfg.ItemId1)
|
||||
if nHasCount >= mapCfg.ItemQty1 then
|
||||
bRedDot = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
RedDotManager.SetValid(RedDotDefine.Soldier_TechNum, nil, bRedDot)
|
||||
end
|
||||
function PlayerSoldierTechnologyData:GetTechNodesBySeason(nSeasonId)
|
||||
return self.tbTechNodes[nSeasonId]
|
||||
end
|
||||
function PlayerSoldierTechnologyData:GetTechNode(nId, nSeasonId)
|
||||
if not nSeasonId then
|
||||
local mapCfg = ConfigTable.GetData("SoldierTechNode", nId)
|
||||
if not mapCfg then
|
||||
printError("自走棋科技树节点Id有误, 未找到配置表数据, Id: " .. nId)
|
||||
return {}
|
||||
end
|
||||
nSeasonId = mapCfg.Season
|
||||
end
|
||||
return self.tbTechNodes[nSeasonId][nId]
|
||||
end
|
||||
function PlayerSoldierTechnologyData:GetActiveNodeCount(nSeasonId)
|
||||
local nAllCount, nActiveCount = 0, 0
|
||||
local tbNodeList = self.tbTechNodes[nSeasonId]
|
||||
if tbNodeList ~= nil then
|
||||
for _, v in pairs(tbNodeList) do
|
||||
if v.bActive == true then
|
||||
nActiveCount = nActiveCount + 1
|
||||
end
|
||||
nAllCount = nAllCount + 1
|
||||
end
|
||||
end
|
||||
return nAllCount, nActiveCount
|
||||
end
|
||||
function PlayerSoldierTechnologyData:GetActiveClientEffect(nSeasonId)
|
||||
local tbClientBuffList = {}
|
||||
local tbNodeList = self.tbTechNodes[nSeasonId]
|
||||
if tbNodeList ~= nil then
|
||||
for _, v in pairs(tbNodeList) do
|
||||
if v.bActive then
|
||||
local mapCfg = ConfigTable.GetData("SoldierTechNode", v.nId)
|
||||
if mapCfg ~= nil and mapCfg.Type == GameEnum.SoldierTechNodeType.Attribute and #mapCfg.EffectClient > 0 then
|
||||
for _, nBuffId in ipairs(mapCfg.EffectClient) do
|
||||
table.insert(tbClientBuffList, nBuffId)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return tbClientBuffList
|
||||
end
|
||||
function PlayerSoldierTechnologyData:GetClientBattleBuffList(nSeasonId)
|
||||
local tbBuffList = {}
|
||||
local tbNodeList = self.tbTechNodes[nSeasonId]
|
||||
if tbNodeList ~= nil then
|
||||
for _, v in pairs(tbNodeList) do
|
||||
if v.bActive then
|
||||
local mapCfg = ConfigTable.GetData("SoldierTechNode", v.nId)
|
||||
if mapCfg ~= nil and mapCfg.Type == GameEnum.SoldierTechNodeType.Attribute and mapCfg.EffectBattle > 0 then
|
||||
table.insert(tbBuffList, mapCfg.EffectBattle)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return tbBuffList
|
||||
end
|
||||
function PlayerSoldierTechnologyData:CheckTechNodeActiveById(nSeasonId, nId)
|
||||
if self.tbTechNodes[nSeasonId] ~= nil and self.tbTechNodes[nSeasonId][nId] ~= nil then
|
||||
return self.tbTechNodes[nSeasonId][nId].bActive
|
||||
end
|
||||
return false
|
||||
end
|
||||
function PlayerSoldierTechnologyData:GetActiveNodePreview(nSeasonId)
|
||||
local tbPreview = {}
|
||||
local tbAttr = {}
|
||||
local tbBattleAttr = {}
|
||||
local tbCore = {}
|
||||
local tbNodeList = self.tbTechNodes[nSeasonId]
|
||||
if tbNodeList ~= nil then
|
||||
for _, v in pairs(tbNodeList) do
|
||||
if v.bActive == true then
|
||||
local mapCfg = ConfigTable.GetData("SoldierTechNode", v.nId)
|
||||
if mapCfg ~= nil then
|
||||
if mapCfg.Type == GameEnum.SoldierTechNodeType.Attribute then
|
||||
if #mapCfg.EffectClient > 0 then
|
||||
for _, nBuffId in ipairs(mapCfg.EffectClient) do
|
||||
local mapBuffCfg = ConfigTable.GetData("SoldierClientBuff", nBuffId)
|
||||
if mapBuffCfg == nil then
|
||||
goto lbl_123
|
||||
end
|
||||
for i = 1, 3 do
|
||||
local nEffectType = mapBuffCfg["Effect" .. i]
|
||||
local tbParam = mapBuffCfg["EffectParams" .. i]
|
||||
if #tbParam == 2 and (nEffectType == GameEnum.SoldierClientEffect.AmendAttr or nEffectType == GameEnum.SoldierClientEffect.PercentAmendAttr or nEffectType == GameEnum.SoldierClientEffect.BaseAmendAttr or nEffectType == GameEnum.SoldierClientEffect.BasePercentAmendAttr) then
|
||||
if tbAttr[nEffectType] == nil then
|
||||
tbAttr[nEffectType] = {}
|
||||
end
|
||||
if tbAttr[nEffectType][tbParam[1]] == nil then
|
||||
tbAttr[nEffectType][tbParam[1]] = 0
|
||||
end
|
||||
tbAttr[nEffectType][tbParam[1]] = tbAttr[nEffectType][tbParam[1]] + tonumber(tbParam[2])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if mapCfg.BattleType ~= GameEnum.SoldierTechBattleEffect.None then
|
||||
if tbBattleAttr[mapCfg.BattleType] == nil then
|
||||
tbBattleAttr[mapCfg.BattleType] = 0
|
||||
end
|
||||
tbBattleAttr[mapCfg.BattleType] = tbBattleAttr[mapCfg.BattleType] + mapCfg.BattleTypeParam
|
||||
end
|
||||
::lbl_123::
|
||||
elseif mapCfg.Type == GameEnum.SoldierTechNodeType.Core then
|
||||
table.insert(tbCore, mapCfg.Id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local tbAttachAttrCfg = {}
|
||||
for _, v in ipairs(SoldierAttrData.GetAttachAttrList()) do
|
||||
tbAttachAttrCfg[v.sKey] = v
|
||||
end
|
||||
for nEffectType, tbSub in pairs(tbAttr) do
|
||||
for sKey, nValue in pairs(tbSub) do
|
||||
local cfg = tbAttachAttrCfg[sKey]
|
||||
if cfg and cfg.bIntFloat and (nEffectType == GameEnum.SoldierClientEffect.AmendAttr or nEffectType == GameEnum.SoldierClientEffect.BaseAmendAttr) then
|
||||
tbSub[sKey] = nValue * ConfigData.IntFloatPrecision
|
||||
end
|
||||
end
|
||||
end
|
||||
for eKey, nValue in pairs(tbBattleAttr) do
|
||||
tbBattleAttr[eKey] = nValue * ConfigData.IntFloatPrecision
|
||||
end
|
||||
tbPreview.tbAttr = tbAttr
|
||||
tbPreview.tbBattleAttr = tbBattleAttr
|
||||
tbPreview.tbCore = tbCore
|
||||
return tbPreview
|
||||
end
|
||||
function PlayerSoldierTechnologyData:SendSoldierTechDetailReq(nSeasonId, callback)
|
||||
local netCallback = function(_, netMsg)
|
||||
self:ParseServerData(nSeasonId, netMsg.Value)
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.soldier_technology_info_req, {Value = nSeasonId}, nil, netCallback)
|
||||
end
|
||||
function PlayerSoldierTechnologyData:SendSoldierTechNodeUnlockReq(nId, callback)
|
||||
local netCallback = function(_, netMsg)
|
||||
local mapDecodedChangeInfo = UTILS.DecodeChangeInfo(netMsg)
|
||||
HttpNetHandler.ProcChangeInfo(mapDecodedChangeInfo)
|
||||
local mapCfg = ConfigTable.GetData("SoldierTechNode", nId)
|
||||
if mapCfg ~= nil then
|
||||
local tbNodeList = self.tbTechNodes[mapCfg.Season]
|
||||
local mapNode = tbNodeList and tbNodeList[nId] or nil
|
||||
if mapNode ~= nil then
|
||||
mapNode.bActive = true
|
||||
self:RefreshNodesReady(mapCfg.Season)
|
||||
self:RefreshRedDot(mapCfg.Season)
|
||||
end
|
||||
end
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.soldier_technology_node_unlock_req, {Value = nId}, nil, netCallback)
|
||||
end
|
||||
return PlayerSoldierTechnologyData
|
||||
@@ -45,7 +45,11 @@ local SoldierAttachAttr = {
|
||||
sKey = "InitialEnergy",
|
||||
bSoldier = true
|
||||
},
|
||||
{sKey = "Recovery", bSoldier = true},
|
||||
{
|
||||
sKey = "Recovery",
|
||||
bSoldier = true,
|
||||
bFloat = true
|
||||
},
|
||||
{
|
||||
sKey = "ATKSPD_P",
|
||||
bSoldier = true,
|
||||
@@ -68,6 +72,8 @@ local _InitAttrMapSlots = function(map)
|
||||
for _, v in pairs(SoldierAttachAttr) do
|
||||
map[v.sKey] = 0
|
||||
map["_" .. v.sKey] = 0
|
||||
map["_" .. v.sKey .. "BasePercentAmend"] = 0
|
||||
map["_" .. v.sKey .. "BaseAmend"] = 0
|
||||
map["_" .. v.sKey .. "PercentAmend"] = 0
|
||||
map["_" .. v.sKey .. "Amend"] = 0
|
||||
end
|
||||
@@ -109,8 +115,13 @@ local _ReadBaseFromConfig = function(map, nId, nStar)
|
||||
end
|
||||
local _Finalize = function(map)
|
||||
for _, v in pairs(SoldierAttachAttr) do
|
||||
map[v.sKey] = map["_" .. v.sKey] * (1 + map["_" .. v.sKey .. "PercentAmend"] / 100) + map["_" .. v.sKey .. "Amend"]
|
||||
map[v.sKey] = math.floor(map[v.sKey])
|
||||
local nBase = map["_" .. v.sKey] * (1 + map["_" .. v.sKey .. "BasePercentAmend"] / 100) + map["_" .. v.sKey .. "BaseAmend"]
|
||||
map[v.sKey] = nBase * (1 + map["_" .. v.sKey .. "PercentAmend"] / 100) + map["_" .. v.sKey .. "Amend"]
|
||||
if v.bFloat then
|
||||
map[v.sKey] = map[v.sKey]
|
||||
else
|
||||
map[v.sKey] = math.floor(map[v.sKey])
|
||||
end
|
||||
end
|
||||
end
|
||||
local _FillAttrForUI = function(map)
|
||||
@@ -174,8 +185,8 @@ local _BuildBuffCtx = function(tbDeployed, tbActivePartner)
|
||||
}
|
||||
ctx.nDeployedCount = #ctx.tbDeployed
|
||||
if tbActivePartner then
|
||||
for _, nId in pairs(tbActivePartner) do
|
||||
local mapPartnerCfg = ConfigTable.GetData("SoldierPartner", nId)
|
||||
for _, info in ipairs(tbActivePartner) do
|
||||
local mapPartnerCfg = ConfigTable.GetData("SoldierPartner", info.nId)
|
||||
if mapPartnerCfg ~= nil then
|
||||
local nType = mapPartnerCfg.PartnerType
|
||||
local nLevel = mapPartnerCfg.Level
|
||||
@@ -184,6 +195,20 @@ local _BuildBuffCtx = function(tbDeployed, tbActivePartner)
|
||||
nLevel = nLevel or 1
|
||||
}
|
||||
ctx.nActivePartnerCount = ctx.nActivePartnerCount + 1
|
||||
if info.tbSoldiers then
|
||||
local mapSoldier = {}
|
||||
for _, nChessId in ipairs(info.tbSoldiers) do
|
||||
mapSoldier[nChessId] = true
|
||||
end
|
||||
for _, chess in ipairs(ctx.tbDeployed) do
|
||||
if mapSoldier[chess.nId] then
|
||||
chess.tbPartnerType = chess.tbPartnerType or {}
|
||||
if 0 >= table.indexof(chess.tbPartnerType, nType) then
|
||||
table.insert(chess.tbPartnerType, nType)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -366,6 +391,26 @@ local _ApplyPercentAmendToChess = function(chess, sKey, nValue)
|
||||
end
|
||||
chess.mapAttr[sPctKey] = chess.mapAttr[sPctKey] + (nValue or 0)
|
||||
end
|
||||
local _ApplyBaseAmendToChess = function(chess, sKey, nValue)
|
||||
if not (chess and chess.mapAttr) or not sKey then
|
||||
return
|
||||
end
|
||||
local sBaseAmendKey = "_" .. sKey .. "BaseAmend"
|
||||
if chess.mapAttr[sBaseAmendKey] == nil then
|
||||
return
|
||||
end
|
||||
chess.mapAttr[sBaseAmendKey] = chess.mapAttr[sBaseAmendKey] + (nValue or 0)
|
||||
end
|
||||
local _ApplyBasePercentAmendToChess = function(chess, sKey, nValue)
|
||||
if not (chess and chess.mapAttr) or not sKey then
|
||||
return
|
||||
end
|
||||
local sBasePctKey = "_" .. sKey .. "BasePercentAmend"
|
||||
if chess.mapAttr[sBasePctKey] == nil then
|
||||
return
|
||||
end
|
||||
chess.mapAttr[sBasePctKey] = chess.mapAttr[sBasePctKey] + (nValue or 0)
|
||||
end
|
||||
local _EffectApply_None = function()
|
||||
end
|
||||
local _EffectApply_AmendAttr = function(ctx, chess, idxChess, tbParam)
|
||||
@@ -380,6 +425,18 @@ local _EffectApply_PercentAmendAttr = function(ctx, chess, idxChess, tbParam)
|
||||
end
|
||||
_ApplyPercentAmendToChess(chess, tbParam[1], tonumber(tbParam[2]) or 0)
|
||||
end
|
||||
local _EffectApply_BaseAmendAttr = function(ctx, chess, idxChess, tbParam)
|
||||
if not tbParam or #tbParam ~= 2 then
|
||||
return
|
||||
end
|
||||
_ApplyBaseAmendToChess(chess, tbParam[1], tonumber(tbParam[2]) or 0)
|
||||
end
|
||||
local _EffectApply_BasePercentAmendAttr = function(ctx, chess, idxChess, tbParam)
|
||||
if not tbParam or #tbParam ~= 2 then
|
||||
return
|
||||
end
|
||||
_ApplyBasePercentAmendToChess(chess, tbParam[1], tonumber(tbParam[2]) or 0)
|
||||
end
|
||||
local _EffectApply_PartnerTag = function(ctx, chess, idxChess, tbParam)
|
||||
local nType = tbParam and tbParam[1]
|
||||
if not nType or nType == 0 then
|
||||
@@ -400,6 +457,8 @@ end
|
||||
_RegisterEffect(GameEnum.SoldierClientEffect.None, {fnApply = _EffectApply_None})
|
||||
_RegisterEffect(GameEnum.SoldierClientEffect.AmendAttr, {fnApply = _EffectApply_AmendAttr})
|
||||
_RegisterEffect(GameEnum.SoldierClientEffect.PercentAmendAttr, {fnApply = _EffectApply_PercentAmendAttr})
|
||||
_RegisterEffect(GameEnum.SoldierClientEffect.BaseAmendAttr, {fnApply = _EffectApply_BaseAmendAttr})
|
||||
_RegisterEffect(GameEnum.SoldierClientEffect.BasePercentAmendAttr, {fnApply = _EffectApply_BasePercentAmendAttr})
|
||||
_RegisterEffect(GameEnum.SoldierClientEffect.PartnerTag, {fnApply = _EffectApply_PartnerTag})
|
||||
_RegisterEffect(GameEnum.SoldierClientEffect.BattleAttrHalve, {fnApply = _EffectApply_BattleAttrHalve})
|
||||
local _TargetSelect_None = function(ctx, tbCandidates, tbParam)
|
||||
@@ -504,7 +563,12 @@ local _AddPositionBuffs = function(ctx)
|
||||
local tbPosEffect = CacheTable.GetData("_SoldierPositionEffect", chess.nPositionType)
|
||||
local mapLine = tbPosEffect and tbPosEffect[chess.nIndex]
|
||||
local nBuffId = mapLine and mapLine.KeyEffectId or 0
|
||||
if nBuffId ~= 0 then
|
||||
local nTechNodeId = mapLine and mapLine.TechNodeId or 0
|
||||
local bActive = true
|
||||
if nTechNodeId ~= 0 then
|
||||
bActive = PlayerData.SoldierData:CheckTechNodeActiveById(nTechNodeId)
|
||||
end
|
||||
if nBuffId ~= 0 and bActive then
|
||||
local buff = _ParseBuffConfig(ConfigTable.GetData("SoldierClientBuff", nBuffId))
|
||||
if buff then
|
||||
local tbInputSet = {
|
||||
@@ -548,6 +612,23 @@ local _AddPartnerBuffs = function(ctx)
|
||||
end
|
||||
end
|
||||
end
|
||||
local _AddTechnologyBuffs = function(ctx)
|
||||
local tbTechBuff = PlayerData.SoldierData:GetTechActiveClientEffect()
|
||||
if not tbTechBuff or #tbTechBuff == 0 then
|
||||
return
|
||||
end
|
||||
local tbInputSet = {}
|
||||
for i = 1, #ctx.tbDeployed do
|
||||
tbInputSet[i] = true
|
||||
end
|
||||
for _, nBuffId in ipairs(tbTechBuff) do
|
||||
local buff = _ParseBuffConfig(ConfigTable.GetData("SoldierClientBuff", nBuffId))
|
||||
if buff then
|
||||
local tbCandidates = _FilterChessByConditions(ctx, tbInputSet, buff.tbConds)
|
||||
_DispatchBuff(ctx, nBuffId, buff, tbCandidates)
|
||||
end
|
||||
end
|
||||
end
|
||||
local _ApplyAllBuffEffects = function(ctx)
|
||||
for idx, chess in ipairs(ctx.tbDeployed) do
|
||||
if chess.tbClientBuffIds then
|
||||
@@ -562,6 +643,99 @@ local _ApplyAllBuffEffects = function(ctx)
|
||||
end
|
||||
end
|
||||
end
|
||||
local _tbOutOfCombatBonusKey = {
|
||||
Hp = "Hp",
|
||||
Atk = "Atk",
|
||||
Def = "Def",
|
||||
CritRate = "CritRate",
|
||||
CritPower = "CritPower",
|
||||
ATKSPD_P = "ATKSPD_P",
|
||||
Recovery = "Recovery"
|
||||
}
|
||||
local _tbGrowthTierSorted
|
||||
local _GetGrowthTierByLevel = function(nLevel)
|
||||
if _tbGrowthTierSorted == nil then
|
||||
_tbGrowthTierSorted = {}
|
||||
ForEachTableLine(DataTable.SoldierCharGrowthTier, function(mapLineData)
|
||||
table.insert(_tbGrowthTierSorted, mapLineData)
|
||||
end)
|
||||
table.sort(_tbGrowthTierSorted, function(a, b)
|
||||
return a.CharLevel[1] < b.CharLevel[1]
|
||||
end)
|
||||
end
|
||||
for _, row in ipairs(_tbGrowthTierSorted) do
|
||||
local tbRange = row.CharLevel
|
||||
if tbRange and nLevel > tbRange[1] and nLevel <= tbRange[2] then
|
||||
return row
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
local _CalcFateLevel = function(nCharId)
|
||||
local nCount = 0
|
||||
local tbFate = PlayerData.Talent:GetFateTalent(nCharId) or {}
|
||||
for _, bActive in ipairs(tbFate) do
|
||||
if bActive then
|
||||
nCount = nCount + 1
|
||||
end
|
||||
end
|
||||
return nCount
|
||||
end
|
||||
local _CalcGrowthBonusByChessId = function(nChessId)
|
||||
if not nChessId or nChessId == 0 then
|
||||
return nil
|
||||
end
|
||||
local cfgChess = ConfigTable.GetData("SoldierCharacter", nChessId)
|
||||
if not cfgChess or cfgChess.CharacterType ~= GameEnum.SoldierCharacterType.Actor then
|
||||
return nil
|
||||
end
|
||||
local nCharId = cfgChess.CharacterId or 0
|
||||
if nCharId == 0 then
|
||||
return nil
|
||||
end
|
||||
local mapChar = PlayerData.Char:GetCharDataByTid(nCharId)
|
||||
if not mapChar then
|
||||
return nil
|
||||
end
|
||||
local nLevel = mapChar.nLevel or 0
|
||||
local nFateLevel = _CalcFateLevel(nCharId)
|
||||
local cfgTier = _GetGrowthTierByLevel(nLevel)
|
||||
if not cfgTier then
|
||||
return nil
|
||||
end
|
||||
local nRank = math.floor((nLevel - cfgTier.A) * cfgTier.N + nFateLevel * cfgTier.K)
|
||||
if 0 < nRank then
|
||||
return ConfigTable.GetData("SoldierCharTierAttrBonus", nRank)
|
||||
end
|
||||
end
|
||||
local _AccumulateGrowthOnMap = function(mapAttr, cfgBonus)
|
||||
if not mapAttr or not cfgBonus then
|
||||
return
|
||||
end
|
||||
for sKey, sBonusField in pairs(_tbOutOfCombatBonusKey) do
|
||||
local nBonus = cfgBonus[sBonusField] or 0
|
||||
if nBonus ~= 0 then
|
||||
local sBasePctKey = "_" .. sKey .. "BasePercentAmend"
|
||||
if mapAttr[sBasePctKey] ~= nil then
|
||||
mapAttr[sBasePctKey] = mapAttr[sBasePctKey] + nBonus * ConfigData.IntFloatPrecision * 100
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local _ApplyOutOfCombatCharGrowth = function(ctx)
|
||||
for _, chess in ipairs(ctx.tbDeployed) do
|
||||
local cfgBonus = _CalcGrowthBonusByChessId(chess.nId)
|
||||
if cfgBonus ~= nil then
|
||||
_AccumulateGrowthOnMap(chess.mapAttr, cfgBonus)
|
||||
end
|
||||
end
|
||||
end
|
||||
local _ApplyOutOfCombatCharGrowthToMap = function(mapAttr, nChessId)
|
||||
local cfgBonus = _CalcGrowthBonusByChessId(nChessId)
|
||||
if cfgBonus ~= nil then
|
||||
_AccumulateGrowthOnMap(mapAttr, cfgBonus)
|
||||
end
|
||||
end
|
||||
local _FinalizeAll = function(ctx)
|
||||
for _, chess in ipairs(ctx.tbDeployed) do
|
||||
if chess.mapAttr then
|
||||
@@ -620,6 +794,8 @@ local _CalcAllDeployedAttrs = function(tbCharacter, tbActivePartner, tbServerBuf
|
||||
_AddPositionBuffs(ctx)
|
||||
_AddServerBuffs(ctx, tbServerBuff)
|
||||
_AddPartnerBuffs(ctx)
|
||||
_AddTechnologyBuffs(ctx)
|
||||
_ApplyOutOfCombatCharGrowth(ctx)
|
||||
_ApplyAllBuffEffects(ctx)
|
||||
_FinalizeAll(ctx)
|
||||
if bIsForBattle then
|
||||
@@ -643,9 +819,9 @@ local _FindChessAttr = function(tbDeployed, nId, nStar)
|
||||
end
|
||||
return nil
|
||||
end
|
||||
function SoldierAttrData.CalcCharacterAttr(nId, nStar, tbCharacter, tbPartner, tbServerBuff)
|
||||
if tbCharacter then
|
||||
local _, tbDeployed = _CalcAllDeployedAttrs(clone(tbCharacter), tbPartner, tbServerBuff)
|
||||
function SoldierAttrData.CalcCharacterAttr(nId, nStar, tbCharacter, tbPartner, tbServerBuff, bAddCharGrowth)
|
||||
if tbCharacter and 0 < #tbCharacter then
|
||||
local _, tbDeployed = _CalcAllDeployedAttrs(clone(tbCharacter), tbPartner, tbServerBuff, false)
|
||||
local map = _FindChessAttr(tbDeployed, nId, nStar)
|
||||
if map then
|
||||
_Finalize(map)
|
||||
@@ -656,6 +832,18 @@ function SoldierAttrData.CalcCharacterAttr(nId, nStar, tbCharacter, tbPartner, t
|
||||
if not map then
|
||||
return nil
|
||||
end
|
||||
if bAddCharGrowth then
|
||||
_ApplyOutOfCombatCharGrowthToMap(map, nId)
|
||||
end
|
||||
local chess = {
|
||||
nId = nId,
|
||||
nStar = nStar,
|
||||
mapAttr = map,
|
||||
tbPartnerType = SoldierAttrData.GetPartnerGroupsByChessId(nId)
|
||||
}
|
||||
local ctx = _BuildBuffCtx({chess}, nil)
|
||||
_AddTechnologyBuffs(ctx)
|
||||
_ApplyAllBuffEffects(ctx)
|
||||
_Finalize(map)
|
||||
return _FillAttrForUI(map)
|
||||
end
|
||||
@@ -696,7 +884,7 @@ end
|
||||
function SoldierAttrData.GetPartnerGroupsByChessId(nId)
|
||||
local mapCharacter = ConfigTable.GetData("SoldierCharacter", nId)
|
||||
if mapCharacter ~= nil then
|
||||
return mapCharacter.PartnerType
|
||||
return clone(mapCharacter.PartnerType)
|
||||
end
|
||||
return {}
|
||||
end
|
||||
@@ -712,9 +900,11 @@ local _IsPartnerLevelActivated = function(nCount, nNum, eNumType)
|
||||
return false
|
||||
end
|
||||
function SoldierAttrData.CalcActivePartners(tbChess, tbExtraLevel, tbExtraCount)
|
||||
local tbActivePartnerIds = {}
|
||||
local tbActivePartners = {}
|
||||
local tbUIData = {}
|
||||
local mapTypeCount = {}
|
||||
local nYiyeId = 2501053
|
||||
local nYiyeStar = 0
|
||||
if tbChess then
|
||||
for _, chess in ipairs(tbChess) do
|
||||
if chess.nId and chess.nId ~= 0 then
|
||||
@@ -722,14 +912,20 @@ function SoldierAttrData.CalcActivePartners(tbChess, tbExtraLevel, tbExtraCount)
|
||||
if tbPartnerTypes then
|
||||
for _, nType in ipairs(tbPartnerTypes) do
|
||||
if nType and 0 < nType then
|
||||
local nCount = 1
|
||||
if mapTypeCount[nType] ~= nil then
|
||||
nCount = mapTypeCount[nType].nCount + 1
|
||||
if mapTypeCount[nType] == nil then
|
||||
mapTypeCount[nType] = {
|
||||
nCount = 0,
|
||||
tbSoldiers = {}
|
||||
}
|
||||
end
|
||||
mapTypeCount[nType] = {nCount = nCount}
|
||||
mapTypeCount[nType].nCount = mapTypeCount[nType].nCount + 1
|
||||
table.insert(mapTypeCount[nType].tbSoldiers, chess.nId)
|
||||
end
|
||||
end
|
||||
end
|
||||
if chess.nId == nYiyeId then
|
||||
nYiyeStar = chess.nStar or 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -744,20 +940,51 @@ function SoldierAttrData.CalcActivePartners(tbChess, tbExtraLevel, tbExtraCount)
|
||||
end
|
||||
if tbExtraLevel then
|
||||
for nType, nLevel in pairs(tbExtraLevel) do
|
||||
if mapTypeCount[nType] ~= nil then
|
||||
mapTypeCount[nType].nExtraLevel = nLevel
|
||||
else
|
||||
mapTypeCount[nType] = {nCount = 0, nExtraLevel = nLevel}
|
||||
if mapTypeCount[nType] == nil then
|
||||
mapTypeCount[nType] = {
|
||||
nCount = 0,
|
||||
tbSoldiers = {}
|
||||
}
|
||||
end
|
||||
mapTypeCount[nType].nExtraLevel = nLevel
|
||||
end
|
||||
end
|
||||
if tbExtraCount then
|
||||
for nType, nCount in pairs(tbExtraCount) do
|
||||
if mapTypeCount[nType] ~= nil then
|
||||
mapTypeCount[nType].nExtraCount = nCount
|
||||
else
|
||||
mapTypeCount[nType] = {nCount = 0, nExtraCount = nCount}
|
||||
if mapTypeCount[nType] == nil then
|
||||
mapTypeCount[nType] = {
|
||||
nCount = 0,
|
||||
tbSoldiers = {}
|
||||
}
|
||||
end
|
||||
mapTypeCount[nType].nExtraCount = nCount
|
||||
end
|
||||
end
|
||||
if 0 < nYiyeStar then
|
||||
local tbCandidates = {
|
||||
GameEnum.ChessPartnerType.BaiBuChuanYang,
|
||||
GameEnum.ChessPartnerType.HuoLiYaZhi,
|
||||
GameEnum.ChessPartnerType.WangPaiTeGong
|
||||
}
|
||||
local tbSorted = {}
|
||||
for _, nType in ipairs(tbCandidates) do
|
||||
local nCount = mapTypeCount[nType] and mapTypeCount[nType].nCount or 0
|
||||
table.insert(tbSorted, {nType = nType, nCount = nCount})
|
||||
end
|
||||
table.sort(tbSorted, function(a, b)
|
||||
return a.nCount > b.nCount
|
||||
end)
|
||||
local nJoin = math.min(nYiyeStar, #tbSorted)
|
||||
for i = 1, nJoin do
|
||||
local nType = tbSorted[i].nType
|
||||
if mapTypeCount[nType] == nil then
|
||||
mapTypeCount[nType] = {
|
||||
nCount = 0,
|
||||
tbSoldiers = {}
|
||||
}
|
||||
end
|
||||
mapTypeCount[nType].nCount = mapTypeCount[nType].nCount + 1
|
||||
table.insert(mapTypeCount[nType].tbSoldiers, nYiyeId)
|
||||
end
|
||||
end
|
||||
for nType, data in pairs(mapTypeCount) do
|
||||
@@ -796,7 +1023,10 @@ function SoldierAttrData.CalcActivePartners(tbChess, tbExtraLevel, tbExtraCount)
|
||||
local cfg = mapByLevel[nActiveLevel]
|
||||
if cfg and cfg.Id then
|
||||
nQuality = cfg.PartnerLevelQuality
|
||||
table.insert(tbActivePartnerIds, cfg.Id)
|
||||
table.insert(tbActivePartners, {
|
||||
nId = cfg.Id,
|
||||
tbSoldiers = data.tbSoldiers or {}
|
||||
})
|
||||
end
|
||||
end
|
||||
table.insert(tbUIData, {
|
||||
@@ -805,7 +1035,8 @@ function SoldierAttrData.CalcActivePartners(tbChess, tbExtraLevel, tbExtraCount)
|
||||
nCurNum = nCount,
|
||||
tbNumList = tbNumList,
|
||||
nActiveNum = nActiveNum,
|
||||
nActiveLevel = nActiveLevel
|
||||
nActiveLevel = nActiveLevel,
|
||||
nMaxLevel = nMaxLevel
|
||||
})
|
||||
end
|
||||
end
|
||||
@@ -823,7 +1054,7 @@ function SoldierAttrData.CalcActivePartners(tbChess, tbExtraLevel, tbExtraCount)
|
||||
end
|
||||
return nActA > nActB
|
||||
end)
|
||||
return tbActivePartnerIds, tbUIData
|
||||
return tbActivePartners, tbUIData
|
||||
end
|
||||
function SoldierAttrData.GetPartnerLevelsByType(nPartnerType)
|
||||
local tbPartnerLevel = {}
|
||||
@@ -843,4 +1074,10 @@ function SoldierAttrData.GetPartnerLevelsByType(nPartnerType)
|
||||
end)
|
||||
return tbPartnerLevel
|
||||
end
|
||||
function SoldierAttrData.GetAttachAttrList()
|
||||
return SoldierAttachAttr
|
||||
end
|
||||
function SoldierAttrData.GetShowAttrKey()
|
||||
return _showAttrKey
|
||||
end
|
||||
return SoldierAttrData
|
||||
|
||||
@@ -7,6 +7,8 @@ function PlayerTutorialData:Init()
|
||||
self.LevelIdList = {}
|
||||
end
|
||||
function PlayerTutorialData:CacheTutorialData(levelsData)
|
||||
self.tbLevelData = {}
|
||||
self.LevelIdList = {}
|
||||
local forEachTableFunc = function(config)
|
||||
self:UpdateLevel({
|
||||
nlevelId = config.Id,
|
||||
|
||||
Reference in New Issue
Block a user