465 lines
18 KiB
Lua
465 lines
18 KiB
Lua
ConfigName = {
|
||
-- AccomplishmentConfig = "AccomplishmentConfig",
|
||
ActivityRewardConfig = "ActivityRewardConfig",
|
||
-- AdventureConfig = "AdventureConfig",
|
||
AreaConfig = "AreaConfig",
|
||
ArtResourcesConfig = "ArtResourcesConfig",
|
||
AudioConfig = "AudioConfig",
|
||
ChallengeConfig = "ChallengeConfig",
|
||
ChallengeMapConfig = "ChallengeMapConfig",
|
||
ChallengeMissionConfig = "ChallengeMissionConfig",
|
||
ChapterEventPointConfig = "ChapterEventPointConfig",
|
||
ChapterOptionConfig = "ChapterOptionConfig",
|
||
DifferDemonsComonpentsConfig = "DifferDemonsComonpentsConfig",
|
||
DifferDemonsConfig = "DifferDemonsConfig",
|
||
DifferDemonsStageConfig = "DifferDemonsStageConfig",
|
||
EquipConfig = "EquipConfig",
|
||
EquipPropertyPool = "EquipPropertyPool",
|
||
EventPointConfig = "EventPointConfig",
|
||
ExploreFunctionConfig = "ExploreFunctionConfig",
|
||
FoodsConfig = "FoodsConfig",
|
||
GameSetting = "GameSetting",
|
||
GlobalActivity = "GlobalActivity",
|
||
GlobalSystemConfig = "GlobalSystemConfig",
|
||
GuideConfig = "GuideConfig",
|
||
HeroConfig = "HeroConfig",
|
||
HeroLevelConfig = "HeroLevelConfig",
|
||
HeroRankupConfig = "HeroRankupConfig",
|
||
HeroRankupGroup = "HeroRankupGroup",
|
||
ItemConfig = "ItemConfig",
|
||
LevelDifficultyConfig = "LevelDifficultyConfig",
|
||
LevelSetting = "LevelSetting",
|
||
LotteryRewardConfig = "LotteryRewardConfig",
|
||
LotterySetting = "LotterySetting",
|
||
LotterySpecialConfig = "LotterySpecialConfig",
|
||
MapPointConfig = "MapPointConfig",
|
||
MissionEventsConfig = "MissionEventsConfig",
|
||
MonsterConfig = "MonsterConfig",
|
||
MonsterGroup = "MonsterGroup",
|
||
MonsterViewConfig = "MonsterViewConfig",
|
||
OptionAddCondition = "OptionAddCondition",
|
||
OptionConfig = "OptionConfig",
|
||
PassiveSkillConfig = "PassiveSkillConfig",
|
||
PassiveSkillLogicConfig = "PassiveSkillLogicConfig",
|
||
PlayerLevelConfig = "PlayerLevelConfig",
|
||
PropertyConfig = "PropertyConfig",
|
||
RewardGroup = "RewardGroup",
|
||
RoleConfig = "RoleConfig",
|
||
RunesConfig = "RunesConfig",
|
||
RunesPoolConfig = "RunesPoolConfig",
|
||
SkillConfig = "SkillConfig",
|
||
SkillLogicConfig = "SkillLogicConfig",
|
||
StoreConfig = "StoreConfig",
|
||
StoreTypeConfig = "StoreTypeConfig",
|
||
UIConfig = "UIConfig",
|
||
VipLevelConfig = "VipLevelConfig",
|
||
PrivilegeTypeConfig = "PrivilegeTypeConfig",
|
||
TaskConfig = "TaskConfig",
|
||
WorkShopEquipmentConfig = "WorkShopEquipmentConfig",
|
||
WorkShopFoundationConfig = "WorkShopFoundationConfig",
|
||
WorkShopFunctionConfig = "WorkShopFunctionConfig",
|
||
WorkShopRebuildConfig = "WorkShopRebuildConfig",
|
||
WorkShopSetting = "WorkShopSetting",
|
||
ArenaReward = "ArenaReward",
|
||
ArenaSetting = "ArenaSetting",
|
||
DifferDemonsBoxSetting = "DifferDemonsBoxSetting",
|
||
-- AdventureReward = "AdventureReward",
|
||
DialogueViewConfig = "DialogueViewConfig",
|
||
JumpConfig = "JumpConfig",
|
||
RechargeCommodityConfig = "RechargeCommodityConfig",
|
||
DailyTasksConfig = "DailyTasksConfig",
|
||
WorkShopTechnology = "WorkShopTechnology",
|
||
WorkShopTechnologySetting = "WorkShopTechnologySetting",
|
||
ChallengeStarBox = "ChallengeStarBox",
|
||
TrialConfig = "TrialConfig",
|
||
TrialSetting = "TrialSetting",
|
||
BlessingConfig = "BlessingConfig",
|
||
BlessingRewardPool = "BlessingRewardPool",
|
||
ElementalResonanceConfig = "ElementalResonanceConfig",
|
||
TreasureTaskConfig = "TreasureTaskConfig",
|
||
EndlessMapConfig = "EndlessMapConfig",
|
||
SevenDaysActivity = "SevenDaysActivity",
|
||
LuckyCatConfig = "LuckyCatConfig",
|
||
SignInConfig = "SignInConfig",
|
||
-- BeginnerTask = "BeginnerTask",
|
||
GuildSetting = "GuildSetting",
|
||
GuildLevelConfig = "GuildLevelConfig",
|
||
GuildRewardConfig = "GuildRewardConfig",
|
||
ActivityRankingReward = "ActivityRankingReward",
|
||
ExchangeActivityConfig = "ExchangeActivityConfig",
|
||
FloodConfig = "FloodConfig",
|
||
LoginPosterConfig = "LoginPosterConfig",
|
||
QAConfig = "QAConfig",
|
||
BeStronger = "BeStronger",
|
||
SpecialConfig = "SpecialConfig",
|
||
EquipSign="EquipSign",
|
||
EquipTalismana = "EquipTalismana",
|
||
EquipTalismanaLottery="EquipTalismanaLottery",
|
||
EquipSignSetting="EquipSignSetting",
|
||
BloodyBattleSetting = "BloodyBattleSetting",
|
||
BloodyBattleReward = "BloodyBattleReward",
|
||
BloodyBattleTask = "BloodyBattleTask",
|
||
BloodyBattleTreasure = "BloodyBattleTreasure",
|
||
BloodyRankConfig = "BloodyRankConfig",
|
||
RandomName = "RandomName",
|
||
MainLevelConfig = "MainLevelConfig",
|
||
MainLevelSettingConfig = "MainLevelSettingConfig",
|
||
HeroReturn = "HeroReturn",
|
||
TreasureSunlongConfig = "TreasureSunlongConfig",
|
||
TreasureSunLongTaskConfig = "TreasureSunlongTaskConfig",
|
||
DialRewardSetting="DialRewardSetting",
|
||
DialRewardConfig="DialRewardConfig",
|
||
MainMapIconConfig="MainMapIconConfig",
|
||
ErrorCodeHint = "ErrorCodeHint",
|
||
SystemMessageConfig = "SystemMessageConfig",
|
||
ActivityDropReward = "ActivityDropReward",
|
||
-- PlayerAppearance = "PlayerAppearance",
|
||
PlayerMountLevelUp = "PlayerMountLevelUp",
|
||
MazeTreasure = "MazeTreasure",
|
||
MazeTreasureSetting = "MazeTreasureSetting",
|
||
ChampionshipReward="ChampionshipReward",
|
||
ChampionshipSetting="ChampionshipSetting",
|
||
LuxuryFundConfig="LuxuryFund",
|
||
PlayerRole="PlayerRole",
|
||
GuildBossConfig="GuildBossConfig",
|
||
GuildBossRewardConfig="GuildBossRewardConfig",
|
||
GuildRedPackConfig="GuildRedPackConfig",
|
||
ExpeditionFloorConfig="ExpeditionFloorConfig",
|
||
ExpeditionHolyConfig="ExpeditionHolyConfig",
|
||
ExpeditionSetting="ExpeditionSetting",
|
||
ExpeditionNodeConfig="ExpeditionNodeConfig",
|
||
AchievementConfig="AchievementConfig",
|
||
MonthcardConfig = "MonthcardConfig",
|
||
EquipStarsConfig = "EquipStarsConfig",
|
||
CombatControl="CombatControl",
|
||
EquipSuiteConfig = "EquipSuiteConfig",
|
||
BuffEffectConfig = "BuffEffectConfig",
|
||
RecommendTeam="RecommendTeam",
|
||
JewelConfig="JewelConfig",
|
||
JewelRankupConfig="JewelRankupConfig",
|
||
JewelResonanceConfig="JewelResonanceConfig",
|
||
DailyChallengeConfig="DailyChallengeConfig",
|
||
GuildTechnology="GuildTechnology",
|
||
WorldBossConfig="WorldBossConfig",
|
||
WorldBossRewardConfig="WorldBossRewardConfig",
|
||
WorldBossSetting="WorldBossSetting",
|
||
GuildSacrificeConfig="GuildSacrificeConfig",
|
||
GuildSacrificeRewardConfig="GuildSacrificeRewardConfig",
|
||
GuildWarConfig="GuildWarConfig",
|
||
GuildHelpConfig="GuildHelpConfig",
|
||
WorldBossTreasureConfig="WorldBossTreasureConfig",
|
||
TrialKillConfig="TrialKillConfig",
|
||
TrialQuestionConfig="TrialQuestionConfig",
|
||
TrialGameConfig="TrialGameConfig",
|
||
FakeBattle = "FakeBattle",
|
||
ArenaBattleReward = "ArenaBattleReward",
|
||
RaceTowerConfig = "RaceTowerConfig",
|
||
RaceTowerRewardConfig = "RaceTowerRewardConfig",
|
||
HeroSacrifice = "HeroSacrifice",
|
||
GuildCheckpointConfig = "GuildCheckpointConfig",
|
||
GuildCheckpointRank = "GuildCheckpointRank",
|
||
ThemeActivityTaskConfig = "ThemeActivityTaskConfig",
|
||
ExchangeRate = "ExchangeRate",
|
||
CustomEventConfig = "CustomEventConfig",
|
||
SpiritAnimal = "SpiritAnimal",
|
||
SpiritAnimalBook = "SpiritAnimalBook",
|
||
SpiritAnimalLevel = "SpiritAnimalLevel",
|
||
SpiritAnimalStar = "SpiritAnimalStar",
|
||
SpiritAnimalSetting = "SpiritAnimalSetting",
|
||
SpiritAnimalSkill = "SpiritAnimalSkill",
|
||
ExpeditionRecruitConfig = "ExpeditionRecruitConfig",
|
||
FreeTravel="FreeTravel",
|
||
FreeTravelStore="FreeTravelStore",
|
||
GodSacrificeConfig = "GodSacrificeConfig",
|
||
GodSacrificeSetting = "GodSacrificeSetting",
|
||
Language="Language",
|
||
FakeBattleNew = "FakeBattleNew",
|
||
HeroSkin = "HeroSkin",
|
||
BlessingConfigNew = "BlessingConfigNew",
|
||
BlessingRewardPoolNew = "BlessingRewardPoolNew",
|
||
SpiritAnimalSummon = "SpiritAnimalSummon",
|
||
CampTowerConfig = "CampTowerConfig",
|
||
CampTowerSetting = "CampTowerSetting",
|
||
GodHoodTreeLevel = "GodHoodTreeLevel",
|
||
GodHoodTreeSetting = "GodHoodTreeSetting",
|
||
NewHeroConfig = "NewHeroConfig",
|
||
PlayerHeadIcon = "PlayerHeadIcon",
|
||
GoodLuck = "GoodLuck",
|
||
Tips = "TipsConfig",
|
||
Hongmeng = "Hongmeng",
|
||
HongmengUp = "HongmengUp",
|
||
NewHeroConfig = "NewHeroConfig",
|
||
MainLevelBossConfig = "MainLevelBoss",
|
||
ActivityGroups = "ActivityGroups",
|
||
ArroGantFly = "ArroGantFly",
|
||
ComposeActivity = "ComposeActivity",
|
||
ComposeBook = "ComposeBook",
|
||
StoryMapConfig = "StoryMapConfig",
|
||
EndlessHeroProp = "EndlessHeroProp",
|
||
EndlessTask = "EndlessTask",
|
||
endlessMorale = "EndlessMorale",
|
||
endlessTreasure = "EndlessTreasure",
|
||
endlessDifficulty = "EndlessDifficulty",
|
||
HardStage = "HardStage",
|
||
HardStageBuff = "HardStageBuff",
|
||
HardStageChapter = "HardStageChapter",
|
||
HardStageCondition = "HardStageCondition",
|
||
HardStageReward = "HardStageReward",
|
||
XiuXianConfig = "XiuXian",
|
||
XiuXianSkillConfig = "XiuXianSkill",
|
||
WishActivitySetting = "WishActivitySetting",
|
||
WishActivityPool = "WishActivityPool",
|
||
WishActivityUp = "WishActivityUp",
|
||
PackageConfig = "PackageConfig",
|
||
MServerArenaSetting = "MServerArenaSetting",
|
||
MServerArenaReward = "MServerArenaReward",
|
||
LingLongPool = "LingLongPool",
|
||
SurpriseBoxConfig = "SurpriseBox",
|
||
JourneyWithWind = "JourneyWithWind",
|
||
LikeAbility = "LikeAbility",
|
||
QijieHolyConfig = "QijieHolyConfig",
|
||
QijieRanking = "QijieRanking",
|
||
QijieStage = "QijieStage",
|
||
QijieStageBuff = "QijieStageBuff",
|
||
QijieTreasure = "QijieTreasure",
|
||
QijieUpgrade = "QijieUpgrade",
|
||
MServerRankConfig="MServerRankConfig",
|
||
MServerRankReward="MServerRankReward",
|
||
MServerArenaSetting="MServerArenaSetting",
|
||
FourQuadrantConfig = "FourQuadrantConfig",
|
||
PlayerSkill = "PlayerSkill",
|
||
PlayerSkillBasicTable = "PlayerSkillBasicTable",
|
||
RidingSwardConfig = "RidingSwardConfig",
|
||
RidingSwardResult = "RidingSwardResult",
|
||
RidingSwardSence = "RidingSwardSence",
|
||
WeekcardConfig = "WeekcardConfig",
|
||
WeekcardRotationConfig="WeekcardRotationConfig",
|
||
WeekRewardConfig="WeekRewardConfig",
|
||
GuideBattleConfig = "GuideBattleConfig",
|
||
TrumpBook = "TrumpBook",
|
||
Trump = "Trump",
|
||
TrumpLevelupPool = "TrumpLevelupPool",
|
||
ChangingCard = "ChangingCard",
|
||
MServerLodeSetting = "MServerLodeSetting",
|
||
LodeConfig = "LodeConfig",
|
||
LodeRankReward = "LodeRankReward",
|
||
GoodsConfig = "GoodsConfig",
|
||
ThemeActivityShop = "ThemeActivityShop",
|
||
GemConfig = "GemConfig",
|
||
SummonTreasure = "SummonTreasure",
|
||
Explore = "Explore",
|
||
LevelTips = "LevelTips",
|
||
HomeLand = "HomeLand",
|
||
HomeLandLevel = "HomeLandLevel",
|
||
HomeLandTask = "HomeLandTask",
|
||
EquipStrengthen = "EquipStrengthen",
|
||
EquipRankUp = "EquipRankUp",
|
||
TrumpStar = "TrumpStar",
|
||
exploreTask = "ExploreTask",
|
||
ChallengeStage="ChallengeStage",
|
||
ChangingCardLevel="ChangingCardLevel",
|
||
ChangingForce="ChangingForce",
|
||
CompareNumBuild="CompareNumBuild",
|
||
CompareNumChaper="CompareNumChaper",
|
||
CompareNumItem="CompareNumItem",
|
||
CompareNumSetting="CompareNumSetting",
|
||
PrestigeConfig="PrestigeConfig",
|
||
UniversalWelfareConfig="UniversalWelfareConfig",
|
||
GMInfo="GMInfo",
|
||
GMMaster="GMMaster",
|
||
ChongRank="ChongRank",
|
||
ChongRankInfo="ChongRankInfo",
|
||
ChongRankInformation ="ChongRankInformation",
|
||
ChangingCardStar = "ChangingCardStar",
|
||
SuperZhenChong="SuperZhenChong",
|
||
RewardItemConfig="RewardItemConfig",
|
||
HotRanking="HotRanking",
|
||
FaxiangConfig="FaxiangConfig",
|
||
FaxiangLevelConfig="FaxiangLevelConfig",
|
||
FaxiangStarConfig="FaxiangStarConfig",
|
||
HeroChange="HeroChange",
|
||
DuoDuiTower="DuoDuiTower",
|
||
DuoDuiTowerHero="DuoDuiTowerHero",
|
||
DuoDuiTowerConfig="DuoDuiTowerConfig",
|
||
ShenbingStar="ShenbingStar",
|
||
ShenBingSkill="ShenBingSkill",
|
||
ShenBingSetting="ShenBingSetting",
|
||
ShenBingLevel="ShenBingLevel",
|
||
ShenBing="ShenBing",
|
||
TabulationConfig="TabulationConfig",
|
||
WishConfig="WishConfig",
|
||
ChangingCardPosition="ChangingCardPosition",
|
||
GemConfigNew ="GemConfigNew",
|
||
GemLotteryConfig="GemLotteryConfig",
|
||
GiftConfig="GiftConfig",
|
||
PotentialNew = "PotentialNew",
|
||
PotentialNewConfig = "PotentialNewConfig",
|
||
Train = "Train",
|
||
TrainBuild = "TrainBuild",
|
||
TrainBuildLevel = "TrainBuildLevel",
|
||
TrainSetting = "TrainSetting",
|
||
RechargeCommodityorder="RechargeCommodityorder",
|
||
}
|
||
|
||
require "Framework/GameDataBase"
|
||
local configList = {}
|
||
|
||
ConfigManager = {}
|
||
|
||
function ConfigManager.Initialize()
|
||
configList = {}
|
||
end
|
||
|
||
function ConfigManager.GetConfig(cfgType)
|
||
if not configList[cfgType] then
|
||
local config = require("Config/Data/" .. cfgType)
|
||
GameDataBase.SheetBase.Init(config)
|
||
configList[cfgType] = config
|
||
end
|
||
return configList[cfgType]
|
||
end
|
||
|
||
---获取表格Id项
|
||
function ConfigManager.GetConfigData(cfgType, id)
|
||
local config = ConfigManager.GetConfig(cfgType)[id]
|
||
assert(config, string.format("%s not find Id:%s", cfgType, id))
|
||
return config
|
||
end
|
||
---获取表格Id项不返回错误
|
||
function ConfigManager.TryGetConfigData(cfgType, id)
|
||
return ConfigManager.GetConfig(cfgType)[id]
|
||
end
|
||
|
||
---获取某个key值为value的固定表格条目(取第一个)
|
||
function ConfigManager.GetConfigDataByKey(cfgType, key, value)
|
||
local configData
|
||
for _, configInfo in ConfigPairs(ConfigManager.GetConfig(cfgType)) do
|
||
if configInfo[key] == value then
|
||
configData = configInfo
|
||
break
|
||
end
|
||
end
|
||
assert(configData, string.format("%s not find key:%s,value:%s", cfgType, key, value))
|
||
return configData
|
||
end
|
||
---获取某个key值为value的固定表格条目(取第一个),不返回错误
|
||
function ConfigManager.TryGetConfigDataByKey(cfgType, key, value)
|
||
local configData
|
||
for _, configInfo in ConfigPairs(ConfigManager.GetConfig(cfgType)) do
|
||
if configInfo[key] == value then
|
||
configData = configInfo
|
||
break
|
||
end
|
||
end
|
||
return configData
|
||
end
|
||
|
||
---获取双重Key锁定下的表格条目(取第一个)
|
||
function ConfigManager.GetConfigDataByDoubleKey(cfgType, key1, value1, key2, value2)
|
||
local configData
|
||
for _, configInfo in ConfigPairs(ConfigManager.GetConfig(cfgType)) do
|
||
if configInfo[key1] == value1 and configInfo[key2] == value2 then
|
||
configData = configInfo
|
||
break
|
||
end
|
||
end
|
||
assert(configData, string.format("%s not find key1:%s,value1:%s,key2:%s, value2:%s", cfgType, key1, value1, key2, value2))
|
||
return configData
|
||
end
|
||
---获取双重Key锁定下的表格条目(取第一个),不返回错误
|
||
function ConfigManager.TryGetConfigDataByDoubleKey(cfgType, key1, value1, key2, value2)
|
||
local configData
|
||
for _, configInfo in ConfigPairs(ConfigManager.GetConfig(cfgType)) do
|
||
if configInfo[key1] == value1 and configInfo[key2] == value2 then
|
||
configData = configInfo
|
||
break
|
||
end
|
||
end
|
||
return configData
|
||
end
|
||
---获取三重Key锁定下的表格条目(取第一个),不返回错误
|
||
function ConfigManager.TryGetConfigDataByThreeKey(cfgType, key1, value1, key2, value2,key3, value3)
|
||
local configData
|
||
for _, configInfo in ConfigPairs(ConfigManager.GetConfig(cfgType)) do
|
||
if configInfo[key1] == value1 and configInfo[key2] == value2 and configInfo[key3] == value3 then
|
||
configData = configInfo
|
||
break
|
||
end
|
||
end
|
||
return configData
|
||
end
|
||
---获取某个key值为value的所有条目
|
||
function ConfigManager.TryGetAllConfigsDataByKey(cfgType, key, value)
|
||
local expectList = {}
|
||
for _, configInfo in ConfigPairs(ConfigManager.GetConfig(cfgType)) do
|
||
if configInfo[key] == value then
|
||
table.insert(expectList, configInfo)
|
||
end
|
||
end
|
||
return expectList
|
||
end
|
||
|
||
---获取某个key值为value的所有条目
|
||
function ConfigManager.TryGetAllConfigsDataByDoubleKey(cfgType, key1, value1, key2, value2)
|
||
local expectList = {}
|
||
for _, configInfo in ConfigPairs(ConfigManager.GetConfig(cfgType)) do
|
||
if configInfo[key1] == value1 and configInfo[key2] == value2 then
|
||
table.insert(expectList, configInfo)
|
||
end
|
||
end
|
||
return expectList
|
||
end
|
||
|
||
---获取某个key值为value的所有条目
|
||
function ConfigManager.GetAllConfigsDataByKey(cfgType, key, value)
|
||
local expectList = {}
|
||
for _, configInfo in ConfigPairs(ConfigManager.GetConfig(cfgType)) do
|
||
if configInfo[key] == value then
|
||
table.insert(expectList, configInfo)
|
||
end
|
||
end
|
||
assert(#expectList > 0, string.format("%s not find key:%s,value:%s", cfgType, key, value))
|
||
return expectList
|
||
end
|
||
---获取双重Key锁定下所有的表格条目
|
||
function ConfigManager.GetAllConfigsDataByDoubleKey(cfgType, key1, value1, key2, value2)
|
||
local expectList = {}
|
||
for _, configInfo in ConfigPairs(ConfigManager.GetConfig(cfgType)) do
|
||
if configInfo[key1] == value1 and configInfo[key2] == value2 then
|
||
table.insert(expectList, configInfo)
|
||
end
|
||
end
|
||
assert(#expectList > 0, string.format("%s not find key1:%s,value1:%s,key2:%s, value2:%s", cfgType, key1, value1, key2, value2))
|
||
return expectList
|
||
end
|
||
---获取三重Key锁定下所有的表格条目
|
||
function ConfigManager.GetAllConfigsDataByThreeKey(cfgType, key1, value1, key2, value2, key3, value3)
|
||
local expectList = {}
|
||
for _, configInfo in ConfigPairs(ConfigManager.GetConfig(cfgType)) do
|
||
if configInfo[key1] == value1 and configInfo[key2] == value2 and configInfo[key3] == value3 then
|
||
table.insert(expectList, configInfo)
|
||
end
|
||
end
|
||
assert(#expectList > 0, string.format("%s not find key1:%s,value1:%s,key2:%s, value2:%s,key3:%s, value3:%s", cfgType, key1, value1, key2, value2, key3, value3))
|
||
return expectList
|
||
end
|
||
|
||
|
||
---配置表遍历(按照id的大小升序遍历)
|
||
---用法:
|
||
---for k, v in ConfigPairs(configs) do
|
||
--- k 为id
|
||
--- v 为id对应的配置项
|
||
---end
|
||
|
||
function ConfigPairs(configs)
|
||
local i = 0
|
||
local keys = GameDataBase.SheetBase.GetKeys(configs)
|
||
return function()
|
||
i = i + 1
|
||
local key = keys[i]
|
||
if key then
|
||
return key, configs[key]
|
||
end
|
||
end
|
||
end |