comparison Core.lua @ 132:0eaec1b52a63

Ticket 40 - Added options to enable counting guild bank inventory.
author Asa Ayers <Asa.Ayers@Gmail.com>
date Wed, 15 Sep 2010 21:33:54 -0700
parents 451d8a19edea
children 5eefa40e2a29
comparison
equal deleted inserted replaced
131:78c6d905c2e1 132:0eaec1b52a63
66 factionrealm = { 66 factionrealm = {
67 item_account = {}, 67 item_account = {},
68 items = {}, 68 items = {},
69 outbound_cod = {}, 69 outbound_cod = {},
70 mailbox = {}, 70 mailbox = {},
71 queue = {} 71 queue = {},
72 enabled_guilds = {},
72 }, 73 },
73 } 74 }
74 75
75 function ItemAuditor:OnInitialize() 76 function ItemAuditor:OnInitialize()
76 self.db = LibStub("AceDB-3.0"):New("ItemAuditorDB", ItemAuditor.DB_defaults, true) 77 self.db = LibStub("AceDB-3.0"):New("ItemAuditorDB", ItemAuditor.DB_defaults, true)
384 count = count + (DataStore:GetAuctionHouseItemCount(character, searchID) or 0) 385 count = count + (DataStore:GetAuctionHouseItemCount(character, searchID) or 0)
385 count = count + (DataStore:GetInventoryItemCount(character, searchID) or 0) 386 count = count + (DataStore:GetInventoryItemCount(character, searchID) or 0)
386 count = count + (DataStore:GetMailItemCount(character, searchID) or 0) 387 count = count + (DataStore:GetMailItemCount(character, searchID) or 0)
387 count = count + (DataStore:GetCurrencyItemCount(character, searchID) or 0) 388 count = count + (DataStore:GetCurrencyItemCount(character, searchID) or 0)
388 end 389 end
390 for guildName in pairs(self.db.factionrealm.enabled_guilds) do
391 count = count + DataStore:GetGuildBankItemCount(DataStore:GetGuilds()[guildName], searchID)
392 end
393
389 local itemName = GetItemInfo(searchID) 394 local itemName = GetItemInfo(searchID)
390 for character, mailbox in pairs(allMailboxes) do 395 for character, mailbox in pairs(allMailboxes) do
391 for type, items in pairs(mailbox) do 396 for type, items in pairs(mailbox) do
392 if type == 'AHWon' or type == 'COD' then 397 if type == 'AHWon' or type == 'COD' then
393 for name, data in pairs(items) do 398 for name, data in pairs(items) do
568 end 573 end
569 return ceil(item.invested), 0, count 574 return ceil(item.invested), 0, count
570 end 575 end
571 return 0, 0, ItemAuditor:GetItemCount(ItemAuditor:GetIDFromLink(link)) 576 return 0, 0, ItemAuditor:GetItemCount(ItemAuditor:GetIDFromLink(link))
572 end 577 end
578
579 ItemAuditor.Options.args.misc= {
580 name = "Misc",
581 type = 'group',
582 args = {
583 },
584 }
585 local function GetGuild(info)
586 local guildName = info[#(info)]
587 return (ItemAuditor.db.factionrealm.enabled_guilds[guildName] == true)
588 end
589
590 local function SetGuild(info, value)
591 local guildName = info[#(info)]
592 ItemAuditor.db.factionrealm.enabled_guilds[guildName] = value or nil
593 end
594
595 for guildName in pairs(DataStore:GetGuilds()) do
596 ItemAuditor.Options.args.misc.args[guildName] = {
597 type = "toggle",
598 name = "Count "..guildName.." Guild Bank",
599 get = GetGuild,
600 set = SetGuild,
601 order = 11,
602 }
603 end