Esempio n. 1
0
 protected String mobHeader(Faction useFaction) {
   final StringBuffer str = new StringBuffer();
   str.append("\n\r");
   str.append(CMStrings.padRight(L("Name"), 20) + " ");
   str.append(CMStrings.padRight(L("Lvl"), 4) + " ");
   str.append(CMStrings.padRight(L("Att"), 5) + " ");
   str.append(CMStrings.padRight(L("Dmg"), 5) + " ");
   str.append(CMStrings.padRight(L("Armor"), 5) + " ");
   str.append(CMStrings.padRight(L("Speed"), 5) + " ");
   str.append(CMStrings.padRight(L("Rejuv"), 5) + " ");
   if (useFaction != null) str.append(CMStrings.padRight(useFaction.name(), 7) + " ");
   str.append(CMStrings.padRight(L("Money"), 5) + " ");
   str.append(CMStrings.padRight(L("Worn"), 5));
   str.append("\n\r");
   return str.toString();
 }
Esempio n. 2
0
 public static String getBasic(MOB M, int i) {
   StringBuffer str = new StringBuffer("");
   switch (i) {
     case 0:
       str.append(M.Name() + ", ");
       break;
     case 1:
       str.append(M.description() + ", ");
       break;
     case 2:
       if (M.playerStats() != null)
         str.append(CMLib.time().date2String(M.playerStats().lastDateTime()) + ", ");
       break;
     case 3:
       if (M.playerStats() != null) str.append(M.playerStats().getEmail() + ", ");
       break;
     case 4:
       str.append(M.baseCharStats().getMyRace().name() + ", ");
       break;
     case 5:
       str.append(
           M.baseCharStats().getCurrentClass().name(M.baseCharStats().getCurrentClassLevel())
               + ", ");
       break;
     case 6:
       str.append(M.baseEnvStats().level() + ", ");
       break;
     case 7:
       str.append(M.baseCharStats().displayClassLevel(M, true) + ", ");
       break;
     case 8:
       str.append(M.baseCharStats().getClassLevel(M.baseCharStats().getCurrentClass()) + ", ");
       break;
     case 9:
       {
         for (int c = M.charStats().numClasses() - 1; c >= 0; c--) {
           CharClass C = M.charStats().getMyClass(c);
           str.append(
               C.name(M.baseCharStats().getCurrentClassLevel())
                   + " ("
                   + M.charStats().getClassLevel(C)
                   + ") ");
         }
         str.append(", ");
         break;
       }
     case 10:
       if (M.maxCarry() > (Integer.MAX_VALUE / 3)) str.append("NA, ");
       else str.append(M.maxCarry() + ", ");
       break;
     case 11:
       str.append(CMStrings.capitalizeAndLower(CMLib.combat().fightingProwessStr(M)) + ", ");
       break;
     case 12:
       str.append(CMStrings.capitalizeAndLower(CMLib.combat().armorStr(M)) + ", ");
       break;
     case 13:
       str.append(CMLib.combat().adjustedDamage(M, null, null) + ", ");
       break;
     case 14:
       str.append(Math.round(CMath.div(M.getAgeHours(), 60.0)) + ", ");
       break;
     case 15:
       str.append(M.getPractices() + ", ");
       break;
     case 16:
       str.append(M.getExperience() + ", ");
       break;
     case 17:
       if (M.getExpNeededLevel() == Integer.MAX_VALUE) str.append("N/A, ");
       else str.append(M.getExpNextLevel() + ", ");
       break;
     case 18:
       str.append(M.getTrains() + ", ");
       break;
     case 19:
       str.append(CMLib.beanCounter().getMoney(M) + ", ");
       break;
     case 20:
       str.append(M.getWorshipCharID() + ", ");
       break;
     case 21:
       str.append(M.getLiegeID() + ", ");
       break;
     case 22:
       str.append(M.getClanID() + ", ");
       break;
     case 23:
       if (M.getClanID().length() > 0) {
         Clan C = CMLib.clans().getClan(M.getClanID());
         if (C != null)
           str.append(
               CMLib.clans().getRoleName(C.getGovernment(), M.getClanRole(), true, false) + ", ");
       }
       break;
     case 24:
       str.append(M.fetchFaction(CMLib.factions().AlignID()) + ", ");
       break;
     case 25:
       {
         Faction.FactionRange FR =
             CMLib.factions()
                 .getRange(CMLib.factions().AlignID(), M.fetchFaction(CMLib.factions().AlignID()));
         if (FR != null) str.append(FR.name() + ", ");
         else str.append(M.fetchFaction(CMLib.factions().AlignID()));
         break;
       }
     case 26:
       str.append(M.getWimpHitPoint() + ", ");
       break;
     case 27:
       if (M.getStartRoom() != null) str.append(M.getStartRoom().displayText() + ", ");
       break;
     case 28:
       if (M.location() != null) str.append(M.location().displayText() + ", ");
       break;
     case 29:
       if (M.getStartRoom() != null) str.append(M.getStartRoom().roomID() + ", ");
       break;
     case 30:
       if (M.location() != null) str.append(M.location().roomID() + ", ");
       break;
     case 31:
       {
         for (int inv = 0; inv < M.inventorySize(); inv++) {
           Item I = M.fetchInventory(inv);
           if ((I != null) && (I.container() == null)) str.append(I.name() + ", ");
         }
         break;
       }
     case 32:
       str.append(M.baseEnvStats().weight() + ", ");
       break;
     case 33:
       str.append(M.envStats().weight() + ", ");
       break;
     case 34:
       str.append(CMStrings.capitalizeAndLower(M.baseCharStats().genderName()) + ", ");
       break;
     case 35:
       if (M.playerStats() != null) str.append(M.playerStats().lastDateTime() + ", ");
       break;
     case 36:
       str.append(M.curState().getHitPoints() + ", ");
       break;
     case 37:
       str.append(M.curState().getMana() + ", ");
       break;
     case 38:
       str.append(M.curState().getMovement() + ", ");
       break;
     case 39:
       if (M.riding() != null) str.append(M.riding().name() + ", ");
       break;
     case 40:
       str.append(M.baseEnvStats().height() + ", ");
       break;
     case 41:
       if (!M.isMonster()) str.append(M.session().getAddress() + ", ");
       else if (M.playerStats() != null) str.append(M.playerStats().lastIP() + ", ");
       break;
     case 42:
       str.append(M.getQuestPoint() + ", ");
       break;
     case 43:
       str.append(M.maxState().getHitPoints() + ", ");
       break;
     case 44:
       str.append(M.maxState().getMana() + ", ");
       break;
     case 45:
       str.append(M.maxState().getMovement() + ", ");
       break;
     case 46:
       str.append(M.rawImage() + ", ");
       break;
     case 47:
       str.append(M.maxItems() + ", ");
       break;
     case 48:
       {
         String[] paths = CMProps.mxpImagePath(M.image());
         if (paths[0].length() > 0) str.append(paths[0] + paths[1] + ", ");
         break;
       }
     case 49:
       if (CMProps.mxpImagePath(M.image())[0].length() > 0) str.append("true, ");
       else str.append("false, ");
       break;
     case 50:
       if (M.playerStats() != null) str.append(M.playerStats().notes() + ", ");
       break;
     case 51:
       if (M.playerStats() != null) {
         long lastDateTime = -1;
         for (int level = 0; level <= M.envStats().level(); level++) {
           long dateTime = M.playerStats().leveledDateTime(level);
           if ((dateTime > 1529122205) && (dateTime != lastDateTime)) {
             str.append("<TR>");
             if (level == 0) str.append("<TD><FONT COLOR=WHITE>Created</FONT></TD>");
             else str.append("<TD><FONT COLOR=WHITE>" + level + "</FONT></TD>");
             str.append(
                 "<TD><FONT COLOR=WHITE>"
                     + CMLib.time().date2String(dateTime)
                     + "</FONT></TD></TR>");
           }
         }
         str.append(", ");
       }
       break;
     case 52:
       str.append(M.baseEnvStats().attackAdjustment() + ", ");
       break;
     case 53:
       str.append(M.baseEnvStats().damage() + ", ");
       break;
     case 54:
       str.append(M.baseEnvStats().armor() + ", ");
       break;
     case 55:
       str.append(M.envStats().speed() + ", ");
       break;
     case 56:
       str.append(M.baseEnvStats().speed() + ", ");
       break;
     case 57:
       {
         for (int e = 0; e < M.numExpertises(); e++) {
           String E = M.fetchExpertise(e);
           ExpertiseLibrary.ExpertiseDefinition X = CMLib.expertises().getDefinition(E);
           if (X == null) str.append(E + ", ");
           else str.append(X.name + ", ");
         }
         break;
       }
     case 58:
       {
         for (int t = 0; t < M.numTattoos(); t++) {
           String E = M.fetchTattoo(t);
           str.append(E + ", ");
         }
         break;
       }
     case 59:
       {
         if (M.playerStats() != null)
           for (int b = 0; b < M.playerStats().getSecurityGroups().size(); b++) {
             String B = (String) M.playerStats().getSecurityGroups().elementAt(b);
             if (B != null) str.append(B + ", ");
           }
         break;
       }
     case 60:
       {
         if (M.playerStats() != null)
           for (int b = 0; b < M.playerStats().getTitles().size(); b++) {
             String B = (String) M.playerStats().getTitles().elementAt(b);
             if (B != null) str.append(B + ", ");
           }
         break;
       }
     case 61:
       {
         for (Enumeration e = M.fetchFactions(); e.hasMoreElements(); ) {
           String FID = (String) e.nextElement();
           Faction F = CMLib.factions().getFaction(FID);
           int value = M.fetchFaction(FID);
           if (F != null) str.append(F.name() + " (" + value + "), ");
         }
         break;
       }
     case 62:
       str.append(CMProps.getBoolVar(CMProps.SYSTEMB_ACCOUNTEXPIRATION) ? "true" : "false");
       break;
     case 63:
       if (M.playerStats() != null)
         str.append(CMLib.time().date2String(M.playerStats().getAccountExpiration()));
       break;
     case 64:
       {
         for (int f = 0; f < M.numFollowers(); f++)
           str.append(M.fetchFollower(f).name()).append(", ");
         // Vector V=CMLib.database().DBScanFollowers(M);
         // for(int v=0;v<V.size();v++)
         //    str.append(((MOB)V.elementAt(v)).name()).append(", ");
         break;
       }
     case 65:
       if ((M.playerStats() != null) && (M.playerStats().getAccount() != null))
         str.append(M.playerStats().getAccount().accountName());
       break;
   }
   return str.toString();
 }
