Show blizzard frame in dungeons doesn't work if Force Hide is turned on (With fix) #88


Closed
Assigned to sorha2
  • Shiv_G3 created this issue Jul 10, 2017

    In the latest Alpha, if you turn on the ShowBlizzardTrackerInDungeons and also have ForceHideBlizzardTracker turned on then it never shows the tracker. 

     

    I changed the following in the function SorhaQuestLog:HandleBlizzardTracker() starting at line 747

            hooksecurefunc(ObjectiveTrackerFrame, "Show", function ()
    		   	if (db.Main.ForceHideBlizzardTracker) then
    				local isInstance, instanceType = IsInInstance()
    				
    				if not (isInstance and (instanceType == "party" or instanceType == "scenario")) then
    					ObjectiveTrackerFrame:Hide()
    				end
            	end
            end)
    
    
  • Shiv_G3 edited description Jul 11, 2017
  • Shiv_G3 posted a comment Jul 12, 2017

    The above code doesn't work 100%.  Will figure it out and update if I can get the code to work right.  Sorry about that.

  • Sorha2 posted a comment Jul 13, 2017

    Woops.. My bad on missing that  >.<

    tbh I might move that hook anyhow.

     

    My line numbers are a bit messed up so will just copy. I have changed the OnEnable method by moving the hook into it

     

    function SorhaQuestLog:OnEnable() -- Called when the addon is enabled
    	self:RegisterEvent("PLAYER_ENTERING_WORLD")
    	self:RegisterEvent("PLAYER_REGEN_ENABLED")
    	self:RegisterEvent("PLAYER_REGEN_DISABLED")
    	self:RegisterEvent("PET_BATTLE_OPENING_DONE")
    	self:RegisterEvent("PET_BATTLE_CLOSE")
    	self:RegisterEvent("UPDATE_BONUS_ACTIONBAR");
    	-- Remove achievements from blizzard questminion to skip their error
    	--SetCVar("trackerFilter", "7");
    		
    	--Uncomment (Remove the --) below lines if default tracker keeps showing up >.>
    	--ObjectiveTrackerBlocksFrame:UnregisterAllEvents()
    	--ScenarioBlocksFrame:UnregisterAllEvents()
    	--ObjectiveTrackerFrame:UnregisterAllEvents()
    	hooksecurefunc(ObjectiveTrackerFrame, "Show", function ()
    		if (db.Main.ForceHideBlizzardTracker and SorhaQuestLog:ShouldHideBlizzardTracker()) then
    			ObjectiveTrackerFrame:Hide();
    		end
    	end)
    	self:HandleBlizzardTracker();
    
    	if (db.AutoHide.HideDuringFlightPaths and UnitOnTaxi('player')) then
    		SorhaQuestLog:HideSorhaQuestLog()
    	end
    	
    	--[===[@debug@
    	-- Masque
    	if Masque then
    		-- Masque:Register("SorhaQuestLog", SkinChanged, SQLButtons)
    	end
    	--@end-debug@]===]
    
    	LSM.RegisterCallback(self, "LibSharedMedia_Registered", "UpdateMedia")
    end

     

     

    And have split the logic and action out into two separate functions. Got myself caught in an infinite loop there :P

     

    function SorhaQuestLog:ShouldHideBlizzardTracker()
    	local forceShow = false;
    	if(db.Main.ShowBlizzardTrackerInDungeons) then
    		local isInstance, instanceType = IsInInstance()
    		if (isInstance == true and (instanceType == "party" or instanceType == "scenario")) then
    			forceShow = true;
    		end
    	end				
    
    	if (db.Main.HideBlizzardTracker == true and not forceShow) then	
    		return true;
        else
    		return false;
        end	
    end
    
    function SorhaQuestLog:HandleBlizzardTracker()
    	if (SorhaQuestLog:ShouldHideBlizzardTracker()) then	
    		ObjectiveTrackerFrame:Hide();
        else
    		ObjectiveTrackerFrame:Show()
        end		
    end

     ... darn wowace formatting

    Anyhow, not much time tonight to double check, but it should hopefully work. If not feel free to yell at me :D


    Edited Jul 13, 2017
  • Sorha2 closed issue Sep 15, 2017
  • Sorha2 self-assigned this issue Sep 15, 2017

To post a comment, please login or register a new account.