1 QuestHelper_File
["collect_util.lua"] = "Development Version"
3 function GetMonsterUID(guid
)
4 QuestHelper
: Assert(#guid
== 18, "guid len " .. guid
) -- 64 bits, plus the 0x prefix
5 QuestHelper
: Assert(guid
:sub(1, 2) == "0x", "guid 0x-prefix " .. guid
)
6 QuestHelper
: Assert(guid
:sub(5, 5) == "3" or guid
:sub(5, 5) == "5", "guid 3-prefix " .. guid
) -- It *shouldn't* be a player or a pet by the time we've gotten here. If so, something's gone wrong.
7 return guid
:sub(9, 18) -- here's our actual identifier
10 function GetMonsterType(guid
)
11 QuestHelper
: Assert(#guid
== 18, "guid len " .. guid
) -- 64 bits, plus the 0x prefix
12 QuestHelper
: Assert(guid
:sub(1, 2) == "0x", "guid 0x-prefix " .. guid
)
13 QuestHelper
: Assert(guid
:sub(5, 5) == "3" or guid
:sub(5, 5) == "5", "guid 3-prefix " .. guid
) -- It *shouldn't* be a player or a pet by the time we've gotten here. If so, something's gone wrong.
14 return tonumber(guid
:sub(9, 12), 16) -- here's our actual identifier
17 function GetItemType(link
)
18 return tonumber(string.match(link
,
19 "^|cff%x%x%x%x%x%x|Hitem:(%d+):[%d:-]+|h%[[^%]]*%]|h|r$"
23 function QH_Collect_Util_Init(_
, API
)
24 API
.Utility_GetMonsterUID
= GetMonsterUID
25 API
.Utility_GetMonsterType
= GetMonsterType
26 API
.Utility_GetItemType
= GetItemType