Originally Posted by Phanx
Short version:
It's probably easier just to delete everything and start over from scratch, since you're going to have to rewrite 90% of your code anyway.
Long version:
This is not how you identify nameplate children/regions anymore:
lua Code:
frame.barFrame, frame.nameFrame = frame:GetChildren() frame.healthBar, frame.absorbBar, frame.castBar = frame.barFrame:GetChildren() local healthBar, castBar = frame.healthBar, frame.castBar local glowRegion, overlayRegion, highlightRegion, levelTextRegion, bossIconRegion, raidIconRegion, stateIconRegion = frame.barFrame:GetRegions() local _, castbarOverlay, shieldedRegion, spellIconRegion = castBar:GetRegions() local nameTextRegion = frame.nameFrame:GetRegions()
All of the objects on a nameplate are accessible through named keys now. See here:
https://www.townlong-yak.com/framexm...Plates.xml#289
This is no longer relevant either:
lua Code:
local numKids = 0 local lastUpdate = 0 local index = 1 local OnUpdate = function(self, elapsed) lastUpdate = lastUpdate + elapsed if lastUpdate > 0.1 then lastUpdate = 0 local newNumKids = WorldFrame:GetNumChildren() if newNumKids ~= numKids then numKids = WorldFrame:GetNumChildren() for i = index, numKids do local frame = select(i, WorldFrame:GetChildren()) local name = frame:GetName() if name and name:find("NamePlate") and not frame.done then --StyleFrame(frame) CreatePlate(frame) index = i end end end end end caelNamePlates:SetScript("OnUpdate", OnUpdate)
This should work now:
lua Code:
hooksecurefunc(NamePlateDriverFrame, "OnNamePlateCreated", function(_, frame) CreatePlate(frame.UnitFrame) end) hooksecurefunc(NamePlateDriverFrame, "ApplyFrameOptions", function(_, frame, unit) UpdatePlate(frame.UnitFrame) end)
Other changes you'll need to make:
Your "CreatePlate" function should only create any new objects you want to add. It should not:
- assign existing objects to keys (eg. don't write "nameplate.healthBar = <something>")
- overwrite existing keys (look what exists before adding keys for your custom objects)
Your "UpdatePlate" function will need to be updated to refer to the existing keys for default objects.
|
I figured it would be a difficult task as a beginner but I really love this addon and want to make it work before legion launch also it might be abit easier to read through someone's code and edit and change rather than rewrite.
I've removed the parts you told me were irrelevant and added the function you gave, now I'm working on the CreatePlate function, since it shouldn't assign existing objects do I just remove all of the "nameplate.healthBar = <something>" or assign them differently?
As for overwriting existing keys which ones do I have overwritten?