Esempio n. 3
0
  public StringBuffer deviations(MOB mob, String rest) {
    final Vector<String> V = CMParms.parse(rest);
    if ((V.size() == 0)
        || ((!V.get(0).equalsIgnoreCase("mobs"))
            && (!V.get(0).equalsIgnoreCase("items"))
            && (!V.get(0).equalsIgnoreCase("both"))))
      return new StringBuffer(
          "You must specify whether you want deviations on MOBS, ITEMS, or BOTH.");

    final String type = V.get(0).toLowerCase();
    if (V.size() == 1)
      return new StringBuffer(
          "You must also specify a mob or item name, or the word room, or the word area.");

    final Room mobR = mob.location();
    Faction useFaction = null;
    for (final Enumeration<Faction> e = CMLib.factions().factions(); e.hasMoreElements(); ) {
      final Faction F = e.nextElement();
      if (F.showInSpecialReported()) useFaction = F;
    }
    final String where = V.get(1).toLowerCase();
    final Environmental E = mobR.fetchFromMOBRoomFavorsItems(mob, null, where, Wearable.FILTER_ANY);
    final Vector<Environmental> check = new Vector<Environmental>();
    if (where.equalsIgnoreCase("room")) fillCheckDeviations(mobR, type, check);
    else if (where.equalsIgnoreCase("area")) {
      for (final Enumeration<Room> r = mobR.getArea().getFilledCompleteMap();
          r.hasMoreElements(); ) {
        final Room R = r.nextElement();
        fillCheckDeviations(R, type, check);
      }
    } else if (where.equalsIgnoreCase("world")) {
      for (final Enumeration<Room> r = CMLib.map().roomsFilled(); r.hasMoreElements(); ) {
        final Room R = r.nextElement();
        fillCheckDeviations(R, type, check);
      }
    } else if (E == null)
      return new StringBuffer("'" + where + "' is an unknown item or mob name.");
    else if (type.equals("items") && (!(E instanceof Weapon)) && (!(E instanceof Armor)))
      return new StringBuffer("'" + where + "' is not a weapon or armor item.");
    else if (type.equals("mobs") && (!(E instanceof MOB)))
      return new StringBuffer("'" + where + "' is not a MOB.");
    else if ((!(E instanceof Weapon)) && (!(E instanceof Armor)) && (!(E instanceof MOB)))
      return new StringBuffer("'" + where + "' is not a MOB, or Weapon, or Item.");
    else check.add(E);
    final StringBuffer str = new StringBuffer("");
    str.append(L("Deviations Report:\n\r"));
    final StringBuffer itemResults = new StringBuffer();
    final StringBuffer mobResults = new StringBuffer();
    for (int c = 0; c < check.size(); c++) {
      if (check.get(c) instanceof Item) {
        final Item I = (Item) check.get(c);
        Weapon W = null;
        if (I instanceof Weapon) W = (Weapon) I;
        final Map<String, String> vals =
            CMLib.itemBuilder()
                .timsItemAdjustments(
                    I,
                    I.phyStats().level(),
                    I.material(),
                    I.rawLogicalAnd() ? 2 : 1,
                    (W == null) ? 0 : W.weaponClassification(),
                    I.maxRange(),
                    I.rawProperLocationBitmap());
        itemResults.append(CMStrings.padRight(I.name(), 20) + " ");
        itemResults.append(CMStrings.padRight(I.ID(), 10) + " ");
        itemResults.append(CMStrings.padRight("" + I.phyStats().level(), 4) + " ");
        itemResults.append(
            CMStrings.padRight(
                    "" + getDeviation(I.basePhyStats().attackAdjustment(), vals, "ATTACK"), 5)
                + " ");
        itemResults.append(
            CMStrings.padRight("" + getDeviation(I.basePhyStats().damage(), vals, "DAMAGE"), 5)
                + " ");
        itemResults.append(
            CMStrings.padRight("" + getDeviation(I.basePhyStats().damage(), vals, "ARMOR"), 5)
                + " ");
        itemResults.append(
            CMStrings.padRight("" + getDeviation(I.baseGoldValue(), vals, "VALUE"), 5) + " ");
        itemResults.append(
            CMStrings.padRight(
                    ""
                        + ((I.phyStats().rejuv() == PhyStats.NO_REJUV)
                            ? " MAX"
                            : "" + I.phyStats().rejuv()),
                    5)
                + " ");
        if (I instanceof Weapon)
          itemResults.append(CMStrings.padRight("" + I.basePhyStats().weight(), 4));
        else
          itemResults.append(
              CMStrings.padRight("" + getDeviation(I.basePhyStats().weight(), vals, "WEIGHT"), 4)
                  + " ");
        if (I instanceof Armor)
          itemResults.append(CMStrings.padRight("" + ((Armor) I).phyStats().height(), 4));
        else itemResults.append(CMStrings.padRight(" - ", 4) + " ");
        itemResults.append("\n\r");
      } else {
        final MOB M = (MOB) check.get(c);
        mobResults.append(CMStrings.padRight(M.name(), 20) + " ");
        mobResults.append(CMStrings.padRight("" + M.phyStats().level(), 4) + " ");
        mobResults.append(
            CMStrings.padRight(
                    ""
                        + getDeviation(
                            M.basePhyStats().attackAdjustment(), CMLib.leveler().getLevelAttack(M)),
                    5)
                + " ");
        mobResults.append(
            CMStrings.padRight(
                    ""
                        + getDeviation(
                            M.basePhyStats().damage(),
                            (int)
                                Math.round(
                                    CMath.div(
                                        CMLib.leveler().getLevelMOBDamage(M),
                                        M.basePhyStats().speed()))),
                    5)
                + " ");
        mobResults.append(
            CMStrings.padRight(
                    ""
                        + getDeviation(
                            M.basePhyStats().armor(), CMLib.leveler().getLevelMOBArmor(M)),
                    5)
                + " ");
        mobResults.append(
            CMStrings.padRight(
                    ""
                        + getDeviation(
                            M.basePhyStats().speed(), CMLib.leveler().getLevelMOBSpeed(M)),
                    5)
                + " ");
        mobResults.append(
            CMStrings.padRight(
                    ""
                        + ((M.phyStats().rejuv() == PhyStats.NO_REJUV)
                            ? " MAX"
                            : "" + M.phyStats().rejuv()),
                    5)
                + " ");
        if (useFaction != null)
          mobResults.append(
              CMStrings.padRight(
                      ""
                          + (M.fetchFaction(useFaction.factionID()) == Integer.MAX_VALUE
                              ? "N/A"
                              : "" + M.fetchFaction(useFaction.factionID())),
                      7)
                  + " ");
        double value = CMLib.beanCounter().getTotalAbsoluteNativeValue(M);
        double[] range = CMLib.leveler().getLevelMoneyRange(M);
        if (value < range[0])
          mobResults.append(CMStrings.padRight("" + getDeviation(value, range[0]), 5) + " ");
        else if (value > range[1])
          mobResults.append(CMStrings.padRight("" + getDeviation(value, range[1]), 5) + " ");
        else mobResults.append(CMStrings.padRight("0%", 5) + " ");
        int reallyWornCount = 0;
        for (int j = 0; j < M.numItems(); j++) {
          final Item Iw = M.getItem(j);
          if (!(Iw.amWearingAt(Wearable.IN_INVENTORY))) reallyWornCount++;
        }
        mobResults.append(CMStrings.padRight("" + reallyWornCount, 5) + " ");
        mobResults.append("\n\r");
      }
    }
    if (itemResults.length() > 0) str.append(itemHeader() + itemResults.toString());
    if (mobResults.length() > 0) str.append(mobHeader(useFaction) + mobResults.toString());
    return str;
  }