@Override
 public void setStat(String code, String val) {
   final int dex = CMParms.indexOfIgnoreCase(getStatCodes(), code);
   if (dex >= 0) setStat(dex, CMath.s_parseIntExpression(val));
   else
     for (final int i : CharStats.CODES.ALLCODES()) {
       if (CODES.DESC(i).startsWith(code)) {
         setStat(dex, CMath.s_parseIntExpression(val));
         return;
       }
     }
 }
Beispiel #2
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;
     }
 }
Beispiel #3
0
 @Override
 public void setStat(String code, String val) {
   switch (getCodeNum(code)) {
     case 0:
       return;
     case 1:
       basePhyStats().setLevel(CMath.s_parseIntExpression(val));
       break;
     case 2:
       basePhyStats().setAbility(CMath.s_parseIntExpression(val));
       break;
     case 3:
       setMiscText(val);
       break;
   }
 }
Beispiel #4
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;
     }
 }
 @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:
         setClothingLayer((short) CMath.s_parseIntExpression(val));
         break;
       case 1:
         setLayerAttributes((short) CMath.s_parseListLongExpression(Armor.LAYERMASK_DESCS, val));
         break;
       default:
         CMProps.setStatCodeExtensionValue(getStatCodes(), xtraValues, code, val);
         break;
     }
 }
Beispiel #6
0
 @Override
 public void setStat(String code, String val) {
   if (CMLib.coffeeMaker().getGenMobCodeNum(code) >= 0)
     CMLib.coffeeMaker().setGenMobStat(this, code, val);
   else
     switch (getCodeNum(code)) {
       case 0:
         {
           if ((val.length() == 0) || (CMath.isLong(val))) setWhatIsSoldMask(CMath.s_long(val));
           else if (CMParms.containsIgnoreCase(ShopKeeper.DEAL_DESCS, val))
             setWhatIsSoldMask(CMParms.indexOfIgnoreCase(ShopKeeper.DEAL_DESCS, val));
           break;
         }
       case 1:
         setPrejudiceFactors(val);
         break;
       case 2:
         setBudget(val);
         break;
       case 3:
         setDevalueRate(val);
         break;
       case 4:
         setInvResetRate(CMath.s_parseIntExpression(val));
         break;
       case 5:
         setIgnoreMask(val);
         break;
       case 6:
         setItemPricingAdjustments(
             (val.trim().length() == 0)
                 ? new String[0]
                 : CMParms.toStringArray(CMParms.parseCommas(val, true)));
         break;
       default:
         CMProps.setStatCodeExtensionValue(getStatCodes(), xtraValues, code, val);
         break;
     }
 }
