View Single Post
10-11-16, 06:43 PM   #3
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by DeadAngel1985 View Post
The option to choose between english and german
Why is this an option? You should just detect which language the game client is set to, and use that.

Originally Posted by DeadAngel1985 View Post
4 blocks where i can drag and drop the types of gloves (Normal gloves, mining, herbalsim and skinning)
Maybe I'm misunderstanding the purpose of your addon, but why does the user need to tell the addon which gloves have the profession enchants? Just scan their bags to find them on demand:

Lua Code:
  1. local enchantsForProfession = {
  2.     Fishing = {
  3.         ["846"] = true, -- +2 Fishing
  4.     },
  5.     Herbalism = {
  6.         ["845"] = true, -- +2 Herbalism
  7.     },
  8.     Mining = {
  9.         ["844"] = true, -- +2 Mining
  10.     },
  11. }
  12.  
  13. local function FindGlovesForProfession(professionName)
  14.     local enchants = enchantValuesForProfession[professionName]
  15.     if not enchants then
  16.         return
  17.     end
  18.  
  19.     for bag = 0, 4 do
  20.         for slot = 1, GetContainerNumSlots(bag) do
  21.             local itemLink = GetContainerItemLink(bag, slot)
  22.             local enchantID = itemLink and itemLink:match("Hitem:%d+:(%d+):")
  23.             if enchantID and enchants[enchantID] then
  24.                 return bag, slot
  25.             end
  26.         end
  27.     end
  28. end
  29.  
  30. local bag, slot = FindGlovesForProfession("Fishing")
  31. if bag and slot then
  32.     -- Do something with the gloves here
  33. end

Note the included enchant IDs were taken from http://wow.gamepedia.com/EnchantId and may not be correct. If there's only one enchant for each profession these days, you don't even need the sub-tables.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote