コード例 #1
0
ファイル: LeatherWorking.java プロジェクト: bbailey/ewok
 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 {
    if ((mob == null) || (mob.playerStats() == null)) return false;

    if (commands.size() < 2) {
      String pageBreak =
          (mob.playerStats().getPageBreak() != 0)
              ? ("" + mob.playerStats().getPageBreak())
              : "Disabled";
      mob.tell(
          "Change your page break to what? Your current page break setting is: "
              + pageBreak
              + ". Enter a number larger than 0 or 'disable'.");
      return false;
    }
    String newBreak = CMParms.combine(commands, 1);
    int newVal = mob.playerStats().getWrap();
    if ((CMath.isInteger(newBreak)) && (CMath.s_int(newBreak) > 0)) newVal = CMath.s_int(newBreak);
    else if ("DISABLED".startsWith(newBreak.toUpperCase())) newVal = 0;
    else {
      mob.tell(
          "'" + newBreak + "' is not a valid setting. Enter a number larger than 0 or 'disable'.");
      return false;
    }
    mob.playerStats().setPageBreak(newVal);
    String pageBreak =
        (mob.playerStats().getPageBreak() != 0)
            ? ("" + mob.playerStats().getPageBreak())
            : "Disabled";
    mob.tell("Your new page break setting is: " + pageBreak + ".");
    return false;
  }
コード例 #3
0
ファイル: ServiceEngine.java プロジェクト: bbailey/ewok
  public String tickInfo(String which) {
    int grpstart = -1;
    for (int i = 0; i < which.length(); i++)
      if (Character.isDigit(which.charAt(i))) {
        grpstart = i;
        break;
      }
    if (which.equalsIgnoreCase("tickGroupSize")) return "" + ticks.size();
    else if (which.toLowerCase().startsWith("tickerssize")) {
      if (grpstart < 0) return "";
      int group = CMath.s_int(which.substring(grpstart));
      if ((group >= 0) && (group < ticks.size()))
        return "" + ((Tick) ticks.get(group)).numTickers();
      return "";
    }
    int group = -1;
    int client = -1;
    int clistart = which.indexOf("-");
    if ((grpstart >= 0) && (clistart > grpstart)) {
      group = CMath.s_int(which.substring(grpstart, clistart));
      client = CMath.s_int(which.substring(clistart + 1));
    }

    if ((group < 0) || (client < 0) || (group >= ticks.size())) return "";
    Tick almostTock = (Tick) ticks.get(group);

    if (client >= almostTock.numTickers()) return "";
    TockClient C = almostTock.fetchTickerByIndex(client);
    if (C == null) return "";

    if (which.toLowerCase().startsWith("tickername")) {
      Tickable E = C.clientObject;
      if ((E instanceof Ability) && (E.ID().equals("ItemRejuv"))) E = ((Ability) E).affecting();
      if (E instanceof Room) return CMLib.map().getExtendedRoomID((Room) E);
      if (E != null) return E.name();
      return "!NULL!";
    } else if (which.toLowerCase().startsWith("tickerid")) return "" + C.tickID;
    else if (which.toLowerCase().startsWith("tickerstatus"))
      return ((C.clientObject == null) ? "" : ("" + C.clientObject.getTickStatus()));
    else if (which.toLowerCase().startsWith("tickercodeword"))
      return getTickStatusSummary(C.clientObject);
    else if (which.toLowerCase().startsWith("tickertickdown")) return "" + C.tickDown;
    else if (which.toLowerCase().startsWith("tickerretickdown")) return "" + C.reTickDown;
    else if (which.toLowerCase().startsWith("tickermillitotal")) return "" + C.milliTotal;
    else if (which.toLowerCase().startsWith("tickermilliavg")) {
      if (C.tickTotal == 0) return "0";
      return "" + (C.milliTotal / C.tickTotal);
    } else if (which.toLowerCase().startsWith("tickerlaststartmillis")) return "" + C.lastStart;
    else if (which.toLowerCase().startsWith("tickerlaststopmillis")) return "" + C.lastStop;
    else if (which.toLowerCase().startsWith("tickerlaststartdate"))
      return CMLib.time().date2String(C.lastStart);
    else if (which.toLowerCase().startsWith("tickerlaststopdate"))
      return CMLib.time().date2String(C.lastStop);
    else if (which.toLowerCase().startsWith("tickerlastduration")) {
      if (C.lastStop >= C.lastStart) return CMLib.english().returnTime(C.lastStop - C.lastStart, 0);
      return CMLib.english().returnTime(System.currentTimeMillis() - C.lastStart, 0);
    } else if (which.toLowerCase().startsWith("tickersuspended")) return "" + C.suspended;
    return "";
  }
コード例 #4
0
 public Room getGridChild(String childCode) {
   if (childCode.equalsIgnoreCase(roomID())) return this;
   if (!childCode.toUpperCase().startsWith(roomID().toUpperCase() + "#(")) return null;
   int len = roomID().length() + 2;
   int comma = childCode.indexOf(',', len);
   if (comma < 0) return null;
   int x = CMath.s_int(childCode.substring(len, comma));
   int y = CMath.s_int(childCode.substring(comma + 1, childCode.length() - 1));
   return getMakeGridRoom(x, y);
 }
