local LimitsFile= "Limits.json";
local Limits = nil;
local LimitsIndexed = nil;
function RefreshLimits()
if Limits == nil then
Limits= JsonSaveLoad.Load(LimitsFile);
for i=1,#Limits do
local item = Limits[i];
local id = item.Fingerprint.id;
if LimitsIndexed[id] == nil then
LimitsIndexed[id] = {};
end
LimitsIndexed[id][#LimitsIndexed[id] + 1] = item;
end
end
end
function GetLimitForItem(fingerprint)
local limits = LimitsIndexed[fingerprint.id];
if limits then
for i=1,#limits do
local limit = limits[i];
local limitFingerprint = limit.Fingerprint;
if limitFingerprint.id == fingerprint.id and limitFingerprint.dmg == fingerprint.dmg and limitFingerprint.nbt_hash == fingerprint.nbt_hash then
return limit.Limit;
end
end
end
end
Comments
0 B
|👍
/👎