Skip to content

Commit

Permalink
'Update'
Browse files Browse the repository at this point in the history
  • Loading branch information
BloodDragon2580 committed Aug 27, 2024
1 parent aa37534 commit 40c2036
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
2 changes: 1 addition & 1 deletion GildenSteuer/GildenSteuer.toc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Title:|cffd6266cGildenSteuer|r
## Notes: Zahl deine Steuer und mach die Gilde Glücklich
## Author: BloodDragon2580
## Version: 7.5
## Version: 7.6
## SavedVariables: GildenSteuerDB
## IconTexture: Interface\AddOns\GildenSteuer\Media\Texture\logo

Expand Down
39 changes: 38 additions & 1 deletion GildenSteuer/Libs/AceDB-3.0/AceDB-3.0.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
-- @class file
-- @name AceDB-3.0.lua
-- @release $Id$
local ACEDB_MAJOR, ACEDB_MINOR = "AceDB-3.0", 29
local ACEDB_MAJOR, ACEDB_MINOR = "AceDB-3.0", 30
local AceDB = LibStub:NewLibrary(ACEDB_MAJOR, ACEDB_MINOR)

if not AceDB then return end -- No upgrade needed
Expand Down Expand Up @@ -525,6 +525,17 @@ function DBObjectLib:DeleteProfile(name, silent)
end
end

-- remove from unloaded namespaces
if self.sv.namespaces then
for nsname, data in pairs(self.sv.namespaces) do
if self.children and self.children[nsname] then
-- already a mapped namespace
elseif data.profiles then
data.profiles[name] = nil
end
end
end

-- switch all characters that use this profile back to the default
if self.sv.profileKeys then
for key, profile in pairs(self.sv.profileKeys) do
Expand Down Expand Up @@ -570,6 +581,20 @@ function DBObjectLib:CopyProfile(name, silent)
end
end

-- copy unloaded namespaces
if self.sv.namespaces then
for nsname, data in pairs(self.sv.namespaces) do
if self.children and self.children[nsname] then
-- already a mapped namespace
elseif data.profiles then
-- reset the current profile
data.profiles[self.keys.profile] = {}
-- copy data
copyTable(data.profiles[name], data.profiles[self.keys.profile])
end
end
end

-- Callback: OnProfileCopied, database, sourceProfileKey
self.callbacks:Fire("OnProfileCopied", self, name)
end
Expand All @@ -596,6 +621,18 @@ function DBObjectLib:ResetProfile(noChildren, noCallbacks)
end
end

-- reset unloaded namespaces
if self.sv.namespaces and not noChildren then
for nsname, data in pairs(self.sv.namespaces) do
if self.children and self.children[nsname] then
-- already a mapped namespace
elseif data.profiles then
-- reset the current profile
data.profiles[self.keys.profile] = nil
end
end
end

-- Callback: OnProfileReset, database
if not noCallbacks then
self.callbacks:Fire("OnProfileReset", self)
Expand Down

0 comments on commit 40c2036

Please sign in to comment.