コード例 #5
0
ファイル: Spell_EnchantArrows.java プロジェクト: bbailey/ewok
  public boolean invoke(
      MOB mob, Vector commands, Environmental givenTarget, boolean auto, int asLevel) {
    Item target = super.getTarget(mob, mob.location(), givenTarget, commands, Wearable.FILTER_ANY);
    if (target == null) return false;

    if ((!(target instanceof Ammunition))
        || (!((Ammunition) target).ammunitionType().equalsIgnoreCase("arrows"))) {
      mob.tell(mob, target, null, "You can't enchant <T-NAME> ith an Enchant Arrows spell!");
      return false;
    }

    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

    int experienceToLose = getXPCOSTAdjustment(mob, 5);
    CMLib.leveler().postExperience(mob, null, null, -experienceToLose, false);

    boolean success = proficiencyCheck(mob, 0, auto);

    if (success) {
      CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              verbalCastCode(mob, target, auto),
              auto ? "" : "^S<S-NAME> hold(s) <T-NAMESELF> and cast(s) a spell.^?");
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        Ability A = target.fetchEffect(ID());
        if ((A != null) && (CMath.s_int(A.text()) > 2))
          mob.tell("You are not able to enchant " + target.name() + " further.");
        else {
          mob.location().show(mob, target, CMMsg.MSG_OK_VISUAL, "<T-NAME> glows!");
          if (A == null) {
            A = (Ability) copyOf();
            target.addNonUninvokableEffect(A);
          }
          A.setMiscText("" + (CMath.s_int(A.text()) + 1));
          target.recoverEnvStats();
          mob.recoverEnvStats();
        }
      }

    } else
      beneficialWordsFizzle(
          mob,
          target,
          "<S-NAME> hold(s) <T-NAMESELF> tightly and whisper(s), but fail(s) to cast a spell.");

    // return whether it worked
    return success;
  }
コード例 #6
0
ファイル: Song_Ode.java プロジェクト: bozimmerman/CoffeeMud
  public String composition() {
    String comp = "";
    if (trail != null) {
      String t = trail.toString();
      final int[] counts = new int[stuff.length];
      int x = t.indexOf(';');
      while (x >= 0) {
        final int q = CMath.s_int(t.substring(0, x));
        t = t.substring(x + 1);
        if (q >= 0) {
          for (int i = 0; i < stuff.length; i++) {
            if (CMath.s_int(stuff[i][0]) == q) counts[i]++;
          }
        }
        x = t.indexOf(';');
      }
      int wa = -1;
      for (int i = 0; i < stuff.length; i++)
        if (CMath.s_int(stuff[i][0]) == CMMsg.TYP_WEAPONATTACK) {
          wa = i;
          break;
        }

      if (wa >= 0) counts[wa] = counts[wa] / 25;

      final Vector<Integer> V = new Vector<Integer>();
      while (V.size() < counts.length) {
        int high = -1;
        int which = -1;
        for (int i = 0; i < counts.length; i++) {
          if ((counts[i] > high) && (!V.contains(Integer.valueOf(i)))) {
            high = counts[i];
            which = i;
          }
        }
        if (which >= 0) V.addElement(Integer.valueOf(which));
      }
      final Vector<Integer> V2 = new Vector<Integer>();
      for (int i = 0; i < 3; i++) {
        final Integer ref = V.elementAt(i);
        Integer which = null;
        while ((which == null) || (V2.contains(which))) {
          final Integer w = V.elementAt(CMLib.dice().roll(1, V.size(), -1));
          if (counts[w.intValue()] == counts[ref.intValue()]) which = w;
        }
        V2.addElement(which);
        comp += which.intValue() + ";" + counts[which.intValue()] + ";";
      }
    }
    return comp;
  }
コード例 #7
0
 @Override
 public void setMyLevels(String levels) {
   if ((levels.length() == 0) && (myClasses != null) && (myClasses.length > 0)) levels = "0";
   int x = levels.indexOf(';');
   final ArrayList<Integer> levelV = new ArrayList<Integer>();
   while (x >= 0) {
     final String theLevel = levels.substring(0, x).trim();
     levels = levels.substring(x + 1);
     if (theLevel.length() > 0) levelV.add(Integer.valueOf(CMath.s_int(theLevel)));
     x = levels.indexOf(';');
   }
   if (levels.trim().length() > 0) levelV.add(Integer.valueOf(CMath.s_int(levels)));
   myLevels = levelV.toArray(new Integer[0]);
 }
コード例 #8
0
ファイル: CoffeeUtensils.java プロジェクト: bbailey/ewok
 public DVector parseLootPolicyFor(MOB mob) {
   if (mob == null) return new DVector(3);
   Vector lootPolicy =
       (!mob.isMonster())
           ? new Vector()
           : CMParms.parseCommas(CMProps.getVar(CMProps.SYSTEM_ITEMLOOTPOLICY), true);
   DVector policies = new DVector(3);
   for (int p = 0; p < lootPolicy.size(); p++) {
     String s = ((String) lootPolicy.elementAt(p)).toUpperCase().trim();
     if (s.length() == 0) continue;
     Vector compiledMask = null;
     int maskDex = s.indexOf("MASK=");
     if (maskDex >= 0) {
       s = s.substring(0, maskDex).trim();
       compiledMask =
           CMLib.masking()
               .maskCompile(((String) lootPolicy.elementAt(p)).substring(maskDex + 5).trim());
     } else compiledMask = new Vector();
     Vector parsed = CMParms.parse(s);
     int pct = 100;
     for (int x = 0; x < parsed.size(); x++)
       if (CMath.isInteger((String) parsed.elementAt(x)))
         pct = CMath.s_int((String) parsed.elementAt(x));
       else if (CMath.isPct((String) parsed.elementAt(x)))
         pct = (int) Math.round(CMath.s_pct((String) parsed.elementAt(x)) * 100.0);
     int flags = 0;
     if (parsed.contains("RUIN")) flags |= CMMiscUtils.LOOTFLAG_RUIN;
     else if (parsed.contains("LOSS")) flags |= CMMiscUtils.LOOTFLAG_LOSS;
     if (flags == 0) flags |= CMMiscUtils.LOOTFLAG_LOSS;
     if (parsed.contains("WORN")) flags |= CMMiscUtils.LOOTFLAG_WORN;
     else if (parsed.contains("UNWORN")) flags |= CMMiscUtils.LOOTFLAG_UNWORN;
     policies.addElement(Integer.valueOf(pct), Integer.valueOf(flags), compiledMask);
   }
   return policies;
 }
