Merged Release 1.0.2 into master

also fixed destroy bar sound
Cette révision appartient à :
Albirew 2020-12-29 17:34:25 +01:00
Parent 89fad344be
révision 183479263c
9 fichiers modifiés avec 100 ajouts et 44 suppressions

Voir le fichier

@ -534,8 +534,7 @@ function Bar:Configure(BarSave)
self:SetAlpha(BarSave["Alpha"]); self:SetAlpha(BarSave["Alpha"]);
self:SetGUI(BarSave["GUI"]); self:SetGUI(BarSave["GUI"]);
-- Uncomment this once Clamp insets are working again self.ControlFrame:SetClampedToScreen(true);
--self.ControlFrame:SetClampedToScreen(true);
end end
--[[ --[[
@ -1105,6 +1104,7 @@ end
--]] --]]
function Bar:DestroyBar() function Bar:DestroyBar()
if (not InCombatLockdown()) then if (not InCombatLockdown()) then
PlaySoundFile("sound/spells/meltoretarget.ogg"); --PlaySoundFile(569366)
Util.DeallocateBar(self); Util.DeallocateBar(self);
end end
UILib.ToggleDestroyBarMode(true); UILib.ToggleDestroyBarMode(true);

Voir le fichier

@ -1136,7 +1136,7 @@ function Button:SetAttributes(Type, Value)
self.Widget:SetAttribute("spell", Value); self.Widget:SetAttribute("spell", Value);
elseif (Type == "customaction") then elseif (Type == "customaction") then
CustomAction.SetAttributes(Value, self.Widget); CustomAction.SetAttributes(Value, self.Widget);
end end
end end
@ -1397,6 +1397,8 @@ function Button:UpdateCheckedCustomAction()
end end
--[[--------------------------------------------------------------------------------------- --[[---------------------------------------------------------------------------------------
Equipped functions Equipped functions
-----------------------------------------------------------------------------------------]] -----------------------------------------------------------------------------------------]]
@ -1478,6 +1480,7 @@ function Button:UpdateCooldownBonusAction()
end end
--[[------------------------------------------------------------------------------------- --[[-------------------------------------------------------------------------------------
Usable Functions Usable Functions
---------------------------------------------------------------------------------------]] ---------------------------------------------------------------------------------------]]
@ -1718,6 +1721,8 @@ function Button:UpdateTooltipCustomAction()
end end
--[[--------------------------------------------------------------------- --[[---------------------------------------------------------------------
Cursor functions Cursor functions
-----------------------------------------------------------------------]] -----------------------------------------------------------------------]]
@ -1750,6 +1755,8 @@ function Button:GetCursorCustomAction()
end end
--[[------------------------------------------------------------------------ --[[------------------------------------------------------------------------
Flash functions Flash functions
--------------------------------------------------------------------------]] --------------------------------------------------------------------------]]

Voir le fichier

@ -1,8 +1,8 @@
## Interface: 11306 ## Interface: 11306
## Title: Button Forge (Classic) ## Title: Button Forge |cff69ccf0(Classic)|r
## Notes: Add as many or few extra Action Bars and Buttons to your user interface to complement the standard (or other) Action Bars ## Notes: Add as many or few extra Action Bars and Buttons to your user interface to complement the standard (or other) Action Bars
## Version: 0.9.50.4 ## Version: 1.0.2-classic
## Author: Massiner of Nathrezim ## Author: Massiner of Nathrezim, Albirew
## SavedVariables: ButtonForgeGlobalSettings, ButtonForgeGlobalProfiles, ButtonForgeGlobalBackup ## SavedVariables: ButtonForgeGlobalSettings, ButtonForgeGlobalProfiles, ButtonForgeGlobalBackup
## SavedVariablesPerCharacter: ButtonForgeSave ## SavedVariablesPerCharacter: ButtonForgeSave
## OptionalDeps: Masque ## OptionalDeps: Masque

Voir le fichier

