Quantcast
Download
(4 Kb)
Download
Updated: 09/16/14 01:49 PM
Compatibility:
Update 6 (1.6.5)
Updated:09/16/14 01:49 PM
Created:05/24/14 11:45 AM
Monthly downloads:110
Total downloads:3,275
Favorites:6
MD5:
libResearch
Version: 2.0r2
by: Baertram, ingeniousclown, katkat42, Randactyl
libResearch HAS UNDERGONE A MAJOR REVISION IN PREPARATION FOR UPDATE 4.
The old version will not recognize the Nirnhoned trait, but will otherwise continue to function. (It was impossible to reconcile a 9th trait with 9 being the code for an Ornate item.) It will not, however, continue to be supported.

The new version supports the Nirnhoned trait, takes item links instead of bagId and slotIndex as arguments for your trading house pleasure, and features a few revised function names.

Please download version 2.0r2 if you have already gotten v2.0. There was a bug in the first release.

This library basically provides a bunch of simple functions to get research information.

Here is the new API:
lua Code:
  1. -- returns true if the character knows or is in the process of researching the supplied trait; else returns false
  2. -- there are a few items, given to the character at the very beginning of the game, that are traited but unresearchable;
  3. -- these will present bugs when used with this function, but these items are very rare
  4. -- this function REPLACES the old function IsCraftingTraitKnownOrResearching()
  5. function libResearch:WillCharacterKnowTrait(craftingSkillType, researchLineIndex, traitIndex)
  6.  
  7. -- returns three values: int traitKey, bool isResearchable, string reason
  8. -- traitKey will be 0 if item is ornate, intricate, or traitless; else it will be the result of GetTraitKey()
  9. -- if isResearchable, then reason will be nil
  10. -- otherwise, reason will be: "WrongItemType", "Ornate", "Intricate", "Traitless", "AlreadyKnown"
  11. -- this function REPLACES DetailedIsItemResearchable() and IsItemResearchable()
  12. function libResearch:GetItemTraitResearchabilityInfo(itemLink)
  13.  
  14. -- Returns an integer representation of the parameters
  15. -- craftingSkillType * 10000 + researchLineIndex * 100 + traitIndex
  16. function libResearch:GetTraitKey( craftingSkillType, researchLineIndex, traitIndex )
  17.  
  18. -- returns the global enums CRAFTING_TYPE_BLACKSMITHING, CRAFTING_TYPE_CLOTHIER, or CRAFTING_TYPE_WOODWORKING
  19. -- if applicable; else returns -1
  20. function libResearch:GetItemCraftingSkill( itemLink )
  21.  
  22. -- returns a trait index suitable for feeding to the global functions GetSmithingLineTraitInfo() et. al.,
  23. -- or returns the string "Ornate" if the item is ornate,
  24. -- or returns the string "Intricate" if the item is intricate,
  25. -- or returns -1 if no trait exists
  26. function libResearch:GetResearchTraitIndex( itemLink )
  27.  
  28. -- returns an index that corresponds to the weapon or armor type within the given crafting skill
  29. -- or returns -1 if not applicable
  30. function libResearch:GetResearchLineIndex( itemLink )
  31.  
  32. -- returns three values: craftingSkill, researchLineIndex, traitIndex for the given item link
  33. function libResearch:GetItemResearchInfo( itemLink )
  34.  
  35. -- returns true if the craftingSkillType is one of the researchable crafts, false otherwise
  36. function libResearch:IsBigThreeCrafting( craftingSkillType )
  37.  
  38. -- returns the below table
  39. function libResearch:GetResearchMap()
  40.  
  41. -- Returns true if the integer you pass in represents Blacksmithing, Clothier, or Woodworking; false otherwise
  42. function libResearch:IsBigThreeCrafting( craftingSkillType )