コード例 #9
0
ファイル: Merge.java プロジェクト: kingdavid127/MUD
 public static void setStat(Environmental E, String stat, String value) {
   if ((stat != null)
       && (stat.length() > 0)
       && (stat.equalsIgnoreCase("REJUV"))
       && (E instanceof Physical)) ((Physical) E).basePhyStats().setRejuv(CMath.s_int(value));
   else E.setStat(stat, value);
 }
コード例 #10
0
ファイル: Falling.java プロジェクト: bozimmerman/CoffeeMud
 @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);
 }
コード例 #11
0
ファイル: Song_Ode.java プロジェクト: bozimmerman/CoffeeMud
  public Hashtable<Integer, Integer> getSongBenefits(String s) {
    if (benefits != null) return benefits;
    benefits = new Hashtable<Integer, Integer>();

    int x = s.indexOf(';');
    while (x >= 0) {
      final int code = CMath.s_int(s.substring(0, x));
      s = s.substring(x + 1);
      x = s.indexOf(';');
      if (x >= 0) {
        final int tick = CMath.s_int(s.substring(0, x));
        s = s.substring(x + 1);
        benefits.put(Integer.valueOf(code), Integer.valueOf(tick));
      }
      x = s.indexOf(';');
    }
    return benefits;
  }
コード例 #12
0
 @Override
 public int backTaxes() {
   final int dex = text().indexOf('/');
   if (dex < 0) return 0;
   final int x = text().indexOf("TAX", dex);
   if (x < 0) return 0;
   final String s = CMParms.parse(text().substring(x + 3)).firstElement();
   return CMath.s_int(s.substring(0, s.length() - 1));
 }
コード例 #13
0
 @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;
 }
コード例 #14
0
ファイル: Skills.java プロジェクト: kingdavid127/MUD
 protected int parseOutLevel(Vector commands) {
   if ((commands.size() > 1)
       && (commands.lastElement() instanceof String)
       && (CMath.isNumber((String) commands.lastElement()))) {
     final int x = CMath.s_int((String) commands.lastElement());
     commands.remove(commands.size() - 1);
     return x;
   }
   return -1;
 }
コード例 #15
0
 @Override
 public void setBodyPartsFromStringAfterRace(String str) {
   final List<String> V = CMParms.parseSemicolons(str, true);
   bodyAlterations = null;
   for (int i = 0; i < getMyRace().bodyMask().length; i++) {
     if (V.size() <= i) break;
     final int val = CMath.s_int(V.get(i));
     final int num = getMyRace().bodyMask()[i];
     if (num != val) alterBodypart(i, val - num);
   }
 }
コード例 #16
0
 @Override
 public String runMacro(HTTPRequest httpReq, String parm, HTTPResponse httpResp) {
   final String last = httpReq.getUrlParameter("GOVERNMENT");
   if (last == null) return " @break@";
   if (last.length() > 0) {
     if (CMath.isInteger(last)) {
       final ClanGovernment G = CMLib.clans().getStockGovernment(CMath.s_int(last));
       if (G != null) return clearWebMacros(Integer.toString(G.getID()));
     }
     return clearWebMacros(last);
   }
   return "";
 }
コード例 #17
0
 @Override
 public Tattoo parse(final String tattooCode) {
   if ((tattooCode == null) || (tattooCode.length() == 0)) return this;
   tattooName = tattooCode;
   if (Character.isDigit(tattooName.charAt(0))) {
     final int x = tattooName.indexOf(' ');
     if ((x > 0) && (CMath.isNumber(tattooName.substring(0, x).trim()))) {
       tickDown = CMath.s_int(tattooName.substring(0, x));
       tattooName = tattooName.substring(x + 1).trim();
     }
   }
   return this;
 }
コード例 #18
0
  @Override
  public int getPrice() {
    if (text().length() == 0) return 100000;
    final String s = text();
    int index = s.length();
    while ((--index) >= 0) {
      if ((!Character.isDigit(s.charAt(index))) && (!Character.isWhitespace(s.charAt(index))))
        break;
    }
    int price = CMath.s_int(s.substring(index + 1).trim());

    if (price <= 0) price = 100000;
    return price;
  }
コード例 #19
0
  @Override
  public void setMiscText(String txt) {
    super.setMiscText("");
    if (txt.startsWith("-")) {
      txt = txt.substring(1).toLowerCase().trim();
      for (final Object[] A : affects)
        if (((CMObject) A[0]).ID().toLowerCase().equals(txt)) {
          unAffectAffected(A);
          return;
        }
      for (final Object[] A : affects)
        if ((A[0] instanceof Ability)
            && (((Environmental) A[0]).name().toLowerCase().startsWith(txt))) {
          unAffectAffected(A);
          return;
        }
      for (final Object[] A : affects)
        if ((A[0] instanceof Behavior)
            && (((Behavior) A[0]).name().toLowerCase().startsWith(txt))) {
          unAffectAffected(A);
          return;
        }
    } else if (txt.trim().length() > 0) {
      if (txt.startsWith("+")) txt = txt.substring(1);
      else for (final Object[] A : affects) unAffectAffected(A);

      int x = txt.indexOf(' ');
      if (x < 0) return;
      final String abilityStr = txt.substring(0, x).trim();
      String numTicksStr = txt.substring(x + 1).trim();
      String parms = "";
      x = numTicksStr.indexOf(' ');
      if (x > 0) {
        parms = numTicksStr.substring(x + 1).trim();
        numTicksStr = numTicksStr.substring(0, x);
      }
      CMObject A = CMClass.getAbility(abilityStr);
      if (A == null) A = CMClass.getBehavior(abilityStr);
      if (A == null) A = CMClass.findAbility(abilityStr);
      if (A == null) A = CMClass.findBehavior(abilityStr);
      if (A != null) {
        affects.addElement(new Object[] {A, new int[] {CMath.s_int(numTicksStr)}});
        if (A instanceof Ability) ((Ability) A).setMiscText(parms);
        if ((A instanceof Behavior) && (affected instanceof PhysicalAgent))
          ((Behavior) A).setParms(parms);
        finishInit(A);
      }
    }
  }
