From 2a12672f009dada452163812e3f65a7d063a21ca Mon Sep 17 00:00:00 2001 From: Ahmil Jilani Date: Wed, 30 Nov 2011 19:53:00 -0500 Subject: [PATCH] 2.4.2 --- SuperDuperMacro/SuperDuperMacro.toc | 2 +- SuperDuperMacro/SuperDuperMacro_Core.lua | 79 +++++++++++++------------ SuperDuperMacro/SuperDuperMacro_Interface.lua | 8 ++- SuperDuperMacro/sdm Readme.txt | 6 +- 4 files changed, 53 insertions(+), 42 deletions(-) diff --git a/SuperDuperMacro/SuperDuperMacro.toc b/SuperDuperMacro/SuperDuperMacro.toc index 060e36f..897cfd9 100644 --- a/SuperDuperMacro/SuperDuperMacro.toc +++ b/SuperDuperMacro/SuperDuperMacro.toc @@ -2,7 +2,7 @@ ## Title : Super Duper Macro ## Notes: Enables creation of incredibly long macros. ## Author: hypehuman -## Version: 2.4.1 +## Version: 2.4.2 ## SavedVariables: sdm_version, sdm_listFilters, sdm_iconSize, sdm_mainContents, sdm_macros SuperDuperMacro_Core.lua SuperDuperMacro_Interface.lua diff --git a/SuperDuperMacro/SuperDuperMacro_Core.lua b/SuperDuperMacro/SuperDuperMacro_Core.lua index d6bd8e5..57346c8 100644 --- a/SuperDuperMacro/SuperDuperMacro_Core.lua +++ b/SuperDuperMacro/SuperDuperMacro_Core.lua @@ -32,9 +32,8 @@ sdm_eventFrame:SetScript("OnEvent", function (self, event, ...) sdm_eventFrame:UnregisterEvent(event) if (not sdm_macros) then sdm_macros={} --type tokens: "b": button macro. "f": floating macro. "s": scripts. "c": containers (folders) - end -- when updating versions, make sure that the saved data are appropriately updated. - if sdm_CompareVersions(oldVersion, sdm_version) == 2 then + elseif sdm_CompareVersions(oldVersion, sdm_version) == 2 then if sdm_CompareVersions(oldVersion,"1.6")==2 then -- Hopefully nobody is upgrading from a version this old. If they are, they should download 2.1 and run that once before upgrading to 2.2. sdm_macros={} end @@ -53,7 +52,7 @@ sdm_eventFrame:SetScript("OnEvent", function (self, event, ...) end end end - if sdm_CompareVersions(oldVersion,"2.4.1")==2 then + if sdm_CompareVersions(oldVersion,"2.4.2")==2 then for _,v in pairs(sdm_macros) do if v.icon then v.icon = sdm_defaultIcon @@ -70,7 +69,7 @@ sdm_eventFrame:SetScript("OnEvent", function (self, event, ...) if sdm_mainContents==nil then sdm_ResetContainers() end - sdm_iconSize=sdm_iconSize or 36 + sdm_iconSize = sdm_iconSize or 36 if not sdm_listFilters then sdm_listFilters={b=true, f=true, s=true, global=true} sdm_listFilters["true"]=true @@ -79,44 +78,48 @@ sdm_eventFrame:SetScript("OnEvent", function (self, event, ...) sdm_iconSizeSlider:SetValue(sdm_iconSize) sdm_iconSizeSlider:SetScript("OnValueChanged", function(self) sdm_iconSize = self:GetValue() sdm_UpdateList() end) sdm_SelectItem(nil) --We want to start with no macro selected - elseif event=="UPDATE_MACROS" then - if sdm_countUpdateMacrosEvents < 2 then - sdm_countUpdateMacrosEvents=sdm_countUpdateMacrosEvents+1 - if sdm_countUpdateMacrosEvents==2 then - local killOnSight = {} - local macrosToDelete = {} - local iIsPerCharacter=false - local thisID, mTab - for i=1,54 do --Check each macro to see if it's been orphaned by a previous installation of SDM. - if i==37 then iIsPerCharacter=true end - thisID = sdm_GetSdmID(i) - mTab = sdm_macros[thisID] - if thisID then --if the macro was created by SDM... - if killOnSight[thisID] then --if this ID is marked as kill-on-sight, kill it. - table.insert(macrosToDelete, i) - elseif (not mTab) or mTab.type~="b" or (not sdm_UsedByThisChar(mTab)) then --if this ID is not in use by this character as a button macro, kill it and mark this ID as KoS - table.insert(macrosToDelete, i) - killOnSight[thisID]=1 - elseif (mTab.characters~=nil)~=iIsPerCharacter then --if the macro is in the wrong spot based on perCharacter, kill it, but give it a chance to find one in the right spot. - table.insert(macrosToDelete, i) - else --This macro is good and should be here. Kill any duplicates. - killOnSight[thisID]=1 - end - end - end - for i=getn(macrosToDelete),1,-1 do -- we delete in descending order so that the indices don't get messed up while we're deleting, which would cause us to delete the wrong macros - print(sdm_printPrefix.."Deleting extraneous macro "..macrosToDelete[i]..": "..GetMacroInfo(macrosToDelete[i])) - DeleteMacro(macrosToDelete[i]) - end - for i,v in pairs(sdm_macros) do - if sdm_UsedByThisChar(sdm_macros[i]) then - sdm_SetUpMacro(sdm_macros[i]) + elseif event=="UPDATE_MACROS" then + -- SDM uses this event for two things. Whenever you log into the game, UPDATE_MACROS is fired twice. After the second firing, the macros are loaded. This is when SDM deletes extraneous macros that it has created before. This generally happens if you use different computers or if you don't use SDM for a while. Whenever you log in, SDM makes sure that your macro list jives with the info in SavedVariables. + if sdm_countUpdateMacrosEvents == 0 then + sdm_countUpdateMacrosEvents = 1 + elseif sdm_countUpdateMacrosEvents==1 then + sdm_countUpdateMacrosEvents = 2 + local killOnSight = {} + local macrosToDelete = {} + local iIsPerCharacter=false + local thisID, mTab + for i=1,54 do --Check each macro to see if it's been orphaned by a previous installation of SDM. + if i==37 then iIsPerCharacter=true end + thisID = sdm_GetSdmID(i) + mTab = sdm_macros[thisID] + if thisID then --if the macro was created by SDM... + if killOnSight[thisID] then --if this ID is marked as kill-on-sight, kill it. + table.insert(macrosToDelete, i) + elseif (not mTab) or mTab.type~="b" or (not sdm_UsedByThisChar(mTab)) then --if this ID is not in use by this character as a button macro, kill it and mark this ID as KoS + table.insert(macrosToDelete, i) + killOnSight[thisID]=1 + elseif (mTab.characters~=nil)~=iIsPerCharacter then --if the macro is in the wrong spot based on perCharacter, kill it, but give it a chance to find one in the right spot. + table.insert(macrosToDelete, i) + else --This macro is good and should be here. Kill any duplicates. + killOnSight[thisID]=1 end end end + for i=getn(macrosToDelete),1,-1 do -- we delete in descending order so that the indices don't get messed up while we're deleting, which would cause us to delete the wrong macros + print(sdm_printPrefix.."Deleting extraneous macro "..macrosToDelete[i]..": "..GetMacroInfo(macrosToDelete[i])) + DeleteMacro(macrosToDelete[i]) + end + for i,v in pairs(sdm_macros) do + if sdm_UsedByThisChar(sdm_macros[i]) then + sdm_SetUpMacro(sdm_macros[i]) + end + end + end + if sdm_countUpdateMacroEvents==2 then + -- If the macros are loaded, update the number of button macros on the SDM frame + local numAccountMacros, numCharacterMacros = GetNumMacros() + sdm_macroLimitText:SetText("Global macros: "..numAccountMacros.."/36\nCharacter-specific macros: "..numCharacterMacros.."/18") end - local numAccountMacros, numCharacterMacros = GetNumMacros() - sdm_macroLimitText:SetText("Global macros: "..numAccountMacros.."/36\nCharacter-specific macros: "..numCharacterMacros.."/18") elseif event=="ADDON_LOADED" then local addonName = ...; if addonName=="Blizzard_MacroUI" then diff --git a/SuperDuperMacro/SuperDuperMacro_Interface.lua b/SuperDuperMacro/SuperDuperMacro_Interface.lua index 0f04972..e262a62 100644 --- a/SuperDuperMacro/SuperDuperMacro_Interface.lua +++ b/SuperDuperMacro/SuperDuperMacro_Interface.lua @@ -440,8 +440,12 @@ function sdm_UpdateList() listItem.slotIcon:SetWidth(sdm_iconSize*64/36) listItem.slotIcon:SetHeight(sdm_iconSize*64/36) if mTab.type=="b" and sdm_UsedByThisChar(mTab) then - listItem:SetScript("OnDragStart", function(self, event, ...) - PickupMacro(sdm_GetMacroIndex(sdm_macros[self.index].ID)) + listItem:SetScript("OnDragStart", function(self, event, ...) + if not InCombatLockdown() then + PickupMacro(sdm_GetMacroIndex(sdm_macros[self.index].ID)) + else + print(sdm_printPrefix.."You cannot pick up macros during combat.") + end end) else listItem:SetScript("OnDragStart", nil) diff --git a/SuperDuperMacro/sdm Readme.txt b/SuperDuperMacro/sdm Readme.txt index d39269b..745fd46 100644 --- a/SuperDuperMacro/sdm Readme.txt +++ b/SuperDuperMacro/sdm Readme.txt @@ -1,5 +1,5 @@ Super Duper Macro -version 2.4.1 +version 2.4.2 by hypehuman Check for updates at http://www.wowinterface.com/downloads/info10496 @@ -25,6 +25,10 @@ Special thanks to: Change Log +2.4.2 (11/30/11) +¥ÊFixed a minor error that occurs when running SDM for the first time +¥ÊWhen attempting to pick up a macro during combat, you will get an error message created by SDM instead of Blizzard's "Interface action failed due to an addon". + 2.4.1 (11/30/11) ¥ÊUpdated for version 4.0 - you will lose any custom icons for your macros. Sorry! -- 1.7.9.5