View Single Post
06-14-18, 03:28 PM   #2
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
TomTom:AddZWaypoint(c, z, x, y, desc, persistent, minimap, world, callbacks, silent, crazy)

In the hopes of making the meaning of those parameters more obvious:

lua Code:
  1. -- TODO: Make this not suck
  2. function TomTom:AddWaypoint(x, y, desc, persistent, minimap, world, silent)
  3.     local c,z = GetCurrentMapContinent(), GetCurrentMapZone()
  4.  
  5.     if not c or not z or c < 1 then
  6.         --self:Print("Cannot find a valid zone to place the coordinates")
  7.         return
  8.     end
  9.  
  10.     return self:AddZWaypoint(c, z, x, y, desc, persistent, minimap, world, nil, silent)
  11. end
  12.  
  13. function TomTom:AddZWaypoint(c, z, x, y, desc, persistent, minimap, world, callbacks, silent, crazy)
  14.     -- Convert the c,z,x,y tuple to m,f,x,y and pass the work off to AddMFWaypoint()
  15.     local mapId, floor = hbd:GetMapIDFromCZ(c, z)
  16.     if not mapId then
  17.         return
  18.     end
  19.  
  20.     return self:AddMFWaypoint(mapId, floor, x/100, y/100, {
  21.         title = desc,
  22.         persistent = persistent,
  23.         minimap = minimap,
  24.         world = world,
  25.         callbacks = callbacks,
  26.         silent = silent,
  27.         crazy = crazy,
  28.     })
  29. end
  Reply With Quote