Quantcast
Download
(9 Kb)
Download
Updated: 07/03/18 06:54 AM
Compatibility:
Summerset (4.0)
Updated:07/03/18 06:54 AM
Created:02/20/16 11:34 AM
Monthly downloads:889
Total downloads:7,196
Favorites:11
MD5:
LibMapPing  Popular! (More than 5000 hits)
Version: r8
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.

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.
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).
mapType is usually MAP_TYPE_LOCATION_CENTERED.
x and y are the normalized coordinates on the current map.
Code:
lib:SetMapPing(MapDisplayPinType pingType, MapDisplayType mapType, number x, number y)
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 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 (5)
File Name
Version
Size
Uploader
Date
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 07/02/18, 08:13 AM  
Sordrak
 
Sordrak's Avatar
AddOn Author - Click to view AddOns

Forum posts: 24
File comments: 69
Uploads: 3
d(self.left)

Hey mate

Nice library. But do you mind removing the following line:
d(self.left) #94

It seems that whenever i set a rally point i'll get an annoying debug message. Thanks.
Report comment to moderator  
Reply With Quote
Unread 02/07/18, 04:56 PM  
marlonbrando
AddOn Author - Click to view AddOns

Forum posts: 2
File comments: 68
Uploads: 3
Re: Re: Re: Re: Re: Set/track a map ping in another zone

Originally Posted by marlonbrando
Originally Posted by sirinsidiator
The current zone has nothing to do with where you can set a ping. When you open the map and go to the map of a different zone you can just place a ping there and that's basically what LGS does. It sets pings on the Wrothgar or Coldharbour map depending on where the player is.

I'll announce the beta on the forum once I finished implementing all the changes.
What I see is that, if my group is in Deshaan and I transport to Coldharbour, other people in my group don't see my pings until I open up a Deshaan map. If I have a minimap up then they won't see my pings when I close the map since the minimap will reselect the map of the zone I'm in. And, I believe that if I look at a map of another zone I lose too. If LibGroupSocket already does the right thing in that scenario then I'll just switch to that.

FWIW, I'm working on an apparently abandoned add-on which defaulted to using LibMapPing which is why I'm using it at all.
...and LibGroupSocket just does just do what I want. Apologies for the noise and for being so dense as to not get it the first time.
Last edited by marlonbrando : 02/07/18 at 05:16 PM.
Report comment to moderator  
Reply With Quote
Unread 02/07/18, 03:20 PM  
marlonbrando
AddOn Author - Click to view AddOns

Forum posts: 2
File comments: 68
Uploads: 3
Re: Re: Re: Re: Set/track a map ping in another zone

Originally Posted by sirinsidiator
The current zone has nothing to do with where you can set a ping. When you open the map and go to the map of a different zone you can just place a ping there and that's basically what LGS does. It sets pings on the Wrothgar or Coldharbour map depending on where the player is.

I'll announce the beta on the forum once I finished implementing all the changes.
What I see is that, if my group is in Deshaan and I transport to Coldharbour, other people in my group don't see my pings until I open up a Deshaan map. If I have a minimap up then they won't see my pings when I close the map since the minimap will reselect the map of the zone I'm in. And, I believe that if I look at a map of another zone I lose too. If LibGroupSocket already does the right thing in that scenario then I'll just switch to that.

FWIW, I'm working on an apparently abandoned add-on which defaulted to using LibMapPing which is why I'm using it at all.
Report comment to moderator  
Reply With Quote
Unread 02/07/18, 01:37 PM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1154
File comments: 691
Uploads: 28
Re: Re: Re: Set/track a map ping in another zone

Originally Posted by marlonbrando
Originally Posted by sirinsidiator
Originally Posted by marlonbrando
Hi,
Is it possible for this library to set and track map pings in other zones than the one the player is currently in?

I'd like to just use an arbitrary zone for communication so that players don't "go away" when they go into a city or just transport away.

SetMapToMapListIndex when setting the ping seems to sort of work unless the player has a minimap active.
You are looking for LibGroupSocket then. It was made expressly for the purpose of communicating between group members. I am currently in the process of developing v2 of that library, as the current one has a few issues. Biggest issue is that users get kicked from the game when they have multiple addons active that send messages via map pings, since the lib does not enforce a global queue for messages. The new version will also have a new interface that makes defining messages a lot easier and hides most of the low level stuff.

