Package games.stendhal.server.entity.creature

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


      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

      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

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

    final Pet pet = player.getPet();

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

      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

          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

          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

      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

                 final EventRaiser npc) {
          if(!player.hasPet()){
            npc.say("That's a cute sheep you have there, but I need a baby dragon for Mr Yeti. Try Morgrin at the magic school.");
            return;
          }
          Pet pet = player.getPet();
          String petType = pet.get("type");
          if("baby_dragon".equals(petType)) {
            player.removePet(pet);
            npc.say("Ah you brought the baby dragon! It will make such a wonderful stew. Baby dragon stew is my speciality and Mr Yeti loves it! You've made us both very happy! Come back in a day to see me for a #reward.");
            player.addKarma(5.0);
            player.addXP(500);
            pet.delayedDamage(pet.getHP(), "Mrs. Yeti");
            player.setQuest(QUEST_SLOT,"reward;"+System.currentTimeMillis());
            player.notifyWorldAboutChanges();
          } else {
            npc.say("That's a cute pet you have there, but I need a baby dragon for Mr Yeti. Try Morgrin at the magic school.")
          }
View Full Code Here

TOP

Related Classes of games.stendhal.server.entity.creature.Pet

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.