コード例 #20
0
  @Override
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    if (commands.size() < 3) {
      mob.tell(
          L("Specify a target, a property, number of ticks, and (optionally) some misc text!"));
      return false;
    }
    final Vector V = new XVector(commands.firstElement());
    final Physical target = getAnyTarget(mob, V, givenTarget, Wearable.FILTER_ANY);
    if (target == null) return false;
    commands.removeElementAt(0);

    final String abilityStr = (String) commands.firstElement();
    CMObject A = CMClass.getAbility(abilityStr);
    if (A == null) A = CMClass.getBehavior(abilityStr);
    if (A == null) A = CMClass.findAbility(abilityStr);
    if (A == null) A = CMClass.findBehavior(abilityStr);
    if (A == null) {
      mob.tell(L("No such ability or behavior as @x1!", abilityStr));
      return false;
    }
    final String numTicks = ((String) commands.elementAt(1)).trim();
    if ((!CMath.isInteger(numTicks)) || (CMath.s_int(numTicks) <= 0)) {
      mob.tell(L("'@x1' is not a number of ticks!", numTicks));
      return false;
    }
    final String parms = CMParms.combine(commands, 2);

    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

    TemporaryAffects T = (TemporaryAffects) target.fetchEffect(ID());
    if (T == null) {
      T = (TemporaryAffects) this.newInstance();
      T.affects = new SVector<Object[]>();
      T.startTickDown(mob, target, 10);
      T = (TemporaryAffects) target.fetchEffect(ID());
    }
    if (T != null) {
      T.setMiscText("+" + A.ID() + " " + numTicks.trim() + " " + parms.trim());
      T.makeLongLasting();
    }
    return true;
  }
コード例 #21
0
ファイル: Song_Ode.java プロジェクト: bozimmerman/CoffeeMud
 @Override
 public void affectCharStats(MOB affected, CharStats affectableStats) {
   if ((whom != null) && (song != null)) {
     final Hashtable<Integer, Integer> H = getSongBenefits(song);
     for (final Enumeration<Integer> e = H.keys(); e.hasMoreElements(); ) {
       final Integer I = e.nextElement();
       final String[] chk = stuff[I.intValue()];
       if ((chk != null) && (chk[1].startsWith("c"))) {
         int ticks = H.get(I).intValue();
         if (ticks > 50) ticks = 50;
         if (ticks <= 0) ticks = 1;
         final int stat = CMath.s_int(chk[2]);
         if (CharStats.CODES.isBASE(stat)) if (ticks > 5) ticks = 5;
         affectableStats.setStat(
             stat, affectableStats.getStat(stat) + ticks + getXLEVELLevel(invoker()));
       }
     }
   }
 }
コード例 #22
0
 @Override
 public String runMacro(HTTPRequest httpReq, String parm, HTTPResponse httpResp) {
   final java.util.Map<String, String> parms = parseParms(parm);
   final String last = httpReq.getUrlParameter("GOVERNMENT");
   if (parms.containsKey("RESET")) {
     if (last != null) httpReq.removeUrlParameter("GOVERNMENT");
     return "";
   }
   int lastID = -1;
   for (final ClanGovernment G : CMLib.clans().getStockGovernments()) {
     if ((last == null)
         || ((last.length() > 0) && (CMath.s_int(last) == lastID) && (G.getID() != lastID))) {
       httpReq.addFakeUrlParameter("GOVERNMENT", Integer.toString(G.getID()));
       return "";
     }
     lastID = G.getID();
   }
   httpReq.addFakeUrlParameter("GOVERNMENT", "");
   if (parms.containsKey("EMPTYOK")) return "<!--EMPTY-->";
   return " @break@";
 }
コード例 #23
0
 public boolean didHappen() {
   if (chanceToHappen < 0) {
     final String parmString = getParmString(text());
     int x = parmString.indexOf('%');
     if (x < 0) {
       chanceToHappen = 100;
       return true;
     }
     int mul = 1;
     int tot = 0;
     while ((--x) >= 0) {
       if (Character.isDigit(parmString.charAt(x)))
         tot += CMath.s_int("" + parmString.charAt(x)) * mul;
       else x = -1;
       mul = mul * 10;
     }
     chanceToHappen = (short) tot;
   }
   if (CMLib.dice().rollPercentage() <= chanceToHappen) return true;
   return false;
 }
コード例 #24
0
ファイル: JournalMessageNext.java プロジェクト: bbailey/ewok
  public String runMacro(ExternalHTTPRequests httpReq, String parm) {
    Hashtable parms = parseParms(parm);
    String journalName = httpReq.getRequestParameter("JOURNAL");
    if (journalName == null) return " @break@";

    if (CMLib.journals().isArchonJournalName(journalName)) {
      MOB M = Authenticate.getAuthenticatedMob(httpReq);
      if ((M == null) || (!CMSecurity.isASysOp(M))) return " @break@";
    }

    String srch = httpReq.getRequestParameter("JOURNALMESSAGESEARCH");
    if (srch != null) srch = srch.toLowerCase();
    String last = httpReq.getRequestParameter("JOURNALMESSAGE");
    int cardinal = CMath.s_int(httpReq.getRequestParameter("JOURNALCARDINAL"));
    if (parms.containsKey("RESET")) {
      if (last != null) {
        httpReq.removeRequestParameter("JOURNALMESSAGE");
        httpReq.removeRequestParameter("JOURNALCARDINAL");
      }
      return "";
    }
    MOB M = Authenticate.getAuthenticatedMob(httpReq);
    cardinal++;
    JournalsLibrary.JournalEntry entry = null;
    List<JournalsLibrary.JournalEntry> msgs = JournalInfo.getMessages(httpReq, journalName);
    while ((entry == null)
        || (!CMLib.journals().canReadMessage(entry, srch, M, parms.contains("NOPRIV")))) {
      entry = JournalInfo.getNextEntry(msgs, last);
      if (entry == null) {
        httpReq.addRequestParameters("JOURNALMESSAGE", "");
        if (parms.containsKey("EMPTYOK")) return "<!--EMPTY-->";
        return " @break@";
      }
      last = entry.key;
    }
    entry.cardinal = cardinal;
    httpReq.addRequestParameters("JOURNALCARDINAL", "" + cardinal);
    httpReq.addRequestParameters("JOURNALMESSAGE", last);
    return "";
  }
