wyvern.kernel.maps
Class Broadcast

java.lang.Object
  extended bywyvern.kernel.maps.Broadcast

public class Broadcast
extends java.lang.Object

Handles the standard broadcasting commands, for broadcasting a message to all players (and monsters that are listening) nearby.

Version:
1.0, Jul 22, 2003
Author:
Steve Yegge

Field Summary
static int DEFAULT_BROADCAST_RADIUS
           
 
Constructor Summary
Broadcast()
           
 
Method Summary
static java.util.List broadcast(GameObject obj, java.lang.String msg)
          Broadcast message to everyone in sight.
static java.util.List broadcast(GameObject obj, java.lang.String msg, byte style)
          Broadcast message to everyone in sight.
static java.util.List broadcast(GameObject obj, java.lang.String message, Predicate p)
          Broadcast message to everyone in sight.
static java.util.List broadcast(GameObject obj, java.lang.String msg, Predicate p, byte style)
          Sends the specified message to everyone in sight.
static java.util.List broadcast(GameObject src, java.lang.String msg, Predicate p, byte style, int radius)
          Sends the specified message to everyone in sight.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_BROADCAST_RADIUS

public static final int DEFAULT_BROADCAST_RADIUS
See Also:
Constant Field Values
Constructor Detail

Broadcast

public Broadcast()
Method Detail

broadcast

public static java.util.List broadcast(GameObject obj,
                                       java.lang.String msg)
Broadcast message to everyone in sight.

Parameters:
obj - the object doing the broadcasting
msg - the message to broadcast - if null, returns an empty list
Returns:
the list of names of players who heard the message, null if none heard (the broadcaster never hears it). Monsters hear broadcasts only if they have a "hears-broadcasts" property, but they're not included in the returned list. Returned list is never null, but can be empty.

broadcast

public static java.util.List broadcast(GameObject obj,
                                       java.lang.String msg,
                                       byte style)
Broadcast message to everyone in sight.

Parameters:
obj - the object doing the broadcasting
msg - the message to send
style - the Kernel.TextStyle to use
Returns:
the list of names of players who heard the message, null if none heard (the broadcaster never hears it). Monsters hear broadcasts only if they have a "hears-broadcasts" property, but they're not included in the returned list. Returned list is never null, but can be empty.

broadcast

public static java.util.List broadcast(GameObject obj,
                                       java.lang.String message,
                                       Predicate p)
Broadcast message to everyone in sight.

Parameters:
obj - the object doing the broadcasting
message - the message to broadcast - if null, returns the empty list
p - a Predicate to match the players and monsters to hear the message

broadcast

public static java.util.List broadcast(GameObject obj,
                                       java.lang.String msg,
                                       Predicate p,
                                       byte style)
Sends the specified message to everyone in sight.

Parameters:
obj - the object doing the broadcasting
msg - the message to send
p - an optional predicate used to filter the recipients. If p is false for a potential recipient, the message is not delivered to that recipient.
style - the Kernel.TextStyle to use
Returns:
the list of names of players who heard the message, null if none heard (the broadcaster never hears it). Monsters hear broadcasts only if they have a "hears-broadcasts" property, but they're not included in the returned list. Returned list is never null, but can be empty.

broadcast

public static java.util.List broadcast(GameObject src,
                                       java.lang.String msg,
                                       Predicate p,
                                       byte style,
                                       int radius)
Sends the specified message to everyone in sight.

Parameters:
src - the object doing the broadcasting
msg - the message to send
p - an optional predicate used to filter the recipients. If p is false for a potential recipient, the message is not delivered to that recipient. (I.e. if p is non-null, then messages will only be delivered to recipients for which the predicate returns true.)
style - the Kernel.TextStyle to use
radius - the radius around the player to broadcast to. Includes the player's location, so a radius of 7 would cover their whole view.
Returns:
the list of names of players who heard the message, null if none heard (the broadcaster never hears it). Monsters hear broadcasts only if they have a "hears-broadcasts" property, but they're not included in the returned list. Returned list is never null, but can be empty.