Download
(4 Kb)
Download
Updated: 11/06/14 04:13 PM
Compatibility:
Update 7 (1.7.0)
Updated:11/06/14 04:13 PM
Created:11/03/14 11:00 PM
Monthly downloads:26
Total downloads:16,795
Favorites:4
MD5:
LibItemInfo  Popular! (More than 5000 hits)
Version: 1.0_R7
by: circonian [More]
What does it do?
This is a library of functions that I made for use with my JunkIt addon. It is used to aid in the gathering of item information by passing in a (bagId, slotId) or a (Link).

There are several functions designed to gather research, crafting, & trait information. Some are used to figure out what type of item you have: Is it a glyph, one-handed or two-handed weapon, jewelry, ect.. Some mimic built in functions, but were written so I did not need to constantly write code everywhere to first check & see if I had a (bagId, slotId) or a link. That and when I wrote it (and JunkIt) we did not have all of the GetItemLink API that is available today.

You will find a list of available functions below. For more detailed information about each function, their return values, & instructions on using it see the LibItemInfo page on my portal: LibItemInfo Portal Page

Lua Code:
  1. ---------------------------------------------------------
  2. --  General Functions  --
  3. ---------------------------------------------------------
  4. function lii:GetItemLink(_BagIdOrLink, _iSlotId)
  5. function lii:GetFormattedItemLink(_BagIdOrLink, _iSlotId)
  6. function lii:GetItemToolTipName(_BagIdOrLink, _iSlotId)
  7. function lii:GetItemInfo(_BagIdOrLink, _iSlotId)
  8.  
  9. ---------------------------------------------------------
  10. --  Item SubType (ArmorType/WeaponType) Info  --
  11. ---------------------------------------------------------
  12. function lii:GetSubType(_BagIdOrLink, _iSlotId)
  13.  
  14. ---------------------------------------------------------
  15. --  ItemType Group Properties  --
  16. ---------------------------------------------------------
  17. function lii:IsJewelry(_BagIdOrLink, _iSlotId)
  18. function lii:IsWeaponOneHanded(_BagIdOrLink, _iSlotId)
  19. function lii:IsWeaponTwoHanded(_BagIdOrLink, _iSlotId)
  20. function lii:IsCrafingMaterial(_BagIdOrLink, _iSlotId)
  21. function lii:IsGlyph(_BagIdOrLink, _iSlotId)
  22.  
  23. ---------------------------------------------------------
  24. --  Crafting Info Functions --
  25. ---------------------------------------------------------
  26. function lii:GetCraftingSkillTypeLabelName(_iCraftingSkillType)
  27. function lii:GetResearchableCraftingSkillType(_BagIdOrLink, _iSlotId)
  28.  
  29. ---------------------------------------------------------
  30. --  Research Specific Functions --
  31. ---------------------------------------------------------
  32. function lii:GetResearchInfo(_BagIdOrLink, _iSlotId)
  33. function lii:IsResearchableItem(_BagIdOrLink, _iSlotId)
  34. function lii:NeedForResearch(_BagIdOrLink, _iSlotId)
  35. function lii:GetResearchLineIndex(_BagIdOrLink, _iSlotId)
  36. function lii:GetTraitIndex(_BagIdOrLink, _iSlotId)
  37. function lii:HasKnownTrait(_BagIdOrLink, _iSlotId)
  38. function lii:HasUnKnownTrait(_BagIdOrLink, _iSlotId)
  39. function lii:HasResearchableTrait(_BagIdOrLink, _iSlotId)
  40. function lii:IsItemTraitBeingResearched(_BagIdOrLink, _iSlotId)
  41.  
  42. ---------------------------------------------------------
  43. --  Recipe Functions  --
  44. ---------------------------------------------------------
  45. function lii:GetRecipeInfo(_BagIdOrLink, _iSlotId)
Version 1.0_R7 -- Bug Fix

lii:IsResearchableItemType(_BagIdOrLink, _iSlotId): Fixed a bug in IsResearchableItemType where it was counting WEAPONTYPE_PROP as a researchable item. Which was causing an error of attempting to access a nil value in GetResearchableCraftingSkillType(..)
Optional Files (0)


Archived Files (1)
File Name
Version
Size
Uploader
Date
1.0_R6
6kB
circonian
11/03/14 11:00 PM


Post A Reply Comment Options
Unread 06/17/15, 12:10 AM  
ahmetertem
AddOn Author - Click to view AddOns

Forum posts: 7
File comments: 7
Uploads: 1
Re: Re: Used

Thanks for detailed reply. You're right all of it but I'm not telling it'a a bug or something It's an item library and I thought it'll be useful. Take my previous message as a suggestion.

Thanks
Report comment to moderator  
Reply With Quote
Unread 06/15/15, 02:29 PM  
circonian
AddOn Author - Click to view AddOns

Forum posts: 613
File comments: 804
Uploads: 27
Re: Used

Originally Posted by ahmetertem
BTW; iCraftingSkillType in GetResearchInfo is not workin' at glyphs.
That is because the function is only designed for research items (things that can be researched) like armor/weapons. Its not supposed to work for glyphs, food, drinks, exc...

I figured most addons either focus on researchable items or provisioning or enchanting, so by not trying to do it all in that function it cuts down on the amount of unecessary code that needs to be run. Why check for a enchanting/alchemy craft type if its not a researchable item, which is what this function is designed for.

Another reason I only handled armor/weapon craftingSkillType returns is because determining an items craftingSkillType for an enchanting or alchemy item is very simple and takes little code. I did not feel that adding this to the library would save anyone much work:
If its an enchanting item there is a built in function to determine if an item is an enchanting rune:
Lua Code:
  1. IsItemLinkEnchantingRune(string itemLink)
But there is not one to determine if an item is a glyph, which is why I added an IsGlyph(..) function.
So addons focusing on Enchanting only need to make two checks,
Lua Code:
  1. if IsItemLinkEnchantingRune(..) or LII:IsGlyph(..) then

If the item is an alchemy item all you have to do is check
Lua Code:
  1. if itemType == ITEMTYPE_POTION

doing that for users in a library seemed like overkill to me. It would take as much code to call the library function as it would to just check it yourself.

...armor & weapons are not that simple which is why I added functions to the library to determine their crafting type for you.

Originally Posted by ahmetertem
I saw there is a function for Glyph called isGlyph but I think this library need a function for checking an item's crafting profession. Foods, drinks, etc everything.
Ok, now having said all of that above....If your addon does multiple things and needs to determine what craftingSkillType an item belongs to whether it is researchable or not (which I just didn't think of that before)....I could add something like that, but before I do let me make sure I'm doing what you want:
Do you mean you want to determine the crafting profession an item is associated with? In other words items that are NOT "MATERIALS" like the actual food, drink, potion, exc... after its crafted or looted? Like "Cloudy Black Coffee" is a potion so it would return CRAFTING_TYPE_ALCHEMY (even though it may not be craftable, maybe its only purchasable or lootable)?
Something like this (I did not proof read or test this at all)?
Warning: Spoiler


Is that what your wanting?
Report comment to moderator  
Reply With Quote
Unread 06/14/15, 03:05 PM  
ahmetertem
AddOn Author - Click to view AddOns

Forum posts: 7
File comments: 7
Uploads: 1
Used

Thanks for library. Used in Mass Deconstructor

BTW; iCraftingSkillType in GetResearchInfo is not workin' at glyphs. I saw there is a function for Glyph called isGlyph but I think this library need a function for checking an item's crafting profession. Foods, drinks, etc everything.

Sorry about bad English

Regards
Last edited by ahmetertem : 06/15/15 at 01:27 AM.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: