1
0
Bifurcation 0
Ce dépôt a été archivé le 2020-03-15. Vous pouvez voir ses fichiers ou le cloner, mais pas ouvrir de ticket ou de demandes d'ajout, ni soumettre de changements.
questhelperredux/QHCollector/collect_item.lua
Nathanial.C.Jones 5287a36af4 Working on separating the collector subsystem out from the rest of the system. Initially it will be a required dependency.
Please note that though these files have been added, nothing has changed yet in the main system to support this separation... i.e. no files have been removed and no files have been changed in the main system for this.
2012-01-01 20:46:45 +00:00

63 lignes
1,8 Kio
Lua

local GetTime = QuestHelperCollector_GetTime
QuestHelper_File["collect_item.lua"] = "4.0.1.$svnversion$"
QuestHelper_Loadtime["collect_item.lua"] = GetTime()
local debug_output = false
if QuestHelper_File["collect_item.lua"] == "Development Version" then debug_output = true end
local GetItemType
local QHCI
-- We could probably snag data from other locations as well, but at the moment, we're not.
local function Tooltipy(self)
if not self.GetItem then return end -- ughhhh, inventoryonpar
local _, ilink = self:GetItem()
if not ilink then return end
local id = GetItemType(ilink)
if not QHCI[id] then QHCI[id] = {} end
local item = QHCI[id]
local name, _, quality, ilvl, min, itype, isubtype, _, equiploc, _ = GetItemInfo(id)
if name then
item.name = name
item.quality = quality
item.ilevel = ilvl
item.minlevel = min
item.type = itype -- Was originally type/subtype, but we can do that during processing. Might want to eventually have it separated, so we separate here.
item.subtype = isubtype
local loc = string.match(equiploc, "INVTYPE_(.*)")
if loc then
item.equiplocation = loc
else
item.equiplocation = nil
end
local lines = GameTooltip:NumLines()
local openable = false
for i = 2, lines do
if _G["GameTooltipTextLeft" .. tostring(i)]:GetText() == ITEM_OPENABLE then
openable = true
end
end
openable = "open_" .. (openable and "yes" or "no")
item[openable] = (item[openable] or 0) + 1 -- so we're going to add a lot to this if the user keeps whipping their mouse over it. I'll live.
end
end
function QH_Collect_Item_Init(QHCData, API)
if not QHCData.item then QHCData.item = {} end
QHCI = QHCData.item
API.Registrar_TooltipHook(Tooltipy)
GetItemType = API.Utility_GetItemType
QuestHelper: Assert(GetItemType)
end