Examples of RPSlot


Examples of marauroa.common.game.RPSlot

   *
   * @return A pet, or <code>null</code> if none.
   */
  public Pet retrievePet() {
    if (player.hasSlot("#pets")) {
      final RPSlot slot = player.getSlot("#pets");

      if (slot.size() > 0) {
        final RPObject object = slot.getFirst();
        slot.remove(object.getID());

        player.removeSlot("#pets");

        if (object.get("type").equals("cat")) {
          return new Cat(object, player);
View Full Code Here

Examples of marauroa.common.game.RPSlot

    }
  }

  private void loadSlotContent() {
    if (hasSlot("content")) {
      final RPSlot slot = getSlot("content");
      final List<RPObject> objects = new LinkedList<RPObject>();
      for (final RPObject objectInSlot : slot) {
        objects.add(objectInSlot);
      }
      slot.clear();
      removeSlot("content");

      final RPSlot newSlot = new ChestSlot(this);
      addSlot(newSlot);
     
      // Restore the stored items
      ItemTransformer transformer = new ItemTransformer();
      for (final RPObject rpobject : objects) {
        try {
          Item item = transformer.transform(rpobject);
         
          // log removed items
          if (item == null) {
            int quantity = 1;
            if (rpobject.has("quantity")) {
              quantity = rpobject.getInt("quantity");
            }
            logger.warn("Cannot restore " + quantity + " "
                + rpobject.get("name") + " of stored chest "
                + " because this item"
                + " was removed from items.xml");
            continue;
          }

          newSlot.add(item);
        } catch (final Exception e) {
          logger.error("Error adding " + rpobject + " to stored chest slot", e);
        }
      }
    }
View Full Code Here

Examples of marauroa.common.game.RPSlot

    }
    setQuest(name, res.toString());
  }
 
  public List<String> getQuests() {
    final RPSlot slot = player.getSlot("!quests");
    final RPObject quests = slot.iterator().next();

    final List<String> questsList = new LinkedList<String>();
    for (final String quest : quests) {
      if (!quest.equals("id") && !quest.equals("zoneid")) {
        questsList.add(quest);
View Full Code Here

Examples of marauroa.common.game.RPSlot

  public Chest() {
    setRPClass(CHEST_RPCLASS_NAME);
    put("type", CHEST_RPCLASS_NAME);
    open = false;

    final RPSlot slot = new ChestSlot(this);
    addSlot(slot);
  }
View Full Code Here

Examples of marauroa.common.game.RPSlot

    super(object);
    setRPClass(CHEST_RPCLASS_NAME);
    put("type", CHEST_RPCLASS_NAME);

    if (!hasSlot("content")) {
      final RPSlot slot = new ChestSlot(this);
      addSlot(slot);
    }

    update();
  }
View Full Code Here

Examples of marauroa.common.game.RPSlot

   *
   * @param entity
   *            entity to add
   */
  public void add(final PassiveEntity entity) {
    final RPSlot content = getSlot("content");
    content.add(entity);
  }
View Full Code Here

Examples of marauroa.common.game.RPSlot

   * Returns the content.
   *
   * @return iterator for the content
   */
  public Iterator<RPObject> getContent() {
    final RPSlot content = getSlot("content");
    return content.iterator();
  }
View Full Code Here

Examples of marauroa.common.game.RPSlot

      while (base.isContained()) {
        base = base.getContainer();
      }

      final RPSlot slot = getContainerSlot();
      slot.remove(getID());

      SingletonRepository.getRPWorld().modify(base);
    } else {
      SingletonRepository.getRPWorld().remove(getID());
    }
View Full Code Here

Examples of marauroa.common.game.RPSlot

    String slotName = get("slot_name");
    if (slotName == null) {
      slotName = DEFAULT_SLOT_NAME;
    }
   
    RPSlot slot = new ContainerItemSlot(DEFAULT_SLOT_NAME, slotName);
    addSlot(slot);
  }
View Full Code Here

Examples of marauroa.common.game.RPSlot

      // Port from 0.57 to 0.58: skills
      for (final String slotName : slotsSpecial) {
        if (!object.hasSlot(slotName)) {
          object.addSlot(new KeyedSlot(slotName));
        }
        final RPSlot slot = object.getSlot(slotName);
        if (slot.size() == 0) {
          final RPObject singleObject = new RPObject();
          slot.add(singleObject);
        }
      }

      // Port from 0.30 to 0.35
      if (!object.has("atk_xp")) {
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.