View Single Post
02-17-14, 07:00 AM   #4
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 793
*Edit*

I just edited my reply.

Here is what I found out, with Astrolabe this is a really easy thing to do, here is sample code:
Code:
local icon = CreateFrame("Frame")
icon:SetSize(1, 1)

local astrolabe = DongleStub("Astrolabe-1.0")

local function ApplyMinimapMath(x, y)
  local scale = Minimap:GetEffectiveScale()
  x = x/scale
  y = y/scale
  local cx, cy = Minimap:GetCenter()
  x = x - cx
  y = y - cy
  if sqrt(x*x + y*y) < (Minimap:GetWidth()/2) then
    return x, y
  end
end

local function PingLocation(mapID, level, x, y)
  if astrolabe:PlaceIconOnMinimap(icon, mapID, level, x, y) == 0 then
    local x, y = icon:GetCenter()
    local edge = astrolabe:IsIconOnEdge(icon)
    astrolabe:RemoveIconFromMinimap(icon)
    if not edge then
      x, y = ApplyMinimapMath(x, y)
      if x then
        Minimap:PingLocation(x, y)
      end
    end
  end
end

-- pings in the middle of your current map and level
PingLocation(GetCurrentMapAreaID(), GetCurrentMapDungeonLevel(), .5, .5)
You can find the latest version of Astrolabe and DongleStub at:
http://svn.esamynn.org/astrolabe/trunk/
__________________
Profile: Curse | Wowhead

Last edited by Vlad : 02-17-14 at 08:18 AM.
  Reply With Quote