157 lines
4.2 KiB
Lua
157 lines
4.2 KiB
Lua
--文件是自动生成,请勿手动修改.来自数据文件:equip_inten_class
|
|
local L_CompressMaxColumn = 1
|
|
local L_CompressData = {
|
|
112621786113,
|
|
--1,80,,1032_500;1033_500;1034_500;1035_500,,
|
|
112623888386,
|
|
--2,160,,1032_1000;1033_1000;1034_1000;1035_1000,,
|
|
112625990659,
|
|
--3,240,,1032_1500;1033_1500;1034_1500;1035_1500,,
|
|
112628093956,
|
|
--4,336,,1032_2000;1033_2000;1034_2000;1035_2000,,
|
|
112630197765,
|
|
--5,440,,1032_2500;1033_2500;1034_2500;1035_2500,,
|
|
112632302086,
|
|
--6,552,,1032_3000;1033_3000;1034_3000;1035_3000,,
|
|
112634406919,
|
|
--7,672,,1032_3500;1033_3500;1034_3500;1035_3500,,
|
|
112636512264,
|
|
--8,800,,1032_4000;1033_4000;1034_4000;1035_4000,,
|
|
112638618121,
|
|
--9,936,,1032_4500;1033_4500;1034_4500;1035_4500,,
|
|
112640724490,
|
|
--10,1080,,1032_5000;1033_5000;1034_5000;1035_5000,,
|
|
112642831371,
|
|
--11,1232,,1032_5500;1033_5500;1034_5500;1035_5500,,
|
|
112644938764,
|
|
--12,1392,,1032_6000;1033_6000;1034_6000;1035_6000,,
|
|
112647046669,
|
|
--13,1560,,1032_6500;1033_6500;1034_6500;1035_6500,,
|
|
112649155086,
|
|
--14,1736,,1032_7000;1033_7000;1034_7000;1035_7000,,
|
|
112651264015,
|
|
--15,1920,,1032_7500;1033_7500;1034_7500;1035_7500,,
|
|
112653373968,
|
|
--16,2120,,1032_8000;1033_8000;1034_8000;1035_8000,,
|
|
}
|
|
local L_MainKeyDic = {
|
|
[1]=1,[2]=2,[3]=3,[4]=4,[5]=5,[6]=6,[7]=7,[8]=8,[9]=9,[10]=10,[11]=11,[12]=12,[13]=13,[14]=14,[15]=15,
|
|
[16]=16,}
|
|
local L_NamesByNum = {
|
|
Id = 1,
|
|
Level = 2,
|
|
}
|
|
local L_NamesByString = {
|
|
Value = 3,
|
|
Value1 = 4,
|
|
}
|
|
local L_ColNameIndexs = {
|
|
Id = 0,
|
|
Level = 1,
|
|
Value = 2,
|
|
Value1 = 3,
|
|
}
|
|
--local L_ColumnUseBitCount = {6,13,2,17,}
|
|
--local L_ColumnList = {1,1,1,1,}
|
|
--local L_ShiftDataList = {0,6,19,21,}
|
|
--local L_AndDataList = {31,4095,1,65535,}
|
|
local L_ColumnShiftAndList = {1,0,31,1,6,4095,1,19,1,1,21,65535,}
|
|
local L_ColNum = 4;
|
|
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]
|
|
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 = 16
|
|
}
|
|
|
|
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
|