Fixes for the gold module that close issue #65 and Ui error in combat
Mikeprod [11-12-16 - 23:17]
Fixes for the gold module that close issue #65 and Ui error in combat
diff --git a/core.lua b/core.lua
index a18b99c..41ca209 100644
--- a/core.lua
+++ b/core.lua
@@ -3,8 +3,6 @@ local _G = _G;
local pairs, unpack, select = pairs, unpack, select
LibStub("AceAddon-3.0"):NewAddon(XIVBar, AddOnName, "AceConsole-3.0", "AceEvent-3.0");
local L = LibStub("AceLocale-3.0"):GetLocale(AddOnName, true);
-local doitOnce = true
-local topOffsetBlizz
XIVBar.L = L
@@ -207,22 +205,18 @@ end
function XIVBar:Refresh()
if self.frames.bar == nil then return; end
-
- if doitOnce then
- topOffsetBlizz = UIParent_UpdateTopFramePositions
- doitOnce = false
- end
self.miniTextPosition = "TOP"
if self.db.profile.general.barPosition == 'TOP' then
- UIParent_UpdateTopFramePositions = topOffsetBlizz
hooksecurefunc("UIParent_UpdateTopFramePositions",function(self)
- if OrderHallCommandBar and OrderHallCommandBar:IsVisible() then
- if XIVBar.db.profile.general.ohHide then
- OrderHallCommandBar:Hide()
+ if(XIVBar.db.profile.general.barPosition == 'TOP') then
+ if OrderHallCommandBar and OrderHallCommandBar:IsVisible() then
+ if XIVBar.db.profile.general.ohHide then
+ OrderHallCommandBar:Hide()
+ end
end
+ OffsetUI()
end
- OffsetUI()
end)
OffsetUI()
self.miniTextPosition = 'BOTTOM'
diff --git a/modules/gold.lua b/modules/gold.lua
index 2b369f7..2f95385 100644
--- a/modules/gold.lua
+++ b/modules/gold.lua
@@ -79,6 +79,7 @@ function GoldModule:Refresh()
self.bagText:SetPoint('LEFT', self.goldText, 'RIGHT', 5, 0)
bagWidth = self.bagText:GetStringWidth()
else
+ self.bagText:SetFont(xb:GetFont(db.text.fontSize))
self.bagText:SetText('')
self.bagText:SetSize(0, 0)
end
@@ -181,6 +182,18 @@ function GoldModule:PLAYER_MONEY()
self:Refresh()
end
+local function shortenNumber(num)
+ if num < 1000 then
+ return tostring(num)
+ elseif num < 1000000 then
+ return format("%.1fK",num/1000)
+ elseif num < 1000000000 then
+ return format("%.2fM",num/1000000)
+ else
+ return format("%.3fB",num/1000000000)
+ end
+end
+
function GoldModule:FormatCoinText(money)
local showSC = xb.db.profile.modules.gold.showSmallCoins
local shortThousands = xb.db.profile.modules.gold.shortThousands
@@ -189,8 +202,7 @@ function GoldModule:FormatCoinText(money)
if g > 0 then
formattedString = '%s'..GOLD_AMOUNT_SYMBOL
if g > 1000 and shortThousands then
- g = floor(abs(g / 1000))
- formattedString = '%s'..FIRST_NUMBER_CAP_NO_SPACE..GOLD_AMOUNT_SYMBOL
+ formattedString = shortenNumber(g)..GOLD_AMOUNT_SYMBOL
end
end
if s > 0 and (g < 1 or showSC) then
@@ -212,6 +224,7 @@ function GoldModule:FormatCoinText(money)
end
return ret
end
+
function GoldModule:SeparateCoins(money)
local gold, silver, copper = floor(abs(money / 10000)), floor(abs(mod(money / 100, 100))), floor(abs(mod(money, 100)))
return gold, silver, copper
diff --git a/modules/micromenu.lua b/modules/micromenu.lua
index edb49ae..7745caf 100644
--- a/modules/micromenu.lua
+++ b/modules/micromenu.lua
@@ -67,8 +67,8 @@ function MenuModule:OnEnable()
self:CreateFrames()
self:RegisterFrameEvents()
self:CreateIcons()
- self:Refresh()
end
+ xb:Refresh()
end
function MenuModule:OnDisable()