Examples of RPAction


Examples of marauroa.common.game.RPAction

                if (rand.nextInt() % 10 == 0) {
                  /*
                   * Send an action to server.
                   */
                  RPAction action = new RPAction();
                  action.put("type", "chat");
                  action.put("text", "Hello world");
                  client.send(action);
                }

                if (rand.nextInt() % 1000 == 0) {
                  /*
 
View Full Code Here

Examples of marauroa.common.game.RPAction

              if (new Random().nextInt() % 10 == 0) {
                /*
                 * Send an action to server.
                 */
                RPAction action = new RPAction();
                action.put("type", "chat");
                action.put("text", "Hello world");
                client.send(action);
              }

              for (RPObject object : client.getObjects().values()) {
                if (object.has("hidden")) {
View Full Code Here

Examples of marauroa.common.game.RPAction

   */
  @Test
  public void sendMessageC2S() throws IOException {
    TCPNetworkClientManager clientNet = new TCPNetworkClientManager("localhost", PORT);

    RPAction action = new RPAction();
    action.put("test", "hello world");
    MessageC2SAction msg = new MessageC2SAction(null, action);

    clientNet.addMessage(msg);

    MessageC2SAction recv = (MessageC2SAction)netMan.getMessage();
View Full Code Here

Examples of marauroa.common.game.RPAction

   */
  @Test
  public void sendMessageS2C() throws IOException, InvalidVersionException {
    TCPNetworkClientManager clientNet=new TCPNetworkClientManager("localhost", PORT);

    RPAction action=new RPAction();
    action.put("test","hello world");
    MessageC2SAction msg=new MessageC2SAction(null, action);

    clientNet.addMessage(msg);

    MessageC2SAction recv=(MessageC2SAction)netMan.getMessage();

    assertEquals(msg.getRPAction(), recv.getRPAction());

    RPAction reply=new RPAction();
    reply.put("test","world ok");

    netMan.sendMessage(new MessageC2SAction(recv.getSocketChannel(), reply));

    MessageC2SAction msgReply=null;
    while(msgReply==null) {
View Full Code Here

Examples of marauroa.common.game.RPAction

       * Update timeout timestamp on player.
       */
      entry.update();

      /* Send the action to RP Manager */
      RPAction action = msg.getRPAction();

      /*
       * NOTE: These are action attributes that are important for RP
       * functionality. Tag them in such way that it is not possible to
       * change them on a buggy RP implementation or it will cause
       * problems at server.
       */
      RPObject object = entry.object;
      action.put("sourceid", object.get("id"));
      action.put("zoneid", object.get("zoneid"));

      stats.add("Actions added", 1);

      /*
       * Log the action into statistics system. Or if the action didn't
       * have type, log it as an invalid action.
       */
      String type = action.get("type");
      if (type != null) {
        stats.add("Actions " + type, 1);
      } else {
        stats.add("Actions invalid", 1);
      }
View Full Code Here

Examples of marauroa.common.game.RPAction

      assertEquals("testCharacter", characters[0]);

      boolean choosen = client.chooseCharacter("testCharacter");
      assertTrue(choosen);

      RPAction action = new RPAction();
      action.put("text", 1);
      client.send(action);

      while (client.getPerceptions() < 5) {
        assertTrue(client.getConnectionState());
        client.loop(0);
View Full Code Here

Examples of marauroa.common.game.RPAction

      assertEquals("testCharacter", characters[0]);

      boolean choosen = client.chooseCharacter("testCharacter");
      assertTrue(choosen);

      RPAction action = new RPAction();
      action.put("text", 1);
      client.send(action);

      while (client.getConnectionState()) {
        client.loop(30);
        /*
 
View Full Code Here

Examples of marauroa.common.game.RPAction

  }

  @Override
  public void readObject(marauroa.common.net.InputSerializer in) throws IOException {
    super.readObject(in);
    action = (RPAction) in.readObject(new RPAction());

    if (type != MessageType.C2S_ACTION) {
      throw new IOException();
    }
  }
View Full Code Here

Examples of marauroa.common.game.RPAction

   */
  @Test
  public void testEncoderDecoderSingle() throws IOException, InvalidVersionException {
    Encoder enc = Encoder.get();

    RPAction action = new RPAction();
    action.put("one", 1);
    action.put("two", "2");

    MessageC2SAction message = new MessageC2SAction(null, action);

    byte[] result = enc.encode(message);

View Full Code Here

Examples of marauroa.common.game.RPAction

   */
  @Test
  public void testEncoderDecoderMultiple() throws IOException, InvalidVersionException {
    Encoder enc = Encoder.get();

    RPAction action = new RPAction();
    action.put("one", 1);
    action.put("two", "2");

    MessageC2SAction message = new MessageC2SAction(null, action);

    byte[] result = enc.encode(message);

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.