View Single Post
06-16-17, 12:32 AM   #1
Kkthnx
A Cobalt Mageweaver
 
Kkthnx's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2011
Posts: 247
Paladin class bar wont show first login

Hey, everyone. I do not post here very often though I do lurk a lot. As I love seeing what add-ons people are making. I'm going to ask for a bit of help and guidance here so bare with me.

Currently, my paladin class bar (HolyPower) won't show on the first login. If you reload it will show. I will show the code I am using for this and where I am placing the code.

Currently, for the modules for class power, I am using this.

Lua Code:
  1. local K, C, _ = unpack(select(2, ...))
  2. if C.Unitframe.Enable ~= true then return end
  3.  
  4. local _G = _G
  5.  
  6. local UnitExists = _G.UnitExists
  7.  
  8. local CMS = CreateFrame("Frame")
  9.  
  10. -- GLOBALS: oUF_KkthnxPlayer, TotemFrame, RuneFrame, SPEC_MAGE_ARCANE, MageArcaneChargesFrame, SPEC_MONK_BREWMASTER, MonkStaggerBar
  11. -- GLOBALS: SPEC_MONK_WINDWALKER, MonkHarmonyBarFrame, SPEC_PALADIN_RETRIBUTION, PaladinPowerBarFrame, ComboPointPlayerFrame
  12. -- GLOBALS: WarlockPowerFrame, oUF_KkthnxPet
  13.  
  14. local function CustomTotemFrame_Update()
  15.     local hasPet = UnitExists("pet") and oUF_KkthnxPet and oUF_KkthnxPet:IsShown()
  16.  
  17.     if (K.Class == "WARLOCK") then
  18.         if (hasPet) then
  19.             TotemFrame:SetPoint("TOPLEFT", oUF_KkthnxPlayer, "BOTTOMLEFT", 0, -75)
  20.         else
  21.             TotemFrame:SetPoint("TOPLEFT", oUF_KkthnxPlayer, "BOTTOMLEFT", 25, -25)
  22.         end
  23.     end
  24.  
  25.     if (K.Class == "SHAMAN") then
  26.         if (hasPet) then
  27.             TotemFrame:SetPoint("TOPLEFT", oUF_KkthnxPlayer, "BOTTOMLEFT", 0, -75)
  28.         else
  29.             TotemFrame:SetPoint("TOPLEFT", oUF_KkthnxPlayer, "BOTTOMLEFT", 25, -25)
  30.         end
  31.     end
  32.  
  33.     if (K.Class == "PALADIN" or K.Class == "DEATHKNIGHT" or K.Class == "DRUID" or K.Class == "MAGE" or K.Class == "MONK") then
  34.         TotemFrame:SetPoint("TOPLEFT", oUF_KkthnxPlayer, "BOTTOMLEFT", 25, 0)
  35.     end
  36. end
  37. hooksecurefunc("TotemFrame_Update", CustomTotemFrame_Update)
  38.  
  39. function CMS:SetupAlternatePowerBar(self)
  40.     self.AdditionalPower = K.CreateOutsideBar(self, false, 0, 0, 1)
  41.     self.DruidMana = self.AdditionalPower
  42.     self.AdditionalPower.colorPower = true
  43.  
  44.     self.AdditionalPower.Value = K.SetFontString(self.AdditionalPower, C.Media.Font, 10, nil, "CENTER")
  45.     self.AdditionalPower.Value:SetPoint("CENTER", self.AdditionalPower, 0, 0.5)
  46.     self.AdditionalPower.Value:Hide()
  47.  
  48.     self.AdditionalPower.Smooth = C.Unitframe.Smooth
  49.     self.AdditionalPower.SmoothSpeed = C.Unitframe.SmoothSpeed * 10
  50.     self:Tag(self.AdditionalPower.Value, "[KkthnxUI:DruidMana]")
  51. end
  52.  
  53. function CMS:HideAltResources()
  54.     if (K.Class == "SHAMAN") then
  55.         TotemFrame:Hide()
  56.     elseif (K.Class == "DEATHKNIGHT") then
  57.         RuneFrame:Hide()
  58.     elseif (K.Class == "MAGE" and K.Spec == SPEC_MAGE_ARCANE) then
  59.         MageArcaneChargesFrame:Hide()
  60.     elseif (K.Class == "MONK") then
  61.         if (K.Spec == SPEC_MONK_BREWMASTER) then
  62.             MonkStaggerBar:Hide()
  63.         elseif (K.Spec == SPEC_MONK_WINDWALKER) then
  64.             MonkHarmonyBarFrame:Hide()
  65.         end
  66.     elseif (K.Class == "PALADIN" and K.Spec == SPEC_PALADIN_RETRIBUTION) then
  67.         PaladinPowerBarFrame:Hide()
  68.     elseif (K.Class == "ROGUE") then
  69.         ComboPointPlayerFrame:Hide()
  70.     elseif (K.Class == "WARLOCK") then
  71.         WarlockPowerFrame:Hide()
  72.     end
  73. end
  74.  
  75. function CMS:ShowAltResources()
  76.     if (K.Class == "SHAMAN") then
  77.         TotemFrame:Show()
  78.     elseif (K.Class == "DEATHKNIGHT") then
  79.         RuneFrame:Show()
  80.     elseif (K.Class == "MAGE" and K.Spec == SPEC_MAGE_ARCANE) then
  81.         MageArcaneChargesFrame:Show()
  82.     elseif (K.Class == "MONK") then
  83.         if (K.Spec == SPEC_MONK_BREWMASTER) then
  84.             MonkStaggerBar:Show()
  85.         elseif (K.Spec == SPEC_MONK_WINDWALKER) then
  86.             MonkHarmonyBarFrame:Show()
  87.         end
  88.     elseif (K.Class == "PALADIN" and K.Spec == SPEC_PALADIN_RETRIBUTION) then
  89.         PaladinPowerBarFrame:Show()
  90.     elseif (K.Class == "ROGUE") then
  91.         ComboPointPlayerFrame:Show()
  92.     elseif (K.Class == "WARLOCK") then
  93.         WarlockPowerFrame:Show()
  94.     end
  95. end
  96.  
  97. function CMS:SetupResources(self)
  98.     -- Alternate Mana Bar
  99.     if (C.UnitframePlugins.AdditionalPower) and (K.Class == "DRUID" or K.Class == "SHAMAN" or K.Class == "PRIEST") then
  100.         K.CMS:SetupAlternatePowerBar(self)
  101.     end
  102.  
  103.     -- Warlock Soul Shards
  104.     if (K.Class == "WARLOCK") then
  105.         WarlockPowerFrame:ClearAllPoints()
  106.         WarlockPowerFrame:SetParent(oUF_KkthnxPlayer)
  107.         WarlockPowerFrame:SetPoint("TOP", oUF_KkthnxPlayer, "BOTTOM", 30, -2)
  108.     end
  109.  
  110.     -- Holy Power Bar (Retribution Only)
  111.     if (K.Class == "PALADIN" and K.Spec == SPEC_PALADIN_RETRIBUTION) then
  112.         PaladinPowerBarFrame:ClearAllPoints()
  113.         PaladinPowerBarFrame:SetParent(oUF_KkthnxPlayer)
  114.         PaladinPowerBarFrame:SetPoint("TOP", oUF_KkthnxPlayer, "BOTTOM", 25, 2)
  115.     PaladinPowerBarFrame:Show()
  116.     end
  117.  
  118.     -- Monk Chi / Stagger Bar
  119.     if (K.Class == "MONK") then
  120.         -- Windwalker Chi
  121.         MonkHarmonyBarFrame:ClearAllPoints()
  122.         MonkHarmonyBarFrame:SetParent(oUF_KkthnxPlayer)
  123.         MonkHarmonyBarFrame:SetPoint("TOP", oUF_KkthnxPlayer, "BOTTOM", 30, 18)
  124.  
  125.         -- Brewmaster Stagger Bar
  126.         MonkStaggerBar:ClearAllPoints()
  127.         MonkStaggerBar:SetParent(oUF_KkthnxPlayer)
  128.         MonkStaggerBar:SetPoint("TOP", oUF_KkthnxPlayer, "BOTTOM", 30, -2)
  129.     end
  130.  
  131.     -- Deathknight Runebar
  132.     if (K.Class == "DEATHKNIGHT") then
  133.         RuneFrame:ClearAllPoints()
  134.         RuneFrame:SetParent(oUF_KkthnxPlayer)
  135.         RuneFrame:SetPoint("TOP", self.Power, "BOTTOM", 2, -2)
  136.     end
  137.  
  138.     -- Arcane Mage
  139.     if (K.Class == "MAGE") then
  140.         MageArcaneChargesFrame:ClearAllPoints()
  141.         MageArcaneChargesFrame:SetParent(oUF_KkthnxPlayer)
  142.         MageArcaneChargesFrame:SetPoint("TOP", oUF_KkthnxPlayer, "BOTTOM", 30, -2)
  143.     end
  144.  
  145.     -- Combo Point Frame
  146.     if (K.Class == "ROGUE" or K.Class == "DRUID") then
  147.         ComboPointPlayerFrame:ClearAllPoints()
  148.         ComboPointPlayerFrame:SetParent(oUF_KkthnxPlayer)
  149.         ComboPointPlayerFrame:SetPoint("TOPLEFT", self.Power, "BOTTOMLEFT", -3, 2)
  150.     end
  151.  
  152.     -- Finish TotemFrame
  153.     if (K.Class == "SHAMAN" or K.Class == "WARLOCK" or K.Class == "DRUID" or K.Class == "PALADIN" or K.Class == "DEATHKNIGHT" or K.Class == "MAGE" or K.Class == "MONK") then
  154.         TotemFrame:SetFrameStrata("LOW")
  155.         TotemFrame:SetParent(oUF_KkthnxPlayer)
  156.         CustomTotemFrame_Update()
  157.     end
  158.     -- Register the event!
  159.     self:RegisterEvent("PLAYER_TOTEM_UPDATE", CustomTotemFrame_Update)
  160. end
  161.  
  162. K.CMS = CMS

Now I have to spawn this all in my unit frame code which is very long. I'm going to just place it in a gist if you all do not mind.

https://gist.github.com/Kkthnx/4b1e3...5764bfd7aa9220

Idk why it will not spawn on the first login. Any advice would help. Thank you kindly.

Oh here is where I place the code.
https://gist.github.com/Kkthnx/4b1e3...rames-lua-L239
https://gist.github.com/Kkthnx/4b1e3...rames-lua-L252
https://gist.github.com/Kkthnx/4b1e3...rames-lua-L600
__________________
Success isn't what you've done compared to others. Success is what you've done compared to what you were made to do.

Last edited by Kkthnx : 06-16-17 at 12:51 PM.
  Reply With Quote