WoWInterface SVN DagAssist

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 2 to Rev 9
    Reverse comparison

Rev 2 → Rev 9

DagAssist.toc
2,7 → 2,7
## Title: DagAssist
## Author: Dagos (Cenarius)
## Notes: Convenient shortcut menu
## Version: 4.02
## Version: 4.03
## DefaultState: enabled
## LoadOnDemand: 0
## SavedVariablesPerCharacter: DA_Vars
DagAssist_Menu.lua New file
0,0 → 1,351
------------------------------------------------
-- DagAssist --
-- Dagos of Cenarius --
------------------------------------------------
 
if (not DagAssist) then
DagAssist = {};
end
 
function PlayerKnowsSpell(checkSpellId)
-- Calling GetSpellInfo with the spellID will always return spell information.
-- Calling GetSpellInfo with the spell name will only return a value if the player knows the spell
-- By nesting two calls to GetSpellInfo, we can test if the player knows the spellId
local value = GetSpellInfo(checkSpellId);
if (value ~= nil) then
return (GetSpellInfo(value) ~= nil);
else
return false;
end
end
 
function DagAssist.LoadDefaultMenu()
 
local templateMenu = DagAssist.TemplateList;
local sectionIndex = 1;
 
while (sectionIndex <= table.getn(templateMenu)) do
local sectionData = templateMenu[sectionIndex];
local actionIndex = 1;
 
while (actionIndex <= table.getn(sectionData.Actions)) do
local actionData = sectionData.Actions[actionIndex];
 
if (actionData.DA_ActionType == "spell") then
if (PlayerKnowsSpell(actionData.DA_ActionData)) then
actionIndex = actionIndex + 1;
else
table.remove(sectionData.Actions, actionIndex);
end
else
actionIndex = actionIndex + 1;
end
end
 
if (table.getn(sectionData.Actions) > 0) then
sectionIndex = sectionIndex + 1;
else
table.remove(templateMenu, sectionIndex);
end
end
 
return templateMenu;
end
 
--------------------------------------------------
-- To find a spell or item ID, use Wowhead. Look up the item or spell and the check the URL for the ID
-- TelePort:Ironforge = http://www.wowhead.com/?spell=3562
-- ID = 3562
--------------------------------------------------
 
DagAssist.TemplateList = {
-----------
--CLASS ABILITIES--
-----------
{
["Name"] = "Warrior",
["Actions"] = {
--WARRIOR
}
},
{
["Name"] = "Deathknight",
["Actions"] = {
--DEATHKNIGHT
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "50977"}, --Death Gate
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "53428"}, --Runeforging
}
},
{
["Name"] = "Paladin",
["Actions"] = {
--PALADIN
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "48950"}, --Redemption
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "25780"}, --Righteous Fury
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "5502"}, --Sense Undead
}
},
{
["Name"] = "Seals",
["Actions"] = {
--Seals
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "20165"}, --Seal of Light
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "20166"}, --Seal of Wisdom
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "21084"}, --Seal of Righteousness
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "31801"}, --Seal of Vengeance
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "53736"}, --Seal of Corruption
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "20164"}, --Seal of Justice
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "31892"}, --Seal of Blood
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "53720"}, --Seal of the Martyr
}
},
{
["Name"] = "Blessings",
["Actions"] = {
--Blessings
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "48932"}, --Blessing of Might
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "48936"}, --Blessing of Wisdom
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "58054"}, --Blessing of Kings
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "20911"}, --Blessing of Sanctuary
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "48934"}, --Greater Blessing of Might
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "48938"}, --Greater Blessing of Wisdom
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "25898"}, --Greater Blessing of Kings
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "25899"}, --Greater Blessing of Sanctuary
}
},
{
["Name"] = "Priest",
["Actions"] = {
--PRIEST
}
},
{
["Name"] = "Shaman",
["Actions"] = {
--SHAMAN
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "556"}, --Astral Recall
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "6196"}, --Far Sight
}
},
{
["Name"] = "Druid",
["Actions"] = {
--DRUID
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "18960"}, --Teleport: Moonglade
}
},
{
["Name"] = "Rogue",
["Actions"] = {
--ROGUE
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "1804"}, --Pick Lock
}
},
{
["Name"] = "Teleports",
["Actions"] = {
--MAGE
--Teleports
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "53140"}, --Teleport: Dalaran
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "3565"}, --Teleport: Darnassus
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "32271"}, --Teleport: Exodar
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "3562"}, --Teleport: Ironforge
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "3567"}, --Teleport: Orgrimmar
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "33690"}, --Teleport: Shattrath
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "32272"}, --Teleport: Silvermoon
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "49358"}, --Teleport: Stonard
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "3561"}, --Teleport: Stormwind
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "49359"}, --Teleport: Theramore
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "3566"}, --Teleport: Thunder Bluff
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "3563"}, --Teleport: Undercity
}
},
{
["Name"] = "Portals",
["Actions"] = {
--Portals
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "53142"}, --Portal: Dalaran
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "11419"}, --Portal: Darnassus
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "32266"}, --Portal: Exodar
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "11416"}, --Portal: Ironforge
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "11417"}, --Portal: Orgrimmar
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "33691"}, --Portal: Shattrath
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "32267"}, --Portal: Silvermoon
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "49361"}, --Portal: Stonard
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "10059"}, --Portal: Stormwind
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "49360"}, --Portal: Theramore
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "11420"}, --Portal: Thunder Bluff
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "11418"}, --Portal: Undercity
}
},
{
["Name"] = "Warlock",
["Actions"] = {
--WARLOCK
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "126"}, --Eye of Kilrogg
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "5500"}, --Sense Demons
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "5697"}, --Unending Breathe
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "132"}, --Detect Invisability
 
