Package org.groovymud.object.room

Examples of org.groovymud.object.room.Room


      logger.error(e, e);
    }
  }

  public void writeLookFooter(Alive looker, MudObject target) {
    Room room = (Room) target;
    Set exits = room.getExitInventory().getMudObjects();
    ExtendedTerminalIO stream = looker.getTerminalOutput();
    try {
      stream.write(colorizeText("There " + (exits.size() == 1 && exits.size() != 0 ? "is" : "are") + " " + pluralize("exit", exits.size()) + ": ", CYAN));
      Iterator iter = exits.iterator();
      int i = 0;
View Full Code Here


   * Test method for
   * 'org.groovymud.object.registry.Registry.addRoom(BaseRoom)'
   */
  public void testAddRoom() {
    MockControl mockCtrl = MockControl.createNiceControl(Room.class);
    final Room mockRoom = (Room) mockCtrl.getMock();
    MockControl obsCtrl = MockClassControl.createControl(Observable.class);
    final Observable obs = (Observable) obsCtrl.getMock();

    MockControl invCtrl = MockClassControl.createControl(InventoryHandler.class);
    final InventoryHandler inv = (InventoryHandler) invCtrl.getMock();

    Registry reg = new Registry(null) {

      @Override
      public void addMudObject(MudObject object) {
        // TODO Auto-generated method stub
        assertSame(mockRoom, object);
      }

      @Override
      public InventoryHandler getInventoryHandler() {
        // TODO Auto-generated method stub
        return inv;
      }

    };
    mockRoom.getContainerLocation();
    ObjectLocation loc = new ObjectLocation();
    loc.setDefinition("tomb/tomb1.groovy");
    loc.setBeanId("id");
    mockCtrl.setDefaultReturnValue(loc);
    mockRoom.setCurrentContainer(reg);
    mockCtrl.setDefaultVoidCallable();
    mockCtrl.replay();
    inv.addMudObject("id", mockRoom);
    invCtrl.setDefaultVoidCallable();
    invCtrl.replay();
View Full Code Here

      logger.error(e, e);
    }
  }

  public void writeLookBody(Alive looker, MudObject target) {
    Room container = (Room) target;
    ExtendedTerminalIO stream = looker.getTerminalOutput();

    try {
      writeDynamicText(looker, target, target.getDescription());

      if (container.getInventoryHandler().getMudObjectsMap(false).size() > 0) {
        stream.write("You see: ");
        super.writeLookBody(looker, target);
        stream.writeln(".");
      }
      Map<String, Set<MudObject>> alive = container.getInventoryHandler().getMudObjectsMap(true);
      ContentsHelper contentsHelper = createContentsHelper();
      String aliveContents = contentsHelper.getContentsDescription(alive, looker, true);

      int aliveSize = container.getInventoryHandler().size(true) - 1;
      if (aliveSize > 0) {
        stream.write(colorizeText(aliveContents, GREEN));
      }
      if (aliveSize > 0) {
        stream.writeln(aliveSize > 1 ? " are here." : " is here.");
View Full Code Here

TOP

Related Classes of org.groovymud.object.room.Room

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.