Mercurial > wow > inventory
comparison Core.lua @ 10:c4d0e5d47e10
Ok, please don?t crash again you silly Ace3 multiselect dropdown box. I know you?re itchy, but there?s nothing I can do for you.
Cleaned up group management layout, added a duplicate group button.
Track at character data is erased when exporting/importing groups.
Duplicate items are erased when importing groups.
Bug fixes and speed increases in Summary.
Added a button to refresh the cache.
Added a slider to increase caching speed.
Auction value will no longer be cached if the threshold was set to 0.
author | Zerotorescue |
---|---|
date | Tue, 12 Oct 2010 02:08:37 +0200 |
parents | 3bac0bdd59e2 |
children | 10a2244f7ff0 |
comparison
equal
deleted
inserted
replaced
9:3bac0bdd59e2 | 10:c4d0e5d47e10 |
---|---|
525 if _G['AceGUI30Pullout' .. i] then | 525 if _G['AceGUI30Pullout' .. i] then |
526 _G['AceGUI30Pullout' .. i]:Hide(); | 526 _G['AceGUI30Pullout' .. i]:Hide(); |
527 end | 527 end |
528 end | 528 end |
529 end, | 529 end, |
530 confirm = true, | |
530 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. | 531 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. |
531 }, | 532 }, |
532 }, | 533 }, |
533 }, | 534 }, |
534 refill = { | 535 refill = { |
1015 end | 1016 end |
1016 | 1017 |
1017 return temp; | 1018 return temp; |
1018 end, | 1019 end, |
1019 get = GetMultiOption, | 1020 get = GetMultiOption, |
1021 confirm = true, | |
1020 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. | 1022 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. |
1021 arg = "overrideTrackAtCharacters", | 1023 arg = "overrideTrackAtCharacters", |
1022 }, | 1024 }, |
1023 }, | 1025 }, |
1024 }, | 1026 }, |
1141 order = 20, | 1143 order = 20, |
1142 type = "group", | 1144 type = "group", |
1143 name = "Group Management", | 1145 name = "Group Management", |
1144 desc = "Rename, delete or export this group.", | 1146 desc = "Rename, delete or export this group.", |
1145 args = { | 1147 args = { |
1146 rename = { | 1148 actions = { |
1147 order = 10, | 1149 order = 10, |
1148 type = "group", | 1150 type = "group", |
1149 name = "Rename", | 1151 name = "Actions", |
1150 inline = true, | 1152 inline = true, |
1151 args = { | 1153 args = { |
1152 rename = { | 1154 rename = { |
1153 order = 10, | 1155 order = 10, |
1154 type = "input", | 1156 type = "input", |
1155 name = "New group name", | 1157 name = "Rename group - New name", |
1156 desc = "Change the name of this group to something else. You can also use item links here as you wish.", | 1158 desc = "Change the name of this group to something else. You can also use item links here as you wish.", |
1157 validate = ValidateGroupName, | 1159 validate = ValidateGroupName, |
1158 set = function(info, value) | 1160 set = function(info, value) |
1159 local oldGroupName = groupIdToName[info[2]]; | 1161 local oldGroupName = groupIdToName[info[2]]; |
1160 | 1162 |
1168 addon:FillGroupOptions(); | 1170 addon:FillGroupOptions(); |
1169 end, | 1171 end, |
1170 get = function(info) | 1172 get = function(info) |
1171 return groupIdToName[info[2]]; | 1173 return groupIdToName[info[2]]; |
1172 end, | 1174 end, |
1173 width = "double", | 1175 }, |
1174 }, | 1176 duplicate = { |
1175 }, | 1177 order = 20, |
1176 }, | 1178 type = "input", |
1177 delete = { | 1179 name = "Duplicate group - New name", |
1178 order = 20, | 1180 desc = "Duplicate this group. You can also use item links here as you wish.\n\nAll item data will be erased.", |
1179 type = "group", | 1181 validate = ValidateGroupName, |
1180 name = "Delete", | 1182 set = function(info, value) |
1181 inline = true, | 1183 local oldGroupName = groupIdToName[info[2]]; |
1182 args = { | 1184 |
1185 addon.db.global.groups[value] = CopyTable(addon.db.global.groups[oldGroupName]); | |
1186 | |
1187 -- Reset item data (duplicate items me no want) | |
1188 addon.db.global.groups[value].items = nil; | |
1189 | |
1190 addon:FillGroupOptions(); | |
1191 end, | |
1192 get = false, | |
1193 }, | |
1183 delete = { | 1194 delete = { |
1184 order = 10, | 1195 order = 30, |
1185 type = "execute", | 1196 type = "execute", |
1186 name = "Delete group", | 1197 name = "Delete group", |
1187 desc = "Delete the currently selected group.", | 1198 desc = "Delete the currently selected group.", |
1188 confirm = true, | 1199 confirm = true, |
1189 confirmText = "Are you sure you wish to |cffff0000DELETE|r this group? This action is not reversable!", | 1200 confirmText = "Are you sure you wish to |cffff0000DELETE|r this group? This action is not reversable!", |
1196 end, | 1207 end, |
1197 }, | 1208 }, |
1198 }, | 1209 }, |
1199 }, | 1210 }, |
1200 export = { | 1211 export = { |
1201 order = 30, | 1212 order = 40, |
1202 type = "group", | 1213 type = "group", |
1203 name = "Export", | 1214 name = "Export", |
1204 inline = true, | 1215 inline = true, |
1205 args = { | 1216 args = { |
1206 input = { | 1217 input = { |
1453 if not AceSerializer then | 1464 if not AceSerializer then |
1454 AceSerializer = LibStub("AceSerializer-3.0"); | 1465 AceSerializer = LibStub("AceSerializer-3.0"); |
1455 end | 1466 end |
1456 | 1467 |
1457 local result, temp = AceSerializer:Deserialize(current); | 1468 local result, temp = AceSerializer:Deserialize(current); |
1458 local name; | |
1459 | 1469 |
1460 if not temp.name then | 1470 if not temp.name then |
1461 print("|cffff0000The provided data is not supported.|r"); | 1471 print("|cffff0000The provided data is not supported.|r"); |
1462 return; | 1472 elseif ValidateGroupName(nil, temp.name) ~= true then |
1473 print(("|cffff0000Aborting: A group named \"%s\" already exists.|r"):format(temp.name)); | |
1463 else | 1474 else |
1464 name = temp.name; | 1475 local name = temp.name; |
1465 temp.name = nil; | 1476 temp.name = nil; |
1466 print(("Importing %s..."):format(name)); | 1477 print(("Importing %s..."):format(name)); |
1478 | |
1479 -- Remove items that are already in another group | |
1480 for value, _ in pairs(temp.items) do | |
1481 local itemId = tonumber(itemid); | |
1482 | |
1483 if not itemId then | |
1484 print(("\"%s\" is not a number."):format(value)); | |
1485 temp.items[value] = nil; | |
1486 elseif InGroup(itemId) then | |
1487 print(("Skipping %s (#%d) as it is already in the group |cfffed000%s|r."):format(select(2, GetItemInfo(itemId)) or "Unknown", itemId, InGroup(itemId))); | |
1488 temp.items[value] = nil; | |
1489 else | |
1490 -- Ensure the keys are numeric | |
1491 temp.items[value] = nil; | |
1492 temp.items[itemId] = true; | |
1493 end | |
1494 end | |
1495 | |
1496 -- Ensure this data isn't received (this would be buggy as exports from other accounts won't know what to do with this) | |
1497 temp.trackAtCharacters = nil; | |
1498 temp.overrideTrackAtCharacters = nil; | |
1499 | |
1500 self.db.global.groups[name] = temp; | |
1467 end | 1501 end |
1468 | |
1469 local newGroupName = string.trim(string.lower(name or "")); | |
1470 | |
1471 for name in pairs(self.db.global.groups) do | |
1472 if string.lower(name) == newGroupName then | |
1473 print(("|cffff0000Aborting: A group named \"%s\" already exists.|r"):format(name)); | |
1474 return; | |
1475 end | |
1476 end | |
1477 | |
1478 -- Remove items that are already in another group | |
1479 for value, _ in pairs(temp.items) do | |
1480 local itemId = tonumber(itemid); | |
1481 | |
1482 if not itemId then | |
1483 print(("\"%s\" is not a number."):format(value)); | |
1484 temp.items[value] = nil; | |
1485 elseif InGroup(itemId) then | |
1486 print(("Skipping %s (#%d) as it is already in the group |cfffed000%s|r."):format(select(2, GetItemInfo(itemId)) or "Unknown", itemId, InGroup(itemId))); | |
1487 temp.items[value] = nil; | |
1488 else | |
1489 -- Ensure the keys are numeric | |
1490 temp.items[value] = nil; | |
1491 temp.items[itemId] = true; | |
1492 end | |
1493 end | |
1494 | |
1495 -- Ensure this data isn't received (this would be buggy as exports from other accounts won't know what to do with this) | |
1496 temp.trackAtCharacters = nil; | |
1497 temp.overrideTrackAtCharacters = nil; | |
1498 | |
1499 self.db.global.groups[name] = temp; | |
1500 | |
1501 self:FillGroupOptions(); | |
1502 end | 1502 end |
1503 | |
1504 self:FillGroupOptions(); | |
1503 end, | 1505 end, |
1504 get = false, | 1506 get = false, |
1505 width = "full", | 1507 width = "full", |
1506 }, | 1508 }, |
1507 }, | 1509 }, |