--Buffs
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "696"}, --Demon Skin
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "47889"}, --Demon Armor
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "47893"}, --Felarmor
}
},
{
["Name"] = "Stones",
["Actions"] = {
--Soul shards
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "6366"}, --Create Firestone
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "6201"}, --Create Healthstone
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "2362"}, --Create Spellstone
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "47884"}, --Create Soulstone
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "29893"}, --Ritual of Souls
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "698"}, --Ritual of Summoning
}
},
{
["Name"] = "Minons",
["Actions"] = {
--Minions
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "691"}, --Summon Felhunter
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "30146"}, --Summon Felguard
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "712"}, --Summon Succubus
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "697"}, --Summon Voidwalker
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "688"}, --Summon Imp
}
},
{
["Name"] = "Hunter",
["Actions"] = {
--HUNTER
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "13161"}, --Aspect of the Beast
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "5118"}, --Aspect of the Cheetah
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "61846"}, --Aspect of the Dragonhawk
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "13165"}, --Aspect of the Hawk
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "13163"}, --Aspect of the Monkey
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "13159"}, --Aspect of the Pack
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "34074"}, --Aspect of the Viper
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "20043"}, --Aspect of the Wild
}
},
{
["Name"] = "Tracking",
["Actions"] = {
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "1494"}, --Track Beasts
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "19878"}, --Track Demons
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "19879"}, --Track Dragonkin
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "19880"}, --Track Elementals
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "19882"}, --Track Giants
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "19885"}, --Track Hidden
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "19883"}, --Track Humanoids (maybe redundant, it will be covered by the druid spell?)
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "19884"}, --Track Undead
}
},
 
-----------
--RACIALS--
-----------
{
["Name"] = "Racials",
["Actions"] = {
--DRAENEI
 
--DWARF
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "2481"}, --Find Treasure
 
--GNOME
 
--HUMAN
 
--NIGHT ELF
 
--BLOOD ELF
 
--ORC
 
--TAUREN
 
--TROLL
 
--UNDEAD
}
},
 
-----------
--Professions--
-----------
{
["Name"] = "Professions",
["Actions"] = {
--ALCHEMY
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "2259"}, --Alchemy
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "28677"}, --Elixer Master
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "28675"}, --Potion Master
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "28672"}, --Transmutation Master
 
--BLACKSMITHING
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "2018"}, --Blacksmithing
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "9788"}, --Armorsmithing
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "17041"}, --Master Axesmith
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "17040"}, --Master Hammersmith
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "17039"}, --Master Swordsmith
 
--COOKING
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "2550"}, --Cooking
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "818"}, --Basic Campfire
 
--ENCHANTING
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "7411"}, --Enchanting
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "13262"}, --Disenchant
 
--ENGINEERING
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "4036"}, --Engineering
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "20219"}, --Gnomish Engineer
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "20222"}, --Goblin Engineer
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "56273"}, --Wormhole: Gadgetzan
 
--FIRST AID
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "3273"}, --First Aid
 
--FISHING
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "7620"}, --Fishing
 
--HERBALISM
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "2383"}, --Find Herbs
 
--INSCRIPTION
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "45357"}, --Inscription
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "51005"}, --Milling
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "52175"}, --Decipher
 
--JEWELCRAFTING
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "25229"}, --Jewelcrafting
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "31252"}, --Prospecting
 
--LEATHERWORKING
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "2108"}, --Leatherworking
 
--MINING
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "2580"}, --Find Minerals
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "2656"}, --Smelting
 
--SKINNING
 
--TAILORING
{["DA_ActionType"] = "spell",["DA_ActionSubType"] = "spell",["DA_ActionData"] = "3908"}, --Tailoring
}
},
 
-----------
--Home--
-----------
{
["Name"] = "Home",
["Actions"] = {
{["DA_ActionData"] = "6948",["DA_ActionType"] = "item",["DA_ActionSubType"] = "|cffffffff|Hitem:6948:0:0:0:0:0:0:0:80:0|h[Hearthstone]|h|r"},
}
},
 
};
DagAssistConfig.lua
1,4 → 1,4
------------------------------------------------
------------------------------------------------
-- DagAssistConfig --
-- Dagos of Cenarius --
------------------------------------------------
14,12 → 14,12
fraConfig:RegisterForDrag("LeftButton");
fraConfig:SetToplevel(true);
fraConfig:SetMovable(true);
fraConfig:SetSize(384, 512);
fraConfig:SetSize(384, 572);
fraConfig:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 100, -100);
fraConfig:SetClampedToScreen(true);
fraConfig:Hide();
 
local configBackdrop = {
fraConfig.configBackdrop = {
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true,
27,7 → 27,7
edgeSize = 13,
insets = {left = 4, right = 4, top = 4, bottom = 4}
}
fraConfig:SetBackdrop(configBackdrop);
fraConfig:SetBackdrop(fraConfig.configBackdrop);
fraConfig:SetBackdropColor(0, 0, 0, 0.9);
 
fraConfig:SetScript("OnMouseDown",
42,21 → 42,24
end
)
 
local DagAssistLoaded = false;
fraConfig.DagAssistLoaded = false;
fraConfig:SetScript("OnEvent",
function(self, event, ...)
if (event == "ADDON_LOADED") then
local name = ...;
if (name == "DagAssist") then
DagAssistLoaded = true;
fraConfig.DagAssistLoaded = true;
 
if (not DA_Vars) then
DA_Vars = {};
end
if (not DA_Vars.Menu) then
DA_Vars.Menu = {{Name="Default", Actions={}}};
DA_Vars.Menu = DagAssist.LoadDefaultMenu();
end
 
end
elseif (event == "PLAYER_ENTERING_WORLD") then
if (DagAssistLoaded) then
if (fraConfig.DagAssistLoaded) then
fraConfig:UnregisterEvent("PLAYER_ENTERING_WORLD");
DagAssistConfigLoadHeaders();
end
68,31 → 71,98
 
 
--Title
local lblTitle = fraConfig:CreateFontString(nil, "OVERLAY", "NumberFont_Outline_Large");
lblTitle:SetPoint("TOP", fraConfig, "TOP", 0, -2);
lblTitle:SetHeight(25);
lblTitle:SetText("DagAssist Configuration");
fraConfig.lblTitle = fraConfig:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge");
fraConfig.lblTitle:SetPoint("TOPLEFT", fraConfig, "TOPLEFT", 16, -16);
fraConfig.lblTitle:SetHeight(25);
fraConfig.lblTitle:SetText(GetAddOnMetadata("DagAssist", "title").." v"..GetAddOnMetadata("DagAssist", "version"));
 
-- Instructions
fraConfig.lblInstructions = fraConfig:CreateFontString(nil, 'ARTWORK');
fraConfig.lblInstructions:SetFont("Fonts\\FRIZQT__.TTF", 10, nil);
fraConfig.lblInstructions:SetPoint("TOPLEFT", fraConfig.lblTitle, "BOTTOMLEFT", 5, -5);
fraConfig.lblInstructions:SetWidth(340);
fraConfig.lblInstructions:SetJustifyH("LEFT");
fraConfig.lblInstructions:SetText("Please drag abilities/items for the selected menu section to the action slots below. "..
"New sections can be created by typing in the New Section box and pressing Enter.");
fraConfig.lblInstructions:SetTextColor(1,1,1,1);
 
--Set up the group frame
DagAssist.SectionGroup = CreateFrame("Frame", "DA_ConfigFrame", fraConfig);
DagAssist.SectionGroup:EnableMouse(true);
DagAssist.SectionGroup:SetSize(344, 80);
DagAssist.SectionGroup:SetPoint("TOPLEFT", fraConfig, "TOPLEFT", 18, -80);
DagAssist.SectionGroup:SetBackdrop(fraConfig.configBackdrop);
DagAssist.SectionGroup:SetBackdropColor(1, 1, 1, 0.2);
 
--Header list
local cboHeaders = CreateFrame("Frame", "DagAssistConfigHeaderList", fraConfig, "DA_Combobox");
cboHeaders:SetPoint("TOPLEFT", fraConfig, "TOPLEFT", 8, -60)
function cboHeaders:OnClickEvent(selectedItem)
DagAssistConfigSaveSection(cboHeaders.PreviousItem);
fraConfig.cboHeaders = CreateFrame("Frame", "DagAssistConfigHeaderList", fraConfig, "DA_Combobox");
fraConfig.cboHeaders:SetPoint("TOPLEFT", DagAssist.SectionGroup, "TOPLEFT", -5, -20)
function fraConfig.cboHeaders:OnClickEvent(selectedItem)
DagAssistConfigSaveSection(fraConfig.cboHeaders.PreviousItem);
DagAssistConfigLoadSection(selectedItem);
end
 
--Section label
local lblMenuSection = fraConfig:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
lblMenuSection:SetPoint("BOTTOMLEFT", cboHeaders, "TOPLEFT", 18, 0);
lblMenuSection:SetHeight(15);
lblMenuSection:SetText("Sections");
fraConfig.lblMenuSection = DagAssist.SectionGroup:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
fraConfig.lblMenuSection:SetPoint("BOTTOMLEFT", fraConfig.cboHeaders, "TOPLEFT", 18, 0);
fraConfig.lblMenuSection:SetHeight(15);
fraConfig.lblMenuSection:SetText("Section");
fraConfig.lblMenuSection:SetTextColor(1,1,0,1);
 
-- Move up button
fraConfig.btnMoveUp = CreateFrame("Button", "DagAssistConfigMoveUpButton", DagAssist.SectionGroup, "DA_Button2");
fraConfig.btnMoveUp:SetSize(55, 25);
fraConfig.btnMoveUp:SetPoint("TOPLEFT", fraConfig.cboHeaders, "TOPRIGHT", -15, 0);
fraConfig.btnMoveUp:SetText("Up");
fraConfig.btnMoveUp:SetScript("OnClick",
function(self, event, ...)
if (DA_Vars.Menu) then
for index = 1, table.getn(DA_Vars.Menu) do
local sectionData = DA_Vars.Menu[index];
if (sectionData.Name == fraConfig.cboHeaders.SelectedItem) then
if (index ~= 1) then
table.remove(DA_Vars.Menu, index);
table.insert(DA_Vars.Menu, index-1, sectionData);
DagAssistConfigSaveSection(sectionData.Name);
DagAssistConfigLoadHeaders(sectionData.Name);
end
return;
end
end
end
end
)
 
-- Move up button
fraConfig.btnMoveDown = CreateFrame("Button", "DagAssistConfigMoveDownButton", DagAssist.SectionGroup, "DA_Button2");
fraConfig.btnMoveDown:SetSize(55, 25);
fraConfig.btnMoveDown:SetPoint("TOPLEFT", fraConfig.btnMoveUp, "TOPRIGHT", 2, 0);
fraConfig.btnMoveDown:SetText("Down");
fraConfig.btnMoveDown:SetScript("OnClick",
function(self, event, ...)
if (DA_Vars.Menu) then
for index = 1, table.getn(DA_Vars.Menu) do
local sectionData = DA_Vars.Menu[index];
if (sectionData.Name == fraConfig.cboHeaders.SelectedItem) then
if (index ~= table.getn(DA_Vars.Menu)) then
table.remove(DA_Vars.Menu, index);
table.insert(DA_Vars.Menu, index+1, sectionData);
DagAssistConfigSaveSection(sectionData.Name);
DagAssistConfigLoadHeaders(sectionData.Name);
end
return;
end
end
end
end
)
 
--Delete button
local btnDelete = CreateFrame("Button", "DagAssistConfigDeleteButton", fraConfig, "DA_Button2");
btnDelete:SetSize(35, 25);
btnDelete:SetPoint("TOPLEFT", cboHeaders, "TOPRIGHT", -15, 0);
btnDelete:SetText("Del");
btnDelete:SetScript("OnClick",
fraConfig.btnDelete = CreateFrame("Button", "DagAssistConfigDeleteButton", DagAssist.SectionGroup, "DA_Button2");
fraConfig.btnDelete:SetSize(65, 25);
fraConfig.btnDelete:SetPoint("TOPLEFT", fraConfig.btnMoveDown, "TOPRIGHT", 2, 0);
fraConfig.btnDelete:SetText("Delete");
fraConfig.btnDelete:SetScript("OnClick",
function(self, event, ...)
if (DA_Vars.Menu) then
if (table.getn(DA_Vars.Menu) == 1) then
101,7 → 171,7
 
for index = 1, table.getn(DA_Vars.Menu) do
local sectionData = DA_Vars.Menu[index];
if (sectionData.Name == cboHeaders.SelectedItem) then
if (sectionData.Name == fraConfig.cboHeaders.SelectedItem) then
table.remove(DA_Vars.Menu, index);
break;
end
112,16 → 182,16
)
 
--New header editbox
local txtNewHeader = CreateFrame("EditBox", "DagAssistConfigNewHeader", fraConfig, "DA_Editbox");
txtNewHeader:SetSize(150, 25);
txtNewHeader:SetPoint("TOPLEFT", btnDelete, "TOPRIGHT", 5, 0);
txtNewHeader:SetAutoFocus(false);
function txtNewHeader:OnEnterEvent(editText)
fraConfig.txtNewHeader = CreateFrame("EditBox", "DagAssistConfigNewHeader", DagAssist.SectionGroup, "DA_Editbox");
fraConfig.txtNewHeader:SetSize(150, 25);
fraConfig.txtNewHeader:SetPoint("TOPLEFT", fraConfig.cboHeaders, "BOTTOMRIGHT", -45, 5);
fraConfig.txtNewHeader:SetAutoFocus(false);
function fraConfig.txtNewHeader:OnEnterEvent(editText)
if (not DA_Vars.Menu) then
DA_Vars.Menu = {{Name="Default"}};
DA_Vars.Menu = DagAssist.LoadDefaultMenu();
end
 
DagAssistConfigSaveSection(cboHeaders.SelectedItem);
DagAssistConfigSaveSection(fraConfig.cboHeaders.SelectedItem);
 
local newSection = {};
newSection.Name = editText;
135,36 → 205,42
end
 
--New section label
local lblNewSection = fraConfig:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
lblNewSection:SetPoint("BOTTOMLEFT", txtNewHeader, "TOPLEFT", 0, 0);
lblNewSection:SetHeight(15);
lblNewSection:SetText("New Section");
fraConfig.lblNewSection = DagAssist.SectionGroup:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
fraConfig.lblNewSection:SetPoint("RIGHT", fraConfig.txtNewHeader, "LEFT", -5, 0);
fraConfig.lblNewSection:SetHeight(15);
fraConfig.lblNewSection:SetText("New Section");
fraConfig.lblNewSection:SetTextColor(1,1,0,1);
 
--Close button
local btnClose = CreateFrame("Button", "DagAssistConfigDeleteButton", fraConfig, "DA_Button2");
btnClose:SetSize(35, 20);
btnClose:SetPoint("BOTTOMRIGHT", fraConfig, "BOTTOMRIGHT", -10, 10);
btnClose:SetText("OK");
btnClose:SetScript("OnClick",
fraConfig.btnClose = CreateFrame("Button", "DagAssistConfigDeleteButton", fraConfig, "DA_Button2");
fraConfig.btnClose:SetSize(35, 20);
fraConfig.btnClose:SetPoint("BOTTOMRIGHT", fraConfig, "BOTTOMRIGHT", -10, 10);
fraConfig.btnClose:SetText("OK");
fraConfig.btnClose:SetScript("OnClick",
function(self, event, ...)
DagAssistConfigSaveSection(cboHeaders.SelectedItem);
DagAssistConfigSaveSection(fraConfig.cboHeaders.SelectedItem);
fraConfig:Hide();
DagAssist:LoadMenu();
end
)
 
--[[
--Hide minimap button
local chkHideMinimap = CreateFrame("CheckButton", "DagAssistConfigHideMinimapButton", fraConfig, "ChatConfigCheckButtonTemplate");
chkHideMinimap:SetPoint("BOTTOMLEFT", fraConfig, "BOTTOMLEFT", 10, 10);
fraConfig.chkHideMinimap = CreateFrame("CheckButton", "DagAssistConfigHideMinimapButton", fraConfig, "ChatConfigCheckButtonTemplate");
fraConfig.chkHideMinimap:SetPoint("BOTTOMLEFT", fraConfig, "BOTTOMLEFT", 10, 10);
 
--Hide minimap button label
local lblHideButton = fraConfig:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
lblHideButton:SetPoint("LEFT", chkHideMinimap, "RIGHT", 0, 2);
lblHideButton:SetHeight(7);
lblHideButton:SetText("Hide minimap button");
fraConfig.lblHideButton = fraConfig:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
fraConfig.lblHideButton:SetPoint("LEFT", fraConfig.chkHideMinimap, "RIGHT", 0, 2);
fraConfig.lblHideButton:SetHeight(7);
fraConfig.lblHideButton:SetText("Hide minimap button");
--]]
 
function DagAssistRetrieveCursorItem(self, event, ...)
if (InCombatLockdown() == 1) then
return;
end
 
if (GetCursorInfo()) then
local oldActionType, oldActionData, oldActionSubType;
if (self.DA_ActionData) then
225,7 → 301,7
local ret = {};
 
if actionType == "companion" then
local companionID = GetCompanionID(actionSubType, actionData)
local companionID = DagAssistGetCompanionID(actionSubType, actionData)
_, itemName, _, itemTexture, _ = GetCompanionInfo(actionSubType, companionID);
elseif actionType == "equipmentset" then
itemName = actionData;
259,7 → 335,7
 
function DagAssistPickupAction(actionType, actionData, actionSubType)
if actionType == "companion" then
local companionID = GetCompanionID(actionSubType, actionData);
local companionID = DagAssistGetCompanionID(actionSubType, actionData);
PickupCompanion(actionSubType, companionID);
elseif actionType == "equipmentset" then
PickupEquipmentSetByName(actionData);
268,14 → 344,11
elseif actionType == "macro" then
PickupMacro(actionData);
elseif actionType == "spell" then
local spellBookID = GetSpellBookID(actionData, actionSubType);
if (spellBookID) then
PickupSpell(spellBookID, actionSubType);
end
PickupSpell(actionData);
end
end
 
function GetCompanionID(subType, name)
function DagAssistGetCompanionID(subType, name)
local i = 1;
local _, itemName = GetCompanionInfo(subType, i);
 
289,22 → 362,12
end
end
 
function GetSpellBookID(spellID, actionSubType)
local i = 1;
local link = GetSpellLink(i, actionSubType);
 
while (link) do
local absoluteID = string.match(link, "Hspell:([^\124]+)\124");
if (absoluteID == spellID) then
return i;
end
 
i = i + 1;
link = GetSpellLink(i, actionSubType);
end
end
 
function DagAssistOnDragStart(self, event, ...)
if (InCombatLockdown() == 1) then
return;
end
 
local cursorType, cursorData, cursorSubType;
if (GetCursorInfo()) then
cursorType, cursorData, cursorSubType = GetCursorInfo();
324,22 → 387,23
 
 
--Items label
local lblMenuItems = fraConfig:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
lblMenuItems:SetPoint("TOPLEFT", fraConfig, "TOPLEFT", 40, -125);
lblMenuItems:SetHeight(15);
lblMenuItems:SetText("Drag Actions Below:");
fraConfig.lblMenuItems = fraConfig:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
fraConfig.lblMenuItems:SetPoint("TOPLEFT", fraConfig, "TOPLEFT", 40, -165);
fraConfig.lblMenuItems:SetHeight(15);
fraConfig.lblMenuItems:SetText("Drag Actions Below");
fraConfig.lblMenuItems:SetTextColor(1,1,0,1);
 
--Menu items
local previousMenuItem = nil;
local configButtons = {};
fraConfig.previousMenuItem = nil;
fraConfig.configButtons = {};
for index = 1, 15 do
local currentItem = CreateFrame("Button", "DagAssistMenuItem"..index, fraConfig, "DAConfig_MenuButtonTemplate");
table.insert(configButtons, currentItem);
table.insert(fraConfig.configButtons, currentItem);
currentItem:SetBackdropColor(1, 0, 0, 0.5);
if (previousMenuItem) then
currentItem:SetPoint("TOPLEFT", previousMenuItem, "BOTTOMLEFT");
if (fraConfig.previousMenuItem) then
currentItem:SetPoint("TOPLEFT", fraConfig.previousMenuItem, "BOTTOMLEFT");
else
currentItem:SetPoint("TOPLEFT", fraConfig, "TOPLEFT", 50, -150);
currentItem:SetPoint("TOPLEFT", fraConfig, "TOPLEFT", 50, -185);
end
 
currentItem.Icon = currentItem:CreateTexture("DagAssistMenuItemIcon"..index, "OVERLAY");
351,7 → 415,7
currentItem:SetScript("OnReceiveDrag", DagAssistRetrieveCursorItem);
currentItem:SetScript("OnClick", DagAssistRetrieveCursorItem);
 
previousMenuItem = currentItem;
fraConfig.previousMenuItem = currentItem;
end
 
function DagAssistConfigSaveSection(section)
363,8 → 427,8
if (sectionData.Name == section) then
sectionData.Actions = {};
 
for actionIndex = 1, table.getn(configButtons) do
local configButton = configButtons[actionIndex];
for actionIndex = 1, table.getn(fraConfig.configButtons) do
local configButton = fraConfig.configButtons[actionIndex];
if (configButton.DA_ActionData) then
local saveData = {};
saveData.DA_ActionType = configButton.DA_ActionType;
397,11 → 461,11
 
table.insert(headers, sectionData.Name);
end
cboHeaders.AddRange(headers);
fraConfig.cboHeaders.AddRange(headers);
 
UIDropDownMenu_SetSelectedID(cboHeaders, selectedIndex);
cboHeaders.PreviousItem = cboHeaders.SelectedItem;
cboHeaders.SelectedItem = selectedHeader;
UIDropDownMenu_SetSelectedID(fraConfig.cboHeaders, selectedIndex);
fraConfig.cboHeaders.PreviousItem = fraConfig.cboHeaders.SelectedItem;
fraConfig.cboHeaders.SelectedItem = selectedHeader;
 
DagAssistConfigLoadSection(selectedHeader);
end
409,8 → 473,8
 
function DagAssistConfigLoadSection(section)
if (DA_Vars.Menu) then
for index = 1, table.getn(configButtons) do
local configButton = configButtons[index];
for index = 1, table.getn(fraConfig.configButtons) do
local configButton = fraConfig.configButtons[index];
DagAssistClearConfigButtonAction(configButton);
end
 
419,7 → 483,7
if (sectionData.Name == section) then
if (sectionData.Actions) then
for actionIndex = 1, table.getn(sectionData.Actions) do
local configButton = configButtons[actionIndex];
local configButton = fraConfig.configButtons[actionIndex];
local saveData = sectionData.Actions[actionIndex];
DagAssistAssignConfigButtonAction(configButton, saveData.DA_ActionType, saveData.DA_ActionData, saveData.DA_ActionSubType);
end
432,7 → 496,7
 
function DagAssistConfigFrame_Toggle()
if ( DagAssist.Config:IsVisible() ) then
DagAssistConfigSaveSection(cboHeaders.SelectedItem);
DagAssistConfigSaveSection(fraConfig.cboHeaders.SelectedItem);
DagAssist.Config:Hide();
else
DagAssist.Config:Show();
DagAssist.lua
15,6 → 15,26
end
end
 
-- Setup slash command for resetting variables and position
SLASH_DAGASSIST1, SLASH_DAGASSIST2 = '/dagassist', '/da';
function DagAssist.SlashHandler(msg, editbox)
local title = GetAddOnMetadata("DagAssist", "title").." v"..GetAddOnMetadata("DagAssist", "version");
if msg == 'reset' then
if (InCombatLockdown() == 1) then
print("<"..title.."> Reset cannot be completed in combat!");
else
DA_Vars = {Minimap = {}};
DagAssist.LoadMenu();
DagAssistConfigLoadHeaders();
DagAssist:PositionMinimapButton();
print("<"..title.."> Reset complete");
end
else
print("<"..title.."> Usage: /da [reset]");
end
end
SlashCmdList["DAGASSIST"] = DagAssist.SlashHandler;
 
--Set up the minimap button
DagAssist.MinimapButton = CreateFrame("Button", "DA_Minimap", Minimap, "SecureHandlerClickTemplate, DA_MinimapButton");
local btnMinimap = DagAssist.MinimapButton;
34,13 → 54,15
btnMinimap:SetFrameRef("dag_menu", DagAssist.Menu);
 
--Pressing ESC will close the menu out of combat
-- tinsert(UISpecialFrames,DagAssist.Menu:GetName()); --http://forums.wowace.com/showthread.php?t=17709
-- DagAssist.Menu.HideOld = DagAssist.Menu.Hide;
-- DagAssist.Menu.Hide = function(self)
-- if (InCombatLockdown() ~= 1) then
-- DagAssist.Menu:HideOld();
-- end
-- end
tinsert(UISpecialFrames,DagAssist.Menu:GetName()); --http://forums.wowace.com/showthread.php?t=17709
DagAssist.Menu.IsShownOld = DagAssist.Menu.IsShown;
DagAssist.Menu.IsShown = function(self, ...)
if (InCombatLockdown() == 1) then
return false;
else
return DagAssist.Menu:IsShownOld();
end
end
DagAssist.Menu:Hide();
 
btnMinimap:Execute([[
128,11 → 150,14
end)
btnMinimap:RegisterEvent("PLAYER_ENTERING_WORLD");
 
function DagAssist:PLAYER_ENTERING_WORLD(event)
function DagAssist:PositionMinimapButton()
if (not DA_Vars) then
DA_Vars = {Minimap = {}};
end
 
if (not DA_Vars.Minimap) then
DA_Vars.Minimap = {};
end
 
if (DA_Vars.Minimap.X and DA_Vars.Minimap.Y) then
--Restore last position
local s = btnMinimap:GetEffectiveScale();
140,9 → 165,13
btnMinimap:ClearAllPoints()
btnMinimap:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", DA_Vars.Minimap.X / s, DA_Vars.Minimap.Y /s);
else
btnMinimap:ClearAllPoints()
btnMinimap:SetPoint("CENTER", Minimap, "BOTTOMLEFT", 15, 15);
end
 
end
 
function DagAssist:PLAYER_ENTERING_WORLD(event)
DagAssist:PositionMinimapButton();
DagAssist:LoadMenu();
DagAssist.MinimapButton:Show();
 
169,7 → 198,7
 
local menu = DagAssist.Menu;
if (not DA_Vars.Menu) then
DA_Vars.Menu = {{Name="Default", Actions={}}};
DA_Vars.Menu = DagAssist.LoadDefaultMenu()
end
local menuItems = DA_Vars.Menu;
local btnMenuItem;
208,7 → 237,7
if (IsMounted()) then
Dismount();
else
local companionID = GetCompanionID(self.Action.DA_ActionSubType, self.Action.DA_ActionData);
local companionID = DagAssistGetCompanionID(self.Action.DA_ActionSubType, self.Action.DA_ActionData);
CallCompanion(self.Action.DA_ActionSubType, companionID);
end
end);
ChangeLog.txt
2,6 → 2,15
-- DagAssist --
-- Dagos of Cenarius --
------------------------------------------------
4.03
* Added instructions to the configuration panel
* Added move up/down buttons to the section editor
* Pressing ESC will now close the menu except while in combat
* Menu items are prepopulated with some defaults when first installed
* Fixed bug preventing the pickup of spells once placed in the menu
* Fixed taint issue if you tried to change the menu items while in combat
* Added "/dagassist reset" command line to reset the menu to defaults
 
4.01
* Configurable!
 
. Property changes : Added: svn:mergeinfo Merged /branches/4.03:r3-8