Package marauroa.common.game

Examples of marauroa.common.game.RPAction


    final Player bob = PlayerTestHelper.createPlayer("bob");
    MockStendhalRPRuleProcessor.get().addPlayer(pl);
    MockStendhalRPRuleProcessor.get().addPlayer(bob);

    pl.setAdminLevel(5000);
    final RPAction action = new RPAction();
    action.put("type", "teleport");
    action.put("text", "huhu");
    action.put("target", "bob");
    action.put("zone", "non-existing-zone");
    action.put("x", "0");
    action.put("y", "0");

    assertTrue(action.has("target") && action.has("zone")
        && action.has("x"));

    CommandCenter.execute(pl, action);
    // The list of existing zones depends on other tests, so we simply
    // ignore it here.
    assertTrue(pl
View Full Code Here


    try {
      AccountDAO accountDAO = DAORegister.get().get(AccountDAO.class);
      CharacterDAO characterDAO = DAORegister.get().get(CharacterDAO.class);
      BanAction ban = new BanAction();
      Player player = PlayerTestHelper.createPlayer("bob");
      RPAction action = new RPAction();
      action.put("target", player.getName());
      action.put("hours", -1);
      action.put("reason", "Because we were testing banning");
     
      // I don't know if this is still needed.
      if (!accountDAO.hasPlayer(transaction, player.getName())) {
        accountDAO.addPlayer(transaction, player.getName(), new byte[0], "schnubbel");
      }
View Full Code Here

    MockStendhalRPRuleProcessor.get().addPlayer(bob);

    MockStendlRPWorld.get().addRPZone(zoneTo);
    pl.setAdminLevel(5000);
    final RPAction action = new RPAction();
    action.put("type", "teleport");
    action.put("text", "huhu");
    action.put("target", "bob");
    action.put("zone", "zoneTo");
    action.put("x", "0");
    action.put("y", "0");

    assertTrue(action.has("target") && action.has("zone")
        && action.has("x"));
    assertThat(bob.getName(), not(is("hugo")));
    CommandCenter.execute(pl, action);
    assertEquals("name must have changed, if action was executed", "hugo", bob.getName());
  }
View Full Code Here

      AccountDAO accountDAO = DAORegister.get().get(AccountDAO.class);
      CharacterDAO characterDAO = DAORegister.get().get(CharacterDAO.class);
     
      Player player = PlayerTestHelper.createPlayer("bobby");
      Player admin = PlayerTestHelper.createPlayer("admin");
      RPAction action = new RPAction();
      action.put("type", "ban");
      action.put("target", player.getName());
      action.put("hours",  -1);
      action.put("reason", "whynot");
      if (!accountDAO.hasPlayer(transaction, player.getName())) {
        accountDAO.addPlayer(transaction, player.getName(), new byte[0], "schnubbel");
      }

      accountDAO.setAccountStatus(transaction, player.getName(), "active");
View Full Code Here

   */
  @Test
  public final void testTeleportToActionPlayerNotThere() {
    final Player pl = PlayerTestHelper.createPlayer("player");
    pl.setAdminLevel(5000);
    final RPAction action = new RPAction();
    action.put("type", "teleportto");
    action.put("target", "blah");
    CommandCenter.execute(pl, action);
    assertEquals("Player \"blah\" not found", pl.events().get(0).get("text"));
  }
View Full Code Here

    try {
      AccountDAO accountDAO = DAORegister.get().get(AccountDAO.class);
     
      Player player = PlayerTestHelper.createPlayer("bobbby");
      Player admin = PlayerTestHelper.createPlayer("admin");
      RPAction action = new RPAction();
      action.put("type", "ban");
      action.put("target", player.getName());
      action.put("hours",  -1);
      action.put("reason", "Because I can't type the correct name");
      if (!accountDAO.hasPlayer(transaction, player.getName())) {
        accountDAO.addPlayer(transaction, player.getName(), new byte[0], "schnubbel");
      }

      accountDAO.setAccountStatus(transaction, player.getName(), "active");
View Full Code Here

    pl.setAdminLevel(5000);

    MockStendhalRPRuleProcessor.get().addPlayer(pl);
    final StendhalRPZone zone = new StendhalRPZone("zone");
    zone.add(pl);
    final RPAction action = new RPAction();
    action.put("type", "teleportto");
    action.put("target", "blah");
    CommandCenter.execute(pl, action);
    assertEquals("Position [0,0] is occupied", pl.events().get(0).get("text"));
  }
View Full Code Here

    final Player pl = PlayerTestHelper.createPlayer("bob");
    pl.setAdminLevel(5000);

    MockStendhalRPRuleProcessor.get().addPlayer(pl);

    final RPAction action = new RPAction();
    action.put("type", "alter");
    action.put("target", "bob");
    action.put("stat", "0");
    action.put("mode", "");
    action.put("value", 0);

    CommandCenter.execute(pl, action);
    assertEquals(
        "Attribute you are altering is not defined in RPClass(player)",
        pl.events().get(0).get("text"));
View Full Code Here

      AccountDAO accountDAO = DAORegister.get().get(AccountDAO.class);
      CharacterDAO characterDAO = DAORegister.get().get(CharacterDAO.class);
     
      Player player = PlayerTestHelper.createPlayer("bobby");
      Player admin = PlayerTestHelper.createPlayer("admin");
      RPAction action = new RPAction();
      action.put("type", "ban");
      action.put("target", player.getName());
      action.put("hours"1);
      action.put("reason", "We want to test the temporary bans");
      if (!accountDAO.hasPlayer(transaction, player.getName())) {
        accountDAO.addPlayer(transaction, player.getName(), new byte[0], "schnubbel");
      }

      accountDAO.setAccountStatus(transaction, player.getName(), "active");
View Full Code Here

    final Player pl = PlayerTestHelper.createPlayer("bob");
    pl.setAdminLevel(5000);

    MockStendhalRPRuleProcessor.get().addPlayer(pl);

    final RPAction action = new RPAction();
    action.put("type", "alter");
    action.put("target", "bob");
    action.put("stat", "name");
    action.put("mode", "");
    action.put("value", 0);

    CommandCenter.execute(pl, action);
    assertEquals("Sorry, name cannot be changed.", pl.events().get(0).get("text"));
    action.put("stat", "adminlevel");
    pl.clearEvents();
    CommandCenter.execute(pl, action);
    assertEquals(
        "Use #/adminlevel #<playername> #[<newlevel>] to display or change adminlevel.",
        pl.events().get(0).get("text"));
View Full Code Here

TOP

Related Classes of marauroa.common.game.RPAction

Copyright © 2018 www.massapicom. 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.