Package games.stendhal.server.core.engine

Examples of games.stendhal.server.core.engine.StendhalRPZone


  @Test
  public void testSearchPathEntityIntInt() {
    final Entity entity = new Entity() {
      // just to create an instance
    };
    final StendhalRPZone zone = new StendhalRPZone("test", 10, 10);
    zone.add(entity);
    assertArrayEquals(expected.toArray(), Path.searchPath(entity, 6, 6).toArray());
  }
View Full Code Here


  /**
   * Test the entity free path finder.
   */
  @Test
  public void testSearchPathSimpleIntInt() {
    final StendhalRPZone zone = new StendhalRPZone("test", 10, 10);
   
    assertArrayEquals(expected.toArray(), Path.searchPath(zone, 0, 0, 6, 6, 20).toArray());
  }
View Full Code Here

    MockStendlRPWorld.get();
    final UseAction ua = new UseAction();
    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"));
View Full Code Here

    final UseAction ua = new UseAction();
    final Player player = PlayerTestHelper.createPlayer("bob");
    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"));
View Full Code Here

    final UseAction ua = new UseAction();
    final Player player = PlayerTestHelper.createPlayer("bob");
    final Chest chest = new Chest();
    final Item cheese = SingletonRepository.getEntityManager().getItem("cheese");
    chest.add(cheese);
    final StendhalRPZone zone = new StendhalRPZone("zone");
    zone.collisionMap.clear();
    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");
View Full Code Here

    QuestHelper.setUpBeforeClass();
  }

  @Before
  public void setUp() {
    final StendhalRPZone zone = new StendhalRPZone("admin_test");
    new TouristFromAdosNPC().configureZone(zone, null)
    new LifeguardNPC().configureZone(zone, null)

    AbstractQuest quest = new SuntanCreamForZara();
    quest.addToWorld();
View Full Code Here

   * Tests for teleportActionToValidZone.
   */
  @Test
  public final void testTeleportActionToValidZone() {

    final StendhalRPZone zoneTo = new StendhalRPZone("zoneTo");
    final Player pl = PlayerTestHelper.createPlayer("player");
    MockStendhalRPRuleProcessor.get().addPlayer(pl);
    PlayerTestHelper.generatePlayerRPClasses();
    final Player bob = new Player(new RPObject()) {
      @Override
View Full Code Here

    final Player pl = PlayerTestHelper.createPlayer("blah");

    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

  public final void testSummonAlterCreature() {

    final Player pl = PlayerTestHelper.createPlayer("hugo");

    MockStendhalRPRuleProcessor.get().addPlayer(pl);
    final StendhalRPZone zone = new StendhalRPZone("testzone") {
      @Override
      public synchronized boolean collides(final Entity entity, final double x,
          final double y) {

        return false;
      }
    };
    zone.add(pl);
    pl.setPosition(1, 1);
    pl.setAdminLevel(5000);
    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"));

    action = new RPAction();
    action.put("type", "altercreature");
    action.put("target", "#2");
View Full Code Here

  @Test
  public void testEntityFromZoneByID() {
    int idRPO1 = 1;
    int idRPO2 = 2;
    StendhalRPZone zone = new StendhalRPZone(TEST_ENTITY_HELPER);
    RPObject rpo1 = new Entity() {};
    rpo1.setID(new RPObject.ID(idRPO1, zone.getID()));
    zone.add(rpo1);
    RPObject rpo2 = new Entity() {};
    rpo2.setID(new RPObject.ID(idRPO2, zone.getID()));
    zone.add(rpo2);
    Entity entityFromZoneByID = EntityHelper.entityFromZoneByID(idRPO1, zone);
    assertThat(entityFromZoneByID, is(rpo1));
    assertThat(entityFromZoneByID, not((is(rpo2))));
  }
View Full Code Here

TOP

Related Classes of games.stendhal.server.core.engine.StendhalRPZone

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.