Beispiel #7
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(),
             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;
     }
 }
 public void setStat(String code, String val) {
   int num = 0;
   int numDex = code.length();
   while ((numDex > 0) && (Character.isDigit(code.charAt(numDex - 1)))) numDex--;
   if (numDex < code.length()) {
     num = CMath.s_int(code.substring(numDex));
     code = code.substring(0, numDex);
   }
   final GOVT_STAT_CODES stat = getStatIndex(code);
   if (stat == null) {
     return;
   }
   switch (stat) {
     case NAME:
       name = val;
       break;
     case AUTOROLE:
       {
         ClanPosition P = getPosition(val);
         if (P != null) autoRole = P.getRoleID();
         break;
       }
     case ACCEPTPOS:
       {
         ClanPosition P = getPosition(val);
         if (P != null) acceptPos = P.getRoleID();
         break;
       }
     case SHORTDESC:
       shortDesc = val;
       break;
     case LONGDESC:
       longDesc = val;
       break;
     case XPLEVELFORMULA:
       setXpCalculationFormulaStr(val);
       break;
     case REQUIREDMASK:
       requiredMaskStr = val;
       break;
     case ISPUBLIC:
       isPublic = CMath.s_bool(val);
       break;
     case ISFAMILYONLY:
       isFamilyOnly = CMath.s_bool(val);
       break;
     case OVERRIDEMINMEMBERS:
       {
         if (val.length() == 0) overrideMinMembers = null;
         else overrideMinMembers = Integer.valueOf(CMath.s_int(val));
         break;
       }
     case CONQUESTENABLED:
       conquestEnabled = CMath.s_bool(val);
       break;
     case CONQUESTITEMLOYALTY:
       conquestItemLoyalty = CMath.s_bool(val);
       break;
     case CONQUESTDEITYBASIS:
       conquestByWorship = CMath.s_bool(val);
       break;
     case MAXVOTEDAYS:
       maxVoteDays = CMath.s_int(val);
       break;
     case VOTEQUORUMPCT:
       voteQuorumPct = CMath.s_int(val);
       break;
     case AUTOPROMOTEBY:
       {
         Clan.AutoPromoteFlag flag =
             (Clan.AutoPromoteFlag) CMath.s_valueOf(Clan.AutoPromoteFlag.values(), val);
         if (flag != null) autoPromoteBy = flag;
         break;
       }
     case VOTEFUNCS:
       {
         final Vector<String> funcs = CMParms.parseCommas(val.toUpperCase().trim(), true);
         for (ClanPosition pos : positions) {
           for (int a = 0; a < Function.values().length; a++)
             if (pos.getFunctionChart()[a] == Authority.MUST_VOTE_ON)
               pos.getFunctionChart()[a] = Authority.CAN_NOT_DO;
           for (final String funcName : funcs) {
             Authority auth = (Authority) CMath.s_valueOf(Function.values(), funcName);
             if (auth != null) pos.getFunctionChart()[auth.ordinal()] = Authority.MUST_VOTE_ON;
           }
         }
         break;
       }
     case NUMRABLE:
       clanAbilityMap = null;
       if (CMath.s_int(val) == 0) {
         clanAbilityNames = null;
         clanAbilityProficiencies = null;
         clanAbilityQuals = null;
         clanAbilityLevels = null;
       } else {
         clanAbilityNames = new String[CMath.s_int(val)];
         clanAbilityProficiencies = new int[CMath.s_int(val)];
         clanAbilityQuals = new boolean[CMath.s_int(val)];
         clanAbilityLevels = new int[CMath.s_int(val)];
       }
       break;
     case GETRABLE:
       {
         if (clanAbilityNames == null) clanAbilityNames = new String[num + 1];
         clanAbilityNames[num] = val;
         break;
       }
     case GETRABLEPROF:
       {
         if (clanAbilityProficiencies == null) clanAbilityProficiencies = new int[num + 1];
         clanAbilityProficiencies[num] = CMath.s_parseIntExpression(val);
         break;
       }
     case GETRABLEQUAL:
       {
         if (clanAbilityQuals == null) clanAbilityQuals = new boolean[num + 1];
         clanAbilityQuals[num] = CMath.s_bool(val);
         break;
       }
     case GETRABLELVL:
       {
         if (clanAbilityLevels == null) clanAbilityLevels = new int[num + 1];
         clanAbilityLevels[num] = CMath.s_parseIntExpression(val);
         break;
       }
     case NUMREFF:
       clanEffectMap = null;
       if (CMath.s_int(val) == 0) {
         clanEffectNames = null;
         clanEffectParms = null;
         clanEffectLevels = null;
       } else {
         clanEffectNames = new String[CMath.s_int(val)];
         clanEffectParms = new String[CMath.s_int(val)];
         clanEffectLevels = new int[CMath.s_int(val)];
       }
       break;
     case GETREFF:
       {
         if (clanEffectNames == null) clanEffectNames = new String[num + 1];
         clanEffectNames[num] = val;
         break;
       }
     case GETREFFPARM:
       {
         if (clanEffectParms == null) clanEffectParms = new String[num + 1];
         clanEffectParms[num] = val;
         break;
       }
     case GETREFFLVL:
       {
         if (clanEffectLevels == null) clanEffectLevels = new int[num + 1];
         clanEffectLevels[num] = CMath.s_int(val);
         break;
       }
     default:
       Log.errOut("Clan", "setStat:Unhandled:" + stat.toString());
       break;
   }
 }