Exemple #1
0
 public void setStat(String code, String val) {
   if (CMLib.coffeeMaker().getGenItemCodeNum(code) >= 0)
     CMLib.coffeeMaker().setGenItemStat(this, code, val);
   else
     switch (getCodeNum(code)) {
       case 0:
         setLidsNLocks(hasALid(), isOpen(), CMath.s_bool(val), false);
         break;
       case 1:
         setLidsNLocks(CMath.s_bool(val), isOpen(), hasALock(), false);
         break;
       case 2:
         setCapacity(CMath.s_parseIntExpression(val));
         break;
       case 3:
         setContainTypes(CMath.s_parseBitLongExpression(Container.CONTAIN_DESCS, val));
         break;
       case 4:
         {
           int x = CMath.s_parseListIntExpression(RawMaterial.CODES.NAMES(), val);
           x = ((x >= 0) && (x < RawMaterial.RESOURCE_MASK)) ? RawMaterial.CODES.GET(x) : x;
           setFuelType(x);
           break;
         }
       case 5:
         setPowerCapacity(CMath.s_parseLongExpression(val));
         break;
       default:
         CMProps.setStatCodeExtensionValue(getStatCodes(), xtraValues, code, val);
         break;
     }
 }
Exemple #2
0
 @Override
 public void setStat(String code, String val) {
   if (code == null) return;
   if (code.equalsIgnoreCase("DAMAGE")) this.damageToTake = CMath.s_int(val);
   else if (code.equalsIgnoreCase("REVERSED")) this.setProficiency(CMath.s_bool(val) ? 100 : 0);
   else if (code.equalsIgnoreCase("NORMAL")) this.setProficiency(CMath.s_bool(val) ? 0 : 100);
   else super.setStat(code, val);
 }
Exemple #3
0
 @Override
 public void setStat(String code, String val) {
   if (CMLib.coffeeMaker().getGenItemCodeNum(code) >= 0)
     CMLib.coffeeMaker().setGenItemStat(this, code, val);
   else
     switch (getCodeNum(code)) {
       case 0:
         setDoorsNLocks(
             hasADoor(),
             isOpen(),
             defaultsClosed(),
             CMath.s_bool(val),
             false,
             CMath.s_bool(val) && defaultsLocked());
         break;
       case 1:
         setDoorsNLocks(
             CMath.s_bool(val),
             isOpen(),
             CMath.s_bool(val) && defaultsClosed(),
             hasALock(),
             false,
             defaultsLocked());
         break;
       case 2:
         setCapacity(CMath.s_parseIntExpression(val));
         break;
       case 3:
         setContainTypes(CMath.s_parseBitLongExpression(Container.CONTAIN_DESCS, val));
         break;
       case 4:
         setOpenDelayTicks(CMath.s_parseIntExpression(val));
         break;
       case 5:
         setClothingLayer((short) CMath.s_parseIntExpression(val));
         break;
       case 6:
         setLayerAttributes((short) CMath.s_parseListLongExpression(Armor.LAYERMASK_DESCS, val));
         break;
       case 7:
         setDoorsNLocks(
             hasADoor(), isOpen(), CMath.s_bool(val), hasALock(), isLocked(), defaultsLocked());
         break;
       case 8:
         setDoorsNLocks(
             hasADoor(), isOpen(), defaultsClosed(), hasALock(), isLocked(), CMath.s_bool(val));
         break;
       default:
         CMProps.setStatCodeExtensionValue(getStatCodes(), xtraValues, code, val);
         break;
     }
 }
 @Override
 public void setStat(String code, String val) {
   if (CMLib.coffeeMaker().getGenItemCodeNum(code) >= 0)
     CMLib.coffeeMaker().setGenItemStat(this, code, val);
   else
     switch (getCodeNum(code)) {
       case 0:
         setDoorsNLocks(
             hasADoor(),
             isOpen(),
             defaultsClosed(),
             CMath.s_bool(val),
             false,
             CMath.s_bool(val) && defaultsLocked());
         break;
       case 1:
         setDoorsNLocks(
             CMath.s_bool(val),
             isOpen(),
             CMath.s_bool(val) && defaultsClosed(),
             hasALock(),
             isLocked(),
             defaultsLocked());
         break;
       case 2:
         setCapacity(CMath.s_parseIntExpression(val));
         break;
       case 3:
         setContainTypes(CMath.s_parseBitLongExpression(Container.CONTAIN_DESCS, val));
         break;
       case 4:
         setOpenDelayTicks(CMath.s_parseIntExpression(val));
         break;
       case 5:
         setPowerCapacity(CMath.s_parseLongExpression(val));
         break;
       case 6:
         {
           final List<String> mats = CMParms.parseCommas(val, true);
           final int[] newMats = new int[mats.size()];
           for (int x = 0; x < mats.size(); x++) {
             final int rsccode = RawMaterial.CODES.FIND_CaseSensitive(mats.get(x).trim());
             if (rsccode > 0) newMats[x] = rsccode;
           }
           super.setConsumedFuelType(newMats);
           break;
         }
       case 7:
         setPowerCapacity(CMath.s_parseLongExpression(val));
         break;
       case 8:
         setGeneratedAmountPerTick(CMath.s_parseIntExpression(val));
         break;
       case 9:
         activate(CMath.s_bool(val));
         break;
       case 10:
         setManufacturerName(val);
         break;
       case 11:
         setInstalledFactor(CMath.s_float(val));
         break;
       case 12:
         setDoorsNLocks(
             hasADoor(), isOpen(), CMath.s_bool(val), hasALock(), isLocked(), defaultsLocked());
         break;
       case 13:
         setDoorsNLocks(
             hasADoor(), isOpen(), defaultsClosed(), hasALock(), isLocked(), CMath.s_bool(val));
         break;
       default:
         CMProps.setStatCodeExtensionValue(getStatCodes(), xtraValues, code, val);
         break;
     }
 }
