Examples of RPAction


Examples of marauroa.common.game.RPAction

    final EquipmentAction action = new DropAction();
    Player bob = PlayerTestHelper.createPlayer("bob");
    StendhalRPZone zone = new StendhalRPZone("bla_jail");
    zone.setNoItemMoveMessage("For security reasons, items may not be moved around in jail.");
    zone.add(bob);
    action.onAction(bob, new RPAction());
    assertFalse(bob.events().isEmpty());
    assertEquals("For security reasons, items may not be moved around in jail.", bob.events().get(0).get("text"));


    bob = PlayerTestHelper.createPlayer("bobby");

    zone = new StendhalRPZone("bla_jail_not");

    zone.add(bob);
    action.onAction(bob, new RPAction());
    assertTrue(bob.events().isEmpty());
  }
View Full Code Here

Examples of marauroa.common.game.RPAction

    Item item = SingletonRepository.getEntityManager().getItem("cheese");

    player.equip("bag", item);
    assertTrue(player.isEquipped("cheese"));
    localzone.add(player);
    final RPAction drop = new RPAction();
    drop.put("type", "drop");
    drop.put("baseobject", player.getID().getObjectID());
    drop.put("baseslot", "bag");
    drop.put("x", player.getX());
    drop.put("y", player.getY() + 1);
    drop.put("quantity", "1");
    drop.put("baseitem", item.getID().getObjectID());

    final EquipmentAction action = new DropAction();
    assertEquals(0, localzone.getItemsOnGround().size());
    assertTrue(drop.has(EquipActionConsts.BASE_ITEM));

    action.onAction(player, drop);
    Assert.assertEquals(0, player.events().size());
    assertEquals(1, localzone.getItemsOnGround().size());
    assertFalse(player.isEquipped("cheese"));
View Full Code Here

Examples of marauroa.common.game.RPAction

    StackableItem item = (StackableItem) SingletonRepository.getEntityManager().getItem("cheese");
    item.setQuantity(5);
    player.equip("bag", item);
    assertTrue(player.isEquipped("cheese", 5));
    localzone.add(player);
    final RPAction drop = new RPAction();
    drop.put("type", "drop");
    drop.put("baseobject", player.getID().getObjectID());
    drop.put("baseslot", "bag");
    drop.put("x", player.getX());
    drop.put("y", player.getY() + 1);
    drop.put("quantity", "2");
    drop.put("baseitem", item.getID().getObjectID());

    final EquipmentAction action = new DropAction();
    assertEquals(0, localzone.getItemsOnGround().size());
    assertTrue(drop.has(EquipActionConsts.BASE_ITEM));

    action.onAction(player, drop);
    Assert.assertEquals(0, player.events().size());
    assertEquals(1, localzone.getItemsOnGround().size());
    assertFalse(player.isEquipped("cheese", 4));
View Full Code Here

Examples of marauroa.common.game.RPAction

   * Tests for onAction.
   */
  @Test
  public void testOnAction() {
    final FaceAction fa = new FaceAction();
    final RPAction action = new RPAction();
    PlayerTestHelper.generatePlayerRPClasses();
    final Player player = new Player(new RPObject()) {
      @Override
      public void stop() {
        stopCalled = true;
      }

      @Override
      public void setDirection(final Direction dir) {
        directionSet = dir;
      }

      @Override
      public void notifyWorldAboutChanges() {
        notifyCalled = true;
      }
    };

    fa.onAction(player, action);
    assertFalse(stopCalled);
    assertFalse(notifyCalled);
    assertNull(directionSet);

    action.put("dir", 1);
    fa.onAction(player, action);
    assertTrue(stopCalled);
    assertTrue(notifyCalled);
    assertNotNull(directionSet);

View Full Code Here

Examples of marauroa.common.game.RPAction

    final Player admin = PlayerTestHelper.createPlayer("admin");
    admin.setAdminLevel(400);
    PlayerTestHelper.registerPlayer(admin, zone);

    RPAction action = new RPAction();
    action.put("type", "marry");
    assertTrue(CommandCenter.execute(admin, action));
    assertEquals("Usage: #/marry #<player1> #<player2>",
        admin.events().get(0).get("text"));
    admin.clearEvents();

    action = new RPAction();
    action.put("type", "marry");
    action.put("target", "player1");
    action.put("args", "player2");
    assertTrue(CommandCenter.execute(admin, action));
    assertEquals(
        "You have successfully married \"player1\" and \"player2\".",
        admin.events().get(0).get("text"));
    admin.clearEvents();
View Full Code Here

Examples of marauroa.common.game.RPAction

    MockStendhalRPRuleProcessor.get().addPlayer(pl);

    zone.add(pl);
    pl.setPosition(1, 1);
    pl.put("adminlevel", 5000);
    final RPAction action = new RPAction();
    action.put("type", "summon");
    action.put("creature", "rat");
    action.put("x", 0);
    action.put("y", 0);
    CommandCenter.execute(pl, action);
    assertEquals(1, pl.getID().getObjectID());
    final Creature rat = (Creature) zone.getEntityAt(0, 0);
    assertEquals("rat", rat.get("subclass"));
    assertTrue("RaidCreature", rat instanceof RaidCreature);
View Full Code Here

Examples of marauroa.common.game.RPAction

    MockStendhalRPRuleProcessor.get().addPlayer(pl);

    zone.add(pl);
    pl.setPosition(1, 1);
    pl.put("adminlevel", 5000);
    final RPAction action = new RPAction();
    action.put("type", "summon");
    action.put("creature", "dagger");
    action.put("x", 0);
    action.put("y", 0);
    CommandCenter.execute(pl, action);
    assertEquals(1, pl.getID().getObjectID());
    final Item item = (Item) zone.getEntityAt(0, 0);
    assertEquals("dagger", item.get("subclass"));
  }
View Full Code Here

Examples of marauroa.common.game.RPAction

    MockStendhalRPRuleProcessor.get().addPlayer(pl);

    zone.add(pl);
    pl.setPosition(1, 1);
    pl.put("adminlevel", 5000);
    final RPAction action = new RPAction();
    action.put("type", "summon");
    action.put("creature", "unknown");
    action.put("x", 0);
    action.put("y", 0);
    CommandCenter.execute(pl, action);
    assertEquals(1, pl.getID().getObjectID());
    assertNull(zone.getEntityAt(0, 0));
  }
View Full Code Here

Examples of marauroa.common.game.RPAction

    MockStendhalRPRuleProcessor.get().addPlayer(pl);

    zone.add(pl);
    pl.setPosition(1, 1);
    pl.put("adminlevel", 5000);
    final RPAction action = new RPAction();
    action.put("type", "summon");
    action.put("creature", "unknown");
    action.put("x", "bag");
    action.put("y", "perch");
    CommandCenter.execute(pl, action);
    assertEquals(1, pl.getID().getObjectID());
    assertNull(zone.getEntityAt(0, 0));
  }
View Full Code Here

Examples of marauroa.common.game.RPAction

  @Test
  public void testIsNotValid() {
    SourceObject so = SourceObject.createSourceObject(null, null);
    assertFalse("null null does not make a valid source", so.isValid());

    so = SourceObject.createSourceObject(new RPAction(), PlayerTestHelper.createPlayer("bob"));
    assertFalse("empty action does not make a valid source", so.isValid());

    final RPAction action = new RPAction();
    action.put(EquipActionConsts.BASE_ITEM, 1);
    so = SourceObject.createSourceObject(action, PlayerTestHelper.createPlayer("bob"));
    assertFalse("Player is not in zone", so.isValid());
  }
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.