コード例 #25
0
 public boolean addMeIfNeccessary(
     PhysicalAgent source, Physical target, boolean makeLongLasting, int asLevel, short maxTicks) {
   final List<Ability> V = getMySpellsV();
   if ((target == null)
       || (V.size() == 0)
       || ((compiledMask != null) && (!CMLib.masking().maskCheck(compiledMask, target, true))))
     return false;
   final List VTOO = convertToV2(V, target);
   if (VTOO.size() == 0) return false;
   final MOB qualMOB = getInvokerMOB(source, target);
   for (int v = 0; v < VTOO.size(); v += 2) {
     final Ability A = (Ability) VTOO.get(v);
     final Vector V2 = (Vector) VTOO.get(v + 1);
     if (level >= 0) asLevel = level;
     else if (asLevel <= 0) asLevel = (affected != null) ? affected.phyStats().level() : 0;
     A.invoke(qualMOB, V2, target, true, asLevel);
     final Ability EA = target.fetchEffect(A.ID());
     lastMOB = target;
     // this needs to go here because otherwise it makes non-item-invoked spells long lasting,
     // which means they dont go away when item is removed.
     if (EA != null) {
       if ((maxTicks > 0)
           && (maxTicks < Short.MAX_VALUE)
           && (CMath.s_int(EA.getStat("TICKDOWN")) > maxTicks))
         EA.setStat("TICKDOWN", Short.toString(maxTicks));
       else if (makeLongLasting) {
         EA.makeLongLasting();
         if (!uninvocable) {
           EA.makeNonUninvokable();
           if (unrevocableSpells == null) unrevocableSpells = new Vector<Ability>();
           unrevocableSpells.add(EA);
         }
       }
     }
   }
   return true;
 }
コード例 #26
0
ファイル: CoffeeUtensils.java プロジェクト: bbailey/ewok
  public boolean resurrect(MOB tellMob, Room corpseRoom, DeadBody body, int XPLevel) {
    MOB rejuvedMOB = CMLib.players().getPlayer(((DeadBody) body).mobName());
    if (rejuvedMOB != null) {
      rejuvedMOB.tell("You are being resurrected.");
      if (rejuvedMOB.location() != corpseRoom) {
        rejuvedMOB
            .location()
            .showOthers(rejuvedMOB, null, CMMsg.MSG_OK_VISUAL, "<S-NAME> disappears!");
        corpseRoom.bringMobHere(rejuvedMOB, false);
      }
      Ability A = rejuvedMOB.fetchAbility("Prop_AstralSpirit");
      if (A != null) rejuvedMOB.delAbility(A);
      A = rejuvedMOB.fetchEffect("Prop_AstralSpirit");
      if (A != null) rejuvedMOB.delEffect(A);

      int it = 0;
      while (it < rejuvedMOB.location().numItems()) {
        Item item = rejuvedMOB.location().fetchItem(it);
        if ((item != null) && (item.container() == body)) {
          CMMsg msg2 = CMClass.getMsg(rejuvedMOB, body, item, CMMsg.MSG_GET, null);
          rejuvedMOB.location().send(rejuvedMOB, msg2);
          CMMsg msg3 = CMClass.getMsg(rejuvedMOB, item, null, CMMsg.MSG_GET, null);
          rejuvedMOB.location().send(rejuvedMOB, msg3);
          it = 0;
        } else it++;
      }
      body.delEffect(body.fetchEffect("Age")); // so misskids doesn't record it
      body.destroy();
      rejuvedMOB
          .baseEnvStats()
          .setDisposition(
              CMath.unsetb(rejuvedMOB.baseEnvStats().disposition(), EnvStats.IS_SITTING));
      rejuvedMOB
          .envStats()
          .setDisposition(
              CMath.unsetb(rejuvedMOB.baseEnvStats().disposition(), EnvStats.IS_SITTING));
      rejuvedMOB.location().show(rejuvedMOB, null, CMMsg.MSG_NOISYMOVEMENT, "<S-NAME> get(s) up!");
      corpseRoom.recoverRoomStats();
      Vector whatsToDo = CMParms.parse(CMProps.getVar(CMProps.SYSTEM_PLAYERDEATH));
      for (int w = 0; w < whatsToDo.size(); w++) {
        String whatToDo = (String) whatsToDo.elementAt(w);
        if (whatToDo.startsWith("UNL")) CMLib.leveler().level(rejuvedMOB);
        else if (whatToDo.startsWith("ASTR")) {
        } else if (whatToDo.startsWith("PUR")) {
        } else if ((whatToDo.trim().equals("0")) || (CMath.s_int(whatToDo) > 0)) {
          if (XPLevel >= 0) {
            int expLost = (CMath.s_int(whatToDo) + (2 * XPLevel)) / 2;
            rejuvedMOB.tell("^*You regain " + expLost + " experience points.^?^.");
            CMLib.leveler().postExperience(rejuvedMOB, null, null, expLost, false);
          }
        } else if (whatToDo.length() < 3) continue;
        else if (XPLevel >= 0) {
          double lvl = (double) body.envStats().level();
          for (int l = body.envStats().level(); l < rejuvedMOB.envStats().level(); l++)
            lvl = lvl / 2.0;
          int expRestored = (int) Math.round(((100.0 + (2.0 * ((double) XPLevel))) * lvl) / 2.0);
          rejuvedMOB.tell("^*You regain " + expRestored + " experience points.^?^.");
          CMLib.leveler().postExperience(rejuvedMOB, null, null, expRestored, false);
        }
      }
      return true;
    } else
      corpseRoom.show(
          tellMob,
          body,
          CMMsg.MSG_OK_VISUAL,
          "<T-NAME> twitch(es) for a moment, but the spirit is too far gone.");
    return false;
  }