Here is the researchMap construct, in case you need it. Note that this can change between patches based on the whims of the game developers...
lua Code:
  1. local researchMap = {
  2.     [CRAFTING_TYPE_BLACKSMITHING] = {
  3.         WEAPON = {
  4.             [WEAPONTYPE_AXE] = 1,
  5.             [WEAPONTYPE_HAMMER] = 2,
  6.             [WEAPONTYPE_SWORD] = 3,
  7.             [WEAPONTYPE_TWO_HANDED_AXE] = 4,
  8.             [WEAPONTYPE_TWO_HANDED_HAMMER] = 5,
  9.             [WEAPONTYPE_TWO_HANDED_SWORD] = 6,
  10.             [WEAPONTYPE_DAGGER] = 7
  11.         },
  12.         ARMOR = {
  13.             [EQUIP_TYPE_CHEST] = 8,
  14.             [EQUIP_TYPE_FEET] = 9,
  15.             [EQUIP_TYPE_HAND] = 10,
  16.             [EQUIP_TYPE_HEAD] = 11,
  17.             [EQUIP_TYPE_LEGS] = 12,
  18.             [EQUIP_TYPE_SHOULDERS] = 13,
  19.             [EQUIP_TYPE_WAIST] = 14
  20.         }
  21.     },
  22.  
  23.     --normal for light, +7 for medium
  24.     [CRAFTING_TYPE_CLOTHIER] = {
  25.         ARMOR =  {
  26.             [EQUIP_TYPE_CHEST] = 1,
  27.             [EQUIP_TYPE_FEET] = 2,
  28.             [EQUIP_TYPE_HAND] = 3,
  29.             [EQUIP_TYPE_HEAD] = 4,
  30.             [EQUIP_TYPE_LEGS] = 5,
  31.             [EQUIP_TYPE_SHOULDERS] = 6,
  32.             [EQUIP_TYPE_WAIST] = 7
  33.         }
  34.     },
  35.  
  36.     [CRAFTING_TYPE_WOODWORKING] = {
  37.         WEAPON = {
  38.             [WEAPONTYPE_BOW] = 1,
  39.             [WEAPONTYPE_FIRE_STAFF] = 2,
  40.             [WEAPONTYPE_FROST_STAFF] = 3,
  41.             [WEAPONTYPE_LIGHTNING_STAFF] = 4,
  42.             [WEAPONTYPE_HEALING_STAFF] = 5
  43.         },
  44.         ARMOR = {
  45.             [EQUIP_TYPE_OFF_HAND] = 6
  46.         }
  47.     },
  48. }
v2.0r2
-Fix an insidious bug

v2.0
-Major overhaul:
-new function names
-use itemLinks instead of bagId and slotIndex
-new return values for some functions
-Updated for API patch 100009.

v1.0r4
-Fixed an error introduced because of a misunderstanding about a new API function.

v1.0r3
-Updated for API patch 100008.

v1.0r2
-Added a new function: "IsBigThreeCrafting()". See documentation.


v1.0r1
-Initial release
Optional Files (0)


Archived Files (6)
File Name
Version
Size
Author
Date
2.0
4kB
ingeniousclown
09/13/14 10:27 PM
1.0r4
3kB
ingeniousclown
08/03/14 03:35 PM
1.0r3
3kB
ingeniousclown
08/02/14 12:41 PM
1.0r3
3kB
ingeniousclown
08/02/14 11:15 AM
1.0r2
3kB
ingeniousclown
05/25/14 08:12 PM
1.0r1
3kB
ingeniousclown
05/24/14 11:45 AM


Post A Reply Comment Options
Unread 08/04/14, 11:16 AM  
Morwo
 
Morwo's Avatar

Forum posts: 44
File comments: 100
Uploads: 0
hi there,
i get lua errors, with LibResearch mentioned in it. they dont stop, even if i turn tis lib off as an addon, anoying because i get tons of po ups. never ending.

Report comment to moderator  
Reply With Quote
Unread 08/03/14, 03:46 PM  
katkat42
AddOn Author - Click to view AddOns

Forum posts: 163
File comments: 165
Uploads: 7
Originally Posted by Sephiroth018
I think you forgot to raise the minor number for registering libResearch in libStub:

In libResearch.lua
Currently:
Lua Code:
  1. local MAJOR, MINOR = "libResearch", 3

Should be:
Lua Code:
  1. local MAJOR, MINOR = "libResearch", 4

That causes your fix (r4) to not be used when r3 has already been registered in libStub
I did. I have fixed and re-uploaded the file.
__________________
"GUIs are tough. Let's go wumpus hunting."
Report comment to moderator  
Reply With Quote
Unread 08/03/14, 03:35 PM  
Sephiroth018
 
Sephiroth018's Avatar
AddOn Author - Click to view AddOns

Forum posts: 20
File comments: 67
Uploads: 3
I think you forgot to raise the minor number for registering libResearch in libStub:

In libResearch.lua
Currently:
Lua Code:
  1. local MAJOR, MINOR = "libResearch", 3

Should be:
Lua Code:
  1. local MAJOR, MINOR = "libResearch", 4

That causes your fix (r4) to not be used when r3 has already been registered in libStub
Last edited by Sephiroth018 : 08/03/14 at 03:36 PM.
Report comment to moderator  
Reply With Quote
Unread 05/25/14, 02:33 AM  
b|m
AddOn Author - Click to view AddOns

Forum posts: 2
File comments: 15
Uploads: 1
Thanks for making your work available in a library.
Last edited by b|m : 05/25/14 at 02:33 AM.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: