示例#1
0
 protected Vector loadRecipes() {
   String filename = parametersFile();
   Vector recipes = (Vector) Resources.getResource("PARSED: " + filename);
   if (recipes == null) {
     StringBuffer str =
         new CMFile(Resources.buildResourcePath("skills") + filename, null, true).text();
     recipes = loadList(str);
     if (recipes.size() == 0) Log.errOut("LeatherWorking", "Recipes not found!");
     else {
       Vector pleaseAdd1 = new Vector();
       Vector pleaseAdd2 = new Vector();
       for (int r = 0; r < recipes.size(); r++) {
         Vector V = (Vector) recipes.elementAt(r);
         if (V.size() > 0) {
           Vector V1 = (Vector) V.clone();
           Vector V2 = (Vector) V.clone();
           String name = (String) V.elementAt(RCP_FINALNAME);
           V1.setElementAt("Hard " + name, RCP_FINALNAME);
           V1.setElementAt("" + (CMath.s_int((String) V.elementAt(RCP_LEVEL)) + 5), RCP_LEVEL);
           V2.setElementAt("Studded " + name, RCP_FINALNAME);
           V2.setElementAt("" + (CMath.s_int((String) V.elementAt(RCP_LEVEL)) + 11), RCP_LEVEL);
           pleaseAdd1.addElement(V1);
           pleaseAdd2.addElement(V2);
         }
       }
       for (int i = 0; i < pleaseAdd1.size(); i++) recipes.addElement(pleaseAdd1.elementAt(i));
       for (int i = 0; i < pleaseAdd2.size(); i++) recipes.addElement(pleaseAdd2.elementAt(i));
     }
     Resources.submitResource("PARSED: " + filename, recipes);
   }
   return recipes;
 }
示例#2
0
 public boolean execute(MOB mob, Vector commands, int metaFlags) throws java.io.IOException {
   StringBuffer credits =
       new CMFile(Resources.buildResourcePath("text") + "credits.txt", null, true).text();
   try {
     credits = CMLib.httpUtils().doVirtualPage(credits);
   } catch (Exception ex) {
   }
   if ((credits != null) && (mob.session() != null) && (credits.length() > 0))
     mob.session().colorOnlyPrintln(credits.toString());
   else mob.tell("CoffeeMud is (C)2000-2010 by Bo Zimmerman");
   return false;
 }
示例#3
0
  protected List<List<String>> loadRecipes() {
    String filename = parametersFile();
    List<List<String>> recipes =
        (List<List<String>>) Resources.getResource("PARSED_RECIPE: " + filename);
    if (recipes == null) {
      StringBuffer str =
          new CMFile(Resources.buildResourcePath("skills") + filename, null, true).text();
      recipes = loadList(str);
      if (recipes.size() == 0) Log.errOut("LeatherWorking", "Recipes not found!");
      else {
        List<List<String>> pleaseAdd = new Vector();
        for (int r = 0; r < recipes.size(); r++) {
          List<String> V = recipes.get(r);
          if (V.size() > 0) {
            String name = (String) V.get(RCP_FINALNAME);
            int baseLevel = CMath.s_int((String) V.get(RCP_LEVEL)) + 2;

            List<String> V1 = new XVector<String>(V);
            V1.set(RCP_FINALNAME, "Cuirbouli " + name);
            V1.set(RCP_LEVEL, "" + (baseLevel + 37));
            pleaseAdd.add(V1);

            V1 = new XVector<String>(V);
            V1.set(RCP_FINALNAME, "Reinforced " + name);
            V1.set(RCP_LEVEL, "" + (baseLevel + 45));
            pleaseAdd.add(V1);

            V1 = new XVector<String>(V);
            V1.set(RCP_FINALNAME, "Masterwork " + name);
            V1.set(RCP_LEVEL, "" + (baseLevel + 54));
            pleaseAdd.add(V1);

            V1 = new XVector<String>(V);
            V1.set(RCP_FINALNAME, "Laminar " + name);
            V1.set(RCP_LEVEL, "" + (baseLevel + 63));
            pleaseAdd.add(V1);

            V1 = new XVector<String>(V);
            V1.set(RCP_FINALNAME, "Battlemoulded " + name);
            V1.set(RCP_LEVEL, "" + (baseLevel + 72));
            pleaseAdd.add(V1);

            V.set(RCP_FINALNAME, "Designer " + name);
            V.set(RCP_LEVEL, "" + (baseLevel + 30));
          }
        }
        for (int i = 0; i < pleaseAdd.size(); i++) recipes.add(pleaseAdd.get(i));
      }
      Resources.submitResource("PARSED_RECIPE: " + filename, recipes);
    }
    return recipes;
  }
 @Override
 protected List<List<String>> loadRecipes() {
   final String filename = parametersFile();
   @SuppressWarnings("unchecked")
   List<List<String>> recipes =
       (List<List<String>>) Resources.getResource("PARSED_RECIPE: " + filename);
   if (recipes == null) {
     final StringBuffer str =
         new CMFile(Resources.buildResourcePath("skills") + filename, null, CMFile.FLAG_LOGERRORS)
             .text();
     recipes = loadList(str);
     if (recipes.size() == 0) Log.errOut("LeatherWorking", "Recipes not found!");
     else {
       final List<List<String>> newRecipes = new Vector<List<String>>();
       for (int r = 0; r < recipes.size(); r++) {
         final List<String> V = recipes.get(r);
         if (V.size() > 0) {
           final String name = V.get(RCP_FINALNAME);
           final int baseLevel = CMath.s_int(V.get(RCP_LEVEL)) + 2;
           for (final Stage s : Stage.values()) {
             final List<String> V1 = new XVector<String>(V);
             V1.set(RCP_FINALNAME, s.name() + " " + name);
             final int level = baseLevel + s.recipeLevel;
             V1.set(RCP_LEVEL, "" + level);
             for (int i = 0; i <= newRecipes.size(); i++) {
               if (newRecipes.size() == i) {
                 newRecipes.add(V1);
                 break;
               } else if (CMath.s_int(newRecipes.get(i).get(RCP_LEVEL)) > level) {
                 newRecipes.add(i, V1);
                 break;
               }
             }
           }
         }
       }
       recipes.clear();
       recipes = newRecipes;
     }
     Resources.submitResource("PARSED_RECIPE: " + filename, recipes);
   }
   return recipes;
 }