Download
(11 Kb)
Download
Updated: 11/01/21 09:46 AM
Compatibility:
Deadlands (7.2.5)
Updated:11/01/21 09:46 AM
Created:02/20/16 11:34 AM
Monthly downloads:31,437
Total downloads:2,228,310
Favorites:1,533
MD5:
LibMapPing  Popular! (More than 5000 hits)
Version: 2.0.0
by: sirinsidiator, votan
This library is an abstraction for the different types of player set pings on the map. Not to be confused with LibMapPins which handles creation of custom map markers.
The main features include:
  • a unified way to manipulate pings and to react to the ensuing map ping events,
  • suppression of pings so that their information can only be accessed via the library,
  • silent placement of pings,
  • watch dog that fires the callbacks if an event does not get fired by the API due to a bug.

Dependencies
Make sure to install the following required libraries in order to use LibMapPing.
API Reference

MapPingState
MapPingState is an enumeration of the possible states of a map ping.
lib.MAP_PING_NOT_SET: There is no ping.
lib.MAP_PING_NOT_SET_PENDING: The ping has been removed, but EVENT_MAP_PING has not been processed.
lib.MAP_PING_SET_PENDING: A ping was added, but EVENT_MAP_PING has not been processed.
lib.MAP_PING_SET: There is a ping.

SetMapPing
Wrapper for PingMap and SetPlayerWaypointByWorldLocation.
pingType is one of the three possible MapDisplayPinType for map pings (MAP_PIN_TYPE_PLAYER_WAYPOINT, MAP_PIN_TYPE_PING or MAP_PIN_TYPE_RALLY_POINT) or false.
when pingType is set to false, the function calls SetPlayerWaypointByWorldLocation and the arguments will be the worldX, worldY and worldZ and the return a boolean success
for all other pingTypes nothing is returned and the arguments are as follows:
mapType is usually MAP_TYPE_LOCATION_CENTERED.
x and y are the normalized coordinates on the current map.
Code:
lib:SetMapPing(MapDisplayPinType pingType, MapDisplayType|number mapTypeOrWorldX, number xOrWorldY, number yOrWorldZ)
RemoveMapPing
Wrapper for the different ping removal functions.
For waypoints and rally points it calls their respective removal function.
For group pings it just sets the position to 0, 0 as there is no function to clear them.
Code:
lib:RemoveMapPing(MapDisplayPinType pingType)
GetMapPing
Wrapper for the different get ping functions. Returns coordinates regardless of their suppression state.
The game API functions return 0, 0 when the ping type is suppressed.
pingType is the same as for SetMapPing.
pingTag is optionally used if another group member's MAP_PIN_TYPE_PING should be returned (possible values: group1 .. group24).
Code:
number x, number y = lib:GetMapPing(MapDisplayPinType pingType[, string pingTag])
GetMapPingState
Returns the MapPingState for the pingType and pingTag.
Code:
MapPingState state = lib:GetMapPingState(MapDisplayPinType pingType[, string pingTag])
HasMapPing
Returns true if ping state is lib.MAP_PING_SET_PENDING or lib.MAP_PING_SET.
Code:
boolean hasPing = lib:HasMapPing(MapDisplayPinType pingType[, string pingTag])
RefreshMapPin
Refreshes the pin icon for the pingType on the worldmap.
Returns true if the pin has been refreshed.
Code:
boolean wasRefreshed = lib:RefreshMapPin(MapDisplayPinType pingType[, string pingTag])
IsPositionOnMap
Returns true if the normalized position is within 0 and 1.
Code:
boolean isInside = lib:IsPositionOnMap(number x, number y)
MutePing
Mutes the map ping of the specified type, so it does not make a sound when it is set.
Do not forget to call UnmutePing later, otherwise the sound will be permanently muted!
Code:
lib:MutePing(MapDisplayPinType pingType[, string pingTag])
UnmutePing
Unmutes the map ping of the specified type.
Do not call this more often than you called MutePing, or you might interfere with other addons.
The sounds are played between the BeforePing* and AfterPing* callbacks are fired.
Code:
lib:UnmutePing(MapDisplayPinType pingType[, string pingTag])
IsPingMuted
Returns true if the map ping has been muted.
Code:
boolean isMuted = lib:IsPingMuted(MapDisplayPinType pingType[, string pingTag])
SuppressPing
Suppresses the map ping of the specified type, so that it neither makes a sound nor shows up on the map.
This also makes the API functions return 0, 0 for that ping.
In order to access the actual coordinates lib:GetMapPing has to be used.
Do not forget to call UnsuppressPing later, otherwise map pings won't work anymore for the user and other addons!
Code:
lib:SuppressPing(MapDisplayPinType pingType[, string pingTag])
UnsuppressPing
Unsuppresses the map ping so it shows up again.
Do not call this more often than you called SuppressPing, or you might interfere with other addons.
Code:
lib:UnsuppressPing(MapDisplayPinType pingType[, string pingTag])
IsPingSuppressed
Returns true if the map ping has been suppressed.
Code:
boolean isSuppressed = lib:IsPingSuppressed(MapDisplayPinType pingType[, string pingTag])
RegisterCallback
Register to callbacks from the library.
Valid events are BeforePingAdded, AfterPingAdded, BeforePingRemoved and AfterPingRemoved.
These are fired at certain points during handling EVENT_MAP_PING.
Code:
lib:RegisterCallback(string eventName, function callback)
UnregisterCallback
Unregister from callbacks. See lib:RegisterCallback.
Code:
lib:UnregisterCallback(string eventName, function callback)
BeforePingAdded
This callback is fired in EVENT_MAP_PING before the map ping is processed.
Code:
BeforePingAdded(MapDisplayPinType pingType, string pingTag, number x, number y, boolean isPingOwner)
AfterPingAdded
This callback is fired in EVENT_MAP_PING after the map ping has been processed.
Code:
AfterPingAdded(MapDisplayPinType pingType, string pingTag, number x, number y, boolean isPingOwner)
BeforePingRemoved
This callback is fired in EVENT_MAP_PING before the map ping is processed.
Code:
BeforePingRemoved(MapDisplayPinType pingType, string pingTag, number x, number y, boolean isPingOwner)
AfterPingRemoved
This callback is fired in EVENT_MAP_PING after the map ping has been processed.
Code:
AfterPingRemoved(MapDisplayPinType pingType, string pingTag, number x, number y, boolean isPingOwner)
version 2.0.0 - sirinsidiator
  • added support for SetPlayerWaypointByWorldLocation
  • updated to latest library standards and semantic versioning
  • made LibDebugLogger a required dependency
  • updated for Deadlands

