local DataSheetUtil = {} local table_insert = table.insert --region 数据的预处理 ---拆分表常量,按需填写,会根据sheetName表名在调用该表的时候,根据splitKey拆分表的依据主键,将表拆分 ---将多主键的表,拆成形如多个表、单主键的形式,方便某些情况下的使用 ---DataSheetManager.sheetName[splitKeyValue]:GetDataByKey() ---通过正则搜索“DataSheetManager\..*\[.*\]:”可找到使用举例 ---使用上仅在表名处不同,通过字典的形式,才能调用各种方法。 local SplitSheetData = { -- 金将活动 - 各系统货币信息 {sheetName = "GoldHeroActivityHUDData", splitKey = "HeroType"}, -- 金将活动 - 体验关(秘闻) {sheetName = "GoldHeroActivityOpen", splitKey = "HeroType"}, {sheetName = "GoldHeroActivityGroup", splitKey = "HeroType"}, -- 金将活动 - 讨伐Boss {sheetName = "GoldHeroSynergyBossData", splitKey = "HeroType"}, {sheetName = "GoldHeroSynergyBossDailyReward", splitKey = "HeroType"}, {sheetName = "GoldHeroSynergyBossTotalRank", splitKey = "HeroType"}, {sheetName = "GoldHeroSynergyBossDamageRank", splitKey = "HeroType"}, -- 金将活动 - 武圣宝库 {sheetName = "GoldHeroActivityStore", splitKey = "HeroStoreType"}, -- 金将活动 - 声名鹊起 {sheetName = "GoldHeroActivityTaskLevel", splitKey = "HeroType"}, {sheetName = "GoldHeroActivityTaskTab", splitKey = "HeroType"}, {sheetName = "GoldHeroActivityTaskData", splitKey = "HeroType"}, --彩金将活动 {sheetName = "SuperGoldHUDData", splitKey = "HeroType"}, --彩金-试炼关 {sheetName = "SuperGoldBossDamageRank", splitKey = "RankRewardGroup"}, {sheetName = "SuperGoldBossTotalRank", splitKey = "RankRewardGroup"}, -- 彩金将活动 - 体验关 {sheetName = "SuperGoldGroup", splitKey = "HeroType"}, {sheetName = "SuperGoldEndingOpen", splitKey = "HeroType"}, {sheetName = "SuperGoldEndingRecord", splitKey = "HeroType"}, {sheetName = "SuperGoldEndingReward", splitKey = "HeroType"}, -- 彩金将活动 - 战令 {sheetName = "SuperGoldHonorOrderReward", splitKey = "RewardGroupID"}, {sheetName = "SuperGoldHonorOrderTask", splitKey = "TaskGroupID"}, } local function IsSheetNeedSplit(sheetName) for i, v in ipairs(SplitSheetData) do if string.find(sheetName, v.sheetName) then return v end end return false end function DataSheetUtil.DataSheetPreProcess(sheetName) return IsSheetNeedSplit(sheetName) end --endregion --指定哪些表的那些列的数据要被替换为FP(定点数) local DataSheetProcessFixedPointList = { ['AttrData'] = {"ChangeMaxParam", "ChangeMinParam", }, ['BuffData'] = { "BuffDuration","CallFrequency", "TimeOverlieLimit", "HaloRadius"}, ['BuffMoveData'] = {"MoveDuration", "HorizontalDistance", "DragTerminalRadius" , "DragTerminalOffsetX" , "DragTerminalOffsetZ"}, ['BuffTriggerData'] = { TriggerBuffData_Table={"ActionParamFloat1"}}, ['CallBulletData'] = {"Radius" ,"PolygonRevolute","HpInherit" ,"RandomDelayTime"}, ['ConstData'] = { "FloatValue" ,}, ['HeroData'] = { "WarnRange" , "ReturnRange", "Speed", "AngleSpeed",}, ['LevelInfoData'] = {"Timer",}, ['MissileData'] = { "OffsetX", "OffsetZ", "ShapeParam1", "ShapeParam2","ShapeParam3", "ColliderY", "TotalTime", "DamageStartFrame", "DamageEndFrame" ,"DamageIntervalFrame" , "MoveSpeed", "MoveSpeedY", "AngleSpeed","DelayMoveFrame" ,"HurtDirectionAngle", "HitMoveTime", "HitDistance", "PlayerHitMoveTime","PlayerHitDistance", "AddSAVal" , MissileBuffData_Table = {"BuffDuration",}, FireMissileData_Table = {"Param",}, "HideDelayFrame", FeedBackBuff_Table = {"BuffDuration",}, }, ['TrackerData'] = { "OffsetX", "OffsetZ", "ShapeParam1", "ShapeParam2","ShapeParam3", "ColliderY", "HurtDirectionAngle","HitMoveTime", "HitDistance", "PlayerHitMoveTime","PlayerHitDistance", "AddSAVal" ,"FreeFlyMaxTime","TrackFlyTime" , "FreeFlySaveTime" , "TrackFlySpd","DamageIntervalFrame" , MissileBuffData_Table = {"BuffDuration",}, FireMissileData_Table = {"Param",}, FeedBackBuff_Table = {"BuffDuration",},}, ['MonsterData'] = { "ShowRange", "WarnRange" , "ReturnRange", "WeakLoopTime" ,"Speed", "AngleSpeed" , "DeadBodyReserveTime",}, --['MonsterValueData'] = {AttrData_Table = { "CalValue" , "BaseValue", },}, ['NpcData'] = { "WarnRange" , "ReturnRange", "Speed", "AngleSpeed",}, ['SkillData'] = { "SkillCD", "MpCost", "ChooseRadius" ,"CastRadius" , "InputCorrectPVE" , "InputCorrectPVP","AimPosRound" , "TimeScaleStartTime" , "TimeScaleEndTime" ,"TimeScale", "RSStartTime","RSEndTime" , "MSStartTime","MSEndTime" , "MSMaxDis", "MSStopAimOffset", "SwitchAllTime",SkillSwitch_Table = {"SwitchStartTime","SwitchDuration" ,"SwitchMinPlayTime",}, "FaceOffsetAngle","FaceAimStart","FaceAimEnd", "AngleSpeedRatio", SkillEvent_Table = {"EventTime","EventParam", }}, ['TrustpointData'] = { "Delaytime" ,Trustpoint_Table = {"WarnRange","InspectRange" ,"ReturnRange" ,}, }, ['InteractData'] = {"InteractRange", "RangeOffsetX" ,"RangeOffsetZ" }, ['DriveData'] = { "DisMin" ,"DisMax" , "DisInit", "BornAngle", "DisSpeed" ,"CRXMin" ,"CRXMax" ,"AngleMax"}, ['SubjugateData'] = {Segments_Table = {"Param_a","Param_b","Param_c","Param_d","Param_m","Param_n",}}, ['HorseMoveData'] = {"MaxSpd","SpdAccele","SpdDecele" ,"SpdGear" ,"MaxAngleSpd" ,"AngleAccele" ,"HeadAccele" ,"HeadStopDecele" ,}, ['RetinueData'] = {"NoTargetMinDistSqr", "NoTargetMaxDistSqr", "NoTargetConveyDistSqr", "HasTargetConveyDistSqr"}, ['BuffSkillData'] = {"CastRadiusSqr","ChooseRadius" , "InputCorrectPVE" , "InputCorrectPVP",}, ['SyncSoloData'] = {"DodgeReactionChance", "SwitchReactionChance"}, ['ThreeBattleLevelData'] = {"DodgeReactionChance", "SwitchReactionChance"}, } function DataSheetUtil.IsColumnFP(sheetName, columnName, tableName) local list if tableName then list = DataSheetProcessFixedPointList[sheetName][tableName] else list = DataSheetProcessFixedPointList[sheetName] end if list then for i,v in ipairs(list) do if v == columnName then return true end end end return false end local function ReplaceNumbers(keys, olds) for i,t_key in ipairs(keys) do for k,t_old in ipairs(olds) do local tt_old = rawget(t_old, t_key) if (tt_old) then local new = FP.newV1(tt_old) rawset(t_old, t_key, new) end end end end --分表模式的定点数预处理 function DataSheetUtil.ProcessFixedPoint(tableName, pageData) if DataSheetProcessFixedPointList[tableName] then local totalTable = DataSheetManager[tableName] for __, tableElement in ipairs(pageData) do for attrKey, attrVal in pairs(DataSheetProcessFixedPointList[tableName]) do local attrType = type(attrVal) if(attrType == 'table') then local index = totalTable:GetPropertyIndex(attrKey) if index then local oldData = tableElement[index] if oldData then ReplaceNumbers(attrVal, oldData) end end else local index = totalTable:GetPropertyIndex(attrVal) if index then local oldData = tableElement[index] if oldData then local new = FP.newV1(oldData) rawset(tableElement, index, new) end end end end end end end --[[ 整表模式的定点数预处理 function DataSheetUtil.ProcessFixedPoint() for path, attr in pairs(DataSheetProcessFixedPointList) do local data = DataSheetManager[path] if data then for n, row in data:GetEnumerator() do for key, attrVal in pairs(attr) do local attrType = type(attrVal) if(attrType == 'table') then local index = data:GetPropertyIndex(key) if index then local oldData = row[index] if oldData then ReplaceNumbers(attrVal, oldData) end end else local index = data:GetPropertyIndex(attrVal) if index then local oldData = row[index] if oldData then local new = FP.newV1(oldData) rawset(row, index, new) end end end end end end end end --]] --*****AttrDataList***** local limitDataDir = {} function DataSheetUtil.AttrDataInit() for _,data in DataSheetManager.AttrData:GetEnumerator() do limitDataDir[data.AttrName] = data end end local EAttrMinMaxType = { INIT_BASED = 0, --初始值乘系数 VALUE_RANGE = 1, --直接值 } -- 获取属性的取值范围 function DataSheetUtil.AttrDataGetResult(attrType, val ,initval) local result = val local data = limitDataDir[attrType] if data == nil then return result end if data.MinMaxType == EAttrMinMaxType.INIT_BASED then result = FP.Math.Min(result, initval * data.ChangeMaxParam) result = FP.Math.Max(result, initval * data.ChangeMinParam) elseif data.MinMaxType == EAttrMinMaxType.VALUE_RANGE then result = FP.Math.Min(result, data.ChangeMaxParam) result = FP.Math.Max(result, data.ChangeMinParam) end return result end --*****BuffRelateDataList***** local BuffImmuneCheckInfo = {} -- 记录的是身上的buff,能否阻挡新buff的添加。key=已有buff,val=被阻挡的buff字典 local BuffExclusiveCheckInfo = {} -- key为buffId甲,value为一个dic,dic的key为buffId乙,value为true,dic里所有buffId乙,都会顶掉buffId甲 【可理解为:删掉“key”的都有哪些 “val”】 local BuffExclusiveHaveDeleteAbilityDic = {} -- key为buffID,val为true 。记录 buffID 是否能 顶掉任意一个buff。【可认为具有顶掉其他buff的集合】 --数据全部读取后 function DataSheetUtil.BuffRelateSetData() for k,v in DataSheetManager.BuffRelateData:GetEnumerator() do local buffId = v.BuffID if #v.ExclusiveBuffs > 0 then local exclusiveIDs = BuffExclusiveCheckInfo[buffId] or {} for i,id in ipairs(v.ExclusiveBuffs) do exclusiveIDs[id] = true BuffExclusiveHaveDeleteAbilityDic[id] = true end BuffExclusiveCheckInfo[buffId] = exclusiveIDs end if #v.ImmuneBuffs > 0 then local immuneIDs = {} for i, id in ipairs(v.ImmuneBuffs) do immuneIDs[id] = true end BuffImmuneCheckInfo[buffId] = immuneIDs end for i,deleteBuffId in ipairs(v.DeleteBuffs) do BuffExclusiveCheckInfo[deleteBuffId] = BuffExclusiveCheckInfo[deleteBuffId] or {} BuffExclusiveCheckInfo[deleteBuffId][buffId] = true BuffExclusiveHaveDeleteAbilityDic[buffId] = true end end end --判断buffID(或buffGroup)对应的Buff能不能互斥 checkBuffID 或者 checkBuffGroupID对应的Buff function DataSheetUtil.CheckBuffExclusive(buffID, buffGroup, checkBuffID, checkBuffGroupID) local exclusiveInfo = BuffExclusiveCheckInfo[buffID] if exclusiveInfo and (exclusiveInfo[checkBuffID] or exclusiveInfo[checkBuffGroupID]) then return true end local exclusiveGroupInfo = BuffExclusiveCheckInfo[buffGroup] if exclusiveGroupInfo and (exclusiveGroupInfo[checkBuffID] or exclusiveGroupInfo[checkBuffGroupID]) then return true end return false end --判断buffID对应的Buff能不能免疫 checkBuffID或者免疫checkBuffGroupID对应的Buff function DataSheetUtil.CheckBuffImmune(buffID, checkBuffID, checkBuffGroupID) local immuneInfo = BuffImmuneCheckInfo[buffID] return immuneInfo and (immuneInfo[checkBuffID] or immuneInfo[checkBuffGroupID]) end -- 检测是否参与到免疫判断 function DataSheetUtil.CheckBuffHasImmune(buffID) return BuffImmuneCheckInfo[buffID] ~= nil end -- 检测是否参与到互斥判断(检测的是已经在身上的buff,是否能被顶掉) function DataSheetUtil.CheckBuffHasExclusive(buffID, buffGroup) return BuffExclusiveCheckInfo[buffID] ~= nil or BuffExclusiveCheckInfo[buffGroup] ~= nil end -- 检测是否具有顶掉其他buff的功能(检测的是正在添加的buff) function DataSheetUtil.CheckBuffHaveDeleteAbility(newBuffID, newBuffGroup) return BuffExclusiveHaveDeleteAbilityDic[newBuffID] ~= nil or BuffExclusiveHaveDeleteAbilityDic[newBuffGroup] ~= nil end function DataSheetUtil.GetBuffImmuneCheckInfo() return BuffImmuneCheckInfo end function DataSheetUtil.GetBuffExclusiveHaveDeleteAbilityDic() return BuffExclusiveHaveDeleteAbilityDic end --返回 function DataSheetUtil.GetCharacterData(characterType,characterID) if characterType == LuaConst.CharacterType.Hero then return DataSheetManager.HeroData:GetDataByID(characterID) elseif characterType == LuaConst.CharacterType.Monster then return DataSheetManager.MonsterData:GetDataByID(characterID) end end --*****BuffTriggerDataList***** local BuffTriggerDataList = {} --数据全部读取后 function DataSheetUtil.BuffTriggerSetData() BuffTriggerDataList.BuffCanTriggerDic = {} --{ [TriggerParam]={{BuffID =2,Triggerdata},},bufftype ==2 的字典 for k,v in DataSheetManager.BuffTriggerData:GetEnumerator() do local buffId = v.BuffID local triggerList = v.TriggerBuffData_Table for i,triggerData in ipairs(triggerList) do if triggerData.TriggerType == LuaConst.BuffTriggerType.BuffTrigger then --local candata = CanTriggerBuffData:new(buffId ,triggerData ) local candata = {["TriggerBuff"] = buffId, ["TriggerData"] = triggerData} local list = BuffTriggerDataList.BuffCanTriggerDic[triggerData.TriggerParam] if list == nil then list = {} table_insert(list,candata) BuffTriggerDataList.BuffCanTriggerDic[triggerData.TriggerParam] = list else table_insert(list,candata) end end end end end function DataSheetUtil.GetBuffCanTriggerData(buffID) local dataList = BuffTriggerDataList.BuffCanTriggerDic[buffID] return dataList end --排序主线章节表 local BarrierChapterSortedData = {} function DataSheetUtil.SortLevelChapterData() for i, v in DataSheetManager.BarrierChapterData:GetEnumerator() do table_insert(BarrierChapterSortedData, v) end table.sort(BarrierChapterSortedData, function(a, b) return a.BarrierCharpterID < b.BarrierCharpterID end) end function DataSheetUtil.GetSortedLevelChapterData() return BarrierChapterSortedData end local GuildCultivationSortedData = {} function DataSheetUtil.SortGuildCultivationData() for i, v in DataSheetManager.CultivationData:GetEnumerator() do table_insert(GuildCultivationSortedData, v) end table.sort(GuildCultivationSortedData, function(a, b) return a.CultivationOrder < b.CultivationOrder end) end function DataSheetUtil.GetSortedGuildCultivationData() return GuildCultivationSortedData end function DataSheetUtil.FunctionUnlockInit() for k,v in DataSheetManager.FuctionUnlock:GetEnumerator() do for i,j in ipairs(v.Unlock_Table) do if j.UnlockCondition ~= LuaConst.UnlockConditionType.CompleteMainAndSubStory and j.UnlockCondition ~= LuaConst.UnlockConditionType.OpenUIView and j.UnlockCondition ~= LuaConst.UnlockConditionType.NoCompleteTask and j.UnlockCondition ~= LuaConst.UnlockConditionType.LevelOrTask then rawset(j,"UnlockConditionParam",tonumber(j.UnlockConditionParam)) end end end end function DataSheetUtil.GuideInit() for k,v in DataSheetManager.GuideData:GetEnumerator() do for i,j in ipairs(v.Trigger_Table) do if j.Condition ~= LuaConst.UnlockConditionType.CompleteMainAndSubStory and j.Condition ~= LuaConst.UnlockConditionType.OpenUIView and j.Condition ~= LuaConst.UnlockConditionType.NoCompleteTask then rawset(j,"ConditionParam",tonumber(j.ConditionParam)) end end end end function DataSheetUtil.ItemCfgIdToBelongerID() local itemCfgData = nil; for i, v in DataSheetManager.HeroNum:GetEnumerator() do itemCfgData = DataSheetManager.ItemData:GetDataByID(v.PieceItem); if itemCfgData and itemCfgData.FirstType == LuaConst.ItemType.HeroFragment then rawset(itemCfgData, "BelongerID", v.ID); end end for __, v in DataSheetManager.EquipData:GetEnumerator() do itemCfgData = DataSheetManager.ItemData:GetDataByID(v.ItemID); if itemCfgData and itemCfgData.FirstType == LuaConst.ItemType.EquipDebris then rawset(itemCfgData, "BelongerID", v.ID); end end for _, v in DataSheetManager.MagicWeaponData:GetEnumerator() do local magicWeaponBreakNeedData = DataSheetManager.MagicWeaponStar:GetDataByMagicWeaponID_Star(v.MagicWeaponID, 0); local costDataCfg = DataSheetManager.MagicWeaponStarItem:GetDataByItemRepeatID(magicWeaponBreakNeedData.Item_Table[1].ItemRepeat); for __, costData in ipairs(costDataCfg.Item_Table) do itemCfgData = DataSheetManager.ItemData:GetDataByID(costData.ItemID); if itemCfgData and itemCfgData.FirstType == LuaConst.ItemType.WeaponFragment then rawset(itemCfgData, "BelongerID", v.MagicWeaponID); end end itemCfgData = DataSheetManager.ItemData:GetDataByID(v.FoundryItem); if itemCfgData and itemCfgData.FirstType == LuaConst.ItemType.WeaponFragment then rawset(itemCfgData, "BelongerID", v.MagicWeaponID); end end for _, warHorseCfgData in DataSheetManager.HorseData:GetEnumerator() do for __, costData in ipairs(warHorseCfgData.Item_Table) do itemCfgData = DataSheetManager.ItemData:GetDataByID(costData.ItemID); if itemCfgData and itemCfgData.FirstType == LuaConst.ItemType.Horse then rawset(itemCfgData, "BelongerID", warHorseCfgData.HorseID); end end end for _, treasureCfgData in DataSheetManager.TreasureData:GetEnumerator() do for __, costData in ipairs(treasureCfgData.Item_Table) do itemCfgData = DataSheetManager.ItemData:GetDataByID(costData.ItemID); if itemCfgData and itemCfgData.FirstType == LuaConst.ItemType.Treasure then rawset(itemCfgData, "BelongerID", treasureCfgData.TreasureID); end end end for _, v in DataSheetManager.GodBeastData:GetEnumerator() do itemCfgData = DataSheetManager.ItemData:GetDataByID(v.PieceItem); rawset(itemCfgData, "BelongerID", v.ID); end for _, v in DataSheetManager.StratagemData:GetEnumerator() do itemCfgData = DataSheetManager.ItemData:GetDataByID(v.PieceItem) rawset(itemCfgData, "BelongerID", v.ID) end for _, v in DataSheetManager.LightEffect:GetEnumerator() do if v.Activation and v.Activation > 0 then itemCfgData = DataSheetManager.ItemData:GetDataByID(v.Activation) rawset(itemCfgData, "BelongerID", v.ID) end end end -- 统计所有武将最大的天赋值 local HeroAwakenMaxTalentDic = {} -- key = heroId , val = {developEffectId,... } function DataSheetUtil.HeroAwakenTalentInit() local totalHeroDic = {} -- { [heroId] = {maxPointId = xxx, [pointId] = {PointId, PointLevel, TalentID }, [pointId] = {PointId, PointLevel, TalentID } }, ... } for k,v in DataSheetManager.HeroAwakenTalent:GetEnumerator() do if totalHeroDic[v.HeroID] == nil then totalHeroDic[v.HeroID] = {maxPointId = -1} end local heroDic = totalHeroDic[v.HeroID] if v.TalentID > 0 then if v.PointId > heroDic.maxPointId then heroDic.maxPointId = v.PointId end local info = heroDic[v.PointId] if info == nil then heroDic[v.PointId] = {v.PointId, v.PointLevel, v.TalentID} -- [1] = PointId ,[2] = PointLevel, [3] = TalentID else -- 如果存在则比较等级 if v.PointLevel > info[2] then info[2] = v.PointLevel info[3] = v.TalentID end end end end for heroId, heroDic in pairs(totalHeroDic) do -- pairs is safe local list = {} HeroAwakenMaxTalentDic[heroId] = list for pointId = 1, heroDic.maxPointId do if heroDic[pointId] then table.insert(list,heroDic[pointId][3]) end end end end function DataSheetUtil.GetHeroAwakenTalentList(heroId) return HeroAwakenMaxTalentDic[heroId] end local function GetMaxPointIDByLineType(lineType, pointData_1, pointData_2, pointData_3) local maxPointID = 0 if pointData_1 and pointData_1.LineType == lineType and pointData_1.PointID > maxPointID then maxPointID = pointData_1.PointID end if pointData_2 and pointData_2.LineType == lineType and pointData_3.PointID > maxPointID then maxPointID = pointData_2.PointID end if pointData_3 and pointData_3.LineType == lineType and pointData_3.PointID > maxPointID then maxPointID = pointData_3.PointID end return maxPointID end local relyForgePointDatas = {} function DataSheetUtil.GetWeaponForgeActivateRelyPoints(heroID, pointID_1, pointID_2, pointID_3) table.clearArray(relyForgePointDatas) local templateID = CTL.DivineWeapon.GetForgeTemplateID(heroID) local pointData_1 = DataSheetManager.MagicWeaponFoundry:GetDataByID_PointID(templateID, pointID_1) local pointData_2 = DataSheetManager.MagicWeaponFoundry:GetDataByID_PointID(templateID, pointID_2) local pointData_3 = DataSheetManager.MagicWeaponFoundry:GetDataByID_PointID(templateID, pointID_3) if not pointData_1 and not pointData_2 and not pointData_3 then return relyForgePointDatas end local topMaxPointID = GetMaxPointIDByLineType(2, pointData_1, pointData_2, pointData_3) local centerMaxPointID = GetMaxPointIDByLineType(1, pointData_1, pointData_2, pointData_3) local bottomMaxPointID = GetMaxPointIDByLineType(3, pointData_1, pointData_2, pointData_3) local relyPointID = 401 local relyPointData = DataSheetManager.MagicWeaponFoundry:GetDataByID_PointID(templateID, relyPointID) while (relyPointData ~= nil) do if #relyPointData.NeedPoint > 0 then local isActivate = true for _, pointID in ipairs (relyPointData.NeedPoint) do local pointData = DataSheetManager.MagicWeaponFoundry:GetDataByID_PointID(templateID, pointID) if pointData.LineType == 2 then isActivate = topMaxPointID >= pointID elseif pointData.LineType == 1 then isActivate = centerMaxPointID >= pointID elseif pointData.LineType == 3 then isActivate = bottomMaxPointID >= pointID end if not isActivate then break end end if isActivate then table.insert(relyForgePointDatas, relyPointData) end end relyPointID = relyPointID + 1 relyPointData = DataSheetManager.MagicWeaponFoundry:GetDataByID_PointID(templateID, relyPointID) end return relyForgePointDatas end function DataSheetUtil.GetForgeTemplateID(heroID, appearanceID) if not heroID then return 0 end local templateID = 0 if appearanceID and appearanceID ~= 0 and heroID ~= appearanceID then local appearanceData = DataSheetManager.WeaponAppearance:GetDataByID(appearanceID) templateID = appearanceData and appearanceData.MagicWeaponFoundry or 0 else local magicData = DataSheetManager.MagicWeaponData:GetDataByMagicWeaponID(heroID) templateID = magicData and magicData.MagicWeaponFoundry or 0 end return templateID end --初始化 function DataSheetUtil.DataSheetPostProcess() DataSheetUtil.AttrDataInit() DataSheetUtil.BuffRelateSetData() DataSheetUtil.BuffTriggerSetData() DataSheetUtil.SortLevelChapterData() DataSheetUtil.SortGuildCultivationData() DataSheetUtil.FunctionUnlockInit() DataSheetUtil.GuideInit() DataSheetUtil.ItemCfgIdToBelongerID() DataSheetUtil.HeroAwakenTalentInit() end local function SortByID(a, b) return a.ID < b.ID end function DataSheetUtil.CreateSortedDataSheet(dataName, sortFunc) local sort = sortFunc or SortByID local sortedList = {} for i, v in DataSheetManager[dataName]:GetEnumerator() do sortedList[i] = v end table.sort(sortedList, sort) return sortedList end --PC市场录屏包需要做一些特殊的数据处理 function DataSheetUtil.DataSheetPCMarketProcess() --市场包需要全部的关卡进包,因此将LevelInfoData中的PackStage由-1改为5 local packStageIndex = 5 local pageIndexArr = {} for i, v in DataSheetManager.LevelInfoData:GetEnumerator() do pageIndexArr[rawget(v, 2)] = rawget(v, 2) end for __, pageIndex in ipairs(pageIndexArr) do local levelInfoDataPage = require ("Data/LevelInfoData-page" .. pageIndex) for __, levelInfoData in ipairs(levelInfoDataPage) do if levelInfoData[packStageIndex] == -1 then levelInfoData[packStageIndex] = 5 end end end --屏蔽金将,金色战马,金色宝物功能不开启 local funcIdIndex = 1 local unlockConditionIndex = 2 pageIndexArr = {} for i, v in DataSheetManager.FuctionUnlock:GetEnumerator() do pageIndexArr[rawget(v, 2)] = rawget(v, 2) end for __, pageIndex in ipairs(pageIndexArr) do local fuctionUnlockPage = require ("Data/FuctionUnlock-page" .. pageIndex) for __, fuctionUnlockData in ipairs(fuctionUnlockPage) do if fuctionUnlockData[funcIdIndex] == 807 or fuctionUnlockData[funcIdIndex] == 808 or fuctionUnlockData[funcIdIndex] == 809 then fuctionUnlockData[unlockConditionIndex][1].UnlockConditionParam = 9999 end end end end --RewardClientShow表中的Item_Table结构被优化重构,需处理转换为原逻辑的使用结构。 JWS2-48991 local RewardClientShowItemTable = {} function DataSheetUtil.GetRewardClientShowItemTable(rewardClientShowCfg) local itemTable = RewardClientShowItemTable[rewardClientShowCfg.ClientShowID] if itemTable then return itemTable end itemTable = {} for i = 1, #rewardClientShowCfg.ItemID do local tb = {ItemID = rewardClientShowCfg.ItemID[i], ItemNum = rewardClientShowCfg.ItemNum[i], FristGothrough = rewardClientShowCfg.FristGothrough[i] == 1, TagType = rewardClientShowCfg.TagType[i]} table.insert(itemTable, tb) end RewardClientShowItemTable[rewardClientShowCfg.ClientShowID] = itemTable return itemTable end return DataSheetUtil