Quantcast Map POI Tracking - WoWInterface
 
Thread Tools Display Modes
06-25-15, 10:58 AM   #1
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Map POI Tracking

I have create a small hook, to hide the stuck Draenor treasures from the world map:

Lua Code:
  1. hooksecurefunc("WorldMapFrame_Update", function(self)
  2.     for i = 1, GetNumMapLandmarks() do
  3.         local poi = _G["WorldMapFramePOI"..i]
  4.         local poiTexture = _G["WorldMapFramePOI"..i.."Texture"]
  5.         if poi and poiTexture then
  6.             local ULx, ULy, LLx, LLy, URx, URy, LRx, LRy = poiTexture:GetTexCoord()
  7.             if ULx == 0.07421875 and ULy == 0.494140625 and LLx == 0.07421875 and LLy == 0.52734375 and URx == 0.140625 and URy == 0.494140625 and LRx == 0.140625 and LRy == 0.52734375 then
  8.                 poi:Hide()
  9.             end
  10.         end
  11.     end
  12. end)

Is it possible to add this function to the World Map Frame's Tracking dropdown as "Show Trasures" as a toggle?
  Reply With Quote
06-25-15, 11:15 AM   #2
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,107
Originally Posted by Resike View Post
Is it possible to add this function to the World Map Frame's Tracking dropdown as "Show Trasures" as a toggle?
Not sure about your question, but probably. I'm not actively playing WoW to test code.

However, I see an unnecessary global lookup, where you already have a local to do the job:
Lua Code:
  1. local poi = _G["WorldMapFramePOI"..i]
  2. local poiTexture = _G["WorldMapFramePOI"..i.."Texture"] -- right here
Replace with:
Lua Code:
  1. local poi = _G["WorldMapFramePOI"..i]
  2. local poiTexture = poi.."Texture"
Unless for some reason the texture lookup won't work in that manner?
  Reply With Quote
06-25-15, 11:50 AM   #3
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Originally Posted by myrroddin View Post
Not sure about your question, but probably. I'm not actively playing WoW to test code.

However, I see an unnecessary global lookup, where you already have a local to do the job:
Lua Code:
  1. local poi = _G["WorldMapFramePOI"..i]
  2. local poiTexture = _G["WorldMapFramePOI"..i.."Texture"] -- right here
Replace with:
Lua Code:
  1. local poi = _G["WorldMapFramePOI"..i]
  2. local poiTexture = poi.."Texture"
Unless for some reason the texture lookup won't work in that manner?
It would probably work, but it's even better just to remove/ignore the poi frame.
  Reply With Quote
06-25-15, 12:31 PM   #4
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,059
_G["WorldMapFramePOI"..i] is a reference to a frame, you can't concatenate a string onto that.

I would be very surprised if your condition comparing texture coordinates to floats actually worked because of the way lua tends to round numbers.

Also, I suspect attempting to add anything to any Blizzard dropdown menu is just going to break something unrelated with taint since it recycles those dropdown menus for secure functions.
  Reply With Quote
06-25-15, 12:52 PM   #5
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Originally Posted by semlar View Post
_G["WorldMapFramePOI"..i] is a reference to a frame, you can't concatenate a string onto that.

I would be very surprised if your condition comparing texture coordinates to floats actually worked because of the way lua tends to round numbers.

Also, I suspect attempting to add anything to any Blizzard dropdown menu is just going to break something unrelated with taint since it recycles those dropdown menus for secure functions.
I was about to cut the numbers, but it's not needed works fine.
  Reply With Quote
06-25-15, 12:28 PM   #6
Choonstertwo
A Chromatic Dragonspawn
 
Choonstertwo's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2011
Posts: 194
Originally Posted by myrroddin View Post
Not sure about your question, but probably. I'm not actively playing WoW to test code.

However, I see an unnecessary global lookup, where you already have a local to do the job:
Lua Code:
  1. local poi = _G["WorldMapFramePOI"..i]
  2. local poiTexture = _G["WorldMapFramePOI"..i.."Texture"] -- right here
Replace with:
Lua Code:
  1. local poi = _G["WorldMapFramePOI"..i]
  2. local poiTexture = poi.."Texture"
Unless for some reason the texture lookup won't work in that manner?
Resike's code is getting the WorldMapFramePOI1 and WorldMapFramePOI1Texture objects, your code is getting the WorldMapFramePOI1 object and then attempting to concatenate that with the "Texture" string (which won't work).
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Map POI Tracking

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off