152 lines
4.5 KiB
Lua
152 lines
4.5 KiB
Lua
--文件是自动生成,请勿手动修改.来自数据文件:Equip_Magic_suit
|
|
local L_CompressMaxColumn = 3
|
|
local L_CompressData = {
|
|
10508726171936529,53343183242982923,33025619470,
|
|
--10001,第1套,筑基套装,1,21850,,31_500;20_500,,32_500;19_500,,30_500;17_500,,29_600;18_600,,13_50;14_35,,
|
|
11334532418873106,53344557635139088,33028240915,
|
|
--10002,第2套,鸿蒙套装,2,33867,,31_775;20_775,,32_775;19_775,,30_775;17_775,,29_930;18_930,,13_77;14_54,,
|
|
11986203511760659,53345932027295253,33030862360,
|
|
--10003,第3套,天道套装,3,43350,,31_992;20_992,,32_992;19_992,,30_992;17_992,,29_1190;18_1190,,13_99;14_69,,
|
|
12760676309575444,49804954820081178,26274874308,
|
|
--10004,第4套,创世套装,4,54620,,31_1249;20_1249,,32_1249;19_1249,,30_1249;17_1249,,29_1499;18_1499,,13_124;14_87,,
|
|
}
|
|
local L_MainKeyDic = {
|
|
[10001]=1,[10002]=2,[10003]=3,[10004]=4,}
|
|
local L_NamesByNum = {
|
|
Id = 1,
|
|
NeedDegree = 3,
|
|
Score = 4,
|
|
}
|
|
local L_NamesByString = {
|
|
Name = 2,
|
|
Attribute2 = 5,
|
|
ElementAttribute2 = 6,
|
|
Attribute4 = 7,
|
|
ElementAttribute4 = 8,
|
|
Attribute6 = 9,
|
|
ElementAttribute6 = 10,
|
|
Attribute8 = 11,
|
|
ElementAttribute8 = 12,
|
|
Attribute10 = 13,
|
|
ElementAttribute10 = 14,
|
|
}
|
|
local L_ColNameIndexs = {
|
|
Id = 0,
|
|
Name = 1,
|
|
NeedDegree = 2,
|
|
Score = 3,
|
|
Attribute2 = 4,
|
|
ElementAttribute2 = 5,
|
|
Attribute4 = 6,
|
|
ElementAttribute4 = 7,
|
|
Attribute6 = 8,
|
|
ElementAttribute6 = 9,
|
|
Attribute8 = 10,
|
|
ElementAttribute8 = 11,
|
|
Attribute10 = 12,
|
|
ElementAttribute10 = 13,
|
|
}
|
|
--local L_ColumnUseBitCount = {15,17,4,17,2,17,2,17,2,17,2,17,2,17,}
|
|
--local L_ColumnList = {1,1,1,1,1,2,2,2,2,2,2,3,3,3,}
|
|
--local L_ShiftDataList = {0,15,32,36,53,0,17,19,36,38,55,0,17,19,}
|
|
--local L_AndDataList = {16383,65535,7,65535,1,65535,1,65535,1,65535,1,65535,1,65535,}
|
|
local L_ColumnShiftAndList = {1,0,16383,1,15,65535,1,32,7,1,36,65535,1,53,1,2,0,65535,2,17,1,2,19,65535,2,36,1,2,38,65535,2,55,1,3,0,65535,3,17,1,3,19,65535,}
|
|
local L_ColNum = 14;
|
|
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 = 4
|
|
}
|
|
|
|
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
|