
Сообщение от
chudo_228
привет, затемнение не сработало, а код с убиранием иконки появляется после использования любого скила
Код:
-- убирать
local function hidePetMood()
local icon = PetFrameHappiness
if not icon then return end
icon:Hide()
icon:SetAlpha(0)
if icon.EnableMouse then
icon:EnableMouse(false)
end
end
local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_LOGIN")
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:RegisterEvent("UNIT_PET")
f:RegisterEvent("UNIT_HAPPINESS")
f:RegisterEvent("PET_BAR_UPDATE")
f:SetScript("OnEvent", function(self, event, unit)
if unit and unit ~= "player" and unit ~= "pet" then
return
end
hidePetMood()
end)
if PetFrameHappiness then
hooksecurefunc(PetFrameHappiness, "Show", function(self)
self:Hide()
self:SetAlpha(0)
end)
end
if PetFrame_Update then
hooksecurefunc("PetFrame_Update", hidePetMood)
end
if PetFrame_UpdateHappiness then
hooksecurefunc("PetFrame_UpdateHappiness", hidePetMood)
end
Код:
-- затемнить
local r, g, b, a = 0.37, 0.37, 0.37, 1
local function paintTexture(texture)
if texture and texture.SetVertexColor then
texture:SetVertexColor(r, g, b, a)
end
end
local function darkenPetMood()
local icon = PetFrameHappiness
if not icon then return end
local regions = { icon:GetRegions() }
for i = 1, #regions do
local region = regions[i]
if region and region.GetObjectType and region:GetObjectType() == "Texture" then
paintTexture(region)
end
end
if icon.GetNormalTexture then
paintTexture(icon:GetNormalTexture())
end
if icon.GetPushedTexture then
paintTexture(icon:GetPushedTexture())
end
if icon.GetHighlightTexture then
paintTexture(icon:GetHighlightTexture())
end
if icon.GetCheckedTexture then
paintTexture(icon:GetCheckedTexture())
end
end
local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_LOGIN")
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:RegisterEvent("UNIT_PET")
f:RegisterEvent("UNIT_HAPPINESS")
f:RegisterEvent("PET_BAR_UPDATE")
f:SetScript("OnEvent", function(self, event, unit)
if unit and unit ~= "player" and unit ~= "pet" then
return
end
darkenPetMood()
end)
if PetFrame_Update then
hooksecurefunc("PetFrame_Update", darkenPetMood)
end
if PetFrame_UpdateHappiness then
hooksecurefunc("PetFrame_UpdateHappiness", darkenPetMood)
end
Попробуй, но сразу говорю, если у тебя стоит пачка аддонов которые тоже трогают "PetFrame", они могут тупо перетирать код обратно, так что это рабочий полукостыль пока я не знаю что у тебя за сборка и какие аддоны лезут в этот фрейм.
- - - Updated - - -

Сообщение от
Bubuzyaka
Конечно не сработает. Это же бесполезная копипаста с гпт
Аватарка всевидящего ока - диагноз по Lua через монитор, всё сходится. увидело GPT, но не увидело что именно не так в коде
- - - Updated - - -
Адрес: Числозверя
СлезаДьявола х100
Каково это жить в мире где все куклы, а ты один куколд?