Class MessageS2CPerception

java.lang.Object
marauroa.common.net.message.Message
marauroa.common.net.message.MessageS2CPerception
All Implemented Interfaces:
Serializable

public class MessageS2CPerception extends Message
This message indicate the client the objects that the server has determined that this client is able to see.
See Also:
Message, IRPZone
  • Constructor Details

    • MessageS2CPerception

      public MessageS2CPerception()
      Constructor for allowing creation of an empty message
    • MessageS2CPerception

      public MessageS2CPerception(Channel source, Perception perception)
      Constructor with a TCP/IP source/destination of the message and perception to send.
      Parameters:
      source - The TCP/IP address associated to this message
      perception - the perception we are going to send.
  • Method Details

    • setMyRPObject

      public void setMyRPObject(RPObject added, RPObject deleted)
      sets the added and deleted information for the destination player
      Parameters:
      added - added information
      deleted - deleted information
    • getMyRPObjectAdded

      public RPObject getMyRPObjectAdded()
      gets the added information for the personal object
      Returns:
      added information to the personal object
    • getMyRPObjectDeleted

      public RPObject getMyRPObjectDeleted()
      gets the deleted information for the personal object
      Returns:
      deleted information from the personal object
    • setPerceptionTimestamp

      public void setPerceptionTimestamp(int ts)
      sets the timestamp of this perception
      Parameters:
      ts - counter
    • getPerceptionTimestamp

      public int getPerceptionTimestamp()
      gets the timestamp of this perception
      Returns:
      counter
    • getPerceptionType

      public byte getPerceptionType()
      gets the type of this perception
      Returns:
      full or delta
    • getRPZoneID

      public IRPZone.ID getRPZoneID()
      gets the id of the zone, this perception is for
      Returns:
      IRPZone.ID
    • getAddedRPObjects

      public List<RPObject> getAddedRPObjects()
      This method returns the list of modified objects
      Returns:
      List of added objects
    • getModifiedAddedRPObjects

      public List<RPObject> getModifiedAddedRPObjects()
      This method returns the list of modified objects
      Returns:
      List of modified objects that has attributes added
    • getModifiedDeletedRPObjects

      public List<RPObject> getModifiedDeletedRPObjects()
      This method returns the list of modified objects
      Returns:
      List of modified objects that has attributes removed
    • getDeletedRPObjects

      public List<RPObject> getDeletedRPObjects()
      This method returns the list of deleted objects
      Returns:
      List of deleted objects
    • toString

      public String toString()
      This method returns a String that represent the object
      Overrides:
      toString in class Message
      Returns:
      a string representing the object.
    • writeObject

      public void writeObject(OutputSerializer out) throws IOException
      Description copied from class: Message
      Serialize the object into an ObjectOutput
      Specified by:
      writeObject in interface Serializable
      Overrides:
      writeObject in class Message
      Parameters:
      out - the output serializer.
      Throws:
      IOException - if the serializations fails
    • readObject

      public void readObject(InputSerializer in) throws IOException
      Description copied from class: Message
      Serialize the object from an ObjectInput
      Specified by:
      readObject in interface Serializable
      Overrides:
      readObject in class Message
      Parameters:
      in - the input serializer
      Throws:
      IOException - if the serializations fails
    • clearPrecomputedPerception

      public static void clearPrecomputedPerception()
      clears the cached perceptions to start the next turn fresh.
    • writeToJson

      public void writeToJson(StringBuilder out)
      Description copied from class: Message
      Serialize the object to json
      Overrides:
      writeToJson in class Message
      Parameters:
      out - output buffer
    • isSkippable

      public boolean isSkippable()
      Description copied from class: Message
      may this method be skipped?
      Overrides:
      isSkippable in class Message
      Returns:
      true, if this method may be skipped; false otherwise.
    • isPerception

      public boolean isPerception()
      is this message a perception
      Overrides:
      isPerception in class Message
      Returns:
      true, if this message is a perception; false otherwise