Package games.stendhal.server.entity.mapstuff.portal

Examples of games.stendhal.server.entity.mapstuff.portal.Portal


    assertEquals("The cost of a new house in Ados is 120000 money. Also, you must pay a house tax of 1000 money,"
        + " every month. If you have a house in mind, please tell me the number now. I will check availability. "
        + "The Ados houses are numbered from 50 to 77.", getReply(npc));
   
    // add a portal to the maps so that there's something to check and sell
    Portal destination = new Portal();
    destination.setIdentifier("dest");
    SingletonRepository.getRPWorld().getRPZone(ZONE_NAME).add(destination);
    chest = new StoredChest();
    SingletonRepository.getRPWorld().getRPZone(ZONE_NAME).add(chest);
   
    housePortal = new HousePortal("ados house 50");
View Full Code Here


    door.setDestination(ZONE_NAME, Integer.valueOf(0));
    entranceZone.add(door);

    door.open();

    final Portal exit = new Portal();
    exit.setPosition(17, 20);
    exit.setIdentifier(Integer.valueOf(0));
    exit.setDestination(entranceZoneName, Integer.valueOf(0));
    zone.add(exit);

    final Sign sign = new Sign();
    sign.setPosition(96, 102);
    sign.setText("If the door is closed, you will have to wait a short time until the last player finishes his task.");
View Full Code Here

    final StendhalRPZone zone = getZone();
    if (zone.simpleCollides(this, nx, ny, this.getWidth(), this.getHeight())) {
      handleSimpleCollision(nx, ny);
      return;
    }
    final Portal p = zone.getPortal(nx, ny);
    if (p != null) {
      if (handlePortal(p)) {
        return;
      }
    }
View Full Code Here

  protected void createLevelPortalAt(final int type, final int x, final int y) {
    if (logger.isDebugEnabled()) {
      logger.debug("Portal stairs at " + this + ": " + x + "," + y);
    }

    Portal portal;

    if (type != 5) {
      portal = new Portal();
    } else {
      portal = new OneWayPortalDestination();
    }

    portal.setPosition(x, y);
    assignPortalID(portal);
    add(portal);

    boolean assigned = false;

    if (isInterior()) {
      // The algo doesn't work on interiors
      return;
    }

    for (final IRPZone i : SingletonRepository.getRPWorld()) {
      final StendhalRPZone zone = (StendhalRPZone) i;

      if (zone.isInterior()) {
        continue;
      }

      /*
       * Portals in the correct direction?
       */
      if (type == 2) {
        /* portal stairs up */
        if ((zone.getLevel() - getLevel()) != 1) {
          continue;
        }
      } else if (type == 3) {
        /* portal stairs down */
        if ((zone.getLevel() - getLevel()) != -1) {
          continue;
        }
      } else {
        /* one way portal - POTENTIALLY WRONG LEVEL */
        /* Should they always go down (drop only)? */
        if (Math.abs(zone.getLevel() - getLevel()) != 1) {
          continue;
        }
      }

      final Portal target = zone.getPortal(
          portal.getX() + getX() - zone.getX(), portal.getY()
              + getY() - zone.getY());

      if (target == null) {
        continue;
      }

      logger.debug(zone + " contains " + target);

      if (target.loaded()) {
        logger.debug(target + " already loaded");
        continue;
      }

      if (type != 5) {
        portal.setDestination(zone.getName(),
            zone.assignPortalID(target));
      }

      target.setDestination(getName(), portal.getIdentifier());

      logger.debug("Portals LINKED");
      logger.debug(portal);
      logger.debug(target);
      assigned = true;
View Full Code Here

    assertEquals("Hello, player.", getReply(npc));
    en.step(player, "buy");
    assertEquals("The cost of a new apartment is 100000 money.  Also, you must pay a monthly tax of 1000 money. If you have an apartment in mind, please tell me the number now. I will check availability. Athor Apartments are numbered 101 to 108.", getReply(npc));
   
//     add a portal to the maps so that there's something to check and sell
    Portal destination = new Portal();
    destination.setIdentifier("dest");
    SingletonRepository.getRPWorld().getRPZone(ZONE_NAME).add(destination);
    chest = new StoredChest();
    SingletonRepository.getRPWorld().getRPZone(ZONE_NAME).add(chest);

    for (String zone : CITY_ZONES) {
View Full Code Here

    assertEquals("Bye.", getReply(npc));

    // jump back to the quest start state
    player.setQuest(questSlot, questStarted);
    // solve the maze
    Portal portal = maze.getPortal();
    player.setPosition(portal.getX(), portal.getY());
    portal.onUsed(player);
    assertTrue(PlayerTestHelper.getPrivateReply(player).matches("You used 0 seconds to solve the maze. That was worth [0-9]+ points."));
    assertEquals("done", player.getQuest(questSlot, 0));
  }
View Full Code Here

    init(player);

  }

  private void init(final Player player) {
    Portal portal = new Teleporter(new Spot(player.getZone(), player.getX(), player.getY()));
    portal.setPosition(6, 3);
    add(portal);
    numCreatures = 0;
    int count = 0;
    // max ALLOWED_FAILS fails to place all creatures before we give up
    while (numCreatures < NUMBER_OF_CREATURES && count < ALLOWED_FAILS) {
View Full Code Here

       */
      className = Portal.class.getName();
    }

    try {
      final Portal portal = (Portal) EntityFactoryHelper.create(className,
          getParameters(), getAttributes());
      if (portal == null) {
        LOGGER.warn("Unable to create portal: " + className);

        return;
      }

      portal.setPosition(getX(), getY());
      portal.setIdentifier(getIdentifier());

      final Object destIdentifier = getDestinationIdentifier();

      if (destIdentifier != null) {
        portal.setDestination(getDestinationZone(), destIdentifier);
      }

      // Check for an existing portal at the location
      final Portal oportal = zone.getPortal(getX(), getY());
      if (oportal != null) {
        if (isReplacing()) {
          LOGGER.debug("Replacing portal: " + oportal);
          zone.remove(oportal);
        } else {
View Full Code Here

    StendhalRPZone zone = StendhalRPWorld.get().getZone(ZONE_NAME);
    System.getProperties().remove("stendhal.forcezone");

    // add portal in int_abstract_server_down going back to semos town hall
    // Note: This portal is defined in misc.xml, too.
    Portal portal = new Portal();
    portal.setPosition(15, 28);
    portal.setDestination("0_semos_city", "townhall_entrance");
    zone.add(portal);

    zone.remove(NPCList.get().get("Megan"));
  }
View Full Code Here

    init(player);

  }

  private void init(final Player player) {
    Portal portal = new Teleporter(new Spot(player.getZone(),
        player.getX(), player.getY()));
    portal.setPosition(4, 8);
    add(portal);

    chest = new PersonalChest();
    chest.setPosition(4, 2);
    add(chest);
View Full Code Here

TOP

Related Classes of games.stendhal.server.entity.mapstuff.portal.Portal

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.