Examples of RPSlot


Examples of marauroa.common.game.RPSlot

    player.setSoloKill("name");
    player.setSharedKill("monster");
    player.setSoloKill("cave rat");

    RPSlot killSlot = player.getSlot("!kills");
    RPObject killStore = killSlot.getFirst();
    final String oldID = killStore.get("id");

    UpdateConverter.updatePlayerRPObject(player);

    killSlot = player.getSlot("!kills");
    killStore = killSlot.getFirst();

    final String idDot = killStore.get(oldID + ".id");
    assertEquals(null, idDot);

    assertTrue(player.hasKilled("name"));
View Full Code Here

Examples of marauroa.common.game.RPSlot

      if (object instanceof NPC) {
        npcs.remove(object);
      }

      final RPSlot slot = object.getContainerSlot();
      return slot.remove(object.getID());
    } else {
      return remove(object.getID());
    }
  }
View Full Code Here

Examples of marauroa.common.game.RPSlot

    }

    final Entity baseEntity = (Entity) base;

    if (baseEntity.hasSlot(action.get(ATTR_BASESLOT))) {
      final RPSlot slot = baseEntity.getSlot(action.get(ATTR_BASESLOT));

      if (slot.size() == 0) {
        return null;
      }

      RPObject object = null;
      final int item = action.getInt(ATTR_BASEITEM);
      // scan through the slot to find the requested item
      for (final RPObject rpobject : slot) {
        if (rpobject.getID().getObjectID() == item) {
          object = rpobject;
          break;
        }
      }

      // no item found... we take the first one
      if (object == null) {
        object = slot.iterator().next();
      }

      // It is always an entity
      return (Entity) object;
    }
View Full Code Here

Examples of marauroa.common.game.RPSlot

            }

            final Entity baseEntity = (Entity) base;

            if (baseEntity.hasSlot(action.get(ATTR_BASESLOT))) {
                final RPSlot slot = baseEntity.getSlot(action.get(ATTR_BASESLOT));
                if (!(slot instanceof EntitySlot)) {
                    return null;
                }
                return (EntitySlot) slot;
            }
View Full Code Here

Examples of marauroa.common.game.RPSlot

        item.put("logid", rpobject.get("logid"));
      }
     
      // Contents, if the item has slot(s)
      for (RPSlot slot : rpobject.slots()) {
        RPSlot itemSlot = item.getSlot(slot.getName());
        for (RPObject obj : slot) {
          // Transform the contents too
          itemSlot.add(transform(obj));
        }
      }
     
      return item;
    } else {
View Full Code Here

Examples of marauroa.common.game.RPSlot

   */
  public EntitySlot getEntitySlot(String name) {
    if (!super.hasSlot(name)) {
      return null;
    }
    RPSlot slot = super.getSlot(name);
    if (!(slot instanceof EntitySlot)) {
      return null;
    }
    return (EntitySlot) slot;
  }
View Full Code Here

Examples of marauroa.common.game.RPSlot

    final String[] slotsItems = { "bag", "rhand", "lhand", "head", "armor",
        "legs", "feet", "finger", "cloak", "keyring", "trade" };

    try {
      for (final String slotName : slotsItems) {
        final RPSlot slot = player.getSlot(slotName);
        final PlayerSlot newSlot;
        if (slotName.equals("keyring")) {
          newSlot = new PlayerKeyringSlot(slotName);
        } else if (slotName.equals("trade")) {
          newSlot = new PlayerTradeSlot(slotName);
        } else {
          newSlot = new PlayerSlot(slotName);
        }
        loadSlotContent(player, slot, newSlot);
      }

      for (final Banks bank : Banks.values()) {
        final RPSlot slot = player.getSlot(bank.getSlotName());
        final PlayerSlot newSlot = new BankSlot(bank);
        loadSlotContent(player, slot, newSlot);
      }
    } catch (final RuntimeException e) {
      logger.error("cannot create player", e);
View Full Code Here

Examples of marauroa.common.game.RPSlot

    // load spells
    // use list of slot names to make code easily extendable in case spell can be put into
    // different slots
    final List<String> slotsSpells = Arrays.asList("spells");
    for(String slotName : slotsSpells) {
      RPSlot slot = player.getSlot(slotName);
      List<RPObject> objects = new LinkedList<RPObject>();
      // collect objects from slot before clearing and transforming
      for (final RPObject objectInSlot : slot) {
        objects.add(objectInSlot);
      }
      // clear the slot
      slot.clear();
      SpellTransformer transformer = new SpellTransformer();
      //transform rpobjects in slot to spell
      for(RPObject o : objects) {
        Spell s = (Spell) transformer.transform(o);
        //only add to slot if transforming was successful
        if(s != null) {
          slot.add(s);
        }
      }
    }
  }
View Full Code Here

Examples of marauroa.common.game.RPSlot

      tellClients();
    }
  }

  private void moveItemsBack() {
    RPSlot tradeSlot = player.getSlot("trade");
    List<Item> items = moveItemsFromSlotToList(tradeSlot);
    RPSlot bagSlot = player.getSlot("bag");
    boolean onGround = !moveItemsFromListToSlotOrGround(player, player.getName(), player.getName(), items, bagSlot);
    if (onGround) {
      player.sendPrivateText("Some items did not fit in your bag and have been put on the ground.");
    }
  }
View Full Code Here

Examples of marauroa.common.game.RPSlot

   * transfers items from one person's trade slots to the trade slot of the other person and via versa
   *
   * @param partner partner
   */
  private void transferItems(Player partner) {
        RPSlot playerTradeSlot = player.getSlot("trade");
        RPSlot partnerTradeSlot = partner.getSlot("trade");
        List<Item> playerItems = moveItemsFromSlotToList(playerTradeSlot);
        List<Item> partnerItems = moveItemsFromSlotToList(partnerTradeSlot);

        moveItemsFromListToSlotOrGround(null, player.getName(), partner.getName(), playerItems, partnerTradeSlot);
        moveItemsFromListToSlotOrGround(null, partner.getName(), player.getName(), partnerItems, playerTradeSlot);
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.