Advertisement
Baz4k

Untitled

Dec 30th, 2020
1,256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.30 KB | None | 0 0
  1. --Create Frame for Avatar Background
  2. local avatarBGFrame = CreateFrame("Frame",nil,UIParent)
  3. avatarBGFrame:SetFrameStrata("LOW")
  4. avatarBGFrame:SetFrameLevel(1)
  5. avatarBGFrame:SetWidth(128) -- Set these to whatever height/width is needed
  6. avatarBGFrame:SetHeight(128) -- for your Texture       
  7. avatarBGFrame:SetMovable(true) -- Make Frame Draggable
  8. avatarBGFrame:EnableMouse(true)
  9. avatarBGFrame:RegisterForDrag("LeftButton")
  10. avatarBGFrame:SetScript("OnDragStart", avatarBGFrame.StartMoving)
  11. avatarBGFrame:SetScript("OnDragStop", avatarBGFrame.StopMovingOrSizing)
  12. local avatarBGTex = avatarBGFrame:CreateTexture(nil,"ARTWORK")
  13. avatarBGTex:SetTexture("Interface\\AddOns\\BazUI\\images\\avatarBG.blp")
  14. avatarBGTex:SetAllPoints(avatarBGFrame)
  15. avatarBGFrame.texture = avatarBGTex
  16. avatarBGFrame:SetPoint("CENTER",0,-450)
  17. avatarBGFrame:Show()
  18.  
  19. --Create Frame for Avatar Border Back
  20. local avatarBorderBackFrame = CreateFrame("Frame",nil,UIParent)
  21. avatarBorderBackFrame:SetFrameStrata("LOW")
  22. avatarBorderBackFrame:SetFrameLevel(2)
  23. avatarBorderBackFrame:SetWidth(128) -- Set these to whatever height/width is needed
  24. avatarBorderBackFrame:SetHeight(128) -- for your Texture
  25. avatarBorderBackFrame:SetMovable(true) -- Make Frame Draggable
  26. avatarBorderBackFrame:EnableMouse(true)
  27. avatarBorderBackFrame:RegisterForDrag("LeftButton")
  28. avatarBorderBackFrame:SetScript("OnDragStart", avatarBorderBackFrame.StartMoving)
  29. avatarBorderBackFrame:SetScript("OnDragStop", avatarBorderBackFrame.StopMovingOrSizing)
  30. local avatarBGTex = avatarBorderBackFrame:CreateTexture(nil,"ARTWORK")
  31. avatarBGTex:SetTexture("Interface\\AddOns\\BazUI\\images\\avatarBorderBack.blp")
  32. avatarBGTex:SetAllPoints(avatarBorderBackFrame)
  33. avatarBorderBackFrame.texture = avatarBGTex
  34. avatarBorderBackFrame:SetPoint("CENTER",0,-450)
  35. avatarBorderBackFrame:Show()
  36.  
  37. --Create 3d Portrait
  38. local PlayerModel = CreateFrame("PlayerModel", nil, UIParent)
  39. PlayerModel:SetFrameStrata("LOW")
  40. PlayerModel:SetFrameLevel(3)
  41. PlayerModel:SetSize(100, 100)
  42. PlayerModel:SetPoint("CENTER", UIParent, "CENTER", 5, -435)
  43. PlayerModel:SetUnit("player")
  44. PlayerModel:SetPortraitZoom(1)
  45. PlayerModel:SetCamDistanceScale(2)
  46. PlayerModel:RefreshCamera()
  47. PlayerModel:Show()
  48. PlayerModel:SetMovable(true)
  49. PlayerModel:EnableMouse(true)
  50. PlayerModel:RegisterForDrag("LeftButton")
  51. PlayerModel:SetScript("OnDragStart", PlayerModel.StartMoving)
  52. PlayerModel:SetScript("OnDragStop", PlayerModel.StopMovingOrSizing)
  53.  
  54. --Create Frame for Avatar Border Front
  55. local avatarBorderFrontFrame = CreateFrame("Frame",nil,UIParent)
  56. avatarBorderFrontFrame:SetFrameStrata("LOW")
  57. avatarBorderFrontFrame:SetFrameLevel(4)
  58. avatarBorderFrontFrame:SetWidth(128) -- Set these to whatever height/width is needed
  59. avatarBorderFrontFrame:SetHeight(128) -- for your Texture
  60. avatarBorderFrontFrame:SetMovable(true) -- Make Frame Draggable
  61. avatarBorderFrontFrame:EnableMouse(true)
  62. avatarBorderFrontFrame:RegisterForDrag("LeftButton")
  63. avatarBorderFrontFrame:SetScript("OnDragStart", avatarBorderFrontFrame.StartMoving)
  64. avatarBorderFrontFrame:SetScript("OnDragStop", avatarBorderFrontFrame.StopMovingOrSizing)
  65. local avatarBorderFrontTex = avatarBorderFrontFrame:CreateTexture(nil,"ARTWORK")
  66. avatarBorderFrontTex:SetTexture("Interface\\AddOns\\BazUI\\images\\avatarBorderFront.blp")
  67. avatarBorderFrontTex:SetAllPoints(avatarBorderFrontFrame)
  68. avatarBorderFrontFrame.texture = avatarBorderFrontTex
  69. avatarBorderFrontFrame:SetPoint("CENTER",0,-450)
  70. avatarBorderFrontFrame:Show()
  71.  
  72. --Create Frame for HealthBar
  73. local healthBarFrame = CreateFrame("Frame",nil,UIParent)
  74. healthBarFrame:SetFrameStrata("LOW")
  75. healthBarFrame:SetFrameLevel(5)
  76. healthBarFrame:SetWidth(512) -- Set these to whatever height/width is needed
  77. healthBarFrame:SetHeight(128) -- for your Texture
  78. healthBarFrame:SetMovable(true) -- Make Frame Draggable
  79. healthBarFrame:EnableMouse(true)
  80. healthBarFrame:RegisterForDrag("LeftButton")
  81. healthBarFrame:SetScript("OnDragStart", healthBarFrame.StartMoving)
  82. healthBarFrame:SetScript("OnDragStop", healthBarFrame.StopMovingOrSizing)
  83. local healthBarTex = healthBarFrame:CreateTexture(nil,"ARTWORK")
  84. healthBarTex:SetTexture("Interface\\AddOns\\BazUI\\images\\healthBar.blp")
  85. healthBarTex:SetAllPoints(healthBarFrame)
  86. healthBarFrame.texture = healthBarTex
  87. healthBarFrame:SetPoint("CENTER",-200,-470)
  88. healthBarFrame:Show()
  89.  
  90. --Create Frame for PowerBar
  91. local PowerBarFrame = CreateFrame("Frame",nil,UIParent)
  92. PowerBarFrame:SetFrameStrata("LOW")
  93. PowerBarFrame:SetFrameLevel(6)
  94. PowerBarFrame:SetWidth(512) -- Set these to whatever height/width is needed
  95. PowerBarFrame:SetHeight(128) -- for your Texture
  96. local powerBarTex = PowerBarFrame:CreateTexture(nil,"ARTWORK")
  97. powerBarTex:SetTexture("Interface\\AddOns\\BazUI\\images\\healthBar.blp")
  98. powerBarTex:SetAllPoints(PowerBarFrame)
  99. PowerBarFrame.texture = powerBarTex
  100. PowerBarFrame:SetPoint("CENTER",200,-470)
  101. PowerBarFrame:Show()
  102. powerBarTex:SetTexCoord(1, 0, 0, 1) --Horizontally Flip Image
  103.  
  104. --Create Frame for Avatar Bottom Shodow
  105. local AvatarShadowFrame = CreateFrame("Frame",nil,UIParent)
  106. AvatarShadowFrame:SetFrameStrata("LOW")
  107. AvatarShadowFrame:SetFrameLevel(7)
  108. AvatarShadowFrame:SetWidth(120) -- Set these to whatever height/width is needed
  109. AvatarShadowFrame:SetHeight(120) -- for your Texture
  110. AvatarShadowFrame:SetMovable(true) -- Make Frame Draggable
  111. AvatarShadowFrame:EnableMouse(true)
  112. AvatarShadowFrame:RegisterForDrag("LeftButton")
  113. AvatarShadowFrame:SetScript("OnDragStart", AvatarShadowFrame.StartMoving)
  114. AvatarShadowFrame:SetScript("OnDragStop", AvatarShadowFrame.StopMovingOrSizing)
  115. local AvatarShadowTex = AvatarShadowFrame:CreateTexture(nil,"ARTWORK")
  116. AvatarShadowTex:SetTexture("Interface\\AddOns\\BazUI\\images\\avatarShadow.blp")
  117. AvatarShadowTex:SetAllPoints(AvatarShadowFrame)
  118. AvatarShadowFrame.texture = AvatarShadowTex
  119. AvatarShadowFrame:SetPoint("CENTER",0,-445)
  120. AvatarShadowFrame:Show()
  121.  
  122. -- Create Helath Bar
  123. local function CreateBar(name, previous) -- Create StatusBar with a text overlay
  124.     local f = CreateFrame("StatusBar", "Fizzle"..name, UIParent)
  125.     f:SetFrameStrata("LOW")
  126.     f:SetFrameLevel(8)
  127.     f:SetSize(500, 32)
  128.     if not previous then
  129.         f:SetPoint("CENTER", -272, -472)
  130.     else
  131.         f:SetPoint("CENTER", previous, "CENTER")
  132.     end
  133.     f:SetStatusBarTexture("Interface\\AddOns\\BazUI\\images\\statusBar2.blp")
  134.     f.Text = f:CreateFontString()
  135.     f.Text:SetFontObject(GameFontNormal)
  136.     f.Text:SetPoint("CENTER",180,0)
  137.     f.Text:SetJustifyH("CENTER")
  138.     f.Text:SetJustifyV("CENTER")
  139.     f:SetReverseFill(true)
  140.     return f
  141. end
  142.  
  143. local function UpdateHealth(self) -- Update the health bar
  144.     local health = UnitHealth("player")
  145.     self:SetValue(health)
  146.     self.Text:SetText(health .. '/' .. self.healthMax)
  147. end
  148.  
  149. local function UpdateHealthMax(self) -- Update min./max. health values
  150.     self.healthMax = UnitHealthMax("player")
  151.     self:SetMinMaxValues(0, self.healthMax)
  152.     UpdateHealth(self)
  153. end
  154.  
  155. local Health = CreateBar('Health') -- Create the health bar
  156. Health:SetStatusBarColor(0, 1, 0) -- make it green
  157. Health:SetScript("OnEvent", function(self, event, ...)
  158.     if event == "UNIT_HEALTH" then -- Fired when health changes
  159.         UpdateHealth(self)
  160.     elseif event == "UNIT_POWER_FREQUENT" then -- Fired when power changes
  161.         UpdatePower(Power)
  162.     elseif event == "UNIT_MAXHEALTH" then -- Fired when max. health changes
  163.         UpdateHealthMax(self)
  164.     elseif event == "UNIT_MAXPOWER" then -- Fired when max. power changes
  165.         UpdatePowerMax(Power)
  166.     end
  167. end)
  168.  
  169. UpdateHealthMax(Health) -- initialise the health bar
  170. Health:RegisterEvent("UNIT_HEALTH") -- register the events to be used
  171. Health:RegisterEvent("UNIT_POWER_FREQUENT") -- Health bar is handling events for both bars
  172. Health:RegisterEvent("UNIT_MAXHEALTH")
  173. Health:RegisterEvent("UNIT_MAXPOWER")
  174.  
  175. -- Create Power Bar
  176. local function CreateBar(name, previous) -- Create StatusBar with a text overlay
  177.     local p = CreateFrame("StatusBar", "Fizzle"..name, UIParent)
  178.     p:SetFrameStrata("LOW")
  179.     p:SetFrameLevel(9)
  180.     p:SetSize(500, 32)
  181.     if not previous then
  182.         p:SetPoint("CENTER", 272, -472)
  183.     else
  184.         p:SetPoint("CENTER", previous, "CENTER")
  185.     end
  186.     p:SetStatusBarTexture("Interface\\AddOns\\BazUI\\images\\statusBarP2.blp")
  187.     p.Text = p:CreateFontString()
  188.     p.Text:SetFontObject(GameFontNormal)
  189.     p.Text:SetPoint("CENTER",-180,0)
  190.     p.Text:SetJustifyH("CENTER")
  191.     p.Text:SetJustifyV("CENTER")
  192.     p:SetReverseFill(false)
  193.     return p
  194. end
  195.  
  196.  
  197. local function UpdatePower(self) -- Update the power bar
  198.     local power = UnitPower("player")
  199.     self:SetValue(power)
  200.     self.Text:SetText(power .. '/' .. self.powerMax)
  201. end
  202.  
  203. local function UpdatePowerMax(self) -- Update min./max. power values
  204.     self.powerMax = UnitPowerMax("player")
  205.     self:SetMinMaxValues(0, self.powerMax)
  206.     UpdatePower(self)
  207. end
  208.  
  209. local Power = CreateBar('Power') -- Create the power bar (set to anchor below Health)
  210. Power:SetStatusBarColor(0, 0, 1) -- make it blue
  211. Health:SetScript("OnEvent", function(self, event, ...)
  212.     if event == "UNIT_HEALTH" then -- Fired when health changes
  213.         UpdateHealth(self)
  214.     elseif event == "UNIT_POWER_FREQUENT" then -- Fired when power changes
  215.         UpdatePower(Power)
  216.     elseif event == "UNIT_MAXHEALTH" then -- Fired when max. health changes
  217.         UpdateHealthMax(self)
  218.     elseif event == "UNIT_MAXPOWER" then -- Fired when max. power changes
  219.         UpdatePowerMax(Power)
  220.     end
  221. end)
  222.  
  223. UpdateHealthMax(Health) -- initialise the health bar
  224. UpdatePowerMax(Power) -- initialise the power bar
  225. Health:RegisterEvent("UNIT_HEALTH") -- register the events to be used
  226. Health:RegisterEvent("UNIT_POWER_FREQUENT") -- Health bar is handling events for both bars
  227. Health:RegisterEvent("UNIT_MAXHEALTH")
  228. Health:RegisterEvent("UNIT_MAXPOWER")
  229.  
  230.  
  231. classColor = GetClassColor(englishClass)
  232.  
  233.  
  234. --Create Frame for Level Button
  235. local levelButtonFrame = CreateFrame("Frame",nil,UIParent)
  236. levelButtonFrame:SetFrameStrata("HIGH")
  237. levelButtonFrame:SetWidth(75) -- Set these to whatever height/width is needed
  238. levelButtonFrame:SetHeight(75) -- for your Texture
  239. levelButtonFrame:SetMovable(true) -- Make Frame Draggable
  240. levelButtonFrame:EnableMouse(true)
  241. levelButtonFrame:RegisterForDrag("LeftButton")
  242. levelButtonFrame:SetScript("OnDragStart", levelButtonFrame.StartMoving)
  243. levelButtonFrame:SetScript("OnDragStop", levelButtonFrame.StopMovingOrSizing)
  244. local levelButtonTex = levelButtonFrame:CreateTexture(nil,"ARTWORK")
  245. levelButtonTex:SetTexture("Interface\\AddOns\\BazUI\\images\\circleButton.blp")
  246. levelButtonTex:SetAllPoints(levelButtonFrame)
  247. levelButtonFrame.texture = avatarBGTex
  248. levelButtonFrame:SetPoint("CENTER",-30,-490)
  249. levelButtonFrame:Show()
  250.  
  251. --Create Frame for Spec Button
  252. local specButtonFrame = CreateFrame("Frame",nil,UIParent)
  253. specButtonFrame:SetFrameStrata("HIGH")
  254. specButtonFrame:SetWidth(75) -- Set these to whatever height/width is needed
  255. specButtonFrame:SetHeight(75) -- for your Texture
  256. specButtonFrame:SetMovable(true) -- Make Frame Draggable
  257. specButtonFrame:EnableMouse(true)
  258. specButtonFrame:RegisterForDrag("LeftButton")
  259. specButtonFrame:SetScript("OnDragStart", specButtonFrame.StartMoving)
  260. specButtonFrame:SetScript("OnDragStop", specButtonFrame.StopMovingOrSizing)
  261. local specButtonTex = specButtonFrame:CreateTexture(nil,"ARTWORK")
  262. specButtonTex:SetTexture("Interface\\AddOns\\BazUI\\images\\circleButton.blp")
  263. specButtonTex:SetAllPoints(specButtonFrame)
  264. specButtonFrame.texture = avatarBGTex
  265. specButtonFrame:SetPoint("CENTER",30,-490)
  266. specButtonFrame:Show()
  267.  
  268.  
  269. --Create Level Text Frame
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement