Update - 1.9.0.103

EN: 1.9.0.103
CN: 1.9.0.104
JP: 1.9.0.106
KR: 1.9.0.108
This commit is contained in:
SL1900
2026-04-18 00:15:00 +09:00
parent 35fe1f046d
commit e0549005e1
1150 changed files with 941124 additions and 19847 deletions
@@ -37,33 +37,30 @@ function BreakOutData:RefreshBreakOutData(actId, msgData)
end
function BreakOutData:CacheAllCharacterData(UnLockedCharacterData)
self.tbUnLockedCharacterDataList = {}
self.tbUnLockedCharacterDataMap = {}
for _, v in pairs(UnLockedCharacterData) do
local CharacterData = {
nId = v.Id,
nBattleTimes = v.BattleTimes
}
table.insert(self.tbUnLockedCharacterDataList, CharacterData)
self.tbUnLockedCharacterDataMap[v.Id] = CharacterData
end
end
function BreakOutData:CacheIsUnlocked(CharacterNid)
for _, v in pairs(self.tbUnLockedCharacterDataList) do
if v.nId == CharacterNid then
return true
end
if self.tbUnLockedCharacterDataMap[CharacterNid] then
return true
end
return false
end
function BreakOutData:GetDataFromBreakOutCharacter(CharacterNid)
for _, v in pairs(self.tbUnLockedCharacterDataList) do
if v.nId == CharacterNid then
return ConfigTable.GetData("BreakOutCharacter", CharacterNid)
end
if self.tbUnLockedCharacterDataMap[CharacterNid] then
return ConfigTable.GetData("BreakOutCharacter", CharacterNid)
end
return nil
end
function BreakOutData:GetSkillData(CharacterNid)
local tbCharacterData
self:GetDataFromBreakOutCharacter(CharacterNid)
local tbCharacterData = self:GetDataFromBreakOutCharacter(CharacterNid)
if tbCharacterData == nil then
return nil
else
@@ -71,23 +68,25 @@ function BreakOutData:GetSkillData(CharacterNid)
end
end
function BreakOutData:GetBattleCount(CharacterNid)
for _, v in pairs(self.tbUnLockedCharacterDataList) do
if v.nId == CharacterNid then
return v.nBattleTimes
end
if self.tbUnLockedCharacterDataMap[CharacterNid] ~= nil then
return self.tbUnLockedCharacterDataMap[CharacterNid].nBattleTimes
else
return 0
end
return 0
end
function BreakOutData:CacheAllLevelData(levelListData)
self.tbLevelDataList = {}
self.tbLevelDataMap = {}
for _, v in pairs(levelListData) do
local config = ConfigTable.GetData("BreakOutLevel", v.Id)
local levelData = {
nId = v.Id,
bFirstComplete = v.FirstComplete,
nDifficultyType = ConfigTable.GetData("BreakOutLevel", v.Id).Type,
nPreLevelId = ConfigTable.GetData("BreakOutLevel", v.Id).PreLevelId
nDifficultyType = config.Type,
nPreLevelId = config.PreLevelId
}
table.insert(self.tbLevelDataList, levelData)
self.tbLevelDataMap[v.Id] = levelData
end
end
function BreakOutData:IsAllLevelComplete()
@@ -102,14 +101,12 @@ function BreakOutData:GetLevelData()
return self.tbLevelDataList
end
function BreakOutData:GetLevelDataById(nId)
local levelData
for _, v in pairs(self.tbLevelDataList) do
if v.nId == nId then
levelData = v
break
end
if self.tbLevelDataMap[nId] ~= nil then
return self.tbLevelDataMap[nId]
else
printLog(nId .. ":Id不存在对应关卡数据")
return nil
end
return levelData
end
function BreakOutData:UpdateLevelData(levelData)
for _, v in pairs(self.tbLevelDataList) do
@@ -126,34 +123,23 @@ function BreakOutData:UpdateLevelData(levelData)
end
end
function BreakOutData:UpdateCharacterData(CharacterData)
for _, v in pairs(self.tbUnLockedCharacterDataList) do
if v.nId == CharacterData.CharacterNid then
v.nBattleTimes = v.nBattleTimes + 1
EventManager.Hit("RefreshCharacterBattleTimes")
break
end
if self.tbUnLockedCharacterDataMap[CharacterData.CharacterNid] ~= nil then
self.tbUnLockedCharacterDataMap[CharacterData.CharacterNid].nBattleTimes = self.tbUnLockedCharacterDataMap[CharacterData.CharacterNid].nBattleTimes + 1
EventManager.Hit("RefreshCharacterBattleTimes")
end
end
function BreakOutData:GetDetailLevelDataById(nId)
local levelData
for _, v in pairs(self.tbLevelDataList) do
if v.nId == nId then
levelData = ConfigTable.GetData("BreakOutLevel", nId)
break
end
if self.tbLevelDataMap[nId] then
return ConfigTable.GetData("BreakOutLevel", nId)
end
return levelData
return nil
end
function BreakOutData:GetDetailFloorDataById(nId)
local FloorData
for _, v in pairs(self.tbLevelDataList) do
if v.nId == nId then
nFloorId = ConfigTable.GetData("BreakOutLevel", nId).FloorId
FloorData = ConfigTable.GetData("BreakOutFloor", nFloorId)
break
end
if self.tbLevelDataMap[nId] then
local nFloorId = ConfigTable.GetData("BreakOutLevel", nId).FloorId
return ConfigTable.GetData("BreakOutFloor", nFloorId)
end
return FloorData
return nil
end
function BreakOutData:GetLevelsByTab(nTabIndex)
local levelData = {}
@@ -162,12 +148,9 @@ function BreakOutData:GetLevelsByTab(nTabIndex)
table.insert(levelData, ConfigTable.GetData("BreakOutLevel", v.nId))
end
end
local sortFunc = function(a, b)
local aConfig = ConfigTable.GetData("BreakOutLevel", a.Id)
local bConfig = ConfigTable.GetData("BreakOutLevel", b.Id)
return aConfig.Difficulty < bConfig.Difficulty
end
table.sort(levelData, sortFunc)
table.sort(levelData, function(a, b)
return a.Difficulty < b.Difficulty
end)
return levelData
end
function BreakOutData:GetBreakoutLevelTypeNum()
@@ -291,7 +274,12 @@ function BreakOutData:GetLevelStartTime(nLevelId)
return remainTime
end
function BreakOutData:IsPreLevelComplete(nLevelId)
local nPreLevelId = ConfigTable.GetData("BreakOutLevel", nLevelId).PreLevelId
local tbLevelData = ConfigTable.GetData("BreakOutLevel", nLevelId)
if tbLevelData == nil then
printLog(nLevelId .. ":Id不存在对应关卡数据")
return false
end
local nPreLevelId = tbLevelData.PreLevelId
if nPreLevelId == 0 then
return true
end
@@ -302,6 +290,9 @@ function BreakOutData:IsLevelComplete(nLevelId)
return true
end
local nLevelData = self:GetLevelDataById(nLevelId)
if nLevelData == nil then
return false
end
return nLevelData.bFirstComplete
end
function BreakOutData:GetUnFinishEasyLevel()
@@ -361,7 +352,7 @@ end
function BreakOutData:RefreshCharacterData(charId)
local bIsLock = true
for _, v in pairs(self.tbUnLockedCharacterDataList) do
if v.Id == charId then
if v.nId == charId then
bIsLock = false
break
end
@@ -369,6 +360,7 @@ function BreakOutData:RefreshCharacterData(charId)
if bIsLock then
local CharacterData = {nId = charId, nBattleTimes = 0}
table.insert(self.tbUnLockedCharacterDataList, CharacterData)
self.tbUnLockedCharacterDataMap[charId] = CharacterData
end
end
function BreakOutData:OnEvent_GMClearAllLevels(mapMsgData)
@@ -2,7 +2,6 @@ local BreakOutData_00 = class("BreakOutData_00")
function BreakOutData_00:AddListeners()
end
function BreakOutData_00:RefreshBreakOutData(tableData)
self.nActId = actId
self.ActEnd = true
if tableData ~= nil then
self:CacheAllLevelData(tableData)
@@ -11,6 +11,7 @@ local mapEventConfig = {
SetPlayFinishState = "SetPlayFinishState"
}
function BreakOutLevelData:InitData(nLevelId, nCharacterNid, nActId)
self:UnBindEvent()
self.nLevelId = nLevelId
self.tbSkillData = {}
self.cacheHasDicList = {}
@@ -18,9 +19,8 @@ function BreakOutLevelData:InitData(nLevelId, nCharacterNid, nActId)
self.nCharacterNid = nCharacterNid
self.bRestart = false
self:BindEvent()
self.tbDropCollect = {}
self.FloorId = ConfigTable.GetData("BreakOutLevel", nLevelId).FloorId
self.bIsEnd = true
self.bShouldExit = true
self.bIsFinishGame = false
local sJson = LocalData.GetPlayerLocalData("BreakOutFloorDicId")
local tb = decodeJson(sJson)
@@ -35,6 +35,7 @@ function BreakOutLevelData:RefreshCharSkillCd(nCharacterId, nCD)
self.tbCharacterData[nCharacterId].nCD = nCD
end
function BreakOutLevelData:GetCurrentFloorDrops(FloorData)
self.tbDropCollect = {}
if FloorData == nil then
return
end
@@ -77,7 +78,7 @@ function BreakOutLevelData:UnBindEvent()
end
end
function BreakOutLevelData:OnEvent_UnloadComplete()
if not self.bIsEnd then
if not self.bShouldExit then
local tempData = {
curChar = self.nCharacterNid,
nLevelId = self.nLevelId,
@@ -86,17 +87,17 @@ function BreakOutLevelData:OnEvent_UnloadComplete()
}
EventManager.Hit("BreakOutRestart")
EventManager.Hit("Event_ReStartBreakOut", tempData)
self.bIsEnd = true
self.bShouldExit = true
else
NovaAPI.EnterModule("MainMenuModuleScene", true)
self:UnBindEvent()
end
end
function BreakOutLevelData:SetBreakOut_Complete(bIsEnd)
self.bIsEnd = bIsEnd
self.bShouldExit = bIsEnd
end
function BreakOutLevelData:GetIsBreakOut_Complete()
return self.bIsEnd
return self.bShouldExit
end
function BreakOutLevelData:SetPlayFinishState(bIsFinishGame)
self.bIsFinishGame = bIsFinishGame
@@ -0,0 +1,251 @@
local ActivityDataBase = require("GameCore.Data.DataClass.Activity.ActivityDataBase")
local LocalData = require("GameCore.Data.LocalData")
local GoldenSpyData = class("GoldenSpyData", ActivityDataBase)
local GoldenSpyLevelData = require("Game.UI.Activity.GoldenSpy.GoldenSpyLevelData")
local ClientManager = CS.ClientManager.Instance
local RapidJson = require("rapidjson")
local RedDotManager = require("GameCore.RedDot.RedDotManager")
function GoldenSpyData:Init()
self.GoldenSpyLevelData = GoldenSpyLevelData.new()
self.cacheEnterGroupList = {}
self.tbLevelGroupData = {}
self.tbLevelData = {}
self.cacheEnterFloorList = {}
self:AddListeners()
end
function GoldenSpyData:AddListeners()
EventManager.Add(EventId.IsNewDay, self, self.OnEvent_NewDay)
end
function GoldenSpyData:OnEvent_NewDay()
end
function GoldenSpyData:RefreshGoldenSpyActData(actId, msgData)
self:Init()
self.nActId = actId
self.tbLevelGroupData = {}
self.tbLevelData = {}
local sJson = LocalData.GetPlayerLocalData("GoldenSpyGroupData")
local tb = decodeJson(sJson)
if type(tb) == "table" then
self.cacheEnterGroupList = tb
end
local sfloorJson = LocalData.GetPlayerLocalData("GoldenSpyFloorData")
local tbFloor = decodeJson(sfloorJson)
if type(tbFloor) == "table" then
self.cacheEnterFloorList = tbFloor
end
self:CacheAllLevelData(msgData.Levels)
end
function GoldenSpyData:CacheAllLevelData(msgData)
local controllCfg = ConfigTable.GetData("GoldenSpyControl", self.nActId)
if controllCfg == nil then
return
end
for _, v in ipairs(controllCfg.LevelGroupList) do
local levelGroupCfg = ConfigTable.GetData("GoldenSpyLevelGroup", v)
if levelGroupCfg ~= nil then
local levelGroupData = {
nId = levelGroupCfg.Id,
nStartTime = self:GetGroupStartTime(levelGroupCfg.Id)
}
self.tbLevelGroupData[levelGroupCfg.Id] = levelGroupData
for _, v in ipairs(levelGroupCfg.LevelList) do
local levelCfg = ConfigTable.GetData("GoldenSpyLevel", v)
if levelCfg ~= nil then
local levelData = {
nId = levelCfg.Id,
nMaxScore = 0,
bFirstComplete = false
}
self:UpdateLevelData(levelData)
end
end
end
end
if msgData ~= nil then
for _, v in ipairs(msgData) do
local levelData = {
nId = v.LevelId,
nMaxScore = v.MaxScore or 0,
bFirstComplete = v.FirstComplete
}
self:UpdateLevelData(levelData)
end
end
self:RefreshRedDot()
end
function GoldenSpyData:UpdateLevelData(levelData)
self.tbLevelData[levelData.nId] = levelData
end
function GoldenSpyData:GetLevelDataById(levelId)
return self.tbLevelData[levelId]
end
function GoldenSpyData:CheckPreLevelPassById(levelId)
local levelCfg = ConfigTable.GetData("GoldenSpyLevel", levelId)
if levelCfg == nil then
return false
end
local preLevelId = levelCfg.PreLevelId
if preLevelId == 0 then
return true
end
local preLevelData = self:GetLevelDataById(preLevelId)
if preLevelData == nil then
return true
end
return preLevelData.bFirstComplete
end
function GoldenSpyData:GetGroupIsNew(groupId)
if table.indexof(self.cacheEnterGroupList, groupId) == 0 then
return true
end
return false
end
function GoldenSpyData:EnterGroupSelect(groupId)
local actGroupId = ConfigTable.GetData("Activity", self.nActId).MidGroupId
if table.indexof(self.cacheEnterGroupList, groupId) == 0 then
table.insert(self.cacheEnterGroupList, groupId)
LocalData.SetPlayerLocalData("GoldenSpyGroupData", RapidJson.encode(self.cacheEnterGroupList))
RedDotManager.SetValid(RedDotDefine.Activity_GoldenSpy_Group, {actGroupId, groupId}, false)
self:RefreshRedDot()
end
end
function GoldenSpyData:GetLevelGroupDataById(groupId)
return self.tbLevelGroupData[groupId]
end
function GoldenSpyData:GetAllLevelGroupData()
return self.tbLevelGroupData
end
function GoldenSpyData:CheckPreGroupPassByGroupId(groupId)
local tbGroupList = ConfigTable.GetData("GoldenSpyControl", self.nActId).LevelGroupList
local nIndex = table.indexof(tbGroupList, groupId)
if nIndex == 1 then
return true
end
local preGroupId = tbGroupList[nIndex - 1]
local preGroupData = self:GetLevelGroupDataById(preGroupId)
if preGroupData == nil then
return false
end
local groupCfg = ConfigTable.GetData("GoldenSpyLevelGroup", preGroupId)
if groupCfg == nil then
return false
end
local bAllLevelPass = true
for _, levelId in ipairs(groupCfg.LevelList) do
local levelData = self:GetLevelDataById(levelId)
local levelCfg = ConfigTable.GetData("GoldenSpyLevel", levelId)
if levelData == nil then
bAllLevelPass = false
break
end
if not levelData.bFirstComplete then
bAllLevelPass = false
break
end
end
return bAllLevelPass
end
function GoldenSpyData:GetGroupStartTime(groupId)
local groupConfig = ConfigTable.GetData("GoldenSpyLevelGroup", groupId)
if groupConfig == nil then
return 0
end
local openActDayNextTime = ClientManager:GetNextRefreshTime(self.nOpenTime)
local nTempDay = 0
if openActDayNextTime > self.nOpenTime then
nTempDay = 1
end
local nDay = (ClientManager.serverTimeStamp - openActDayNextTime) // 86400 + nTempDay
if nDay >= groupConfig.DayOpen then
return 0
end
local openDayNextTime = ClientManager:GetNextRefreshTime(ClientManager.serverTimeStamp)
return openDayNextTime + (groupConfig.DayOpen - nDay - 1) * 86400
end
function GoldenSpyData:GetGoldenSpyLevelData()
return self.GoldenSpyLevelData
end
function GoldenSpyData:GetGoldenSpyFloorData()
return self.GoldenSpyLevelData:GetFloorData()
end
function GoldenSpyData:RefreshRedDot()
if not self:GetPlayState() then
return
end
local actGroupId = ConfigTable.GetData("Activity", self.nActId).MidGroupId
for _, groupData in pairs(self.tbLevelGroupData) do
if CS.ClientManager.Instance.serverTimeStamp < groupData.nStartTime and groupData.nStartTime ~= 0 then
RedDotManager.SetValid(RedDotDefine.Activity_GoldenSpy_Group, {
actGroupId,
groupData.nId
}, false)
elseif not self:CheckPreGroupPassByGroupId(groupData.nId) then
RedDotManager.SetValid(RedDotDefine.Activity_GoldenSpy_Group, {
actGroupId,
groupData.nId
}, false)
else
RedDotManager.SetValid(RedDotDefine.Activity_GoldenSpy_Group, {
actGroupId,
groupData.nId
}, self:GetGroupIsNew(groupData.nId))
end
end
end
function GoldenSpyData:StartLevel(groupId, levelId)
self.nGroupId = groupId
self.GoldenSpyLevelData:InitData()
self.GoldenSpyLevelData:StartLevel(levelId)
EventManager.Hit(EventId.OpenPanel, PanelId.GoldenSpyPanel, self.nActId, self.nGroupId, levelId)
end
function GoldenSpyData:FinishLevel(levelId, data, callback)
local items = {}
for _, v in pairs(data.tbItems) do
local data = {
ItemId = v.itemId,
PickCount = v.itemCount
}
table.insert(items, data)
end
local skills = {}
for k, v in pairs(data.tbSkills) do
local data = {SkillId = k, UseCount = v}
table.insert(skills, data)
end
local mapMsg = {
ActivityId = self.nActId,
LevelId = levelId,
Floor = data.nFloor,
Score = data.nScore,
CompletedTaskCount = data.nTaskCompleteCount,
Items = items,
Skills = skills
}
local callback = function(_, msgData)
local oldLevelData = self:GetLevelDataById(levelId)
local levelCfg = ConfigTable.GetData("GoldenSpyLevel", levelId)
local levelData = {
nId = levelId,
nMaxScore = math.max(oldLevelData.nMaxScore, data.nScore),
bFirstComplete = oldLevelData.bFirstComplete or data.nScore >= levelCfg.Score
}
self:UpdateLevelData(levelData)
if callback ~= nil then
callback()
end
end
HttpNetHandler.SendMsg(NetMsgId.Id.activity_gds_settle_req, mapMsg, nil, callback)
end
function GoldenSpyData:EnterFloor(floorId)
if table.indexof(self.cacheEnterFloorList, floorId) == 0 then
table.insert(self.cacheEnterFloorList, floorId)
LocalData.SetPlayerLocalData("GoldenSpyFloorData", RapidJson.encode(self.cacheEnterFloorList))
end
end
function GoldenSpyData:GetFloorIsNew(floorId)
if table.indexof(self.cacheEnterFloorList, floorId) == 0 then
return true
end
return false
end
return GoldenSpyData
@@ -224,6 +224,10 @@ function PenguinCardActData:RefreshLevelRedDot()
local bSkip = table.indexof(self.tbSkipNewLevel, nId) > 0
if bSkip then
RedDotManager.SetValid(RedDotDefine.Activity_PenguinCard_Level, {nId}, false)
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
if bInActGroup then
RedDotManager.SetValid(RedDotDefine.Activity_Group_PenguinCard_Level, {nActGroupId, nId}, false)
end
else
local bLock = self:CheckLevelLock(nId)
local bHasScore = self.mapLevelData[nId] and 0 < self.mapLevelData[nId].nScore
@@ -234,10 +238,18 @@ function PenguinCardActData:RefreshLevelRedDot()
RedDotManager.SetValid(RedDotDefine.Activity_PenguinCard_Level, {nId}, bNew)
end
end
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
if bInActGroup then
RedDotManager.SetValid(RedDotDefine.Activity_Group_PenguinCard_Level, {nActGroupId}, #self.tbNewLevel > 0)
end
end
function PenguinCardActData:SkipLevelRedDot()
for _, nId in ipairs(self.tbNewLevel) do
RedDotManager.SetValid(RedDotDefine.Activity_PenguinCard_Level, {nId}, false)
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
if bInActGroup then
RedDotManager.SetValid(RedDotDefine.Activity_Group_PenguinCard_Level, {nActGroupId}, false)
end
if table.indexof(self.tbSkipNewLevel, nId) == 0 then
table.insert(self.tbSkipNewLevel, nId)
end
@@ -26,6 +26,8 @@ local SpringFestival_10104Data = require("GameCore.Data.DataClass.Activity.Sprin
local WinterNight_10105Data = require("GameCore.Data.DataClass.Activity.WinterNight_10105Data")
local Postal_10106Data = require("GameCore.Data.DataClass.Activity.Postal_10106Data")
local PenguinCardActData = require("GameCore.Data.DataClass.Activity.PenguinCardActData")
local GoldenSpyData = require("GameCore.Data.DataClass.Activity.GoldenSpyData")
local Solodance_20102Data = require("GameCore.Data.DataClass.Activity.Solodance_20102Data")
function PlayerActivityData:Init()
self.bCacheActData = false
self.tbAllActivity = {}
@@ -134,6 +136,8 @@ function PlayerActivityData:CacheAllActivityData(mapNetMsg)
self:RefreshThrowGiftData(nActId, v.ThrowGift)
elseif actCfg.ActivityType == GameEnum.activityType.PenguinCard then
self:RefreshPenguinCardActData(nActId, v.PenguinCard)
elseif actCfg.ActivityType == GameEnum.activityType.GoldenSpy then
self:RefreshGoldenSpyActData(nActId, v.GDS)
end
end
end
@@ -228,6 +232,8 @@ function PlayerActivityData:CreateActivityIns(actData)
actIns = ThrowGiftData.new(actData)
elseif actCfg.ActivityType == GameEnum.activityType.PenguinCard then
actIns = PenguinCardActData.new(actData)
elseif actCfg.ActivityType == GameEnum.activityType.GoldenSpy then
actIns = GoldenSpyData.new(actData)
end
if actIns ~= nil then
self.tbAllActivity[actData.Id] = actIns
@@ -327,6 +333,8 @@ function PlayerActivityData:CreateActivityGroupIns(actData)
actIns = WinterNight_10105Data.new(actData)
elseif actCfg.ActivityThemeType == GameEnum.activityThemeType.Postal_10106 then
actIns = Postal_10106Data.new(actData)
elseif actCfg.ActivityThemeType == GameEnum.activityThemeType.SoloDance_20102 then
actIns = Solodance_20102Data.new(actData)
end
self.tbAllActivityGroup[actData.Id] = actIns
PlayerData.ActivityAvg:RefreshAvgRedDot()
@@ -560,6 +568,11 @@ function PlayerActivityData:RefreshPenguinCardActData(nActId, msgData)
self.tbAllActivity[nActId]:RefreshPenguinCardActData(msgData)
end
end
function PlayerActivityData:RefreshGoldenSpyActData(nActId, msgData)
if nil ~= self.tbAllActivity[nActId] then
self.tbAllActivity[nActId]:RefreshGoldenSpyActData(nActId, msgData)
end
end
function PlayerActivityData:RefreshActivityLevelGameActData(nActId, msgData)
if nil ~= self.tbAllActivity[nActId] then
self.tbAllActivity[nActId]:RefreshActivityLevelGameActData(nActId, msgData)
@@ -0,0 +1,61 @@
local ActivityGroupDataBase = require("GameCore.Data.DataClass.Activity.ActivityGroupDataBase")
local Solodance_20102Data = class("Solodance_20102Data", ActivityGroupDataBase)
function Solodance_20102Data:Init()
self.tbAllActivity = {}
self.nCGActivityId = 0
self.sCGPath = ""
self.bPlayedCG = false
self:ParseActivity()
end
function Solodance_20102Data: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 Solodance_20102Data:GetActivityDataByIndex(nIndex)
for _, activity in pairs(self.tbAllActivity) do
if activity.Index == nIndex then
return activity
end
end
end
function Solodance_20102Data:PlayCG()
self:SendMsg_CG_READ(self.nCGActivityId)
end
function Solodance_20102Data:GetActivityGroupCGPlayed()
if self.bPlayedCG then
return true
end
return PlayerData.Activity:IsCGPlayed(self.nCGActivityId)
end
function Solodance_20102Data:IsActivityInActivityGroup(nActivityId)
for _, activity in pairs(self.tbAllActivity) do
if activity.ActivityId == nActivityId then
return true, self.nActGroupId
end
end
return false
end
function Solodance_20102Data:SendMsg_CG_READ(nActivityId)
local Callback = function()
self.bPlayedCG = true
end
HttpNetHandler.SendMsg(NetMsgId.Id.activity_cg_read_req, {nActivityId}, nil, Callback)
end
return Solodance_20102Data
@@ -13,6 +13,10 @@ function TrekkerVersusData:Init()
self.bFirstIn = true
self.nSuccessBattle = 0
self.nLastBattleHard = 0
self.nTimerIdleRefresh = 0
self.bFirstBattlePlayed = false
EventManager.Add("TrekkerVersusReceiveHeatQuest", self, self.RequestReceiveScheduleReward)
EventManager.Add("TrekkerVersusFanGiftDataRefresh", self, self.OnEvent_TrekkerVersusFanGiftDataRefresh)
end
function TrekkerVersusData:GetActivityData()
return {
@@ -31,19 +35,28 @@ function TrekkerVersusData:RefreshTrekkerVersusData(nActId, msgData)
self.nFanLevel = msgData.Level
self.nFanExp = msgData.Exp
self.nIdleRewardStartTime = msgData.Show.IdleTime
self.tbIdleReward = msgData.Show.IdleValues
self.tbIdleReward = msgData.Show.IdleValues or {}
self.nSelfHotValue = msgData.Show.SelfHotValue
self.nRivalHotValue = msgData.Show.RivalHotValue
self.tbHotValueRewardIds = msgData.HotValueRewardIds
self.tbHotValueRewardIds = msgData.HotValueRewardIds or {}
self.tbDuelRewardIds = msgData.DuelRewardIds
self.tbDuelHistory = msgData.HistoryResult
self.tbDuelHistory = msgData.Results
self.bFirstBattlePlayed = self.nIdleRewardStartTime ~= nil and self.nIdleRewardStartTime > 0
self.nLastBuildId = msgData.BuildId
self.nCachedBuildId = msgData.BuildId
self.nRecord = msgData.Show.Difficulty
self.nRecord = msgData.Show.Difficult or 0
self.nRivalCount = 0
local foreachRival = function(mapData)
if mapData.GroupId == self.nActId then
self.nRivalCount = self.nRivalCount + 1
end
end
ForEachTableLine(DataTable.TravelerDuelTarget, foreachRival)
for _, mapQuest in ipairs(msgData.Quests) do
self.mapQuests[mapQuest.Id] = mapQuest
end
self:RefreshQusetRedDot()
PlayerData.State:RefreshTrekkerVersusIdleRewardRedDot()
end
function TrekkerVersusData:EnterTrekkerVersus(nLevelId, nBuildId, tbAffix)
local callback = function()
@@ -65,11 +78,7 @@ function TrekkerVersusData:GetTravelerDuelAffixUnlock(nAffixId)
if mapAffixCfgData.UnlockDurationTime > 0 and curTimeStamp < _fixedTimeStamp then
local sCond = ""
local sumTime = _fixedTimeStamp - curTimeStamp
if 86400 < sumTime then
sCond = orderedFormat(ConfigTable.GetUIText("TDQuest_Day"), math.floor(sumTime / 86400))
else
sCond = ConfigTable.GetUIText("TDQuest_LessThenDay")
end
sCond = orderedFormat(ConfigTable.GetUIText("TDQuest_Day"), math.ceil(sumTime / 86400))
return false, 4, sCond
end
if 0 < mapAffixCfgData.UnlockDifficulty and self.nRecord < mapAffixCfgData.UnlockDifficulty then
@@ -99,18 +108,38 @@ function TrekkerVersusData:GetAllQuestData()
table.sort(ret, sort)
return ret
end
function TrekkerVersusData:CheckBattlePlayed()
return self.bFirstBattlePlayed
end
function TrekkerVersusData:GetCurStreamerDuelData()
local mapStreamerDuelCfgData = self:GetTrekkerVersusCfgData()
local mapDuelData
local nMaxDay = 1
local mapLastData
local foreachDuel = function(mapData)
if mapData.DayNum >= nMaxDay then
nMaxDay = mapData.DayNum
mapLastData = mapData
end
if mapData.GroupId == mapStreamerDuelCfgData.TargetGroupId and mapData.DayNum == self.nDayNum then
mapDuelData = mapData
end
end
ForEachTableLine(DataTable.TravelerDuelTarget, foreachDuel)
if mapDuelData == nil then
mapDuelData = mapLastData
end
return mapDuelData
end
function TrekkerVersusData:GetCurHeatValue()
local nLastDuelResultHeatValue = 0
if self.tbDuelHistory ~= nil and 0 < #self.tbDuelHistory then
nLastDuelResultHeatValue = self.tbDuelHistory[#self.tbDuelHistory].SelfHotValue or 0
end
if nLastDuelResultHeatValue > self.nSelfHotValue then
self.nSelfHotValue = nLastDuelResultHeatValue
self.nRivalHotValue = self.tbDuelHistory[#self.tbDuelHistory].RivalHotValue or 0
end
local mapHeatData = {
nSelfHotValue = self.nSelfHotValue or 0,
nRivalHotValue = self.nRivalHotValue or 0
@@ -128,10 +157,52 @@ function TrekkerVersusData:GetCurFanData()
return mapFanData
end
function TrekkerVersusData:GetDuelHistory()
table.sort(self.tbDuelHistory, function(a, b)
return a.SelfHotValue > b.SelfHotValue
end)
return self.tbDuelHistory
end
function TrekkerVersusData:GetIdleReward()
return self.tbIdleReward
local tbIdleReward = {}
local bAllZero = true
local foreachIdleReward = function(mapData)
for k, v in pairs(self.tbIdleReward) do
if v.TypeId == mapData.HotValueItemType then
local nCount = math.floor(v.Value / mapData.CumulativeValue)
if 1 <= nCount then
bAllZero = false
end
table.insert(tbIdleReward, {
Tid = mapData.Id,
Qty = nCount
})
break
end
end
end
ForEachTableLine(DataTable.TravelerDuelHotValueItem, foreachIdleReward)
if bAllZero then
tbIdleReward = {}
end
return tbIdleReward
end
function TrekkerVersusData:GetIdleValue()
return self.tbIdleReward or 0
end
function TrekkerVersusData:GetRecordLevel()
return self.nRecord or 0
end
function TrekkerVersusData:GetIdleRewardStartTime()
return self.nIdleRewardStartTime
end
function TrekkerVersusData:GetRivalCount()
return self.nRivalCount or 0
end
function TrekkerVersusData:GetHotValueRewardTable()
return self.tbHotValueRewardIds
end
function TrekkerVersusData:GetDuelRewardTable()
return self.tbDuelRewardIds
end
function TrekkerVersusData:SetCachedBuildId(nBuildId)
self.nCachedBuildId = nBuildId
@@ -163,7 +234,7 @@ function TrekkerVersusData:EnterGame(nLevel, nBuildId, tbAffixes)
end
end
function TrekkerVersusData:SettleBattle(bSuccess, nLevelId, nTime, tbAffix, nBuildId, msgCallback)
local callback = function()
local callback = function(_, msgData)
local bNewRecord = false
if bSuccess then
local nRecordLevel = 0
@@ -188,6 +259,7 @@ function TrekkerVersusData:SettleBattle(bSuccess, nLevelId, nTime, tbAffix, nBui
end
self.nSuccessBattle = 1
self.nLastBattleHard = nRecordLevel
self.bFirstBattlePlayed = true
else
self.nSuccessBattle = -1
local nRecordLevel = 0
@@ -199,6 +271,10 @@ function TrekkerVersusData:SettleBattle(bSuccess, nLevelId, nTime, tbAffix, nBui
end
self.nLastBattleHard = nRecordLevel
end
if msgData ~= nil and msgData.Show ~= nil then
self.nIdleRewardStartTime = msgData.Show.IdleTime
self.tbIdleReward = msgData.Show.IdleValues
end
if msgCallback ~= nil then
msgCallback(bNewRecord)
end
@@ -213,20 +289,47 @@ function TrekkerVersusData:SettleBattle(bSuccess, nLevelId, nTime, tbAffix, nBui
}
HttpNetHandler.SendMsg(NetMsgId.Id.activity_trekker_versus_settle_req, msg, nil, callback)
end
function TrekkerVersusData:RequestIdleRefresh()
local msg = {
Value = self.nActId
}
local callback = function(_, msgData)
function TrekkerVersusData:RequestIdleRefresh(callback)
local nElapsedTime = CS.ClientManager.Instance.serverTimeStamp - self.nTimerIdleRefresh
if nElapsedTime < 60 then
if callback ~= nil then
callback()
end
return
end
self.nTimerIdleRefresh = CS.ClientManager.Instance.serverTimeStamp
local cb = function(_, msgData)
if msgData ~= nil then
self.nIdleRewardStartTime = msgData.IdleTime
self.nDifficult = msgData.Difficulty
self.tbIdleReward = msgData.IdleValues
self.nSelfHotValue = msgData.SelfHotValue
self.nRivalHotValue = msgData.RivalHotValue
local bRedDotOn = false
if self.tbIdleReward ~= nil and #self.tbIdleReward > 0 then
local nPassedTime = CS.ClientManager.Instance.serverTimeStamp - self.nIdleRewardStartTime
if nPassedTime >= 3600 * ConfigTable.GetConfigNumber("TrekkerVersusIdleRewardRedDotTime") then
bRedDotOn = true
end
end
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
if bInActGroup then
RedDotManager.SetValid(RedDotDefine.TrekkerVersusIdleReward, {
nActGroupId,
self.nActId
}, bRedDotOn)
end
PlayerData.State:RefreshTrekkerVersusIdleRewardRedDot(self.nIdleRewardStartTime)
self:RefreshQusetRedDot()
local mapHeatData = self:GetCurHeatValue()
EventManager.Hit("UpdateTrekkerVersusHotValue", mapHeatData.nSelfHotValue, mapHeatData.nRivalHotValue)
if callback ~= nil then
callback(msgData)
end
end
end
HttpNetHandler.SendMsg(NetMsgId.Id.activity_trekker_versus_idle_refresh_req, msg, nil, callback)
HttpNetHandler.SendMsg(NetMsgId.Id.activity_trekker_versus_idle_refresh_req, {
Value = self.nActId
}, nil, cb)
end
function TrekkerVersusData:RequestIdleRewardReceive(callback)
local msg = {
@@ -235,10 +338,16 @@ function TrekkerVersusData:RequestIdleRewardReceive(callback)
local cb = function(_, msgData)
if msgData ~= nil then
if msgData.Change ~= nil then
HttpNetHandler.ProcChangeInfo(msgData.Change)
local mapDecodedChangeInfo = UTILS.DecodeChangeInfo(msgData.Change)
HttpNetHandler.ProcChangeInfo(mapDecodedChangeInfo)
UTILS.OpenReceiveByDisplayItem(msgData.AwardItems, msgData.ChangeInfo)
end
self.nIdleRewardStartTime = msgData.IdleTime
for k, v in pairs(self.tbIdleReward) do
v.Value = 0
end
PlayerData.State:RefreshTrekkerVersusIdleRewardRedDot(self.nIdleRewardStartTime)
self:RefreshQusetRedDot()
if callback ~= nil then
callback(msgData)
end
@@ -246,7 +355,7 @@ function TrekkerVersusData:RequestIdleRewardReceive(callback)
end
HttpNetHandler.SendMsg(NetMsgId.Id.activity_trekker_versus_idle_reward_receive_req, msg, nil, cb)
end
function TrekkerVersusData:RequestSendStreamerGift(tbGift, callback)
function TrekkerVersusData:RequestSendStreamerGift(tbGift, nAddHotValue, callback)
local msg = {
ActivityId = self.nActId,
Items = tbGift
@@ -257,12 +366,20 @@ function TrekkerVersusData:RequestSendStreamerGift(tbGift, callback)
local nPrevFanExp = self.nFanExp
self.nFanLevel = msgData.Level
self.nFanExp = msgData.Exp
self.nSelfHotValue = msgData.Show.SelfHotValue
self.nRivalHotValue = msgData.Show.RivalHotValue
if msgData.Change ~= nil then
HttpNetHandler.ProcChangeInfo(msgData.Change)
UTILS.OpenReceiveByDisplayItem(msgData.AwardItems, msgData.ChangeInfo)
local nNowTime = CS.ClientManager.Instance.serverTimeStamp
if msgData.SelfHotValue > self.nSelfHotValue then
self.nSelfHotValue = msgData.SelfHotValue
elseif nNowTime < self:GetChallengeEndTime() then
self.nSelfHotValue = self.nSelfHotValue + nAddHotValue
end
self.nRivalHotValue = msgData.RivalHotValue
local mapHeatData = self:GetCurHeatValue()
EventManager.Hit("UpdateTrekkerVersusHotValue", mapHeatData.nSelfHotValue, mapHeatData.nRivalHotValue)
if msgData.Change ~= nil then
local mapDecodedChangeInfo = UTILS.DecodeChangeInfo(msgData.Change)
HttpNetHandler.ProcChangeInfo(mapDecodedChangeInfo)
end
self:RefreshQusetRedDot()
if callback ~= nil then
callback(msgData, nPrevFanLevel, nPrevFanExp)
end
@@ -276,9 +393,30 @@ function TrekkerVersusData:RequestReceiveScheduleReward(nScheduleType)
ScheduleType = nScheduleType
}
local callback = function(_, msgData)
if msgData ~= nil and msgData.Change ~= nil then
HttpNetHandler.ProcChangeInfo(msgData.Change)
UTILS.OpenReceiveByDisplayItem(msgData.AwardItems, msgData.ChangeInfo)
if msgData ~= nil then
if msgData.Change ~= nil then
local mapDecodedChangeInfo = UTILS.DecodeChangeInfo(msgData.Change)
HttpNetHandler.ProcChangeInfo(mapDecodedChangeInfo)
UTILS.OpenReceiveByDisplayItem(msgData.AwardItems, msgData.ChangeInfo)
end
if nScheduleType == 1 then
local foreachHeatQuest = function(mapQuestData)
if mapQuestData.TargetValue <= self.nSelfHotValue and table.indexof(self.tbHotValueRewardIds, mapQuestData.Id) <= 0 then
table.insert(self.tbHotValueRewardIds, mapQuestData.Id)
end
end
ForEachTableLine(DataTable.TravelerDuelHotValueRewards, foreachHeatQuest)
self:RefreshQusetRedDot()
EventManager.Hit("TrekkerVersusHeatQuestRefresh")
elseif nScheduleType == 2 then
for _, v in pairs(self.tbDuelHistory) do
if table.indexof(self.tbDuelRewardIds, v.TargetId) <= 0 then
table.insert(self.tbDuelRewardIds, v.TargetId)
end
end
self:RefreshQusetRedDot()
EventManager.Hit("TrekkerVersusDuelQuestRefresh")
end
end
end
HttpNetHandler.SendMsg(NetMsgId.Id.activity_trekker_versus_schedule_reward_receive_req, msg, nil, callback)
@@ -309,8 +447,10 @@ function TrekkerVersusData:ReceiveQuestReward(callback)
end
end
local msgCallback = function(_, msgData)
if callback ~= nil then
callback(msgData)
if msgData.Change ~= nil then
local mapDecodedChangeInfo = UTILS.DecodeChangeInfo(msgData.Change)
HttpNetHandler.ProcChangeInfo(mapDecodedChangeInfo)
UTILS.OpenReceiveByDisplayItem(msgData.AwardItems, msgData.ChangeInfo)
end
for _, mapQuest in pairs(self.mapQuests) do
if mapQuest.Status == 1 then
@@ -318,6 +458,10 @@ function TrekkerVersusData:ReceiveQuestReward(callback)
end
end
self:RefreshQusetRedDot()
EventManager.Hit("TrekkerVersusQuestRefresh")
if callback ~= nil then
callback(msgData)
end
end
if bReceive then
local msg = {
@@ -347,16 +491,60 @@ function TrekkerVersusData:GetChallengeEndTime()
end
return self.nEndTime
end
function TrekkerVersusData:IsOpenStreamerDuel(nStartTime)
local nowTime = CS.ClientManager.Instance.serverTimeStamp
local nEndTime = CS.ClientManager.Instance:GetNextRefreshTime(nStartTime) + 86400 * (self.nRivalCount - 1)
return nStartTime < nowTime and nowTime < nEndTime
end
function TrekkerVersusData:RefreshQusetRedDot()
local bVisible = false
local bGiftQuestVisible = false
local bBattleQuestVisible = false
for _, mapQuest in pairs(self.mapQuests) do
if mapQuest.Status == 1 then
bVisible = true
break
local mapQuestData = ConfigTable.GetData("TravelerDuelChallengeQuest", mapQuest.Id)
if mapQuestData.CompleteCond == GameEnum.questCompleteCond.TrekkerVersusFansWithSpecificLevel then
bGiftQuestVisible = true
else
bBattleQuestVisible = true
end
end
end
RedDotManager.SetValid(RedDotDefine.TrekkerVersusQuest, nil, bVisible)
RedDotManager.SetValid(RedDotDefine.TrekkerVersusQuest_1, nil, bVisible)
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
if bInActGroup then
RedDotManager.SetValid(RedDotDefine.TrekkerVersusGiftQuest, {
nActGroupId,
self.nActId
}, bGiftQuestVisible)
RedDotManager.SetValid(RedDotDefine.TrekkerVersusBattleQuest, {
nActGroupId,
self.nActId
}, bBattleQuestVisible)
end
local bStreamerDuelOpen = self:IsOpenStreamerDuel(self:GetChallengeStartTime())
local nPassedDuelCount = bStreamerDuelOpen and self.nDayNum - 1 or self.nRivalCount
if self.nDayNum == 0 then
nPassedDuelCount = self.nRivalCount
end
local nReceivedDuelReward = #self.tbDuelRewardIds
if bInActGroup then
RedDotManager.SetValid(RedDotDefine.TrekkerVersusDuelQuest, {
nActGroupId,
self.nActId
}, nPassedDuelCount > nReceivedDuelReward)
end
local bHeatQuestVisible = false
local foreachHeatReward = function(mapData)
if mapData.TargetValue <= self.nSelfHotValue and table.indexof(self.tbHotValueRewardIds, mapData.Id) <= 0 then
bHeatQuestVisible = true
end
end
ForEachTableLine(DataTable.TravelerDuelHotValueRewards, foreachHeatReward)
if bInActGroup then
RedDotManager.SetValid(RedDotDefine.TrekkerVersusHeatQuest, {
nActGroupId,
self.nActId
}, bHeatQuestVisible)
end
end
function TrekkerVersusData:GetFirstIn()
local bFirst = self.bFirstIn
@@ -365,4 +553,12 @@ function TrekkerVersusData:GetFirstIn()
end
return bFirst
end
function TrekkerVersusData:OnEvent_TrekkerVersusFanGiftDataRefresh(nActId, nFanLevel, nExp)
if nActId ~= self.nActId then
return
end
self.nFanLevel = nFanLevel
self.nFanExp = nExp
EventManager.Hit("TrekkerVersusFanGiftShowRefresh")
end
return TrekkerVersusData
@@ -1,4 +1,6 @@
local dailycheckinctrl = require("Game.UI.CheckIn.DailyCheckInCtrl")
local NotificationManager = require("GameCore.Module.NotificationManager")
local LocalSettingData = require("GameCore.Data.LocalSettingData")
local DispatchData = class("DispatchData")
local tbAllDispatchData = {}
local tbWeeklyDispatchDataIds = {}
@@ -9,6 +11,8 @@ local OnEvent_NewDay = function()
tbCompletedDailyDispatchIds = {}
EventManager.Hit("UpdateDispatchData")
end
local OnEvent_SettingsNotificationClose = function()
end
local Init = function()
EventManager.Add(EventId.IsNewDay, DispatchData, OnEvent_NewDay)
end
@@ -23,6 +27,7 @@ local CacheDispatchData = function(data)
local state = AllEnum.DispatchState.Accepting
if v.ProcessTime * 60 + v.StartTime <= CS.ClientManager.Instance.serverTimeStamp then
state = AllEnum.DispatchState.Complete
else
end
tbAllDispatchData[v.Id] = {Data = v, State = state}
end
+82 -24
View File
@@ -16,7 +16,9 @@ function EquipmentData:Clear()
self.nRefreshId = nil
self.bLock = nil
self.tbAffix = nil
self.tbUpgradeCount = nil
self.tbAlterAffix = nil
self.tbAlterUpgradeCount = nil
self.tbPotentialAffix = nil
self.tbSkillAffix = nil
self.tbRandomAttr = nil
@@ -44,51 +46,72 @@ function EquipmentData:ParseConfigData(equipmentCfg)
end
function EquipmentData:ParseServerData(mapEquipment)
self.bLock = mapEquipment.Lock
self:UpdateAffix(mapEquipment.Attributes)
self:UpdateAlterAffix(mapEquipment.AlterAttributes)
self:UpdateAffix(mapEquipment.Attributes, mapEquipment.OverlockCount)
self:UpdateAlterAffix(mapEquipment.AlterAttributes, mapEquipment.AlterOverlockCount)
end
function EquipmentData:UpdateAffix(tbAttributes)
function EquipmentData:UpdateAffix(tbAttributes, tbCount)
self.tbAffix = tbAttributes
self:UpdateRandomAttr(self.tbAffix)
self.tbUpgradeCount = tbCount
self:UpdateRandomAttr(self.tbAffix, self.tbUpgradeCount)
end
function EquipmentData:UpdateAlterAffix(tbAttributes)
function EquipmentData:UpdateAlterAffix(tbAttributes, tbCount)
self.tbAlterAffix = tbAttributes
self.tbAlterUpgradeCount = tbCount
end
function EquipmentData:ReplaceRandomAttr()
if not self.tbAlterAffix or next(self.tbAlterAffix) == nil then
return
end
if not self.tbAlterUpgradeCount or next(self.tbAlterUpgradeCount) == nil then
return
end
self.tbAffix = clone(self.tbAlterAffix)
for k, _ in ipairs(self.tbAlterAffix) do
self.tbAlterAffix[k] = 0
end
self:UpdateRandomAttr(self.tbAffix)
self.tbUpgradeCount = clone(self.tbAlterUpgradeCount)
for k, _ in ipairs(self.tbAlterUpgradeCount) do
self.tbAlterUpgradeCount[k] = 0
end
self:UpdateRandomAttr(self.tbAffix, self.tbUpgradeCount)
end
function EquipmentData:UpdateRandomAttr(mapAttrs)
function EquipmentData:UpdateRandomAttr(mapAttrs, tbCount)
self.tbPotentialAffix = {}
self.tbSkillAffix = {}
self.tbRandomAttr = {}
self.tbEffect = {}
for _, v in ipairs(mapAttrs) do
local add = function(mapCfg, nAttrId)
if not mapCfg then
return
end
if mapCfg.AttrType == GameEnum.CharGemEffectType.Potential then
table.insert(self.tbPotentialAffix, mapCfg)
elseif mapCfg.AttrType == GameEnum.CharGemEffectType.SkillLevel then
table.insert(self.tbSkillAffix, mapCfg)
elseif mapCfg.AttrType == GameEnum.effectType.ATTR_FIX or mapCfg.AttrType == GameEnum.effectType.PLAYER_ATTR_FIX then
if mapCfg.AttrTypeSecondSubtype == GameEnum.parameterType.BASE_VALUE then
local value = tonumber(mapCfg.Value) or 0
local mapData = {
AttrId = nAttrId,
Value = value,
CfgValue = value / ConfigData.IntFloatPrecision
}
table.insert(self.tbRandomAttr, mapData)
else
table.insert(self.tbEffect, mapCfg.EffectId)
end
end
end
for k, v in ipairs(mapAttrs) do
if 0 < v then
local mapCfg = ConfigTable.GetData("CharGemAttrValue", v)
if mapCfg then
if mapCfg.AttrType == GameEnum.CharGemEffectType.Potential then
table.insert(self.tbPotentialAffix, mapCfg)
elseif mapCfg.AttrType == GameEnum.CharGemEffectType.SkillLevel then
table.insert(self.tbSkillAffix, mapCfg)
elseif mapCfg.AttrType == GameEnum.effectType.ATTR_FIX or mapCfg.AttrType == GameEnum.effectType.PLAYER_ATTR_FIX then
if mapCfg.AttrTypeSecondSubtype == GameEnum.parameterType.BASE_VALUE then
local value = tonumber(mapCfg.Value) or 0
local mapData = {
AttrId = v,
Value = value,
CfgValue = value / ConfigData.IntFloatPrecision
}
table.insert(self.tbRandomAttr, mapData)
else
table.insert(self.tbEffect, mapCfg.EffectId)
end
if tbCount and 0 < tbCount[k] then
local nId = mapCfg.TypeId * 100 + tbCount[k] + mapCfg.Level
local mapAfterCfg = ConfigTable.GetData("CharGemAttrValue", nId)
add(mapAfterCfg, nId)
else
add(mapCfg, v)
end
end
end
@@ -137,6 +160,41 @@ function EquipmentData:CheckAlterEmpty()
end
return false
end
function EquipmentData:GetUpgradeCount()
local nAll = 0
if self.tbUpgradeCount then
for _, v in ipairs(self.tbUpgradeCount) do
nAll = nAll + v
end
end
return nAll
end
function EquipmentData:ChangeUpgradeCount(nAttrIndex, nChange)
if self.tbAlterUpgradeCount[nAttrIndex] == self.tbUpgradeCount[nAttrIndex] and self.tbAlterAffix[nAttrIndex] == self.tbAffix[nAttrIndex] then
self.tbAlterUpgradeCount[nAttrIndex] = self.tbAlterUpgradeCount[nAttrIndex] + nChange
end
self.tbUpgradeCount[nAttrIndex] = self.tbUpgradeCount[nAttrIndex] + nChange
end
function EquipmentData:CheckUpgradeAble()
local nAll = self:GetUpgradeCount()
local nLimit = ConfigTable.GetConfigNumber("CharGemOverlockCount")
return nAll < nLimit
end
function EquipmentData:CheckUpgradeAlterSame(nAttrIndex)
if not self.tbAlterAffix or next(self.tbAlterAffix) == nil then
return true
end
if not self.tbAlterUpgradeCount or next(self.tbAlterUpgradeCount) == nil then
return true
end
if self.tbAlterAffix[nAttrIndex] == 0 then
return true
end
if self.tbAlterUpgradeCount[nAttrIndex] == self.tbUpgradeCount[nAttrIndex] and self.tbAlterAffix[nAttrIndex] == self.tbAffix[nAttrIndex] then
return true
end
return false
end
function EquipmentData:GetTypeDesc()
local sLanguage = AllEnum.EquipmentType[self.nType].Language
return ConfigTable.GetUIText(sLanguage)
@@ -229,6 +229,11 @@ function FilterData:GetCacheFilterByKey(fKey, sKey)
end
return self:GetFilterByKey(fKey, sKey), false
end
function FilterData:GetCacheFilter(fKey)
if nil ~= self.tbCacheFilter[fKey] then
return self.tbCacheFilter[fKey]
end
end
function FilterData:CacheCharSort(nType, bOrder)
self.nFormationCharSrotType = nType
self.bFormationCharOrder = bOrder
+42 -1
View File
@@ -1,6 +1,8 @@
local PlayerBaseData = class("PlayerBaseData")
local TimerManager = require("GameCore.Timer.TimerManager")
local AvgManager = require("GameCore.Module.AvgManager")
local NotificationManager = require("GameCore.Module.NotificationManager")
local LocalSettingData = require("GameCore.Data.LocalSettingData")
local TimerScaleType = require("GameCore.Timer.TimerScaleType")
local ModuleManager = require("GameCore.Module.ModuleManager")
local localdata = require("GameCore.Data.LocalData")
@@ -127,6 +129,14 @@ function PlayerBaseData:ProcessTableData()
end
ForEachTableLine(ConfigTable.Get("DemonAdvance"), foreachTable)
CacheTable.Set("_DemonAdvance", _tbDemonAdvance)
self.tbHonorLevelTitle = {}
local foreachHonorLevel = function(mapData)
if self.tbHonorLevelTitle[mapData.GroupId] == nil then
self.tbHonorLevelTitle[mapData.GroupId] = {}
end
table.insert(self.tbHonorLevelTitle[mapData.GroupId], mapData)
end
ForEachTableLine(ConfigTable.Get("HonorLevel"), foreachHonorLevel)
end
function PlayerBaseData:CacheAccInfo(mapData)
if mapData ~= nil then
@@ -196,6 +206,19 @@ function PlayerBaseData:CacheHonorTitleInfo(mapData)
end
end
function PlayerBaseData:CacheHonorTitleList(mapData)
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)
end
self:RefreshHonorTitleRedDot()
end
function PlayerBaseData:CacheHonorTitleListActivity(mapData)
if not mapData then
return
end
@@ -417,7 +440,11 @@ function PlayerBaseData:ChangeHonorTitle(mapData)
local newData = {}
local delData = {}
for _, v in pairs(mapData) do
table.insert(self._tbHonorTitleList, v.NewId)
local data = {
Lv = v.Level,
Id = v.NewId
}
table.insert(self._tbHonorTitleList, data)
local honorData = ConfigTable.GetData("Honor", v.NewId)
if honorData.TabType == GameEnum.honorTabType.Achieve then
local foreachHonor = function(mapData)
@@ -1175,6 +1202,18 @@ function PlayerBaseData:CheckNewFuncUnlockFixedRoguelike(nFRId)
end
ForEachTableLine(DataTable.OpenFunc, ForEachOpenFunc)
end
function PlayerBaseData:GetLevelHonorTitleData(nGroupId)
local tbHonorTitle = {}
local maxLevel = 0
if self.tbHonorLevelTitle[nGroupId] == nil then
return nil, maxLevel
end
for _, v in pairs(self.tbHonorLevelTitle[nGroupId]) do
tbHonorTitle[v.Level] = v
maxLevel = math.max(maxLevel, v.Level)
end
return tbHonorTitle, maxLevel
end
function PlayerBaseData:OnEvent_TransAnimInClear()
self.bInLoading = true
end
@@ -1263,4 +1302,6 @@ function PlayerBaseData:OnCS2LuaEvent_AppFocus(bFocus)
printLog("Lua PlayerBaseData OnCS2LuaEvent_AppFocus, Lose APP Focus, nCachedTime: " .. tostring(self.nCachedTime) .. ", nRequestEnergyLimitTime: " .. tostring(self.nRequestEnergyLimitTime) .. ", nLastEnergy: " .. tostring(self.nLastEnergy) .. ", nLastEnergyBattery: " .. tostring(self.nLastEnergyBattery))
end
end
function PlayerBaseData:OnEvent_SettingsNotificationClose()
end
return PlayerBaseData
+24 -2
View File
@@ -254,7 +254,8 @@ function PlayerCharData:CreateNewChar(msgData)
nAffinityExp = msgData.AffinityExp,
nAffinityLevel = msgData.AffinityLevel,
tbAffinityQuests = msgData.AffinityQuests,
tbArchiveRewardIds = msgData.ArchiveRewardIds or {}
tbArchiveRewardIds = msgData.ArchiveRewardIds or {},
bIsFavorite = msgData.IsFavorite
}
if msgData.DatingEventIds ~= nil and msgData.DatingEventRewardIds ~= nil then
PlayerData.Dating:RefreshLimitedEventList(nCharId, msgData.DatingEventIds, msgData.DatingEventRewardIds)
@@ -1251,6 +1252,7 @@ function PlayerCharData:GetDataForCharList()
mapChar[nCharId].CreateTime = data.nCreateTime
mapChar[nCharId].Advance = self:GetCharAdvance(nCharId)
mapChar[nCharId].Favorability = self:GetCharAffinityData(nCharId).Level
mapChar[nCharId].IsFavorite = self:GetCharFavoriteState(nCharId)
else
printError(nCharId .. "角色数据不存在")
end
@@ -1270,6 +1272,7 @@ function PlayerCharData:GetCharDataById(nCharId)
tbCharData.CreateTime = self._mapChar[nCharId].nCreateTime
tbCharData.Advance = self:GetCharAdvance(nCharId)
tbCharData.Favorability = self:GetCharAffinityData(nCharId).Level
tbCharData.IsFavorite = self:GetCharFavoriteState(nCharId)
end
return tbCharData
end
@@ -1362,6 +1365,21 @@ function PlayerCharData:SetCharSkinId(nCharId, nSkinId)
end
EventManager.Hit(EventId.CharacterSkinChange, nCharId, nSkinId)
end
function PlayerCharData:SetCharFavoriteState(nCharId, bOnFavorite)
local mapChar = self._mapChar[nCharId]
if mapChar == nil then
printError("没有该角色数据" .. nCharId)
end
self._mapChar[nCharId].bIsFavorite = bOnFavorite
end
function PlayerCharData:GetCharFavoriteState(nCharId)
local mapChar = self._mapChar[nCharId]
if mapChar == nil then
printError("没有该角色数据" .. nCharId)
return false
end
return mapChar.bIsFavorite
end
function PlayerCharData:CalcAffinityEffect(nCharId)
local tbEfts = PlayerData.Char:GetCharAffinityEffects(nCharId)
if tbEfts == nil then
@@ -2047,7 +2065,11 @@ function PlayerCharData:UpdateCharPlotReddot(nCharId)
end
end
function PlayerCharData:UpdateCharArchiveRewardRedDot(nCharId)
local nCurFavorLevel = self:GetCharAffinityData(nCharId).Level
local affinityData = self:GetCharAffinityData(nCharId)
if affinityData == nil then
return
end
local nCurFavorLevel = affinityData.Level
local foreachCharacterArchive = function(mapData)
if mapData.CharacterId == nCharId then
local bReward = false
+20 -1
View File
@@ -841,8 +841,9 @@ function PlayerDiscData:GetTrialDiscById(nId)
if not nId then
return
end
if self._mapTrialDisc[nId] == nil then
if self._mapTrialDisc == nil or self._mapTrialDisc[nId] == nil then
printLog(string.format("该星盘不存在或新获得, 唯一Id: %d", nId))
return
end
return self._mapTrialDisc[nId]
end
@@ -906,6 +907,24 @@ function PlayerDiscData:CalcTrialInfoInBuild(nTrialId, tbSecondarySkill)
discInfo.discLevel = discData.nLevel
return discInfo
end
function PlayerDiscData:GetRankDetailDisc(nId)
if not nId then
return
end
if not nId then
printError("GenerateLocalDiscData Failed!")
return
end
local mapDisc = {}
mapDisc.Id = nId
mapDisc.Exp = 0
mapDisc.Level = 1
mapDisc.Phase = 0
mapDisc.Star = 0
mapDisc.Read = false
local discData = DiscData.new(mapDisc)
return discData
end
local tbSortNameTextCfg = {
"CharList_Sort_Toggle_Level",
"CharList_Sort_Toggle_Rare",
@@ -6,6 +6,7 @@ function PlayerEquipmentData:Init()
self.tbCharSelectPreset = {}
self.tbCharEquipment = {}
self.bRollWarning = true
self.bRollUpgradeWarning = true
self:ProcessTableData()
self.isTestPresetTeam = false
end
@@ -234,6 +235,12 @@ end
function PlayerEquipmentData:SetRollWarning(bAble)
self.bRollWarning = bAble
end
function PlayerEquipmentData:GetRollUpgradeWarning()
return self.bRollUpgradeWarning
end
function PlayerEquipmentData:SetRollUpgradeWarning(bAble)
self.bRollUpgradeWarning = bAble
end
function PlayerEquipmentData:CacheEquipmentSelect(nSlotId, nGemIndex, nCharId)
self.mapSelect = {
nSlotId = nSlotId,
@@ -249,6 +256,22 @@ function PlayerEquipmentData:GetEquipmentSelect()
self.mapSelect = nil
return mapSelect
end
function PlayerEquipmentData:CacheEquipmentUpgrade(nSlotId, nGemIndex, nCharId, nSelectUpgradeIndex)
self.mapUpgrade = {
nSlotId = nSlotId,
nGemIndex = nGemIndex,
nCharId = nCharId,
nSelectUpgradeIndex = nSelectUpgradeIndex
}
end
function PlayerEquipmentData:GetEquipmentUpgrade()
if self.mapUpgrade == nil then
return false
end
local mapUpgrade = clone(self.mapUpgrade)
self.mapUpgrade = nil
return mapUpgrade
end
function PlayerEquipmentData:CheckAlterHighQualityAffix(tbAlterAffix, tbLockId)
for _, v in ipairs(tbAlterAffix) do
if v ~= 0 and table.indexof(tbLockId, v) == 0 then
@@ -341,7 +364,7 @@ function PlayerEquipmentData:SendCharGemRefreshReq(nCharId, nSlotId, nGemIndex,
LockAttrs = tbLockAttrs
}
local successCallback = function(_, mapMainData)
self.tbCharEquipment[nCharId][nSlotId][nGemIndex]:UpdateAlterAffix(mapMainData.Attributes)
self.tbCharEquipment[nCharId][nSlotId][nGemIndex]:UpdateAlterAffix(mapMainData.Attributes, mapMainData.OverlockCount)
if callback then
callback()
end
@@ -361,6 +384,42 @@ function PlayerEquipmentData:SendCharGemGenerateReq(nCharId, nSlotId, callback)
end
HttpNetHandler.SendMsg(NetMsgId.Id.char_gem_generate_req, msgData, nil, successCallback)
end
function PlayerEquipmentData:SendCharGemOverlockReq(nCharId, nSlotId, nGemIndex, nAttrIndex, callback)
local msgData = {
CharId = nCharId,
SlotId = nSlotId,
GemIndex = nGemIndex - 1,
AttrIndex = nAttrIndex - 1
}
local successCallback = function(_, mapMainData)
local mapEquip = self.tbCharEquipment[nCharId][nSlotId][nGemIndex]
mapEquip:ChangeUpgradeCount(nAttrIndex, 1)
mapEquip:UpdateRandomAttr(mapEquip.tbAffix, mapEquip.tbUpgradeCount)
EventManager.Hit("EquipmentSlotChanged")
if callback then
callback()
end
end
HttpNetHandler.SendMsg(NetMsgId.Id.char_gem_overlock_req, msgData, nil, successCallback)
end
function PlayerEquipmentData:SendCharGemOverlockRevertReq(nCharId, nSlotId, nGemIndex, nAttrIndex, callback)
local msgData = {
CharId = nCharId,
SlotId = nSlotId,
GemIndex = nGemIndex - 1,
AttrIndex = nAttrIndex - 1
}
local successCallback = function(_, mapMainData)
local mapEquip = self.tbCharEquipment[nCharId][nSlotId][nGemIndex]
mapEquip:ChangeUpgradeCount(nAttrIndex, -1)
mapEquip:UpdateRandomAttr(mapEquip.tbAffix, mapEquip.tbUpgradeCount)
EventManager.Hit("EquipmentSlotChanged")
if callback then
callback()
end
end
HttpNetHandler.SendMsg(NetMsgId.Id.char_gem_overlock_revert_req, msgData, nil, successCallback)
end
function PlayerEquipmentData:CacheEquipmentDataForChar(mapMsgData)
if self.tbCharPreset == nil then
self.tbCharPreset = {}
@@ -294,7 +294,13 @@ function PlayerItemData:GetItemCountByID(Tid)
end
if itemCfgData.Type == GameEnum.itemType.Honor then
local tbHonor = PlayerData.Base:GetPlayerHonorTitleList()
local bHas = 0 < table.indexof(tbHonor, Tid)
local bHas = false
for k, v in pairs(tbHonor) do
if v.Id == Tid then
bHas = true
break
end
end
return bHas and 1 or 0
end
if self._mapItem[Tid] ~= nil then
@@ -46,10 +46,10 @@ function PlayerJointDrillData_1:InitConfig()
CacheTable.SetField("_JointDrillLevel", line.DrillLevelGroupId, line.Difficulty, line)
end
ForEachTableLine(ConfigTable.Get("JointDrillLevel"), funcForeachJointDrillLevel)
local funcForeachJointDrillLevel = function(line)
local funcForeachJointDrillFloor = function(line)
CacheTable.SetField("_JointDrillFloor", line.FloorId, line.BattleLvs, line)
end
ForEachTableLine(ConfigTable.Get("JointDrillFloor"), funcForeachJointDrillLevel)
ForEachTableLine(ConfigTable.Get("JointDrillFloor"), funcForeachJointDrillFloor)
local funcForeachJointDrillQuest = function(line)
if nil == CacheTable.GetData("_JointDrillQuest", line.GroupId) then
CacheTable.SetData("_JointDrillQuest", line.GroupId, {})
@@ -240,33 +240,7 @@ function PlayerJointDrillData_1:IsJointDrillUnlock(nLevelId)
return self.actDataIns:CheckPassedId(nPreLevelId)
end
function PlayerJointDrillData_1:GetMonsterMaxHp(nMonsterId, nDifficulty)
local nMaxHp = 0
local mapMonsterCfg = ConfigTable.GetData("Monster", nMonsterId)
if mapMonsterCfg == nil then
return 0
end
local mapAdjustCfg = ConfigTable.GetData("MonsterValueTempleteAdjust", mapMonsterCfg.Templete)
if mapAdjustCfg == nil then
return 0
end
if next(CacheTable.Get("_MonsterValueTemplete")) == nil then
local funcForeachMonsterValueTemplete = function(line)
CacheTable.SetField("_MonsterValueTemplete", line.TemplateId, line.Lv, line.Hp)
end
ForEachTableLine(ConfigTable.Get("MonsterValueTemplete"), funcForeachMonsterValueTemplete)
end
local mapCfgList = CacheTable.GetData("_MonsterValueTemplete", mapAdjustCfg.TemplateId)
if mapCfgList == nil then
return 0
end
local nValue = mapCfgList[nDifficulty]
if nValue == nil then
return 0
end
local nRatio = mapAdjustCfg.HpRatio
local nFix = mapAdjustCfg.HpFix
nMaxHp = math.floor(nValue * (1 + nRatio * ConfigData.IntFloatPrecision) + nFix)
return nMaxHp
return NovaAPI.GetJointDrillBossMaxHp(nMonsterId, nDifficulty)
end
function PlayerJointDrillData_1:GetMonsterName(nMonsterId)
local mapMonsterCfg = ConfigTable.GetData("Monster", nMonsterId)
@@ -394,146 +368,208 @@ end
function PlayerJointDrillData_1:RestartBattle()
self:EnterJointDrill(self.nCurLevelId, self.nSelectBuildId, self.bSimulate, AllEnum.JointDrillLevelStartType.Restart, self.nCurLevel)
end
function PlayerJointDrillData_1:ContinueJointDrill(nBuildId, callback)
local NetCallback = function(_, netMsg)
local sKey = LocalData.GetPlayerLocalData("JointDrillRecordKey") or ""
if sKey == "" or sKey ~= tostring(self.nStartTime) then
if sKey ~= "" then
NovaAPI.DeleteRecFile(sKey)
function PlayerJointDrillData_1:ContinueJointDrill(nBuildId, callback, bEditor)
if not bEditor then
local NetCallback = function(_, netMsg)
local sKey = LocalData.GetPlayerLocalData("JointDrillRecordKey") or ""
if sKey == "" or sKey ~= tostring(self.nStartTime) then
if sKey ~= "" then
NovaAPI.DeleteRecFile(sKey)
end
LocalData.SetPlayerLocalData("JointDrillRecordKey", self.nStartTime)
LocalData.SetPlayerLocalData("JointDrillRecordFloorId", 0)
LocalData.SetPlayerLocalData("JointDrillRecordExcludeId", 0)
end
if callback ~= nil then
callback()
end
LocalData.SetPlayerLocalData("JointDrillRecordKey", self.nStartTime)
LocalData.SetPlayerLocalData("JointDrillRecordFloorId", 0)
LocalData.SetPlayerLocalData("JointDrillRecordExcludeId", 0)
end
if callback ~= nil then
callback()
end
local msg = {BuildId = nBuildId}
HttpNetHandler.SendMsg(NetMsgId.Id.joint_drill_continue_req, msg, nil, NetCallback)
elseif callback ~= nil then
callback()
end
local msg = {BuildId = nBuildId}
HttpNetHandler.SendMsg(NetMsgId.Id.joint_drill_continue_req, msg, nil, NetCallback)
end
function PlayerJointDrillData_1:JointDrillGameOver(callback, bSettle)
self:SetRecorderExcludeIds()
self:StopRecord()
self._EndTime = ClientManager.serverTimeStamp
local NetCallback = function(_, netMsg)
local nScoreOld = 0
if self.mapSelfRankData ~= nil then
nScoreOld = self.mapSelfRankData.Score
function PlayerJointDrillData_1:JointDrillGameOver(callback, bSettle, bEditor)
if not bEditor then
self:SetRecorderExcludeIds()
self:StopRecord()
self._EndTime = ClientManager.serverTimeStamp
local NetCallback = function(_, netMsg)
local nScoreOld = 0
if self.mapSelfRankData ~= nil then
nScoreOld = self.mapSelfRankData.Score
end
if netMsg.Old ~= netMsg.New then
self:SendJointDrillRankMsg()
end
self:UploadRecordFile(netMsg.Token)
if not self.bSimulate then
self.nTotalScore = self.nTotalScore + netMsg.FightScore + netMsg.HpScore + netMsg.DifficultyScore
end
EventManager.Hit(EventId.ClosePanel, PanelId.JointDrillBuildList_1)
self.bResetLevelSelect = true
if callback ~= nil then
callback(netMsg)
end
if bSettle then
local nResultType = AllEnum.JointDrillResultType.ChallengeEnd
local mapScore = {}
local nTotalScore = self:GetTotalRankScore()
local mapChange, mapItems = {}, {}
local nOld, nNew = 0, 0
if netMsg ~= nil then
mapChange = netMsg.Change or {}
mapItems = netMsg.Items or {}
local nScore = netMsg.FightScore + netMsg.HpScore + netMsg.DifficultyScore
mapScore = {
FightScore = netMsg.FightScore,
HpScore = netMsg.HpScore,
DifficultyScore = netMsg.DifficultyScore,
nTotalScore = nTotalScore,
nScore = nScore,
nScoreOld = nScoreOld
}
nOld = netMsg.Old
nNew = netMsg.New
end
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillResult_1, nResultType, self.nCurLevel, 0, self.nCurLevelId, self.mapBossInfo, mapScore, mapItems, mapChange, nOld, nNew, self.bSimulate, #self.tbTeams)
end
self:EventUpload(4, 0)
self:ChallengeEnd()
end
if netMsg.Old ~= netMsg.New then
self:SendJointDrillRankMsg()
end
self:UploadRecordFile(netMsg.Token)
if not self.bSimulate then
self.nTotalScore = self.nTotalScore + netMsg.FightScore + netMsg.HpScore + netMsg.DifficultyScore
end
EventManager.Hit(EventId.ClosePanel, PanelId.JointDrillBuildList_1)
HttpNetHandler.SendMsg(NetMsgId.Id.joint_drill_game_over_req, {}, nil, NetCallback)
else
self.bResetLevelSelect = true
if callback ~= nil then
callback(netMsg)
callback()
end
if bSettle then
local nResultType = AllEnum.JointDrillResultType.ChallengeEnd
local mapScore = {}
local nTotalScore = self:GetTotalRankScore()
local mapChange, mapItems = {}, {}
local nOld, nNew = 0, 0
if netMsg ~= nil then
mapChange = netMsg.Change or {}
mapItems = netMsg.Items or {}
local nScore = netMsg.FightScore + netMsg.HpScore + netMsg.DifficultyScore
mapScore = {
FightScore = netMsg.FightScore,
HpScore = netMsg.HpScore,
DifficultyScore = netMsg.DifficultyScore,
nTotalScore = nTotalScore,
nScore = nScore,
nScoreOld = nScoreOld
}
nOld = netMsg.Old
nNew = netMsg.New
end
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillResult_1, nResultType, self.nCurLevel, 0, self.nCurLevelId, self.mapBossInfo, mapScore, mapItems, mapChange, nOld, nNew, self.bSimulate, #self.tbTeams)
end
self:EventUpload(4, 0)
self:ChallengeEnd()
end
HttpNetHandler.SendMsg(NetMsgId.Id.joint_drill_game_over_req, {}, nil, NetCallback)
end
function PlayerJointDrillData_1:JointDrillGiveUp(nFloor, nTime, nDamage, nBossHp, sRecord, mapBuild, callback)
self:SetRecorderExcludeIds()
self:StopRecord()
local NetCallback = function(_, netMsg)
function PlayerJointDrillData_1:JointDrillGiveUp(nFloor, nTime, nDamage, nBossHp, sRecord, mapBuild, callback, bEditor)
if not bEditor then
self:SetRecorderExcludeIds()
self:StopRecord()
local NetCallback = function(_, netMsg)
self.record = sRecord
self.nCurLevel = nFloor
self.mapBossInfo.nHp = nBossHp
if callback ~= nil then
callback(netMsg)
end
if netMsg.Old ~= netMsg.New then
self:SendJointDrillRankMsg()
end
end
local msg = {
Floor = nFloor,
Time = nTime,
Damage = nDamage,
BossHp = nBossHp,
Record = sRecord
}
HttpNetHandler.SendMsg(NetMsgId.Id.joint_drill_give_up_req, msg, nil, NetCallback)
else
self.record = sRecord
self.nCurLevel = nFloor
self.mapBossInfo.nHp = nBossHp
if callback ~= nil then
callback(netMsg)
end
if netMsg.Old ~= netMsg.New then
self:SendJointDrillRankMsg()
callback()
end
end
local msg = {
Floor = nFloor,
Time = nTime,
Damage = nDamage,
BossHp = nBossHp,
Record = sRecord
}
HttpNetHandler.SendMsg(NetMsgId.Id.joint_drill_give_up_req, msg, nil, NetCallback)
end
function PlayerJointDrillData_1:JointDrillRetreat(mapBuild, nBossHp, callback)
self:SetRecorderExcludeIds(true)
self:StopRecord()
local NetCallback = function(_, netMsg)
function PlayerJointDrillData_1:JointDrillRetreat(mapBuild, nBossHp, callback, bEditor)
if not bEditor then
self:SetRecorderExcludeIds(true)
self:StopRecord()
local NetCallback = function(_, netMsg)
self:RemoveJointDrillTeam(mapBuild)
self.mapBossInfo.nHp = nBossHp
if callback ~= nil then
callback()
end
end
HttpNetHandler.SendMsg(NetMsgId.Id.joint_drill_retreat_req, {}, nil, NetCallback)
else
self:RemoveJointDrillTeam(mapBuild)
self.mapBossInfo.nHp = nBossHp
if callback ~= nil then
callback()
end
end
HttpNetHandler.SendMsg(NetMsgId.Id.joint_drill_retreat_req, {}, nil, NetCallback)
end
function PlayerJointDrillData_1:JointDrillSettle(mapBuild, nTime, nDamage, callback)
self:SetRecorderExcludeIds()
self:StopRecord()
self:AddJointDrillTeam(mapBuild, nTime, nDamage)
self._EndTime = ClientManager.serverTimeStamp
local NetCallback = function(_, netMsg)
self:UploadRecordFile(netMsg.Token)
if not self.bSimulate then
local nScore = netMsg.FightScore + netMsg.HpScore + netMsg.DifficultyScore
self.nTotalScore = self.nTotalScore + nScore
self.actDataIns:PassedLevel(self.nCurLevelId, nScore)
function PlayerJointDrillData_1:JointDrillSettle(mapBuild, nTime, nDamage, callback, bEditor)
if not bEditor then
self:SetRecorderExcludeIds()
self:StopRecord()
self:AddJointDrillTeam(mapBuild, nTime, nDamage)
self._EndTime = ClientManager.serverTimeStamp
local NetCallback = function(_, netMsg)
self:UploadRecordFile(netMsg.Token)
if not self.bSimulate then
local nScore = netMsg.FightScore + netMsg.HpScore + netMsg.DifficultyScore
self.nTotalScore = self.nTotalScore + nScore
self.actDataIns:PassedLevel(self.nCurLevelId, nScore)
end
EventManager.Hit(EventId.ClosePanel, PanelId.JointDrillBuildList_1)
self.bResetLevelSelect = true
if callback ~= nil then
callback(netMsg)
end
if netMsg.Old ~= netMsg.New then
self:SendJointDrillRankMsg()
end
self:EventUpload(4, 1)
end
EventManager.Hit(EventId.ClosePanel, PanelId.JointDrillBuildList_1)
local sKey = LocalData.GetPlayerLocalData("JointDrillRecordKey") or ""
local tbSamples = UTILS.GetBattleSamples(sKey)
local bSuccess, nCheckSum = NovaAPI.GetRecorderKey(sKey)
local tbSendSample = {Sample = tbSamples, Checksum = nCheckSum}
local msg = {
Time = nTime,
Damage = nDamage,
Sample = tbSendSample,
Events = {
List = PlayerData.Achievement:GetBattleAchievement(GameEnum.levelType.JointDrill, true)
}
}
HttpNetHandler.SendMsg(NetMsgId.Id.joint_drill_settle_req, msg, nil, NetCallback)
else
self:AddJointDrillTeam(mapBuild, nTime, nDamage)
self.bResetLevelSelect = true
if callback ~= nil then
callback(netMsg)
callback()
end
if netMsg.Old ~= netMsg.New then
self:SendJointDrillRankMsg()
end
self:EventUpload(4, 1)
end
local sKey = LocalData.GetPlayerLocalData("JointDrillRecordKey") or ""
local tbSamples = UTILS.GetBattleSamples(sKey)
local bSuccess, nCheckSum = NovaAPI.GetRecorderKey(sKey)
local tbSendSample = {Sample = tbSamples, Checksum = nCheckSum}
local msg = {
Time = nTime,
Damage = nDamage,
Sample = tbSendSample,
Events = {
List = PlayerData.Achievement:GetBattleAchievement(GameEnum.levelType.JointDrill, true)
}
}
HttpNetHandler.SendMsg(NetMsgId.Id.joint_drill_settle_req, msg, nil, NetCallback)
end
function PlayerJointDrillData_1:JointDrillSync(nFloor, nTime, nDamage, nBossHp, nBossHpMax, sRecord, callback)
local NetCallback = function(_, netMsg)
function PlayerJointDrillData_1:JointDrillSync(nFloor, nTime, nDamage, nBossHp, nBossHpMax, sRecord, callback, bEditor)
if not bEditor then
local NetCallback = function(_, netMsg)
self.record = sRecord
self.mapBossInfo.nHp = nBossHp
self.mapBossInfo.nHpMax = nBossHpMax
if callback ~= nil then
callback()
end
end
local msg = {
Floor = nFloor,
Time = nTime,
Damage = nDamage,
BossHp = nBossHp,
BossHpMax = nBossHpMax,
Record = sRecord
}
HttpNetHandler.SendMsg(NetMsgId.Id.joint_drill_sync_req, msg, nil, NetCallback)
else
self.record = sRecord
self.mapBossInfo.nHp = nBossHp
self.mapBossInfo.nHpMax = nBossHpMax
@@ -541,15 +577,6 @@ function PlayerJointDrillData_1:JointDrillSync(nFloor, nTime, nDamage, nBossHp,
callback()
end
end
local msg = {
Floor = nFloor,
Time = nTime,
Damage = nDamage,
BossHp = nBossHp,
BossHpMax = nBossHpMax,
Record = sRecord
}
HttpNetHandler.SendMsg(NetMsgId.Id.joint_drill_sync_req, msg, nil, NetCallback)
end
function PlayerJointDrillData_1:LevelEnd(nType)
if self.curLevel ~= nil and type(self.curLevel.UnBindEvent) == "function" then
@@ -636,7 +663,7 @@ function PlayerJointDrillData_1:GetCachedBuild()
return self.nSelectBuildId
end
function PlayerJointDrillData_1:GetBossHpBarNum()
if self.nCurLevelId ~= nil then
if self.nCurLevelId ~= 0 then
local mapCfg = ConfigTable.GetData("JointDrillLevel", self.nCurLevelId)
if mapCfg ~= nil then
return mapCfg.HpBarNum
@@ -718,7 +745,6 @@ function PlayerJointDrillData_1:SetRecorderExcludeIds(bRemove)
table.insert(tbTemp, 1, nExcludeValue % 2)
nExcludeValue = math.floor(nExcludeValue / 2)
end
printTable(tbTemp)
for k, v in ipairs(tbTemp) do
if v == 1 then
tbFloorId:Add(#tbTemp - k + 1)
@@ -792,14 +818,14 @@ function PlayerJointDrillData_1:GetTotalRankScore()
end
function PlayerJointDrillData_1:SendJointDrillSweepMsg(nLevelId, nCount, callback)
local NetCallback = function(_, netMsg)
local mapSelfRank = PlayerData.JointDrill_1:GetSelfRankData()
local mapSelfRank = self:GetSelfRankData()
local nRank = 0
local nScoreOld = 0
if mapSelfRank ~= nil then
nRank = mapSelfRank.Rank
nScoreOld = mapSelfRank.Score
end
local nTotalScoreOld = PlayerData.JointDrill_1:GetTotalRankScore()
local nTotalScoreOld = self:GetTotalRankScore()
local nScore = math.max(netMsg.Score - nTotalScoreOld, 0)
local mapScore = {
nScore = nScore,
@@ -47,10 +47,10 @@ function PlayerJointDrillData_2:InitConfig()
CacheTable.SetField("_JointDrill_2_Level", line.DrillLevelGroupId, line.Difficulty, line)
end
ForEachTableLine(ConfigTable.Get("JointDrill_2_Level"), funcForeachJointDrillLevel2)
local funcForeachJointDrillLevel2 = function(line)
local funcForeachJointDrillFloor2 = function(line)
CacheTable.SetField("_JointDrill_2_Floor", line.FloorId, line.BattleLvs, line)
end
ForEachTableLine(ConfigTable.Get("JointDrill_2_Floor"), funcForeachJointDrillLevel2)
ForEachTableLine(ConfigTable.Get("JointDrill_2_Floor"), funcForeachJointDrillFloor2)
self.nRankCount = 0
local funcForeachJointDrillRank = function(line)
self.nRankCount = self.nRankCount + 1
@@ -116,33 +116,7 @@ function PlayerJointDrillData_2:GetMonsterCfg(nMonsterId)
end
end
function PlayerJointDrillData_2:GetMonsterMaxHp(nMonsterId, nDifficulty)
local nMaxHp = 0
local mapMonsterCfg = ConfigTable.GetData("Monster", nMonsterId)
if mapMonsterCfg == nil then
return 0
end
local mapAdjustCfg = ConfigTable.GetData("MonsterValueTempleteAdjust", mapMonsterCfg.Templete)
if mapAdjustCfg == nil then
return 0
end
if next(CacheTable.Get("_MonsterValueTemplete")) == nil then
local funcForeachMonsterValueTemplete = function(line)
CacheTable.SetField("_MonsterValueTemplete", line.TemplateId, line.Lv, line.Hp)
end
ForEachTableLine(ConfigTable.Get("MonsterValueTemplete"), funcForeachMonsterValueTemplete)
end
local mapCfgList = CacheTable.GetData("_MonsterValueTemplete", mapAdjustCfg.TemplateId)
if mapCfgList == nil then
return 0
end
local nValue = mapCfgList[nDifficulty]
if nValue == nil then
return 0
end
local nRatio = mapAdjustCfg.HpRatio
local nFix = mapAdjustCfg.HpFix
nMaxHp = math.floor(nValue * (1 + nRatio * ConfigData.IntFloatPrecision) + nFix)
return nMaxHp
return NovaAPI.GetJointDrillBossMaxHp(nMonsterId, nDifficulty)
end
function PlayerJointDrillData_2:InitBossInfo(nGroupId, nDifficulty)
self.mapBossInfo = {}
@@ -316,187 +290,237 @@ end
function PlayerJointDrillData_2:RestartBattle()
self:EnterJointDrill(self.nCurLevelId, self.nSelectBuildId, self.bSimulate, AllEnum.JointDrillLevelStartType.Restart, self.nCurLevel)
end
function PlayerJointDrillData_2:ContinueJointDrill(nBuildId, callback)
local NetCallback = function(_, netMsg)
local sKey = LocalData.GetPlayerLocalData("JointDrillRecordKey") or ""
if sKey == "" or sKey ~= tostring(self.nStartTime) then
if sKey ~= "" then
NovaAPI.DeleteRecFile(sKey)
function PlayerJointDrillData_2:ContinueJointDrill(nBuildId, callback, bEditor)
if not bEditor then
local NetCallback = function(_, netMsg)
local sKey = LocalData.GetPlayerLocalData("JointDrillRecordKey") or ""
if sKey == "" or sKey ~= tostring(self.nStartTime) then
if sKey ~= "" then
NovaAPI.DeleteRecFile(sKey)
end
LocalData.SetPlayerLocalData("JointDrillRecordKey", self.nStartTime)
LocalData.SetPlayerLocalData("JointDrillRecordFloorId", 0)
LocalData.SetPlayerLocalData("JointDrillRecordExcludeId", 0)
end
if callback ~= nil then
callback()
end
LocalData.SetPlayerLocalData("JointDrillRecordKey", self.nStartTime)
LocalData.SetPlayerLocalData("JointDrillRecordFloorId", 0)
LocalData.SetPlayerLocalData("JointDrillRecordExcludeId", 0)
end
if callback ~= nil then
callback()
end
local msg = {BuildId = nBuildId}
HttpNetHandler.SendMsg(NetMsgId.Id.joint_drill_2_continue_req, msg, nil, NetCallback)
elseif callback ~= nil then
callback()
end
local msg = {BuildId = nBuildId}
HttpNetHandler.SendMsg(NetMsgId.Id.joint_drill_2_continue_req, msg, nil, NetCallback)
end
function PlayerJointDrillData_2:JointDrillGameOver(callback, bSettle)
self:SetRecorderExcludeIds()
self:StopRecord()
self._EndTime = ClientManager.serverTimeStamp
local NetCallback = function(_, netMsg)
local nScoreOld = 0
if self.mapSelfRankData ~= nil then
nScoreOld = self.mapSelfRankData.Score
function PlayerJointDrillData_2:JointDrillGameOver(callback, bSettle, bEditor)
if not bEditor then
self:SetRecorderExcludeIds()
self:StopRecord()
self._EndTime = ClientManager.serverTimeStamp
local NetCallback = function(_, netMsg)
local nScoreOld = 0
if self.mapSelfRankData ~= nil then
nScoreOld = self.mapSelfRankData.Score
end
if netMsg.Old ~= netMsg.New then
self:SendJointDrillRankMsg()
end
self:UploadRecordFile(netMsg.Token)
if not self.bSimulate then
self.nTotalScore = self.nTotalScore + netMsg.FightScore + netMsg.HpScore + netMsg.DifficultyScore
end
EventManager.Hit(EventId.ClosePanel, PanelId.JointDrillBuildList_2)
self.bResetLevelSelect = true
if callback ~= nil then
callback(netMsg)
end
if bSettle then
local nResultType = AllEnum.JointDrillResultType.ChallengeEnd
local mapScore = {}
local nTotalScore = self.nTotalScore
local mapChange, mapItems = {}, {}
local nOld, nNew = 0, 0
if netMsg ~= nil then
mapChange = netMsg.Change or {}
mapItems = netMsg.Items or {}
local nScore = netMsg.FightScore + netMsg.HpScore + netMsg.DifficultyScore
mapScore = {
FightScore = netMsg.FightScore,
HpScore = netMsg.HpScore,
DifficultyScore = netMsg.DifficultyScore,
nTotalScore = nTotalScore,
nScore = nScore,
nScoreOld = nScoreOld
}
nOld = netMsg.Old
nNew = netMsg.New
end
local mapBossInfo = self.mapBossInfo[self.nCurLevel]
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillResult_2, nResultType, self.nCurLevel, 0, self.nCurLevelId, mapBossInfo, mapScore, mapItems, mapChange, nOld, nNew, self.bSimulate, #self.tbTeams)
end
self:EventUpload(4, 0)
self:ChallengeEnd()
end
if netMsg.Old ~= netMsg.New then
self:SendJointDrillRankMsg()
end
self:UploadRecordFile(netMsg.Token)
if not self.bSimulate then
self.nTotalScore = self.nTotalScore + netMsg.FightScore + netMsg.HpScore + netMsg.DifficultyScore
end
EventManager.Hit(EventId.ClosePanel, PanelId.JointDrillBuildList_2)
HttpNetHandler.SendMsg(NetMsgId.Id.joint_drill_2_game_over_req, {}, nil, NetCallback)
else
self.bResetLevelSelect = true
if callback ~= nil then
callback(netMsg)
callback()
end
if bSettle then
local nResultType = AllEnum.JointDrillResultType.ChallengeEnd
local mapScore = {}
local nTotalScore = self.nTotalScore
local mapChange, mapItems = {}, {}
local nOld, nNew = 0, 0
if netMsg ~= nil then
mapChange = netMsg.Change or {}
mapItems = netMsg.Items or {}
local nScore = netMsg.FightScore + netMsg.HpScore + netMsg.DifficultyScore
mapScore = {
FightScore = netMsg.FightScore,
HpScore = netMsg.HpScore,
DifficultyScore = netMsg.DifficultyScore,
nTotalScore = nTotalScore,
nScore = nScore,
nScoreOld = nScoreOld
}
nOld = netMsg.Old
nNew = netMsg.New
end
local mapBossInfo = self.mapBossInfo[self.nCurLevel]
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillResult_2, nResultType, self.nCurLevel, 0, self.nCurLevelId, mapBossInfo, mapScore, mapItems, mapChange, nOld, nNew, self.bSimulate, #self.tbTeams)
end
self:EventUpload(4, 0)
self:ChallengeEnd()
end
HttpNetHandler.SendMsg(NetMsgId.Id.joint_drill_2_game_over_req, {}, nil, NetCallback)
end
function PlayerJointDrillData_2:JointDrillGiveUp(nLevel, nTime, nDamage, sRecord, callback)
self:SetRecorderExcludeIds()
self:StopRecord()
local NetCallback = function(_, netMsg)
function PlayerJointDrillData_2:JointDrillGiveUp(nLevel, nTime, nDamage, sRecord, callback, bEditor)
if not bEditor then
self:SetRecorderExcludeIds()
self:StopRecord()
local NetCallback = function(_, netMsg)
self.record = sRecord
self.nCurLevel = nLevel
if callback ~= nil then
callback(netMsg)
end
if netMsg.Old ~= netMsg.New then
self:SendJointDrillRankMsg()
end
end
local tbBossHps = {}
local mapBoss = self.mapBossInfo[nLevel]
if mapBoss ~= nil then
for nIndex, v in ipairs(mapBoss) do
if v.nBossCfgId ~= 0 then
table.insert(tbBossHps, {
Id = v.nBossCfgId,
Hp = v.nHp
})
end
end
end
local msg = {
Floor = nLevel,
Time = nTime,
Damage = nDamage,
BossHps = tbBossHps,
Record = sRecord
}
HttpNetHandler.SendMsg(NetMsgId.Id.joint_drill_2_give_up_req, msg, nil, NetCallback)
else
self.record = sRecord
self.nCurLevel = nLevel
if callback ~= nil then
callback(netMsg)
end
if netMsg.Old ~= netMsg.New then
self:SendJointDrillRankMsg()
callback()
end
end
local tbBossHps = {}
local mapBoss = self.mapBossInfo[nLevel]
if mapBoss ~= nil then
for nIndex, v in ipairs(mapBoss) do
if v.nBossCfgId ~= 0 then
table.insert(tbBossHps, {
Id = v.nBossCfgId,
Hp = v.nHp
})
end
function PlayerJointDrillData_2:JointDrillRetreat(mapBuild, callback, bEditor)
if not bEditor then
self:SetRecorderExcludeIds(true)
self:StopRecord()
local NetCallback = function(_, netMsg)
self:RemoveJointDrillTeam(mapBuild)
if callback ~= nil then
callback()
end
end
end
local msg = {
Floor = nLevel,
Time = nTime,
Damage = nDamage,
BossHps = tbBossHps,
Record = sRecord
}
HttpNetHandler.SendMsg(NetMsgId.Id.joint_drill_2_give_up_req, msg, nil, NetCallback)
end
function PlayerJointDrillData_2:JointDrillRetreat(mapBuild, callback)
self:SetRecorderExcludeIds(true)
self:StopRecord()
local NetCallback = function(_, netMsg)
HttpNetHandler.SendMsg(NetMsgId.Id.joint_drill_2_retreat_req, {}, nil, NetCallback)
else
self:RemoveJointDrillTeam(mapBuild)
if callback ~= nil then
callback()
end
end
HttpNetHandler.SendMsg(NetMsgId.Id.joint_drill_2_retreat_req, {}, nil, NetCallback)
end
function PlayerJointDrillData_2:JointDrillSettle(mapBuild, nTime, nDamage, callback)
self:SetRecorderExcludeIds()
self:StopRecord()
self:AddJointDrillTeam(mapBuild, nTime, nDamage)
self._EndTime = ClientManager.serverTimeStamp
local NetCallback = function(_, netMsg)
self:UploadRecordFile(netMsg.Token)
if not self.bSimulate then
local nScore = netMsg.FightScore + netMsg.HpScore + netMsg.DifficultyScore
self.nTotalScore = self.nTotalScore + nScore
self.actDataIns:PassedLevel(self.nCurLevelId, nScore)
function PlayerJointDrillData_2:JointDrillSettle(mapBuild, nTime, nDamage, callback, bEditor)
if not bEditor then
self:SetRecorderExcludeIds()
self:StopRecord()
self:AddJointDrillTeam(mapBuild, nTime, nDamage)
self._EndTime = ClientManager.serverTimeStamp
local NetCallback = function(_, netMsg)
self:UploadRecordFile(netMsg.Token)
if not self.bSimulate then
local nScore = netMsg.FightScore + netMsg.HpScore + netMsg.DifficultyScore
self.nTotalScore = self.nTotalScore + nScore
self.actDataIns:PassedLevel(self.nCurLevelId, nScore)
end
EventManager.Hit(EventId.ClosePanel, PanelId.JointDrillBuildList_2)
self.bResetLevelSelect = true
if callback ~= nil then
callback(netMsg)
end
if netMsg.Old ~= netMsg.New then
self:SendJointDrillRankMsg()
end
self:EventUpload(4, 1)
end
EventManager.Hit(EventId.ClosePanel, PanelId.JointDrillBuildList_2)
local sKey = LocalData.GetPlayerLocalData("JointDrillRecordKey") or ""
local tbSamples = UTILS.GetBattleSamples(sKey)
local bSuccess, nCheckSum = NovaAPI.GetRecorderKey(sKey)
local tbSendSample = {Sample = tbSamples, Checksum = nCheckSum}
local msg = {
Time = nTime,
Damage = nDamage,
Sample = tbSendSample,
Events = {
List = PlayerData.Achievement:GetBattleAchievement(GameEnum.levelType.JointDrill, true)
}
}
HttpNetHandler.SendMsg(NetMsgId.Id.joint_drill_2_settle_req, msg, nil, NetCallback)
else
self:AddJointDrillTeam(mapBuild, nTime, nDamage)
self.bResetLevelSelect = true
if callback ~= nil then
callback(netMsg)
callback()
end
if netMsg.Old ~= netMsg.New then
self:SendJointDrillRankMsg()
end
self:EventUpload(4, 1)
end
local sKey = LocalData.GetPlayerLocalData("JointDrillRecordKey") or ""
local tbSamples = UTILS.GetBattleSamples(sKey)
local bSuccess, nCheckSum = NovaAPI.GetRecorderKey(sKey)
local tbSendSample = {Sample = tbSamples, Checksum = nCheckSum}
local msg = {
Time = nTime,
Damage = nDamage,
Sample = tbSendSample,
Events = {
List = PlayerData.Achievement:GetBattleAchievement(GameEnum.levelType.JointDrill, true)
}
}
HttpNetHandler.SendMsg(NetMsgId.Id.joint_drill_2_settle_req, msg, nil, NetCallback)
end
function PlayerJointDrillData_2:JointDrillSync(nLevel, nTime, nDamage, sRecord, callback)
local NetCallback = function(_, netMsg)
function PlayerJointDrillData_2:JointDrillSync(nLevel, nTime, nDamage, sRecord, callback, bEditor)
if not bEditor then
local NetCallback = function(_, netMsg)
self.record = sRecord
if callback ~= nil then
callback()
end
end
local tbBossHp = {}
local tbBossHpMax = {}
if self.mapBossInfo[nLevel] ~= nil then
for nIndex, v in ipairs(self.mapBossInfo[nLevel]) do
if v.nBossCfgId ~= 0 then
table.insert(tbBossHp, {
Id = v.nBossCfgId,
Hp = v.nHp
})
table.insert(tbBossHpMax, {
Id = v.nBossCfgId,
Hp = v.nHpMax
})
end
end
end
local msg = {
Floor = nLevel,
Time = nTime,
Damage = nDamage,
BossHps = tbBossHp,
BossHpMaxes = tbBossHpMax,
Record = sRecord
}
HttpNetHandler.SendMsg(NetMsgId.Id.joint_drill_2_sync_req, msg, nil, NetCallback)
else
self.record = sRecord
if callback ~= nil then
callback()
end
end
local tbBossHp = {}
local tbBossHpMax = {}
if self.mapBossInfo[nLevel] ~= nil then
for nIndex, v in ipairs(self.mapBossInfo[nLevel]) do
if v.nBossCfgId ~= 0 then
table.insert(tbBossHp, {
Id = v.nBossCfgId,
Hp = v.nHp
})
table.insert(tbBossHpMax, {
Id = v.nBossCfgId,
Hp = v.nHpMax
})
end
end
end
local msg = {
Floor = nLevel,
Time = nTime,
Damage = nDamage,
BossHps = tbBossHp,
BossHpMaxes = tbBossHpMax,
Record = sRecord
}
HttpNetHandler.SendMsg(NetMsgId.Id.joint_drill_2_sync_req, msg, nil, NetCallback)
end
function PlayerJointDrillData_2:LevelEnd(nType)
if self.curLevel ~= nil and type(self.curLevel.UnBindEvent) == "function" then
@@ -583,7 +607,7 @@ function PlayerJointDrillData_2:GetCachedBuild()
return self.nSelectBuildId
end
function PlayerJointDrillData_2:GetBossHpBarNum()
if self.nCurLevelId ~= nil then
if self.nCurLevelId ~= 0 then
local mapCfg = ConfigTable.GetData("JointDrill_2_Level", self.nCurLevelId)
if mapCfg ~= nil then
return mapCfg.HpBarNum
@@ -665,7 +689,6 @@ function PlayerJointDrillData_2:SetRecorderExcludeIds(bRemove)
table.insert(tbTemp, 1, nExcludeValue % 2)
nExcludeValue = math.floor(nExcludeValue / 2)
end
printTable(tbTemp)
for k, v in ipairs(tbTemp) do
if v == 1 then
tbFloorId:Add(#tbTemp - k + 1)
@@ -0,0 +1,351 @@
local PlayerPotentialPreselectionData = class("PlayerPotentialPreselectionData")
local TimerManager = require("GameCore.Timer.TimerManager")
local saveCD = 5
function PlayerPotentialPreselectionData:Init()
self.bGetData = false
self.tbPreselectionList = {}
self.mapCurUsePreselection = {}
self.rankSaveTimer = nil
end
function PlayerPotentialPreselectionData:CreateNewPreselection(mapNetData)
local mapPotential = {}
local tbCharPotential = {}
for _, v in ipairs(mapNetData.CharPotentials) do
local nCharId = v.CharId
local tbPotential = {}
for _, data in ipairs(v.Potentials) do
table.insert(tbPotential, {
nId = data.Id,
nLevel = data.Level
})
end
table.insert(tbCharPotential, {nCharId = nCharId, tbPotential = tbPotential})
end
mapPotential = {
nId = mapNetData.Id,
sName = mapNetData.Name,
bPreference = mapNetData.Preference,
tbCharPotential = tbCharPotential,
nTimestamp = mapNetData.Timestamp
}
return mapPotential
end
function PlayerPotentialPreselectionData:GetPreselectionById(nId)
for _, v in ipairs(self.tbPreselectionList) do
if v.nId == nId then
return v
end
end
end
function PlayerPotentialPreselectionData:SavePreselection(sName, bPreference, tbCharPotential, callback)
self:SendImportPotential(sName, bPreference, tbCharPotential, callback)
end
function PlayerPotentialPreselectionData:PackPotentialData(tbCharPotential)
local bit_buffer = {}
local bit_pos = 0
local to_uint32 = function(num)
num = math.floor(num or 0)
if num < 0 then
num = 0
elseif 4294967295 < num then
num = 4294967295
end
return num
end
local add_bit = function(bit)
bit_buffer[bit_pos] = bit
bit_pos = bit_pos + 1
end
local write_bits = function(value, num_bits)
for i = num_bits - 1, 0, -1 do
add_bit(value >> i & 1)
end
end
local pack_potential = function(tbAll, tbPotential, bSpecial)
for k, nId in ipairs(tbAll) do
local nLevel = 0
for _, data in ipairs(tbPotential) do
if data.nId == nId then
nLevel = data.nLevel
break
end
end
if bSpecial then
local flag = 0 < nLevel and 1 or 0
write_bits(flag, 1)
else
write_bits(nLevel, 3)
end
end
end
for k, v in ipairs(tbCharPotential) do
if v.nCharId == 0 then
return
end
write_bits(to_uint32(v.nCharId), 32)
end
for k, v in ipairs(tbCharPotential) do
local potentialCfg = ConfigTable.GetData("CharPotential", v.nCharId)
if potentialCfg ~= nil then
if k == 1 then
pack_potential(potentialCfg.MasterSpecificPotentialIds, v.tbPotential, true)
pack_potential(potentialCfg.MasterNormalPotentialIds, v.tbPotential, false)
pack_potential(potentialCfg.CommonPotentialIds, v.tbPotential, false)
else
pack_potential(potentialCfg.AssistSpecificPotentialIds, v.tbPotential, true)
pack_potential(potentialCfg.AssistNormalPotentialIds, v.tbPotential, false)
pack_potential(potentialCfg.CommonPotentialIds, v.tbPotential, false)
end
end
end
local bytes = {}
for i = 0, bit_pos - 1, 8 do
local byte = 0
for j = 0, 7 do
if bit_pos > i + j then
byte = byte * 2 + (bit_buffer[i + j] or 0)
else
byte = byte * 2
end
end
table.insert(bytes, string.char(byte))
end
return CS.System.Convert.ToBase64String(table.concat(bytes))
end
function PlayerPotentialPreselectionData:UnPackPotentialData(b64Str)
if not b64Str or type(b64Str) ~= "string" or b64Str == "" then
return
end
if string.match(b64Str, "[^A-Za-z0-9+/=]") then
printError("包含非base64字符")
return
end
b64Str = b64Str:gsub("-", "+")
b64Str = b64Str:gsub("_", "/")
local len = #b64Str
if len % 4 ~= 0 then
b64Str = b64Str .. string.rep("=", 4 - len % 4)
end
if #b64Str % 4 ~= 0 then
printError("Base64长度错误")
return
end
local ok, packed_data = xpcall(function()
return CS.System.Convert.FromBase64String(b64Str)
end, function(e)
return e
end)
if not ok then
printError("Base64解码失败: " .. tostring(packed_data))
return
end
local bit_buffer = {}
local bit_count = 0
for i = 1, #packed_data do
local byte = string.byte(packed_data, i)
for j = 7, 0, -1 do
local bit = byte >> j & 1
bit_buffer[bit_count] = bit
bit_count = bit_count + 1
end
end
local bit_index = 0
local read_bits = function(num_bits)
local value = 0
for i = num_bits - 1, 0, -1 do
if bit_index >= bit_count then
break
end
value = value + (bit_buffer[bit_index] or 0) * (1 << i)
bit_index = bit_index + 1
end
return value
end
local tbCharPotential = {}
for i = 1, 3 do
local nCharId = read_bits(32)
local mapCharCfg = ConfigTable.GetData_Character(nCharId)
if mapCharCfg == nil or mapCharCfg.Visible == false or mapCharCfg.Available == false then
printError("角色id解析错误")
return
end
table.insert(tbCharPotential, {
CharId = nCharId,
Potentials = {}
})
end
local nMaxLevel = ConfigTable.GetConfigNumber("PotentialPreselectionMaxLevel")
local unpack_potential = function(tbPotential, tbAll, bSpecial)
for _, nId in ipairs(tbAll) do
if bSpecial then
local flag = read_bits(1)
if flag == 1 then
table.insert(tbPotential, {Id = nId, Level = 1})
end
else
local nLevel = read_bits(3)
if nLevel > nMaxLevel then
printError("潜能等级异常")
return false
end
if 0 < nLevel then
table.insert(tbPotential, {Id = nId, Level = nLevel})
end
end
end
return true
end
for k, v in ipairs(tbCharPotential) do
if v.CharId > 0 then
local potentialCfg = ConfigTable.GetData("CharPotential", v.CharId)
if potentialCfg then
local bAvailable = true
if k == 1 then
bAvailable = bAvailable and unpack_potential(v.Potentials, potentialCfg.MasterSpecificPotentialIds, true)
bAvailable = bAvailable and unpack_potential(v.Potentials, potentialCfg.MasterNormalPotentialIds, false)
else
bAvailable = bAvailable and unpack_potential(v.Potentials, potentialCfg.AssistSpecificPotentialIds, true)
bAvailable = bAvailable and unpack_potential(v.Potentials, potentialCfg.AssistNormalPotentialIds, false)
end
bAvailable = bAvailable and unpack_potential(v.Potentials, potentialCfg.CommonPotentialIds, false)
if not bAvailable then
return
end
end
end
end
return tbCharPotential
end
function PlayerPotentialPreselectionData:SavePreselectionFromRank(sName, bPreference, tbCharPotential, callback)
if self.rankSaveTimer ~= nil then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Potential_Preselection_Save_CD"))
return
end
self.rankSaveTimer = TimerManager.Add(1, saveCD, nil, function()
self.rankSaveTimer:Cancel()
self.rankSaveTimer = nil
end, true, true, true, nil)
self:SendImportPotential(sName, bPreference, tbCharPotential, callback)
end
function PlayerPotentialPreselectionData:GetPreselectionList()
return self.tbPreselectionList
end
function PlayerPotentialPreselectionData:SendGetPreselectionList(callback)
if not self.bGetData then
local netCallback = function(_, mapNetData)
self.bGetData = true
self.tbPreselectionList = {}
for _, v in ipairs(mapNetData.List) do
local mapData = self:CreateNewPreselection(v)
table.insert(self.tbPreselectionList, mapData)
end
if callback ~= nil then
callback()
end
end
HttpNetHandler.SendMsg(NetMsgId.Id.potential_preselection_list_req, {}, nil, netCallback)
elseif callback ~= nil then
callback()
end
end
function PlayerPotentialPreselectionData:SendDeletePreselection(tbIds, callback)
local netCallback = function(_, mapNetData)
local tbTemp = {}
for k, v in ipairs(self.tbPreselectionList) do
if table.indexof(tbIds, v.nId) == 0 then
table.insert(tbTemp, v)
end
end
self.tbPreselectionList = tbTemp
local tbAllTeam = PlayerData.Team:GetAllTeamData()
if tbAllTeam ~= nil then
for nIdx, v in ipairs(tbAllTeam) do
if 0 < table.indexof(tbIds, v.nPreselectionId) then
local tmpDisc = v.tbTeamDiscId
local tbTeamMemberId = v.tbTeamMemberId
PlayerData.Team:UpdateFormationInfo(nIdx, tbTeamMemberId, tmpDisc, 0)
end
end
end
if callback ~= nil then
callback()
end
EventManager.Hit("DeletePotentialPreselection")
end
local msgData = {Ids = tbIds}
HttpNetHandler.SendMsg(NetMsgId.Id.potential_preselection_delete_req, msgData, nil, netCallback)
end
function PlayerPotentialPreselectionData:SendChangePreselectionName(nId, sName, callback)
local netCallback = function()
for _, v in ipairs(self.tbPreselectionList) do
if v.nId == nId then
v.sName = sName
break
end
end
if callback ~= nil then
callback()
end
end
local msgData = {Id = nId, Name = sName}
HttpNetHandler.SendMsg(NetMsgId.Id.potential_preselection_name_set_req, msgData, nil, netCallback)
end
function PlayerPotentialPreselectionData:SendPreselectionPreference(tbCheckIns, tbCheckOutIds, callback)
local netCallback = function(_, mapNetData)
for _, v in ipairs(self.tbPreselectionList) do
if tbCheckIns ~= nil and table.indexof(tbCheckIns, v.nId) > 0 then
v.bPreference = true
end
if tbCheckOutIds ~= nil and table.indexof(tbCheckOutIds, v.nId) > 0 then
v.bPreference = false
end
end
if callback ~= nil then
callback()
end
end
local msgData = {CheckInIds = tbCheckIns, CheckOutIds = tbCheckOutIds}
HttpNetHandler.SendMsg(NetMsgId.Id.potential_preselection_preference_set_req, msgData, nil, netCallback)
end
function PlayerPotentialPreselectionData:SendUpdatePotential(nId, tbCharPotential, callback)
local netCallback = function(_, mapNetData)
local mapData = self:CreateNewPreselection(mapNetData)
for k, v in ipairs(self.tbPreselectionList) do
if v.nId == nId then
self.tbPreselectionList[k] = mapData
break
end
end
if callback ~= nil then
callback(mapData)
end
end
local msgData = {Id = nId, CharPotentials = tbCharPotential}
HttpNetHandler.SendMsg(NetMsgId.Id.potential_preselection_update_req, msgData, nil, netCallback)
end
function PlayerPotentialPreselectionData:SendImportPotential(sName, bPreference, tbCharPotential, callback)
local netCallback = function(_, mapNetData)
local bInList = false
local mapData = self:CreateNewPreselection(mapNetData)
for k, v in ipairs(self.tbPreselectionList) do
if v.nId == mapData.nId then
bInList = true
self.tbPreselectionList[k] = mapData
break
end
end
if not bInList then
table.insert(self.tbPreselectionList, mapData)
end
if callback ~= nil then
callback(mapData)
end
end
local msgData = {
Name = sName,
Preference = bPreference,
CharPotentials = tbCharPotential
}
HttpNetHandler.SendMsg(NetMsgId.Id.potential_preselection_import_req, msgData, nil, netCallback)
end
return PlayerPotentialPreselectionData
+75 -13
View File
@@ -39,6 +39,7 @@ function PlayerQuestData:Init()
self.nCurTourGroupOrderIndex = 0
self.nMaxTourGroupOrderIndex = 0
self.nMaxTeamFormationGroupIdx = 0
self.nMaxTeamFormationGroupIdxInAttr = {}
self.tbTourGuideGroup = {}
self.tbTourGuide = {}
self.tbTeamFormation = {}
@@ -92,6 +93,10 @@ function PlayerQuestData:InitConfig()
end
ForEachTableLine(DataTable.WeeklyQuestActive, foreachWeeklyActive)
local foreachTeamFormationGroup = function(mapData)
if self.nMaxTeamFormationGroupIdxInAttr[mapData.AttributeId] == nil then
self.nMaxTeamFormationGroupIdxInAttr[mapData.AttributeId] = 0
end
self.nMaxTeamFormationGroupIdxInAttr[mapData.AttributeId] = self.nMaxTeamFormationGroupIdxInAttr[mapData.AttributeId] + 1
table.insert(self.tbTeamFormationGroup, mapData)
end
ForEachTableLine(DataTable.AssistQuestGroup, foreachTeamFormationGroup)
@@ -240,6 +245,17 @@ function PlayerQuestData:GetStarTowerBookQuestData()
end
return self._mapQuest[12]
end
function PlayerQuestData:GetOngoingAttributeId()
local nLastestAttributeId = 0
for k, v in pairs(self.tbTeamFormationAttr) do
local bComplete = self:CheckTeamFormationAttributeCompleted(v.Id)
if not bComplete then
nLastestAttributeId = v.Id
break
end
end
return nLastestAttributeId
end
function PlayerQuestData:GetAttributeIdByGroupId(nGroupId)
for nGroupIdx, mapGroup in pairs(self.tbTeamFormationGroup) do
if mapGroup.Id == nGroupId then
@@ -278,9 +294,16 @@ function PlayerQuestData:GetCurTeamFormationQuestGroup(nAttributeId)
end
return mapFirstGroup.Id
end
local nCurIndex = math.min(self.tbCurTeamFormationGroupIndex[nAttributeId] + 1, self.nMaxTeamFormationGroupIdx)
local mapCurGroup = self.tbTeamFormationGroup[nCurIndex]
return mapCurGroup.Id
local nCurIndex = math.min(self.tbCurTeamFormationGroupIndex[nAttributeId] + 1, self.nMaxTeamFormationGroupIdxInAttr[nAttributeId])
local nCurAttriCount = 0
for i = 1, #self.tbTeamFormationGroup do
if self.tbTeamFormationGroup[i].AttributeId == nAttributeId then
nCurAttriCount = nCurAttriCount + 1
if nCurAttriCount == nCurIndex then
return self.tbTeamFormationGroup[i].Id
end
end
end
end
function PlayerQuestData:GetTeamFormationQuestData()
if self._mapQuest[QuestType.Assist] == nil then
@@ -301,12 +324,36 @@ function PlayerQuestData:GetTeamFormationGroupById(nGroupId)
end
return tbGroupData
end
function PlayerQuestData:CheckTeamFormationAttributeCompleted(nAttrId)
local tbGroups = {}
local bCompleted = true
function PlayerQuestData:GetTeamFormationGroupStartIndex(nAttrId)
local nStartIndex = 0
for nGroupIndex, mapGroup in pairs(self.tbTeamFormationGroup) do
if mapGroup.AttributeId == nAttrId then
local bGroupCompleted = self:CheckTeamFormationGroupReward(nAttrId, nGroupIndex)
nStartIndex = nGroupIndex
break
end
end
return nStartIndex
end
function PlayerQuestData:GetTeamFormationGroupEndIndex(nAttrId)
local nEndIndex = 0
local nLastestGroupId = self:GetCurTeamFormationQuestGroup(nAttrId)
for nGroupIndex, mapGroup in pairs(self.tbTeamFormationGroup) do
if mapGroup.AttributeId == nAttrId and mapGroup.Id == nLastestGroupId then
nEndIndex = nGroupIndex
end
end
return nEndIndex
end
function PlayerQuestData:CheckTeamFormationAttributeCompleted(nAttrId)
local bCompleted = true
local tbIndexInAttr = {}
for nGroupIndex, mapGroup in pairs(self.tbTeamFormationGroup) do
if mapGroup.AttributeId == nAttrId then
if tbIndexInAttr[nAttrId] == nil then
tbIndexInAttr[nAttrId] = 0
end
tbIndexInAttr[nAttrId] = tbIndexInAttr[nAttrId] + 1
local bGroupCompleted = self:CheckTeamFormationGroupReward(nAttrId, tbIndexInAttr[nAttrId])
bCompleted = bCompleted and bGroupCompleted
if bCompleted == false then
return false
@@ -336,9 +383,11 @@ function PlayerQuestData:CheckTeamFormationAttributeUnlocked(nAttrId)
return true
end
local bCompleted = true
local nGroupIdxInAttr = 0
for nGroupIndex, mapGroup in pairs(self.tbTeamFormationGroup) do
if mapGroup.AttributeId == mapAttr.Pre then
local bGroupCompleted = self:CheckTeamFormationGroupReward(nAttrId, nGroupIndex)
nGroupIdxInAttr = nGroupIdxInAttr + 1
local bGroupCompleted = self:CheckTeamFormationGroupReward(mapAttr.Pre, nGroupIdxInAttr)
bCompleted = bCompleted and bGroupCompleted
if bCompleted == false then
return false
@@ -350,10 +399,15 @@ end
function PlayerQuestData:GetTeamFormationAttributeProgress(nAttrId)
local nTotalCount = 0
local nReceivedCount = 0
local tbIndexInAttr = {}
for nGroupIndex, mapGroup in pairs(self.tbTeamFormationGroup) do
if mapGroup.AttributeId == nAttrId then
if tbIndexInAttr[nAttrId] == nil then
tbIndexInAttr[nAttrId] = 0
end
tbIndexInAttr[nAttrId] = tbIndexInAttr[nAttrId] + 1
nTotalCount = nTotalCount + 1
local bGroupCompleted = self:CheckTeamFormationGroupReward(nAttrId, nGroupIndex)
local bGroupCompleted = self:CheckTeamFormationGroupReward(nAttrId, tbIndexInAttr[nAttrId])
if bGroupCompleted then
nReceivedCount = nReceivedCount + 1
end
@@ -1222,13 +1276,21 @@ end
function PlayerQuestData:UpdateTeamFormationRedDot()
local bCanReceive = false
local bAllReceive = true
local nAttr = 0
for k, v in pairs(table) do
nAttr = nAttr + 1
local bComp = self:CheckTeamFormationAttributeCompleted(nAttr)
local nAttr = 1
local nFinish = 0
local foreachAttri = function(mapData)
nFinish = nFinish + 1
end
ForEachTableLine(DataTable.AssistAttribute, foreachAttri)
for i = 1, nFinish do
local bComp = self:CheckTeamFormationAttributeCompleted(i)
if not bComp then
nAttr = i
break
end
if i == nFinish then
nAttr = i
end
end
local nCurGroupId = self:GetCurTeamFormationQuestGroup(nAttr)
local questList = self._mapQuest[QuestType.Assist]
@@ -547,6 +547,17 @@ function PlayerStarTowerData:GetMaxDifficult(nGroupId)
end
return ret
end
function PlayerStarTowerData:GetGlobalMaxDifficult()
local ret = 1
local foreachStarTower = function(mapData)
local nTempRet = self:GetMaxDifficult(mapData.Id)
if nTempRet > ret then
ret = nTempRet
end
end
ForEachTableLine(DataTable.StarTowerGroup, foreachStarTower)
return ret
end
function PlayerStarTowerData:GetMaxPassedDifficult(nGroupId)
local ret = 0
local mapGroup = CacheTable.GetData("_StarTower", nGroupId)
@@ -25,6 +25,7 @@ function PlayerStateData:CacheStateData(mapMsgData)
RedDotManager.SetValid(RedDotDefine.StarTowerBook_Affinity_Reward, "server", mapMsgData.NpcAffinityReward)
PlayerData.Quest:UpdateServerQuestRedDot(mapMsgData.TravelerDuelQuest)
PlayerData.Quest:UpdateServerQuestRedDot(mapMsgData.TravelerDuelChallengeQuest)
self.nLastReceiveIdleRewardTime = mapMsgData.TravelerDuelIdleReward or CS.ClientManager.Instance.serverTimeStamp
PlayerData.InfinityTower:UpdateBountyRewardState(mapMsgData.InfinityTower)
PlayerData.StarTowerBook:UpdateServerRedDot(mapMsgData.StarTowerBook)
PlayerData.ScoreBoss:UpdateRedDot(mapMsgData.ScoreBoss)
@@ -335,4 +336,31 @@ function PlayerStateData:RefreshCharAdvanceRewardRedDot()
end
end
end
function PlayerStateData:RefreshTrekkerVersusIdleRewardRedDot(nNewTime)
local nActId = 0
local foreachActData = function(mapData)
if mapData.ActivityType == GameEnum.activityType.TrekkerVersus then
nActId = mapData.Id > nActId and mapData.Id or nActId
end
end
ForEachTableLine(DataTable.Activity, foreachActData)
local actData = PlayerData.Activity:GetActivityDataById(nActId)
local bRedDotOn = false
if actData ~= nil then
local tbIdleReward = actData:GetIdleReward()
if tbIdleReward ~= nil and 0 < #tbIdleReward then
if nNewTime ~= nil then
self.nLastReceiveIdleRewardTime = nNewTime
end
local nElapsedTime = CS.ClientManager.Instance.serverTimeStamp - self.nLastReceiveIdleRewardTime
if nElapsedTime >= 3600 * ConfigTable.GetConfigNumber("TrekkerVersusIdleRewardRedDotTime") then
bRedDotOn = true
end
end
end
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(nActId)
if bInActGroup then
RedDotManager.SetValid(RedDotDefine.TrekkerVersusIdleReward, {nActGroupId, nActId}, bRedDotOn)
end
end
return PlayerStateData
+22 -3
View File
@@ -20,7 +20,8 @@ function PlayerTeamData:CacheFormationInfo(mapData)
0,
0,
0
}
},
nPreselectionId = 0
}
end
end
@@ -42,7 +43,8 @@ function PlayerTeamData:CacheFormationInfo(mapData)
0,
0,
0
}
},
nPreselectionId = 0
}
end
for nIndex, nCharId in ipairs(v.CharIds) do
@@ -51,19 +53,21 @@ function PlayerTeamData:CacheFormationInfo(mapData)
for nIndex, nDiscId in ipairs(v.DiscIds) do
mapTeamData.tbTeamDiscId[nIndex] = nDiscId
end
mapTeamData.nPreselectionId = v.PreselectionId
end
end
if mapData.Record ~= nil then
PlayerData.StarTower:CacheFormationInfo(mapData.Record)
end
end
function PlayerTeamData:UpdateFormationInfo(nTeamId, tbCharIds, tbDiscIds, callback)
function PlayerTeamData:UpdateFormationInfo(nTeamId, tbCharIds, tbDiscIds, nPreselectionId, callback)
local PlayerFormationReq = {}
PlayerFormationReq.Formation = {}
PlayerFormationReq.Formation.Number = nTeamId
PlayerFormationReq.Formation.Captain = 1
PlayerFormationReq.Formation.CharIds = tbCharIds
PlayerFormationReq.Formation.DiscIds = tbDiscIds
PlayerFormationReq.Formation.PreselectionId = nPreselectionId
local Callback = function()
if self._tbTeam == nil then
self._tbTeam = {}
@@ -78,12 +82,16 @@ function PlayerTeamData:UpdateFormationInfo(nTeamId, tbCharIds, tbDiscIds, callb
mapTeamData.tbTeamDiscId[nIndex] = nDiscId
end
end
mapTeamData.nPreselectionId = nPreselectionId
if callback ~= nil and type(callback) == "function" then
callback()
end
end
HttpNetHandler.SendMsg(NetMsgId.Id.player_formation_req, PlayerFormationReq, nil, Callback)
end
function PlayerTeamData:GetAllTeamData()
return self._tbTeam
end
function PlayerTeamData:GetTeamData(nTeamId)
if self._tbTeam == nil then
return nil, nil
@@ -134,6 +142,17 @@ function PlayerTeamData:GetTeamCharId(nTeamId)
end
return tbCharId
end
function PlayerTeamData:GetTeamPreselectionId(nTeamId)
if self._tbTeam == nil then
return 0
end
local mapTeamData = self._tbTeam[nTeamId]
if mapTeamData ~= nil then
return mapTeamData.nPreselectionId
else
return 0
end
end
function PlayerTeamData:CheckTeamValid(nTeamId)
if self._tbTeam == nil then
return false
@@ -1,5 +1,6 @@
local PlayerTrialData = class("PlayerTrialData")
local AdventureModuleHelper = CS.AdventureModuleHelper
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
function PlayerTrialData:Init()
self.curLevel = nil
self.bInSettlement = false
@@ -65,6 +66,7 @@ function PlayerTrialData:EnterTrialEditor(nFloor)
self.curLevel:BindEvent()
end
if type(self.curLevel.Init) == "function" then
Actor2DManager.ForceUseL2D(true)
self.curLevel:Init(self, nFloor)
end
end
@@ -82,10 +84,12 @@ function PlayerTrialData:EnterTrial(nLevelId)
self.curLevel:BindEvent()
end
if type(self.curLevel.Init) == "function" then
Actor2DManager.ForceUseL2D(true)
self.curLevel:Init(self, nLevelId)
end
end
function PlayerTrialData:LevelEnd()
Actor2DManager.ForceUseL2D(false)
PlayerData.Build:DeleteTrialBuild()
if nil ~= self.curLevel and type(self.curLevel.UnBindEvent) == "function" then
self.curLevel:UnBindEvent()
@@ -245,10 +245,10 @@ function PlayerVoiceData:PlayBoardSelectVoice(nCharId, nSkinId)
end
function PlayerVoiceData:PlayMainViewOpenVoice()
local curBoardCharId, curSkinId = self:GetCurBoardCharIdAndSkinId()
self:CheckHoliday()
local bPlayFirst = false
local tbVoiceKey = {}
if nil ~= curBoardCharId then
if curBoardCharId ~= nil and curBoardCharId ~= 0 then
self:CheckHoliday()
local nServerTimeStamp = ClientManager.serverTimeStamp
local nHour = tonumber(os.date("%H", nServerTimeStamp))
local getIndex = function(nHour)
@@ -267,7 +267,7 @@ function PlayerVoiceData:PlayMainViewOpenVoice()
else
tbVoiceKey = {sKey, "greet"}
end
if #self.tbHolidayVoiceKey > 0 then
if 0 < #self.tbHolidayVoiceKey then
for _, v in ipairs(self.tbHolidayVoiceKey) do
table.insert(tbVoiceKey, v)
end
@@ -302,7 +302,7 @@ function PlayerVoiceData:PlayBoardClickVoice()
end
self.nContinuousClickCount = self.nContinuousClickCount + 1
local curBoardCharId, curSkinId = self:GetCurBoardCharIdAndSkinId()
if nil ~= curBoardCharId then
if curBoardCharId ~= nil and curBoardCharId ~= 0 then
local tbVoiceKey = {}
if self.nContinuousClickCount > getBoardClickMaxCount(self.bNpc) then
table.insert(tbVoiceKey, "hfc")
@@ -369,7 +369,7 @@ function PlayerVoiceData:PlayBoardFreeVoice()
curSkinId = self.nNPCSkinId
sVoiceKey = "hang_npc"
end
if nil ~= curBoardCharId then
if curBoardCharId ~= nil and curBoardCharId ~= 0 then
self:PlayCharVoice(sVoiceKey, curBoardCharId, curSkinId, self.bNpc)
end
end
@@ -383,7 +383,7 @@ function PlayerVoiceData:PlayBoardFreeLongTimeVoice()
curSkinId = self.nNPCSkinId
sVoiceKey = "exhang_npc"
end
if nil ~= curBoardCharId then
if curBoardCharId ~= nil and curBoardCharId ~= 0 then
self:PlayCharVoice(sVoiceKey, curBoardCharId, curSkinId, self.bNpc)
end
end
+5
View File
@@ -50,12 +50,17 @@ local LoadBattleData = function()
LocalSettingData.mapData.BattleHUD = LoadLocalData("BattleHUD", AllEnum.BattleHudType.Sector)
end
end
local LoadNotificationData = function()
LocalSettingData.mapData.Energy = LoadLocalData("Energy", true)
LocalSettingData.mapData.Dispatch = LoadLocalData("Dispatch", true)
end
function LocalSettingData.Init()
LocalSettingData.mapData = {}
LocalSettingData.mapData.UseLive2D = LoadLocalData("UseLive2D", true)
LoadSoundData()
LoadBattleData()
InitCurSignInData()
LoadNotificationData()
end
function LocalSettingData.GetLocalSettingData(subKey)
return LocalSettingData.mapData[subKey]
+3
View File
@@ -161,6 +161,9 @@ function PlayerData.Init()
local StoryData = require("GameCore.Data.DataClass.PlayerStoryData")
PlayerData.Story = StoryData.new()
PlayerData.Story:Init()
local PotentialPreselection = require("GameCore.Data.DataClass.PlayerPotentialPreselectionData")
PlayerData.PotentialPreselection = PotentialPreselection.new()
PlayerData.PotentialPreselection:Init()
local foreachEnumDesc = function(mapData)
CacheTable.SetField("_EnumDesc", mapData.EnumName, mapData.Value, mapData.Key)
end