LibQuestItem-1.0

There are various ways to tell if a item is a quest item or not. This library will attempt to combine all different ways.

The library will only be able to tell a addon if a item is a quest item if the user have the item equipped, in a bag, on keyring or in bank when visiting.

Implemented so far:
-Scan for quest items in bags, keyring and equipped. Scanning using GetContainerItemQuestInfo() and looking at item type and subtype using GetItemInfo.
-Scan for quest items using the questlog using GetQuestLogSpecialItemInfo().
-Detects if items starts a quest and/or if the user is already on the quest the item belongs to.

API (so far):
GetQuestItems(forceRescan) -returns a table with itemIds and their properties.
IsQuestItem(itemId) -return true if quest item.
IsUsable(itemId) -return true if usable quest item.
StartsQuestId(itemId) -return the questId if item starts a quest.
IsQuestActive(itemId) -return true if user is on quest.

NOTE:
This is my first library so any constructive feedback is very welcome.

You must login to post a comment. Don't have an account? Register to get one!

  • Avatar of Amaedeus Amaedeus Aug 29, 2012 at 03:12 UTC - 0 likes
  • Avatar of Endar0 Endar0 Feb 21, 2011 at 19:04 UTC - 0 likes

    I was looking at using this library for AutoPicker to identify quest items in the loot window. Would it be able to do that?

  • Avatar of Zidomo Zidomo Dec 13, 2010 at 00:21 UTC - 0 likes

    That's the same error from the same library version I posted about 3 months prior below. It was fixed in r18.

  • Avatar of Skylinee Skylinee Nov 28, 2010 at 19:59 UTC - 0 likes

    You maintaining this post cataclysm? If so:

    1x LibQuestItem-1.0-17:139: table index is nil LibQuestItem-1.0-17:194: in function `Scan' LibQuestItem-1.0-17:263: in function <...mKeybound\Libs\LibQuestItem-1.0\LibQuestItem-1.0.lua:258>

    Locals: self = <table> { activeQuestItems = <table> {} callbacks = <table> {} PLAYER_ENTERING_WORLD = <function> @ QuestItemKeybound\Libs\LibQuestItem-1.0\LibQuestItem-1.0.lua:276: StartsQuestId = <function> @ QuestItemKeybound\Libs\LibQuestItem-1.0\LibQuestItem-1.0.lua:225: PLAYER_REGEN_ENABLED = <function> @ QuestItemKeybound\Libs\LibQuestItem-1.0\LibQuestItem-1.0.lua:285: IsQuestActive = <function> @ QuestItemKeybound\Libs\LibQuestItem-1.0\LibQuestItem-1.0.lua:229: UnregisterAllCallbacks = <function> @ Ace3\CallbackHandler-1.0\CallbackHandler-1.0.lua:202: PLAYER_LEAVING_WORLD = <function> @ QuestItemKeybound\Libs\LibQuestItem-1.0\LibQuestItem-1.0.lua:281: PLAYER_REGEN_DISABLED = <function> @ QuestItemKeybound\Libs\LibQuestItem-1.0\LibQuestItem-1.0.lua:289: ITEMS_UPDATED = <function> @ QuestItemKeybound\Libs\LibQuestItem-1.0\LibQuestItem-1.0.lua:271: startsQuestItems = <table> {} GetItemString = <function> @ QuestItemKeybound\Libs\LibQuestItem-1.0\LibQuestItem-1.0.lua:213: Scan = <function> @ QuestItemKeybound\Libs\LibQuestItem-1.0\LibQuestItem-1.0.lua:180: IsUsable = <function> @ QuestItemKeybound\Libs\LibQuestItem-1.0\LibQuestItem-1.0.lua:221: questItems = <table> {} UnregisterCallback = <function> @ Ace3\CallbackHandler-1.0\CallbackHandler-1.0.lua:181: RegisterCallback = <function> @ Ace3\CallbackHandler-1.0\CallbackHandler-1.0.lua:118: usableQuestItems = <table> {} frame = LibQuestItem10Frame {} IsQuestItem = <function> @ QuestItemKeybound\Libs\LibQuestItem-1.0\LibQuestItem-1.0.lua:217: questItemSpells = <table> {} } questItems = <table> { 57755 = true 1357 = true } usableQuestItems = <table> { 1357 = true } startsQuestItems = <table> { } activeQuestItems = <table> { } questItemSpells = <table> { } ScanInventory = <function> @ QuestItemKeybound\Libs\LibQuestItem-1.0\LibQuestItem-1.0.lua:149: ScanBags = <function> @ QuestItemKeybound\Libs\LibQuestItem-1.0\LibQuestItem-1.0.lua:125: ScanQuestLog = <function> @ QuestItemKeybound\Libs\LibQuestItem-1.0\LibQuestItem-1.0.lua:159: callbacks = <table> { recurse = 0 events = <table> {} Fire = <function> @ Ace3\CallbackHandler-1.0\CallbackHandler-1.0.lua:87: }

    -

  • Avatar of Zidomo Zidomo Aug 18, 2010 at 06:03 UTC - 0 likes

    Solid...but just experienced the first bug/error with r17.

    LibQuestItem-1.0 r17 (upgraded from r14), QuestItemBar v0.6, USEnglish client/server, WoW 3.3.5a live, Ace3 disembedded, all other libraries (including LibQuestItem) embedded. Sometime when doing quests in Colderra, the following error occurred:

    ["message"] = {
    				"LibQuestItem-1.0-17:139: table index is nil\nLibQuestItem-1.0-17:194: in function `Scan'\nLibQuestItem-1.0-17:263: in function <...stItemBar\\Libs\\LibQuestItem-1.0\\LibQuestItem-1.0.lua:258>\n\nLocals:|r\nself = <table> {\n activeQuestItems = <table> {\n }\n callbacks = <table> {\n }\n PLAYER_ENTERING_WORLD = <function> defined @Interface\\AddOns\\QuestItemBar\\Libs\\LibQuestItem-1.0\\LibQuestItem-1.0.lua:276\n StartsQuestId = <function> defined @Interface\\AddOns\\QuestItemBar\\Libs\\LibQuestItem-1.0\\LibQuestItem-1.0.lua:225\n PLAYER_REGEN_ENABLED = <function> defined @Interface\\AddOns\\QuestItemBar\\Libs\\LibQuestItem-1.0\\LibQuestItem-1.0.lua:285\n IsQuestActive = <function> defined @Interface\\AddOns\\QuestItemBar\\Libs\\LibQuestItem-1.0\\LibQuestItem-1.0.lua:229\n UnregisterAllCallbacks = <function> defined @Interface\\AddOns\\AddonLoader\\CallbackHandler-1.0\\CallbackHandler-1.0.lua:202\n PLAYER_LEAVING_WORLD = <function> defined @Interface\\AddOns\\QuestItemBar\\Libs\\LibQuestItem-1.0\\LibQuestItem-1.0", -- [1]
    				".lua:281\n PLAYER_REGEN_DISABLED = <function> defined @Interface\\AddOns\\QuestItemBar\\Libs\\LibQuestItem-1.0\\LibQuestItem-1.0.lua:289\n ITEMS_UPDATED = <function> defined @Interface\\AddOns\\QuestItemBar\\Libs\\LibQuestItem-1.0\\LibQuestItem-1.0.lua:271\n startsQuestItems = <table> {\n }\n GetItemString = <function> defined @Interface\\AddOns\\QuestItemBar\\Libs\\LibQuestItem-1.0\\LibQuestItem-1.0.lua:213\n Scan = <function> defined @Interface\\AddOns\\QuestItemBar\\Libs\\LibQuestItem-1.0\\LibQuestItem-1.0.lua:180\n IsUsable = <function> defined @Interface\\AddOns\\QuestItemBar\\Libs\\LibQuestItem-1.0\\LibQuestItem-1.0.lua:221\n questItems = <table> {\n }\n UnregisterCallback = <function> defined @Interface\\AddOns\\AddonLoader\\CallbackHandler-1.0\\CallbackHandler-1.0.lua:181\n RegisterCallback = <function> defined @Interface\\AddOns\\AddonLoader\\CallbackHandler-1.0\\CallbackHandler-1.0.lua:118\n usableQuestItems = <table> {\n }\n frame = LibQuestItem10Frame {\n }\n IsQuestItem = <function> defined @Interface", -- [2]
    				"\\AddOns\\QuestItemBar\\Libs\\LibQuestItem-1.0\\LibQuestItem-1.0.lua:217\n questItemSpells = <table> {\n }\n}\nquestItems = <table> {\n 35648 = true\n}\nusableQuestItems = <table> {\n 35648 = true\n}\nstartsQuestItems = <table> {\n}\nactiveQuestItems = <table> {\n}\nquestItemSpells = <table> {\n}\nScanInventory = <function> defined @Interface\\AddOns\\QuestItemBar\\Libs\\LibQuestItem-1.0\\LibQuestItem-1.0.lua:149\nScanBags = <function> defined @Interface\\AddOns\\QuestItemBar\\Libs\\LibQuestItem-1.0\\LibQuestItem-1.0.lua:125\nScanQuestLog = <function> defined @Interface\\AddOns\\QuestItemBar\\Libs\\LibQuestItem-1.0\\LibQuestItem-1.0.lua:159\ncallbacks = <table> {\n recurse = 0\n events = <table> {\n }\n Fire = <function> defined @Interface\\AddOns\\AddonLoader\\CallbackHandler-1.0\\CallbackHandler-1.0.lua:87\n}\n\n  ---", -- [3]
    			},
    			["type"] = "error",
    			["session"] = 908,
    			["counter"] = 7,
    		}, -- [254]
    

    There was a span of about 10 minutes between when the error happened (and repeated 7 times) and when I noticed the BugSack LDB display, so can't be certain what triggered the error.

    May have occurred when picking up quest item drops off mobs for a certain quest...you get up to 5 copies of the same item (shows them stacked in QuestItemBar) to be "used on" other items. Or it came from a quest item that could "summon" a friendly NPC when used (its only usage). Will link the quests later if it will help debug.

    As to CPU usage, in addition to r45 of QuestItemBar using 0 CPU/second when idle, the following similar mod also uses 0 on idle: QuestClicks.

    Thanks very much for replies and hope you get this working perfectly soon :D.

    Last edited Aug 18, 2010 by Zidomo
  • Avatar of Nickenyfiken Nickenyfiken Aug 16, 2010 at 23:27 UTC - 0 likes

    The lib should be pretty solid now. It spikes a bit when scanning for items but it's not that bad i think. It should never ever make a scan during combat. It is listening to the BAG_UPDATE event which fires if you loot during combat, but it will only set a var to true to indicate a update is needed. Then on PLAYER_REGEN_ENABLED the OnUpdate frame is shown and will initiate a update if needed, then it will be hidden again.

    Parties should not be a problem, BAG_UPDATE is only firing for the player itself as far as i know.

    Revision number is fixed.

    Mmm yeah I have to dissect QuestItemBar as it seems to be using CPU for me unknown reasons. Though it should not do anything except when the lib fires its its item update callback and some cooldown updates on the buttons when a ACTIONBAR_UPDATE_COOLDOWN fires.

  • Avatar of Zidomo Zidomo Aug 12, 2010 at 21:09 UTC - 0 likes

    (Removes all bridges from surrounding area) :D

    Finally, with r14 this library uses 0 CPU when idle. Nice work. Had to switch to testing with the following mods to see what CPU was used on looting, as OptionHouse closes when you loot: AddonProfiler & AddonManager (both more inconvenient to see ongoing CPU, though).

    It does spike a bit when you loot, but nomoreso than other mods that update on bag content changes. And appears to spike to substantially lower heights than QuestItemBar r45 does itself + through Ace3 when you loot something.

    The big thing will be to see if it actually causes lag when looting in parties. Which is a potential hazard when doing OnUpdates non-optimally (and I've seen testing another mod called Broker Garbage before it was recoded).

    Looking better so far, though.

    EDIT: one small thing, the library revision number (14 currently) isn't seen in its LUA file as it should be, even though you have a revision line at the top.

    EDIT#2: one bigger thing: tested QuestItemBar v0.6-beta1 with this library embedded (Ace3 still disembedded). For some reason, the mod appears to use a small amount of CPU in combat (0.01 in AddonProfiler when not looting) with a larger than expected spike immediately after the end of combat for 2 ticks/seconds (0.15-0.25 in AddonProfiler and again, not looting). No quest items were on the bar or being used.

    The mod should shut totally off (in effect) during combat, other than letting you click quest items that may be on the bar. That increased use immediately after combat is over for 2 seconds seems odd if nothing in your packs or the bar has changed.

    Last edited Aug 12, 2010 by Zidomo
  • Avatar of Nickenyfiken Nickenyfiken Aug 10, 2010 at 20:44 UTC - 0 likes

    Thanks for being so persistent Zidomo. I actually don't understand why LQI was showing absolute zero CPU when QIB was loaded. But you were right, LQI was bugged because of my stupidity. It wasn't doing any item scans but the OnUpdate was constantly running.

    Please try r14, if it isn't fixed I will jump off a bridge or something :-D

  • Avatar of Zidomo Zidomo Aug 10, 2010 at 19:48 UTC - 0 likes

    No, not with items showing. That's a different circumstance unrelated to what LibQuestItem-1.0 is doing on its own with QuestItemBar. Whether or not your secure action buttons use CPU or not, the issue here is what LibQuestItem-1.0 is doing on its own when no items are shown on the bar.

    QuestItemBar r45 - - with Ace3 disembedded, other libraries embedded (CallbackHandler-1.0, LibAboutPanel, LibGratuity-3.0, LibStub) - - uses 0.0 CPU/second when idle with no items showing as show in this screenshot. QuestItemBar's anchor button is shown immediately below the OptionHouse frame. Ace3 uses the same 0.775 CPU/second median that it does on its own with no mods that use it are loaded; QuestItemBar doesn't go through it.

  • Avatar of Nickenyfiken Nickenyfiken Aug 10, 2010 at 07:17 UTC - 0 likes

    Thanks for the screenshot. I will try with only these three addons loaded ASAP. I really want to fix this. :-)

    Hmm is old revisions of QuestItemBar really using 0 CPU when idle (with items showing)? As far as I can see a SecureActionButton is using about 0.4-0.7 CPU/s. For example Bartender4 is using like 130 CPU/s for me displaying about 60 buttons. Hide half of the buttons and the CPU usage drops with about 50%.

Facts

Date created
Jul 30, 2010
Category
Last update
Sep 11, 2013
Development stage
Release
Language
  • enUS
License
MIT License
Curse link
LibQuestItem-1.0
Downloads
2,505
Recent files
  • R: 1.0.2.4 for 5.4.0 Sep 11, 2013
  • A: r34 for 5.4.0 Sep 11, 2013
  • R: 1.0.2.2 for 5.2.0 Mar 09, 2013
  • A: r32 for 5.2.0 Mar 09, 2013
  • R: 1.0.2.1 for 5.1.0 Dec 02, 2012

Authors

Relationships

Embedded library
CallbackHandler-1.0
LibStub