• 0

    posted a message on Editting unitframes
    Hello Guys,

    I downloaded an existing UI called IboUi .

    There is one thing I'd like to change for myself;
    The moved target unitframe is overlapping the unitframe for the pet.
    I'd like to move the pet frame a bit and found a script to do this:

    /run PetFrame:ClearAllPoints() PetFrame:SetPoint("LEFT",PlayerFrame,"RIGHT",-245, -45)

    But everytime I restart WoW it resets and I have to use it again.

    I'd like to know how I'm able to adjust the script of the UI so this will be done automaticly everytime I start WoW.

    Thanks in advance !!

    here is how the LUA file looks like:

    print("IboUI loaded!")
    
    ---------- // CONFIG // ---------- UI Scale 0.81
    local IboMoveFrames = 1
    local IboTextures = 1
    local IboHPMPValues = 1
    local IboRange = 1
    local IboClassColorBars = 1	
    local IboClassColorNameBackground = 1	
    local IboCombatSword = 1
    local IboDarkFrame = 1 
    local IboHideHotkeyText = 1
    local IboHideMacroText = 1
    local frame = {
    
    ["PlayerFrame"] = { 	
    position = {"LEFT", UIParent, "LEFT", 357, 44};
    scale = 1},													
    ["TargetFrame"]	= {
    position = {"TOPLEFT", PlayerFrame,"TOPLEFT", 100, -45};  --100 , -45
    scale = 1},
    
    ["TargetFrameToT"] =	{
    position = {"CENTER","TargetFrame", "CENTER", 52, -38};
    scale = 1},
    	
    ["FocusFrame"] = {
    position = {"CENTER", UIParent, "CENTER", 290, -1};		
    scale = 1},
    
    ["FocusFrameToT"] = {
    position = {"CENTER", "FocusFrame", "CENTER", 52, -38};	
    scale = 1},
    
    ["PartyMemberFrame1"] = {
    position = {"CENTER","PlayerFrame","CENTER", -80, -57};
    scale = 1},
    };
    
    ---------- // END OF CONFIG // ----------
    
    ---------- // MISC SHIT // ----------
    --PlayerFrame.name:Hide()
    
    ---------- // MOVE FRAMES // ----------
    if (IboMoveFrames == 1) then
    
    -- Player frame
    hooksecurefunc("PlayerFrame_ResetPosition", function(self)
           self:ClearAllPoints()
           self:SetPoint(unpack(frame["PlayerFrame"].position))
    	   PlayerFrame:SetScale(frame["PlayerFrame"].scale)
    	   end)
    	   
    -- Target frame
    TargetFrame:ClearAllPoints()
    TargetFrame:SetPoint(unpack(frame["TargetFrame"].position));
    TargetFrame:SetScale(frame["TargetFrame"].scale)
    
    -- Target of target frame
    TargetFrameToT:ClearAllPoints()
    TargetFrameToT:SetPoint(unpack(frame["TargetFrameToT"].position));
    TargetFrameToT:SetScale(frame["TargetFrameToT"].scale)
    
    -- Focus frame
    FocusFrame:ClearAllPoints()
    FocusFrame:SetPoint(unpack(frame["FocusFrame"].position))
    FocusFrame:SetScale(frame["FocusFrame"].scale)
    
    -- Target of focus frame
    FocusFrameToT:ClearAllPoints()
    FocusFrameToT:SetPoint(unpack(frame["FocusFrameToT"].position))
    FocusFrameToT:SetScale(frame["FocusFrameToT"].scale)
    
    -- Party Frame
    PartyMemberFrame1:ClearAllPoints()
    PartyMemberFrame1:SetPoint(unpack(frame["PartyMemberFrame1"].position))
    PartyMemberFrame1:SetScale(frame["PartyMemberFrame1"].scale)
    
    end	
    
    ---------- // HIDING FRAMES // ----------
    MainMenuBarLeftEndCap:Hide()
    MainMenuBarRightEndCap:Hide()
    MainMenuBarMaxLevelBar:SetAlpha(0)
    TargetFrameTextureFramePVPIcon:SetAlpha(0)
    PlayerPVPIcon:SetAlpha(0)
    
    ---------- // GETTING TEXTURES // ----------
    if (IboTextures == 1) then
    	for _, StatusBarTextures in pairs ({
    	PlayerFrameHealthBar, PlayerFrameManaBar,
    		TargetFrameHealthBar, TargetFrameManaBar,
    		TargetFrameToTHealthBar, TargetFrameToTManaBar,
    	FocusFrameHealthBar, FocusFrameManaBar,
    	FocusFrameToTHealthBar, FocusFrameToTManaBar,
    		PartyMemberFrame1HealthBar,
    		PartyMemberFrame2HealthBar,
    		PartyMemberFrame3HealthBar,
    		PartyMemberFrame4HealthBar,
    	PartyMemberFrame1ManaBar,
    	PartyMemberFrame2ManaBar,
    	PartyMemberFrame3ManaBar,
    	PartyMemberFrame4ManaBar,
    		CastingBarFrame, TargetFrameSpellBar, FocusFrameSpellBar,	
    	}) 	do
    		StatusBarTextures:SetStatusBarTexture("Interface\\AddOns\\IboUI\\IboFrameBackground")
    	end
    	
    	for _, BarTextures in pairs ({
    	TargetFrameNameBackground, FocusFrameNameBackground,
    	}) 	do
    		BarTextures:SetTexture("Interface\\AddOns\\IboUI\\IboFrameBackground")
    	end
    end
    
    ---------- // ONLY CURRENT HEALTH AND MANA VALUES ON PLAYER, TARGET AND FOCUS // ----------
    if (IboHPMPValues == 1) then
    local CurrentValues = CreateFrame("Frame")
    CurrentValues:SetScript("OnUpdate", function(self, e)
    
    		local PlayerHealth = UnitHealth("player")
    		local PlayerMana = UnitMana("player")
    		
            local TargetHealth = UnitHealth("target")
            local TargetMana = UnitMana("target")
    		
    		local FocusHealth = UnitHealth("focus")
            local FocusMana = UnitMana("focus")
    		
    		
    		PlayerFrameHealthBar.TextString:SetText(TextStatusBar_CapDisplayOfNumericValue(PlayerHealth))
    		PlayerFrameManaBar.TextString:SetText(TextStatusBar_CapDisplayOfNumericValue(PlayerMana))
    		
    		TargetFrameHealthBar.TextString:SetText(TextStatusBar_CapDisplayOfNumericValue(TargetHealth))
    		TargetFrameManaBar.TextString:SetText(TextStatusBar_CapDisplayOfNumericValue(TargetMana))
    		
    		FocusFrameHealthBar.TextString:SetText(TextStatusBar_CapDisplayOfNumericValue(FocusHealth))
    		FocusFrameManaBar.TextString:SetText(TextStatusBar_CapDisplayOfNumericValue(FocusMana))
    end)
    end
    
    ---------- // RED HOVER WHEN OUT OF RANGE // ----------
    if (IboRange == 1) then
    hooksecurefunc("ActionButton_OnEvent",function(self, event, ...)
                    if ( event == "PLAYER_TARGET_CHANGED" ) then
                            self.newTimer = self.rangeTimer
                    end
            end)
    
            hooksecurefunc("ActionButton_UpdateUsable",function(self)
                    local icon = _G[self:GetName().."Icon"]
                    local valid = IsActionInRange(self.action)
    
                    if ( valid == 0 ) then
                            icon:SetVertexColor(1.0, 0.1, 0.1)
                    end
            end)
    
            hooksecurefunc("ActionButton_OnUpdate",function(self, elapsed)
                    local rangeTimer = self.newTimer
    
                    if ( rangeTimer ) then
                            rangeTimer = rangeTimer - elapsed
     
                            if ( rangeTimer <= 0 ) then
                                    ActionButton_UpdateUsable(self)
                                    rangeTimer = TOOLTIP_UPDATE_TIME
                            end
    
                            self.newTimer = rangeTimer
                    end
            end)
    end		
    		
    ---------- // CLASS COLOR BARS EXCEPT SELF // ----------
    if (IboClassColorBars == 1) then
    local   UnitIsPlayer, UnitIsConnected, UnitClass, RAID_CLASS_COLORS =
            UnitIsPlayer, UnitIsConnected, UnitClass, RAID_CLASS_COLORS
    local _, class, c
    
    local function colour(statusbar, unit)
        if UnitIsPlayer(unit) and UnitIsConnected(unit) and unit == statusbar.unit and UnitClass(unit) then
            _, class = UnitClass(unit)
            c = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class]
            statusbar:SetStatusBarColor(c.r, c.g, c.b)
    		PlayerFrameHealthBar:SetStatusBarColor(0,1,0)
    		--TargetFrameTextureFrameName:SetVertexColor(c.r, c.g, c.b)
        end
    end
    
    hooksecurefunc("UnitFrameHealthBar_Update", colour)
    hooksecurefunc("HealthBar_OnValueChanged", function(self)
    	colour(self, self.unit)
    end)
    
    local sb = _G.GameTooltipStatusBar
    local addon = CreateFrame("Frame", "StatusColour")
    addon:RegisterEvent("UPDATE_MOUSEOVER_UNIT")
    addon:SetScript("OnEvent", function()
    	colour(sb, "mouseover")
    end)
    end
    
    ---------- // COMBAT STATE SWORDS TARGET AND FOCUS // ----------
    if (IboCombatSword == 1) then
    local t = CreateFrame("Frame", UIParent)
    t.t = t:CreateTexture()
    t.t:SetTexture("Interface\\CHARACTERFRAME\\UI-StateIcon.blp")
    t.t:SetTexCoord(0.5,1,0,0.49);
    t.t:SetAllPoints(t)
    t:SetWidth(25)
    t:SetHeight(25)
    t:SetPoint("CENTER", TargetFrame, "CENTER", 52, -12)
    t:Show()
    
    local function FrameOnUpdate(self)
               if UnitAffectingCombat("target") then
                      self:Show()
               else
                      self:Hide()
               end
    end
    local g = CreateFrame("Frame")
    g:SetScript("OnUpdate", function(self) FrameOnUpdate(t) end)
    
    -- Combat State Sword FOCUS
    local f = CreateFrame("Frame", UIParent)
    f.t = f:CreateTexture()
    f.t:SetTexture("Interface\\CHARACTERFRAME\\UI-StateIcon.blp")
    f.t:SetTexCoord(0.5,1,0,0.49);
    f.t:SetAllPoints(f)
    f:SetWidth(25)
    f:SetHeight(25)
    f:SetPoint("CENTER", FocusFrame, "CENTER", 52, -12)
    f:Show()
    
    local function FrameOnUpdateFocus(self)
               if UnitAffectingCombat("focus") then
                      self:Show()
               else
                      self:Hide()
               end
    end
    local g = CreateFrame("Frame")
    g:SetScript("OnUpdate", function(self) FrameOnUpdateFocus(f) end)
    end
    
    
    
    
    ---------- // MINIMAP // ----------
    MinimapBorderTop:Hide()
    MiniMapWorldMapButton:Hide()
    MinimapZoneText:SetPoint("TOPLEFT","MinimapZoneTextButton","TOPLEFT", 8, 0) -- to center the minimap zone text
    MinimapZoomIn:Hide()
    MinimapZoomOut:Hide()
    Minimap:EnableMouseWheel(true)
    Minimap:EnableMouseWheel(true)
    Minimap:SetScript('OnMouseWheel', function(self, delta)
    	if delta > 0 then
    		Minimap_ZoomIn()
    	else
    		Minimap_ZoomOut() 
    	end
    end)
    
    
    ---------- // DARK FRAMES // ----------
    if (IboDarkFrame == 1) then	
     local ef=CreateFrame("Frame")
       
          ef:RegisterEvent("ADDON_LOADED")
             ef:SetScript("OnEvent", function(self, event, addon)
                 if(addon=="Blizzard_TimeManager") then
              for i,v in pairs({
       		
    		PlayerFrameTexture,
       		TargetFrameTextureFrameTexture,
      		PetFrameTexture,
    			PartyMemberFrame1Texture,
    			PartyMemberFrame2Texture,
    			PartyMemberFrame3Texture,
    			PartyMemberFrame4Texture,
    		PartyMemberFrame1PetFrameTexture,
    		PartyMemberFrame2PetFrameTexture,
    		PartyMemberFrame3PetFrameTexture,
    		PartyMemberFrame4PetFrameTexture,
    			FocusFrameTextureFrameTexture,
    			TargetFrameToTTextureFrameTexture,
    			FocusFrameToTTextureFrameTexture,
            BonusActionBarFrameTexture0,
    		BonusActionBarFrameTexture1,
    		BonusActionBarFrameTexture2,
    		BonusActionBarFrameTexture3,
    		BonusActionBarFrameTexture4,	
    			MainMenuBarTexture0,
    			MainMenuBarTexture1,
    			MainMenuBarTexture2,
    			MainMenuBarTexture3,
            MainMenuMaxLevelBar0,
            MainMenuMaxLevelBar1,
    		MainMenuMaxLevelBar2,
    		MainMenuMaxLevelBar3,
    			MinimapBorder,
    		CastingBarFrameBorder,
    		FocusFrameSpellBarBorder,
    		TargetFrameSpellBarBorder,
    			MiniMapTrackingButtonBorder,
    			MiniMapLFGFrameBorder,
    			MiniMapBattlefieldBorder,
    			MiniMapMailBorder,	
    
    		select(1, TimeManagerClockButton:GetRegions()), 
    		--select(1, GameTimeFrame:GetRegions()),
                  }) do
                     v:SetVertexColor(.4, .4, .4)
                  end
    		for i,v in pairs({
    		select(2, TimeManagerClockButton:GetRegions()),
    			}) do
                     v:SetVertexColor(1, 1, 1)
                  end 
            self:UnregisterEvent("ADDON_LOADED")
            ef:SetScript("OnEvent", nil)
        end
    end)
              for i,v in pairs({
    		MainMenuBarLeftEndCap,
            MainMenuBarRightEndCap,  
                  }) do
                     v:SetVertexColor(.35, .35, .35)
    	      end  	  
    end
    
    
    ---------- // CLASS COLORS IN NAME BACKGROUND // ----------
    if (IboClassColorNameBackground == 1) then
    local frame = CreateFrame("FRAME")
    	frame:RegisterEvent("PLAYER_ENTERING_WORLD")
    	frame:RegisterEvent("PARTY_MEMBERS_CHANGED")
    	frame:RegisterEvent("PLAYER_TARGET_CHANGED")
    	frame:RegisterEvent("PLAYER_FOCUS_CHANGED")
    	frame:RegisterEvent("UNIT_FACTION")
    
    local function eventHandler(self, event, ...)
            local unitid = ...
            if (event == "UNIT_FACTION" and unitid ~= "target" and unitid ~= "focus") then return end
    
            if UnitIsPlayer("target") then
                    _, class = UnitClass("target")
                    c = RAID_CLASS_COLORS[class]
                    TargetFrameNameBackground:SetVertexColor(c.r, c.g, c.b)
    				end
    		
    		if UnitIsPlayer("focus") then
                    _, class = UnitClass("focus")
                    c = RAID_CLASS_COLORS[class]
                   FocusFrameNameBackground:SetVertexColor(c.r, c.g, c.b)
    				end
    		end
    frame:SetScript("OnEvent", eventHandler)
    end
    
    ---------- // ACTION BAR TEXTURE FIX // ----------
    hooksecurefunc("ActionButton_ShowGrid", function(btn)
    	local buttonTexture = _G[btn:GetName().."NormalTexture"]:SetVertexColor(1, 1, 1, 1)
    end)
    
    ---------- // Hooks to make sure player frame get back to their position when entering/leaving a vehicle // ----------
    if (IboMoveFrames == 1) then
    hooksecurefunc("PlayerFrame_AnimateOut", function()
    	if not (UnitAffectingCombat("player")) then
    		PetFrame:SetAlpha(0)
    		PlayerFrame:ClearAllPoints()
            PlayerFrame:SetPoint(unpack(frame["PlayerFrame"].position))
    	else
    		frame:RegisterEvent("PLAYER_REGEN_ENABLED")
    	end
    end)
    
    hooksecurefunc("PlayerFrame_SequenceFinished", function()
    	if not (UnitAffectingCombat("player")) then
    		PlayerFrame:SetAlpha(1)
    		PlayerFrame:ClearAllPoints()
            PlayerFrame:SetPoint(unpack(frame["PlayerFrame"].position))
    	else
    		frame:RegisterEvent("PLAYER_REGEN_ENABLED")
    	end
    end)
    end
    ---------- // HIDE HOTKEY // ----------
    if (IboHideHotkeyText == 1) then
    local noop = function() end
    	hooksecurefunc("ActionButton_Update", function(btn)
    		local hotkey = _G[btn:GetName().."HotKey"]
    		hotkey:SetText("")
    		hotkey.Show = noop
    		hotkey:Hide()
    	end)
    end
    
    ---------- // HIDE MACRO NAME // ----------
    if (IboHideMacroText == 1) then
    hooksecurefunc("ActionButton_Update", function(btn)
    		local name = _G[btn:GetName().."Name"]
    		name:Hide()
    	end)
    end
    Posted in: Need Help?
  • To post a comment, please or register a new account.