WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Search/Requests (https://www.wowinterface.com/forums/forumdisplay.php?f=6)
-   -   LF Some1 to do some rework on my UI addon. Compensation will be provided. (https://www.wowinterface.com/forums/showthread.php?t=58752)

Emukiopa 05-21-21 04:04 PM

LF Some1 to do some rework on my UI addon. Compensation will be provided.
 
So i got an addon, with some scripts inside it, that i would like to get removed, and than be put into a downloadable addon again.

HMU on discord.

IiIiiIiIiIiiIIiiI#9538

-- UI Scripts - Shadowlands updated - Emil

local f = CreateFrame("FRAME");
f:RegisterEvent("PLAYER_ENTERING_WORLD"); --Event that fires on loadingscreens
f:RegisterEvent("PLAYER_REGEN_DISABLED")
f:RegisterEvent("PLAYER_REGEN_ENABLED")
f:SetScript("OnEvent", function(self, event, ...)
if (event == "PLAYER_REGEN_DISABLED") then

else
MicroButtonAndBagsBar:Hide()

local t, f = {"Character","Spellbook","Talent","Achievement","QuestLog","Guild","LFD","Collections","EJ","Store","MainMenu"}
for i = 1, #t do
f= _G[t[i].."MicroButton"]f:SetScale(.001)
end
MicroButtonAndBagsBar:Hide()

PlayerFrame:SetScale(1.2)
TargetFrame:SetScale(1.2)
FocusFrame:SetScale(1.2)

BuffFrame:ClearAllPoints()
BuffFrame:SetPoint("CENTER", PlayerFrame, "CENTER", 980, 80)
BuffFrame.SetPoint = function() end

SetCVar("cameradistancemaxfactor", 10)

local m1 = "MultiBarBottomRight"
_G[m1.."Button7"]:SetPoint("BOTTOMLEFT",_G[m1.."Button1"],"TOPLEFT", 0, 4)
UIPARENT_MANAGED_FRAME_POSITIONS[m1].xOffset = 6
ActionBarUpButton:Hide()
MainMenuBar.GetYOffset=function()
return -30
end
UIParent_ManageFramePositions()

local m2 = "MainMenuBarArtFrame"
_G[m2.."Background"]:Hide()
_G[m2].PageNumber:Hide()
_G[m2].LeftEndCap:Hide()
_G[m2].RightEndCap:Hide()
ActionButton1:ClearAllPoints()
ActionButton1:SetPoint("BOTTOM",_G[m2.."Background"], -340, 35)
ActionBarDownButton:Hide()

for _, v in pairs({TargetFrame.levelText, FocusFrame.levelText, TargetFrame.name, PlayerFrame.name, FocusFrame.name, PlayerLevelText}) do
hooksecurefunc(v, "Show", function(s)
s:Hide()
end)
v:Show()
end

C_NamePlate.SetNamePlateFriendlySize(40, 20)

RegisterStateDriver(StanceBarFrame, "visibility", "hide")
RegisterStateDriver(PetActionBarFrame, "visibility", "hide")

GameTimeFrame:Hide()
MiniMapTrackingBackground:Hide()
MiniMapTrackingButton:Hide()
MiniMapTrackingIcon:Hide()
MiniMapWorldMapButton:Hide()
MinimapBorderTop:Hide()
MinimapZoneText:Hide()
MinimapZoomIn:Hide()
MinimapZoomOut:Hide()
PetActionBarFrame:Hide()

-- Blizzard_TimeManager
LoadAddOn("Blizzard_TimeManager")
TimeManagerClockButton:Hide()

f:UnregisterEvent("PLAYER_ENTERING_WORLD")
end
end)


It is the buff part i would like to have removed. And also, if the coding can be worked, cause i sometimes have to lag problems. When i have this addon script on, compared to not having it on. Idk if that is something with the coding.

Kanegasi 05-21-21 05:12 PM

This code runs every time you leave combat. This is fine, especially since some things may reset themselves in combat, but this also means you're creating several more function hooks (the hooksecurefunc). Let's say you get into and out of combat 100 times. Every time one of those fontstrings tries to show now, such as PlayerLevelText, the game calls PlayerLevelText:Hide() literally 100 times. Next time you leave combat adds another hook, calling :Hide() 101 times. You probably noticed the longer you played, the worse the lag was.

I removed the three buff lines, protected the hooks and the securestatedriver behind a switch so they only happen once, and cleaned up the code, including changing the function hooks into widget hooks. I'm not too familiar with securestatedriver stuff, but I'm pretty sure every time a specific register function is called, it toggles that state, so you should only call it once.

Lua Code:
  1. -- UI Scripts - Shadowlands updated - Emil
  2.  
  3. local f=CreateFrame("frame")
  4. f:RegisterEvent("PLAYER_ENTERING_WORLD") --Event that fires on loadingscreens
  5. f:RegisterEvent("PLAYER_REGEN_DISABLED")
  6. f:RegisterEvent("PLAYER_REGEN_ENABLED")
  7. f:SetScript("OnEvent",function(self,event,...)
  8.     if event~="PLAYER_REGEN_DISABLED" then
  9.  
  10.         for _,v in pairs({"Character","Spellbook","Talent","Achievement","QuestLog","Guild","LFD","Collections","EJ","Store","MainMenu"}) do
  11.             _G[v.."MicroButton"]:SetScale(.001)
  12.         end
  13.         MicroButtonAndBagsBar:Hide()
  14.  
  15.         PlayerFrame:SetScale(1.2)
  16.         TargetFrame:SetScale(1.2)
  17.         FocusFrame:SetScale(1.2)
  18.  
  19.         SetCVar("cameradistancemaxfactor",10)
  20.  
  21.         local m1 = "MultiBarBottomRight"
  22.         _G[m1.."Button7"]:SetPoint("BOTTOMLEFT",_G[m1.."Button1"],"TOPLEFT",0,4)
  23.         UIPARENT_MANAGED_FRAME_POSITIONS[m1].xOffset = 6
  24.         ActionBarUpButton:Hide()
  25.         MainMenuBar.GetYOffset=function() return -30 end
  26.         UIParent_ManageFramePositions()
  27.  
  28.         local m2 = "MainMenuBarArtFrame"
  29.         _G[m2.."Background"]:Hide()
  30.         _G[m2].PageNumber:Hide()
  31.         _G[m2].LeftEndCap:Hide()
  32.         _G[m2].RightEndCap:Hide()
  33.         ActionButton1:ClearAllPoints()
  34.         ActionButton1:SetPoint("BOTTOM",_G[m2.."Background"],-340,35)
  35.         ActionBarDownButton:Hide()
  36.  
  37.         if not f.hooks then
  38.             for _,v in pairs({TargetFrame.levelText,FocusFrame.levelText,TargetFrame.name,PlayerFrame.name,FocusFrame.name,PlayerLevelText}) do
  39.     --          hooksecurefunc(v,"Show",function(s) s:Hide() end)
  40.                 v:HookScript("OnShow",function(s) s:Hide() end)
  41.                 v:Hide()
  42.             end
  43.             RegisterStateDriver(StanceBarFrame,"visibility","hide")
  44.             RegisterStateDriver(PetActionBarFrame,"visibility","hide")
  45.             f.hooks=true
  46.         end
  47.  
  48.         C_NamePlate.SetNamePlateFriendlySize(40,20)
  49.  
  50.         GameTimeFrame:Hide()
  51.         MiniMapTrackingBackground:Hide()
  52.         MiniMapTrackingButton:Hide()
  53.         MiniMapTrackingIcon:Hide()
  54.         MiniMapWorldMapButton:Hide()
  55.         MinimapBorderTop:Hide()
  56.         MinimapZoneText:Hide()
  57.         MinimapZoomIn:Hide()
  58.         MinimapZoomOut:Hide()
  59.         PetActionBarFrame:Hide()
  60.  
  61.         -- Blizzard_TimeManager
  62.         LoadAddOn("Blizzard_TimeManager")
  63.         TimeManagerClockButton:Hide()
  64.     end
  65. end)

Emukiopa 05-21-21 05:18 PM

Quote:

Originally Posted by Kanegasi (Post 339214)
This code runs every time you leave combat. This is fine, especially since some things may reset themselves in combat, but this also means you're creating several more function hooks (the hooksecurefunc). Let's say you get into and out of combat 100 times. Every time one of those fontstrings tries to show now, such as PlayerLevelText, the game calls PlayerLevelText:Hide() literally 100 times. Next time you leave combat adds another hook, calling :Hide() 101 times. You probably noticed the longer you played, the worse the lag was.

I removed the three buff lines, protected the hooks and the securestatedriver behind a switch so they only happen once, and cleaned up the code, including changing the function hooks into widget hooks. I'm not too familiar with securestatedriver stuff, but I'm pretty sure every time a specific register function is called, it toggles that state, so you should only call it once.

Lua Code:
  1. -- UI Scripts - Shadowlands updated - Emil
  2.  
  3. local f=CreateFrame("frame")
  4. f:RegisterEvent("PLAYER_ENTERING_WORLD") --Event that fires on loadingscreens
  5. f:RegisterEvent("PLAYER_REGEN_DISABLED")
  6. f:RegisterEvent("PLAYER_REGEN_ENABLED")
  7. f:SetScript("OnEvent",function(self,event,...)
  8.     if event~="PLAYER_REGEN_DISABLED" then
  9.  
  10.         for _,v in pairs({"Character","Spellbook","Talent","Achievement","QuestLog","Guild","LFD","Collections","EJ","Store","MainMenu"}) do
  11.             _G[v.."MicroButton"]:SetScale(.001)
  12.         end
  13.         MicroButtonAndBagsBar:Hide()
  14.  
  15.         PlayerFrame:SetScale(1.2)
  16.         TargetFrame:SetScale(1.2)
  17.         FocusFrame:SetScale(1.2)
  18.  
  19.         SetCVar("cameradistancemaxfactor",10)
  20.  
  21.         local m1 = "MultiBarBottomRight"
  22.         _G[m1.."Button7"]:SetPoint("BOTTOMLEFT",_G[m1.."Button1"],"TOPLEFT",0,4)
  23.         UIPARENT_MANAGED_FRAME_POSITIONS[m1].xOffset = 6
  24.         ActionBarUpButton:Hide()
  25.         MainMenuBar.GetYOffset=function() return -30 end
  26.         UIParent_ManageFramePositions()
  27.  
  28.         local m2 = "MainMenuBarArtFrame"
  29.         _G[m2.."Background"]:Hide()
  30.         _G[m2].PageNumber:Hide()
  31.         _G[m2].LeftEndCap:Hide()
  32.         _G[m2].RightEndCap:Hide()
  33.         ActionButton1:ClearAllPoints()
  34.         ActionButton1:SetPoint("BOTTOM",_G[m2.."Background"],-340,35)
  35.         ActionBarDownButton:Hide()
  36.  
  37.         if not f.hooks then
  38.             for _,v in pairs({TargetFrame.levelText,FocusFrame.levelText,TargetFrame.name,PlayerFrame.name,FocusFrame.name,PlayerLevelText}) do
  39.     --          hooksecurefunc(v,"Show",function(s) s:Hide() end)
  40.                 v:HookScript("OnShow",function(s) s:Hide() end)
  41.                 v:Hide()
  42.             end
  43.             RegisterStateDriver(StanceBarFrame,"visibility","hide")
  44.             RegisterStateDriver(PetActionBarFrame,"visibility","hide")
  45.             f.hooks=true
  46.         end
  47.  
  48.         C_NamePlate.SetNamePlateFriendlySize(40,20)
  49.  
  50.         GameTimeFrame:Hide()
  51.         MiniMapTrackingBackground:Hide()
  52.         MiniMapTrackingButton:Hide()
  53.         MiniMapTrackingIcon:Hide()
  54.         MiniMapWorldMapButton:Hide()
  55.         MinimapBorderTop:Hide()
  56.         MinimapZoneText:Hide()
  57.         MinimapZoomIn:Hide()
  58.         MinimapZoomOut:Hide()
  59.         PetActionBarFrame:Hide()
  60.  
  61.         -- Blizzard_TimeManager
  62.         LoadAddOn("Blizzard_TimeManager")
  63.         TimeManagerClockButton:Hide()
  64.     end
  65. end)

yo thanks bro, can you contact me on discord ? And if it is possible for you, to maybe create the addon ? Ill compensate with paymeant

Kanegasi 05-21-21 05:30 PM

You got this code from a file in an addon folder. Put it back into the file.


All times are GMT -6. The time now is 07:06 PM.

vBulletin © 2021, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI