local CreateButton; do-- Prototype for function
-- Tooltip Handlers
local function OnEnter(self)
if self.Tooltip then
GameTooltip:SetOwner(self,"ANCHOR_TOP");
GameTooltip:AddLine(self.Tooltip,0,1,0.5,1,1,1);
GameTooltip:Show();
end
end
local function OnLeave(self) if GameTooltip:IsOwned(self) then GameTooltip:Hide(); end end
-- Button Generator (this will be assigned to the upvalue noted as a function prototype)
function CreateButton(parent,name,texture,text,tooltip)
tooltip=tooltip or text;-- If no tooltip, use button text
-- Create our button
local btn=CreateFrame("Button",name,parent,"SecureActionButtonTemplate");
btn:RegisterForClicks("AnyUp");-- Register all buttons
btn:SetSize(30,30);
-- Setup button text
btn:SetNormalFontObject("GameFontNormalSmall");
btn:SetHighlightFontObject("GameFontHighlightSmall");
btn:SetDisabledFontObject("GameFontDisableSmall");
btn:SetText(text);
-- Setup button's backgorund, you can use :SetNormalTexture() and other functions to set state-based textures
local tex=btn:CreateTexture(nil,"BACKGROUND");
tex:SetAllPoints(btn);
tex:SetTexture(texture);
btn.Texture=tex;
-- Register handlers
btn:SetScript("OnEnter",OnEnter);
btn:SetScript("OnLeave",OnLeave);
btn.Tooltip=tooltip;
-- Return our button
return btn;
end
end
local button=CreateButton(AshranCommander,"AshranCommanderButton1","Interface\\Icons\\achievement_pvp_a_h",nil,"Warspear Keep");
button:SetPoint("TOPRIGHT",ACFrame,"CENTER",13,-13);-- Anchors always default to an object's parent
button:SetScript("OnClick", function()
SendChatMessage("Warspear Keep ","SAY")
DoEmote("follow")
end )
local button=CreateButton(AshranCommander,"AshranCommanderButton2","Interface\\Icons\\achievement_garrison_tier02_horde",nil,"Emberfall Tower");
button:SetPoint("TOP",AshranCommanderButton1,"BOTTOM",0,-1);-- Anchors always default to an object's parent
button:SetScript("OnClick", function()
SendChatMessage("Emberfall Tower ","SAY")
DoEmote("follow" , UnitName("target"))
end )
local button=CreateButton(AshranCommander,"AshranCommanderButton3","Interface\\Icons\\achievement_garrison_tier01_horde",nil,"Volrath's Advance");
button:SetPoint("TOP",AshranCommanderButton2,"BOTTOM",0,-1);-- Anchors always default to an object's parent
button:SetScript("OnClick", function()
SendChatMessage("Volrath's Advance ","SAY")
DoEmote("follow" , UnitName("target"))
end )
local button=CreateButton(AshranCommander,"AshranCommanderButton4","Interface\\Icons\\achievement_doublejeopardy",nil,"The Crossroads");
button:SetPoint("TOP",AshranCommanderButton3,"BOTTOM",0,-1);-- Anchors always default to an object's parent
button:SetScript("OnClick", function()
SendChatMessage("The Crossroads ","SAY")
DoEmote("follow" , UnitName("target"))
end )
local button=CreateButton(AshranCommander,"AshranCommanderButton5","Interface\\Icons\\achievement_garrison_tier01_alliance",nil,"Tremblade's Vanguard");
button:SetPoint("TOP",AshranCommanderButton4,"BOTTOM",0,-1);-- Anchors always default to an object's parent
button:SetScript("OnClick", function()
SendChatMessage("Tremblade's Vanguard ","SAY")
DoEmote("follow" , UnitName("target"))
end )
local button=CreateButton(AshranCommander,"AshranCommanderButton6","Interface\\Icons\\achievement_garrison_tier02_alliance",nil,"Archmage Overwatch");
button:SetPoint("TOP",AshranCommanderButton5,"BOTTOM",0,-1);-- Anchors always default to an object's parent
button:SetScript("OnClick", function()
SendChatMessage("Archmage Overwatch ","SAY")
DoEmote("follow" , UnitName("target"))
end )
local button=CreateButton(AshranCommander,"AshranCommanderButton7","Interface\\Icons\\achievement_pvp_h_a",nil,"Stormshield Stronghold");
button:SetPoint("TOP",AshranCommanderButton6,"BOTTOM",0,-1);-- Anchors always default to an object's parent
button:SetScript("OnClick", function()
SendChatMessage("Stormshield Stronghold ","SAY")
DoEmote("follow" , UnitName("target"))
end )
local button=CreateButton(AshranCommander,"AshranCommanderButton8","Interface\\Icons\\Ability_rogue_sprint",nil,"Amphitheater of Annihilation(AoA)");
button:SetPoint("RIGHT",AshranCommanderButton1,"LEFT",0,0);-- Anchors always default to an object's parent
button:SetScript("OnClick", function()
SendChatMessage("AoA - EVENT:STADIUM RACING - Block the entrance!","SAY")
DoEmote("follow" , UnitName("target"))
end )
local button=CreateButton(AshranCommander,"AshranCommanderButton9","Interface\\Icons\\spell_fire_fire",nil,"Brute's Rise(BR)");
button:SetPoint("RIGHT",AshranCommanderButton2,"LEFT",0,0);-- Anchors always default to an object's parent
button:SetScript("OnClick", function()
SendChatMessage("BR - EVENT:OGRE FIRES - Block the stairs! ","SAY")
DoEmote("follow" , UnitName("target"))
end )
local button=CreateButton(AshranCommander,"AshranCommanderButton10","Interface\\Icons\\achievement_boss_furyfurnace",nil,"Ring of Conquest(RoC)");
button:SetPoint("RIGHT",AshranCommanderButton3,"LEFT",0,0);-- Anchors always default to an object's parent
button:SetScript("OnClick", function()
SendChatMessage("Ring of Conquest GO RoC ","SAY")
DoEmote("follow" , UnitName("target"))
end )
local button=CreateButton(AshranCommander,"AshranCommanderButton11","Interface\\Icons\\Trade_archaeology_apexisstatue",nil,"Ashran Excavation(Mines)");
button:SetPoint("RIGHT",AshranCommanderButton4,"LEFT",0,0);-- Anchors always default to an object's parent
button:SetScript("OnClick", function()
SendChatMessage("Ashran Excavation - EVENT:APEXIS MARKS - Secure the center! ","SAY")
DoEmote("follow" , UnitName("target"))
end )
local button=CreateButton(AshranCommander,"AshranCommanderButton12","Interface\\Icons\\achievement_reputation_ogre",nil,"Seat of Kor'lok");
button:SetPoint("RIGHT",AshranCommanderButton5,"LEFT",0,0);-- Anchors always default to an object's parent
button:SetScript("OnClick", function()
SendChatMessage("Seat of Kor'lok - Kor'lok - Kill the ogre! ","SAY")
DoEmote("follow" , UnitName("target"))
end )
local button=CreateButton(AshranCommander,"AshranCommanderButton13","Interface\\Icons\\Spell_lifegivingspeed",nil,"Molten Quarry(MQ)");
button:SetPoint("RIGHT",AshranCommanderButton6,"LEFT",0,0);-- Anchors always default to an object's parent
button:SetScript("OnClick", function()
SendChatMessage("Molten Quarry - EVENT:Empowered Ore - Block the entrance! ","SAY")
DoEmote("follow" , UnitName("target"))
end )
local button=CreateButton(AshranCommander,"AshranCommanderButton14","Interface\\Icons\\Achievement_halloween_ghost_01",nil,"Ashmaul Burial Grounds(ABG)");
button:SetPoint("RIGHT",AshranCommanderButton7,"LEFT",0,0);-- Anchors always default to an object's parent
button:SetScript("OnClick", function()
SendChatMessage("Ashmaul Burial Grounds - EVENT:RISEN SPIRITS - Clear the center and block the entrance! ","SAY")
DoEmote("follow" , UnitName("target"))
end )
local frame = CreateFrame("Frame","ACFrame",UIParent)
frame:SetWidth(40+40+20)
frame:SetHeight((7*40)+20)
frame:ClearAllPoints()
frame:SetBackdrop(StaticPopup1:GetBackdrop())
frame:SetPoint("CENTER",UIParent)
frame:SetScale(scale)
frame:Show()
frame:SetMovable(movable)
frame:StartMoving()
frame:StopMovingOrSizing()