Mercurial > wow > inventory
diff Summary.lua @ 61:d903b0a151d3
Command handler function is now private, no need to keep it global when you can use the global SlashCmdList["INVENTORIUM"](msg) instead.
Added database updating mechanism.
All database vars are now stored in profiles rather than global.
Now refreshing options when a different profile is selected.
Fixed an issue with minimum local and global stock values not being inherited from the defaults.
author | Zerotorescue |
---|---|
date | Wed, 22 Dec 2010 15:04:09 +0100 |
parents | 03c0610e9c1e |
children | fee06221176f |
line wrap: on
line diff
--- a/Summary.lua Tue Dec 21 14:29:52 2010 +0100 +++ b/Summary.lua Wed Dec 22 15:04:09 2010 +0100 @@ -103,13 +103,13 @@ mod:CancelTimer(self.tmrUpdater, true); mod:CloseFrame(); end); - mod.frame:SetWidth(addon.db.global.defaults.summary.width); - mod.frame:SetHeight(addon.db.global.defaults.summary.height); + mod.frame:SetWidth(addon.db.profile.defaults.summary.width); + mod.frame:SetHeight(addon.db.profile.defaults.summary.height); mod.frame.OnWidthSet = function(_, width) - addon.db.global.defaults.summary.width = width; + addon.db.profile.defaults.summary.width = width; end; mod.frame.OnHeightSet = function(_, height) - addon.db.global.defaults.summary.height = height; + addon.db.profile.defaults.summary.height = height; end; -- Close on escape @@ -208,11 +208,11 @@ sdrSpeed:SetIsPercent(true); sdrSpeed:SetRelativeWidth(.3); sdrSpeed:SetCallback("OnMouseUp", function(self, event, value) - addon.db.global.defaults.summary.speed = ceil( value * 100 / 5 ); + addon.db.profile.defaults.summary.speed = ceil( value * 100 / 5 ); - CACHE_ITEMS_PER_UPDATE = addon.db.global.defaults.summary.speed; -- max = 20, min = 1 + CACHE_ITEMS_PER_UPDATE = addon.db.profile.defaults.summary.speed; -- max = 20, min = 1 end); - sdrSpeed:SetValue( addon.db.global.defaults.summary.speed * 5 / 100 ); + sdrSpeed:SetValue( addon.db.profile.defaults.summary.speed * 5 / 100 ); sdrSpeed:SetCallback("OnEnter", ShowTooltip); sdrSpeed:SetCallback("OnLeave", HideTooltip); sdrSpeed.frame.tooltipTitle = "Caching Processing Speed"; @@ -265,7 +265,7 @@ local playerName = UnitName("player"); -- Go through all our stored groups - for groupName, values in pairsByKeys(addon.db.global.groups, function(a, b) return a:lower() < b:lower(); end) do + for groupName, values in pairsByKeys(addon.db.profile.groups, function(a, b) return a:lower() < b:lower(); end) do local groupStartTime, groupTimes = GetTime(), {}; local trackAt = addon:GetOptionByKey(groupName, "trackAtCharacters"); @@ -531,8 +531,8 @@ local i = 0; for groupName, items in pairs(itemsCache) do - local minGlobalStock = addon:GetOptionByKey(groupName, "minimumStock"); - local minLocalStock = addon:GetOptionByKey(groupName, "minimumLocalStock"); + local minGlobalStock = addon:GetOptionByKey(groupName, "minGlobalStock"); + local minLocalStock = addon:GetOptionByKey(groupName, "minLocalStock"); local priceThreshold = addon:GetOptionByKey(groupName, "priceThreshold"); for _, item in pairs(items) do @@ -576,7 +576,7 @@ mod.frame:SetStatusText(("Caching auction values and item-counts... %d%% has already been processed."):format(floor(CACHE_ITEMS_CURRENT / CACHE_ITEMS_TOTAL * 100))); end - if i >= addon.db.global.defaults.summary.speed then + if i >= addon.db.profile.defaults.summary.speed then return; end end @@ -603,13 +603,13 @@ function mod:ColorCode(num, required) local percentage = ( num / required ); - if percentage >= addon.db.global.defaults.colors.green then + if percentage >= addon.db.profile.defaults.colors.green then return ("|cff00ff00%d|r"):format(num); - elseif percentage >= addon.db.global.defaults.colors.yellow then + elseif percentage >= addon.db.profile.defaults.colors.yellow then return ("|cffffff00%d|r"):format(num); - elseif percentage >= addon.db.global.defaults.colors.orange then + elseif percentage >= addon.db.profile.defaults.colors.orange then return ("|cffff9933%d|r"):format(num); - elseif percentage >= addon.db.global.defaults.colors.red then + elseif percentage >= addon.db.profile.defaults.colors.red then return ("|cffff0000%d|r"):format(num); end end