Download
(8 Kb)
Download
Updated: 05/22/23 09:03 AM
Compatibility:
Necrom (9.0.0)
Updated:05/22/23 09:03 AM
Created:05/10/20 05:35 PM
Monthly downloads:7,775
Total downloads:350,702
Favorites:176
MD5:
LibAlchemy  Popular! (More than 5000 hits)
Version: 1.5
by: Hyperioxes, Sharlikran
A library containing various functions useful for anything alchemy related.

Optional Dependencies:
-LibPrice

Example functions:
Lua Code:
  1. --input table of effect names for example {"RestoreHealth","RestoreMagicka","RestoreStamina"}
  2. --you can also add prolonged effect - an effect that will last longer because it appears in the combination 3 times, instead of 2
  3. --prolonged effect always has to have key = 4
  4. --for example, if you want a combination with only 2 effects and one of them to be prolonged you input {"RestoreHealth","RestoreMagicka",[4] = "RestoreHealth"}
  5. --outputs IDs (1st number in itemLinks, not actual itemLinks) for reagents that will create desired combination for cheapest price
  6. function LibAlchemy:getBestCombination(tableOfEffects)
  7.     local effect1,effect2,effect3,prolongedEffect, Combinations
  8.     if tableOfEffects[1] then
  9.         effect1 = tableOfEffects[1]
  10.         length = 1
  11.     end
  12.     if tableOfEffects[2] then
  13.         effect2 = tableOfEffects[2]
  14.         length = 2
  15.     end
  16.     if tableOfEffects[3] then
  17.         effect3 = tableOfEffects[3]
  18.         length = 3
  19.     end
  20.     if tableOfEffects[4] then
  21.         prolongedEffect = tableOfEffects[4]
  22.     end
  23.     if length == 3 then
  24.         Combinations = LibAlchemy:ThreeEffects(effect1,effect2,effect3)
  25.         if Combinations[1] == nil then
  26.             Combinations = LibAlchemy:ThreeEffectsAlt(effect1,effect2,effect3)
  27.         end
  28.         Combinations = LibAlchemy:sortOutWrongCombinations3(Combinations,{effect1,effect2,effect3})
  29.         if prolongedEffect then
  30.             Combinations = LibAlchemy:sortOutAdditional(Combinations,prolongedEffect)
  31.         end
  32.         BestCombination = LibAlchemy:getCheapestCombination(Combinations)
  33.         return BestCombination
  34.     elseif length == 2 then
  35.         Combinations = LibAlchemy:TwoEffects(effect1,effect2)
  36.         Combinations = LibAlchemy:sortOutWrongCombinations3(Combinations,{effect1,effect2})
  37.         if effectAdditional then
  38.             Combinations = LibAlchemy:sortOutAdditional(Combinations,effectAdditional)
  39.         end
  40.         return LibAlchemy:getCheapestCombination(Combinations)
  41.     elseif length == 1 then
  42.         Combinations = LibAlchemy:OneEffect(effect1)
  43.         Combinations = LibAlchemy:sortOutWrongCombinations2(Combinations,effect1)
  44.         if effectAdditional then
  45.             Combinations = LibAlchemy:OneEffectAlt(effect1)
  46.             Combinations = LibAlchemy:sortOutWrongCombinations3(Combinations,{effect1})
  47.             Combinations = LibAlchemy:sortOutAdditional(Combinations,effectAdditional)
  48.         end
  49.         if not Combinations[1] then
  50.             Combinations = LibAlchemy:OneEffect(effect1)
  51.             local Combinations2 = {}
  52.             for key,value in pairs(Combinations) do
  53.                 local negativeEffect = LibAlchemy:checkIfAdditional2Effect(value,effect1)
  54.                 for key2,value2 in pairs(LibAlchemy.effects[LibAlchemy.opposites[negativeEffect]]) do
  55.                     if LibAlchemy:checkIfAdditionalCorrect({value[1],value[2],value2},effect1) and LibAlchemy:checkIfAdditional3({value[1],value[2],value2},{effect1}) then
  56.                         Combinations2[#Combinations2 + 1] = {value[1],value[2],value2}
  57.                     end
  58.                 end
  59.  
  60.             end
  61.             Combinations = Combinations2
  62.         end
  63.  
  64.         return LibAlchemy:getCheapestCombination(Combinations)
  65.     end
  66. end
  67.  
  68.  
  69. --input table of reagents' IDs for example {30148,30149,30150} and itemLink
  70. --outputs crafting cost
  71. function LibAlchemy:getCraftingCost(reagentsTable,itemLink)
  72.     local x,mainID,solvent,CP
  73.     if GetItemLinkItemType(itemLink) == ITEMTYPE_MASTER_WRIT then
  74.         x = LibAlchemy:ATconvertItemLink(itemLink)
  75.         mainID = x.solvent
  76.         solvent = 50
  77.         CP = 258
  78.     else
  79.         mainID = select(4,ZO_LinkHandler_ParseLink(itemLink))
  80.         CP = tonumber(select(5,ZO_LinkHandler_ParseLink(itemLink))-select(6,ZO_LinkHandler_ParseLink(itemLink)))
  81.         solvent = tonumber(select(6,ZO_LinkHandler_ParseLink(itemLink))-select(7,ZO_LinkHandler_ParseLink(itemLink)))
  82.     end
  83.     local result = 0
  84.     local type = 2
  85.     for key1,value1 in pairs(reagentsTable) do
  86.         result = result + LibAlchemy.reagents[value1][2]
  87.     end
  88.    
  89.     if solvent == 50 then
  90.         result = result + LibAlchemy.solvents["CP"][CP][type]
  91.     else
  92.         result = result + LibAlchemy.solvents[solvent][type]
  93.     end
  94.     if mainID == 239 then
  95.         return result
  96.     elseif mainID == 199 then
  97.         return result*4
  98.     elseif GetItemLinkItemType(itemLink) == 7 then
  99.         return result/4
  100.         else
  101.         return result/16
  102.     end
  103.  
  104. end
  105.  
  106.  
  107.  
  108.  
  109.  
  110. --input itemLink
  111. --outputs cheapest combination of reagents that will craft potion/poison required to fulfill master writ
  112. function LibAlchemy:getBestCombinationMasterWrit(itemLink)
  113.     local x = LibAlchemy:ATconvertItemLink(itemLink)
  114.     if x.solvent == 199 or x.solvent == 239 then
  115.         local effect1 = LibAlchemy.effectsByWritID[x.effect1]
  116.         local effect2 = LibAlchemy.effectsByWritID[x.effect2]
  117.         local effect3 = LibAlchemy.effectsByWritID[x.effect3]
  118.         if table.effect3 == 0 then
  119.             local Combinations = LibAlchemy:TwoEffects(effect1,effect2)
  120.             Combinations = LibAlchemy:sortOutWrongCombinations3(Combinations,{effect1,effect2})
  121.             return LibAlchemy:getCheapestCombination(Combinations)
  122.         else
  123.             local Combinations = LibAlchemy:ThreeEffects(effect1,effect2,effect3)
  124.             if Combinations[1] == nil then
  125.                 Combinations = LibAlchemy:ThreeEffectsAlt(effect1,effect2,effect3)
  126.             end
  127.             return LibAlchemy:getCheapestCombination(Combinations)
  128.         end
  129.     end
  130.     return nil
  131. end

Example of databases:
Lua Code:
  1. LibAlchemy.effects = {
  2.  
  3.     ["RestoreHealth"] = {
  4.         [1] = 30148, --Blue Entoloma
  5.         [2] = 30160, --Bugloss
  6.         [3] = 77585, --Butterfly Wing
  7.         [4] = 30164, --Columbine
  8.         [5] = 30163, --Mountain Flower
  9.         [6] = 30166, --Water Hyacinth
  10.         [7] = 30155, --Luminous Russula
  11.         [8] = 150672, --Crimson Nirnroot
  12.        
  13.     },
  14.     ["LingeringHealth"] = {
  15.         [1] = 77585, --Butterfly Wing
  16.         [2] = 150731, --Dragon Blood
  17.         [3] = 139019, --Powdered Mother of Pearl
  18.         [4] = 77584, --Spider Egg
  19.         [5] = 77589, --Scrib Jelly
  20.     },
  21.  
  22.     ["RestoreMagicka"] = {
  23.         [1] = 30160, --Bugloss
  24.         [2] = 30164, --Columbine
  25.         [3] = 30161, --Corn Flower
  26.         [4] = 30158, --Lady's Smock
  27.         [5] = 150671, --Dragon Rheum
  28.         [6] = 150670, --Vile Coagulant
  29.        
  30.        
  31.     },
  32.     ["RestoreStamina"] = {
  33.         [1] = 30163, --Mountain Flower
  34.         [2] = 30164, --Columbine
  35.         [3] = 30162, --Dragonthorn
  36.         [4] = 30157, --Blessed Thistle
  37.         [5] = 150731, --Dragon Blood
  38.         [6] = 150669, --Chaurus Egg
  39.    
  40.     },
  41.  
  42.     ["Unstoppable"] = {
  43.         [1] = 30164, --Columbine
  44.         [2] = 30153, --Namira's Rot
  45.         [3] = 30159, --Wormwood
  46.     },
  47.     ["Invisible"] = {
  48.         [1] = 30148, --Blue Entoloma
  49.         [2] = 30153, --Namira's Rot
  50.         [3] = 150789, --Dragon Bile
  51.         [4] = 30165, --Nirnroot
  52.         [5] = 77584, --Spider Egg
  53.     },
  54. -- and more
1.5

- Update for Necrom
- Optimized some of the functions

1.4.
- Added function LibAlchemy:GenerateItemLinkFromID
- Optimized some of the functions

1.3.
-Added functions:
>LibAlchemy:GetEffectsFromItemLink(itemLink)
>LibAlchemy:GetRealNames()
and dictionary:
>LibAlchemy.effectsByWritIDShort
used in AlchemyTooltips to generate custom potion names

1.2a.
-Fixed a bug with potions/poisons made with Grease or Natural Water throwing errors if you had no price data for those solvents

1.2.
-Fixed a bug with library not finding combinations for potions with 1 effect that have to be done with 3 reagents

1.1.
-Implemented some (but not yet all) changes suggested by Dolgubon, there is no hardcoded database anymore
Archived Files (6)
File Name
Version
Size
Uploader
Date
1.4
7kB
Hyperioxes
12/05/20 01:57 AM
1.3
8kB
Hyperioxes
11/27/20 07:02 AM
1.2a
7kB
Hyperioxes
09/23/20 11:34 AM
1.2
7kB
Hyperioxes
05/28/20 12:29 PM
1.1
7kB
Hyperioxes
05/27/20 04:13 PM
1.0
10kB
05/10/20 05:35 PM


Post A Reply Comment Options
Unread 12/04/20, 05:15 PM  
Hyperioxes
 
Hyperioxes's Avatar
AddOn Author - Click to view AddOns

Forum posts: 6
File comments: 69
Uploads: 11
Originally Posted by DrakeRulo
New Issue with LibAlchemy:getCraftingCost
in Alchemy Tooltips with Master Writs
The issue was related to Alchemy Tooltips addon and should be fixed in its new version (1.12a), can you tell me if the problem persists on new version?
Report comment to moderator  
Reply With Quote
Unread 12/04/20, 04:18 AM  
DrakeRulo

Forum posts: 0
File comments: 24
Uploads: 0
New Issue with LibAlchemy:getCraftingCost
in Alchemy Tooltips with Master Writs
Report comment to moderator  
Reply With Quote
Unread 06/14/20, 12:30 PM  
Hyperioxes
 
Hyperioxes's Avatar
AddOn Author - Click to view AddOns

Forum posts: 6
File comments: 69
Uploads: 11
Originally Posted by SkamzA
bad argument #1 to 'pairs' (table/struct expected, got nil)
stack traceback:
[C]: in function 'pairs'
user:/AddOns/LibAlchemy/LibAlchemy.lua:480: in function 'LibAlchemy:OneEffect'
|caaaaaa<Locals> self = [table:1]{} </Locals>|r
user:/AddOns/LibAlchemy/LibAlchemy.lua:574: in function 'LibAlchemy:ThreeEffects'
|caaaaaa<Locals> self = [table:1], first = "RavageHealth", third = "Breach", firstConnectedIngredients = [table:2]{} </Locals>|r
user:/AddOns/LibAlchemy/LibAlchemy.lua:104: in function 'LibAlchemy:getBestCombination'
|caaaaaa<Locals> self = [table:1], tableOfEffects = [table:3]{1 = "RavageHealth"}, effect1 = "RavageHealth", effect3 = "Breach" </Locals>|r
user:/AddOns/AlchemyTooltips/AlchemyTooltips.lua:228: in function 'checkPotion'
|caaaaaa<Locals> itemLink = "|H0:item:44812:30:3:0:0:0:0:0:...", id = 166664, mainID = 44812, effect1 = "RavageHealth", effect3 = "Breach", calculation = 2 </Locals>|r
user:/AddOns/AlchemyTooltips/AlchemyTooltips.lua:295: in function '(anonymous)'
|caaaaaa<Locals> self = ud </Locals>|r
(tail call): ?
(tail call): ?
user:/AddOns/WritWorthy/WritWorthy.lua:361: in function 'BagItemTooltip'
|caaaaaa<Locals> control = ud, bagId = 1, slotIndex = 1 </Locals>|r
user:/AddOns/TraitBuddy/TraitBuddy.lua:121: in function 'SetBagItem'
|caaaaaa<Locals> control = ud, bagId = 1, slotIndex = 1 </Locals>|r
EsoUI/Ingame/Inventory/InventorySlot.lua:2042: in function '(anonymous)'
|caaaaaa<Locals> inventorySlot = ud, bag = 1, index = 1 </Locals>|r
EsoUI/Ingame/Utility/ZO_SlotUtil.lua:14: in function 'RunHandlers'
|caaaaaa<Locals> handlerTable = [table:4]{}, slot = ud, handlers = [table:5]{}, i = 1 </Locals>|r
EsoUI/Ingame/Inventory/InventorySlot.lua:2403: in function 'ZO_InventorySlot_OnMouseEnter'
|caaaaaa<Locals> inventorySlot = ud, buttonPart = ud, listPart = ud </Locals>|r
ZO_StackSplitSource_MouseEnter:3: in function '(main chunk)'
|caaaaaa<Locals> self = ud </Locals>|r


Any ideas?
The issue was in Alchemy Tooltips and is now fixed
Report comment to moderator  
Reply With Quote
Unread 06/09/20, 04:13 AM  
SkamzA

Forum posts: 0
File comments: 11
Uploads: 0
bad argument #1 to 'pairs' (table/struct expected, got nil)
stack traceback:
[C]: in function 'pairs'
user:/AddOns/LibAlchemy/LibAlchemy.lua:480: in function 'LibAlchemy:OneEffect'
|caaaaaa<Locals> self = [table:1]{} </Locals>|r
user:/AddOns/LibAlchemy/LibAlchemy.lua:574: in function 'LibAlchemy:ThreeEffects'
|caaaaaa<Locals> self = [table:1], first = "RavageHealth", third = "Breach", firstConnectedIngredients = [table:2]{} </Locals>|r
user:/AddOns/LibAlchemy/LibAlchemy.lua:104: in function 'LibAlchemy:getBestCombination'
|caaaaaa<Locals> self = [table:1], tableOfEffects = [table:3]{1 = "RavageHealth"}, effect1 = "RavageHealth", effect3 = "Breach" </Locals>|r
user:/AddOns/AlchemyTooltips/AlchemyTooltips.lua:228: in function 'checkPotion'
|caaaaaa<Locals> itemLink = "|H0:item:44812:30:3:0:0:0:0:0:...", id = 166664, mainID = 44812, effect1 = "RavageHealth", effect3 = "Breach", calculation = 2 </Locals>|r
user:/AddOns/AlchemyTooltips/AlchemyTooltips.lua:295: in function '(anonymous)'
|caaaaaa<Locals> self = ud </Locals>|r
(tail call): ?
(tail call): ?
user:/AddOns/WritWorthy/WritWorthy.lua:361: in function 'BagItemTooltip'
|caaaaaa<Locals> control = ud, bagId = 1, slotIndex = 1 </Locals>|r
user:/AddOns/TraitBuddy/TraitBuddy.lua:121: in function 'SetBagItem'
|caaaaaa<Locals> control = ud, bagId = 1, slotIndex = 1 </Locals>|r
EsoUI/Ingame/Inventory/InventorySlot.lua:2042: in function '(anonymous)'
|caaaaaa<Locals> inventorySlot = ud, bag = 1, index = 1 </Locals>|r
EsoUI/Ingame/Utility/ZO_SlotUtil.lua:14: in function 'RunHandlers'
|caaaaaa<Locals> handlerTable = [table:4]{}, slot = ud, handlers = [table:5]{}, i = 1 </Locals>|r
EsoUI/Ingame/Inventory/InventorySlot.lua:2403: in function 'ZO_InventorySlot_OnMouseEnter'
|caaaaaa<Locals> inventorySlot = ud, buttonPart = ud, listPart = ud </Locals>|r
ZO_StackSplitSource_MouseEnter:3: in function '(main chunk)'
|caaaaaa<Locals> self = ud </Locals>|r


Any ideas?
Report comment to moderator  
Reply With Quote
Unread 05/28/20, 12:30 PM  
Hyperioxes
 
Hyperioxes's Avatar
AddOn Author - Click to view AddOns

Forum posts: 6
File comments: 69
Uploads: 11
Originally Posted by sarousse
Got this error when my mouse goes over Brutality-Draining Poison IX :

bad argument #1 to 'pairs' (table/struct expected, got nil)
stack traceback:
[C]: in function 'pairs'
user:/AddOns/LibAlchemy/LibAlchemy.lua:150: in function 'LibAlchemy:getCraftingCost'
user:/AddOns/AlchemyTooltips/AlchemyTooltips.lua:226: in function 'checkPotion'
user:/AddOns/AlchemyTooltips/AlchemyTooltips.lua:292: in function 'TooltipSetBagItem'
It's fixed now
Report comment to moderator  
Reply With Quote
Unread 05/28/20, 09:26 AM  
Hyperioxes
 
Hyperioxes's Avatar
AddOn Author - Click to view AddOns

Forum posts: 6
File comments: 69
Uploads: 11
Re: Error with Guild Tabard

Originally Posted by hagermanj
When I mouse over my Guild Tabards, I receive the following error:
Code:
user:/AddOns/LibAlchemy/LibAlchemy.lua:157: attempt to index a nil value
stack traceback:
user:/AddOns/LibAlchemy/LibAlchemy.lua:157: in function 'LibAlchemy:getCraftingCost'
|caaaaaa<Locals> self = [table:1]{}, reagentsTable = [table:2]{1 = 30163}, itemLink = "|H0:item:55262:4:1:0:0:0:0:0:0...", mainID = 55262, solvent = 1, CP = 3, result = 123.27288307769, type = 2 </Locals>|r
user:/AddOns/AlchemyTooltips/AlchemyTooltips.lua:226: in function 'checkPotion'
|caaaaaa<Locals> itemLink = "|H0:item:55262:4:1:0:0:0:0:0:0...", id = 375495, mainID = 55262, effect1 = "RestoreStamina", calculation = 5, BestCombination = [table:2] </Locals>|r
user:/AddOns/AlchemyTooltips/AlchemyTooltips.lua:292: in function 'orgFunc'
|caaaaaa<Locals> self = ud </Locals>|r
user:/AddOns/HarvensTraitAndStyle/HarvensTraitAndStyle.lua:296: in function 'HarvensTraitAndStyle_SetBagItem'
|caaaaaa<Locals> orgFunc = user:/AddOns/AlchemyTooltips/AlchemyTooltips.lua:290, tooltip = ud, bagId = 2, slotIndex = 145, unhackTraitName = user:/AddOns/HarvensTraitAndStyle/HarvensTraitAndStyle.lua:107 </Locals>|r
(tail call): ?
user:/AddOns/WritWorthy/WritWorthy.lua:361: in function 'TooltipSetBagItem'
|caaaaaa<Locals> control = ud, bagId = 2, slotIndex = 145 </Locals>|r
user:/AddOns/ArkadiusTradeToolsSales/ArkadiusTradeToolsSalesTooltipExtensions.lua:225: in function 'self.tooltip.SetBagItem'
|caaaaaa<Locals> tooltip = ud, bag = 2, index = 145, itemLink = "|H0:item:55262:4:1:0:0:0:0:0:0..." </Locals>|r
user:/AddOns/LibMarify/LibMarify.lua:419: in function 'SetBagItem'
EsoUI/Ingame/Inventory/InventorySlot.lua:2050: in function '(anonymous)'
|caaaaaa<Locals> inventorySlot = ud, bag = 2, index = 145 </Locals>|r
EsoUI/Ingame/Utility/ZO_SlotUtil.lua:14: in function 'RunHandlers'
|caaaaaa<Locals> handlerTable = [table:3]{}, slot = ud, handlers = [table:4]{}, i = 1 </Locals>|r
EsoUI/Ingame/Inventory/InventorySlot.lua:2403: in function 'ZO_InventorySlot_OnMouseEnter'
|caaaaaa<Locals> inventorySlot = ud, buttonPart = ud, listPart = ud </Locals>|r
(tail call): ?
(tail call): ?
ZO_StackSplitSource_MouseEnter:3: in function '(main chunk)'
|caaaaaa<Locals> self = ud </Locals>|r
The issue was with with Alchemy Tooltips addon and is now fixed
Report comment to moderator  
Reply With Quote
Unread 05/28/20, 05:29 AM  
sarousse

Forum posts: 16
File comments: 62
Uploads: 0
Got this error when my mouse goes over Brutality-Draining Poison IX :

bad argument #1 to 'pairs' (table/struct expected, got nil)
stack traceback:
[C]: in function 'pairs'
user:/AddOns/LibAlchemy/LibAlchemy.lua:150: in function 'LibAlchemy:getCraftingCost'
user:/AddOns/AlchemyTooltips/AlchemyTooltips.lua:226: in function 'checkPotion'
user:/AddOns/AlchemyTooltips/AlchemyTooltips.lua:292: in function 'TooltipSetBagItem'
Report comment to moderator  
Reply With Quote
Unread 05/28/20, 04:44 AM  
hagermanj

Forum posts: 2
File comments: 367
Uploads: 0
Error with Guild Tabard

When I mouse over my Guild Tabards, I receive the following error:
Code:
user:/AddOns/LibAlchemy/LibAlchemy.lua:157: attempt to index a nil value
stack traceback:
user:/AddOns/LibAlchemy/LibAlchemy.lua:157: in function 'LibAlchemy:getCraftingCost'
|caaaaaa<Locals> self = [table:1]{}, reagentsTable = [table:2]{1 = 30163}, itemLink = "|H0:item:55262:4:1:0:0:0:0:0:0...", mainID = 55262, solvent = 1, CP = 3, result = 123.27288307769, type = 2 </Locals>|r
user:/AddOns/AlchemyTooltips/AlchemyTooltips.lua:226: in function 'checkPotion'
|caaaaaa<Locals> itemLink = "|H0:item:55262:4:1:0:0:0:0:0:0...", id = 375495, mainID = 55262, effect1 = "RestoreStamina", calculation = 5, BestCombination = [table:2] </Locals>|r
user:/AddOns/AlchemyTooltips/AlchemyTooltips.lua:292: in function 'orgFunc'
|caaaaaa<Locals> self = ud </Locals>|r
user:/AddOns/HarvensTraitAndStyle/HarvensTraitAndStyle.lua:296: in function 'HarvensTraitAndStyle_SetBagItem'
|caaaaaa<Locals> orgFunc = user:/AddOns/AlchemyTooltips/AlchemyTooltips.lua:290, tooltip = ud, bagId = 2, slotIndex = 145, unhackTraitName = user:/AddOns/HarvensTraitAndStyle/HarvensTraitAndStyle.lua:107 </Locals>|r
(tail call): ?
user:/AddOns/WritWorthy/WritWorthy.lua:361: in function 'TooltipSetBagItem'
|caaaaaa<Locals> control = ud, bagId = 2, slotIndex = 145 </Locals>|r
user:/AddOns/ArkadiusTradeToolsSales/ArkadiusTradeToolsSalesTooltipExtensions.lua:225: in function 'self.tooltip.SetBagItem'
|caaaaaa<Locals> tooltip = ud, bag = 2, index = 145, itemLink = "|H0:item:55262:4:1:0:0:0:0:0:0..." </Locals>|r
user:/AddOns/LibMarify/LibMarify.lua:419: in function 'SetBagItem'
EsoUI/Ingame/Inventory/InventorySlot.lua:2050: in function '(anonymous)'
|caaaaaa<Locals> inventorySlot = ud, bag = 2, index = 145 </Locals>|r
EsoUI/Ingame/Utility/ZO_SlotUtil.lua:14: in function 'RunHandlers'
|caaaaaa<Locals> handlerTable = [table:3]{}, slot = ud, handlers = [table:4]{}, i = 1 </Locals>|r
EsoUI/Ingame/Inventory/InventorySlot.lua:2403: in function 'ZO_InventorySlot_OnMouseEnter'
|caaaaaa<Locals> inventorySlot = ud, buttonPart = ud, listPart = ud </Locals>|r
(tail call): ?
(tail call): ?
ZO_StackSplitSource_MouseEnter:3: in function '(main chunk)'
|caaaaaa<Locals> self = ud </Locals>|r
Report comment to moderator  
Reply With Quote
Unread 05/13/20, 10:07 PM  
Dolgubon
 
Dolgubon's Avatar
AddOn Author - Click to view AddOns

Forum posts: 408
File comments: 883
Uploads: 21
So, the database isn't necessary - there's a structure to the pots so that you can determine what the effects are instead of hardcoding all of them.


See the section on #21 Instance data here: https://wiki.esoui.com/ZO_LinkHandler_CreateLink


Applying it would greatly simplify the database as well as make it easy to expand it to all potion types.


Also, for crafting mats you only need to save the item ID instead of the entire link ; you can generate a link from that with this:
local function getItemLinkFromItemId(itemId)
return string.format("|H1:item:%d:%d:50:0:0:0:0:0:0:0:0:0:0:0:0:%d:%d:0:0:%d:0|h|h", itemId, 0, ITEMSTYLE_NONE, 0, 10000)
end

There's GetItemType which you can use to determine if an item is a potion (or poison)
The checkIfNotIn and tableContains functions are inverses of each other, you only need one. Or have one just return not of the other one. You also have checkIfIn.
For getTextureFromId you could use the previously mentioned function to get an item link, then get the texture from that item link.

Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: