Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- -- Custom code injector template for Kui_Nameplates_Core
- --]]
- local folder,ns=...
- local addon = KuiNameplates
- local core = KuiNameplatesCore
- -- Position and size
- local PvPClassificationIndicator = self:CreateTexture(nil, 'OVERLAY')
- PvPClassificationIndicator:SetSize(24, 24)
- PvPClassificationIndicator:SetPoint('CENTER')
- -- sourced from FrameXML/CompactUnitFrame.lua
- local ICONS = {
- [Enum.PvPUnitClassification.FlagCarrierHorde or 0] = "nameplates-icon-flag-horde",
- [Enum.PvPUnitClassification.FlagCarrierAlliance or 1] = "nameplates-icon-flag-alliance",
- [Enum.PvPUnitClassification.FlagCarrierNeutral or 2] = "nameplates-icon-flag-neutral",
- [Enum.PvPUnitClassification.CartRunnerHorde or 3] = "nameplates-icon-cart-horde",
- [Enum.PvPUnitClassification.CartRunnerAlliance or 4] = "nameplates-icon-cart-alliance",
- [Enum.PvPUnitClassification.AssassinHorde or 5] = "nameplates-icon-bounty-horde",
- [Enum.PvPUnitClassification.AssassinAlliance or 6] = "nameplates-icon-bounty-alliance",
- [Enum.PvPUnitClassification.OrbCarrierBlue or 7] = "nameplates-icon-orb-blue",
- [Enum.PvPUnitClassification.OrbCarrierGreen or 8] = "nameplates-icon-orb-green",
- [Enum.PvPUnitClassification.OrbCarrierOrange or 9] = "nameplates-icon-orb-orange",
- [Enum.PvPUnitClassification.OrbCarrierPurple or 10] = "nameplates-icon-orb-purple",
- }
- local mod = addon:NewPlugin('CustomPVPCarriers',101)
- if not mod then return end
- local function Update(self, event, unit)
- if(unit ~= self.unit) then return end
- local element = self.PvPClassificationIndicator
- --[[ Callback: PvPClassificationIndicator:PreUpdate(unit)
- Called before the element has been updated.
- * self - the PvPClassificationIndicator element
- * unit - the unit for which the update has been triggered (string)
- --]]
- if(element.PreUpdate) then
- element:PreUpdate(unit)
- end
- local class = UnitPvpClassification(unit)
- local icon = ICONS[class]
- if(icon) then
- element:SetAtlas(icon, element.useAtlasSize)
- element:Show()
- else
- element:Hide()
- end
- --[[ Callback: PvPClassificationIndicator:PostUpdate(unit, class)
- Called after the element has been updated.
- * self - the PvPClassificationIndicator element
- * unit - the unit for which the update has been triggered (string)
- * class - the pvp classification of the unit (number?)
- --]]
- if(element.PostUpdate) then
- return element:PostUpdate(unit, class)
- end
- end
- -- create ######################################################################
- function mod:Create(frame)
- -- Place code to be performed after a frame is created here.
- end
- -- show ########################################################################
- function mod:Show(frame)
- -- Place code to be performed after a frame is shown here.
- end
- -- hide ########################################################################
- function mod:Hide(frame)
- -- Place code to be performed after a frame is hidden here.
- end
- -- initialise ##################################################################
- function mod:Initialise()
- self:RegisterMessage('Create')
- self:RegisterMessage('Show')
- self:RegisterMessage('Hide')
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement