diff --git a/.pkgmeta-bcc b/.pkgmeta-bcc index 975dbb7..176a8be 100644 --- a/.pkgmeta-bcc +++ b/.pkgmeta-bcc @@ -1,4 +1,5 @@ package-as: DruidMacroHelper ignore: - - README.md \ No newline at end of file + - README.md + - pkgmeta.yaml \ No newline at end of file diff --git a/.pkgmeta-classic b/.pkgmeta-classic index 975dbb7..176a8be 100644 --- a/.pkgmeta-classic +++ b/.pkgmeta-classic @@ -1,4 +1,5 @@ package-as: DruidMacroHelper ignore: - - README.md \ No newline at end of file + - README.md + - pkgmeta.yaml \ No newline at end of file diff --git a/.pkgmeta-wrath b/.pkgmeta-wrath new file mode 100644 index 0000000..a47fe73 --- /dev/null +++ b/.pkgmeta-wrath @@ -0,0 +1,5 @@ +package-as: DruidMacroHelper + +ignore: + - README.md + - pkgmeta.yaml diff --git a/DruidMacroHelper.lua b/DruidMacroHelper.lua index 02222d0..c379fce 100755 --- a/DruidMacroHelper.lua +++ b/DruidMacroHelper.lua @@ -6,13 +6,6 @@ local DRUID_MACRO_HELPER_LOC_STUN = { "STUN", "STUN_MECHANIC", "FEAR", "CHARM", DruidMacroHelper = {}; function DruidMacroHelper:Init() - self.ChatThrottle = nil; - self.Frame = _G["DruidMacroHelperFrame"] or CreateFrame('Frame', 'DruidMacroHelperFrame'); - self.Frame:SetScript("OnEvent", function(...) - self:OnEvent(...); - end); - self.SpellQueueWindow = 400; - self:RegisterEvent("PLAYER_ENTERING_WORLD"); self:RegisterItemShortcut("pot", 13446); self:RegisterItemShortcut("potion", 13446); self:RegisterItemShortcut("hs", 20520); @@ -34,14 +27,16 @@ function DruidMacroHelper:Init() self:RegisterSlashAction('charge', 'OnSlashCharge', '|cffffff00|r Disable autoUnshift if unit is in range of Feral Charge'); self:RegisterSlashAction('innervate', 'OnSlashInnervate', '|cffffff00|r Cast Innervate on the given unit and notify it via whisper'); self:RegisterSlashAction('debug', 'OnSlashDebug', '|cffffff00on/off|r Enable or disable debugging output'); - self:CreateButton('dmhStart', self:GetMacroText('dmhStart'), 'Change actionbar based on the current form. (includes /dmh start)'); - self:CreateButton('dmhBar', self:GetMacroText('dmhBar'), 'Change actionbar based on the current form. (without /dmh start)'); - self:CreateButton('dmhReset', self:GetMacroText('dmhReset'), 'Change actionbar back to 1.'); - self:CreateButton('dmhEnd', self:GetMacroText('dmhEnd'), 'Change back to form based on the current bar. (includes /dmh end)'); - self:CreateButton('dmhPot', self:GetMacroText('dmhPot'), 'Disable autoUnshift if not ready to use a potion'); - self:CreateButton('dmhHs', self:GetMacroText('dmhHs'), 'Disable autoUnshift if not ready to use a healthstone'); - self:CreateButton('dmhSap', self:GetMacroText('dmhSap'), 'Disable autoUnshift if not ready to use a sapper'); - self:CreateButton('dmhSuperSap', self:GetMacroText('dmhSuperSap'), 'Disable autoUnshift if not ready to use a super sapper'); + self:CreateButton('dmhStart', '/changeactionbar [noform]1;[form:1]2;[form:3]3;[form:4]4;[form:5]5;6;\n/dmh start', 'Change actionbar based on the current form. (includes /dmh start)'); + self:CreateButton('dmhBar', '/changeactionbar [noform]1;[form:1]2;[form:3]3;[form:4]4;[form:5]5;6;', 'Change actionbar based on the current form. (without /dmh start)'); + self:CreateButton('dmhReset', '/changeactionbar 1', 'Change actionbar back to 1.'); + self:CreateButton('dmhEnd', '/use [bar:2]!'..L["FORM_DIRE_BEAR"]..';[bar:3]!'..L["FORM_CAT"]..';[bar:4]!'..L["FORM_TRAVEL"]..'\n/click dmhReset\n/dmh end', 'Change back to form based on the current bar. (includes /dmh end)'); + self:CreateButton('dmhPot', '/dmh cd pot\n/dmh start', 'Disable autoUnshift if not ready to use a potion'); + self:CreateButton('dmhHs', '/dmh cd hs\n/dmh start', 'Disable autoUnshift if not ready to use a healthstone'); + self:CreateButton('dmhSap', '/dmh cd sapper\n/dmh start', 'Disable autoUnshift if not ready to use a sapper'); + self:CreateButton('dmhSuperSap', '/dmh cd supersapper\n/dmh start', 'Disable autoUnshift if not ready to use a super sapper'); + self.ChatThrottle = nil + self.SpellQueueWindow = 400 end function DruidMacroHelper:LogOutput(...) @@ -73,16 +68,6 @@ function DruidMacroHelper:ChatMessageThrottleUnit(message, unit) end end -function DruidMacroHelper:OnEvent(frame, event, ...) - if (event == "PLAYER_ENTERING_WORLD") then - self:UpdateForms(); - elseif (event == "LEARNED_SPELL_IN_TAB") then - self:UpdateForms(); - else - self:LogDebug("Unhandled Event:", event, ...); - end -end - function DruidMacroHelper:OnSlashCommand(parameters) if not self.slashActions then self:LogOutput("No slash actions registered!"); @@ -130,8 +115,8 @@ function DruidMacroHelper:OnSlashStart(parameters) self:OnSlashMana(parameters); self:OnSlashCooldown(parameters); - if GetCVar("autoUnshift") == 1 then - self:LogOutput("Setting SpellQueueWindow to 0") + if GetCVar("autoUnshift") == "1" then + self:LogDebug("Setting SpellQueueWindow to 0") self.SpellQueueWindow = GetCVar("SpellQueueWindow"); SetCVar("SpellQueueWindow", 0); end @@ -268,7 +253,6 @@ function DruidMacroHelper:OnSlashDebug(parameters) end if self.debug then self:LogOutput("Debug output enabled"); - self:LogDebug("Button 'dmhEnd' macrotext:\n"..self:GetButtonMacroText('dmhEnd')); else self:LogOutput("Debug output disabled"); end @@ -332,34 +316,6 @@ function DruidMacroHelper:IsItemOnCooldown(itemNameOrId) return (GetItemCooldown(itemId) > 0); end -function DruidMacroHelper:GetMacroText(buttonName) - if buttonName == 'dmhStart' then - return '/changeactionbar [noform]1;[form:1]2;[form:3]3;[form:4]4;[form:5]5;6;\n/dmh start'; - elseif buttonName == 'dmhBar' then - return '/changeactionbar [noform]1;[form:1]2;[form:3]3;[form:4]4;[form:5]5;6;'; - elseif buttonName == 'dmhReset' then - return '/changeactionbar 1'; - elseif buttonName == 'dmhEnd' then - local spellBear = L["FORM_DIRE_BEAR"]; - if not GetSpellInfo(spellBear) then - spellBear = L["FORM_BEAR"]; - end - local spellCat = L["FORM_CAT"]; - local spellTravel = L["FORM_TRAVEL"]; - return '/use [bar:2]!'..spellBear..';[bar:3]!'..spellCat..';[bar:4]!'..spellTravel..'\n/click dmhReset\n/dmh end'; - elseif buttonName == 'dmhPot' then - return '/dmh cd pot\n/dmh start'; - elseif buttonName == 'dmhHs' then - return '/dmh cd hs\n/dmh start'; - elseif buttonName == 'dmhSap' then - return '/dmh cd sapper\n/dmh start'; - elseif buttonName == 'dmhSuperSap' then - return '/dmh cd supersapper\n/dmh start'; - else - return ''; - end -end - function DruidMacroHelper:CreateButton(name, macrotext, description) local b = _G[name] or CreateFrame('Button', name, nil, 'SecureActionButtonTemplate,SecureHandlerBaseTemplate'); b:SetAttribute('type', 'macro'); @@ -373,34 +329,6 @@ function DruidMacroHelper:CreateButton(name, macrotext, description) self.buttons[name] = description; end -function DruidMacroHelper:GetButtonMacroText(name) - if not self.buttons or not self.buttons[name] then - return "