Skip to content

Commit

Permalink
#579 Dump current Macro state to GSE_C
Browse files Browse the repository at this point in the history
  • Loading branch information
TimothyLuke committed Aug 29, 2019
1 parent bcca58a commit 59f0f94
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 17 deletions.
39 changes: 23 additions & 16 deletions GSE/API/Events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,12 @@ GSE:RegisterChatCommand("gse", "GSSlash")
-- Functions
--- Handle slash commands
function GSE:GSSlash(input)
if string.lower(input) == "showspec" then
local params = GSE.split(input, " ")
if table.getn(params) > 1 then
input = params[1]
end
local command = string.lower(input)
if command == "showspec" then
local version, build, date, tocversion = GetBuildInfo()
local majorVersion = GSE.split(version, '.')
if tonumber(majorVersion[1]) == 1 then
Expand All @@ -298,52 +303,54 @@ function GSE:GSSlash(input)
local _, specname, specdescription, specicon, _, specrole, specclass = GetSpecializationInfoByID(currentSpecID)
GSE.Print(L["Your current Specialisation is "] .. currentSpecID .. ':' .. specname .. L[" The Alternative ClassID is "] .. currentclassId, GNOME)
end
elseif string.lower(input) == "help" then
elseif command == "help" then
PrintGnomeHelp()
elseif string.lower(input) == "cleanorphans" or string.lower(input) == "clean" then
elseif command == "cleanorphans" or command == "clean" then
GSE.CleanOrphanSequences()
elseif string.lower(input) == "forceclean" then
elseif command == "forceclean" then
GSE.CleanOrphanSequences()
GSE.CleanMacroLibrary(true)
elseif string.lower(string.sub(string.lower(input),1,6)) == "export" then
GSE.Print(GSE.ExportSequence(string.sub(string.lower(input),8, true, "STRING", true)))
elseif string.lower(input) == "showdebugoutput" then
elseif command == "showdebugoutput" then
StaticPopup_Show ("GS-DebugOutput")
elseif string.lower(input) == "record" then
elseif command == "record" then
if GSE.UnsavedOptions["GUI"] then
GSE.GUIRecordFrame:Show()
else
GSE.printNoGui()
end
elseif string.lower(input) == "debug" then
elseif command == "debug" then
if GSE.UnsavedOptions["GUI"] then
GSE.GUIShowDebugWindow()
else
GSE.printNoGui()
end

elseif string.lower(input) == "compilemissingspells" then
elseif command == "compilemissingspells" then
GSE.Print("Compiling Language Table errors. If the game hangs please be patient.")
GSE.ReportUnfoundSpells()
GSE.Print("Language Spells compiled. Please exit the game and obtain the values from WTF/AccountName/SavedVariables/GSE.lua")
elseif string.lower(input) == "resetoptions" then
elseif command == "resetoptions" then
GSE.SetDefaultOptions()
GSE.Print(L["Options have been reset to defaults."])
StaticPopup_Show ("GSE_ConfirmReloadUIDialog")
elseif string.lower(input) == "updatemacrostrings" then
elseif command == "updatemacrostrings" then
-- Convert macros to new format in a one off run.
GSE.UpdateMacroString()
elseif string.lower(input) == "movelostmacros" then
elseif command == "movelostmacros" then
GSE.MoveMacroToClassFromGlobal()
elseif string.lower(input) == "checkmacrosforerrors" then
elseif command == "checkmacrosforerrors" then
GSE.ScanMacrosForErrors()
elseif string.lower(input) == "compressstring" then
elseif command == "compressstring" then
if GSE.UnsavedOptions["GUI"] then
GSE.GUICompressFrame:Show()
else
GSE.printNoGui()
end

elseif command == "dumpmacro" then
GSE_C[params[2]] = {}
GSE_C[params[2]].name = params[2]
GSE_C[params[2]].sequence = GSE.FindMacro(params[2])
GSE_C[params[2]].button = _G[params[2]]
else
if GSE.UnsavedOptions["GUI"] then
GSE.GUIShowViewer()
Expand Down
2 changes: 1 addition & 1 deletion GSE/API/Init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ GSE.VersionString = GetAddOnMetadata("GSE", "Version");

--@debug@
if GSE.VersionString == "@project-version@" then
GSE.VersionString = "2.4.14-18-g95ecb41"
GSE.VersionString = "2.4.19-18-g95ecb41"
end
--@end-debug@

Expand Down
9 changes: 9 additions & 0 deletions GSE/API/OneOffEvents.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ function GSE.PerformOneOffEvents()
GSE.Update2305()
GSE.Update2410()
GSE.Update2411()
GSE.Update2415()
end

function GSE.UpdateFrom735to801()
Expand Down Expand Up @@ -54,4 +55,12 @@ function GSE.Update2411()
}
end
GSEOptions.Update2411 = true
end


function GSE.Update2415()
if GSE.isEmpty(GSEOptions.Update2415) then
GSE_C = {}
end
GSEOptions.Update2415 = true
end
11 changes: 11 additions & 0 deletions GSE/API/Storage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1254,6 +1254,17 @@ function GSE.GetMacroResetImplementation()

end

--- This function finds a macro by name. It checks current class first then global
function GSE.FindMacro(sequenceName)
local returnVal = {}
if not GSE.isEmpty(GSELibrary[GSE.GetCurrentClassID()][sequenceName]) then
returnVal = GSELibrary[GSE.GetCurrentClassID()][sequenceName]
elseif not GSE.isEmpty(GSELibrary[0][sequenceName]) then
returnVal = GSELibrary[0][sequenceName]
end
return returnVal
end

--- This funcion returns the actual onclick implementation
function GSE.PrepareOnClickImplementation(sequence)
local returnstring = (GSEOptions.DebugPrintModConditionsOnKeyPress and Statics.PrintKeyModifiers or "" )
Expand Down
1 change: 1 addition & 0 deletions GSE/GSE.toc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
## Author: TimothyLuke
## Version: @project-version@
## SavedVariables: GSEOptions GSELibrary
## SavedVariablesPerCharacter: GSE_C
## OptionalDeps: WeakAuras

## X-WoWI-ID: 23921
Expand Down

0 comments on commit 59f0f94

Please sign in to comment.