Created: 19 days ago on 05/31/2025, 04:37:19 AM
Description: Id unidentified items in bag
-- UO Sagas: Identify Unidentified Items (Backpack Only, Fallback with Position)
-- Author: Vocom
-- Colors
local LEGENDARY_ORANGE = 43
local IDENTIFIED_GREEN = 61
local ERROR_RED = 22
local SCAN_COLOR = 89
local MAX_ROUNDS = 5
-- Check modules
if not Items or not Items.FindByFilter then
Messages.Overhead("Error: Items module not loaded", ERROR_RED, Player.Serial)
return
end
local serial = Player.Serial
local backpack = Items.FindByLayer(21) -- Layer 21 = backpack
if not backpack then
Messages.Overhead("Backpack not found!", ERROR_RED, serial)
return
end
-- Item in backpack checker (fallback using position if container nil)
local function isBackpackItem(item)
return item.RootContainer == serial and (item.Container == backpack.Serial or item.Container == nil or (item.Position.X ~= 0 or item.Position.Y ~= 0))
end
-- Get list of unidentified items
local function getUnidentifiedItems()
local all = Items.FindByFilter({ name = "Unidentified", hues = {0} }) or {}
local valid = {}
for _, item in ipairs(all) do
if isBackpackItem(item) then
table.insert(valid, item)
end
end
return valid
end
-- Begin
Messages.Overhead("Scanning for unidentified items...", SCAN_COLOR, serial)
local unidentified = getUnidentifiedItems()
if #unidentified == 0 then
Messages.Overhead("No unidentified items", SCAN_COLOR, serial)
return
end
Messages.Overhead("Starting ID: " .. #unidentified .. " items", SCAN_COLOR, serial)
local round = 0
while #unidentified > 0 and round < MAX_ROUNDS do
round = round + 1
Messages.Overhead("Round " .. round .. ": " .. #unidentified .. " items", SCAN_COLOR, serial)
for _, item in ipairs(unidentified) do
if isBackpackItem(item) then
Skills.Use("Item Identification")
if Targeting.WaitForTarget(1000) then
Targeting.Target(item.Serial)
Pause(1000)
local updated = Items.FindBySerial(item.Serial)
if updated and updated.Name and updated.Name ~= "Unidentified" then
Messages.Overhead("Identified: " .. updated.Name, LEGENDARY_ORANGE, serial)
Messages.Overhead("Identified", IDENTIFIED_GREEN, updated.Serial)
else
Messages.Overhead("Still unidentified", ERROR_RED, item.Serial)
end
else
Messages.Overhead("Targeting failed", ERROR_RED, serial)
end
end
end
unidentified = getUnidentifiedItems()
Pause(600)
end
Messages.Overhead("ID Process Complete", SCAN_COLOR, serial)