Exemplo n.º 1
0
  /** Move without alerting others to your presence as you enter in the same room as them */
  @Override
  public void execute(Mob mob, String input) {

    Ability sneak = mob.getLearned().getAbility(SNEAK);

    if (sneak == null || sneak.isNull()) {
      mob.out("You have no knowledge of sneak");
      return;
    }

    if (mob.isSneaking()) {
      mob.out("You are already sneaking around");
    }

    if (sneak.isSuccessful(mob)) {
      mob.out(new Msg(mob, "<S-You/NAME> successfully start to sneak"));

      mob.getMobStatus().setSneaking(60); // 1 minute of sneaking around.
    }
  }
Exemplo n.º 2
0
  @Override
  public void execute(Mob mob, String input) {

    String bagString = getLastWord(input);

    Item bag = mob.getInventory().get(bagString);

    if (bag == null) {
      bag = mob.getRoom().getInventory().get(bagString);
    }

    if (bag == null) {
      mob.out("There is no bag to put stuff into");
      return;
    }

    if (!bag.isContainer()) {
      mob.out("You can not put things into " + bag.getName());
      return;
    }

    String target = getFirstWord(input);

    Item anItem = mob.getInventory().get(target);

    if (anItem == null) {
      mob.out("Can not put " + target + " it is not here!");
      return;
    }

    if (anItem == bag) {
      mob.out("You can not put something into itself");
      return;
    }

    Bag aBag = (Bag) bag;

    if (bag instanceof Chest) {
      if (((Chest) bag).getState() != DoorState.OPEN) {
        mob.out("That item is not open");
        return;
      }
    }

    aBag.getInventory().add(anItem);
    mob.getInventory().remove(anItem);

    mob.out("You put an " + anItem.getName() + " into a " + bag.getName());
  }