--------------------------
--[[ Layout Settings ]]
--------------------------
local ButtonSize=32;-- Size to make buttons
local Padding=12;-- Buttons are placed this far from the edge of the container frame
local Backdrop={
bgFile="Interface\\DialogFrame\\UI-DialogBox-Background",
edgeFile="Interface\\DialogFrame\\UI-DialogBox-Border",
tile=true,tileSize=32,edgeSize=32,
insets={left=11,right=12,top=12,bottom=12}
};
local ButtonData={-- Note: Buttons will be created top-down, then left-right
--[[ Data Format (All arguments are optional)
Icon: Icon file
Text: Button text
Tooltip: Tooltip text
Message: Message to send Format: {<Message>, <Channel>, ...} Can contain multiple messages as pairs of message and channel strings
Emote: Perform emote Format: {<EmoteToken>, <TargetUnit>} -or- <EmoteToken>
Attributes: List of attributes to apply (keys are attributes, values are values)
--]]
{-- Container 1
{-- Column 1
{
Icon="Interface\\Icons\\Ability_rogue_sprint";
Tooltip="Amphitheater of Annihilation(AoA)";
Message={
"Amphitheater of Annihilation(AoA) - EVENT:STADIUM RACING - Block the entrance!","INSTANCE_CHAT";
"AoA AoA GO NOW! - Block the entrance!","RAID_WARNING";
};
Emote="FOLLOW";
};
{
Icon="Interface\\Icons\\spell_fire_fire";
Tooltip="Brute's Rise(BR)";
Message={
"Brute's Rise(BR) - EVENT:OGRE FIRES - Block the stairs!","INSTANCE_CHAT";
"BR BR GO NOW! MOVE IT! Block the stairs!","RAID_WARNING";
};
Emote="FOLLOW";
};
{
Icon="Interface\\Icons\\achievement_boss_furyfurnace";
Tooltip="Ring of Conquest(RoC)";
Message={
"Ring of Conquest GO RoC - Let's get some fragments, scrolls, wands and class books","INSTANCE_CHAT";
"Ring of Conquest GO RoC","RAID_WARNING";
};
Emote="FOLLOW";
};
{
Icon="Interface\\Icons\\Trade_archaeology_apexisstatue";
Tooltip="Ashran Excavation(Mines)";
Message={
"Ashran Excavation(Mines) - EVENT:APEXIS MARKS - Secure the center!","INSTANCE_CHAT";
"MINES! GO NOW! MOVE IT! - Secure the center!","RAID_WARNING";
};
Emote="FOLLOW";
};
{
Icon="Interface\\Icons\\achievement_reputation_ogre";
Tooltip="Seat of Kor'lok";
Message={
"Seat of Kor'lok - Kor'lok - Kill the ogre!","INSTANCE_CHAT";
"Kor'lok! - Kill the ogre!","RAID_WARNING";
};
Emote="FOLLOW";
};
{
Icon="Interface\\Icons\\Spell_lifegivingspeed";
Tooltip="Molten Quarry(MQ)";
Message={
"Molten Quarry(MQ) - EVENT:Empowered Ore - Block the entrance!","INSTANCE_CHAT";
"MQ MQ GO NOW! MOVE IT! - Block the entrance!","RAID_WARNING";
};
Emote="FOLLOW";
};
{
Icon="Interface\\Icons\\Achievement_halloween_ghost_01";
Tooltip="Ashmaul Burial Grounds(ABG)";
Message={
"Ashmaul Burial Grounds(ABG) - EVENT:RISEN SPIRITS - Clear the center and block the entrance!","INSTANCE_CHAT";
"ABG ABG GO NOW! MOVE IT! - Clear the center and block the entrance!","RAID_WARNING";
};
Emote="FOLLOW";
};
};
{-- Column 2
{
Icon="Interface\\Icons\\achievement_pvp_a_h";
Tooltip="Warspear Keep";
Message={
"Warspear Keep!","INSTANCE_CHAT";
"Warspear Keep!","RAID_WARNING";
};
Emote="FOLLOW";
};
{
Icon="Interface\\Icons\\achievement_garrison_tier02_horde";
Tooltip="Emberfall Tower";
Message={
"Emberfall Tower! Go Go Go! Stack at the flag","INSTANCE_CHAT";
"Emberfall Tower!","RAID_WARNING";
};
Emote="FOLLOW";
};
{
Icon="Interface\\Icons\\achievement_garrison_tier01_horde";
Tooltip="Volrath's Advance";
Message={
"Volrath's Advance! Go Go Go! Stack at the flag","INSTANCE_CHAT";
"Volrath's Advance! VA VA VA","RAID_WARNING";
};
Emote="FOLLOW";
};
{
Icon="Interface\\Icons\\achievement_doublejeopardy";
Tooltip="The Crossroads";
"The Crossroads - Get to Crossroads! Stack at the flag","INSTANCE_CHAT";
"The Crossroads - XR XR XR","RAID_WARNING";
Message={
};
Emote="FOLLOW";
};
{
Icon="Interface\\Icons\\achievement_garrison_tier01_alliance";
Tooltip="Tremblade's Vanguard";
Message={
"Tremblade's Vanguard! Go Go Go! Stack at the flag","INSTANCE_CHAT";
"Tremblade's Vanguard! TV TV TV","RAID_WARNING";
};
Emote="FOLLOW";
};
{
Icon="Interface\\Icons\\achievement_garrison_tier02_alliance";
Tooltip="Archmage Overwatch";
Message={
"Archmage Overwatch! Go Go Go! Stack at the flag","INSTANCE_CHAT";
"Archmage Overwatch! AO AO AO","RAID_WARNING";
};
Emote="FOLLOW";
};
{
Icon="Interface\\Icons\\achievement_pvp_h_a";
Tooltip="Stormshield Stronghold";
Message={
"Stormshield Stronghold!","INSTANCE_CHAT";
"Stormshield Stronghold!","RAID_WARNING";
};
Emote="FOLLOW";
};
};
};
{-- Container 2
{-- Column 1
{
Icon="Interface\\Icons\\Spell_holy_mindvision";
Tooltip="Song flower";
Message={
"Song Flower - Increases all stats by 15%. This effect persists through death. Pick them up in The Dark Woods (the arakkoa area)","INSTANCE_CHAT";
"Use Song Flower! 15% to all stats","RAID_WARNING";
"You should also pick up Star Root Tuber in Root Den (the saberon area). It gives you are small heal and 40% damage reduction for 10 sec. when used. The Tuber is not as visible as the Song Flowers, but once you know what to look for, it's easy to find them.","INSTANCE_CHAT";
};
Emote="DRINK";
};
{
Icon="Interface\\Icons\\Misc_arrowleft";
Tooltip="Get out of the road";
Message={
"Get out of the main road - Stampede or Frost wyrm incoming - Move it!","INSTANCE_CHAT";
"GET OUT OF THE ROAD! STAMPEDE OR FROST WYRM INCOMING!","RAID_WARNING";
};
Emote="DUCK";
};
{
Icon="Interface\\Icons\\Spell_nature_bloodlust";
Tooltip="Bloodlust";
Message={
"Time to fight! Pop Bloodlust/Time Warp/Heroism","INSTANCE_CHAT";
"Pop Bloodlust - Time Warp - Heroism!!","RAID_WARNING";
};
Emote="FLEX";
};
};
{-- Column 2
{
Icon="Interface\\Icons\\misc_arrowlup";
Tooltip="Push";
Message={
"PUSH PUSH! Give them nothing! But take from them EVERYTHING!","INSTANCE_CHAT";
"PUSH PUSH PUSH!","RAID_WARNING";
};
Emote="CHARGE";
};
{
Icon="Interface\\Icons\\ability_defend";
Tooltip="Hold Position";
Message={
"Hold this position. Stay grouped. Form a wall and let any attackers break upon it. Protect the healers.","INSTANCE_CHAT";
"HOLD THE POSITION - STAY GROUPED","RAID_WARNING";
};
Emote="ENCOURAGE";
};
{
Icon="Interface\\Icons\\misc_arrowdown";
Tooltip="Retreat";
Message={
"Time for a tactical retreat. Stay grouped. Disengage from combat quickly. Like Top Gear, we will leave stragglers behind","INSTANCE_CHAT";
"MOVE BACK! STAY GROUPED!","RAID_WARNING";
};
Emote="FLEE";
};
};
{-- Column 3
{
Icon="Interface\\Icons\\Inv_enchant_formulasuperior_01";
Tooltip="Scroll of Protection";
Message={
"One player use Scroll of Protection(SoP) now. If you see another player use one, don't use yours for 10-15 sec. SoP reduces damage taken by 60% for 15 seconds.","INSTANCE_CHAT";
"Use Scroll of Protection!","RAID_WARNING";
};
Emote="INCOMING";
};
{
Icon="Interface\\Icons\\achievement_bg_xkills_avgraveyard";
Tooltip="Market Graveyard";
Message={
"Capture Market Graveyard. No more than 5 should disengage from combat to capture the graveyard, unless the raid is moving past it anyway or not engaged in combat.","INSTANCE_CHAT";
"CAP THE GY!","RAID_WARNING";
};
Emote="GO";
};
{
Icon="Interface\\TargetingFrame\\UI-RaidTargetingIcon_8";
Tooltip="Place World Marker/Right-click to remove";
Message={
"{rt8} is used by a commander to mark the battlefront, gathering spots, defensive lines and on AA if it is dropped.","INSTANCE_CHAT";
"{rt8} Get to {rt8}","RAID_WARNING";-- {rt8} is locale-independant form of {skull}
};
Attributes={
type="macro";
macrotext1=SLASH_WORLD_MARKER1.." 8";
macrotext2=SLASH_CLEAR_WORLD_MARKER1.." 8";
};
};
};
};
};
------------------------------------------------------------------
--[[ Addon Code (Don't change anything below this line) ]]
------------------------------------------------------------------
-- Button Handlers
local function Container_OnEvent(self)
if not (self.HasProtectedFrame and InCombatLockdown()) then-- Check if we have a protected button and can show/hide ourselves (Protected frames are protected in combat)
self:SetShown(GetZoneText()==GetMapNameByID(978))
end
end
local function Button_OnEnter(self)
GameTooltip:SetOwner(self,"ANCHOR_TOP");
GameTooltip:AddLine(self.Tooltip,0,1,0.5);
GameTooltip:Show();
end
local function Button_OnLeave(self) if GameTooltip:IsOwned(self) then GameTooltip:Hide(); end end
local function Button_OnDragStart(self) self:GetParent():StartMoving(); end
local function Button_OnDragStop(self) self:GetParent():StopMovingOrSizing(); end
local function Button_OnClick(self)
if self.Message then
for i=1,#self.Message,2 do
SendChatMessage(self.Message[i],self.Message[i+1]);
end
end
if self.Emote then
if type(self.Emote)=="table" then
local target; do-- Prototype variable
local unit=self.Emote[2];
if unit and UnitExists(unit) and UnitIsPlayer(unit) then
local name,server=UnitName(unit);-- Unit name and server
target=name..(server and "-"..server:gsub("%s","") or "");-- Format name to <name-server> if necessary
end
end
DoEmote(self.Emote[1],target);
else
DoEmote(self.Emote);
end
end
end
local OffsetX=0;
for containerid,buttonlist in ipairs(ButtonData) do
-- Container Frame
local container=CreateFrame("Frame","AshranCommander"..containerid,UIParent);
container:SetBackdrop(Backdrop);
container:Hide();-- Start hidden
-- Enable Dragging
container:EnableMouse(true);
container:SetMovable(true);
container:SetClampedToScreen(true);
container:RegisterForDrag("LeftButton");
container:SetScript("OnDragStart",container.StartMoving);
container:SetScript("OnDragStop",container.StopMovingOrSizing);
-- Event Handlers
container:RegisterEvent("PLAYER_ENTERING_WORLD");-- Load screen disapears
container:RegisterEvent("ZONE_CHANGED_NEW_AREA");-- Moved into new area
container:RegisterEvent("PLAYER_REGEN_ENABLED");-- Retry when exiting combat
container:SetScript("OnEvent",Container_OnEvent);
-- Button Factory
local numrows,buttonid=0,1;
for column,rowlist in ipairs(buttonlist) do
numrows=math.max(numrows,#rowlist);
for row,data in ipairs(rowlist) do
local btn=CreateFrame("Button","$parentButton"..buttonid,container,data.Attributes and "SecureActionButtonTemplate");
btn:SetPoint("TOPLEFT",(column-1)*ButtonSize+Padding,-(row-1)*ButtonSize-Padding);-- Yay, math!
btn:SetSize(ButtonSize,ButtonSize);
-- Extra flair
btn:SetPushedTexture("Interface\\Buttons\\UI-Quickslot-Depress");
btn:SetHighlightTexture("Interface\\Buttons\\ButtonHilight-Square","ADD");
-- Pushed texture replaces normal texture
local icon=btn:CreateTexture(nil,"BACKGROUND");
icon:SetTexture(data.Icon or "Interface\\Icons\\INV_Misc_QuestionMark");
icon:SetAllPoints(btn);
-- Button Text
if data.Text then
btn:SetNormalFontObject("GameFontNormalSmall");
btn:SetHighlightFontObject("GameFontHighlightSmall");
btn:SetDisabledFontObject("GameFontDisableSmall");
btn:SetText(data.Text);
end
-- Register clicks and drag
btn:RegisterForClicks("AnyUp");-- By default, buttons only respond to LeftUp
btn:RegisterForDrag("LeftButton");
btn:HookScript("OnDragStart",Button_OnDragStart);
btn:HookScript("OnDragStop",Button_OnDragStop);
-- Attribute Setup
if data.Attributes then
container.HasProtectedFrame=true;-- Lets the container frame know we have protected buttons now
for key,val in pairs(data.Attributes) do btn:SetAttribute(key,val); end
end
-- Tooltip Setup
if data.Tooltip then
btn.Tooltip=data.Tooltip;
btn:HookScript("OnEnter",Button_OnEnter);
btn:HookScript("OnLeave",Button_OnLeave);
end
-- Chat Handling
if data.Message or data.Emote then
btn.Message=data.Message;
btn.Emote=data.Emote;
btn:HookScript("OnClick",Button_OnClick);
end
end
end
-- We get to apply the position and size now
local width=#buttonlist*ButtonSize+Padding*2;
container:SetPoint("TOPLEFT",256+OffsetX,-256);
container:SetSize(width,numrows*ButtonSize+Padding*2);-- More math, yay!
OffsetX=OffsetX+width;
end