Exemple #5
0
  @Override
  public String runMacro(HTTPRequest httpReq, String parm) {
    final java.util.Map<String, String> parms = parseParms(parm);
    final String last = httpReq.getUrlParameter("JOURNAL");
    if (last == null) return " @break@";
    boolean securityOverride = false;
    if ((Thread.currentThread() instanceof CWThread)
        && CMath.s_bool(((CWThread) Thread.currentThread()).getConfig().getMiscProp("ADMIN"))
        && parms.containsKey("ALLFORUMJOURNALS")) securityOverride = true;

    final MOB M = Authenticate.getAuthenticatedMob(httpReq);
    if ((!securityOverride)
        && (CMLib.journals().isArchonJournalName(last))
        && ((M == null) || (!CMSecurity.isASysOp(M)))) return " @break@";

    final Clan setClan = CMLib.clans().getClan(httpReq.getUrlParameter("CLAN"));
    final JournalsLibrary.ForumJournal journal = CMLib.journals().getForumJournal(last, setClan);
    if (journal == null) return " @break@";

    final StringBuffer str = new StringBuffer("");
    if (parms.containsKey("ISSMTPFORWARD")) {
      @SuppressWarnings("unchecked")
      final TreeMap<String, JournalsLibrary.SMTPJournal> set =
          (TreeMap<String, JournalsLibrary.SMTPJournal>)
              Resources.getResource("SYSTEM_SMTP_JOURNALS");
      final JournalsLibrary.SMTPJournal entry =
          (set != null) ? set.get(last.toUpperCase().trim()) : null;
      final String email =
          ((M != null) && (M.playerStats() != null) && (M.playerStats().getEmail() != null))
              ? M.playerStats().getEmail()
              : "";
      str.append(
              ((entry != null) && (email.length() > 0)) ? Boolean.toString(entry.forward) : "false")
          .append(", ");
    }

    if (parms.containsKey("ISSMTPSUBSCRIBER")) {
      final Map<String, List<String>> lists =
          Resources.getCachedMultiLists("mailinglists.txt", true);
      final List<String> mylist = lists.get(last);
      str.append(
              ((mylist != null) && (M != null))
                  ? Boolean.toString(mylist.contains(M.Name()))
                  : "false")
          .append(", ");
    }

    if (parms.containsKey("SMTPADDRESS")) {
      @SuppressWarnings("unchecked")
      final TreeMap<String, JournalsLibrary.SMTPJournal> set =
          (TreeMap<String, JournalsLibrary.SMTPJournal>)
              Resources.getResource("SYSTEM_SMTP_JOURNALS");
      final JournalsLibrary.SMTPJournal entry =
          (set != null) ? set.get(last.toUpperCase().trim()) : null;
      if ((entry != null) && (entry.forward)) {
        str.append(entry.name.replace(' ', '_') + "@" + CMProps.getVar(CMProps.Str.MUDDOMAIN))
            .append(", ");
      }
    }

    if (parms.containsKey("CANADMIN") || parms.containsKey("ISADMIN"))
      str.append("" + journal.authorizationCheck(M, ForumJournalFlags.ADMIN)).append(", ");

    if (parms.containsKey("CANPOST"))
      str.append("" + journal.authorizationCheck(M, ForumJournalFlags.POST)).append(", ");

    if (parms.containsKey("CANREAD"))
      str.append("" + journal.authorizationCheck(M, ForumJournalFlags.READ)).append(", ");

    if (parms.containsKey("CANREPLY"))
      str.append("" + journal.authorizationCheck(M, ForumJournalFlags.REPLY)).append(", ");

    if (parms.containsKey("ADMINMASK")) str.append("" + journal.adminMask()).append(", ");

    if (parms.containsKey("READMASK")) str.append("" + journal.readMask()).append(", ");

    if (parms.containsKey("POSTMASK")) str.append("" + journal.postMask()).append(", ");

    if (parms.containsKey("REPLYMASK")) str.append("" + journal.replyMask()).append(", ");

    if (parms.containsKey("ID")) str.append("" + journal.NAME()).append(", ");

    if (parms.containsKey("NAME")) str.append("" + journal.NAME()).append(", ");

    if (parms.containsKey("EXPIRE")) str.append("").append(", ");

    final JournalsLibrary.JournalSummaryStats stats = CMLib.journals().getJournalStats(journal);
    if (stats == null) return " @break@";

    if (parms.containsKey("POSTS")) str.append("" + stats.posts).append(", ");

    if (parms.containsKey("THREADS")) str.append("" + stats.threads).append(", ");

    if (parms.containsKey("SHORTDESC")) str.append("" + stats.shortIntro).append(", ");

    if (parms.containsKey("LONGDESC")) str.append("" + stats.longIntro).append(", ");

    if (parms.containsKey("IMAGEPATH")) {
      if ((stats.imagePath == null) || (stats.imagePath.trim().length() == 0))
        str.append(L("images/lilcm.jpg")).append(", ");
      else str.append("" + stats.threads).append(", ");
    }

    String strstr = str.toString();
    if (strstr.endsWith(", ")) strstr = strstr.substring(0, strstr.length() - 2);
    return clearWebMacros(strstr);
  }