Package games.stendhal.client.gui.chatlog

Examples of games.stendhal.client.gui.chatlog.StandardEventLine


    if (!attackers.isEmpty()) {
      Collection<String> attackerNames = new LinkedList<String>();
      for (Entity ent : attackers) {
          attackerNames.add(ent.getTitle());
      }
      ClientSingletonRepository.getUserInterface().addEventLine(new StandardEventLine(
          getTitle() + " has been killed by " + Grammar.enumerateCollection(attackerNames)));
    }
  }
View Full Code Here


    boolean play = Boolean.parseBoolean(WtWindowManager.getInstance().getProperty("sound.play", "true"));
    play = !play;
    WtWindowManager.getInstance().setProperty("sound.play", Boolean.toString(play));
    ClientSingletonRepository.getSound().mute(!play, true, new Time(2, Time.Unit.SEC));
    if (play) {
      ClientSingletonRepository.getUserInterface().addEventLine(new StandardEventLine("Sounds are now on."));
    } else {
      ClientSingletonRepository.getUserInterface().addEventLine(new StandardEventLine("Sounds are now off."));
    }
    return true;
  }
View Full Code Here

   */
  public boolean execute(final String[] params, final String remainder) {
    if (params[0] == null) {
      float volume = ClientSingletonRepository.getSound().getVolume();
      UserInterface ui = ClientSingletonRepository.getUserInterface();
      ui.addEventLine(new StandardEventLine("Please use /volume <name> <value> to adjust the volume."));
      ui.addEventLine(new HeaderLessEventLine("<name> is an item from the following list. \"master\" refers to the global volume setting.", NotificationType.CLIENT));
      ui.addEventLine(new HeaderLessEventLine("<value> is in the range from 0 to 100 but may be set higher.", NotificationType.CLIENT));
      ui.addEventLine(new HeaderLessEventLine("master -> " + Numeric.floatToInt(volume, 100.0f), NotificationType.CLIENT));

      for (String name : ClientSingletonRepository.getSound().getGroupNames()) {
View Full Code Here

        if (groupName.equals("master")) {
          int volume = Integer.parseInt(volumeString);
          ClientSingletonRepository.getSound().changeVolume(Numeric.intToFloat(volume, 100.0f));
          WtWindowManager.getInstance().setProperty("sound.volume." + groupName, Integer.toString(volume));
        } else {
          ClientSingletonRepository.getUserInterface().addEventLine(new StandardEventLine("No sound group \"" + groupName + "\" does exist"));
          ClientSingletonRepository.getUserInterface().addEventLine(new StandardEventLine("Please type \"/volume show\" for a valid list of groups"));
        }
      }
    } catch (NumberFormatException exception) {
      ClientSingletonRepository.getUserInterface().addEventLine(new HeaderLessEventLine(volumeString + " is not a valid number", NotificationType.ERROR));
    }
View Full Code Here

    // Is there a numeric expression as first parameter?
    if (params[0].matches("[0-9].*")) {
      try {
        quantity = Integer.parseInt(params[0]);
      } catch (final NumberFormatException ex) {
        ClientSingletonRepository.getUserInterface().addEventLine(new StandardEventLine("Invalid quantity: " + params[0]));
        return true;
      }

      itemName = remainder;
    } else {
      quantity = 1;
      itemName = (params[0] + " " + remainder).trim();
    }

    final String singularItemName = Grammar.singular(itemName);

    for (final String slotName : Constants.CARRYING_SLOTS) {
      int itemID = User.get().findItem(slotName, itemName);

      // search again using the singular, in case it was a plural item name
      if ((itemID == -1) && !itemName.equals(singularItemName)) {
        itemID = User.get().findItem(slotName, singularItemName);
      }

      if (itemID != -1) {
        final RPAction drop = new RPAction();

        drop.put(EquipActionConsts.TYPE, "drop");
        drop.put(EquipActionConsts.BASE_OBJECT, User.get().getObjectID());
        drop.put(EquipActionConsts.BASE_SLOT, slotName);
        drop.put(EquipActionConsts.GROUND_X, (int) User.get().getX());
        drop.put(EquipActionConsts.GROUND_Y, (int) User.get().getY());
        drop.put(EquipActionConsts.QUANTITY, quantity);
        drop.put(EquipActionConsts.BASE_ITEM, itemID);

        ClientSingletonRepository.getClientFramework().send(drop);
        return true;
      }
    }
    ClientSingletonRepository.getUserInterface().addEventLine(new StandardEventLine("You don't have any " + singularItemName));
    return true;
  }
View Full Code Here

   *            Line content after parameters.
   *
   * @return <code>true</code> if was handled.
   */
  public boolean execute(final String[] params, final String remainder) {
    j2DClient.get().addEventLine(new StandardEventLine("This command is outdated. Please use \"/volume\" for changing the volume and \"/mute\" for muting all audio"));
    return true;
  }
View Full Code Here

  public boolean execute(String[] params, String remainder) {
    boolean doubleClick = Boolean.parseBoolean(WtWindowManager.getInstance().getProperty("ui.doubleclick", "false"));
    doubleClick = !doubleClick;
    WtWindowManager.getInstance().setProperty("ui.doubleclick", Boolean.toString(doubleClick));
    if (doubleClick) {
      ClientSingletonRepository.getUserInterface().addEventLine(new StandardEventLine("Click mode is now set to double click."));
    } else {
      ClientSingletonRepository.getUserInterface().addEventLine(new StandardEventLine("Click mode is now set to single click."));
    }
    return true;
  }
View Full Code Here

   * @return <code>true</code> if was handled.
   */
  public boolean execute(String[] params, String remainder) {
    String oldValue = WtWindowManager.getInstance().getProperty(params[0], "{undefined}");
    if ((remainder == null) || remainder.equals("")) {
      ClientSingletonRepository.getUserInterface().addEventLine(new StandardEventLine(
          params[0] + "=" + oldValue));
      return true;
    }

    WtWindowManager.getInstance().setProperty(params[0], remainder);
    ClientSingletonRepository.getUserInterface().addEventLine(new StandardEventLine(
        "Changed configuration property " + params[0] + " from \"" + oldValue + "\" to \"" + remainder + "\"."));
    return true;
  }
View Full Code Here

    //TODO refactor with same code in DropAction.execute()
    if (params[2].matches("[0-9].*")) {
        try {
          amount = Integer.parseInt(params[2]);
        } catch (final NumberFormatException ex) {
          ClientSingletonRepository.getUserInterface().addEventLine(new StandardEventLine("Invalid amount: " + params[2]));
          return true;
        }

        itemName = remainder;
    } else {
View Full Code Here

   */
  public ScriptRecorder(final String classname) throws FileNotFoundException {
    this.classname = classname;
    filename = System.getProperty("java.io.tmpdir") + "/" + classname
        + ".java";
    j2DClient.get().addEventLine(new StandardEventLine("Starting recoding to " + filename));
    lastTimestamp = 0;
    ps = new PrintStream(filename);
  }
View Full Code Here

TOP

Related Classes of games.stendhal.client.gui.chatlog.StandardEventLine

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.