version 1.0 r12 - sirinsidiator
  • fixed errors when either LibStub or LibDebugLogger is not loaded

version 1.0 r11 - sirinsidiator
  • fixed error when LibStub is loaded

version 1.0 r10 - sirinsidiator
  • switched to LibDebugLogger for debug output
  • removed LibStub and made its usage optional
  • updated API version in manifest

version 1.0 r9 - votan
  • Update to API 100027 "Elsweyr".

version 1.0 r8 - sirinsidiator
  • removed debug output (thanks Sordrak)

version 1.0 r7 - sirinsidiator
  • added protection to drop group pings that would cause a player to get kicked (only relevant when you use LibGroupSocket with many addons that send data)
  • updated API version in manifest

version 1.0 r6 - votan
  • Fixed map ping events can cause wrong waypoint/rally pins in combination with addons changing the current map
  • updated API version in manifest

version 1.0 r5 - sirinsidiator
  • fixed an issue where the initial state of the player waypoint is discarded on ui load in combination with LibGPS
  • updated API version in manifest

version 1.0 r4 - sirinsidiator
  • fixed an error when trying to set a group ping while not in a group
  • added watchdog that fires the callbacks and resets mute and suppress counts when the EVENT_MAP_PING does not get fired by the API in response to a waypoint being set by the player
Optional Files (0)


Archived Files (10)
File Name
Version
Size
Uploader
Date
1.0 r12
8kB
sirinsidiator
02/27/20 01:50 PM
1.0 r11
8kB
sirinsidiator
02/26/20 04:13 PM
10
8kB
sirinsidiator
02/26/20 03:20 PM
9
9kB
sirinsidiator
05/15/19 01:13 PM
r8
17kB
sirinsidiator
07/03/18 06:54 AM
r7
9kB
sirinsidiator
06/24/18 03:29 AM
r6
9kB
sirinsidiator
11/11/17 07:54 AM
r5
9kB
sirinsidiator
07/14/16 02:45 PM
r4
8kB
sirinsidiator
03/19/16 08:59 AM
r3
8kB
sirinsidiator
02/20/16 11:34 AM


