Skip to content

Commit

Permalink
Version Bump for Wrath + Changes from Discord
Browse files Browse the repository at this point in the history
- Updated TOC versions and Packaging for Wrath
- Added Fix from the Druid Discord regarding the spell queue window
  • Loading branch information
Jens N committed Nov 20, 2022
1 parent d12e98f commit aa8f00b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 93 deletions.
3 changes: 2 additions & 1 deletion .pkgmeta-bcc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package-as: DruidMacroHelper

ignore:
- README.md
- README.md
- pkgmeta.yaml
3 changes: 2 additions & 1 deletion .pkgmeta-classic
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package-as: DruidMacroHelper

ignore:
- README.md
- README.md
- pkgmeta.yaml
5 changes: 5 additions & 0 deletions .pkgmeta-wrath
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package-as: DruidMacroHelper

ignore:
- README.md
- pkgmeta.yaml
100 changes: 12 additions & 88 deletions DruidMacroHelper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -34,14 +27,16 @@ function DruidMacroHelper:Init()
self:RegisterSlashAction('charge', 'OnSlashCharge', '|cffffff00<unit|target|mouseover|targettarget|arena1 ...>|r Disable autoUnshift if unit is in range of Feral Charge');
self:RegisterSlashAction('innervate', 'OnSlashInnervate', '|cffffff00<unit>|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(...)
Expand Down Expand Up @@ -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!");
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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');
Expand All @@ -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 "<Button "..name.." not defined>";
end
local b = _G[name];
if not b then
return "<Button "..name.." not found>";
end
return b:GetAttribute('macrotext');
end

function DruidMacroHelper:UpdateButton(name, macrotext, description)
if not self.buttons or not self.buttons[name] then
return;
end
local b = _G[name];
if macrotext then
b:SetAttribute('macrotext', macrotext);
end
if description then
self.buttons[name] = description;
end
end

function DruidMacroHelper:UpdateForms()
self:UpdateButton('dmhEnd', self:GetMacroText('dmhEnd'));
end

function DruidMacroHelper:RegisterCondition(shortcut, itemId)
if not self.itemShortcuts then
self.itemShortcuts = {};
Expand Down Expand Up @@ -449,9 +377,5 @@ function DruidMacroHelper:RegisterSlashCommand(cmd)
end
end

function DruidMacroHelper:RegisterEvent(event)
self.Frame:RegisterEvent(event);
end

-- Kickstart the addon
DruidMacroHelper:Init();
7 changes: 4 additions & 3 deletions DruidMacroHelper.toc
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
## Interface: 90200
## Interface-Classic: 11402
## Interface: 90207
## Interface-Classic: 11403
## Interface-BCC: 20504
## Interface-Wrath: 30400
## Title: DruidMacroHelper
## Version: 1.2.1
## Version: 1.2.2
## Author: Mylaerla-Everlook
## Notes: Helper-Functions for creating efficient druid macros
## X-Curse-Project-ID: 515355
Expand Down

0 comments on commit aa8f00b

Please sign in to comment.