Mercurial > wow > inventory
comparison Core.lua @ 69:6329ee822172
Group functions moved to the config module, this should fix an issue with the item list not updating when adding items.
author | Zerotorescue |
---|---|
date | Thu, 23 Dec 2010 14:02:04 +0100 |
parents | 057f6661ad9d |
children | 8d11fc88ecab |
comparison
equal
deleted
inserted
replaced
68:710f03653aaf | 69:6329ee822172 |
---|---|
330 | 330 |
331 | 331 |
332 | 332 |
333 | 333 |
334 | 334 |
335 -- Group functions | |
336 | |
337 function addon:InGroup(itemId) | |
338 -- Go through all groups to see if this item is already somewhere | |
339 for groupName, values in pairs(addon.db.profile.groups) do | |
340 if values.items and values.items[itemId] then | |
341 return groupName; | |
342 end | |
343 end | |
344 | |
345 return; | |
346 end | |
347 | |
348 function addon:AddItemToGroup(groupName, itemId) | |
349 if self:InGroup(itemId) then | |
350 return false; | |
351 end | |
352 | |
353 if not addon.db.profile.groups[groupName].items then | |
354 addon.db.profile.groups[groupName].items = {}; | |
355 end | |
356 | |
357 -- Set this item | |
358 addon.db.profile.groups[groupName].items[itemId] = true; | |
359 | |
360 if AceConfigRegistry then | |
361 -- Now rebuild the list | |
362 AceConfigRegistry:NotifyChange("InventoriumOptions"); | |
363 end | |
364 | |
365 return true; | |
366 end | |
367 | |
368 function addon:RemoveItemFromGroup(groupName, itemId) | |
369 if self:InGroup(itemId) ~= groupName then | |
370 return false; | |
371 end | |
372 | |
373 -- Unset this item | |
374 addon.db.profile.groups[groupName].items[itemId] = nil; | |
375 | |
376 return true; | |
377 end | |
378 | |
379 | |
380 | |
381 | |
382 | |
383 -- Readable money | 335 -- Readable money |
384 | 336 |
385 local goldText = "%s%d|cffffd700g|r "; | 337 local goldText = "%s%d|cffffd700g|r "; |
386 local silverText = "%s%d|cffc7c7cfs|r "; | 338 local silverText = "%s%d|cffc7c7cfs|r "; |
387 local copperText = "%s%d|cffeda55fc|r"; | 339 local copperText = "%s%d|cffeda55fc|r"; |