Examples of Pet


Examples of com.wordnik.swagger.sample.model.Pet

  @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied"),
      @ApiResponse(code = 404, message = "Pet not found") })
  public Response getPetById(
      @ApiParam(value = "ID of pet that needs to be fetched", allowableValues = "range[1,5]", required = true) @PathParam("petId") String petId)
      throws NotFoundException {
    Pet pet = petData.getPetbyId(ru.getLong(0, 100000, 0, petId));
    if (null != pet) {
      return Response.ok().entity(pet).build();
    } else {
      throw new NotFoundException(404, "Pet not found");
    }
View Full Code Here

Examples of games.stendhal.client.entity.Pet

   */
  @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

Examples of games.stendhal.server.entity.creature.Pet

    pq.onAction(player, action);
    assertThat(player.events().get(0).get("text"), equalTo("No player or pet named \"pet\" is currently logged in."));
 
   
    final Pet testPet = new Cat();
   
    final Sheep testSheep = new Sheep();

    player = PlayerTestHelper.createPlayer("player");
   
View Full Code Here

Examples of games.stendhal.server.entity.creature.Pet

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

    Sheep sheep = null;
    Pet pet = null;

    /*
     * Remove from old zone (if any) during zone change
     */
    if (oldZone != null) {
      /*
       * Player specific pre-remove handling
       */
      if (entity instanceof Player) {
        final Player player = (Player) entity;

        /*
         * Remove and remember dependents
         */
        sheep = player.getSheep();

        if (sheep != null) {
          sheep.clearPath();
          sheep.stop();

          player.removeSheep(sheep);
        }

        pet = player.getPet();

        if (pet != null) {
          pet.clearPath();
          pet.stop();

          player.removePet(pet);
        }
      }

      if (zoneChanged) {
        oldZone.remove(entity);
      }
    }

    /*
     * [Re]position (possibly while between zones)
     */
    entity.setPosition(x, y);

    /*
     * Place in new zone (if needed)
     */
    if (zoneChanged) {
      zone.add(entity);
    }

    /*
     * Player specific post-change handling
     */
    if (entity instanceof Player) {
      final Player player = (Player) entity;

      /*
       * Move and re-add removed dependents
       */
      if (sheep != null) {
        if (placePet(zone, player, sheep)) {
          player.setSheep(sheep);
          sheep.setOwner(player);
        } else {
          // Didn't fit?
          player.sendPrivateText("You seemed to have lost your sheep while trying to squeeze in.");
        }
      }

      if (pet != null) {
        if (placePet(zone, player, pet)) {
          player.setPet(pet);
          pet.setOwner(player);
        } else {
          // Didn't fit?
          player.sendPrivateText("You seemed to have lost your pet while trying to squeeze in.");
        }
      }
View Full Code Here

Examples of games.stendhal.server.entity.creature.Pet

      sheep.notifyWorldAboutChanges();
    }

    // load pet
    final Pet pet = player.getPetOwner().retrievePet();

    if (pet != null) {
      logger.debug("Player has a pet");

      if (!pet.has("base_hp")) {
        pet.initHP(200);
      }

      if (placeAnimalIntoWorld(pet, player)) {
        player.setPet(pet);
      } else {
        logger.warn("Could not place pet: " + pet);
        player.sendPrivateText("You can not seem to locate your "
            + pet.getTitle() + ".");
      }

      pet.notifyWorldAboutChanges();
    }
  }
View Full Code Here

Examples of games.stendhal.server.entity.creature.Pet

    if (sheep != null) {
      player.removeSheep(sheep);
    }

    final Pet pet = player.getPet();

    if (pet != null) {
      player.removePet(pet);
    }
  }
View Full Code Here

Examples of games.stendhal.server.entity.creature.Pet

      if (player.hasSlot("#flock")) {
        player.removeSlot("#flock");
      }
    }

    final Pet pet = player.getPet();

    if (pet != null) {
      pet.getZone().remove(pet);

      /*
       * NOTE: Once the pet is stored there is no more trace of zoneid.
       */
      playerPetManager.storePet(pet);
 
View Full Code Here

Examples of games.stendhal.server.entity.creature.Pet

          new GameEvent(player.getName(), "leave", Integer.toString(sheep.getWeight())).raise();
        } else {
          logger.error("sheep not found in disown action: " + action.toString());
        }
      } else if (species.equals(PET)) {
        final Pet pet = player.getPet();

        if (pet != null) {
          player.removePet(pet);

          // HACK: Avoid a problem on database
          if (pet.has(DB_ID)) {
            pet.remove(DB_ID);
          }
          new GameEvent(player.getName(), "leave", species, Integer.toString(pet.getWeight())).raise();
        } else {
          logger.error("pet not found in disown action: " + action.toString());
        }
      }
    }
View Full Code Here

Examples of games.stendhal.server.entity.creature.Pet

          ConversationPhrases.YES_MESSAGES, null,
          ConversationStates.ATTENDING, null,
          new ChatAction() {
            public void fire(final Player player, final Sentence sentence,
                     final EventRaiser npc) {
              Pet pet = player.getPet();
              String petName = pet.getTitle();
              // these numbers are hardcoded, they're the area in the pet sanctuary which is for pets. It has food spawners.
              int x = Rand.randUniform(2, 12);
              int y = Rand.randUniform(7, 29);
              StendhalRPZone zone = SingletonRepository.getRPWorld().getZone(ZONE_NAME);
              if (StendhalRPAction.placeat(zone, pet, x, y)) {
View Full Code Here

Examples of games.stendhal.server.entity.creature.Pet

      if (squaredDistance(sheep) > (7 * 7)) {
        return false;
      }
    }

    final Pet pet = getPet();

    if (pet != null) {
      if (squaredDistance(pet) > (7 * 7)) {
        return false;
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.