Quantcast
WoWInterface - View Single Post - Error with hiding WorldMapFrame WorldQuests
View Single Post
08-12-18, 10:00 AM   #1
Xruptor
A Flamescale Wyrmkin
 
Xruptor's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 121
Error with hiding WorldMapFrame WorldQuests

So I'm trying to write code that will completely eliminate or at least hide the WorldQuests from the World Map. Just the world quests though nothing else. I believe there is a filter way of doing it but I haven't looked much into it.

Code:
hooksecurefunc (WorldMapFrame, "OnMapChanged", function()

	local mapID = WorldMapFrame.mapID

	for dataProvider, state in pairs (WorldMapFrame.dataProviders) do

		if mapID == dataProvider:GetMap():GetMapID() then
			local taskInfo = C_TaskQuest.GetQuestsForPlayerByMapID(mapID)
	
			if (taskInfo and #taskInfo > 0) then

				local questPins = {}
				
				for pin in dataProvider:GetMap():EnumerateAllPins() do
					if pin.questID then
						questPins[pin.questID] = pin
					end
				end
			
				for i, info  in ipairs (taskInfo) do
					local questID = info.questId
					if (HaveQuestData (questID)) then
						local isWorldQuest = QuestUtils_IsQuestWorldQuest (questID)
						if isWorldQuest and questPins[questID] and questPins[questID].worldQuest then
							dataProvider:GetMap():RemovePin(questPins[questID])
						end
					end
				end
				
			end
			
			break
		end
		
	end

end)
The code above is what I'm using but I keep getting an error with it. I've tried several methods but maybe someone here can see something I'm not seeing.

Code:
Date: 2018-08-12 11:57:33
ID: 1
Error occured in: Global
Count: 1
Message: ...ns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua line 244:
   attempt to index a nil value
Debug:
   ...ns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua:244: SetPosition()
   ...rd_SharedMapDataProviders\WorldQuestDataProvider.lua:217: RefreshAllData()
   ...dOns\Blizzard_WorldMap\WM_WorldQuestDataProvider.lua:26: RefreshAllData()
   ...ace\AddOns\Blizzard_MapCanvas\Blizzard_MapCanvas.lua:418: RefreshAllDataProviders()
   ...ace\AddOns\Blizzard_MapCanvas\Blizzard_MapCanvas.lua:446: RefreshAll()
   ...ace\AddOns\Blizzard_MapCanvas\Blizzard_MapCanvas.lua:59: OnShow()
   ...rface\AddOns\Blizzard_WorldMap\Blizzard_WorldMap.lua:231:
      ...rface\AddOns\Blizzard_WorldMap\Blizzard_WorldMap.lua:228
   [C]: Show()
   ..\FrameXML\UIParent.lua:2611: SetUIPanel()
   ..\FrameXML\UIParent.lua:2456: ShowUIPanel()
   ..\FrameXML\UIParent.lua:2317:
      ..\FrameXML\UIParent.lua:2313
   [C]: SetAttribute()
   ..\FrameXML\UIParent.lua:3138: ShowUIPanel()
   ..\FrameXML\QuestLogOwnerMixin.lua:103: SetDisplayState()
   ..\FrameXML\QuestLogOwnerMixin.lua:41: HandleUserActionToggleSelf()
   ...rface\AddOns\Blizzard_WorldMap\Blizzard_WorldMap.lua:405: ToggleWorldMap()
   [string "TOGGLEWORLDMAP"]:1:
      [string "TOGGLEWORLDMAP"]:1
Locals:
self = <unnamed> {
 0 = <userdata>
 Highlight = <unnamed> {
 }
 PanTo = <function> defined @Interface\AddOns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua:260
 BountyRing = <unnamed> {
 }
 worldQuest = true
 UseFrameLevelType = <function> defined @Interface\AddOns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua:365
 GetNudgeSourceZoomedInMagnitude = <function> defined @Interface\AddOns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua:175
 SetScaleStyle = <function> defined @Interface\AddOns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua:301
 GetNudgeSourcePinZoomedInNudgeFactor = <function> defined @Interface\AddOns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua:211
 UpdateTooltip = <function> defined @Interface\AddOns\Blizzard_SharedMapDataProviders\WorldQuestDataProvider.lua:400
 GetMap = <function> defined @Interface\AddOns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua:199
 ApplyFrameLevel = <function> defined @Interface\AddOns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua:374
 ApplyCurrentPosition = <function> defined @Interface\AddOns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua:336
 IsIgnoringGlobalPinScale = <function> defined @Interface\AddOns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua:287
 Glow = <unnamed> {
 }
 GetNudgeZoomFactor = <function> defined @Interface\AddOns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua:233
 OnMouseUp = <function> defined @Interface\AddOns\Blizzard_SharedMapDataProviders\WorldQuestDataProvider.lua:436
 OnAcquired = <function> defined @Interface\AddOns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua:110
 PanAndZoomTo = <function> defined @Interface\AddOns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua:265
 SelectedGlow = <unnamed> {
 }
 RefreshVisuals = <function> defined @Interface\AddOns\Blizzard_WorldMap\WM_WorldQuestDataProvider.lua:48
 ApplyCurrentAlpha = <function> defined @Interface\AddOns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua:357
 OnLoad = <function> defined @Interface\AddOns\Blizzard_WorldMap\WM_WorldQuestDataProvider.lua:42
 TrackedCheck = <unnamed> {
 }
 OnReleased = <function> defined @Interface\AddOns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua:114
 OnCanvasPanChanged = <function> defined @Interface\AddOns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua:275
 SetNudgeFactor = <function> defined @Interface\AddOns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua:228
 GetNudgeSourcePinZoomedOutNudgeFactor = <function> defined @Interface\AddOns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua:207
 startScale = 0.425
 OnClick = <function> defined @Interface\AddOns\Blizzard_SharedMapDataProviders\WorldQuestDataProvider.lua:408
 SetNudgeZoomedInFactor = <function> defined @Interface\AddOns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua:179
 GetNudgeSourceRadius = <function> defined @Interface\AddOns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua:162
 normalizedY = 0.72549211978912
 questID = 44744
 scaleFactor = 1
 Underlay = <unnamed> {
 }
 GetFrameLevelType = <function> defined @Interface\AddOns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua:370
 SetAlphaStyle = <function> defined @Interface\AddOns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua:326
 SetScalingLimits = <function> defined @Interface\AddOns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua:291
 worldQuestType = 2
 SetNudgeSourceRadius = <function> defined @Interface\AddOns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua:158
 OnMapInsetMouseLeave = <function> defined @Interface\AddOns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua:146
 GetNudgeTargetFactor = <function> defined @Interface\AddOns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua:154
 numObjectives = 1
 dataProvider = <table> {
 }
 endScale = 0.425
 normalizedX = 0.49518918991089
 SetAlphaLimits = <function> defined @Interface\AddOns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua:316
 SetNudgeSourceMagnitude = <function> defined @Interface\AddOns\Blizzard_MapCanvas\MapCanvas_DataProviderBase.lua:166
 OnCanvasScaleChanged = <function> defined @Interface\AddOns\Blizzard_
__________________
Click HERE for the ultimate idiot test.

if (sizeof(sadness) > sizeof(happiness)) { initDepression(); }
  Reply With Quote