175 lines
4.4 KiB
Lua
175 lines
4.4 KiB
Lua
--文件是自动生成,请勿手动修改.来自数据文件:NewRedPacket
|
|
local L_CompressMaxColumn = 1
|
|
local L_CompressData = {
|
|
372273605656641,
|
|
--1,1,100,1440,10,10,2,5,,
|
|
372273605656706,
|
|
--2,2,100,1440,10,10,2,5,,
|
|
724117326954691,
|
|
--3,3,200,1440,10,10,2,10,,
|
|
724117326954756,
|
|
--4,4,200,1440,10,10,2,10,,
|
|
724117326954821,
|
|
--5,5,200,1440,10,10,2,10,,
|
|
724117326954886,
|
|
--6,6,200,1440,10,10,2,10,,
|
|
372273605657031,
|
|
--7,7,100,1440,10,10,2,5,,
|
|
372273605657096,
|
|
--8,8,100,1440,10,10,2,5,,
|
|
372273605657161,
|
|
--9,9,100,1440,10,10,2,5,,
|
|
724117326955146,
|
|
--10,10,200,1440,10,10,2,10,,
|
|
724117326955211,
|
|
--11,11,200,1440,10,10,2,10,,
|
|
724117326955276,
|
|
--12,12,200,1440,10,10,2,10,,
|
|
724117326955341,
|
|
--13,13,200,1440,10,10,2,10,,
|
|
724117326955406,
|
|
--14,14,200,1440,10,10,2,10,,
|
|
724117326955471,
|
|
--15,15,200,1440,10,10,2,10,,
|
|
724117326955536,
|
|
--16,16,200,1440,10,10,2,10,,
|
|
724117326955601,
|
|
--17,17,200,1440,10,10,2,10,,
|
|
724117326955666,
|
|
--18,18,200,1440,10,10,2,10,,
|
|
724117326955731,
|
|
--19,19,200,1440,10,10,2,10,,
|
|
724117326955796,
|
|
--20,20,200,1440,10,10,2,10,,
|
|
724117326955861,
|
|
--21,21,200,1440,10,10,2,10,,
|
|
}
|
|
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,[17]=17,[18]=18,[19]=19,[20]=20,[21]=21,}
|
|
local L_NamesByNum = {
|
|
Id = 1,
|
|
GetReasons = 2,
|
|
Value = 3,
|
|
Time = 4,
|
|
MaxNumber = 5,
|
|
MinNumber = 6,
|
|
ItemType = 7,
|
|
MinGetValue = 8,
|
|
}
|
|
local L_NamesByString = {
|
|
}
|
|
local L_ColNameIndexs = {
|
|
Id = 0,
|
|
GetReasons = 1,
|
|
Value = 2,
|
|
Time = 3,
|
|
MaxNumber = 4,
|
|
MinNumber = 5,
|
|
ItemType = 6,
|
|
MinGetValue = 7,
|
|
}
|
|
--local L_ColumnUseBitCount = {6,6,9,12,5,5,3,5,}
|
|
--local L_ColumnList = {1,1,1,1,1,1,1,1,}
|
|
--local L_ShiftDataList = {0,6,12,21,33,38,43,46,}
|
|
--local L_AndDataList = {31,31,255,2047,15,15,3,15,}
|
|
local L_ColumnShiftAndList = {1,0,31,1,6,31,1,12,255,1,21,2047,1,33,15,1,38,15,1,43,3,1,46,15,}
|
|
local L_ColNum = 8;
|
|
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 = 21
|
|
}
|
|
|
|
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
|