1 QuestHelper_File
["collect_object.lua"] = "Development Version"
2 QuestHelper_Loadtime
["collect_object.lua"] = GetTime()
4 local debug_output
= false
5 if QuestHelper_File
["collect_object.lua"] == "Development Version" then debug_output
= true end
14 mine
= UNIT_SKINNABLE_ROCK
,
15 herb
= UNIT_SKINNABLE_HERB
,
16 eng
= UNIT_SKINNABLE_BOLTS
,
17 skin
= UNIT_SKINNABLE_LEATHER
,
20 local function Tooltipy(self
)
21 -- objects are a bitch since they have no unique ID or any standard way to detect them (that I know of).
22 -- So we kind of guess at it.
23 if self
:GetAnchorType() == "ANCHOR_NONE" then
24 if self
:GetItem() or self
:GetUnit() or self
:GetSpell() then return end
29 local lines
= GameTooltip
:NumLines()
31 if lines == 2 then -- see if we're mine or herb
32 for k, v in pairs(minetypes) do
33 if _G["GameTooltipTextLeft2"]:GetText() == v then
37 if not skintype then return end -- we are neither!
38 elseif lines == 0 then -- this isn't much of anything, is it
45 -- the painful process of checking to see if it might be a game object
46 -- first, look for a "requires" line
48 if not (_G
["GameTooltipTextLeft" .. cline
] and _G
["GameTooltipTextLeft" .. cline
]:IsShown()) then return end
51 local gt
= _G
["GameTooltipTextLeft" .. cline
]:GetText()
52 if string.match(gt
, Patterns
.LOCKED_WITH_ITEM
) or string.match(gt
, Patterns
.LOCKED_WITH_SPELL
) or string.match(gt
, Patterns
.LOCKED_WITH_SPELL_KNOWN
) then cline
= cline
+ 1 end
55 if not (_G
["GameTooltipTextLeft" .. cline
] and _G
["GameTooltipTextLeft" .. cline
]:IsShown()) then return end
57 local r
, g
, b
, a
= _G
["GameTooltipTextLeft" .. cline
]:GetTextColor()
58 r
, g
, b
, a
= math
.floor(r
* 255 + 0.5), math
.floor(g
* 255 + 0.5), math
.floor(b
* 255 + 0.5), math
.floor(a
* 255 + 0.5)
59 if not (r
== 255 and g
== 210 and b
== 0 and a
== 255) then return end -- not a quest item, which I guess we care about
62 if not (_G
["GameTooltipTextLeft" .. cline
] and _G
["GameTooltipTextLeft" .. cline
]:IsShown()) then return end
64 local r
, g
, b
, a
= _G
["GameTooltipTextLeft" .. cline
]:GetTextColor()
65 r
, g
, b
, a
= math
.floor(r
* 255 + 0.5), math
.floor(g
* 255 + 0.5), math
.floor(b
* 255 + 0.5), math
.floor(a
* 255 + 0.5)
66 if not (r
== 255 and g
== 255 and b
== 255 and a
== 255) or not _G
["GameTooltipTextLeft" .. cline
]:GetText():match("^ - ") then return end -- not a quest item, which I guess we care about
68 -- alright good enough
71 local name
= _G
["GameTooltipTextLeft1"]:GetText()
73 if string.match(name
, Patterns
.CORPSE_TOOLTIP
) then return end -- no corpses plzkthx
75 if debug_output
then QuestHelper
:TextOut("Parsing " .. name
) end
77 if not QHCO
[name
] then QHCO
[name
] = {} end
78 local qhci
= QHCO
[name
]
81 for k, _ in pairs(minetypes) do
83 qhci[k .. "_yes"] = (qhci[k .. "_yes"] or 0) + 1
85 qhci[k .. "_no"] = (qhci[k .. "_no"] or 0) + 1
89 -- We have no unique identifier, so I'm just going to record every position we see. That said, I wonder if it's a good idea to add a cooldown.
90 -- Obviously, we also have no possible range data, so, welp.
91 Merger
.Add(qhci
, GetLoc(), true)
95 function QH_Collect_Object_Init(QHCData
, API
)
96 if not QHCData
.object
then QHCData
.object
= {} end
99 API
.Registrar_TooltipHook(Tooltipy
)
101 Patterns
= API
.Patterns
102 QuestHelper
: Assert(Patterns
)
104 API
.Patterns_Register("CORPSE_TOOLTIP", "[^%s]+")
105 API
.Patterns_Register("LOCKED_WITH_ITEM", "[^%s]+")
106 API
.Patterns_Register("LOCKED_WITH_SPELL", "[^%s]+")
107 API
.Patterns_Register("LOCKED_WITH_SPELL_KNOWN", "[^%s]+")
109 GetLoc
= API
.Callback_LocationBolusCurrent
110 QuestHelper
: Assert(GetLoc
)
112 Merger
= API
.Utility_Merger
113 QuestHelper
: Assert(Merger
)