I strongly recommend you use the lib if you want to communicate via map pings, since it will improve compatibility between addons that do the same.
I'm aware of LibGroupSocket and plan on moving to that eventually but, as far as I can see, it also communicates only in the player's current zone doesn't it?

If you're looking for beta testers for your new addon, please sign me up.
The current zone has nothing to do with where you can set a ping. When you open the map and go to the map of a different zone you can just place a ping there and that's basically what LGS does. It sets pings on the Wrothgar or Coldharbour map depending on where the player is.

I'll announce the beta on the forum once I finished implementing all the changes.
__________________
>siri.exe MyAddon
Does your addon work? [y/n] n
There is a typo in there.
Report comment to moderator  
Reply With Quote
Unread 02/07/18, 09:54 AM  
marlonbrando
AddOn Author - Click to view AddOns

Forum posts: 2
File comments: 68
Uploads: 3
Re: Re: Set/track a map ping in another zone

Originally Posted by sirinsidiator
Originally Posted by marlonbrando
Hi,
Is it possible for this library to set and track map pings in other zones than the one the player is currently in?

I'd like to just use an arbitrary zone for communication so that players don't "go away" when they go into a city or just transport away.

SetMapToMapListIndex when setting the ping seems to sort of work unless the player has a minimap active.
You are looking for LibGroupSocket then. It was made expressly for the purpose of communicating between group members. I am currently in the process of developing v2 of that library, as the current one has a few issues. Biggest issue is that users get kicked from the game when they have multiple addons active that send messages via map pings, since the lib does not enforce a global queue for messages. The new version will also have a new interface that makes defining messages a lot easier and hides most of the low level stuff.

I strongly recommend you use the lib if you want to communicate via map pings, since it will improve compatibility between addons that do the same.
I'm aware of LibGroupSocket and plan on moving to that eventually but, as far as I can see, it also communicates only in the player's current zone doesn't it?

If you're looking for beta testers for your new addon, please sign me up.
Report comment to moderator  
Reply With Quote
Unread 02/07/18, 06:51 AM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1154
File comments: 691
Uploads: 28
Re: Set/track a map ping in another zone

Originally Posted by marlonbrando
Hi,
Is it possible for this library to set and track map pings in other zones than the one the player is currently in?

I'd like to just use an arbitrary zone for communication so that players don't "go away" when they go into a city or just transport away.

SetMapToMapListIndex when setting the ping seems to sort of work unless the player has a minimap active.
You are looking for LibGroupSocket then. It was made expressly for the purpose of communicating between group members. I am currently in the process of developing v2 of that library, as the current one has a few issues. Biggest issue is that users get kicked from the game when they have multiple addons active that send messages via map pings, since the lib does not enforce a global queue for messages. The new version will also have a new interface that makes defining messages a lot easier and hides most of the low level stuff.

I strongly recommend you use the lib if you want to communicate via map pings, since it will improve compatibility between addons that do the same.
__________________
>siri.exe MyAddon
Does your addon work? [y/n] n
There is a typo in there.
Report comment to moderator  
Reply With Quote
Unread 02/06/18, 10:51 PM  
marlonbrando
AddOn Author - Click to view AddOns

Forum posts: 2
File comments: 68
Uploads: 3
Set/track a map ping in another zone

Hi,
Is it possible for this library to set and track map pings in other zones than the one the player is currently in?

I'd like to just use an arbitrary zone for communication so that players don't "go away" when they go into a city or just transport away.

SetMapToMapListIndex when setting the ping seems to sort of work unless the player has a minimap active.
Report comment to moderator  
Reply With Quote
Unread 01/02/18, 01:28 AM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1154
File comments: 691
Uploads: 28
Re: Questions...

Originally Posted by Phinix
EDIT: Never mind. Functionality I was looking for is actually in LibGroupSocket.
Was just about to write that.
__________________
>siri.exe MyAddon
Does your addon work? [y/n] n
There is a typo in there.
Report comment to moderator  
Reply With Quote
Unread 01/02/18, 01:03 AM  
Phinix
 
Phinix's Avatar
AddOn Author - Click to view AddOns

Forum posts: 142
File comments: 1011
Uploads: 28
Questions...

EDIT: Never mind. Functionality I was looking for is actually in LibGroupSocket.
Last edited by Phinix : 01/02/18 at 01:25 AM.
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.