Quantcast

Some fixes

MilleXIV [08-30-16 - 12:34]
Some fixes

Closes #25, and gold error part of #23
Filename
locales/enUS.lua
modules/gold.lua
modules/talent.lua
modules/travel.lua
diff --git a/locales/enUS.lua b/locales/enUS.lua
index 362b128..791b2d8 100644
--- a/locales/enUS.lua
+++ b/locales/enUS.lua
@@ -77,6 +77,9 @@ L['Hide Event Text'] = true;

 L['Travel'] = true;
 L['Port Options'] = true;
+L['Ready'] = true;
+L['Travel Cooldowns'] = true;
+L['Change Port Option'] = true;

 L['Gold'] = true;
 L['Always Show Silver and Copper'] = true;
diff --git a/modules/gold.lua b/modules/gold.lua
index f459ebe..2031341 100644
--- a/modules/gold.lua
+++ b/modules/gold.lua
@@ -43,12 +43,14 @@ function GoldModule:Refresh()
   if not db.modules.gold.enabled then return; end

   if InCombatLockdown() then
+    self.goldText:SetFont(xb:GetFont(db.text.fontSize))
     self.goldText:SetText(self:FormatCoinText(GetMoney()))
     if db.modules.gold.showFreeBagSpace then
       local freeSpace = 0
       for i = 0, 4 do
         freeSpace = freeSpace + GetContainerNumFreeSlots(i)
       end
+      self.bagText:SetFont(xb:GetFont(db.text.fontSize))
       self.bagText:SetText('('..tostring(freeSpace)..')')
     end
     return
diff --git a/modules/talent.lua b/modules/talent.lua
index 7f403cf..f4c840d 100644
--- a/modules/talent.lua
+++ b/modules/talent.lua
@@ -173,8 +173,10 @@ function TalentModule:RegisterFrameEvents()
   self.specFrame:SetScript('OnEnter', function()
     if InCombatLockdown() then return; end
     self.specText:SetTextColor(unpack(xb:HoverColors()))
-    if xb.db.profile.modules.tradeskill.showTooltip and ((not self.specPopup:IsVisible()) or (not self.lootSpecPopup:IsVisible())) then
-      self:ShowTooltip()
+    if xb.db.profile.modules.tradeskill.showTooltip then
+      if ((not self.specPopup:IsVisible()) or (not self.lootSpecPopup:IsVisible())) then
+        self:ShowTooltip()
+      end
     end
   end)
   self.specFrame:SetScript('OnLeave', function()
diff --git a/modules/travel.lua b/modules/travel.lua
index 604565a..fe90347 100644
--- a/modules/travel.lua
+++ b/modules/travel.lua
@@ -132,13 +132,53 @@ function TravelModule:RegisterFrameEvents()

   self.portButton:SetScript('OnEnter', function()
     TravelModule:SetPortColor()
+    if InCombatLockdown() then return; end
+
+    GameTooltip:SetOwner(self.portButton, 'ANCHOR_'..xb.miniTextPosition)
+    GameTooltip:ClearLines()
+    GameTooltip:AddLine("[|cff6699FF"..L['Travel Cooldowns'].."|r]")
+    for i, v in ipairs(self.portOptions) do
+      if IsUsableItem(v.portId) or IsPlayerSpell(v.portId) then
+        if IsUsableItem(v.portId) then
+          local _, cd, _ = GetItemCooldown(v.portId)
+          local cdString = self:FormatCooldown(cd)
+          GameTooltip:AddDoubleLine(v.text, cdString, 1, 1, 0, 1, 1, 1)
+        end
+        if IsPlayerSpell(v.portId) then
+          local _, cd, _ = GetSpellCooldown(v.portId)
+          local cdString = self:FormatCooldown(cd)
+          GameTooltip:AddDoubleLine(v.text, cdString, 1, 1, 0, 1, 1, 1)
+        end
+      end
+    end
+    GameTooltip:AddLine(" ")
+    GameTooltip:AddDoubleLine('<'..L['Right-Click']..'>', L['Change Port Option'], 1, 1, 0, 1, 1, 1)
+    GameTooltip:Show()
   end)

   self.portButton:SetScript('OnLeave', function()
     TravelModule:SetPortColor()
+    GameTooltip:Hide()
   end)
 end

+function TravelModule:FormatCooldown(cdTime)
+  if cdTime <= 0 then
+    return L['Ready']
+  end
+  local hours = string.format("%02.f", math.floor(cdTime / 3600))
+  local minutes = string.format("%02.f", math.floor(cdTime / 60 - (hours * 60)))
+  local seconds = string.format("%02.f", math.floor(cdTime - (hours * 3600) - (minutes * 60)))
+  local retString = ''
+  if tonumber(hours) ~= 0 then
+    retString = hours..':'
+  end
+  if tonumber(minutes) ~= 0 or tonumber(hours) ~= 0 then
+    retString = retString..minutes..':'
+  end
+  return retString..seconds
+end
+
 function TravelModule:SetHearthColor()
   if InCombatLockdown() then return; end