Post A Reply Comment Options
Unread 02/27/20, 08:03 AM  
Baertram
Super Moderator
 
Baertram's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 4989
File comments: 6040
Uploads: 78
The new version of LibMapPing (r11) is throwing this error when you do not have LibDebugLogger installed. Either you install that, or you use LibMapPing r9 for the time being.
Report comment to moderator  
Reply With Quote
Unread 02/27/20, 07:42 AM  
yRaven

Forum posts: 0
File comments: 3
Uploads: 0
New version is bugged

2 LUA error in the new version, if you guys wanna a fix just ''un-update'' to version 10
Last edited by yRaven : 02/27/20 at 07:43 AM.
Report comment to moderator  
Reply With Quote
Unread 02/27/20, 07:27 AM  
smoothjoe

Forum posts: 0
File comments: 1
Uploads: 0
worked before i updated it now it just is a error
Report comment to moderator  
Reply With Quote
Unread 02/27/20, 01:39 AM  
andy.s
AddOn Author - Click to view AddOns

Forum posts: 40
File comments: 86
Uploads: 10
LibDebugLogger dependency

LibDebugLogger and LibStub are optional dependencies in the manifest file, but the lib doesn't work without both of them (throws nil errors).
Report comment to moderator  
Reply With Quote
Unread 02/27/20, 12:47 AM  
Kr4ftw3rk

Forum posts: 0
File comments: 12
Uploads: 0
A Slew of Error Popups

Had the same errors as the previous posters - but also included problems with:

LIbMapPing
LibGroupSocket
Raidnotifier
LibAsync
VotansMiniMap
HodorReflexes
LibGPS
LibAddonMenu
LibCombat
LibHarvensAddonSettings


