Hi!.
I have new questions!.
I want make a zonetext panels colored by pvp status.
I find information for other lua codes and for now I have this (Dont work of course Xddddd).
OnLoad
local font,size = self.text:GetFont()
self.text:SetFont(font,size,"OUTLINE")
self.text:SetJustifyH("CENTER")
self.text:SetJustifyV("CENTER")
self:RegisterEvent("PLAYER_ENTERING_WORLD")
self:RegisterEvent("PLAYER_FLAGS_CHANGED")
self:RegisterEvent("ZONE_CHANGED_NEW_AREA")
self:RegisterEvent("PLAYER_LOGIN")
|
OnEvent
zone = GetRealZoneText()
subzone = GetSubZoneText()
self.text:SetText(string.format("%s, %s",zone,subzone))
|
Who I need:
1º:a class colored text based on pvp status, I extract that lua code, maybe can be usefull:
local pvpType, isFFA, faction = GetZonePVPInfo()
if(pvpType == "friendly") then
col = "00ff00"
elseif(pvpType == "hostile") then
col = "ff0000"
elseif(pvpType == "arena") then
col = "ffff00"
elseif(pvpType == "hostile" or pvpType == "combat" or pvpType=="contested") then
if(faction == select(2,UnitFactionGroup('player'))) then
col = "886600"
else
col = "ff0000"
end
elseif(pvpType == "sanctuary") then
col = "9999ff"
else
return txt
end
return addon['colorize'](txt, col)
|
But I dont have idea how can I apply to text.
2º: When I enter in a zone with no subzone appear only the Main zone, for example, I enter on Dalaran, appear "Dalaran, Dalaran", When the correct be that only appear 1 dalaran: "Dalaran".
Any help will be greatly appreciated Thanks!!!