diff --git a/PallyPower.lua b/PallyPower.lua
index d5f5a23..ef06b37 100644
--- a/PallyPower.lua
+++ b/PallyPower.lua
@@ -92,6 +92,12 @@ function PallyPower:OnInitialize()
self.db.RegisterCallback(self, "OnProfileCopied", "OnProfileChanged")
self.db.RegisterCallback(self, "OnProfileReset", "OnProfileChanged")
+ if not PallyPower_SavedPresets or PallyPower_SavedPresets == nil then
+ PallyPower_SavedPresets = {}
+ PallyPower_SavedPresets["PallyPower_Assignments"] = {[0] = {}}
+ PallyPower_SavedPresets["PallyPower_NormalAssignments"] = {[0] = {}}
+ end
+
self.opt = self.db.profile
self.options.args.profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db)
@@ -274,6 +280,15 @@ function PallyPower:OpenConfigWindow()
end
end
+function tablecopy(tbl)
+ if type(tbl) ~= "table" then return tbl end
+ local t = {}
+ for i,v in pairs(tbl) do
+ t[i] = tablecopy(v)
+ end
+ return t
+ end
+
function PallyPowerBlessings_Clear()
if InCombatLockdown() then return end
@@ -307,6 +322,77 @@ function PallyPowerBlessings_Refresh()
PallyPower:UpdateRoster()
end
+function PallyPowerBlessings_Preset(shift)
+ if shift then --save current Assignments to preset
+ PallyPower_SavedPresets["PallyPower_Assignments"][0] = tablecopy(PallyPower_Assignments)
+ PallyPower_SavedPresets["PallyPower_NormalAssignments"][0] = tablecopy(PallyPower_NormalAssignments)
+ else -- load preset and publish to other pallys if possible
+ PallyPower:ClearAssignments(PallyPower.player)
+ PallyPower:SendMessage("CLEAR")
+ PallyPower_Assignments = tablecopy(PallyPower_SavedPresets["PallyPower_Assignments"][0])
+ PallyPower_NormalAssignments = tablecopy(PallyPower_SavedPresets["PallyPower_NormalAssignments"][0])
+
+ if PallyPower:CheckLeader(PallyPower.player) or PP_Leader == false then
+ C_Timer.After(
+ 0.25,
+ function() -- send Class-Assignments
+ for name in pairs(AllPallys) do
+ local s = ""
+ local BuffInfo = PallyPower_Assignments[name]
+ for i = 1, PALLYPOWER_MAXCLASSES do
+ if not BuffInfo[i] or BuffInfo[i] == 0 then
+ s = s .. "n"
+ else
+ s = s .. BuffInfo[i]
+ end
+ end
+ PallyPower:SendMessage("PASSIGN " .. name .. "@" .. s)
+ end
+
+ C_Timer.After(
+ 0.25,
+ function() -- send Single-Assignments
+ for pname in pairs(PallyPower_NormalAssignments) do
+ if (PallyPower_NormalAssignments[pName]) then
+ for class in pairs(PallyPower_NormalAssignments[pName]) do
+ if PallyPower_NormalAssignments[pName][class] then
+ for tname in pairs(PallyPower_NormalAssignments[pName][class]) do
+ if PallyPower_NormalAssignments[pName][class][tname] and AllPallys[pname] and PallyPower:GetUnitIdByName(tname) then
+ if PallyPower_NormalAssignments[pname][class][tname] == nil or not AllPallys[pname][value] then
+ value = 0
+ else
+ value = PallyPower_NormalAssignments[pname][class][tname]
+ end
+ PallyPower:SendMessage("NASSIGN " .. pname .. " " .. class .. " " .. tname .. " " .. value)
+ end
+ end
+ end
+ end
+ end
+ end
+ C_Timer.After(
+ 0.25,
+ function()
+ PallyPower:UpdateLayout()
+ PallyPower:UpdateRoster()
+ end
+ )
+ end
+ )
+ end
+ )
+ else
+ C_Timer.After(
+ 0.25,
+ function()
+ PallyPower:UpdateLayout()
+ PallyPower:UpdateRoster()
+ end
+ )
+ end
+ end
+end
+
function PallyPowerBlessings_Toggle()
if PallyPower.configFrame and PallyPower.configFrame:IsShown() then
PallyPower.configFrame:Hide()
@@ -3777,6 +3863,15 @@ function PallyPower:AutoAssign()
end
end
+function PallyPower:Preset()
+ if InCombatLockdown() then return end
+
+ local shift = (IsShiftKeyDown() and PallyPowerBlessingsFrame:IsMouseOver())
+ PallyPowerBlessings_Preset(shift)
+
+
+end
+
function PallyPower:CalcSkillRanks(name)
local wisdom, might, kings, salv, light, sanct
if AllPallys[name][1] then
diff --git a/PallyPowerValues.lua b/PallyPowerValues.lua
index 597e07e..27a6783 100644
--- a/PallyPowerValues.lua
+++ b/PallyPowerValues.lua
@@ -301,6 +301,8 @@ PALLYPOWER_REFRESH = L["Refresh"]
PALLYPOWER_REFRESH_DESC = L["PP_REFRESH_TOOLTIP"]
PALLYPOWER_AUTOASSIGN = L["Auto-Assign"]
PALLYPOWER_AUTOASSIGN_DESC = L["AUTO_ASSIGN_TOOLIP"]
+PALLYPOWER_PRESET = L["Preset"]
+PALLYPOWER_PRESET_DESC = L["PRESET_TOOLIP"]
PALLYPOWER_REPORT = L["Blessings Report"]
PALLYPOWER_REPORT_DESC = L["BLESSING_REPORT_TOOLTIP"]
PALLYPOWER_FREEASSIGN = L["Free Assignment"]
diff --git a/PallyPower_TBC.xml b/PallyPower_TBC.xml
index 783edbb..cfe4e0c 100644
--- a/PallyPower_TBC.xml
+++ b/PallyPower_TBC.xml
@@ -1853,12 +1853,40 @@
+
+
+