View Single Post
09-15-17, 06:53 PM   #2
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
This happens because Personal Resource display is just another nameplate. Nameplates get recycled when not in use so the nameplate associated with your character may end up being assigned to some other random player/NPC if you walk in range while out of combat.

In your case, the best course of action would probably be to add a check when you begin casting to ensure the cast bar is currently anchored to the player's resource frame, and if not, set its position elsewhere (for example, its default anchor, but it can be anywhere.)

Something like this should help:
Code:
if CastingBarFrame:GetParent() ~= NamePlatePlayerResourceFrame and NamePlatePlayerResourceFrame then
	CastingBarFrame:ClearAllPoints()
	CastingBarFrame:SetPoint("TOP",NamePlatePlayerResourceFrame,"BOTTOM",0,-28)
	CastingBarFrame.SetPoint = function() end
else
	[... code that re-anchors the cast bar somewhere else ...]
end
Untested, but the idea is that if the castbar isn't currently anchored to NamePlatePlayerResourceFrame AND NamePlatePlayerResourceFrame exists, it will anchor the castbar to Personal Resource Display, and if you begin casting while out of combat, it will re-anchor the castbar to its default position to prevent it from showing up in places you don't want it to.

You can probably hook into UNIT_SPELLCAST_CHANNEL_START for this.
  Reply With Quote