WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   HereBeDragons libs usage help. (https://www.wowinterface.com/forums/showthread.php?t=57382)

gmarco 08-24-19 01:21 AM

HereBeDragons libs usage help.
 
Hi,

I am trying to implement a simple command to put a icon on a map to specific coordinate.

Lua Code:
  1. local ADDON = ...
  2.  
  3. -- some code
  4.  
  5. local hbd  = LibStub:GetLibrary("HereBeDragons-2.0")
  6. local hbdp = LibStub:GetLibrary("HereBeDragons-Pins-2.0")
  7.  
  8. -- some code
  9.  
  10. local point = CreateFrame("Frame", nil, UIParent)
  11. point:SetWidth(12)
  12. point:SetHeight(12)
  13. point:SetBackdrop({bgFile = "Interface\\Addons\\"..ADDON.."\\icon.tga"})
  14.  
  15. SLASH_GMSPEED1 = "/gmpoint"
  16. SlashCmdList["GMSPEED"] = function(args)
  17.     local x, y = strsplit(" ",SecureCmdOptionParse(args))
  18.     local mapid
  19.  
  20.     if WorldMapFrame:IsShown() then
  21.         mapid = WorldMapFrame:GetMapID()
  22.     else
  23.         mapid = C_Map.GetBestMapForUnit("player")
  24.     end
  25.    
  26.     -- x,y,mapid = hbd:GetPlayerZonePosition()
  27.    
  28.     print("DEBUG:" .. mapid .. ":" .. x .. ":" .. y)
  29.    
  30.     hbdp:RemoveAllMinimapIcons(ADDON)
  31.     hbdp:AddMinimapIconMap(ADDON, point, tonumber(mapid), tonumber(x)/100, tonumber(y)/100, true, true)
  32.  
  33.     hbdp:RemoveAllWorldMapIcons(ADDON)
  34.     hbdp:AddWorldMapIconMap(ADDON, point, tonumber(mapid), tonumber(x)/100, tonumber(y)/100, HBD_PINS_WORLDMAP_SHOW_PARENT )
  35. end

But it doesn't works as expected ...

Some iussue:

1) /gmpoint x y works (big word :) and puts the icon --> "point" on worldmap and minimap .... but

a) it seems to me the icon disappears as soon as I move
b) it is unable to works after the first use :(
c) is there a nice pin icon I can use in wow texture ?


Thanks for any helps.


All times are GMT -6. The time now is 08:36 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI