Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --get addon data
- local oUF_naisz, addonTable = ...
- -- local cfg = config.cfg
- local texture = "Interface\\AddOns\\oUF_naisz\\media\\statusbar"
- local font = "Interface\\AddOns\\oUF_naisz\\fonts\\font.ttf"
- local fontsize = 16
- local color = {r = 0, g = 0, b = 0}
- local scale = 1
- local pos = 1 -- dieser Wert gibt den Abstand vom Frame an
- local frameborder = "Interface\\ChatFrame\\ChatFrameBackground"
- --
- --Tags , thank you Phanx!
- --
- oUF.Tags.Events["shorthp"] = "UNIT_HEALTH"
- oUF.Tags.Methods["shorthp"] = function(unit)
- if not UnitIsDeadOrGhost(unit) then
- local hp = UnitHealth(unit)
- return AbbreviateLargeNumbers(hp)
- end
- end
- oUF.Tags.Events["mouseoverhp"] = "UNIT_HEALTH UNIT_MAXHEALTH UPDATE_MOUSEOVER_UNIT"
- oUF.Tags.Methods["mouseoverhp"] = function(unit)
- if UnitIsDead(unit) then
- return DEAD
- end
- local hp = UnitHealth(unit)
- if UnitIsUnit(unit, "mouseover") then
- return AbbreviateLargeNumbers(hp)
- else
- return format("%.0f%%", hp / UnitHealthMax(unit) * 100)
- end
- end
- --
- --create statusbar func
- --
- local function Style(self, unit, isSingle)
- --SIZE! depending on unit
- if unit == "player" or unit =="target" then
- self:SetSize(250,24)
- elseif unit =="targettarget" or unit == "pet" then
- self:SetSize(125,24)
- end
- --DROPDOWN
- self:RegisterForClicks("AnyUp")
- self:SetScript("OnEnter", UnitFrame_OnEnter)
- self:SetScript("OnLeave", UnitFrame_OnLeave)
- --
- --Draw Beautiful 1px Border
- --
- local TopLeft = self:CreateTexture(nil, "BORDER")
- TopLeft:SetTexture(frameborder)
- TopLeft:SetTexCoord(0, 1/3, 0, 1/3)
- TopLeft:SetPoint("TOPLEFT", self, -pos+1, pos-1)
- TopLeft:SetWidth(scale) TopLeft:SetHeight(scale)
- TopLeft:SetVertexColor(color.r,color.g,color.b)
- TopLeft:SetDrawLayer("BORDER")
- local TopRight = self:CreateTexture(nil, "BORDER")
- TopRight:SetTexture(frameborder)
- TopRight:SetTexCoord(2/3, 1, 0, 1/3)
- TopRight:SetPoint("TOPRIGHT", self, pos-1, pos-1)
- TopRight:SetWidth(scale) TopRight:SetHeight(scale)
- TopRight:SetVertexColor(color.r,color.g,color.b)
- TopRight:SetDrawLayer("BORDER")
- local BottomLeft = self:CreateTexture(nil, "BORDER")
- BottomLeft:SetTexture(frameborder)
- BottomLeft:SetTexCoord(0, 1/3, 2/3, 1)
- BottomLeft:SetPoint("BOTTOMLEFT", self, -pos+1, -pos)
- BottomLeft:SetWidth(scale) BottomLeft:SetHeight(scale)
- BottomLeft:SetVertexColor(color.r,color.g,color.B)
- BottomLeft:SetDrawLayer("BORDER")
- local BottomRight = self:CreateTexture(nil, "BORDER")
- BottomRight:SetTexture(frameborder)
- BottomRight:SetTexCoord(2/3, 1, 2/3, 1)
- BottomRight:SetPoint("BOTTOMRIGHT", self, pos-1, -pos+1)
- BottomRight:SetWidth(scale) BottomRight:SetHeight(scale)
- BottomRight:SetVertexColor(color.r,color.g,color.B)
- BottomRight:SetDrawLayer("BORDER")
- local TopEdge = self:CreateTexture(nil, "BORDER")
- TopEdge:SetTexture(frameborder)
- TopEdge:SetTexCoord(1/3, 2/3, 0, 1/3)
- TopEdge:SetPoint("TOPLEFT", TopLeft, "TOPRIGHT")
- TopEdge:SetPoint("TOPRIGHT", TopRight, "TOPLEFT")
- TopEdge:SetHeight(scale)
- TopEdge:SetVertexColor(color.r,color.g,color.B)
- TopEdge:SetDrawLayer("BORDER")
- local BottomEdge = self:CreateTexture(nil, "BORDER")
- BottomEdge:SetTexture(frameborder)
- BottomEdge:SetTexCoord(1/3, 2/3, 2/3, 1)
- BottomEdge:SetPoint("BOTTOMLEFT", BottomLeft, "BOTTOMRIGHT")
- BottomEdge:SetPoint("BOTTOMRIGHT", BottomRight, "BOTTOMLEFT")
- BottomEdge:SetHeight(scale)BottomEdge:SetVertexColor(color.r,color.g,color.B)
- BottomEdge:SetDrawLayer("BORDER")
- local LeftEdge = self:CreateTexture(nil, "BORDER")
- LeftEdge:SetTexture(frameborder)
- LeftEdge:SetTexCoord(0, 1/3, 1/3, 2/3)
- LeftEdge:SetPoint("TOPLEFT", TopLeft, "BOTTOMLEFT")
- LeftEdge:SetPoint("BOTTOMLEFT", BottomLeft, "TOPLEFT")
- LeftEdge:SetWidth(scale)
- LeftEdge:SetVertexColor(color.r,color.g,color.B)
- LeftEdge:SetDrawLayer("BORDER")
- local RightEdge = self:CreateTexture(nil, "BORDER")
- RightEdge:SetTexture(frameborder)
- RightEdge:SetTexCoord(2/3, 1, 1/3, 2/3)
- RightEdge:SetPoint("TOPRIGHT", TopRight, "BOTTOMRIGHT")
- RightEdge:SetPoint("BOTTOMRIGHT", BottomRight, "TOPRIGHT")
- RightEdge:SetWidth(scale)
- RightEdge:SetVertexColor(color.r,color.g,color.B)
- RightEdge:SetDrawLayer("BORDER")
- --Create HealthBar
- local health = CreateFrame("StatusBar", nil, self)
- health:SetStatusBarTexture(texture)
- health:SetPoint("TOPLEFT", self, 1, -1)
- health:SetPoint("TOPRIGHT", self, -1, -1)
- health:SetHeight(18)
- -- and Background
- local Background = self:CreateTexture(nil, "BACKGROUND")
- Background.multiplier = 0.3
- Background.Alpha = 0.5
- Background:SetAllPoints()
- Background:SetTexture(texture)
- health:SetStatusBarTexture(texture)
- health.bg = Background
- -- Text depending on Character! THANK PHANX: ShortVal instead of % on mouseover
- local healthText = health:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
- healthText:SetPoint("RIGHT", health)
- healthText:SetFont(font, fontsize, "OUTLINE")
- if unit == "player" then
- self:Tag(healthText, "[dead][shorthp]")
- elseif unit == "target" then
- self:Tag(healthText, "[mouseoverhp]")
- elseif unit == "focus" or unit =="targettarget" then
- self:Tag(healthText, "[mouseoverhp]")
- end
- --
- -- Register with oUF
- --
- health.colorTapping = true
- health.colorDisconnected = true
- health.colorClass = true
- health.colorReaction = true
- health.colorHealth = true
- health.FrequentUpdates = true
- self.Health = health
- -- Create PowerBar
- local power = CreateFrame("StatusBar", nil, self)
- power:SetStatusBarTexture(texture)
- power:SetPoint("TOPLEFT", health, "BOTTOMLEFT")
- power:SetPoint("TOPRIGHT", health, "BOTTOMRIGHT")
- power:SetPoint("BOTTOM", self, -1, 0)
- -- and Background
- local Background = power:CreateTexture(nil, "BACKGROUND")
- Background:SetAllPoints()
- Background:SetTexture(texture)
- power:SetStatusBarTexture(texture)
- Background.multiplier = 0.3
- power.bg = Background
- -- Text depending on Character && next: ShortVal on Mouseover
- local powerPer = power:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
- -- powerPer:SetPoint("LEFT", health, 5, 8)
- powerPer:SetFont(font, fontsize, "OUTLINE")
- powerPer:SetTextColor(1, 1, 1, 1)
- if unit == "player" then
- powerPer:SetPoint("LEFT", health, 5, 0)
- self:Tag(powerPer, "[curpp]")
- elseif unit == "target" then
- powerPer:SetPoint("LEFT", health, 5, 8)
- self:Tag(powerPer, "[smartlevel] [name]")
- elseif unit == "targettarget" or unit == "pet" then
- powerPer:SetPoint("LEFT", health, 5, 8)
- self:Tag(powerPer, "[name]")
- end
- power.colorPower = true
- power.FrequentUpdates = true
- self.Power = power
- --
- --COMBOPOINTS -- WIP
- --
- if unit == "target" then
- local CPoints = {}
- for index = 1, MAX_COMBO_POINTS do
- local CPoint = health:CreateTexture(nil, "OVERLAY")
- -- Position and size of the combo point.
- CPoint:SetSize(10, 10)
- CPoint:SetPoint("LEFT", health, "LEFT", index * CPoint:GetWidth(), 0, 20)
- CPoint:SetTexture(font, fontsize, "THINOUTLINE")
- CPoints[index] = CPoint
- end
- self.CPoints = CPoints
- end
- -- END OF FUNCTION
- end
- --register and activate style
- oUF:RegisterStyle("oUF_naisz", Style)
- oUF:SetActiveStyle("oUF_naisz")
- --spawn player
- local player = oUF:Spawn("player")
- player:SetPoint("CENTER",-280,-50)
- --spawn target
- local target = oUF:Spawn("target")
- target:SetPoint("CENTER",280,-50)
- local tot = oUF:Spawn("targettarget")
- tot:SetPoint("CENTER",342, -80)
- local pet = oUF:Spawn("pet")
- pet:SetPoint("CENTER",-342,-80)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement