Quantcast
Download
(9 Kb)
Download
Updated: 11/18/19 02:12 PM
Compatibility:
Dragonhold (5.2.5)
Updated:11/18/19 02:12 PM
Created:06/04/14 06:19 PM
Monthly downloads:71,204
Total downloads:485,664
Favorites:506
MD5:
5.2.5
LibMapPins  Popular! (More than 5000 hits)
Version: 1.0 r18
by: Garkin, AssemblerManiac, Ayantir, Fyrakin, Sensi
LibMapPins-1.0 is a library for custom map pins.

How to install:
You may either embed the library in your addon and load the files from your addon manifest, or have the library installed like any other normal addon.

If you are depending on the library being installed separately and are not embedding it, then you must include this line in your addon manifest:
Code:
## DependsOn:  LibMapPins-1.0
Either way you choose, LibStub will ensure that only one copy of the library (the newest revision) is loaded into memory.

How to use:
Get a reference to the library from LibStub:
Lua Code:
  1. local lib = LibStub("LibMapPins-1.0")

Arguments used by most of the functions:
Code:
pinType:       either pinTypeId or pinTypeString, you can use both
pinTypeString: unique string name of your choice (it will be used as a name
               for global variable)
pinTypeId:     unique number code for your pin type, return value from lib:AddPinType
               ( local pinTypeId = _G[pinTypeString] )
