Кто-то сможет помочь произвести небольшую кастомизацию дефолтных плейтов?
1. Убрать прозрачность нейпмлейтов при активном выбранном таргете
Вложение 880615
2. Добавить значения хп (оставшиеся) в циферках на полоске здоровья
Спасибо
Вид для печати
Кто-то сможет помочь произвести небольшую кастомизацию дефолтных плейтов?
1. Убрать прозрачность нейпмлейтов при активном выбранном таргете
Вложение 880615
2. Добавить значения хп (оставшиеся) в циферках на полоске здоровья
Спасибо
PHP код:local function formatV(v)
if v > 0 then
if v < 1e3 then
return v
elseif v < 1e6 then
return ("%.1fk"):format(v/1e3)
else
return ("%.1fm"):format(v/1e6)
end
end
end
local function healthbar_valuechanged_cb(self,value)
self.text:SetText(formatV(value))
end
local function healthbar_show_cb(self)
self.text:SetText(formatV(self:GetValue()))
end
local function nameplate_update_cb(self)
self:SetAlpha(1)
end
local function InitNamePlate(frame)
local healthbar = frame:GetChildren()
healthbar.text = healthbar:CreateFontString(nil,"ARTWORK")
healthbar.text:SetFont("Fonts\\FRIZQT__.TTF",11,"OUTLINE")
healthbar.text:SetPoint("CENTER")
healthbar_show_cb(healthbar)
healthbar:SetScript("OnValueChanged",healthbar_valuechanged_cb)
healthbar:SetScript("OnShow",healthbar_show_cb)
frame:SetScript("OnUpdate",nameplate_update_cb)
end
local function IdentifyFrame(self)
if self:GetName() then return end
if self.GetRegions then
local region = self:GetRegions()
if region.GetTexture then
local texturePath = region:GetTexture()
if texturePath == "Interface\\TargetingFrame\\UI-TargetingFrame-Flash" then
return "NamePlate"
elseif texturePath == "Interface\\Tooltips\\ChatBubble-Background" then
return "ChatBubble"
end
end
end
end
local function iterateChildrens(object,...)
if not object then return end
local type = IdentifyFrame(object)
if type == "NamePlate" then
InitNamePlate(object)
elseif type == "ChatBubble" then
--InitChatBubble(object)
end
return iterateChildrens(...)
end
local select,WorldFrame = select,WorldFrame
local lastWorldFrameChildsCount = 0
CreateFrame("frame"):SetScript("OnUpdate",function()
local worldFrameChildsCount = WorldFrame:GetNumChildren()
if worldFrameChildsCount ~= lastWorldFrameChildsCount then
iterateChildrens(select(lastWorldFrameChildsCount+1,WorldFrame:GetChildren()))
lastWorldFrameChildsCount = worldFrameChildsCount
end
end)
Забыл об еще одном. Возможно убрать смешивание неймплейтов как здесь?
Вложение 880644
И сделать полное наложение плейта если они пересекаются, как здесь:
Вложение 880645
Спасибо!
@Sproody, ваша помощь все еще актуальна?
Я просто на примере ниже показал как мне надо, это одна задача. Где именно этот чекбокс в настройках игры? Все перепробовал, не нашел
Мне именно надо чтобы они не перемешивались друг с другом, как на 2 скрине (если нажать на таргет, то будет как на 2 скрине), а вне таргета как на скрине выше, это и надо устранить. Короче, надо сделать так, чтобы в любых случаях они не перемешивались, а были как на скрине ниже не зависимо в таргете или нет.
А, ну это уже надо писать какой то скрипт, в близз интерфейсе можно включить, что бы индикаторы никогда не накладовались друг на друга.
Т.е. Первый индикатор будет автоматически выкидыватся за рамки второго.
Включается это во вкладке с настройками неймплейт, поймешь по названию, либо же потыкаешь галочки
PHP код:local function healthbar_valuechanged_cb(self,value)
self.text:SetText(value)
end
local function healthbar_show_cb(self)
self.text:SetText(self:GetValue())
end
local function nameplate_update_cb(self)
self:SetAlpha(1)
end
local function InitNamePlate(frame)
local healthbar = frame:GetChildren()
healthbar.text = healthbar:CreateFontString(nil,"ARTWORK")
healthbar.text:SetFont("Fonts\\FRIZQT__.TTF",11,"OUTLINE")
healthbar.text:SetPoint("CENTER")
healthbar_show_cb(healthbar)
healthbar:SetScript("OnValueChanged",healthbar_valuechanged_cb)
healthbar:SetScript("OnShow",healthbar_show_cb)
frame:SetScript("OnUpdate",nameplate_update_cb)
end
local function IdentifyFrame(self)
if self:GetName() then return end
if self.GetRegions then
local region = self:GetRegions()
if region.GetTexture then
local texturePath = region:GetTexture()
if texturePath == "Interface\\TargetingFrame\\UI-TargetingFrame-Flash" then
return "NamePlate"
elseif texturePath == "Interface\\Tooltips\\ChatBubble-Background" then
return "ChatBubble"
end
end
end
end
local function iterateChildrens(object,...)
if not object then return end
local type = IdentifyFrame(object)
if type == "NamePlate" then
InitNamePlate(object)
elseif type == "ChatBubble" then
--InitChatBubble(object)
end
return iterateChildrens(...)
end
local select,WorldFrame = select,WorldFrame
local lastWorldFrameChildsCount = 0
CreateFrame("frame"):SetScript("OnUpdate",function()
local worldFrameChildsCount = WorldFrame:GetNumChildren()
if worldFrameChildsCount ~= lastWorldFrameChildsCount then
iterateChildrens(select(lastWorldFrameChildsCount+1,WorldFrame:GetChildren()))
lastWorldFrameChildsCount = worldFrameChildsCount
end
end)
Спасибо фурычит!
А можно ещё сюда запихать иконку класса?
С возможностью регулировать размер иконке в коде?
Вложение 880794
Вот вроде, пробуй. Если классы будет неверно определять - поиграйся с значением константы ACCURACYPHP код:local CLASSICON_SIZE = 28
local ACCURACY = 8
local CLASS_ICON_TCOORDS = CLASS_ICON_TCOORDS
local UnitClass = UnitClass
local pairs = pairs
local math_round
do
local math_floor = math.floor
math_round = function(x)
return math_floor(x+0.5)
end
end
local function GetUnitTypeByNameplateRGB(r,g,b)
if g + b == 0 then -- red
return "enemy"
elseif r + b == 0 then -- green
return "friend_pvp"
elseif r + g == 0 then -- blue
return "friend_nopvp"
elseif r + g > 1.99 and b == 0 then -- yellow
return "neutral"
else
return "enemy_player"
end
end
local GetClassByRGB
do
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
GetClassByRGB = function(r,g,b)
for class,tbl in pairs(RAID_CLASS_COLORS) do
if math_round(tbl.r*ACCURACY) == math_round(r*ACCURACY)
and math_round(tbl.g*ACCURACY) == math_round(g*ACCURACY)
and math_round(tbl.b*ACCURACY) == math_round(b*ACCURACY) then
return class
end
end
end
end
local function healthbar_UpdateClassIcon(self,r,g,b)
if GetUnitTypeByNameplateRGB(r,g,b) == "enemy_player" then
local class = GetClassByRGB(r,g,b)
if class then
self.classIcon:SetTexCoord(unpack(CLASS_ICON_TCOORDS[class]))
self.classIcon:Show()
return
end
end
self.classIcon:Hide()
end
local function healthbar_valuechanged_cb(self,value)
self.text:SetText(value)
end
local function healthbar_show_cb(self)
self.text:SetText(self:GetValue())
end
local function healthbar_update_cb(self)
local r,g,b = self:GetStatusBarColor()
if not (r == self.r and g == self.g and b == self.b) then
healthbar_UpdateClassIcon(self,r,g,b)
self.r,self.g,self.b = r,g,b
end
end
local function nameplate_update_cb(self)
self:SetAlpha(1)
end
local function InitNamePlate(frame)
local healthbar = frame:GetChildren()
healthbar.text = healthbar:CreateFontString(nil,"ARTWORK")
healthbar.text:SetFont("Fonts\\FRIZQT__.TTF",11,"OUTLINE")
healthbar.text:SetPoint("CENTER")
healthbar.classIcon = healthbar:CreateTexture(nil,"BORDER")
healthbar.classIcon:SetPoint("RIGHT",healthbar,"LEFT",-4,0)
healthbar.classIcon:SetSize(CLASSICON_SIZE,CLASSICON_SIZE)
healthbar.classIcon:SetTexture("Interface\\TargetingFrame\\UI-Classes-Circles")
healthbar.classIcon:Hide()
healthbar_show_cb(healthbar)
healthbar:SetScript("OnValueChanged",healthbar_valuechanged_cb)
healthbar:SetScript("OnShow",healthbar_show_cb)
healthbar:SetScript("OnUpdate",healthbar_update_cb)
frame:SetScript("OnUpdate",nameplate_update_cb)
end
local function IdentifyFrame(self)
if self:GetName() then return end
if self.GetRegions then
local region = self:GetRegions()
if region.GetTexture then
local texturePath = region:GetTexture()
if texturePath == "Interface\\TargetingFrame\\UI-TargetingFrame-Flash" then
return "NamePlate"
elseif texturePath == "Interface\\Tooltips\\ChatBubble-Background" then
return "ChatBubble"
end
end
end
end
local function iterateChildrens(object,...)
if not object then return end
local type = IdentifyFrame(object)
if type == "NamePlate" then
InitNamePlate(object)
elseif type == "ChatBubble" then
--InitChatBubble(object)
end
return iterateChildrens(...)
end
local select,WorldFrame = select,WorldFrame
local lastWorldFrameChildsCount = 0
CreateFrame("frame"):SetScript("OnUpdate",function()
local worldFrameChildsCount = WorldFrame:GetNumChildren()
if worldFrameChildsCount ~= lastWorldFrameChildsCount then
iterateChildrens(select(lastWorldFrameChildsCount+1,WorldFrame:GetChildren()))
lastWorldFrameChildsCount = worldFrameChildsCount
end
end)
Sproody, скажи, пожалуйста, что на счет этого поста? https://forum.wowcircle.net/showthre...=1#post7327200
Возможно убрать смешивание полосок как на скрине выше и сделать всегда как на скрине ниже не зависимо берешь в таргет или нет?
Если возьмешься, возьми, пожалуйста, за основу код из 2 поста.
Да работает, а можно иконки квадратные сделать?
Вложение 880823
А, да, вот. Правда мне не оч нравится что их приоритеты(выше-ниже) распределяются без какой то логики. В идеале бы сделать зависимость от расстояния к юниту плейта, но это уже сишную часть ковырять надо.
- - - Updated - - -PHP код:local CLASSICON_SIZE = 28
local ACCURACY = 8
local CLASS_ICON_TCOORDS = CLASS_ICON_TCOORDS
local UnitClass = UnitClass
local pairs = pairs
local nameplates = {}
local math_round
do
local math_floor = math.floor
math_round = function(x)
return math_floor(x+0.5)
end
end
local function GetUnitTypeByNameplateRGB(r,g,b)
if g + b == 0 then -- red
return "enemy"
elseif r + b == 0 then -- green
return "friend_pvp"
elseif r + g == 0 then -- blue
return "friend_nopvp"
elseif r + g > 1.99 and b == 0 then -- yellow
return "neutral"
else
return "enemy_player"
end
end
local GetClassByRGB
do
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
GetClassByRGB = function(r,g,b)
for class,tbl in pairs(RAID_CLASS_COLORS) do
if math_round(tbl.r*ACCURACY) == math_round(r*ACCURACY)
and math_round(tbl.g*ACCURACY) == math_round(g*ACCURACY)
and math_round(tbl.b*ACCURACY) == math_round(b*ACCURACY) then
return class
end
end
end
end
local function healthbar_UpdateClassIcon(self,r,g,b)
if GetUnitTypeByNameplateRGB(r,g,b) == "enemy_player" then
local class = GetClassByRGB(r,g,b)
if class then
self.classIcon:SetTexCoord(unpack(CLASS_ICON_TCOORDS[class]))
self.classIcon:Show()
return
end
end
self.classIcon:Hide()
end
local function healthbar_valuechanged_cb(self,value)
self.text:SetText(value)
end
local function healthbar_show_cb(self)
self.text:SetText(self:GetValue())
end
local function healthbar_update_cb(self)
local r,g,b = self:GetStatusBarColor()
if not (r == self.r and g == self.g and b == self.b) then
healthbar_UpdateClassIcon(self,r,g,b)
self.r,self.g,self.b = r,g,b
end
end
local function nameplate_update_cb(self)
self:SetAlpha(1)
end
local function InitNamePlate(frame)
local healthbar = frame:GetChildren()
healthbar.text = healthbar:CreateFontString(nil,"ARTWORK")
healthbar.text:SetFont("Fonts\\FRIZQT__.TTF",11,"OUTLINE")
healthbar.text:SetPoint("CENTER")
healthbar.classIcon = healthbar:CreateTexture(nil,"BORDER")
healthbar.classIcon:SetPoint("RIGHT",healthbar,"LEFT",-4,0)
healthbar.classIcon:SetSize(CLASSICON_SIZE,CLASSICON_SIZE)
healthbar.classIcon:SetTexture("Interface\\TargetingFrame\\UI-Classes-Circles")
healthbar.classIcon:Hide()
healthbar_show_cb(healthbar)
healthbar:SetScript("OnValueChanged",healthbar_valuechanged_cb)
healthbar:SetScript("OnShow",healthbar_show_cb)
healthbar:SetScript("OnUpdate",healthbar_update_cb)
frame:SetScript("OnUpdate",nameplate_update_cb)
table.insert(nameplates,frame)
end
local function IdentifyFrame(self)
if self:GetName() then return end
if self.GetRegions then
local region = self:GetRegions()
if region.GetTexture then
local texturePath = region:GetTexture()
if texturePath == "Interface\\TargetingFrame\\UI-TargetingFrame-Flash" then
return "NamePlate"
elseif texturePath == "Interface\\Tooltips\\ChatBubble-Background" then
return "ChatBubble"
end
end
end
end
local function iterateChildrens(object,...)
if not object then return end
local type = IdentifyFrame(object)
if type == "NamePlate" then
InitNamePlate(object)
elseif type == "ChatBubble" then
--InitChatBubble(object)
end
return iterateChildrens(...)
end
local select,WorldFrame = select,WorldFrame
local lastWorldFrameChildsCount = 0
CreateFrame("frame"):SetScript("OnUpdate",function()
local worldFrameChildsCount = WorldFrame:GetNumChildren()
if worldFrameChildsCount ~= lastWorldFrameChildsCount then
iterateChildrens(select(lastWorldFrameChildsCount+1,WorldFrame:GetChildren()))
lastWorldFrameChildsCount = worldFrameChildsCount
end
local level = 1
for _,frame in pairs(nameplates) do
if frame:IsShown() then
if frame:GetFrameLevel() == 20 then -- is target
frame:SetFrameLevel(#nameplates*2)
else
level = level + 2
frame:SetFrameLevel(level)
end
end
end
end)
Скрытый текст
Спасибо, друг!
А какие именно строчки кода отвечают за возможность убрать смешивание плейтов? Я бы их вставил в код из 2 поста, а то не особо удобно юзать код который ты написал для чела выше с иконками и цифрами хп целиком без "к", мне с "к" и без иконок удобнее.
UPD. Хотя вроде уже сам нашел
значение хп в цифрах на хпбаре уныло как то выглядит.
придумал другую фигню, ну как придумал, в доте2 увидал. там просто разделители ставятся и уже примерно понятно сколько текущее и сколько максимальное.
для дефолтных неймплейтов
https://i.ibb.co/1qTqjKb/image.png
PHP код:do
local hp = 10000
local cap = 10
local w,num, select,ipairs = WorldFrame,0, select,ipairs
local function divide(s,max)
local w,ww = (s:GetWidth()/max)*hp,0
local n = max/hp
if n > cap then return end
for i = 1, n do
local a = s.d[i]
if not a then
a = s:CreateTexture(nil,"OVERLAY")
a:SetTexture('Interface\\MainMenuBar\\UI-ExhaustionTickNormal')
local size = s:GetHeight()+12
a.s = size/2
a:SetWidth(size)
a:SetHeight(size)
a:SetAlpha(.6)
tinsert(s.d,a)
end
ww = ww + w
a:SetPoint('topleft',ww-a.s,6)
a:Show()
end
end
local function re(s)
s.d = {}
divide(s,(select(2,s:GetMinMaxValues())))
s:HookScript("OnShow",function(s) divide(s,select(2,s:GetMinMaxValues())) end)
s:HookScript("OnHide",function(s) for _,v in ipairs(s.d) do v:Hide() end end)
s:HookScript("OnValueChanged",function(s,v)
if not s:GetParent():IsShown() then return end
local _,max = s:GetMinMaxValues()
if s.max ~= max then s.max = max divide(s,max) end
end)
end
CreateFrame("frame"):SetScript("OnUpdate",function()
local n = w:GetNumChildren()
if num == n then return end
for i = num + 1, n do
local f = select(i, w:GetChildren())
if not f:GetName() then
local a = f:GetRegions()
if a and a.GetTexture and a:GetTexture() == "Interface\\TargetingFrame\\UI-TargetingFrame-Flash" then
re(f:GetChildren())
end
end
num = n
end
end)
end
[свернуть]
любезно к себе в сборку утащил :D
Скрытый текст
https://github.com/FrostAtom/FrostAt...nameplates.lua
+ апскейл для юнитов вроде манекена с большим кол-вом хп, в тупую прятать это не оч
+ промежуточные делители
Вложение 904773[свернуть]
тоже сперва сделал также как на картинке с доты. просто черные полоски и каждая четвертая жирнее.
но, у меня текстуры с малыми значениями размеров, отображаются криво. я так понимаю, когда середина попадает между пикселей, они не отображаются. поэтому делители с одинаковой шириной могут выглядеть по разному, а с разными - одинаково. а когда неймплейт немного движется, из-за анимации например, черточки начинают плясать. а вот с широкой текстуркой с альфа-каналом, которая выглядит узкой, все в порядке, отображается четко.
нашел еще один, пожалуй лучший вариант
текстовые строки c символом "|"
https://i.ibb.co/dB6wqhs/image.pngPHP код:a = s:CreateFontString(nil,"OVERLAY","GameFontBlack")
a:SetHeight(s:GetHeight()-4)
a:SetText("|")
[свернуть]
Cпасибо
Код из второго поста не работает с аддоном Arena Spectator
Также если прописать эти коды к коду второго поста, которые отвечают за наложение плейтов друг на друга, то вне таргетные касты с пропатченным экзешником кастуются быстрее, чем на самом деле (визуально полоска каста финиширует в 2 раза быстрее, но только ВНЕ таргетные, а если взять в таргет, то скорость каста будет соответствовать спелу).
Ну на спекратор по сути пох, это он выдает луа ошибки, но по какой причине внетаргетные касты с кодом ниже со скоростью света кастуются, это вообще дерьмово
Код:local nameplates = {}
Код:table.insert(nameplates,frame)
Код:local level = 1
for _,frame in pairs(nameplates) do
if frame:IsShown() then
if frame:GetFrameLevel() == 20 then -- is target
frame:SetFrameLevel(#nameplates*2)
else
level = level + 2
frame:SetFrameLevel(level)
end
end
end
@Sproody можно с этим что-то сделать, не знаешь?
Upp
ап)
Подскажите, пожалуйста, куда код со второго поста заносить? Может быть есть какой-то гайд...
1. создаешь папку в Interface\Addons\Customnameplate < твоя папка
2. создаешь в ней 2 текстовых документа, 1 называешь "Customnameplate.lua", второй "Customnameplate.toc"
3. в 1(.lua), вставляешь нужный тебе код, а в 2(.toc)
4. Заходишь в игруКод:## Interface: 30300
## Title: Customnameplate
## Notes: nameplates
## Author: GODMODEGAME666
## Version: 1.0
Customnameplate.lua