comparison Config.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 710f03653aaf
comparison
equal deleted inserted replaced
64:0bd50500561c 65:ac1189599769
419 ["Bank"] = "Bank", 419 ["Bank"] = "Bank",
420 ["Auction House"] = "Auction House", 420 ["Auction House"] = "Auction House",
421 ["Mailbox"] = "Mailbox", 421 ["Mailbox"] = "Mailbox",
422 }, 422 },
423 get = GetMultiOption, 423 get = GetMultiOption,
424 --dialogControl = "Dropdown", -- this is not standard, normal multiselect control gives us a list of all chars with toggle-boxes. UGLY! We want a multiselect-box instead. 424 dialogControl = "Dropdown", -- this is not standard, normal multiselect control gives us a list of all chars with toggle-boxes. UGLY! We want a multiselect-box instead.
425 arg = "overrideLocalItemData", 425 arg = "overrideLocalItemData",
426 }, 426 },
427 virtualGroup = { 427 virtualGroup = {
428 order = 50, 428 order = 50,
429 type = "select", 429 type = "select",
577 end 577 end
578 578
579 return temp; 579 return temp;
580 end, 580 end,
581 get = GetMultiOption, 581 get = GetMultiOption,
582 --dialogControl = "Dropdown", -- this is not standard, normal multiselect control gives us a list of all chars with toggle-boxes. UGLY! We want a multiselect-box instead. 582 dialogControl = "Dropdown", -- this is not standard, normal multiselect control gives us a list of all chars with toggle-boxes. UGLY! We want a multiselect-box instead.
583 arg = "overrideTrackAtCharacters", 583 arg = "overrideTrackAtCharacters",
584 }, 584 },
585 }, 585 },
586 }, 586 },
587 refill = { 587 refill = {
1188 Widgets:ItemLinkButton(); 1188 Widgets:ItemLinkButton();
1189 Widgets:ConfigItemLinkButton(); 1189 Widgets:ConfigItemLinkButton();
1190 end 1190 end
1191 1191
1192 function mod:RefreshConfig() 1192 function mod:RefreshConfig()
1193 self:PremadeGroupsCheck();
1194
1193 self:FillGroupOptions(); 1195 self:FillGroupOptions();
1194 end 1196 end
1195 1197
1196 function mod:Load() 1198 function mod:Load()
1197 if not AceConfigDialog and not AceConfigRegistry then 1199 if not AceConfigDialog and not AceConfigRegistry then
1200 self:PremadeGroupsCheck();
1201
1198 self:FillOptions(); 1202 self:FillOptions();
1199 1203
1200 -- Build options dialog 1204 -- Build options dialog
1201 AceConfigDialog = LibStub("AceConfigDialog-3.0"); 1205 AceConfigDialog = LibStub("AceConfigDialog-3.0");
1202 AceConfigRegistry = LibStub("AceConfigRegistry-3.0"); 1206 AceConfigRegistry = LibStub("AceConfigRegistry-3.0");
1370 ["Auction House"] = "Auction House", 1374 ["Auction House"] = "Auction House",
1371 ["Mailbox"] = "Mailbox", 1375 ["Mailbox"] = "Mailbox",
1372 }, 1376 },
1373 get = function(i, v) return addon.db.profile.defaults.localItemData and addon.db.profile.defaults.localItemData[v]; end, 1377 get = function(i, v) return addon.db.profile.defaults.localItemData and addon.db.profile.defaults.localItemData[v]; end,
1374 set = function(i, v, e) addon.db.profile.defaults.localItemData[v] = e or nil; end, 1378 set = function(i, v, e) addon.db.profile.defaults.localItemData[v] = e or nil; end,
1375 --dialogControl = "Dropdown", -- this is not standard, normal multiselect control gives us a list of all chars with toggle-boxes. UGLY! We want a multiselect-box instead. 1379 dialogControl = "Dropdown", -- this is not standard, normal multiselect control gives us a list of all chars with toggle-boxes. UGLY! We want a multiselect-box instead.
1376 }, 1380 },
1377 }, 1381 },
1378 }, 1382 },
1379 minimumStock = { 1383 minimumStock = {
1380 order = 10, 1384 order = 10,
1458 1462
1459 return temp; 1463 return temp;
1460 end, 1464 end,
1461 get = function(i, v) return addon.db.profile.defaults.trackAtCharacters[v]; end, 1465 get = function(i, v) return addon.db.profile.defaults.trackAtCharacters[v]; end,
1462 set = function(i, v, e) addon.db.profile.defaults.trackAtCharacters[v] = e or nil; end, 1466 set = function(i, v, e) addon.db.profile.defaults.trackAtCharacters[v] = e or nil; end,
1463 --dialogControl = "Dropdown", -- this is not standard, normal multiselect control gives us a list of all chars with toggle-boxes. UGLY! We want a multiselect-box instead. 1467 dialogControl = "Dropdown", -- this is not standard, normal multiselect control gives us a list of all chars with toggle-boxes. UGLY! We want a multiselect-box instead.
1464 }, 1468 },
1465 }, 1469 },
1466 }, 1470 },
1467 refill = { 1471 refill = {
1468 order = 20, 1472 order = 20,
1901 1905
1902 count = ( count + 1 ); 1906 count = ( count + 1 );
1903 end 1907 end
1904 end 1908 end
1905 end 1909 end
1910
1911
1912
1913
1914
1915
1916 -- Verify premade groups
1917
1918 function mod:PremadeGroupsCheck(updateGroupName, updateKey, accept)
1919 -- Compare the current premade groups with those used, notify about changes
1920 if addon.defaultGroups then
1921 for premadeGroupName, groupInfo in pairs(addon.defaultGroups) do
1922 -- Go through all default groups
1923
1924 for groupName, values in pairs(addon.db.profile.groups) do
1925 -- Go through all groups to find those with this premade group
1926
1927 if values.premadeGroups and values.premadeGroups[premadeGroupName] and values.premadeGroups[premadeGroupName] < groupInfo.version then
1928 -- Outdated group
1929
1930 if updateGroupName and updateKey then
1931 -- This function was called after pressing yes or no in a confirm box
1932
1933 if accept then
1934 -- Yes was clicked
1935
1936 for itemId, version in pairs(groupInfo.items) do
1937 -- Go through all items in this premade group
1938
1939 if version > values.premadeGroups[premadeGroupName] then
1940 -- This item was added in a more recent version than this group: Add item
1941
1942 if addon:InGroup(itemId) then
1943 print(("Skipping %s (#%d) as it is already in the group |cfffed000%s|r."):format(select(2, GetItemInfo(itemId)) or "Unknown", itemId, addon:InGroup(itemId)));
1944 elseif addon:AddItemToGroup(groupName, itemId) then
1945 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, addon:InGroup(itemId)));
1946 end
1947 elseif ( version * -1 ) > values.premadeGroups[premadeGroupName] then
1948 if addon:InGroup(itemId) == groupName then
1949 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, addon:InGroup(itemId), premadeGroupName));
1950 addon:RemoveItemFromGroup(groupName, itemId);
1951 else
1952 print(("Skipping the removal of %s (#%d) as it isn't in this group."):format(select(2, GetItemInfo(itemId)) or "Unknown", itemId, addon:InGroup(itemId)));
1953 end
1954 end
1955 end
1956
1957 -- Remember the new version
1958 values.premadeGroups[premadeGroupName] = groupInfo.version;
1959 else
1960 -- No was clicked
1961
1962 -- Let user know what was not added
1963 for itemId, version in pairs(groupInfo.items) do
1964 -- Go through all items in this premade group
1965
1966 if version > values.premadeGroups[premadeGroupName] then
1967 -- This item was added in a more recent version than this group: don't add (since we clicked no), but announce it
1968
1969 print(("Skipping %s (#%d) found in the premade group |cfffed000%s|r."):format(select(2, GetItemInfo(itemId)) or "Unknown", itemId, addon:InGroup(itemId)));
1970 end
1971 end
1972
1973 -- Remember the new version
1974 values.premadeGroups[premadeGroupName] = groupInfo.version;
1975 end
1976 else
1977 StaticPopupDialogs["InventoriumConfirmUpdatePremadeGroup"] = {
1978 text = "The premade group |cfffed000%s|r used in the group |cfffed000%s|r has been changed. Do you wish to copy these changes?",
1979 button1 = YES,
1980 button2 = NO,
1981 OnAccept = function()
1982 addon:PremadeGroupsCheck(groupName, premadeGroupName, true);
1983 end,
1984 OnCancel = function(_, _, reason)
1985 if reason == "clicked" then
1986 addon:PremadeGroupsCheck(groupName, premadeGroupName, false);
1987 end
1988 end,
1989 timeout = 0,
1990 whileDead = 1,
1991 hideOnEscape = 1,
1992 };
1993 StaticPopup_Show("InventoriumConfirmUpdatePremadeGroup", premadeGroupName, groupName);
1994
1995 return;
1996 end
1997 end
1998 end
1999 end
2000 end
2001 end