Package marauroa.common.game

Examples of marauroa.common.game.RPSlot


  @Test
  public void testTransformUnderscore() {
    RPObject obje = new RPObject();
    obje.put("name", "bob");
    obje.setID(new RPObject.ID(1,"testzone"));
    RPSlot slot = new RPSlot("bag");
   
    obje.addSlot(slot);
    slot.add(new Item("leather_armor","clazz","subclass",null));
    RPObject transObj = new PlayerTransformer().transform(obje);
    assertTrue(transObj.hasSlot("bag"));
   
    assertThat(transObj.getSlot("bag").getFirst().get("name"), is("leather armor"));
  }
View Full Code Here


  @Test
  public void testTransformBind() {
    RPObject obje = new RPObject();
    obje.put("name", "bob");
    obje.setID(new RPObject.ID(1,"testzone"));
    RPSlot slot = new RPSlot("bag");
   
    obje.addSlot(slot);
    Item item = new Item("lich gold key","clazz","subclass",null);
     slot.add(item);
   
    assertFalse(item.isBound());
   
    RPObject transObj = new PlayerTransformer().transform(obje);
    assertTrue(transObj.hasSlot("bag"));
    RPSlot bag = transObj.getSlot("bag");
    RPObject transItem = bag.getFirst();
    assertTrue(((Item) transItem).isBound());
  }
View Full Code Here

  @Test
  public void testTransformUnBind() {
    RPObject obje = new RPObject();
    obje.put("name", "bob");
    obje.setID(new RPObject.ID(1,"testzone"));
    RPSlot slot = new RPSlot("bag");
   
    obje.addSlot(slot);
   
    Item item = new Item("marked scroll","clazz","subclass",null);
    item.setBoundTo("bob");   
     slot.add(item);
    assertTrue(item.isBound());
   
    RPObject transObj = new PlayerTransformer().transform(obje);
    assertTrue(transObj.hasSlot("bag"));
    RPSlot bag = transObj.getSlot("bag");
    RPObject transItem = bag.getFirst();
    assertFalse(((Item) transItem).isBound());
  }
View Full Code Here

      html.append("<p>" + event.get("caption") + "</p><br>");
    }
    html.append("<table border=\"1\" width=\"400px\">");
    html.append("<tr><th>Item</th><th>Price</th><th>Description</th></tr>");

    RPSlot slot = event.getSlot("content");
    for (RPObject item : slot) {
      createRow(html, item);
    }

   
View Full Code Here

   * Updates the player slot panels.
   */
  private void refreshContents() {
    // traverse all displayed slots
    for (final Entry<String, ItemPanel> entry : slotPanels.entrySet()) {
      final RPSlot slot = player.getSlot(entry.getKey());
     
      if (slot == null) {
        continue;
      }

      final ItemPanel entitySlot = entry.getValue();

      if (entitySlot != null) {
        entitySlot.setParent(player);

        final Iterator<RPObject> iter = slot.iterator();

        if (iter.hasNext()) {
          final RPObject object = iter.next();

          IEntity entity = GameObjects.getInstance().get(object);
View Full Code Here

    // Clear the panels, in case they are not already empty
    for (ItemPanel panel : panels) {
      panel.setEntity(null);
    }
    final RPSlot rpslot = parent.getSlot(slotName);
    // Treat the entire slot contents as a content change
    contentAdded(rpslot);
  }
View Full Code Here

      return;
    }

    // find the player and slot
    final Player player = SingletonRepository.getRuleProcessor().getPlayer(args.get(0));
    final RPSlot slot = player.getSlot("!tutorial");

    // remove old store object
    final RPObject rpObject = slot.iterator().next();
    slot.remove(rpObject.getID());

    // create new store object
    slot.add(new RPObject());

    // notify the player
    player.sendPrivateText("Your tutorial state was reset by "
        + admin.getTitle());
  }
View Full Code Here

    super.put(TITLE, title);
    if (caption != null) {
      super.put(CAPTION, caption);
    }
    super.addSlot(CONTENT_SLOT);
    RPSlot slot = super.getSlot(CONTENT_SLOT);
    for (Item item : items) {
      slot.add(item);
    }
  }
View Full Code Here

    for (final EquipItem equippedItem : items) {
      if (!hasSlot(equippedItem.slot)) {
        addSlot(new EntitySlot(equippedItem.slot, equippedItem.slot));
      }

      final RPSlot slot = getSlot(equippedItem.slot);
      final Item item = SingletonRepository.getEntityManager().getItem(equippedItem.name);

      if (item instanceof StackableItem) {
        ((StackableItem) item).setQuantity(equippedItem.quantity);
      }

      slot.add(item);
    }
  }
View Full Code Here

    put("stage", stage);
    // default to player corpse image
    put(ATTR_IMAGE, "player");
    setResistance(calculateResistance());
   
    final RPSlot slot = new LootableSlot(this);
    addSlot(slot);
  }
View Full Code Here

TOP

Related Classes of marauroa.common.game.RPSlot

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.