View Single Post
09-25-17, 03:45 PM   #6
Uitat
A Chromatic Dragonspawn
 
Uitat's Avatar
AddOn Author - Click to view addons
Join Date: May 2011
Posts: 162
ok so i had tried what you suggested, and came up with bad juju, it litteraly cut my current to next level in half and thats all

so here we go again i made some changes, just to get out of the bug fix coding as i was doing adn renamed things to what i though would be ok

im going to post the entire script here so all events are shown

what is happening.
before the fix, stack overflow issue

after the fix
no more stack overflow Errors
However

my druid shows 4 Mil / 39Mil which is correct
Pally shows 900 Mil / 4 Bil which is correct
Warrior shows 100 / 300 which is correct
and so on

my Desired Result if artifact xp to next and artifact currently in my stash

is more then 1,000,000
please for the love of god add a period and 2 digits behind.
i.e. 1.05 mil , 1.15 bil, 4.05 bil, 900 mil, 45 bil and so on

here is all of my code
someone please rip me appart and tell me what stupid crap ive done cause im goin batty

Lua Code:
  1. --Thank you for your help
  2. --SDPhantom
  3. --Phanx
  4. --Fizzlemizz
  5. local AXP_COLOR = { r = 0.6, g = 0.2, b = 0.1 }
  6. --Lets set up the Frame
  7. local derArtifactBar = CreateFrame("Statusbar", "derArtifactBar",artifactFrame)
  8.     derArtifactBar:SetPoint("CENTER", 0, 0)
  9.     derArtifactBar:SetHeight(18)
  10.     derArtifactBar:SetWidth(artifactFrame:GetWidth() * .968)
  11.     derArtifactBar:SetStatusBarTexture("Interface\\AddOns\\_Deranjata\\media\\cast\\Waterline")
  12.     derArtifactBar:SetStatusBarColor(AXP_COLOR.r, AXP_COLOR.g, AXP_COLOR.b, 0.5)
  13.     derArtifactBar:SetBackdrop({
  14.     bgFile =  "Interface\\AddOns\\_Deranjata\\media\\cast\\Lines",
  15.     insets = { left = 1, right = 1, top = 1, bottom = 1 }
  16.     })
  17. derArtifactBar:SetBackdropColor(0.1, 0.1, 0.1)
  18. derArtifactBar:SetBackdropBorderColor(0.6, 0.6, 0.6)
  19. --lets clear any text then set out centerpoint
  20. derArtifactBar.Text=derArtifactBar:CreateFontString(nil, "OVERLAY", "GameFontNormal")
  21. derArtifactBar.Text:SetPoint("CENTER")      
  22.  
  23. --Registering out watched events
  24. derArtifactBar:RegisterEvent("PLAYER_ENTERING_WORLD")
  25. derArtifactBar:RegisterEvent("ARTIFACT_XP_UPDATE")
  26. derArtifactBar:RegisterEvent("UNIT_INVENTORY_CHANGED")
  27.  
  28. -- now lets update the position and text on the bar so we can always have accurate info
  29. derArtifactBar:SetScript("OnEvent", function(self, event, ...)
  30.     if not HasArtifactEquipped() then self:Hide() return end
  31.     self:Show()
  32.     local itemID, altItemID, name, icon, xp, pointsSpent, quality, artifactAppearanceID, appearanceModID, itemAppearanceID, altItemAppearanceID, altOnTop, artifactTier = C_ArtifactUI.GetEquippedArtifactInfo()
  33.     local numPoints, artifactXP, xpForNextPoint = MainMenuBar_GetNumArtifactTraitsPurchasableFromXP(pointsSpent, xp, artifactTier)
  34.     self:SetMinMaxValues(0,xpForNextPoint)
  35.     self:SetValue(artifactXP)
  36.  
  37. --Begin Stack Overflow Fix
  38.  
  39. local setCurrentAXP
  40. local appendCurrentAXP
  41.  local placeValue1 =("%%.%df"):format(places or 0)
  42.     if not (artifactXP) then
  43.         return 0
  44.     elseif (artifactXP) >= 1000000000000 then
  45.         setCurrentAXP = placeValue1:format(artifactXP / 1000000000000)
  46.         appendCurrentAXP =" Tril"
  47.     elseif artifactXP >= 1000000000 then
  48.         setCurrentAXP = placeValue1:format(artifactXP / 1000000000)
  49.         appendCurrentAXP =" Bil"
  50.     elseif artifactXP >= 1000000 then
  51.         setCurrentAXP = placeValue1:format(artifactXP / 1000000)
  52.         appendCurrentAXP =" Mil"
  53.     else
  54.         setCurrentAXP = artifactXP -- hundreds
  55.         appendCurrentAXP =" "
  56.     end
  57.  
  58. local setNextPoint
  59. local setAppendNext
  60.  local placeValue = ("%%.%df"):format(places or 0)
  61.     if not (xpForNextPoint) then
  62.         return 0
  63.     elseif (xpForNextPoint) >= 1000000000000 then
  64.         setNextPoint = placeValue:format(xpForNextPoint / 1000000000000)
  65.         setAppendNext =" Tril"
  66.     elseif xpForNextPoint >= 1000000000 then
  67.         setNextPoint = placeValue:format(xpForNextPoint / 1000000000)
  68.         setAppendNext =" Bil"
  69.     elseif xpForNextPoint >= 1000000 then
  70.         setNextPoint = placeValue:format(xpForNextPoint / 1000000)
  71.         setAppendNext =" Mil"
  72.     else
  73.         setNextPoint = xpForNextPoint -- hundreds
  74.         setAppendNext =" "
  75.     end
  76.    
  77.     --End Stack Overflow Fix **** also added the variable into the self.text:SetFormattedText Below
  78.    
  79.    self.Text:SetFormattedText("Current %d%s/%d%s    +%d Points",setCurrentAXP,appendCurrentAXP,setNextPoint,setAppendNext,numPoints)
  80. end)
__________________
  Reply With Quote