Files
Main/Assets/GameAssets/Resources/Lua/Config/Data/DataStateXisui.lua
2025-01-25 04:38:09 +08:00

138 lines
4.3 KiB
Lua

--文件是自动生成,请勿手动修改.来自数据文件:state_xisui
local L_CompressMaxColumn = 2
local L_CompressData = {
1456106716343361,9654,
--1,意通周天,元婴,收集【灵气精粹】点亮星窍,贯通周天抵御元婴之劫(击败任意首领,离线挂机,掌门传道均有机会获取),1_210,,
1456244157394018,21192,
--2,五灵灌体,化神,修复【五灵洞真图】引五灵真气灌体抵御化神之劫(击败任意首领,离线挂机,掌门传道均有机会获取),1_350,,
1456450316872851,21195,
--3,神火锻体,合体,收集【六丁神火】净化凡尘混浊炼成混元金身抵御合体之劫(击败任意首领,离线挂机,掌门传道均有机会获取),1_460,,
1456656875859140,21198,
--4,一气化三清,大乘,收集【道气】炼成三清玉体抵御大乘之劫(击败任意首领,离线挂机,掌门传道均有机会获取),1_620,,
1456863036386549,21201,
--5,斩三世身,地仙,收集【因果之丝】凝聚因果之剑斩三世身抵御地仙之劫(击败任意首领,离线挂机,掌门传道均有机会获取),1_740,,
1457012579052838,21204,
--6,占位不开启,占位,占位不开启,1_9999;2_9999,,
}
local L_MainKeyDic = {
[1]=1,[2]=2,[3]=3,[4]=4,[5]=5,[6]=6,}
local L_NamesByNum = {
Id = 1,
}
local L_NamesByString = {
Name = 2,
TargetName = 3,
Describe = 4,
Condition = 5,
}
local L_ColNameIndexs = {
Id = 0,
Name = 1,
TargetName = 2,
Describe = 3,
Condition = 4,
}
--local L_ColumnUseBitCount = {4,16,16,16,16,}
--local L_ColumnList = {1,1,1,1,2,}
--local L_ShiftDataList = {0,4,20,36,0,}
--local L_AndDataList = {7,32767,32767,32767,32767,}
local L_ColumnShiftAndList = {1,0,7,1,4,32767,1,20,32767,1,36,32767,2,0,32767,}
local L_ColNum = 5;
local L_UseDataK = setmetatable({ },{ __mode = 'k'});
local L_UseDataV = setmetatable({ },{ __mode = 'v'});
local L_UseDataRow = setmetatable({ },{ __mode = 'v'});
local L_IsCache = false;
local mt = {}
local function GetData(row, column)
local startIndex = (column - 1) * 3
local _compressData = L_CompressData[(row - 1)*L_CompressMaxColumn+L_ColumnShiftAndList[startIndex + 1]]
local _tempData = _compressData >> L_ColumnShiftAndList[startIndex + 2]
local _data = _tempData & L_ColumnShiftAndList[startIndex + 3]
local _andSign = L_ColumnShiftAndList[startIndex + 3] + 1
local _isMinus = (_andSign & _tempData) == _andSign
return _isMinus and -_data or _data;
end
mt.__index = function (t,key)
local _key = L_UseDataK[t];
local _row = L_MainKeyDic[_key];
local _column = L_NamesByNum[key];
if _column ~= nil then
if L_IsCache then
local _data = L_UseDataRow[_row * L_ColNum + _column]
if not _data then
_data = GetData(_row, _column)
L_UseDataRow[_row * L_ColNum + _column] = _data
end
return _data
else
return GetData(_row, _column)
end
end
_column = L_NamesByString[key]
if _column ~= nil then
return StringDefines[GetData(_row, _column)]
end
if string.find(key, '_') then
local _newKey = string.gsub(key, '_', '')
_column = L_NamesByString[_newKey]
if _column ~= nil then
return GetData(_row, _column)
end
end
if key ~= '_OnCopyAfter_' then
return
end
end
local M = {
_CompressData_ = L_CompressData,
_ColumnShiftAndList_ = L_ColumnShiftAndList,
_CompressMaxColumn_ = L_CompressMaxColumn,
_ColumnNameIndexs_ = L_ColNameIndexs,
Count = 6
}
function M:Foreach(func)
for i=1,M.Count do
local _key = GetData(i, 1)
func(_key, M[_key])
end
end
function M:ForeachCanBreak(func)
for i = 1,M.Count do
local _key = GetData(i, 1)
if func(_key, M[_key]) then
break
end
end
end
function M:GetByIndex(index)
return M[GetData(index, 1)];
end
function M:IsContainKey(key)
return not(not L_MainKeyDic[key]);
end
function M:SetIsCache(isCh)
L_IsCache = isCh;
end
setmetatable(M, {__index = function(t, key)
if not L_MainKeyDic[key] then
return;
end
local _t = L_UseDataV[key];
if not _t then
_t = setmetatable({}, mt);
L_UseDataV[key] = _t;
L_UseDataK[_t] = key;
end
return _t
end})
return M