Package games.stendhal.client.entity

Examples of games.stendhal.client.entity.User


    assertEquals("Pick up cursor",
        cursors.get(StendhalCursor.ITEM_PICK_UP_FROM_SLOT).toString(),
        panel.getCursor().toString());
   
    // Repeat the checks with an user owned slot
    User user = new User();
    panel.setParent(user);
    /*
     * Comparing empty slots first because normally the parent of the slot
     * does not change from User to a non-user or vice versa, so ItemPanel
     * does not handle the situation.
View Full Code Here


    rpo.put("type", "player");
    rpo.put("name", "player");
    rpo.setID(new ID(USER_ID, ZONE_NAME));

    final User pl = new User();
    pl.initialize(rpo);

    for (final String slotName : Constants.CARRYING_SLOTS) {
      rpo.addSlot(slotName);
    }
View Full Code Here

    try {
      final String type = object.getRPClass().getName();
      if (type.equals("player") && object.has("name")) {
        if (StendhalClient.get().getCharacter().equalsIgnoreCase(
            object.get("name"))) {
          final User me = new User();
          me.initialize(object);
          EventDispatcher.dispatchEvents(object, me);
          return me;
        }
      }
View Full Code Here

    list.remove(ActionType.TRADE.getRepresentation());

    list.add(ActionType.SET_OUTFIT.getRepresentation());
    list.add(ActionType.WHERE.getRepresentation());

    User user = (User) entity;
    if (user != null) {
      if (user.hasSheep()) {
        list.add(ActionType.LEAVE_SHEEP.getRepresentation());
      }

      if (user.hasPet()) {
        list.add(ActionType.LEAVE_PET.getRepresentation());
      }
    }
  }
View Full Code Here

  }
 
  @Override
  public void draw(final Graphics g, final int scale) {
    // we check this here rather than in the MapPanel so that any changes to the user are refreshed (e.g. disowning pet)
    User user = User.get();
    if ((user.hasPet() && user.getPetID() == domesticanimal.getObjectID()) || (user.hasSheep() && user.getSheepID() == domesticanimal.getObjectID())) {
      draw(g, scale, drawColor);
    }
  }
View Full Code Here

   *            The list to populate.
   */
  @Override
  protected void buildActions(final List<String> list) {
    super.buildActions(list);
    User user = User.get();
    Pet pet = (Pet) entity;
    if (user != null) {
      if (!user.hasPet()) {
        list.add(ActionType.OWN.getRepresentation());
      } else if ((pet != null) && (user.getPetID() == pet.getID().getObjectID())) {
        list.add(ActionType.LEAVE_PET.getRepresentation());
      }
    }
  }
View Full Code Here

   *            The list to populate.
   */
  @Override
  protected void buildActions(final List<String> list) {
    super.buildActions(list);
    User user = User.get();
    Sheep sheep = (Sheep) entity;

    if (user != null) {
      if (!user.hasSheep()) {
        list.add(ActionType.OWN.getRepresentation());
      } else if ((sheep != null) && (user.getSheepID() == sheep.getID()
          .getObjectID())) {
        list.add(ActionType.LEAVE_SHEEP.getRepresentation());
      }
    }
  }
View Full Code Here

            minimap.update(cd, pd, gameLayers.getArea());
          }
          gameLayers.resetChangedArea();
        }

        final User user = User.get();

        if (user != null) {
          // check if the player object has changed.
          // Note: this is an exact object reference check
          if (user != lastuser) {
View Full Code Here

       * Ctrl means face, otherwise move
       */
      final Direction direction = keyCodeToDirection(e.getKeyCode());

      if (e.isAltGraphDown()) {
        final User user = User.get();

        final EntityView view = screen.getEntityViewAt(user.getX()
            + direction.getdx(), user.getY() + direction.getdy());

        if (view != null) {
          final IEntity entity = view.getEntity();
          if (!entity.equals(user)) {
            view.onAction();
View Full Code Here

   *
   * @return <code>true</code> if the user is close enough to have the window
   *   open, <code>false</code> otherwise.
   */
  public boolean isCloseEnough() {
    final User user = User.get();

    if ((user != null) && (parent != null)) {
      // null checks are fixes for Bug 1825678:
      // NullPointerException happened
      // after double clicking one
      // monster and a fast double
      // click on another monster
     
      // Check if the parent is user
      RPObject root = parent.getRPObject().getBaseContainer();
      // We don't want to close our own stuff
      // The root entity may have been removed, but still if it was
      // the user we do not want to close it.
      // User may have been changed by the main thread, so we can not rely
      // on user.getRPObject() being equal to root. (bug #3159058)
      final String type = root.getRPClass().getName();
      if (type.equals("player") && root.has("name")) {
        if (StendhalClient.get().getCharacter().equalsIgnoreCase(
            root.get("name"))) {
          return true;
        }
      }

      return isCloseEnough(user.getX(), user.getY());
    }

    return true;
  }
View Full Code Here

TOP

Related Classes of games.stendhal.client.entity.User

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.