Package games.stendhal.server.entity

Examples of games.stendhal.server.entity.RPEntity


        return;
      }

      // Parse Player2 (player/npc)
      final String name2 = action.get("args");
      RPEntity player2 = SingletonRepository.getRuleProcessor().getPlayer(name2);
      if (player2 == null) {
        player2 = SingletonRepository.getNPCList().get(name2);
        if (player2 == null) {

          final String text = "Player \"" + name2 + "\" not found";
          admin.sendPrivateText(text);
          logger.debug(text);
          return;
        }
      }

      final StendhalRPZone zone = player2.getZone();
      final int x = player2.getX();
      final int y = player2.getY();

      player1.teleport(zone, x, y, null, admin);

      /*
       * StendhalRPRuleProcessor.get().addGameEvent(admin.getName(),
 
View Full Code Here


    final StendhalRPZone oldZone = entity.getZone();
    final boolean zoneChanged = (oldZone != zone);

    if (entity instanceof RPEntity) {
      final RPEntity rpentity = (RPEntity) entity;

      rpentity.stop();
      rpentity.stopAttack();
      rpentity.clearPath();
    }

    Sheep sheep = null;
    Pet pet = null;
View Full Code Here

  @Override
  public void perform(final Player player, final RPAction action) {
    if (action.has(TARGET)) {
      final String name = action.get(TARGET);
      RPEntity teleported = SingletonRepository.getRuleProcessor().getPlayer(name);

      if (teleported == null) {
        teleported = SingletonRepository.getNPCList().get(name);
        if (teleported == null) {

          final String text = "Player \"" + name + "\" not found";
          player.sendPrivateText(text);
          logger.debug(text);
          return;
        }
      }

      final StendhalRPZone zone = teleported.getZone();
      final int x = teleported.getX();
      final int y = teleported.getY();

      player.teleport(zone, x, y, null, player);
      new GameEvent(player.getName(), TELEPORTTO, action.get(TARGET), zone.getName(), Integer.toString(x), Integer.toString(y)).raise();
    }
  }
View Full Code Here

    }

    final StringBuilder st = new StringBuilder();

    if (target instanceof RPEntity) {
      final RPEntity inspected = (RPEntity) target;

      // display type and name/title of the entity if they are available

      final String type = inspected.get("type");
      st.append("Inspected ");
      if (type != null) {
        st.append(type);
      } else {
        st.append("entity");
      }
      st.append(" is ");

      String name = inspected.getName();
      if (name == null) {
        name = inspected.getTitle();
      }
      if (name != null) {
        st.append("called \"");
        st.append(name);
        st.append("\"");
      } else {
        st.append("unnamed");
      }

      st.append(" and has the following attributes:");

      // st.append(target.toString());
      // st.append("\n===========================\n");
      st.append("\nID: " + action.get("target") + " in " + inspected.getZone().getName() + " at (" + + inspected.getX() + ", " + + inspected.getY()+")");
      st.append("\nATK:    " + inspected.getAtk() + "("
          + inspected.getAtkXP() + ")");
      st.append("\nDEF:    " + inspected.getDef() + "("
          + inspected.getDefXP() + ")");
      st.append("\nHP:     " + inspected.getHP() + " / "
          + inspected.getBaseHP());
      st.append("\nXP:     " + inspected.getXP());
      st.append("\nLevel:  " + inspected.getLevel());
      st.append("\nKarma:  " + inspected.getKarma());
      st.append("\nequips");
     
      for (final RPSlot slot : inspected.slots()) {
        // showing these is either irrelevant, private, or spams too much
        if (slot.getName().equals("!buddy")
          || slot.getName().equals("!ignore")
          || slot.getName().equals("!visited")
          || slot.getName().equals("!tutorial")
View Full Code Here

     */
    if (!(entity instanceof RPEntity)) {
      return;
    }

    final RPEntity rpentity = (RPEntity) entity;

    /*
     * Only effect players?
     */
    if (playersOnly && !(rpentity instanceof Player)) {
View Full Code Here

     */
    if (!(entity instanceof RPEntity)) {
      return;
    }

    final RPEntity rpentity = (RPEntity) entity;

    /*
     * Only effect players?
     */
    if (playersOnly && !(rpentity instanceof Player)) {
      return;
    }

    if (targets.contains(rpentity.getID())) {
      handleMovement(rpentity);
      removeTarget(rpentity);
      handleRemoved(rpentity);
    }
  }
View Full Code Here

     */
    if (!(entity instanceof RPEntity)) {
      return;
    }

    final RPEntity rpentity = (RPEntity) entity;

    if (targets.contains(rpentity.getID())) {
      handleMovement(rpentity);
    }
  }
View Full Code Here

    while (iter.hasNext()) {
      final RPEntity.ID id = iter.next();

      if (zone.has(id)) {
        final RPEntity entity = (RPEntity) zone.get(id);

        if (area.intersects(entity.getArea())) {
          if (!handleInterval(entity)) {
            handleRemoved(entity);
            iter.remove();
          }
        } else {
View Full Code Here

  private void destroyRing(SlotOwner container, final WeddingRing ring, final RPSlot slot) {
    // The players need to be told first, while the ring still
    // exist in the world
    informNearbyPlayers(ring);

    RPEntity player = null;
    if (container instanceof RPEntity) {
      player = (RPEntity) container;
    }

    new ItemLogger().destroy(player, slot, ring, "another ring");
View Full Code Here

   */
  @Test
  public final void testOnUsed() {
    final Chest ch = new Chest();
    assertFalse(ch.isOpen());
    ch.onUsed(new RPEntity() {

      @Override
      protected void dropItemsOn(final Corpse corpse) {
      }

      @Override
      public void logic() {

      }
    });

    assertTrue(ch.isOpen());
    ch.onUsed(new RPEntity() {

      @Override
      protected void dropItemsOn(final Corpse corpse) {
      }

View Full Code Here

TOP

Related Classes of games.stendhal.server.entity.RPEntity

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.