Example #1
0
  public void setGiveItem(String give_) {
    String elements[] = give_.split(" ");

    if (elements.length < 3) {
      LOGGER.error("Give needs to be [mob] [room] [item] <load percentage>");
      return;
    }

    Mob mob = World.getRoom(elements[1]).getMob(elements[0]);

    if (mob == null) {
      LOGGER.error("Mob was null for id: " + elements[0]);
      return;
    }

    Item item = EntityProvider.createItem(elements[2]);

    if (item == null) {
      LOGGER.error("Item was null for id: " + elements[2]);
      return;
    }

    if (elements.length == 4) {
      item.setLoadPercentage(Integer.parseInt(elements[3]));
    }

    if (item.isLoaded()) {
      mob.getInventory().add(item); // Gives to room mob only.
    }
  }
Example #2
0
  /**
   * Mob then item space seperated then load percentage for item
   *
   * @param give_
   */
  public void setGive(String give_) {
    String elements[] = give_.split(" ");

    if (elements.length < 2) {
      LOGGER.error("Give needs to be [mob] [item] <load percentage>");
      return;
    }
    Mob mob = World.getMob(elements[0]);
    Item item = EntityProvider.createItem(elements[1]);
    mob.getInventory().add(item); // Gives to template mob only

    if (elements.length == 3) {
      item.setLoadPercentage(Integer.parseInt(elements[2]));
    }
  }
Example #3
0
 public static void inveDagger(Mob player1Mob) {
   player1Mob.getInventory().add(makeDagger());
 }