I installed LibDebugLogger as mentioned (didn't know I needed it) and that cleared everything up for me. Thnx....
Last edited by Kr4ftw3rk : 02/27/20 at 12:51 AM.
Report comment to moderator  
Reply With Quote
Unread 02/26/20, 11:57 PM  
LarsS

Forum posts: 0
File comments: 20
Uploads: 0
dont work for me after update. Worked Before.
Report comment to moderator  
Reply With Quote
Unread 02/26/20, 08:47 PM  
khaoticfury

Forum posts: 0
File comments: 1
Uploads: 0
Fixed yet?

Has there been a fix yet? Latest update broke things.
Report comment to moderator  
Reply With Quote
Unread 02/26/20, 07:05 PM  
Micke2nd
AddOn Author - Click to view AddOns

Forum posts: 43
File comments: 76
Uploads: 1
Originally Posted by sirinsidiator
LibDebugLogger should actually be specified as a required dependency the way it works right now. The error should go away when you install it.
In my case it looks like too, if exceptions are triggered by LibMapPing.
Installed LibDebugLogger - and yes exceptions are gone. But doesnt this only say exceptions are catched, but not gone ?
Last edited by Micke2nd : 02/27/20 at 02:17 AM.
Report comment to moderator  
Reply With Quote
Unread 02/26/20, 06:35 PM  
Snaketzu

Forum posts: 0
File comments: 9
Uploads: 0
Broken

When I ran Minion today I had several addons update. When I logged in I had a mess with neverending errors. Most of them referenced LibMapPing.
After spending quite a while trying to turn addons on and off to find the problem, I finally removed the entire contents of my addons folder to a backup location. Client worked fine.
I then put NOTHING but LibMapPing in my addons folder. Error on login, reads:

user:/AddOns/LibMapPing/LibMapPing.lua:130: attempt to index a nil value
stack traceback:
user:/AddOns/LibMapPing/LibMapPing.lua:130: in function '(main chunk)'

Details:
Bad argument #2 to `NewLibrary' (string expected)
stack traceback:
[C]: in function 'assert'
user:/AddOns/LibStub/LibStub/LibStub.lua:73: in function 'LibStub:NewLibrary'
|caaaaaa<Locals> self = [table:1]{SILENT = T, minor = 7}, minor = 10 </Locals>|r
user:/AddOns/LibMapPing/LibMapPing.lua:2: in function '(main chunk)'
|caaaaaa<Locals> LIB_IDENTIFIER = "LibMapPing" </Locals>|r

Reading the comments below, I added LibDebugLogger to my addons folder. These are now the only two files in my addons folder. I still receive the error on login. I am still unable to use any addon that uses LibMapPing as a dependency, as it results in never-ending errors that eventually lock up the client.
*Edit* Reading the error I thought maybe it needed LibStub to work, so I added that to the Addons folder. No change.
Last edited by Snaketzu : 02/26/20 at 06:51 PM.
Report comment to moderator  
Reply With Quote
Unread 02/26/20, 05:54 PM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1578
File comments: 1131
Uploads: 41
Originally Posted by RinFox
After applying the r11 update I still get this error:

user:/AddOns/LibMapPing/LibMapPing.lua:8: attempt to index a nil value
stack traceback:
user:/AddOns/LibMapPing/LibMapPing.lua:8: in function '(main chunk)'
|caaaaaa<Locals> LIB_IDENTIFIER = "LibMapPing", lib = [table:1]{} </Locals>|r
Good catch. LibDebugLogger should actually be specified as a required dependency the way it works right now. The error should go away when you install it.
Report comment to moderator  
Reply With Quote
Unread 02/26/20, 05:21 PM  
RinFox

Forum posts: 0
File comments: 1
Uploads: 0
After applying the r11 update I still get this error:

user:/AddOns/LibMapPing/LibMapPing.lua:8: attempt to index a nil value
stack traceback:
user:/AddOns/LibMapPing/LibMapPing.lua:8: in function '(main chunk)'
|caaaaaa<Locals> LIB_IDENTIFIER = "LibMapPing", lib = [table:1]{} </Locals>|r
Last edited by RinFox : 02/26/20 at 05:22 PM.
Report comment to moderator  
Reply With Quote
Unread 02/26/20, 05:16 PM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1578
File comments: 1131
Uploads: 41
Originally Posted by wambo
Can confirm, with the latest update I got a ****ton of addons giving me bugs (harvestmap, raidnotifier, hodors ... )
Reverting back to version before fixxed it
r10 was broken. Make sure you install r11.
Report comment to moderator  
Reply With Quote
Unread 02/26/20, 05:05 PM  
wambo
AddOn Author - Click to view AddOns

Forum posts: 38
File comments: 457
Uploads: 3
Can confirm, with the latest update I got a ****ton of addons giving me bugs (harvestmap, raidnotifier, hodors ... )
Reverting back to version before fixxed it
Last edited by wambo : 02/26/20 at 05:09 PM.
Report comment to moderator  
Reply With Quote
Unread 02/26/20, 04:45 PM  
Tsavi

Forum posts: 0
File comments: 8
Uploads: 0
Updated and got this even after you posted the fix.

Code:
Bad argument #2 to `NewLibrary' (string expected)
stack traceback:
[C]: in function 'assert'
user:/AddOns/LibStub/LibStub/LibStub.lua:73: in function 'LibStub:NewLibrary'
user:/AddOns/LibMapPing/LibMapPing.lua:2: in function '(main chunk)'
Edit: Woops I guess it did not register the fix.
Last edited by Tsavi : 02/26/20 at 04:52 PM.
Report comment to moderator  
Reply With Quote
Unread 02/26/20, 04:23 PM  
fruitykiting

Forum posts: 0
File comments: 2
Uploads: 0
Originally Posted by sirinsidiator
Originally Posted by fruitykiting
Hi, I get this error when using the lib:

Bad argument #2 to `NewLibrary' (string expected)
stack traceback:
[C]: in function 'assert'
user:/AddOns/LibAddonMenu-2.0/LibStub/LibStub.lua:16: in function 'LibStub:NewLibrary'
user:/AddOns/LibMapPing/LibMapPing.lua:2: in function '(main chunk)'

I have installed the most recent version (10) and do not have LibStub installed. Even when having it installed, the error persists.
I just uploaded a new version a minute ago, which should fix that.
Can confirm, it is fixed. Thanks
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump:

Support AddOn Development!

You have just downloaded by the author . If you like this AddOn why not consider supporting the author? This author has set up a donation account. Donations ensure that authors can continue to develop useful tools for everyone.