Updated get-live-data to avoid overwriting existing data when it looks better
Kevin Lyles [01-07-12 - 17:17]
Updated get-live-data to avoid overwriting existing data when it looks better
diff --git a/get-live-data.lua b/get-live-data.lua
index b3322df..12996ef 100644
--- a/get-live-data.lua
+++ b/get-live-data.lua
@@ -1,4 +1,50 @@
-loadfile(...)()
+local func = loadfile(...)
+
+loadfile("load-all-item-info.lua")()
+
+func()
+
+func = loadfile("scanned/ItemsThatNeedManualIntervention.lua")
+if func then
+ func()
+end
+
+if not ItemsThatNeedManualIntervention then
+ ItemsThatNeedManualIntervention = {}
+end
+
+IS_invalid_items = IS_status.items.invalid
+
+for k, v in pairs(item_info) do
+ if IS_item_info[k] then
+ if #(v) > #(IS_item_info[k]) then
+ ItemsThatNeedManualIntervention[k] = IS_item_info[k]
+ IS_item_info[k] = v
+ else
+ ItemsThatNeedManualIntervention[k] = nil
+ end
+ elseif type(k) ~= "string" then
+ ItemsThatNeedManualIntervention[k] = string.format("Unknown item link format: %q", tostring(k))
+ else
+ local start, _, itemNum = k:find("^item:(%d+):0:0:0:0:0:0:0:")
+ if start then
+ itemNum = tonumber(itemNum)
+ if type(IS_invalid_items[itemNum]) == "number" then
+ if IS_invalid_items[itemNum] > 10 then
+ v = nil
+ ItemsThatNeedManualIntervention[k] = nil
+ end
+ elseif IS_invalid_items[itemNum] == true then
+ ItemsThatNeedManualIntervention[k] = "Exists in old data, but marked definitely invalid"
+ elseif IS_invalid_items[itemNum] ~= false and IS_invalid_items[itemNum] ~= nil then
+ ItemsThatNeedManualIntervention[k] = string.format("Unhandled invalid item type: %s (tostring = %q)", type(IS_invalid_items[itemNum]), tostring(IS_invalid_items[itemNum]))
+ end
+ IS_item_info[k] = v
+ else
+ ItemsThatNeedManualIntervention[k] = string.format("Unknown item link format: %q", k)
+ end
+ end
+end
loadfile("sort.lua")()
@@ -10,11 +56,10 @@ for i = 1, 99 do
tbl["^item:" .. i .. "%d%d%d:0:0:0:0:0:0:0:"] = padded .. "000_" .. padded .. "999"
end
-IS_invalid_items = IS_status.items.invalid
-
local savedVars = {
["IS_item_info"] = {"scanned/item-info-%s.lua", tbl},
["IS_invalid_items"] = "scanned/invalid-items.lua",
+ ["ItemsThatNeedManualIntervention"] = "scanned/ItemsThatNeedManualIntervention.lua",
}
for varName, fileName in pairs(savedVars) do