Package games.stendhal.server.entity.creature

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


    final List<DomesticAnimal> animals = player.getAnimals();

    if (animals.isEmpty()) {
      player.sendPrivateText("You don't own any " + curName);
    } else {
      DomesticAnimal animal = null;

      do {
        animal = player.searchAnimal(curName, false);
        if (animal != null) {
          // remove quotes, if present
          if ((newName.charAt(0) == '\'') && (newName.charAt(newName.length() - 1) == '\'')) {
            newName = newName.substring(1, newName.length() - 1);
          }

          newName = newName.trim();

          // check only if the pet is actually named newName, rather than just recognises it
          if (player.searchAnimal(newName, true) != null) {
            player.sendPrivateText("You own already a pet named '" + newName + "'");
          } else if (newName.length() > 0) {
            if (newName.length() > 20) {
              player.sendPrivateText("The new name of your pet must not be longer than 20 characters.");
            } else {
              final String oldName = animal.getTitle();

              animal.setTitle(newName);

              if (oldName != null) {
                player.sendPrivateText("You changed the name of '" + oldName + "' to '" + newName
                    + "'");

              } else {
                player.sendPrivateText("Congratulations, your " + curName + " is now called '"
                    + newName + "'.");
              }
              new GameEvent(player.getName(), "name", animal.getRPClass().getName(), newName).raise();
            }
          } else {
            player.sendPrivateText("Please don't use empty names.");
          }
        } else {
View Full Code Here


    if (entity != null) {
      if (!checkEntityIsDomesticAnimal(player, entity)) {
        return;
      }

      DomesticAnimal animal = (DomesticAnimal) entity;
      if (!checkNotOwned(player, animal)) {
        return;
      }

      if (!checkEntityIsReachable(player, animal)) {
View Full Code Here

      String[] params = { whoName };

      new GameEvent(player.getName(), WHERE, params).raise();

      final Player who = rules.getPlayer(whoName);
      final DomesticAnimal animal = player.searchAnimal(whoName, false);

      if (who != null) {
        if (who.isGhost() && !who.equals(player)) {
          player.sendPrivateText("No player or pet named \"" + whoName + "\" is currently logged in.");
        } else {
          final StendhalRPZone zone = who.getZone();

          if (zone != null) {
            if (who.equals(player)) {
              player.sendPrivateText("You are in " + zone.getName()
                  + " at (" + who.getX() + "," + who.getY() + ")");
            } else {
              player.sendPrivateText(who.getTitle() + " is in " + zone.getName()
                  + " at (" + who.getX() + "," + who.getY() + ")");
            }
          }
        }
      }

      if (animal != null) {
        player.sendPrivateText("Your " + ItemTools.itemNameToDisplayName(animal.get("type"))
              + " is at (" + animal.getX() + "," + animal.getY() + ")");
      }

      if ((who == null) && (animal == null)) {
        player.sendPrivateText("No player or pet named \"" + whoName + "\" is currently logged in.");
      }
View Full Code Here

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

      for (final RPObject rpObj : zone) {
        if (rpObj instanceof DomesticAnimal) {
          final DomesticAnimal pet = (DomesticAnimal) rpObj;
          final String zoneName = zone.getName();
          res.append("\r\n" + pet.getRPClass().getName());
          res.append(" named " + pet.getTitle());
          res.append(" (" + pet.getLevel() + ")");
          res.append(" at " + zoneName + " " + pet.getX() + " " + pet.getY());
          if (pet.getOwner() != null) {
            res.append(" owned by " + pet.getOwner().getName());
          }
        }
      }

    }
View Full Code Here

TOP

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

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.