diff --git a/CRAFT_SHOW.lua b/CRAFT_SHOW.lua new file mode 100644 index 0000000..c000c60 --- /dev/null +++ b/CRAFT_SHOW.lua @@ -0,0 +1,46 @@ +local addonName, addon = ... +local childName = addon['childName'] +local child = addon[childName] +local events, db = {} +local hookedCraft = {} +local craftTip = CreateFrame( "GameTooltip", format("%sCraftReagentTip",childName), nil, "GameTooltipTemplate") +local function CraftReagent_OnLeave(self,...) + craftTip:Hide() +end +local function CraftReagent_OnEnter(self,...) + if(self.hasItem==1) then + local itemName = self['Name']:GetText() + if(itemName) then + local id = GetItemInfoInstant(itemName) + craftTip:Hide() + craftTip:ClearLines() + craftTip:SetOwner(self, "ANCHOR_TOPLEFT") + if(id) then + craftTip:SetItemByID(id) + GameTooltip_OnTooltipSetItem(craftTip) + else + craftTip:SetCraftItem(GetCraftSelectionIndex(), self:GetID()) + end + craftTip:Show() + CursorUpdate() + end + end +end +function events:CRAFT_SHOW(...) + for i = 1, MAX_CRAFT_REAGENTS,1 do + local reag = format("CraftReagent%i", i) + if(not hookedCraft[reag]) then + _G[reag]:SetScript("OnEnter", CraftReagent_OnEnter) + _G[reag]:SetScript("OnLeave", CraftReagent_OnLeave) + hookedCraft[reag] = true + end + end +end +child:IgnoreRetail("CRAFT_SHOW") +child:AddEvent(events) +local init = { + Setup = function(self) + db = child['db'] + end +} +addon.RegisterCallback(init, format("Init%s", childName), 'Setup') \ No newline at end of file diff --git a/Libs/AceConfig-3.0/AceConfig-3.0.lua b/Libs/AceConfig-3.0/AceConfig-3.0.lua new file mode 100755 index 0000000..aae348b --- /dev/null +++ b/Libs/AceConfig-3.0/AceConfig-3.0.lua @@ -0,0 +1,58 @@ +--- AceConfig-3.0 wrapper library. +-- Provides an API to register an options table with the config registry, +-- as well as associate it with a slash command. +-- @class file +-- @name AceConfig-3.0 +-- @release $Id: AceConfig-3.0.lua 1202 2019-05-15 23:11:22Z nevcairiel $ + +--[[ +AceConfig-3.0 + +Very light wrapper library that combines all the AceConfig subcomponents into one more easily used whole. + +]] + +local cfgreg = LibStub("AceConfigRegistry-3.0") +local cfgcmd = LibStub("AceConfigCmd-3.0") + +local MAJOR, MINOR = "AceConfig-3.0", 3 +local AceConfig = LibStub:NewLibrary(MAJOR, MINOR) + +if not AceConfig then return end + +--TODO: local cfgdlg = LibStub("AceConfigDialog-3.0", true) +--TODO: local cfgdrp = LibStub("AceConfigDropdown-3.0", true) + +-- Lua APIs +local pcall, error, type, pairs = pcall, error, type, pairs + +-- ------------------------------------------------------------------- +-- :RegisterOptionsTable(appName, options, slashcmd, persist) +-- +-- - appName - (string) application name +-- - options - table or function ref, see AceConfigRegistry +-- - slashcmd - slash command (string) or table with commands, or nil to NOT create a slash command + +--- Register a option table with the AceConfig registry. +-- You can supply a slash command (or a table of slash commands) to register with AceConfigCmd directly. +-- @paramsig appName, options [, slashcmd] +-- @param appName The application name for the config table. +-- @param options The option table (or a function to generate one on demand). http://www.wowace.com/addons/ace3/pages/ace-config-3-0-options-tables/ +-- @param slashcmd A slash command to register for the option table, or a table of slash commands. +-- @usage +-- local AceConfig = LibStub("AceConfig-3.0") +-- AceConfig:RegisterOptionsTable("MyAddon", myOptions, {"/myslash", "/my"}) +function AceConfig:RegisterOptionsTable(appName, options, slashcmd) + local ok,msg = pcall(cfgreg.RegisterOptionsTable, self, appName, options) + if not ok then error(msg, 2) end + + if slashcmd then + if type(slashcmd) == "table" then + for _,cmd in pairs(slashcmd) do + cfgcmd:CreateChatCommand(cmd, appName) + end + else + cfgcmd:CreateChatCommand(slashcmd, appName) + end + end +end diff --git a/Libs/AceConfig-3.0/AceConfig-3.0.xml b/Libs/AceConfig-3.0/AceConfig-3.0.xml new file mode 100755 index 0000000..84c8d03 --- /dev/null +++ b/Libs/AceConfig-3.0/AceConfig-3.0.xml @@ -0,0 +1,8 @@ + + + + + +