Ejemplo n.º 1
0
 /**
  * Get the VALUE sub token
  *
  * @param pc
  * @return the VALUE sub token
  */
 public static String getValueToken(PlayerCharacter pc) {
   return BigDecimalHelper.trimZeros(pc.totalValue())
       + " "
       + SettingsHandler.getGame().getCurrencyDisplay();
 }
Ejemplo n.º 2
0
  private static String _writeArmorProperty(Equipment eq, String property, PlayerCharacter aPC) {
    CharacterDisplay display = aPC.getDisplay();
    StringBuilder ret = new StringBuilder();

    if (property.startsWith("NAME")) {
      if (eq.isEquipped() && !property.equals("NAMENOSTAR")) {
        ret.append("*");
      }

      ret.append(OutputNameFormatting.parseOutputName(eq, aPC));
      ret.append(eq.getAppliedName());
    } else if (property.startsWith("OUTPUTNAME")) {
      // TODO this appears to be the same as above.  Should be refactored
      if (eq.isEquipped()) {
        ret.append("*");
      }

      ret.append(OutputNameFormatting.parseOutputName(eq, aPC));
      ret.append(eq.getAppliedName());
    } else if (property.startsWith("TOTALAC") || property.startsWith("ACBONUS")) {
      // adjustments for new equipment modifier
      // EQMARMOR|AC|x|TYPE=ENHANCEMENT changed to COMBAT|AC|x|TYPE=Armor.ENHANCEMENT
      // FileAccess.write(output, Delta.toString(eq.getACMod()));
      String acMod = aPC.getControl(CControl.EQACMOD);
      if (acMod != null) {
        Object o = aPC.getLocal(eq, acMod);
        int intValue = ((Number) o).intValue();
        ret.append(Delta.toString(intValue));
      } else {
        ret.append(Delta.toString((int) eq.bonusTo(aPC, "COMBAT", "AC", true)));
      }
    } else if (property.startsWith("BASEAC")) {
      // adjustments for new equipment modifier
      // EQMARMOR|AC|x|TYPE=ENHANCEMENT changed to COMBAT|AC|x|TYPE=Armor.ENHANCEMENT
      // FileAccess.write(output, Delta.toString(eq.getACMod()));
      String baseMod = aPC.getControl(CControl.EQBASEACMOD);
      if (baseMod != null) {
        Object o = aPC.getLocal(eq, baseMod);
        int intValue = ((Number) o).intValue();
        ret.append(Delta.toString(intValue));
      } else {
        ret.append(Delta.toString((int) BonusCalc.charBonusTo(eq, "COMBAT", "AC", aPC)));
      }
    } else if (property.startsWith("MAXDEX")) {
      final int iMax = EqToken.getMaxDexTokenInt(aPC, eq);
      if (iMax != Constants.MAX_MAXDEX) {
        ret.append(Delta.toString(iMax));
      }
    } else if (property.startsWith("ACCHECK")) {
      ret.append(Delta.toString(EqToken.getAcCheckTokenInt(aPC, eq)));
    } else if (property.startsWith("EDR")) {
      ret.append(Delta.toString(EqToken.getEdrTokenInt(aPC, eq)));
    } else if (property.startsWith("ISTYPE")) {
      if (eq.isType(property.substring(property.indexOf(".") + 1))) {
        ret.append("TRUE");
      } else {
        ret.append("FALSE");
      }
    } else if (property.startsWith("SPELLFAIL")) {
      ret.append(EqToken.getSpellFailureTokenInt(aPC, eq));
    } else if (property.startsWith("MOVE")) {
      final StringTokenizer aTok = new StringTokenizer(eq.moveString(), ",", false);
      String tempString = "";

      if (("M".equals(display.getSize()) || "S".equals(display.getSize()))
          && (aTok.countTokens() > 0)) {
        tempString = aTok.nextToken();

        if ("S".equals(display.getSize()) && (aTok.countTokens() > 1)) {
          tempString = aTok.nextToken();
        }
      }

      ret.append(tempString);
    } else if (property.startsWith("SPROP")) {
      ret.append(eq.getSpecialProperties(aPC));
    } else if (property.startsWith("TYPE")) {
      String typeString = "";

      if (eq.isLight()) {
        typeString = "Light";
      } else if (eq.isMedium()) {
        typeString = "Medium";
      } else if (eq.isHeavy()) {
        typeString = "Heavy";
      } else if (eq.isShield()) {
        typeString = "Shield";
      } else if (eq.isExtra()) {
        typeString = "Extra";
      }

      ret.append(typeString);
    } else if (property.startsWith("WT")) {
      ret.append(BigDecimalHelper.trimZeros(eq.getWeight(aPC).toString()));
    }
    return ret.toString();
  }