Ejemplo n.º 1
0
  private static String getTextAreaContent(Creature creature) {
    StringBuilder sb = new StringBuilder();

    if (creature.getTemplate().getRace().showDetailedDescription()) {
      appendDetails(creature, sb);
    } else {
      sb.append("<div style=\"font-family: medium-blue;\">");
      sb.append(creature.getTemplate().getRace().getName());
      sb.append("</div>");
    }

    synchronized (creature.getEffects()) {
      for (Effect effect : creature.getEffects()) {
        effect.appendDescription(sb);
      }
    }

    for (Inventory.Slot slot : Inventory.Slot.values()) {
      Item item = creature.inventory.getEquippedItem(slot);
      if (item == null) continue;

      if (item != null) {
        synchronized (item.getEffects()) {
          for (Effect effect : item.getEffects()) {
            effect.appendDescription(sb);
          }
        }
      }
    }

    return sb.toString();
  }
Ejemplo n.º 2
0
  private static void appendDetails(Creature creature, StringBuilder sb) {
    sb.append("<div style=\"font-family: medium;\">");
    sb.append(creature.getTemplate().getGender()).append(' ');
    sb.append("<span style=\"font-family: medium-blue;\">")
        .append(creature.getTemplate().getRace().getName())
        .append("</span>");
    sb.append("</div>");

    sb.append("<div style=\"font-family: medium; margin-bottom: 1em\">");
    for (String roleID : creature.roles.getRoleIDs()) {
      Role role = Game.ruleset.getRole(roleID);
      int level = creature.roles.getLevel(role);

      sb.append("<p>");
      sb.append("Level <span style=\"font-family: medium-italic;\">")
          .append(level)
          .append("</span> ");
      sb.append("<span style=\"font-family: medium-red;\">")
          .append(role.getName())
          .append("</span>");
      sb.append("</p>");
    }
    sb.append("</div>");

    sb.append("<div style=\"font-family: medium; margin-bottom: 1em\">");
    sb.append("Hit Points ");
    sb.append("<span style=\"font-family: medium-italic-green\">");
    sb.append(creature.getCurrentHitPoints())
        .append("</span> / <span style=\"font-family: medium-italic-green\">");
    sb.append(creature.stats.get(Stat.MaxHP)).append("</span>");
    sb.append("</div>");

    Item mainHand = creature.getMainHandWeapon();
    Item offHand = creature.inventory.getEquippedItem(Inventory.Slot.OffHand);

    sb.append("<div style=\"margin-bottom: 1em; font-family: medium;\"><p>Main hand</p>");
    sb.append("<div style=\"font-family: medium-italic-blue\">");
    sb.append(mainHand.getTemplate().getName()).append("</div></div>");

    if (offHand != null) {
      sb.append("<div style=\"margin-bottom: 1em; font-family: medium;\"><p>Off hand</p>");
      sb.append("<div style=\"font-family: medium-italic-blue\">");
      sb.append(offHand.getTemplate().getName()).append("</div></div>");
    }
  }