Quantcast
WoWInterface - View Single Post - code integration
View Single Post
09-25-17, 10:51 AM   #2
Uitat
A Flamescale Wyrmkin
 
Uitat's Avatar
AddOn Author - Click to view addons
Join Date: May 2011
Posts: 141
ok so i figured out how to make it work, but when going into the billions i want to force 3 numbers deep,

so instead of it saying 4 billion only, i want it to say,.... 4.25 or 6.99 or so on, here is my code the fix is at the bottom

starting at
local bugfix and continuing to the end

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.     --self.Text:SetFormattedText("Artifact XP: %d / %d       +%d Points",artifactXP,xpForNextPoint,numPoints)
  38. --if artifactXP >= 1000000000  then
  39.  --  local bugFix = artifactXP/1000000--xpForNextPoint
  40.   -- else
  41.   -- local bugFix = 9494949--artifactXP/1000000
  42.  
  43.    
  44. -- end  
  45. local bugFix
  46. local append
  47.  local placeValue = ("%%.%df"):format(places or 0)
  48.     if not (artifactXP) then
  49.         return 0
  50.     elseif (artifactXP) >= 1000000000000 then
  51.         bugFix = placeValue:format(artifactXP / 1000000000000)-- .. --" Tril" -- trillion
  52.         append =" Tril"
  53.     elseif artifactXP >= 1000000000 then
  54.         bugFix = placeValue:format(artifactXP / 1000000000)-- ..-- " Bil" -- billion
  55.         append =" Bil"
  56.     elseif artifactXP >= 1000000 then
  57.         bugFix = placeValue:format(artifactXP / 1000000) --.. --" Mil" -- million
  58.         append =" Mil"
  59.     else
  60.         bugFix = artifactXP -- hundreds
  61.     end
  62.  
  63. local nextPoint
  64. local appendNext
  65.  local placeValue = ("%%.%df"):format(places or 0)
  66.     if not (xpForNextPoint) then
  67.         return 0
  68.     elseif (xpForNextPoint) >= 1000000000000 then
  69.         nextPoint = placeValue:format(xpForNextPoint / 1000000000000)-- .. --" Tril" -- trillion
  70.         appendNext =" Tril"
  71.     elseif xpForNextPoint >= 1000000000 then
  72.         nextPoint = placeValue:format(xpForNextPoint / 1000000000)-- ..-- " Bil" -- billion
  73.         appendNext =" Bil"
  74.     elseif xpForNextPoint >= 1000000 then
  75.         nextPoint = placeValue:format(xpForNextPoint / 1000000) --.. --" Mil" -- million
  76.         appendNext =" Mil"
  77.     else
  78.         nextPoint = xpForNextPoint -- hundreds
  79.     end
  80.    
  81.    self.Text:SetFormattedText("Current %d%s/%d%s    +%d Points",bugFix,append,nextPoint,appendNext,numPoints)
  82. end)
__________________
  Reply With Quote