コード例 #27
0
ファイル: Tailoring.java プロジェクト: bbailey/ewok
  public boolean invoke(
      MOB mob, Vector commands, Environmental givenTarget, boolean auto, int asLevel) {
    int autoGenerate = 0;
    if ((auto)
        && (givenTarget == this)
        && (commands.size() > 0)
        && (commands.firstElement() instanceof Integer)) {
      autoGenerate = ((Integer) commands.firstElement()).intValue();
      commands.removeElementAt(0);
      givenTarget = null;
    }
    DVector enhancedTypes = enhancedTypes(mob, commands);
    randomRecipeFix(mob, addRecipes(mob, loadRecipes()), commands, autoGenerate);
    if (commands.size() == 0) {
      commonTell(
          mob,
          "Knit what? Enter \"knit list\" for a list, \"knit refit <item>\" to resize, \"knit scan\", or \"knit mend <item>\".");
      return false;
    }
    if ((!auto)
        && (commands.size() > 0)
        && (((String) commands.firstElement()).equalsIgnoreCase("bundle"))) {
      bundling = true;
      if (super.invoke(mob, commands, givenTarget, auto, asLevel))
        return super.bundle(mob, commands);
      return false;
    }
    Vector recipes = addRecipes(mob, loadRecipes());
    String str = (String) commands.elementAt(0);
    String startStr = null;
    bundling = false;
    int duration = 4;
    if (str.equalsIgnoreCase("list")) {
      String mask = CMParms.combine(commands, 1);
      StringBuffer buf = new StringBuffer("");
      int toggler = 1;
      int toggleTop = 2;
      for (int r = 0; r < toggleTop; r++)
        buf.append(CMStrings.padRight("Item", 28) + " Lvl " + CMStrings.padRight("Cloth", 5) + " ");
      buf.append("\n\r");
      for (int r = 0; r < recipes.size(); r++) {
        Vector V = (Vector) recipes.elementAt(r);
        if (V.size() > 0) {
          String item = replacePercent((String) V.elementAt(RCP_FINALNAME), "");
          int level = CMath.s_int((String) V.elementAt(RCP_LEVEL));
          int wood = CMath.s_int((String) V.elementAt(RCP_WOOD));
          wood = adjustWoodRequired(wood, mob);
          if ((level <= xlevel(mob))
              && ((mask == null)
                  || (mask.length() == 0)
                  || mask.equalsIgnoreCase("all")
                  || CMLib.english().containsString(item, mask))) {
            buf.append(
                CMStrings.padRight(item, 28)
                    + " "
                    + CMStrings.padRight("" + level, 3)
                    + " "
                    + CMStrings.padRight("" + wood, 5)
                    + ((toggler != toggleTop) ? " " : "\n\r"));
            if (++toggler > toggleTop) toggler = 1;
          }
        }
      }
      if (toggler != 1) buf.append("\n\r");
      commonTell(mob, buf.toString());
      enhanceList(mob);
      return true;
    }
    if (str.equalsIgnoreCase("scan")) return publicScan(mob, commands);
    else if (str.equalsIgnoreCase("mend")) {
      building = null;
      mending = false;
      messedUp = false;
      Vector newCommands = CMParms.parse(CMParms.combine(commands, 1));
      building =
          getTarget(mob, mob.location(), givenTarget, newCommands, Wearable.FILTER_UNWORNONLY);
      if (!canMend(mob, building, false)) return false;
      mending = true;
      if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;
      startStr = "<S-NAME> start(s) mending " + building.name() + ".";
      displayText = "You are mending " + building.name();
      verb = "mending " + building.name();
    } else if (str.equalsIgnoreCase("refit")) {
      building = null;
      mending = false;
      refitting = false;
      messedUp = false;
      Vector newCommands = CMParms.parse(CMParms.combine(commands, 1));
      building =
          getTarget(mob, mob.location(), givenTarget, newCommands, Wearable.FILTER_UNWORNONLY);
      if (building == null) return false;
      if ((building.material() & RawMaterial.MATERIAL_MASK) != RawMaterial.MATERIAL_CLOTH) {
        commonTell(mob, "That's not made of cloth.  It can't be refitted.");
        return false;
      }
      if (!(building instanceof Armor)) {
        commonTell(mob, "You don't know how to refit that sort of thing.");
        return false;
      }
      if (building.envStats().height() == 0) {
        commonTell(mob, building.name() + " is already the right size.");
        return false;
      }
      refitting = true;
      if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;
      startStr = "<S-NAME> start(s) refitting " + building.name() + ".";
      displayText = "You are refitting " + building.name();
      verb = "refitting " + building.name();
    } else {
      building = null;
      mending = false;
      messedUp = false;
      refitting = false;
      aborted = false;
      int amount = -1;
      if ((commands.size() > 1) && (CMath.isNumber((String) commands.lastElement()))) {
        amount = CMath.s_int((String) commands.lastElement());
        commands.removeElementAt(commands.size() - 1);
      }
      String recipeName = CMParms.combine(commands, 0);
      Vector foundRecipe = null;
      Vector matches = matchingRecipeNames(recipes, recipeName, true);
      for (int r = 0; r < matches.size(); r++) {
        Vector V = (Vector) matches.elementAt(r);
        if (V.size() > 0) {
          int level = CMath.s_int((String) V.elementAt(RCP_LEVEL));
          if ((autoGenerate > 0) || (level <= xlevel(mob))) {
            foundRecipe = V;
            break;
          }
        }
      }
      if (foundRecipe == null) {
        commonTell(
            mob,
            "You don't know how to knit a '"
                + recipeName
                + "'.  Try \""
                + triggerStrings()[0].toLowerCase()
                + " list\" for a list.");
        return false;
      }
      int woodRequired = CMath.s_int((String) foundRecipe.elementAt(RCP_WOOD));
      woodRequired = adjustWoodRequired(woodRequired, mob);
      if (amount > woodRequired) woodRequired = amount;
      String misctype = (String) foundRecipe.elementAt(RCP_MISCTYPE);
      bundling = misctype.equalsIgnoreCase("BUNDLE");
      int[] pm = {RawMaterial.MATERIAL_CLOTH};
      int[][] data =
          fetchFoundResourceData(
              mob, woodRequired, "cloth", pm, 0, null, null, bundling, autoGenerate, enhancedTypes);
      if (data == null) return false;
      woodRequired = data[0][FOUND_AMT];
      if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;
      int lostValue =
          autoGenerate > 0
              ? 0
              : CMLib.materials()
                  .destroyResources(mob.location(), woodRequired, data[0][FOUND_CODE], 0, null);
      building = CMClass.getItem((String) foundRecipe.elementAt(RCP_CLASSTYPE));
      if (building == null) {
        commonTell(
            mob, "There's no such thing as a " + foundRecipe.elementAt(RCP_CLASSTYPE) + "!!!");
        return false;
      }
      duration =
          getDuration(
              CMath.s_int((String) foundRecipe.elementAt(RCP_TICKS)),
              mob,
              CMath.s_int((String) foundRecipe.elementAt(RCP_LEVEL)),
              4);
      String itemName =
          replacePercent(
                  (String) foundRecipe.elementAt(RCP_FINALNAME),
                  RawMaterial.CODES.NAME(data[0][FOUND_CODE]))
              .toLowerCase();
      if (bundling) itemName = "a " + woodRequired + "# " + itemName;
      else if (itemName.endsWith("s")) itemName = "some " + itemName;
      else itemName = CMLib.english().startWithAorAn(itemName);
      building.setName(itemName);
      startStr = "<S-NAME> start(s) knitting " + building.name() + ".";
      displayText = "You are knitting " + building.name();
      verb = "knitting " + building.name();
      playSound = "scissor.wav";
      building.setDisplayText(itemName + " lies here");
      building.setDescription(itemName + ". ");
      if (bundling) building.baseEnvStats().setWeight(woodRequired);
      else building.baseEnvStats().setWeight(woodRequired / 2);
      int hardness = RawMaterial.CODES.HARDNESS(data[0][FOUND_CODE]) - 1;
      building.setBaseValue(CMath.s_int((String) foundRecipe.elementAt(RCP_VALUE)));
      building.setMaterial(data[0][FOUND_CODE]);
      building.baseEnvStats().setLevel(CMath.s_int((String) foundRecipe.elementAt(RCP_LEVEL)));
      building.setSecretIdentity("This is the work of " + mob.Name() + ".");
      int capacity = CMath.s_int((String) foundRecipe.elementAt(RCP_CAPACITY));
      int canContain = CMath.s_int((String) foundRecipe.elementAt(RCP_CONTAINMASK));
      int armordmg = CMath.s_int((String) foundRecipe.elementAt(RCP_ARMORDMG));
      String spell =
          (foundRecipe.size() > RCP_SPELL)
              ? ((String) foundRecipe.elementAt(RCP_SPELL)).trim()
              : "";
      if (bundling) building.setBaseValue(lostValue);
      addSpells(building, spell);
      if (building instanceof Weapon) {
        ((Weapon) building).setWeaponClassification(Weapon.CLASS_NATURAL);
        setWeaponTypeClass((Weapon) building, misctype);
        building.baseEnvStats().setDamage(armordmg);
        ((Weapon) building).setRawProperLocationBitmap(Wearable.WORN_WIELD | Wearable.WORN_HELD);
        ((Weapon) building).setRawLogicalAnd((capacity > 1));
      }
      if (building instanceof Armor) {
        if (capacity > 0) {
          ((Armor) building).setCapacity(capacity + woodRequired);
          ((Armor) building).setContainTypes(canContain);
        }
        ((Armor) building).baseEnvStats().setArmor(0);
        if (armordmg != 0)
          ((Armor) building).baseEnvStats().setArmor(armordmg + (abilityCode() - 1) + hardness);
        setWearLocation(building, misctype, 0);
      }
      if (building instanceof Rideable) {
        setRideBasis((Rideable) building, misctype);
      }
      building.recoverEnvStats();
      building.text();
      building.recoverEnvStats();
    }

    messedUp = !proficiencyCheck(mob, 0, auto);

    if (bundling) {
      messedUp = false;
      duration = 1;
      verb = "bundling " + RawMaterial.CODES.NAME(building.material()).toLowerCase();
      startStr = "<S-NAME> start(s) " + verb + ".";
      displayText = "You are " + verb;
    }

    if (autoGenerate > 0) {
      commands.addElement(building);
      return true;
    }

    CMMsg msg = CMClass.getMsg(mob, building, this, CMMsg.MSG_NOISYMOVEMENT, startStr);
    if (mob.location().okMessage(mob, msg)) {
      mob.location().send(mob, msg);
      building = (Item) msg.target();
      beneficialAffect(mob, mob, asLevel, duration);
      enhanceItem(mob, building, enhancedTypes);
    } else if (bundling) {
      messedUp = false;
      aborted = false;
      unInvoke();
    }
    return true;
  }
