Package marauroa.common.game

Examples of marauroa.common.game.RPAction


    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", "title");
    action.put("mode", "");
    action.put("value", 0);

    CommandCenter.execute(pl, action);
    assertEquals("The title attribute may not be changed directly.", pl
        .events().get(0).get("text"));
  }
View Full Code Here


  @Test
  public void alterQuestActionPerform() throws Exception {
    final Player bob = PlayerTestHelper.createPlayer("bob");
    final MockStendhalRPRuleProcessor rules = MockStendhalRPRuleProcessor.get();
    rules.addPlayer(bob);
    final RPAction action = new RPAction();
    action.put("type", "alterquest");
    action.put("target", "bob");
    action.put("name", "questname");
    action.put("state", "queststate");
    final AlterQuestAction aq = new AlterQuestAction();
    aq.perform(bob, action);
    assertTrue(bob.hasQuest("questname"));
    assertEquals("queststate", bob.getQuest("questname"));
View Full Code Here

    final Player bob = PlayerTestHelper.createPlayer("bob");
    final Player james = PlayerTestHelper.createPlayer("james");
    final MockStendhalRPRuleProcessor rules = MockStendhalRPRuleProcessor.get();
    rules.addPlayer(james);
    final RPAction action = new RPAction();
    action.put("type", "alterquest");
    action.put("target", "james");
    action.put("name", "questname");
    action.put("state", "queststate");
    final AlterQuestAction aq = new AlterQuestAction();
    aq.perform(bob, action);
    assertTrue(james.hasQuest("questname"));
    assertEquals("queststate", james.getQuest("questname"));
  }
View Full Code Here

    MockStendhalRPRuleProcessor.get().addPlayer(pl);
    MockStendhalRPRuleProcessor.get().addPlayer(bob);

    pl.put("adminlevel", 5000);

    RPAction action = new RPAction();
    action.put("type", "alterquest");
    action.put("target", "bob");
    action.put("name", "questname");
    action.put("state", "queststate");
    CommandCenter.execute(pl, action);
    assertTrue(bob.hasQuest("questname"));
    assertEquals("queststate", bob.getQuest("questname"));
    action = new RPAction();
    action.put("type", "alterquest");
    action.put("target", "bob");
    action.put("name", "questname");
   
    CommandCenter.execute(pl, action);
    assertFalse(bob.hasQuest("questname"));
 
  }
View Full Code Here

    final Player player = PlayerTestHelper.createPlayer("bob");
    final Item cheese = SingletonRepository.getEntityManager().getItem("cheese");
    player.equip("bag", cheese);
    final StendhalRPZone zone = new StendhalRPZone("zone");
    zone.add(player);
    final RPAction action = new RPAction();
    action.put(BASEITEM, cheese.getID().getObjectID());
    action.put(BASEOBJECT, player.getID().getObjectID());
    action.put(BASESLOT, "bag");
    assertTrue(player.isEquipped("cheese"));
    ua.onAction(player, action);
    assertFalse(player.isEquipped("cheese"));
  }
View Full Code Here

    final StackableItem cheese = (StackableItem) SingletonRepository.getEntityManager().getItem("cheese");
    cheese.setQuantity(2);
    player.equip("bag", cheese);
    final StendhalRPZone zone = new StendhalRPZone("zone");
    zone.add(player);
    final RPAction action = new RPAction();
    action.put(BASEITEM, cheese.getID().getObjectID());
    action.put(BASEOBJECT, player.getID().getObjectID());
    action.put(BASESLOT, "bag");
    assertTrue(player.isEquipped("cheese"));
    ua.onAction(player, action);
    assertTrue(player.isEquipped("cheese"));
  }
View Full Code Here

    player.setPosition(1, 1);
    chest.setPosition(1, 2);
    zone.add(player);
    zone.add(chest);
    chest.open();
    final RPAction action = new RPAction();
    action.put(BASEITEM, cheese.getID().getObjectID());
    action.put(BASEOBJECT, chest.getID().getObjectID());
    action.put(BASESLOT, "content");
    assertFalse(player.has("eating"));
    ua.onAction(player, action);
    assertTrue(player.has("eating"));
  }
View Full Code Here

    MockStendhalRPRuleProcessor.get().addPlayer(pl);
    MockStendhalRPRuleProcessor.get().addPlayer(bob);

    pl.put("adminlevel", 0);

    final RPAction action = new RPAction();
    action.put("type", "alterquest");
    action.put("target", "bob");
    action.put("name", "questname");
    action.put("state", "queststate");
    CommandCenter.execute(pl, action);
    assertFalse(bob.hasQuest("questname"));
  }
View Full Code Here

   
    MockStendhalRPRuleProcessor.get().addPlayer(hugo);
    MockStendhalRPRuleProcessor.get().addPlayer(bob);
    MockStendhalRPRuleProcessor.get().addPlayer(jack);
   
    final RPAction action = new RPAction();

    action.put("type", "ghostmode");
    assertFalse(hugo.isInvisibleToCreatures());
    assertFalse(hugo.isGhost());

    CommandCenter.execute(hugo, action);
View Full Code Here

   */
  @Test
  public void testOnWrongAction() {
    final OutfitAction oa = new OutfitAction();
    final Player player = PlayerTestHelper.createPlayer("player");
    final RPAction action = new RPAction();
    oa.onAction(player, action);
    assertTrue("no exception thrown", true);
  }
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.