Permalink
Browse files

Many updates, trying to ignore "Icon\r" once more.

  • Loading branch information...
1 parent d2997cf commit ad32a20645ed49d2a0f40948775c48ebeccfac3f @Jaliborc Jaliborc committed Apr 29, 2012
Showing with 65 additions and 94 deletions.
  1. BIN .DS_Store
  2. +1 −0 .gitignore
  3. +1 −1 Bagnon.toc
  4. +7 −2 Bindings.xml
  5. +13 −1 Changelog.txt
  6. +38 −87 components/moneyFrame.lua
  7. BIN libs/.DS_Store
  8. +1 −0 localization/en.lua
  9. +4 −3 main.lua
View
BIN .DS_Store
Binary file not shown.
View
1 .gitignore
@@ -0,0 +1 @@
+Icon^M^M
View
2 Bagnon.toc
@@ -5,7 +5,7 @@
## SavedVariablesPerCharacter: BagnonFrameSettings
## SavedVariables: BagnonGlobalSettings
-## Version: 4.3.17
+## Version: 4.3.21
## OptionalDeps: LibStub, Ace3, LibItemSearch-1.0, LibItemCache-1.0, Unfit-1.0, BagBrother, BagSync, Armory
libs\libs.xml
View
9 Bindings.xml
@@ -1,8 +1,13 @@
<Bindings>
- <Binding name="BAGNON_TOGGLE" description="BINDING_NAME_BAGNON_TOGGLE" header="BAGNON">
+ <Binding name="BAGNON_TOGGLE" header="BAGNON">
Bagnon:ToggleFrame('inventory')
</Binding>
- <Binding name="BANKNON_TOGGLE" description="BINDING_NAME_BANKNON_TOGGLE">
+ <Binding name="BAGNON_BANK_TOGGLE">
Bagnon:ToggleFrame('bank')
</Binding>
+ <Binding name="BAGNON_VAULT_TOGGLE">
+ if LoadAddOn('Bagnon_VoidStorage') then
+ Bagnon:ToggleFrame('voidstorage')
+ end
+ </Binding>
</Bindings>
View
14 Changelog.txt
@@ -1,7 +1,19 @@
+====== 4.3.21
+* Fixed bug when depositing money on guild bank
+
+====== 4.3.20
+* Added binding to toggle Void Storage
+* Fixed bug causing GuildBank money frame to be unresponsive to clicks
+
+====== 4.3.19
+* VoidStorage and GuildBank hotfixes
+* Tagging as release
+
====== 4.3.18 (beta)
* Guild Bank and Void Storage now displays items in the same order as in the default interface
* German and Portuguese localizations update
* Void Storage bugfixes
+* Money frame tooltip redesigned
====== 4.3.17 (beta)
* Fixed a bug causing weird behavior when the void storage was configured while transferring items.
@@ -364,4 +376,4 @@
* Fixed bank frame closing
* Fixed an error when hovering over a bank item when at the bank
* Fixed an error when clicking on a databroker object with no click event
-* Added sounds when opening/closing framessssessess opening/closing framessssessess
+* Added sounds when opening/closing framessssessess opening/closing framessssessesss opening/closing framessssessess
View
125 components/moneyFrame.lua
@@ -5,62 +5,31 @@
local Bagnon = LibStub('AceAddon-3.0'):GetAddon('Bagnon')
local MoneyFrame = Bagnon:NewClass('MoneyFrame', 'Frame')
-local ItemCache = LibStub('LibItemCache-1.0')
-
local L = LibStub('AceLocale-3.0'):GetLocale('Bagnon')
-local GOLD_TEXT = format('|cffffd700%s|r', 'g')
-local SILVER_TEXT = format('|cffc7c7cf%s|r', 's')
-local COPPER_TEXT = format('|cffeda55f%s|r', 'c')
+local ItemCache = LibStub('LibItemCache-1.0')
--[[ Constructor ]]--
function MoneyFrame:New(frameID, parent)
- local name = 'BagnonMoneyFrame' .. self:GetNextID()
- local f = self:Bind(CreateFrame('Button', name, parent, 'SmallMoneyFrameTemplate'))
- local click = CreateFrame('Button', nil, f)
- click:SetFrameLevel(self:GetFrameLevel() + 3)
- click:SetAllPoints()
-
- f:SetScript('OnEvent', f.UpdateValue)
- f:SetScript('OnClick', f.OnClick)
- f:SetScript('OnShow', f.OnShow)
- f:SetScript('OnHide', f.OnHide)
-
- f:AddClickFrame(click)
+ local f = self:Bind(CreateFrame('Button', parent:GetName() .. 'MoneyFrame', parent, 'SmallMoneyFrameTemplate'))
f:SetFrameID(frameID)
f:SetHeight(24)
- return f
-end
-
---creates a clickable frame for tooltips/etc
-do
- local function ClickFrame_OnClick(self, button)
- self:GetParent():OnClick(button)
- end
-
- local function ClickFrame_OnEnter(self)
- self:GetParent():OnEnter()
- end
-
- local function ClickFrame_OnLeave(self)
- self:GetParent():OnLeave()
- end
+
+ local click = CreateFrame('Button', f:GetName() .. 'Click', f)
+ click:SetFrameLevel(self:GetFrameLevel() + 4)
+ click:RegisterForClicks('anyUp')
+ click:SetAllPoints()
+
+ click:SetScript('OnClick', function(_, ...) f:OnClick(...) end)
+ click:SetScript('OnEnter', function() f:OnEnter() end)
+ click:SetScript('OnLeave', function() f:OnLeave() end)
- function MoneyFrame:AddClickFrame(frame)
- frame:SetScript('OnClick', ClickFrame_OnClick)
- frame:SetScript('OnEnter', ClickFrame_OnEnter)
- frame:SetScript('OnLeave', ClickFrame_OnLeave)
- end
-end
+ f:SetScript('OnShow', f.UpdateEverything)
+ f:SetScript('OnHide', f.UpdateEvents)
+ f:SetScript('OnEvent', f.UpdateValue)
-do
- local id = 0
- function MoneyFrame:GetNextID()
- local nextID = id + 1
- id = nextID
- return nextID
- end
+ return f
end
@@ -75,14 +44,6 @@ end
--[[ Frame Events ]]--
-function MoneyFrame:OnShow()
- self:UpdateEverything()
-end
-
-function MoneyFrame:OnHide()
- self:UpdateEvents()
-end
-
function MoneyFrame:OnClick()
local name = self:GetName()
@@ -105,27 +66,29 @@ function MoneyFrame:OnEnter()
return
end
- GameTooltip:SetOwner(self, 'ANCHOR_TOPRIGHT')
- GameTooltip:SetText(format(L.TipGoldOnRealm, GetRealmName()))
+ -- Total
+ local total = 0
+ for i, player in ItemCache:IteratePlayers() do
+ total = total + ItemCache:GetMoney(player)
+ end
- local totalMoney = 0
+ GameTooltip:SetOwner(self, 'ANCHOR_BOTTOM')
+ GameTooltip:AddDoubleLine(L.Total, GetCoinTextureString(total), nil,nil,nil, 1,1,1)
+ GameTooltip:AddLine(' ')
+
+ -- Each player
for i, player in ItemCache:IteratePlayers() do
local money = ItemCache:GetMoney(player)
if money > 0 then
- totalMoney = totalMoney + money
- self:AddPlayer(player, money)
+ GameTooltip:AddDoubleLine(player, self:GetCoinsText(money), 1,1,1, 1,1,1)
end
end
-
- GameTooltip:AddLine('----------------------------------------')
- self:AddPlayer(L.Total, totalMoney)
+
GameTooltip:Show()
end
function MoneyFrame:OnLeave()
- if GameTooltip:IsOwned(self) then
- GameTooltip:Hide()
- end
+ GameTooltip:Hide()
end
@@ -177,42 +140,30 @@ function MoneyFrame:GetMoney()
end
---[[ API ]]--
-
-function MoneyFrame:AddPlayer(player, money)
- GameTooltip:AddDoubleLine(player, self:GetCoinsText(money), 1, 1, 1, 1, 1, 1, 0)
-end
+--[[ Methods ]]--
function MoneyFrame:GetCoinsText(money)
local gold, silver, copper = self:GetCoins(money)
- local text
+ local text = ''
if gold > 0 then
- text = format('|cffffffff%d|r%s', gold, GOLD_TEXT)
+ text = format('%d|cffffd700%s|r', gold, GOLD_AMOUNT_SYMBOL)
end
if silver > 0 then
- if text then
- text = text .. string.format(' |cffffffff%d|r%s', silver, SILVER_TEXT)
- else
- text = format('|cffffffff%d|r%s', silver, SILVER_TEXT)
- end
+ text = text .. format(' %d|cffc7c7cf%s|r', silver, SILVER_AMOUNT_SYMBOL)
end
- if copper > 0 or (gold == 0 and silver == 0) then
- if text then
- text = text .. format(' |cffffffff%d|r%s', copper, COPPER_TEXT)
- else
- text = format('|cffffffff%d|r%s', copper, COPPER_TEXT)
- end
+ if copper > 0 or money == 0 then
+ text = text .. format(' %d|cffeda55f%s|r', copper, COPPER_AMOUNT_SYMBOL)
end
return text
end
function MoneyFrame:GetCoins(money)
- local gold = floor(money / (COPPER_PER_SILVER * SILVER_PER_GOLD))
- local silver = floor((money - (gold * COPPER_PER_SILVER * SILVER_PER_GOLD)) / COPPER_PER_SILVER)
- local copper = money % COPPER_PER_SILVER
- return gold, silver, copper
+ local gold = floor(money / (COPPER_PER_SILVER * SILVER_PER_GOLD))
+ local silver = floor((money - (gold * COPPER_PER_SILVER * SILVER_PER_GOLD)) / COPPER_PER_SILVER)
+ local copper = money % COPPER_PER_SILVER
+ return gold, silver, copper
end
View
BIN libs/.DS_Store
Binary file not shown.
View
1 localization/en.lua
@@ -8,6 +8,7 @@ local L = LibStub('AceLocale-3.0'):NewLocale('Bagnon', 'enUS', true)
--keybinding text
L.ToggleBags = 'Toggle Inventory'
L.ToggleBank = 'Toggle Bank'
+L.ToggleVault = 'Toggle Void Storage'
--system messages
View
7 main.lua
@@ -4,16 +4,17 @@
--]]
Bagnon = LibStub('AceAddon-3.0'):NewAddon('Bagnon', 'AceEvent-3.0', 'AceConsole-3.0')
-local L = LibStub('AceLocale-3.0'):GetLocale('Bagnon')
+Bagnon.frames = {}
+local L = LibStub('AceLocale-3.0'):GetLocale('Bagnon')
BINDING_HEADER_BAGNON = 'Bagnon'
BINDING_NAME_BAGNON_TOGGLE = L.ToggleBags
-BINDING_NAME_BANKNON_TOGGLE = L.ToggleBank
+BINDING_NAME_BAGNON_BANK_TOGGLE = L.ToggleBank
+BINDING_NAME_BAGNON_VAULT_TOGGLE = L.ToggleVault
--[[ Startup ]]--
-Bagnon.frames = {}
function Bagnon:OnInitialize()
self:AddSlashCommands()
self:RegisterAutoDisplayEvents()

0 comments on commit ad32a20

Please sign in to comment.