コード例 #28
0
ファイル: Merge.java プロジェクト: kingdavid127/MUD
  public boolean dbMerge(MOB mob, String name, Modifiable dbM, Modifiable M, Set<String> ignores)
      throws java.io.IOException, CMException {
    if ((M instanceof Physical) && (dbM instanceof Physical)) {
      final Physical PM = (Physical) M;
      final Physical dbPM = (Physical) dbM;
      if (CMLib.flags().isCataloged(PM)) {
        mob.tell(L("^H**Warning: Changes will remove this object from the catalog."));
        PM.basePhyStats()
            .setDisposition(CMath.unsetb(PM.basePhyStats().disposition(), PhyStats.IS_CATALOGED));
      }
      if (CMLib.flags().isCataloged(dbPM))
        dbPM.basePhyStats()
            .setDisposition(CMath.unsetb(dbPM.basePhyStats().disposition(), PhyStats.IS_CATALOGED));
      PM.image();
      dbPM.image();
    }

    final String[] statCodes = dbM.getStatCodes();
    int showFlag = -1;
    if (CMProps.getIntVar(CMProps.Int.EDITORTYPE) > 0) showFlag = -999;
    boolean ok = false;
    boolean didSomething = false;
    while (!ok) {
      int showNumber = 0;
      mob.tell(name);
      for (int i = 0; i < statCodes.length; i++) {
        final String statCode = M.getStatCodes()[i];
        if (ignores.contains(statCode)
            || ((M instanceof MOB) && statCode.equalsIgnoreCase("INVENTORY"))) continue;
        final String promptStr = CMStrings.capitalizeAndLower(M.getStatCodes()[i]);
        final String dbVal = dbM.getStat(statCode);
        final String loVal = M.getStat(statCode);
        if (dbVal.equals(loVal)) continue;
        ++showNumber;
        if ((showFlag > 0) && (showFlag != showNumber)) continue;
        mob.tell(
            L(
                "^H@x1. @x2\n\rValue: ^W'@x3'\n\r^HDBVal: ^N'@x4'",
                "" + showNumber,
                promptStr,
                loVal,
                dbVal));
        if ((showFlag != showNumber) && (showFlag > -999)) continue;
        final String res =
            mob.session()
                .choose(
                    L("D)atabase Value, E)dit Value, or N)o Change, or Q)uit All: "),
                    L("DENQ"),
                    L("N"));
        if (res.trim().equalsIgnoreCase("N")) continue;
        if (res.trim().equalsIgnoreCase("Q")) throw new CMException("Cancelled by user.");
        didSomething = true;
        if (res.trim().equalsIgnoreCase("D")) {
          M.setStat(statCode, dbVal);
          continue;
        }
        M.setStat(
            statCode,
            CMLib.genEd().prompt(mob, M.getStat(statCode), ++showNumber, showFlag, promptStr));
      }
      if (showNumber == 0) return didSomething;
      if (showFlag < -900) {
        ok = true;
        break;
      }
      if (showFlag > 0) {
        showFlag = -1;
        continue;
      }
      showFlag = CMath.s_int(mob.session().prompt(L("Edit which? "), ""));
      if (showFlag <= 0) {
        showFlag = -1;
        ok = true;
      }
    }
    return didSomething;
  }
