152 lines
4.6 KiB
Lua
152 lines
4.6 KiB
Lua
--文件是自动生成,请勿手动修改.来自数据文件:world_bonfire
|
|
local L_CompressMaxColumn = 2
|
|
local L_CompressData = {
|
|
1730385282625,8463425606145,
|
|
--1,50,0,1_50,50,8000001,3,70_176;67_180;64_181;58_179;68_173;57_170;55_173;54_176;71_179,,
|
|
1730385323586,8463425606145,
|
|
--2,50,10,1_50,50,8000001,3,70_176;67_180;64_181;58_179;68_173;57_170;55_173;54_176;71_179,,
|
|
1730385364547,8463425606145,
|
|
--3,50,20,1_50,50,8000001,3,70_176;67_180;64_181;58_179;68_173;57_170;55_173;54_176;71_179,,
|
|
1730385405508,8463425606145,
|
|
--4,50,30,1_50,50,8000001,3,70_176;67_180;64_181;58_179;68_173;57_170;55_173;54_176;71_179,,
|
|
1730385446469,8463425606145,
|
|
--5,50,40,1_50,50,8000001,3,70_176;67_180;64_181;58_179;68_173;57_170;55_173;54_176;71_179,,
|
|
1730385487430,8463425606145,
|
|
--6,50,50,1_50,50,8000001,3,70_176;67_180;64_181;58_179;68_173;57_170;55_173;54_176;71_179,,
|
|
1730385528391,8463425606145,
|
|
--7,50,60,1_50,50,8000001,3,70_176;67_180;64_181;58_179;68_173;57_170;55_173;54_176;71_179,,
|
|
1730385569352,8463425606145,
|
|
--8,50,70,1_50,50,8000001,3,70_176;67_180;64_181;58_179;68_173;57_170;55_173;54_176;71_179,,
|
|
1730385610313,8463425606145,
|
|
--9,50,80,1_50,50,8000001,3,70_176;67_180;64_181;58_179;68_173;57_170;55_173;54_176;71_179,,
|
|
1730385690634,8463425606145,
|
|
--10,0,100,1_50,50,8000001,3,70_176;67_180;64_181;58_179;68_173;57_170;55_173;54_176;71_179,,
|
|
}
|
|
local L_MainKeyDic = {
|
|
[1]=1,[2]=2,[3]=3,[4]=4,[5]=5,[6]=6,[7]=7,[8]=8,[9]=9,[10]=10,}
|
|
local L_NamesByNum = {
|
|
Id = 1,
|
|
LevelExp = 2,
|
|
ExpAddition = 3,
|
|
WoodExp = 5,
|
|
AddGather = 6,
|
|
AddGatherNum = 7,
|
|
}
|
|
local L_NamesByString = {
|
|
WoodCost = 4,
|
|
GatherLocation = 8,
|
|
}
|
|
local L_ColNameIndexs = {
|
|
Id = 0,
|
|
LevelExp = 1,
|
|
ExpAddition = 2,
|
|
WoodCost = 3,
|
|
WoodExp = 4,
|
|
AddGather = 5,
|
|
AddGatherNum = 6,
|
|
GatherLocation = 7,
|
|
}
|
|
--local L_ColumnUseBitCount = {5,7,8,15,7,24,3,17,}
|
|
--local L_ColumnList = {1,1,1,1,1,2,2,2,}
|
|
--local L_ShiftDataList = {0,5,12,20,35,0,24,27,}
|
|
--local L_AndDataList = {15,63,127,16383,63,8388607,3,65535,}
|
|
local L_ColumnShiftAndList = {1,0,15,1,5,63,1,12,127,1,20,16383,1,35,63,2,0,8388607,2,24,3,2,27,65535,}
|
|
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 - 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 = 10
|
|
}
|
|
|
|
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
|