-- EDIT THESE LINES BELOW TO CHANGE YOUR NAME ---------------
-- what YOUR name will show up as
NewName = "TEST"
-- what YOUR TEAM name will show up as (on scoreboard only)
newTeamName = "http://google.com"
------------------------------------------------------------------------
----------------- DO NOT EDIT ANYTHING BELOW THIS LINE -----------------
------------------------------------------------------------------------
local frame = CreateFrame("FRAME", "NameChangeScripts")
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
frame:RegisterEvent("UPDATE_MOUSEOVER_UNIT");
local function eventHandler(self, event, ...)
PN = GetUnitName("player")
partyMembers = GetNumPartyMembers()
raidMembers = GetNumRaidMembers()
local isArena, isRegistered = IsActiveBattlefieldArena();
-- Player UnitFrame
local function ChangePlayerName(self)
PlayerFrame.name:SetText(NewName)
end
PlayerFrame:SetScript("OnUpdate", ChangePlayerName)
-- Party Frames
PNFNC = CreateFrame("Frame", "PlayerFrameNameChange")
local function ChangePartyNames(self)
for i = 1, partyMembers do
local className = UnitClass("party"..i)
_G["PartyMemberFrame"..i].name:SetText(className)
end
end
PNFNC:SetScript("OnUpdate", ChangePartyNames)
-- Raid Frames
RFNC = CreateFrame("Frame", "RaidFrameNameChange")
local function ChangeRaidNames(self)
for i = 1, raidMembers do
local className = UnitClass("party"..i)
if PN == _G["CompactRaidGroup1Member"..i].name:GetText() then
_G["CompactRaidGroup1Member"..i].name:SetText(NewName)
else
_G["CompactRaidGroup1Member"..i].name:SetText(className)
end
end
end
RFNC:SetScript("OnUpdate", ChangeRaidNames)
if (isArena) then
else
-- hide raid frames while not in arena
CompactRaidFrameContainer:Hide()
CompactRaidFrameContainer:SetAlpha(0)
-- hide party frames while not in arena
for i = 1, partyMembers do
_G["PartyMemberFrame"..i]:SetAlpha(0)
_G["PartyMemberFrame"..i]:Hide()
end
end
-- Target UnitFrame
--TFNC = CreateFrame("Frame", "TargetFrameNameChange")
local function ChangeTargetName(self)
local TN = GetUnitName("target")
-- if target is you
if PN == TN then
TargetFrame.name:SetText(NewName)
end
-- if target is a party member
for i = 1, partyMembers do
local className = UnitClass("party"..i)
local partyName = GetUnitName("party"..i)
if partyName == TN then
TargetFrame.name:SetText(className)
end
end
end
TargetFrame:SetScript("OnUpdate", ChangeTargetName)
-- Target's Target UnitFrame
local function ChangeTargetofTargetName(self)
local TTN = GetUnitName("targettarget")
-- if target's target is you
if PN == TTN then
TargetFrameToT.name:SetText(NewName)
end
-- if target's target is a party member
for i = 1, partyMembers do
local className = UnitClass("party"..i)
local partyName = GetUnitName("party"..i)
if partyName == TTN then
TargetFrameToT.name:SetText(className)
end
end
end
TargetFrameToT:SetScript("OnUpdate", ChangeTargetofTargetName)
-- Focus UnitFrame
local function ChangeFocusName(self)
local FN = GetUnitName("focus")
-- if focus is you
if PN == FN then
FocusFrame.name:SetText(NewName)
end
-- if focus is a party member
for i = 1, partyMembers do
local className = UnitClass("party"..i)
local partyName = GetUnitName("party"..i)
if partyName == FN then
FocusFrame.name:SetText(className)
end
end
end
FocusFrame:SetScript("OnUpdate", ChangeFocusName)
-- Focus' Target UnitFrame
local function ChangeFocusTargetName(self)
local FTN = GetUnitName("focustarget")
-- if focus' target is you
if PN == FTN then
FocusFrameToT.name:SetText(NewName)
end
-- if focus' target is a party member
for i = 1, partyMembers do
local className = UnitClass("party"..i)
local partyName = GetUnitName("party"..i)
if partyName == FTN then
FocusFrameToT.name:SetText(className)
end
end
end
FocusFrameToT:SetScript("OnUpdate", ChangeFocusTargetName)
GameTooltip:SetScript("OnUpdate", function(self)
local GTN = GameTooltipTextLeft1:GetText()
-- if tooltip is you
local CurTitleNum = GetCurrentTitle()
local CurTitle = GetTitleName(CurTitleNum)
if(CurTitle) then
GTNN = GTN:gsub(CurTitle, "")
else
GTNN = GTN
end
if GTNN == PN then
GameTooltipTextLeft1:SetText(NewName)
if (IsInGuild()) then
GameTooltipTextLeft2:SetText(newTeamName)
end
end
-- if tooltip is a party member
for i = 1, partyMembers do
if GTN == GetUnitName("party"..i) then
local className = UnitClass("party"..i)
GameTooltipTextLeft1:SetText(className)
guildName = GetGuildInfo("party"..i)
if (guildName) then
GameTooltipTextLeft2:SetText(newTeamName)
end
end
end
end)
end
frame:SetScript("OnEvent", eventHandler)
-- Scoreboard (Exit Arena)
hooksecurefunc("WorldStateScoreFrame_Update", function()
for i = 1, MAX_WORLDSTATE_SCORE_BUTTONS do
local isArena, isRegistered = IsActiveBattlefieldArena();
local name, _, _, _, _, faction = GetBattlefieldScore(i)
local scoreButton = _G["WorldStateScoreButton"..i]
local partyMembers = GetNumPartyMembers()
if(name) then
if(isArena) then
if(isRegistered) then
if name == GetUnitName("player") then
for m = 1, MAX_WORLDSTATE_SCORE_BUTTONS do
local name2, _, _, _, _, faction2 = GetBattlefieldScore(m)
local scoreButton2 = _G["WorldStateScoreButton"..m]
local nameText = _G["WorldStateScoreButton" .. m .. "NameText"]
local winner = GetBattlefieldWinner()
if(faction == faction2) then
if(winner == faction2) then
WorldStateScoreWinnerFrameText:SetText(newTeamName)
end
if(name2 == name) then
nameText:SetText(NewName)
scoreButton2.team:SetText(newTeamName)
else
if(name2) then
local className2 = UnitClass(name2)
if (className2) then
nameText:SetText(className2)
else
nameText:SetText("")
end
scoreButton2.team:SetText(newTeamName)
end
end
end
end
end
end
end
end
end
end)
[свернуть]