pinLayoutData: table which can contain the following keys:
   level =     number > 2, pins with higher level are drawn on the top of pins
               with lower level.
               Examples: Points of interest 50, quests 110, group members 130,
               wayshrine 140, player 160.
   texture =   string or function(pin). Function can return just one texture
               or overlay, pulse and glow textures.
   size =      texture will be resized to size*size, if not specified size is 20.
   tint  =     ZO_ColorDef object or function(pin) which returns this object.
               If defined, color of background texture is set to this color.
   grayscale = true/false, could be function(pin). If defined and not false,
               background texure will be converted to grayscale (http://en.wikipedia.org/wiki/Colorfulness)
   insetX =    size of transparent texture border, used to handle mouse clicks
   insetY =    dtto
   minSize =   if not specified, default value is 18
   minAreaSize = used for area pins
   showsPinAndArea = true/false
   isAnimated = true/false
Add custom pin type (group of pins):
Lua Code:
  1. lib:AddPinType(pinTypeString, pinTypeAddCallback, pinTypeOnResizeCallback, pinLayoutData, pinTooltipCreator)
  2. -- returns: pinTypeId
  3. --
  4. -- pinTypeString: string
  5. -- pinTypeAddCallback: function(pinManager), will be called every time when map
  6. --                is changed. It should create pins on the current map using the
  7. --                lib:CreatePin(...) function.
  8. -- pinTypeOnResizeCallback: (nilable) function(pinManager, mapWidth, mapHeight),
  9. --                is called when map is resized (zoomed).
  10. -- pinLayoutData:  (nilable) table, details above
  11. -- pinTooltipCreator: (nilable) etiher string to display or table with the
  12. --                following keys:
  13. --    creator =   function(pin) that creates tooltip - or I should say function
  14. --                that will be called when mouse is over the pin, it does not
  15. --                need to create tooltip.
  16. --    tooltip =   (nilable) tooltip mode,  number between 1 and 4. It is
  17. --                defined in WorldMap.lua as follows:
  18. --                local TOOLTIP_MODE = {
  19. --                   INFORMATION = 1,
  20. --                   KEEP = 2,
  21. --                   MAP_LOCATION = 3,
  22. --                   IMPERIAL_CITY = 4,
  23. --                }
  24. --    hasTooltip = (optional), function(pin) which returns true/false to
  25. --                enable/disable tooltip.
  26. --    gamepadCategory = (nilable) string
  27. --    gamepadCategoryId = (nilable) number, right now it uses one of:
  28. --                local GAMEPAD_PIN_ORDERS = {
  29. --                   DESTINATIONS = 10,
  30. --                   AVA_KEEP = 20,
  31. --                   AVA_OUTPOST = 21,
  32. --                   AVA_RESOURCE = 22,
  33. --                   AVA_GATE = 23,
  34. --                   AVA_ARTIFACT = 24,
  35. --                   AVA_IMPERIAL_CITY = 25,
  36. --                   AVA_FORWARD_CAMP = 26,
  37. --                   CRAFTING = 30,
  38. --                   QUESTS = 40,
  39. --                   PLAYERS = 50,
  40. --                }
  41. --    gamepadCategoryIcon = (nilable) texture path
  42. --    gamepadEntryName = (nilable) string
  43. --    gamepadSpacing = (nilable) boolean

Create single pin on the current map, primary use is from pinTypeAddCallback:
Lua Code:
  1. lib:CreatePin(pinType, pinTag, locX, locY, areaRadius)
  2. -- pinType:       pinTypeId or pinTypeString
  3. -- pinTag:        can be anything, but I recommend using table or string with
  4. --                additional pin details. You can use it later in code.
  5. --                ( local pinTypeId, pinTag = pin:GetPinTypeAndTag() )
  6. --                Argument pinTag is used as an id for functions
  7. --                lib:RemoveCustomPin(...) and lib:FindCustomPin(...).
  8. -- locX, locY:    normalized position on the current map
  9. -- areaRadius:    (nilable)

Add filter checkboxes to the world map:
Lua Code:
  1. lib:AddPinFilter(pinType, pinCheckboxText, separate, savedVars, savedVarsPveKey, savedVarsPvpKey, savedVarsImperialPvpKey)
  2. -- Returns: pveCheckbox, pvpCheckbox
  3. -- (newly created checkbox controls for PvE and PvP context of the world map)
  4. --
  5. -- pinType:       pinTypeId or pinTypeString
  6. -- pinCheckboxText: (nilable), description displayed next to the checkbox, if nil
  7. --                pinCheckboxText = pinTypeString
  8. -- separate:      (nilable), if false or nil, checkboxes for PvE and PvP context
  9. --                will be linked together. If savedVars argument is nil, separate
  10. --                is ignored and checkboxes will be linked together.
  11. -- savedVars:     (nilable), table where you store filter settings
  12. -- savedVarsPveKey: (nilable), key in the savedVars table where you store filter
  13. --                state for PvE context. If savedVars table exists but this key
  14. --                is nil, state will be stored in savedVars[pinTypeString].
  15. -- savedVarsPvpKey: (nilable), key in the savedVars table where you store filter
  16. --                state for PvP context, used only if separate is true. If separate
  17. --                is true, savedVars exists but this argument is nil, state will
  18. --                be stored in savedVars[pinTypeString .. "_pvp"].
  19. -- savedVarsImperialPvpKey: (nilable), key in the savedVars table where you store
  20. --                filter state for Imperial City PvP context, used only if separate
  21. --                is true. If separate is true, savedVars exists but this argument
  22. --                is nil, state will be stored in savedVars[pinTypeString .. "_imperialPvP"].

Add click handlers for pins, if handler is nil, any existing handler will be removed.
Lua Code:
  1. lib:SetClickHandlers(pinType, LMB_handler, RMB_handler)
  2. -- pinType:       pinTypeId or pinTypeString
  3. -- LMB_handler:   hadler for left mouse button
  4. -- RMB_handler:   handler for right mouse button
  5. --
  6. -- handler = {
  7. --    {
  8. --       name = string or function(pin) end  --required
  9. --       callback = function(pin) end        --required
  10. --       show = function(pin) end, (optional) default is true. Callback function
  11. --                is called only when show returns true.
  12. --       duplicates = function(pin1, pin2) end, (optional) default is true.
  13. --                What happens when mouse lick hits more than one pin. If true,
  14. --                pins are considered to be duplicates and just one callback
  15. --                function is called.
  16. --       gamepadName = the same as name, but for gamepad
  17. --    },
  18. -- }
  19. -- One handler can have defined more actions, with different conditions in show
  20. -- function. First action with true result from show function will be used.
  21. -- handler = {
  22. --    {name = "name1", callback = callback1, show = show1},
  23. --    {name = "name2", callback = callback2, show = show2},
  24. --     ...
  25. -- }

Refresh pins. If pinType is nil, refreshes all custom pins:
Lua Code:
  1. lib:RefreshPins(pinType)
  2. -- pinType:       pinTypeId or pinTypeString

Check if pins are enabled:
Lua Code:
  1. lib:IsEnabled(pinType)
  2. -- returns: true/false
  3. --
  4. -- pinType:       pinTypeId or pinTypeString

Set enabled/disabled state of the given pinType and if exists, update filter checkbox on the world map:
Lua Code:
  1. lib:SetEnabled(pinType, state)
  2. -- pinType:       pinTypeId or pinTypeString
  3. -- state:         true/false, as false is considered nil, false or 0. All other
  4. --                values are true.

Enable pins of the given pinType:
Lua Code:
  1. lib:Enable(pinType)
  2. -- pinType:       pinTypeId or pinTypeString

Disable pins of the given pinType:
Lua Code:
  1. lib:Disable(pinType)
  2. -- pinType:       pinTypeId or pinTypeString

Find custom pin:
Lua Code:
  1. lib:FindCustomPin(pinType, pinTag)
  2. -- returns pin
  3. --
  4. -- pinType:       pinTypeId or pinTypeString
  5. -- pinTag:        id assigned to the pin by function lib:CreatePin(...)

Remove custom pin. If pinTag is nil, all pins of the given pinType are removed.
Lua Code:
  1. lib:RemoveCustomPin(pinType, pinTag)
  2. -- pinType:       pinTypeId or pinTypeString
  3. -- pinTag:        id assigned to the pin by function lib:CreatePin(...)


Change a single key in the pinLayoutData table:
Lua Code:
  1. lib:SetLayoutKey(pinType, key, data)
  2. -- pinType:       pinTypeId or pinTypeString
  3. -- key:           key name in pinLayoutData table
  4. -- data:          data to be stored in pinLayoutData[key]

Replace whole pinLayoutData table:
Lua Code:
  1. lib:SetLayoutData(pinType, pinLayoutData)
  2. -- pinType:       pinTypeId or pinTypeString
  3. -- pinLayoutData: table

Get a single key from the pinLayoutData table:
Lua Code:
  1. lib:GetLayoutKey(pinType, key)
  2. -- returns: pinLayoutData[key]
  3. --
  4. -- pinType:       pinTypeId or pinTypeString
  5. -- key:           key name in pinLayoutData table

Get a reference to the pinLayoutData table:
Lua Code:
  1. lib:GetLayoutData(pinType)
  2. -- returns: pinLayoutData
  3. --
  4. -- pinType:       pinTypeId or pinTypeString

Set new add callback:
Lua Code:
  1. lib:SetAddCallback(pinType, pinTypeAddCallback)
  2. -- pinType:       pinTypeId or pinTypeString
  3. -- pinTypeAddCallback: function(pinManager)

Set new OnResize callback:
Lua Code:
  1. lib:SetResizeCallback(pinType, pinTypeOnResizeCallback)
  2. -- pinType:       pinTypeId or pinTypeString
  3. -- pinTypeOnResizeCallback: function(pinManager, mapWidth, mapHeight)

Get zone and subzone derived from map texture:
Lua Code:
  1. lib:GetZoneAndSubzone(alternativeFormat)
  2. -- You can select from 2 formats:
  3. -- 1: "zone", "subzone"    (that's what I use in my addons)
  4. -- 2: "zone/subzone"       (this format is used by HarvestMap)
  5. -- If argument is nil or false, function returns first format

Example:
Example of code is attached to the end of LibMapPins-1.0.lua or check code of SkyShards or LoreBooks.
r18 (AM)
- removed libstub requirement (works with and without)
- added /lmppos and /lmploc
- added /mypos & /myloc if /mypos not defined
- changed /mypos to use 0.nnn decimal location co-ordinate system instead of nn.nnn

r17 (modified by Sensi)
- Removed AUI support. (It is no longer needed)

r16 (modified by Ayantir)
- Fixed tiny typo

r15 (modified by Ayantir)
- Added Battleground compatibility

r14 (modified by Sensi)
- fixed a memory leak in combination with AUI Minimap

r13 (modified by Sensi)
- updated for API to 100013 (Update 8 - Orsinium)
- add compatibility for "AUI Minimap" version 1.2
- the function "CreatePin" is only redirected when associated pin type is enabled

r12 (modified by Sensi)
- incorrect upload, do not use this version.

r11
- fixed compatibility issue with new version of AUI

r10
- updated for API to 100012 (Update 7 - Imperial City)
- updated LibStub to r4

r9
- another improvements for AUI compatibility (tanks for the code, Sensi)

r8
- fixed compatibility issue with AUI

r7
- updated for API to 100011 (Update 6)
- key "tooltip" in tooltip layout should now contain index number instead of tooltip control - Usually you will want to use number 1 for InformationTooltip.
- pinLayouData no longer supports key "color", it was replaced by "tint". Color was simple table with r,g,b,a values, tint is ZO_ColorDef object.

r6
- added scrollbox for world map filters

r5
- updated EMM minimap support for the latest beta EMM 0.9.9.3e

r4
- updated API version
- added support for beta version of EMM minimap (tested with EMM 0.9.9.3d)

r3
- updated API version
- updated LibStub to r2
- added ZOS disclosure

r2
- fixed bug in function lib:AddPinType()
- fixed a few typos in comments and in the sample code

r1
- initial release
Archived Files (18)
File Name
Version
Size
Uploader
Date
1.0 r17
10kB
Sensi
06/10/17 09:14 PM
1.0 r17
10kB
Sensi
06/10/17 09:05 PM
1.0 r16
9kB
Ayantir
06/10/17 05:40 AM
1.0 r15
9kB
Ayantir
05/26/17 07:43 PM
1.0 r14
10kB
Sensi
01/29/16 08:09 AM
1.0 r13
10kB
Sensi
01/27/16 12:57 PM
1.0 r12
10kB
Sensi
01/26/16 03:41 PM
1.0 r11
10kB
Garkin
09/15/15 06:53 AM
1.0 r10
10kB
Garkin
08/31/15 09:00 AM
1.0 r9
10kB
Garkin
03/07/15 04:17 PM
1.0 r8
10kB
Garkin
03/05/15 11:45 AM
1.0 r7
10kB
Garkin
02/23/15 09:09 PM
1.0 r6
10kB
Garkin
10/31/14 10:34 AM
1.0 r5
9kB
Garkin
09/16/14 09:03 AM
1.0 r4
9kB
Garkin
09/16/14 08:24 AM
1.0 r3
8kB
Garkin
07/31/14 10:04 AM
1.0 r2
8kB
Garkin
06/13/14 06:04 PM
1.0 r1
8kB
Garkin
06/09/14 09:51 AM


Post A Reply Comment Options
Unread 09/25/19, 10:43 AM  
Marazota

Forum posts: 145
File comments: 1123
Uploads: 0
## IsLibrary: true
need to be added to the manifest of this one
Report comment to moderator  
Reply With Quote
Unread 07/18/19, 10:57 AM  
Rajhin

Forum posts: 0
File comments: 1
Uploads: 0
For some reason it's just missing from the list, even though Skyshards addon thinks it's installed, until you log in and skyshards breaks.
Am I installing it wrong?
Last edited by Rajhin : 07/18/19 at 11:00 AM.
Report comment to moderator  
Reply With Quote
Unread 06/05/19, 04:24 PM  
Vampyra

Forum posts: 0
File comments: 1
Uploads: 0
Re: Re: Is this even current?

Originally Posted by Kyoma
Originally Posted by TehChad1988
Minion won't update this file in game it says out of date. There's nothing in the thread indicating an update
It is, the game saying it is out of date is because it is comparing some number in the addon against some number ingame and has no bearing on the actual functionality of said addon. Use the "Allow out-of-date" checkbox.
Well, then update that number and make a release.

That way we know authors are aware of API changes and verified the addon is still working properly and not an abandon project...

Indeed that is the specific purpose of that number in that text file.

Also it is missing the "## IsLibrary: true" line from the new api

So yes, this addon is not up to date, despite its working or not.

Specially when the ## APIVersion: is 100019 and we are on currently on 100027

Also, do you realize the ridiculous of your post saying the addon is up to date, but to work you need to check the allow out of date option...?

Last update is from 06/11/17 so yes, the addon is ****ing out of date.
Report comment to moderator  
Reply With Quote
Unread 05/30/19, 07:29 PM  
DeathStalker

Forum posts: 0
File comments: 20
Uploads: 0
No, the Add-On detail INSIDE the game indicate this Lib in RED as Dependencies to several Add-Ons. As such, it will not allow those other add-ons to function.
Report comment to moderator  
Reply With Quote
Unread 05/28/19, 10:05 AM  
Kyoma
AddOn Author - Click to view AddOns

Forum posts: 96
File comments: 243
Uploads: 10
Re: Is this even current?

Originally Posted by TehChad1988
Minion won't update this file in game it says out of date. There's nothing in the thread indicating an update
It is, the game saying it is out of date is because it is comparing some number in the addon against some number ingame and has no bearing on the actual functionality of said addon. Use the "Allow out-of-date" checkbox.
Report comment to moderator  
Reply With Quote
Unread 05/28/19, 09:30 AM  
TehChad1988

Forum posts: 0
File comments: 5
Uploads: 0
Is this even current?

Minion won't update this file in game it says out of date. There's nothing in the thread indicating an update
Report comment to moderator  
Reply With Quote
Unread 05/25/19, 06:41 AM  
AssemblerManiac
AddOn Author - Click to view AddOns

Forum posts: 50
File comments: 295
Uploads: 1
Re: Could someone explain what an add on manifest is?

Originally Posted by SpaceLoaf
I can't find mine, and have no idea where or what it is. How do I acquire an addon manifest and where do I put it?
Look in the directory of any addon, it's the .txt file with the same name as the directory it's in.
Report comment to moderator  
Reply With Quote
Unread 05/24/19, 02:48 PM  
SpaceLoaf

Forum posts: 0
File comments: 5
Uploads: 0
Could someone explain what an add on manifest is?

I can't find mine, and have no idea where or what it is. How do I acquire an addon manifest and where do I put it?
Report comment to moderator  
Reply With Quote
Unread 06/10/17, 05:40 AM  
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1022
File comments: 1559
Uploads: 31
Re: word mistyped ? (meant WORD not world in my title)

Originally Posted by Anceane
WORLD_MAP_FILTERS.imeperialPvPPanel.comboBoxPool.parent

may be a imperial ?

Not sur but seems you corrected the world but left at the same time another *e*

If normal then dont mind me
Ups.
__________________
Obsessive Compulsive Coder

My little french Guild: Cercle de l'Eveil
Report comment to moderator  
Reply With Quote
Unread 05/27/17, 06:04 AM  
Anceane
 
Anceane's Avatar

Forum posts: 251
File comments: 798
Uploads: 0
word mistyped ? (meant WORD not world in my title)

WORLD_MAP_FILTERS.imeperialPvPPanel.comboBoxPool.parent

may be a imperial ?

Not sur but seems you corrected the world but left at the same time another *e*

If normal then dont mind me
__________________
Last edited by Anceane : 05/27/17 at 06:14 AM.
Report comment to moderator  
Reply With Quote
Unread 05/29/16, 01:41 AM  
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1022
File comments: 1559
Uploads: 31
I'll have a look, Sensi looks away.
But I'm clearly not fan at all of all the AUI things in LibMapPin.

For me, it's AUI's job to be compliant with a library, not a library which need to be compliant with an addon.
That's how code works.

So I'll wait first to see if AUI will be updated for DB (because Sensi is also AUI author).
__________________
Obsessive Compulsive Coder

My little french Guild: Cercle de l'Eveil
Last edited by Ayantir : 05/29/16 at 01:41 AM.
Report comment to moderator  
Reply With Quote
Unread 05/22/16, 10:24 AM  
Shinni
AddOn Author - Click to view AddOns

Forum posts: 144
File comments: 475
Uploads: 21
When i try to delete a single pin via lib:RemoveCustomPin(pinType, pinTag) it deletes all pins of the given type on the AUI minimap.
This should be fixable by calling AUI.Minimap.Pin.RemovePins instead of AUI.Minimap.Pin.RemoveCustomPinsByType in line 489.
Report comment to moderator  
Reply With Quote
Unread 02/10/16, 07:36 AM  
Kyoma
AddOn Author - Click to view AddOns

Forum posts: 96
File comments: 243
Uploads: 10
I have a question/request. Is it possible to display the filter checkbox only when in pvp and/or imperial city? Looking at the code it seems it always creates the checkboxes for pve/pvp/imperialPvp. Should I just hide them manually?
Report comment to moderator  
Reply With Quote
Unread 10/31/15, 09:57 AM  
CaptainBlagbird
 
CaptainBlagbird's Avatar
AddOn Author - Click to view AddOns

Forum posts: 53
File comments: 171
Uploads: 23
Pins not resetting

I have the same problem, often the pins aren't reset (e.g. when moving in a new map).

Here's an example:

dungeon map

zone map

world map

I've also seen it happen for Skyshards, and probably happens for other add-ons too. I don't know since when that happens (probably since a library update). The currently loaded version is 1.0r11.

I haven't seen it happen for my add-on Quest Map yet. I had to use this code since r11, which might or might not be related:

diff Code:
  1. -- This code is inside of the pinTypeAddCallback function
  2. +if LMP:IsEnabled(MY_CUSTOM_PIN_TYPE) then
  3.     LMP:CreatePin(MY_CUSTOM_PIN_TYPE, pinInfo, x, y)
  4. +end
__________________
My Addons: Quest Map, Helmet Toggle, Sieged Keeps, Target Whisper, ... | Also available on GitHub
Last edited by CaptainBlagbird : 10/31/15 at 10:00 AM.
Report comment to moderator  
Reply With Quote
Unread 10/13/15, 10:20 PM  
Fyrakin
 
Fyrakin's Avatar
AddOn Author - Click to view AddOns

Forum posts: 129
File comments: 820
Uploads: 6
There is some sort of an issue with map being out of sync with an actual place your character is. This results in custom pins being dropped for the wrong map. I am investigating for the possible solution.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: