diff Core.lua @ 65:ac1189599769

Added warning to AuctionLite pricing addon selection stating the addon wasn?t tested properly yet. Premade groups check now occurs when the config is opened rather than upon login. All multiselects are now dropdowns as they are meant to be. Please ensure the pullouts are closed before switching groups or closing the window or you may get some LUA errors (thanks Wowace for not fixing what seems to be a year old issue). Hopefully added support for the crafting addon ?Cauldron?, but this still has to be tested.
author Zerotorescue
date Thu, 23 Dec 2010 03:19:27 +0100
parents fee06221176f
children 057f6661ad9d
line wrap: on
line diff
--- a/Core.lua	Wed Dec 22 20:01:13 2010 +0100
+++ b/Core.lua	Thu Dec 23 03:19:27 2010 +0100
@@ -117,10 +117,14 @@
 		-- Default to tracking on all chars, untracking is a convenience, not tracking by default would probably get multiple issue reports.
 		self.db.profile.defaults.trackAtCharacters[playerName] = true;
 	end
-	
-	self:PremadeGroupsCheck();
 end
 
+
+
+
+
+-- Database patching after new revisions
+
 function addon:UpdateDatabase()
 	if not self.db.global.version or self.db.global.version < addonRevision then
 		-- Is our database outdated? Then patch it.
@@ -184,91 +188,6 @@
 	end
 end
 
-function addon:PremadeGroupsCheck(updateGroupName, updateKey, accept)
-	-- Compare the current premade groups with those used, notify about changes
-	if addon.defaultGroups then
-		for premadeGroupName, groupInfo in pairs(addon.defaultGroups) do
-			-- Go through all default groups
-			
-			for groupName, values in pairs(addon.db.profile.groups) do
-				-- Go through all groups to find those with this premade group
-				
-				if values.premadeGroups and values.premadeGroups[premadeGroupName] and values.premadeGroups[premadeGroupName] < groupInfo.version then
-					-- Outdated group
-					
-					if updateGroupName and updateKey then
-						-- This function was called after pressing yes or no in a confirm box
-						
-						if accept then
-							-- Yes was clicked
-							
-							for itemId, version in pairs(groupInfo.items) do
-								-- Go through all items in this premade group
-								
-								if version > values.premadeGroups[premadeGroupName] then
-									-- This item was added in a more recent version than this group: Add item
-									
-									if self:InGroup(itemId) then
-										print(("Skipping %s (#%d) as it is already in the group |cfffed000%s|r."):format(select(2, GetItemInfo(itemId)) or "Unknown", itemId, self:InGroup(itemId)));
-									elseif self:AddItemToGroup(groupName, itemId) then
-										print(("|cff00ff00Added|r %s (#%d) found in the premade group |cfffed000%s|r to the group |cfffed000%s|r."):format(select(2, GetItemInfo(itemId)) or "Unknown", itemId, premadeGroupName, self:InGroup(itemId)));
-									end
-								elseif ( version * -1 ) > values.premadeGroups[premadeGroupName] then
-									if self:InGroup(itemId) == groupName then
-										print(("|cffff0000Removed|r %s (#%d) from the group |cfffed000%s|r as it was removed from the premade group |cfffed000%s|r."):format(select(2, GetItemInfo(itemId)) or "Unknown", itemId, self:InGroup(itemId), premadeGroupName));
-										self:RemoveItemFromGroup(groupName, itemId);
-									else
-										print(("Skipping the removal of %s (#%d) as it isn't in this group."):format(select(2, GetItemInfo(itemId)) or "Unknown", itemId, self:InGroup(itemId)));
-									end
-								end
-							end
-							
-							-- Remember the new version
-							values.premadeGroups[premadeGroupName] = groupInfo.version;
-						else
-							-- No was clicked
-							
-							-- Let user know what was not added
-							for itemId, version in pairs(groupInfo.items) do
-								-- Go through all items in this premade group
-								
-								if version > values.premadeGroups[premadeGroupName] then
-									-- This item was added in a more recent version than this group: don't add (since we clicked no), but announce it
-									
-									print(("Skipping %s (#%d) found in the premade group |cfffed000%s|r."):format(select(2, GetItemInfo(itemId)) or "Unknown", itemId, self:InGroup(itemId)));
-								end
-							end
-							
-							-- Remember the new version
-							values.premadeGroups[premadeGroupName] = groupInfo.version;
-						end
-					else
-						StaticPopupDialogs["InventoriumConfirmUpdatePremadeGroup"] = {
-							text = "The premade group |cfffed000%s|r used in the group |cfffed000%s|r has been changed. Do you wish to copy these changes?",
-							button1 = YES,
-							button2 = NO,
-							OnAccept = function(self)
-								addon:PremadeGroupsCheck(groupName, premadeGroupName, true);
-							end,
-							OnCancel = function(self, _, reason)
-								if reason == "clicked" then
-									addon:PremadeGroupsCheck(groupName, premadeGroupName, false);
-								end
-							end,
-							timeout = 0,
-							whileDead = 1,
-							hideOnEscape = 1,
-						};
-						StaticPopup_Show("InventoriumConfirmUpdatePremadeGroup", premadeGroupName, groupName);
-						
-						return;
-					end
-				end
-			end
-		end
-	end
-end
-
 function addon:GetItemId(itemLink)
 	itemLink = itemLink and itemLink:match("|Hitem:([-0-9]+):"); -- if itemLink is nil, it won't execute the second part
 	itemLink = itemLink and tonumber(itemLink);
@@ -376,6 +295,10 @@
 	return -2;
 end
 
+
+
+
+
 -- Slash commands
 
 local slashArgs = {};
@@ -403,6 +326,10 @@
 	end
 end
 
+
+
+
+
 -- Group functions
 
 function addon:InGroup(itemId)
@@ -447,6 +374,10 @@
 	return true;
 end
 
+
+
+
+
 -- Readable money
 
 local goldText = "%s%d|cffffd700g|r ";
@@ -507,6 +438,8 @@
 
 
 
+
+
 -- Public
 
 function IMRegisterPricingAddon(name, get, enabled, onSelect)
@@ -541,6 +474,8 @@
 
 
 
+
+
 -- Debug
 
 function addon:Debug(t)