@ -9,8 +9,8 @@
local Const = BFConst; local Const = BFConst;
Const.SUMMON_RANDOM_FAVORITE_MOUNT_SPELL = 150544; Const.SUMMON_RANDOM_FAVORITE_MOUNT_SPELL = 150544;
Const.SUMMON_RANDOM_FAVORITE_MOUNT_ID = 268435455; Const.SUMMON_RANDOM_FAVORITE_MOUNT_ID = 268435455;
Const.Version = 0.9; Const.Version = 1.0;
Const.VersionMinor = 50; Const.VersionMinor = 0.2;
Const.MAX_ACCOUNT_MACROS = 120; Const.MAX_ACCOUNT_MACROS = 120;
Const.ButtonNaming = "ButtonForge" Const.ButtonNaming = "ButtonForge"
Const.ButtonSeq = 1; --This value will increment (so not technically a const...) Const.ButtonSeq = 1; --This value will increment (so not technically a const...)
@ -90,15 +90,16 @@ Const.DarkOrange = "ffEE5500";
Const.SlashCommands = {}; Const.SlashCommands = {};
Const.SlashCommands["-bar"] = {params = "^%s*(..-)%s*$", group = "bar"}; Const.SlashCommands["-bar"] = {params = "^%s*(..-)%s*$", group = "bar"};
Const.SlashCommands["-list"] = {params = "^()$", incompat = {"ALL"}};
Const.SlashCommands["-macrotext"] = {params = "bool", group = "bar"}; Const.SlashCommands["-macrotext"] = {params = "bool", group = "bar"};
Const.SlashCommands["-keybindtext"] = {params = "bool", group = "bar"}; Const.SlashCommands["-keybindtext"] = {params = "bool", group = "bar"};
Const.SlashCommands["-tooltips"] = {params = "bool", group = "bar"}; Const.SlashCommands["-tooltips"] = {params = "bool", group = "bar"};
Const.SlashCommands["-emptybuttons"] = {params = "bool", group = "bar"}; Const.SlashCommands["-emptybuttons"] = {params = "bool", group = "bar"};
Const.SlashCommands["-lockbuttons"] = {params = "bool", group = "bar"}; Const.SlashCommands["-lockbuttons"] = {params = "bool", group = "bar"};
Const.SlashCommands["-scale"] = {params = "^%s*(%d*%.?%d+)%s*$", group = "bar"}; Const.SlashCommands["-scale"] = {params = "^%s*(%d*%.?%d+)%s*$", group = "bar"};
Const.SlashCommands["-rows"] = {params = "^%s*(%d+)%s*$", group = "bar", requires = {"-bar"}}; Const.SlashCommands["-rows"] = {params = "^%s*(%d+)%s*$", group = "bar", requires = {"-createbar", "-bar"}};
Const.SlashCommands["-cols"] = {params = "^%s*(%d+)%s*$", group = "bar", requires = {"-bar"}}; Const.SlashCommands["-cols"] = {params = "^%s*(%d+)%s*$", group = "bar", requires = {"-createbar", "-bar"}};
Const.SlashCommands["-coords"] = {params = "^%s*(%d*%.?%d+)%s*,?%s*(%d*%.?%d+)%s*$", group = "bar", requires = {"-bar"}}; Const.SlashCommands["-coords"] = {params = "^%s*(%d*%.?%d+)%s*,?%s*(%d*%.?%d+)%s*$", group = "bar", requires = {"-createbar", "-bar"}};
Const.SlashCommands["-gap"] = {params = "^%s*(%d*%.?%d+)%s*$", group = "bar"}; Const.SlashCommands["-gap"] = {params = "^%s*(%d*%.?%d+)%s*$", group = "bar"};
Const.SlashCommands["-enabled"] = {params = "bool", group = "bar"}; Const.SlashCommands["-enabled"] = {params = "bool", group = "bar"};
Const.SlashCommands["-info"] = {params = "^()$", group = "bar", requires = {"-bar"}}; Const.SlashCommands["-info"] = {params = "^()$", group = "bar", requires = {"-bar"}};

Voir le fichier

@ -1,18 +1,18 @@
--[[ --[[
Author: Alternator (Massiner of Nathrezim) Author: Alternator (Massiner of Nathrezim)
Copyright 2010 Copyright 2010
Notes: Notes:
]] ]]
BFLocales = {}; BFLocales = {};
BFConst = {}; BFConst = {};
BFUtil = {}; BFUtil = {};
BFUILib = {}; BFUILib = {};
BFButton = {}; BFButton = {};
BFBar = {}; BFBar = {};
BFCustomAction = {}; BFCustomAction = {};
ButtonForge_API1 = {}; ButtonForge_API1 = {};
ButtonForgeSave = {}; ButtonForgeSave = {};
@ -20,3 +20,4 @@ ButtonForgeSave = {};
ButtonForgeGlobalSettings = {}; ButtonForgeGlobalSettings = {};
ButtonForgeGlobalProfiles = {}; ButtonForgeGlobalProfiles = {};
ButtonForgeGlobalBackup = {}; ButtonForgeGlobalBackup = {};

Voir le fichier

@ -455,6 +455,13 @@ function Misc:OnEvent(Event, ...)
-- self.TalentSwap = true; -- self.TalentSwap = true;
-- self:SetScript("OnUpdate", self.OnUpdate); -- self:SetScript("OnUpdate", self.OnUpdate);
-- elseif (Event == "COMPANION_LEARNED") then
-- Util.CacheCompanions();
-- Util.RefreshCompanions();
-- elseif (Event == "EQUIPMENT_SETS_CHANGED") then
-- Util.RefreshEquipmentSets();
elseif (Event == "PLAYER_REGEN_DISABLED") then elseif (Event == "PLAYER_REGEN_DISABLED") then
Util.PreCombatStateUpdate(); Util.PreCombatStateUpdate();

Voir le fichier

@ -36,6 +36,9 @@
BFKeyBinder.OnInputBindingOverlay("MOUSEWHEELDOWN"); BFKeyBinder.OnInputBindingOverlay("MOUSEWHEELDOWN");
end end
</OnMouseWheel> </OnMouseWheel>
<OnGamePadButtonDown>
BFKeyBinder.OnInputBindingOverlay(button);
</OnGamePadButtonDown>
</Scripts> </Scripts>
</Frame> </Frame>

Voir le fichier

@ -88,6 +88,7 @@ Locale["SlashHelpFormatted"] =
"Valid slash commands: |c"..Const.LightBlue.."/buttonforge|r, |c"..Const.LightBlue.."/bufo|r\n".. "Valid slash commands: |c"..Const.LightBlue.."/buttonforge|r, |c"..Const.LightBlue.."/bufo|r\n"..
"Valid switches:\n".. "Valid switches:\n"..
"|c"..Const.LightBlue.."-bar <bar name>|r (the bar to apply changes to, or if not set then all bars)\n".. "|c"..Const.LightBlue.."-bar <bar name>|r (the bar to apply changes to, or if not set then all bars)\n"..
"|c"..Const.LightBlue.."-list|r\n"..
"|c"..Const.LightBlue.."-rename <new name>|r\n".. "|c"..Const.LightBlue.."-rename <new name>|r\n"..
"|c"..Const.LightBlue.."-rows <number>|r\n".. "|c"..Const.LightBlue.."-rows <number>|r\n"..
"|c"..Const.LightBlue.."-cols <number>|r\n".. "|c"..Const.LightBlue.."-cols <number>|r\n"..
@ -134,6 +135,8 @@ Locale["SlashHelpFormatted"] =
Locale["SlashCommandRequired"] = "<COMMANDA> requires <COMMANDB> to also be specified"; Locale["SlashCommandRequired"] = "<COMMANDA> requires <COMMANDB> to also be specified";
Locale["SlashCommandIncompatible"] = "<COMMANDA> is incompatible with <COMMANDB>"; Locale["SlashCommandIncompatible"] = "<COMMANDA> is incompatible with <COMMANDB>";
Locale["SlashCommandAlone"] = "<COMMANDA> cannot be used with other commands"; Locale["SlashCommandAlone"] = "<COMMANDA> cannot be used with other commands";
Locale["SlashListBarWithLabel"] = "- <LABEL> |c"..Const.LightBlue.." Examples: /bufo -bar <LABEL> -info";
Locale["SlashListBarWithIndex"] = "- <LABEL> (No label set, use Index) |c"..Const.LightBlue.." Examples: /bufo -bar <LABEL> -info";
Locale["SlashBarNameRequired"] = Locale["SlashBarNameRequired"] =
[[ButtonForge slash command failed: [[ButtonForge slash command failed:

Voir le fichier

@ -105,7 +105,7 @@ function Util.UpdateSavedData()
------The following section updates the per character saved data------ ------The following section updates the per character saved data------
--Need to allocate save structure --Need to allocate save structure
if (not ButtonForgeSave or ButtonForgeSave["Version"] == nil ) then if (not ButtonForgeSave or ButtonForgeSave["Version"] == nil) then
--Swap v0.9.0 / v0.9.1 / v0.9.2 users to the new save structure --Swap v0.9.0 / v0.9.1 / v0.9.2 users to the new save structure
ButtonForgeSave = {}; ButtonForgeSave = {};
ButtonForgeSave["ConfigureMode"] = true; ButtonForgeSave["ConfigureMode"] = true;
@ -168,6 +168,12 @@ function Util.UpdateSavedData()
DEFAULT_CHAT_FRAME:AddMessage(Util.GetLocaleString("UpgradedChatMsg").."v0.9.22", .5, 1, 0, 1); DEFAULT_CHAT_FRAME:AddMessage(Util.GetLocaleString("UpgradedChatMsg").."v0.9.22", .5, 1, 0, 1);
end end
--v0.9.25 update
if (ButtonForgeSave["Version"] == 0.9 and ButtonForgeSave["VersionMinor"] < 25) then
ButtonForgeSave["VersionMinor"] = 25;
DEFAULT_CHAT_FRAME:AddMessage(Util.GetLocaleString("UpgradedChatMsg").."v0.9.25", .5, 1, 0, 1);
end
-- v0.9.34 update -- v0.9.34 update
if (ButtonForgeSave["Version"] == 0.9 and ButtonForgeSave["VersionMinor"] < 34) then if (ButtonForgeSave["Version"] == 0.9 and ButtonForgeSave["VersionMinor"] < 34) then
for i = 1, #ButtonForgeSave.Bars do for i = 1, #ButtonForgeSave.Bars do
@ -420,8 +426,6 @@ function Util.Load()
Util.StartMacroCheckDelay(); Util.StartMacroCheckDelay();
Util.RefreshOnUpdateFunction(); Util.RefreshOnUpdateFunction();
SLASH_BUTTONFORGE1 = Util.GetLocaleString("SlashButtonForge1"); -- = "/buttonforge"; --these two identifiers probably shouldn't change, but if need be they can be?!
SLASH_BUTTONFORGE2 = Util.GetLocaleString("SlashButtonForge2"); -- = "/bufo";
collectgarbage("collect"); collectgarbage("collect");
Util.CallbackEvent("INITIALISED"); Util.CallbackEvent("INITIALISED");
end end
@ -1184,7 +1188,10 @@ function Util.SlashShowMessageByLine(Message)
end end
end end
function SlashCmdList.BUTTONFORGE(msg, editbox) SLASH_BUTTONFORGE1 = Util.GetLocaleString("SlashButtonForge1"); -- = "/buttonforge"; --these two identifiers probably shouldn't change, but if need be they can be?!
SLASH_BUTTONFORGE2 = Util.GetLocaleString("SlashButtonForge2"); -- = "/bufo";
SlashCmdList["BUTTONFORGE"] = function(msg, editbox)
local FirstCommand;
local PreparedCommands = {}; local PreparedCommands = {};
local Command, Params; local Command, Params;
local Count = 0; local Count = 0;
@ -1192,6 +1199,9 @@ function SlashCmdList.BUTTONFORGE(msg, editbox)
for Token, Space in string.gmatch(msg, '([^%s]+)([%s]*)') do for Token, Space in string.gmatch(msg, '([^%s]+)([%s]*)') do
if (Const.SlashCommands[strlower(Token)]) then if (Const.SlashCommands[strlower(Token)]) then
if (Command) then if (Command) then
if (FirstCommand == nil) then
FirstCommand = Command;
end;
Count = Count + 1; Count = Count + 1;
--PreparedCommands["Count"] = Count; --PreparedCommands["Count"] = Count;
PreparedCommands[Command] = Util.ProcessSlashCommandParams(Command, Params); PreparedCommands[Command] = Util.ProcessSlashCommandParams(Command, Params);
@ -1225,7 +1235,7 @@ function SlashCmdList.BUTTONFORGE(msg, editbox)
-- 2. A rules required's must be present -- 2. A rules required's must be present
-- 3. A rules exclusions must not be present -- 3. A rules exclusions must not be present
local Group; local Group;
local FirstCommand;
for k, v in pairs(Commands) do for k, v in pairs(Commands) do
FirstCommand = FirstCommand or k; FirstCommand = FirstCommand or k;
if (Group ~= nil and Group ~= Const.SlashCommands[k].group) then if (Group ~= nil and Group ~= Const.SlashCommands[k].group) then
@ -1237,13 +1247,20 @@ function SlashCmdList.BUTTONFORGE(msg, editbox)
local Requires = Const.SlashCommands[k].requires; local Requires = Const.SlashCommands[k].requires;
if (Requires) then if (Requires) then
local RequiresValid = false;
local RequiresInfo = {};
-- make sure we have at least one of the requirements
for k1, v1 in pairs(Requires) do for k1, v1 in pairs(Requires) do
if (Commands[v1] == nil) then table.insert(RequiresInfo,v1);
-- Missing a required command if (Commands[v1] ~= nil) then
DEFAULT_CHAT_FRAME:AddMessage(string.gsub(string.gsub(Util.GetLocaleString("SlashCommandRequired"), "<COMMANDA>", k), "<COMMANDB>", v1), .5, 1, 0, 1); RequiresValid = true;
return;
end end
end end
if (RequiresValid == false) then
-- Missing a required command
DEFAULT_CHAT_FRAME:AddMessage(string.gsub(string.gsub(Util.GetLocaleString("SlashCommandRequired"), "<COMMANDA>", k), "<COMMANDB>", table.concat(RequiresInfo, " or ")), .5, 1, 0, 1);
return;
end
end end
local Incompat = Const.SlashCommands[k].incompat; local Incompat = Const.SlashCommands[k].incompat;
@ -1282,10 +1299,21 @@ function SlashCmdList.BUTTONFORGE(msg, editbox)
BarName = Commands["-bar"][1]; BarName = Commands["-bar"][1];
elseif (Commands["-destroybar"]) then elseif (Commands["-destroybar"]) then
BarName = Commands["-destroybar"][1]; BarName = Commands["-destroybar"][1];
end end
local barFound = false;
for i = 1, #Bars do for i = 1, #Bars do
if ((not BarName) or strlower(BarName) == strlower(Bars[i].BarSave["Label"])) then if ((not BarName) or strlower(BarName) == strlower(Bars[i].BarSave["Label"])) then
Util.ApplySlashCommands(Commands, Bars[i]); Util.ApplySlashCommands(Commands, Bars[i]);
barFound = true;
end
end
-- bar name not found, check with Index
if ( barFound == false ) then
for i = 1, #Bars do
if ( tonumber(BarName) == i ) then
Util.ApplySlashCommands(Commands, Bars[i]);
barFound = true;
end
end end
end end
end end
@ -1309,6 +1337,17 @@ function Util.ApplySlashCommands(Commands, Bar)
end end
Commands["-rename"] = Commands["-createbar"]; --this could arguably work by having an empty param to createbar but I think it will feel more natural to require a name with this command Commands["-rename"] = Commands["-createbar"]; --this could arguably work by having an empty param to createbar but I think it will feel more natural to require a name with this command
end end
if (Commands["-list"]) then
local Bars = Util.ActiveBars;
for i = 1, #Bars do
local label = string.gsub(Util.GetLocaleString("SlashListBarWithLabel"), "<LABEL>", Bars[i].BarSave["Label"]);
if (Bars[i].BarSave["Label"] == "") then
label = string.gsub(Util.GetLocaleString("SlashListBarWithIndex"), "<LABEL>", i);
end
DEFAULT_CHAT_FRAME:AddMessage(label, .5, 1, 0, 1);
end
end
if (Commands["-destroybar"]) then if (Commands["-destroybar"]) then
Util.DeallocateBar(Bar); Util.DeallocateBar(Bar);
@ -1377,7 +1416,7 @@ function Util.ApplySlashCommands(Commands, Bar)
if (Commands["-hideoverridebar"]) then if (Commands["-hideoverridebar"]) then
Bar:SetHBonusBar(Commands["-hideoverridebar"][1]); Bar:SetHBonusBar(Commands["-hideoverridebar"][1]);
end end
if (Commands["-vismacro"]) then if (Commands["-vismacro"]) then
Bar:SetVD(Commands["-vismacro"][1]); Bar:SetVD(Commands["-vismacro"][1]);
end end
@ -1638,7 +1677,7 @@ end
-------------------------------------------]] -------------------------------------------]]
function Util.GetFullSpellName(Name, Rank) function Util.GetFullSpellName(Name, Rank)
--BFA fix: GetSpellInfo now returns a nil for the rank. That's passed in here --BFA fix: GetSpellInfo now returns a nil for the rank. That's passed in here
--So we check to make sure ranx exists or only pass back the name itself. --So we check to make sure rank exists or only pass back the name itself.
if (Rank) then if (Rank) then
Rank = "("..Rank..")"; Rank = "("..Rank..")";
else else
@ -1732,21 +1771,16 @@ end
function Util.CachePetSpellIndexes() function Util.CachePetSpellIndexes()
local i = 1; local i = 1;
local NewPSI = {}; local NewPSI = {};
--Util.NewPetSpellIndex = {};
while true do while true do
local NameRank = Util.GetFullSpellName(GetSpellInfo(i, BOOKTYPE_PET)); local spellName, spellSubName = GetSpellBookItemName(i, BOOKTYPE_PET)
if (not NameRank) then if not spellName then
break; do break end
end end
--if (not Util.PetSpellIndex[NameRank]) then NewPSI[spellName] = i;
-- Util.NewPetSpellIndex[NameRanl] = i; i = i + 1
--end
NewPSI[NameRank] = i;
i = i + 1;
end end
Util.PetSpellIndex = NewPSI; Util.PetSpellIndex = NewPSI;
end end
function Util.LookupSpellIndex(NameRank) function Util.LookupSpellIndex(NameRank)
@ -1844,7 +1878,7 @@ function Util.CacheCompanions()
Util.Critters[Name] = i; Util.Critters[Name] = i;
end]] end]]
Util.Mounts = {}; -- Util.Mounts = {};
-- for i, mountID in pairs(C_MountJournal.GetMountIDs()) do -- for i, mountID in pairs(C_MountJournal.GetMountIDs()) do
-- local creatureName, spellID = C_MountJournal.GetMountInfoByID(mountID); -- local creatureName, spellID = C_MountJournal.GetMountInfoByID(mountID);
-- if (not creatureName) then -- if (not creatureName) then
@ -1852,6 +1886,7 @@ function Util.CacheCompanions()
-- end -- end
-- Util.Mounts[spellID] = mountID; -- Util.Mounts[spellID] = mountID;
-- end -- end
-- Util.CompanionsCached = true;
end end
function Util.LookupCompanion(Name) function Util.LookupCompanion(Name)
@ -2510,6 +2545,5 @@ function Util.LookupEquipmentSetIndex(EquipmentSetID)
end end
end end
return nil; return nil;
end end