コード例 #29
0
  public boolean invoke(
      MOB mob, Vector commands, Environmental givenTarget, boolean auto, int asLevel) {
    if (type.length() == 0) return false;
    if ((mob.getClanID() == null)
        || (mob.getClanID().equalsIgnoreCase(""))
        || (mob.getClanRole() == 0)) {
      mob.tell("You aren't even a member of a clan.");
      return false;
    }
    Clan C = CMLib.clans().getClan(mob.getClanID());
    if (C == null) {
      mob.tell("You aren't even a member of a clan.");
      return false;
    }
    if (C.allowedToDoThis(mob, Clan.FUNC_CLANENCHANT) != 1) {
      mob.tell("You are not authorized to draw from the power of your " + C.typeName() + ".");
      return false;
    }
    String ClanName = C.clanID();
    String ClanType = C.typeName();

    // Invoking will be like:
    //   CAST [CLANEQSPELL] ITEM QUANTITY
    //   -2   -1            0    1
    if (commands.size() < 1) {
      mob.tell("Enchant which spell onto what?");
      return false;
    }
    if (commands.size() < 2) {
      mob.tell("Use how much clan enchantment power?");
      return false;
    }
    Environmental target =
        mob.location()
            .fetchFromMOBRoomFavorsItems(
                mob, null, (String) commands.elementAt(0), Item.WORNREQ_UNWORNONLY);
    if ((target == null) || (!CMLib.flags().canBeSeenBy(target, mob))) {
      mob.tell("You don't see '" + ((String) commands.elementAt(0)) + "' here.");
      return false;
    }
    // Add clan power check start
    int points = CMath.s_int((String) commands.elementAt(1));
    if (points <= 0) {
      mob.tell("You need to use at least 1 enchantment point.");
      return false;
    }
    long exp = points * CMProps.getIntVar(CMProps.SYSTEMI_CLANENCHCOST);
    if ((C.getExp() < exp) || (exp < 0)) {
      mob.tell(
          "You need "
              + exp
              + " to do that, but your "
              + C.typeName()
              + " has only "
              + C.getExp()
              + " experience points.");
      return false;
    }

    // Add clan power check end
    if (target.fetchEffect("Prop_ClanEquipment") != null) {
      mob.tell(target.name() + " is already clan enchanted.");
      return false;
    }

    // lose all the mana!
    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

    boolean success = proficiencyCheck(mob, 0, auto);

    C.setExp(C.getExp() - exp);
    C.update();

    if (success) {
      CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              verbalCastCode(mob, target, auto),
              "^S<S-NAME> move(s) <S-HIS-HER> fingers around <T-NAMESELF>, encanting intensely.^?");
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        Ability A = CMClass.getAbility("Prop_ClanEquipment");
        StringBuffer str = new StringBuffer("");
        str.append(type); // Type of Enchantment
        str.append(" ");
        str.append("" + points); // Power of Enchantment
        str.append(" \"");
        str.append(ClanName); // Clan Name
        str.append("\" \"");
        str.append(ClanType); // Clan Type
        str.append("\"");
        A.setMiscText(str.toString());
        target.addEffect(A);
      }
    } else
      beneficialWordsFizzle(
          mob,
          target,
          "<S-NAME> move(s) <S-HIS-HER> fingers around <T-NAMESELF>, encanting intensely, and looking very frustrated.");
    return success;
  }
コード例 #30
0
 public int pct() {
   int pct = 50;
   if (getParms().length() > 0) pct = CMath.s_int(getParms());
   return pct;
 }