Ok here is the whole addon in pieces:
SavedVariables (DB): WTF\USERNAME\SavedVariables\UpyurshHealAssign.lua
UpyurshHealAssigns_Data = {
["Tanks"] = {
"TANK1", -- [1]
"Tank2", -- [2]
"RangedTank3", -- [3]
"Tank4", -- [4]
"Tank5", -- [5]
},
["Placeholders"] = {
["Heals"] = {
"TANKH1", -- [1]
"TANKH2", -- [2]
"HOTS1", -- [3]
},
["Tanks"] = {
"TANK1", -- [1]
"TANK2", -- [2]
"TANK3", -- [3]
"TANK4", -- [4]
"RANGEDTANK", -- [5]
},
},
["Healers"] = {
"Pally1", -- [1]
"DiscPriest1", -- [2]
"RestoDruid1", -- [3]
"RestoDruid2", -- [4]
"HolyPriest1", -- [5]
"RestoSham1", -- [6]
"RestoSham2", -- [7]
},
}
UpyurshHealAssign.toc
## Interface: 30000
## Title : Upyursh Healing Assign
## Notes: designed to take data from http://healassigns.upyursh.com
## Author: Upyursh
## SavedVariables: UpyurshHealAssigns_Data
UpyurshHealAssign.xml
Core.lua
UpyurshHealAssign.xml
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="Libs\LibStub\LibStub.lua"/>
<Include file="Libs\CallbackHandler-1.0\CallbackHandler-1.0.xml"/>
<Include file="Libs\AceAddon-3.0\AceAddon-3.0.xml"/>
<Include file="Libs\AceGUI-3.0\AceGUI-3.0.xml"/>
<Include file="Libs\AceConfig-3.0\AceConfig-3.0.xml"/>
<Include file="Libs\AceConsole-3.0\AceConsole-3.0.xml"/>
<Include file="Libs\AceDB-3.0\AceDB-3.0.xml"/>
<Include file="Libs\AceEvent-3.0\AceEvent-3.0.xml"/>
</Ui>
Core.lua
UpyurshHealAssign = LibStub("AceAddon-3.0"):NewAddon("UpyurshHealAssign", "AceConsole-3.0")
local AceGUI = LibStub("AceGUI-3.0")
local UHAVersion = "0.0.1"
local function GetSelectedHealer(this, event, item)
-- Healers/Tanks and their details
local healers = UpyurshHealAssigns_Data["Healers"] -- actual healers
print(healers[item])
end
local function GetSelectedTank(this, event, item)
-- Healers/Tanks and their details
local tanks = UpyurshHealAssigns_Data["Tanks"] -- actual tanks
print(tanks[item])
end
-- Register our slash commands
function UpyurshHealAssign:OnEnable()
UpyurshHealAssign:RegisterChatCommand("upyursh", UpyurshHealAssign_Start)
UpyurshHealAssign:RegisterChatCommand("uha", UpyurshHealAssign_Start)
end
-- Start Function when slash commands are used
function UpyurshHealAssign_Start()
-- Healers/Tanks and their details
local healers = UpyurshHealAssigns_Data["Healers"] -- actual healers
local tanks = UpyurshHealAssigns_Data["Tanks"] -- actual tanks & others
-- Placeholders
local ph_heals = UpyurshHealAssigns_Data["Placeholders"]["Heals"] -- Healing Placeholders
local ph_tanks = UpyurshHealAssigns_Data["Placeholders"]["Tanks"] -- Tank Placeholders
-- Draw our Placeholder Frame
local function DrawPlaceholders(container)
local desc = AceGUI:Create("Label")
desc:SetText("Select the toons that will be filling your roles in the raid")
desc:SetFullWidth(true)
container:AddChild(desc)
-- Add our Healer Heading
local label_healers = AceGUI:Create("Heading")
label_healers:SetText("HEALERS")
label_healers:SetFullWidth(true)
container:AddChild(label_healers)
-- List all Healer Placeholders with Healer Dropdown
for k,v in pairs(ph_heals) do
local thisupyursh = "upyursh_" .. ph_heals[k]
local thisupyursh = AceGUI:Create("Dropdown")
thisupyursh:SetLabel(ph_heals[k])
-- To be fixed
thisupyursh:SetList(healers)
-- need to add functions here
thisupyursh:SetCallback("OnValueChanged",GetSelectedHealer)
thisupyursh:SetWidth(200)
container:AddChild(thisupyursh)
end
-- List all Tank Placeholders with Tank Dropdown
local label_tanks = AceGUI:Create("Heading")
label_tanks:SetText("TANKS & OTHERS")
label_tanks:SetFullWidth(true)
container:AddChild(label_tanks)
-- Tanks Second
for k,v in pairs(ph_tanks) do
local thisupyursh = "upyursh_" .. ph_tanks[k]
local thisupyursh = AceGUI:Create("Dropdown")
thisupyursh:SetLabel(ph_tanks[k])
-- to be fixed
thisupyursh:SetList(tanks)
thisupyursh:SetWidth(200)
-- need to add functions here
thisupyursh:SetCallback("OnValueChanged", GetSelectedTank)
container:AddChild(thisupyursh)
end
end
-- Draw our Assigns Tab
local function DrawAssigns(container)
local desc = AceGUI:Create("Label")
desc:SetText("Select & Manage your heal assigns")
desc:SetFullWidth(true)
container:AddChild(desc)
local button = AceGUI:Create("Button")
button:SetText("Tab 2 Button")
button:SetWidth(200)
container:AddChild(button)
end
-- Draw our Config Tab
local function DrawConfig(container)
local desc = AceGUI:Create("Label")
desc:SetText("Upyursh Heal Assigns Configuration")
desc:SetFullWidth(true)
container:AddChild(desc)
local button = AceGUI:Create("Button")
button:SetText("Tab 2 Button")
button:SetWidth(200)
container:AddChild(button)
end
-- Callback function for OnGroupSelected
local function SelectGroup(container, event, group)
container:ReleaseChildren()
if group == "tab1" then
DrawPlaceholders(container)
elseif group == "tab2" then
DrawAssigns(container)
elseif group == "tab3" then
DrawConfig(container)
end
end
-- Create the upyursh container
local upyursh = AceGUI:Create("Frame")
upyursh:SetTitle("Upyursh Heal Assigns")
upyursh:SetStatusText("Upyursh Heal Assigns v" .. UHAVersion)
upyursh:SetCallback("OnClose", function(widget) AceGUI:Release(widget) end)
-- Fill Layout - the TabGroup widget will fill the whole upyursh
upyursh:SetLayout("Fill")
if( UpyurshHealAssigns_Data == nil) then
UpyurshHealAssigns_Data = { }
end
-- Create the TabGroup
local tab = AceGUI:Create("TabGroup")
tab:SetLayout("Flow")
-- Setup which tabs to show
tab:SetTabs({{text="Placeholders", value="tab1"}, {text="Assigns", value="tab2"}, {text="Config", value="tab3"}})
-- Register callback
tab:SetCallback("OnGroupSelected", SelectGroup)
-- Set initial Tab (this will fire the OnGroupSelected callback)
tab:SelectTab("tab1")
-- add to the upyursh container
upyursh:AddChild(tab)
end