Mercurial > wow > mailopener
diff Modules/Collected.lua @ 31:90d58723ac0a
- Removed all BeanCounter checks in files.
+ Added a new module: BeanCounter Support. This module will now take care of preventing mail opening while BeanCounter is scanning.
+ Added AceHook library for the BeanCounter Support module.
~ Sorted the Core.lua OnInitialize to properly toggle modules before doing time consuming things.
~ All module comments are now a property of the modules themselves and can be retrieved with (string)?.moduleDescription? and (bool)?.moduleRequired?.
~ All module references are now called ?mod?.
! Added a new config group: Modules. This group will show the module statuses and descriptions and it will contain all optional modules (with their settings) as subgroups.
- Removed all libraries from the repository.
| author | Zerotorescue |
|---|---|
| date | Fri, 10 Sep 2010 18:59:58 +0200 |
| parents | c6f0976069c7 |
| children | 81e7cfcc36b9 |
line wrap: on
line diff
--- a/Modules/Collected.lua Thu Sep 09 22:16:50 2010 +0200 +++ b/Modules/Collected.lua Fri Sep 10 18:59:58 2010 +0200 @@ -1,19 +1,21 @@ local MailOpener = LibStub("AceAddon-3.0"):GetAddon("MailOpener"); -local Collected = MailOpener:NewModule("Collected", "AceEvent-3.0", "AceTimer-3.0"); +local mod = MailOpener:NewModule("Collected", "AceEvent-3.0", "AceTimer-3.0"); ---[[ -Module name: Collected -Description: Shows a simple summary of what has been collected at the mailbox. -Required: No. -]] +mod.moduleDescription = "Shows a simple summary of what has been collected at the mailbox."; +mod.moduleRequired = false; +-- Gold local previousGold, earned, sessionEarned; +-- Items local previousFreeSlotsAvailable, itemsGained, sessionItemsgained; +-- Mail local previousMailCount, mailOpened, sessionMailOpened; +-- Time local timeStarted, sessionTimeSpent; -- even though the first contains GetTime(), the second var will be filled with actual seconds + local updated; -function Collected:OnInitialize() +function mod:OnInitialize() local defaults = { profile = { trackGold = true, @@ -28,7 +30,7 @@ self.db = MailOpener.db:RegisterNamespace("Collected", defaults); end -function Collected:OnEnable() +function mod:OnEnable() self:Debug("OnEnable"); self:RegisterEvent("MAIL_SHOW"); @@ -47,7 +49,7 @@ end -- Even though Ace can unregister our events it's neater to do it manually too -function Collected:OnDisable() +function mod:OnDisable() self:Debug("OnDisable"); self:UnregisterEvent("MAIL_SHOW"); @@ -57,7 +59,7 @@ MailOpener:TogglePostalModule("Rake", true); end -function Collected:MAIL_SHOW() +function mod:MAIL_SHOW() self:Debug("MAIL_SHOW"); -- Unbind / reset all previous events and settings @@ -99,7 +101,7 @@ end end -function Collected:MAIL_CLOSED() +function mod:MAIL_CLOSED() self:Debug("MAIL_CLOSED"); self:Summarize(); @@ -107,7 +109,7 @@ self:Stop(); end -function Collected:PLAYER_MONEY() +function mod:PLAYER_MONEY() -- Sending mail does not interest us, so only remember what we earned local currentGold = GetMoney(); @@ -126,7 +128,7 @@ previousGold = currentGold; end -function Collected:BAG_UPDATE() +function mod:BAG_UPDATE() -- Sending mail does not interest us, so only remember what we earned local freeSlotAvailable = self:GetNumFreeSlots(); @@ -156,7 +158,7 @@ previousFreeSlotsAvailable = freeSlotAvailable; end -function Collected:MAIL_INBOX_UPDATE() +function mod:MAIL_INBOX_UPDATE() local numItems, _ = GetInboxNumItems(); if previousMailCount == nil then @@ -180,7 +182,7 @@ end end -function Collected:MO_OPEN_COMPLETE() +function mod:MO_OPEN_COMPLETE() -- Only summarize when changed if updated then self:Summarize(); @@ -189,7 +191,7 @@ end end -function Collected:Stop() +function mod:Stop() self:UnregisterEvent("MAIL_CLOSED"); -- Batch summary @@ -216,7 +218,7 @@ timeStarted = nil; end -function Collected:Summarize() +function mod:Summarize() -- Message buffer, append details we have data for local printMessage = ""; @@ -287,7 +289,7 @@ end end -function Collected:GetNumFreeSlots() +function mod:GetNumFreeSlots() local slotsAvailable = 0; for bag = 0, 4 do slotsAvailable = ( slotsAvailable + GetContainerNumFreeSlots(bag) ); @@ -296,10 +298,10 @@ return slotsAvailable; end -function Collected:GetOptionsGroup() +function mod:GetOptionsGroup() local configGroup = { - order = 400, - type = "group", + order = 0, + type = "modulesSubGroup", name = "Collected", desc = "Change settings for the collected module.", args = { @@ -313,13 +315,15 @@ order = 10, type = "description", name = function() - local default = "With this button you can completely toggle this module |cff00ff00on|r or |cffff0000off|r. This setting will be remembered and the module will be automatically toggled |cff00ff00on|r or |cffff0000off|r upon logon as it was last set.\n\n"; + local descText = "With this button you can completely toggle this module |cff00ff00on|r or |cffff0000off|r. This setting will be remembered and the module will be automatically toggled |cff00ff00on|r or |cffff0000off|r upon logon as it was last set.\n\n"; if self:IsEnabled() then - return default .. "Status: |cff00ff00Enabled|r"; + descText = descText .. "Status: |cff00ff00Enabled|r"; else - return default .. "Status: |cffff0000Disabled|r"; + descText = descText .. "Status: |cffff0000Disabled|r"; end + + return descText; end, }, disable = { @@ -466,6 +470,6 @@ return configGroup; end -function Collected:Debug(t) +function mod:Debug(t) return MailOpener:Debug("|cffff0000Collected|r:" .. t); end \ No newline at end of file
