• 0

    posted a message on Leaving Battleground
    That worked perfectly, thank you!
    Posted in: Need Help?
  • 0

    posted a message on Leaving Battleground
    I hate the leave BG button being right next to the see scoreboard button in game now.

    I wish I could remove leave BG form the list, but I am way noobish at this. I am trying to make a confirmation button to ask me yes or no on hitting leave BG on accident. I cannot get it to work, could use some help or if someone has already made this point me that way.

    local locale = GetLocale() -- Translation from Google Translate
    if locale == "enUS" or locale == "enGB" then
    	CONFIRM_BATTLEGROUND = "Are you sure you want to leave the battleground?"
    	CONFIRM_ARENA = "Are you sure you want to leave the arena?"
    elseif locale == "esES" or locale == "esMX" then
    	CONFIRM_BATTLEGROUND = "¿Estás seguro de querer dejar el campo de batalla?"
    	CONFIRM_ARENA = "¿Estás seguro de querer dejar la arena?"
    
    end
    
    local dropdown = QueueStatusMinimapButtonDropDown
    
    StaticPopupDialogs["CONFIRM_PVP"] = {
    	button1 = YES,
    	button2 = NO,
    	OnAccept = LeaveBattlefield
    }
    
    local popup = StaticPopupDialogs["CONFIRM_PVP"]
    
    local function ShowConfirmation()
    	StaticPopup_Show("CONFIRM_PVP")
    end
    
    local function SetNewFuncs(...)
    	for i = 1, select("#", ...) do
    		local button = select(i, ...)
    		local text = button.text
    
    		if text == LEAVE_ARENA or text == LEAVE_BATTLEGROUND then
    			popup.text = text == LEAVE_BATTLEGROUND and CONFIRM_BATTLEGROUND or CONFIRM_ARENA
    			button.func = ShowConfirmation
    		end
    	end
    end
    
    local function QueueStatusDropDown_Update_Hook()
    	SetNewFuncs(dropdown:GetChildren())
    end
    
    hooksecurefunc("QueueStatusDropDown_Update", QueueStatusDropDown_Update_Hook)


    Thanks
    Posted in: Need Help?
  • To post a comment, please or register a new account.