@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: setClericRequirements(val); break; case 1: setClericRitual(val); break; case 2: setWorshipRequirements(val); break; case 3: setWorshipRitual(val); break; case 4: setServiceRitual(val); break; default: CMProps.setStatCodeExtensionValue(getStatCodes(), xtraValues, code, val); break; } }
@Override public void run() { nextTickTime = System.currentTimeMillis() + tickTime; // final String oldThreadName=Thread.currentThread().getName(); try { currentThread = Thread.currentThread(); lastStart = System.currentTimeMillis(); lastClient = null; final boolean allSuspended = CMLib.threads().isAllSuspended(); if ((CMProps.getBoolVar(CMProps.Bool.MUDSTARTED)) && (!allSuspended)) { for (final Iterator<TickClient> i = tickers(); i.hasNext(); ) { final TickClient client = i.next(); lastClient = client; // if(client.getCurrentTickDown()<=1) // currentThread.setName(oldThreadName+":"+getName()+":"+client.getName()); if (client.tickTicker(false)) { delTicker(client); // cant do i.remove, its an streeset } } } } finally { lastStop = System.currentTimeMillis(); milliTotal += (lastStop - lastStart); tickTotal++; currentThread = null; // Thread.currentThread().setName(oldThreadName); } if (tickers.size() == 0) { if (CMLib.threads() instanceof ServiceEngine) ((ServiceEngine) CMLib.threads()).delTickGroup(this); } }
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; } }
public void recursiveDropMOB(MOB mob, Room room, Item thisContainer, boolean bodyFlag) { // caller is responsible for recovering any env // stat changes! if (CMLib.flags().isHidden(thisContainer)) thisContainer .baseEnvStats() .setDisposition( thisContainer.baseEnvStats().disposition() & ((int) EnvStats.ALLMASK - EnvStats.IS_HIDDEN)); mob.delInventory(thisContainer); thisContainer.unWear(); if (!bodyFlag) bodyFlag = (thisContainer instanceof DeadBody); if (bodyFlag) { room.addItem(thisContainer); thisContainer.setExpirationDate(0); } else room.addItemRefuse(thisContainer, CMProps.getIntVar(CMProps.SYSTEMI_EXPIRE_PLAYER_DROP)); thisContainer.recoverEnvStats(); boolean nothingDone = true; do { nothingDone = true; for (int i = 0; i < mob.inventorySize(); i++) { Item thisItem = mob.fetchInventory(i); if ((thisItem != null) && (thisItem.container() == thisContainer)) { recursiveDropMOB(mob, room, thisItem, bodyFlag); nothingDone = false; break; } } } while (!nothingDone); }
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; }
@Override public String text() { if (CMProps.getBoolVar(CMProps.Bool.MOBCOMPRESS)) miscText = CMLib.encoder().compressString(CMLib.coffeeMaker().getPropertiesStr(this, false)); else miscText = CMLib.coffeeMaker().getPropertiesStr(this, false); return super.text(); }
@Override public String getStat(String code) { if (CMLib.coffeeMaker().getGenItemCodeNum(code) >= 0) return CMLib.coffeeMaker().getGenItemStat(this, code); switch (getCodeNum(code)) { case 0: return "" + hasALock(); case 1: return "" + hasADoor(); case 2: return "" + capacity(); case 3: return "" + containTypes(); case 4: return "" + openDelayTicks(); case 5: return "" + getClothingLayer(); case 6: return "" + getLayerAttributes(); case 7: return "" + defaultsClosed(); case 8: return "" + defaultsLocked(); default: return CMProps.getStatCodeExtensionValue(getStatCodes(), xtraValues, code); } }
@Override public boolean execute(MOB mob, Vector commands, int metaFlags) throws java.io.IOException { mob.tell(L("CoffeeMud v@x1", CMProps.getVar(CMProps.Str.MUDVER))); mob.tell(L("(C) 2000-2015 Bo Zimmerman")); mob.tell(L("^<A HREF=\"mailto:[email protected]\"^>[email protected]^</A^>")); mob.tell(L("^<A HREF=\"http://www.coffeemud.org\"^>http://www.coffeemud.org^</A^>")); return false; }
@Override public void setPermanentStat(int abilityCode, int value) { setStat(abilityCode, value); if (CharStats.CODES.isBASE(abilityCode)) setStat( CharStats.CODES.toMAXBASE(abilityCode), value - CMProps.getIntVar(CMProps.Int.BASEMAXSTAT)); }
@Override public String[] getStatCodes() { if (codes == null) codes = CMProps.getStatCodesList( CMParms.toStringArray(GenericBuilder.GenItemCode.values()), this); return codes; }
@Override public boolean execute(MOB mob, List<String> commands, int metaFlags) throws java.io.IOException { final StringBuffer head = new StringBuffer(""); final boolean isArchonLooker = CMSecurity.isASysOp(mob); head.append("^x["); head.append(CMStrings.padRight(L("Class"), 16) + " "); head.append(CMStrings.padRight(L("Race"), 8) + " "); head.append(CMStrings.padRight(L("Lvl"), 4) + " "); if (isArchonLooker) head.append(CMStrings.padRight(L("Last"), 18) + " "); head.append("] Character Name^.^?\n\r"); mob.tell( "^x[" + CMStrings.centerPreserve( L("The Administrators of @x1", CMProps.getVar(CMProps.Str.MUDNAME)), head.length() - 10) + "]^.^?"); final java.util.List<PlayerLibrary.ThinPlayer> allUsers = CMLib.database().getExtendedUserList(); String mask = CMProps.getVar(CMProps.Str.WIZLISTMASK); if (mask.length() == 0) mask = "-ANYCLASS +Archon"; final MaskingLibrary.CompiledZMask compiledMask = CMLib.masking().maskCompile(mask); for (final PlayerLibrary.ThinPlayer U : allUsers) { CharClass C; final MOB player = CMLib.players().getPlayer(U.name()); if (player != null) C = player.charStats().getCurrentClass(); else C = CMClass.getCharClass(U.charClass()); if (C == null) C = CMClass.findCharClass(U.charClass()); if (((player != null) && (CMLib.masking().maskCheck(compiledMask, player, true))) || (CMLib.masking().maskCheck(compiledMask, U))) { head.append("["); if (C != null) head.append(CMStrings.padRight(C.name(), 16) + " "); else head.append(CMStrings.padRight(L("Unknown"), 16) + " "); head.append(CMStrings.padRight(U.race(), 8) + " "); if ((C == null) || (!C.leveless())) head.append(CMStrings.padRight("" + U.level(), 4) + " "); else head.append(CMStrings.padRight(" ", 4) + " "); if (isArchonLooker) head.append(CMStrings.padRight(CMLib.time().date2String(U.last()), 18) + " "); head.append("] " + U.name()); head.append("\n\r"); } } mob.tell(head.toString()); return false; }
@Override public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { Item target = null; if ((commands.size() == 0) && (!auto) && (givenTarget == null)) target = Prayer_Sacrifice.getBody(mob.location()); if (target == null) target = getTarget(mob, mob.location(), givenTarget, commands, Wearable.FILTER_UNWORNONLY); if (target == null) return false; if ((!(target instanceof DeadBody)) || (target.rawSecretIdentity().toUpperCase().indexOf("FAKE") >= 0)) { mob.tell(L("You may only desecrate the dead.")); return false; } if ((((DeadBody) target).isPlayerCorpse()) && (!((DeadBody) target).getMobName().equals(mob.Name())) && (((DeadBody) target).hasContent())) { mob.tell(L("You are not allowed to desecrate a players corpse.")); return false; } if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; final boolean success = proficiencyCheck(mob, 0, auto); if (success) { final CMMsg msg = CMClass.getMsg( mob, target, this, verbalCastCode(mob, target, auto), auto ? L("<T-NAME> feel(s) desecrated!") : L("^S<S-NAME> desecrate(s) <T-NAMESELF> before @x1.^?", hisHerDiety(mob))); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); if (CMLib.flags().isEvil(mob)) { double exp = 5.0; final int levelLimit = CMProps.getIntVar(CMProps.Int.EXPRATE); final int levelDiff = (mob.phyStats().level()) - target.phyStats().level(); if (levelDiff > levelLimit) exp = 0.0; if (exp > 0.0) CMLib.leveler() .postExperience( mob, null, null, (int) Math.round(exp) + super.getXPCOSTLevel(mob), false); } target.destroy(); mob.location().recoverRoomStats(); } } else beneficialWordsFizzle( mob, target, L("<S-NAME> attempt(s) to desecrate <T-NAMESELF>, but fail(s).")); // return whether it worked return success; }
public String[] getStatCodes() { if (codes != null) return codes; String[] MYCODES = CMProps.getStatCodesList(GenShipContainer.MYCODES, this); String[] superCodes = GenericBuilder.GENITEMCODES; codes = new String[superCodes.length + MYCODES.length]; int i = 0; for (; i < superCodes.length; i++) codes[i] = superCodes[i]; for (int x = 0; x < MYCODES.length; i++, x++) codes[i] = MYCODES[x]; return codes; }
@Override public String[] getStatCodes() { if (codes != null) return codes; final String[] MYCODES = CMProps.getStatCodesList(GenThinArmor.MYCODES, this); final String[] superCodes = CMParms.toStringArray(GenericBuilder.GenItemCode.values()); codes = new String[superCodes.length + MYCODES.length]; int i = 0; for (; i < superCodes.length; i++) codes[i] = superCodes[i]; for (int x = 0; x < MYCODES.length; i++, x++) codes[i] = MYCODES[x]; return codes; }
@Override public String[] getStatCodes() { if (codes != null) return codes; final String[] MYCODES = CMProps.getStatCodesList(GenShopkeeper.MYCODES, this); final String[] superCodes = GenericBuilder.GENMOBCODES; codes = new String[superCodes.length + MYCODES.length]; int i = 0; for (; i < superCodes.length; i++) codes[i] = superCodes[i]; for (int x = 0; x < MYCODES.length; i++, x++) codes[i] = MYCODES[x]; return codes; }
@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 Trap setTrap(MOB mob, Physical P, int trapBonus, int qualifyingClassLevel, boolean perm) { if (P == null) return null; final Trap T = (Trap) copyOf(); T.setInvoker(mob); P.addEffect(T); CMLib.threads() .startTickDown( T, Tickable.TICKID_TRAP_DESTRUCTION, CMProps.getIntVar(CMProps.Int.TICKSPERMUDDAY) + (2 * getXLEVELLevel(mob))); return T; }
@Override public String getStat(String code) { if (CMLib.coffeeMaker().getGenItemCodeNum(code) >= 0) return CMLib.coffeeMaker().getGenItemStat(this, code); switch (getCodeNum(code)) { case 0: return "" + getClothingLayer(); case 1: return "" + getLayerAttributes(); default: return CMProps.getStatCodeExtensionValue(getStatCodes(), xtraValues, code); } }
public static void doAnimalFreeingCheck(CharClass C, Environmental host, CMMsg msg) { if ((msg.source() != host) && (msg.sourceMinor() == CMMsg.TYP_NOFOLLOW) && (msg.source().isMonster()) && (host instanceof MOB) && (!((MOB) host).isMonster()) && (msg.target() == host) && (msg.source().getStartRoom() != null) && (CMLib.law().isACity(msg.source().getStartRoom().getArea())) && (((MOB) host).charStats().getCurrentClass().ID().equals(C.ID())) && (CMLib.flags().isAnimalIntelligence(msg.source()) || msg.source().charStats().getMyRace().racialCategory().equalsIgnoreCase("Vegetation") || msg.source() .charStats() .getMyRace() .racialCategory() .equalsIgnoreCase("Stone Golem")) && (CMLib.flags().flaggedAffects(msg.source(), Ability.FLAG_SUMMONING).size() == 0) && (msg.source().location() != null) && (!msg.source().amDestroyed()) && (CMLib.flags().isInTheGame((MOB) host, true)) && (!CMLib.law().isACity(msg.source().location().getArea()))) { Object[] stuff = (Object[]) animalChecking.get(host); final Room room = msg.source().location(); if ((stuff == null) || (System.currentTimeMillis() - ((Long) stuff[0]).longValue() > (room.getArea().getTimeObj().getDaysInMonth() * room.getArea().getTimeObj().getHoursInDay() * CMProps.getMillisPerMudHour()))) { stuff = new Object[3]; stuff[0] = Long.valueOf(System.currentTimeMillis()); animalChecking.remove(host); animalChecking.put(host, stuff); stuff[1] = Integer.valueOf(0); stuff[2] = new Vector(); } if ((((Integer) stuff[1]).intValue() < 19) && (!((List) stuff[2]).contains("" + msg.source()))) { stuff[1] = Integer.valueOf(((Integer) stuff[1]).intValue() + 1); ((MOB) host) .tell( CMLib.lang() .L( "You have freed @x1 from @x2.", msg.source().name((MOB) host), (msg.source().getStartRoom().getArea().name()))); CMLib.leveler() .postExperience((MOB) host, null, null, ((Integer) stuff[1]).intValue(), false); } } }
public boolean shutdown() { // int numTicks=tickGroup.size(); int which = 0; while (ticks.size() > 0) { // Log.sysOut("ServiceEngine","Shutting down all tick "+which+"/"+numTicks+"..."); Tick tock = ticks.getFirst(); if (tock != null) { CMProps.setUpAllLowVar( CMProps.SYSTEM_MUDSTATUS, "Shutting down...shutting down Service Engine: killing Tick#" + tock.getCounter() + ": " + tock.getStatus()); tock.shutdown(); } try { Thread.sleep(100); } catch (Exception e) { } which++; } CMProps.setUpAllLowVar( CMProps.SYSTEM_MUDSTATUS, "Shutting down...shutting down Service Engine: " + ID() + ": thread shutdown"); thread.shutdown(); // force final time tick! Vector timeObjects = new Vector(); for (Enumeration e = CMLib.map().areas(); e.hasMoreElements(); ) { Area A = ((Area) e.nextElement()); if (!timeObjects.contains(A.getTimeObj())) timeObjects.addElement(A.getTimeObj()); } CMProps.setUpAllLowVar( CMProps.SYSTEM_MUDSTATUS, "Shutting down...shutting down Service Engine: " + ID() + ": saving time objects"); for (int t = 0; t < timeObjects.size(); t++) ((TimeClock) timeObjects.elementAt(t)).save(); Log.sysOut("ServiceEngine", "Shutdown complete."); return true; }
@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; } }
@Override public String getStat(String code) { if (CMLib.coffeeMaker().getGenItemCodeNum(code) >= 0) return CMLib.coffeeMaker().getGenItemStat(this, code); switch (getCodeNum(code)) { case 0: return "" + hasALock(); case 1: return "" + hasADoor(); case 2: return "" + capacity(); case 3: return "" + containTypes(); case 4: return "" + openDelayTicks(); case 5: return "" + powerCapacity(); case 6: { final StringBuilder str = new StringBuilder(""); for (int i = 0; i < getConsumedFuelTypes().length; i++) { if (i > 0) str.append(", "); str.append(RawMaterial.CODES.NAME(getConsumedFuelTypes()[i])); } return str.toString(); } case 7: return "" + powerRemaining(); case 8: return "" + getGeneratedAmountPerTick(); case 9: return "" + activated(); case 10: return "" + getManufacturerName(); case 11: return "" + getInstalledFactor(); case 12: return "" + defaultsClosed(); case 13: return "" + defaultsLocked(); default: return CMProps.getStatCodeExtensionValue(getStatCodes(), xtraValues, code); } }
@Override public String getStat(String code) { if (CMLib.coffeeMaker().getGenMobCodeNum(code) >= 0) return CMLib.coffeeMaker().getGenMobStat(this, code); switch (getCodeNum(code)) { case 0: return getClericRequirements(); case 1: return getClericRitual(); case 2: return getWorshipRequirements(); case 3: return getWorshipRitual(); case 4: return getServiceRitual(); default: return CMProps.getStatCodeExtensionValue(getStatCodes(), xtraValues, code); } }
public String getStat(String code) { if (CMLib.coffeeMaker().getGenItemCodeNum(code) >= 0) return CMLib.coffeeMaker().getGenItemStat(this, code); switch (getCodeNum(code)) { case 0: return "" + hasALock(); case 1: return "" + hasALid(); case 2: return "" + capacity(); case 3: return "" + containTypes(); case 4: return "" + fuelType(); case 5: return "" + powerCapacity(); default: return CMProps.getStatCodeExtensionValue(getStatCodes(), xtraValues, code); } }
@Override public void setRacialStat(final int abilityCode, final int racialMax) { if ((!CharStats.CODES.isBASE(abilityCode)) || (getStat(abilityCode) == VALUE_ALLSTATS_DEFAULT)) setPermanentStat(abilityCode, racialMax); else { final int baseMax = CMProps.getIntVar(CMProps.Int.BASEMAXSTAT); int currMax = getStat(CharStats.CODES.toMAXBASE(abilityCode)) + baseMax; if (currMax <= 0) currMax = 1; int curStat = getStat(abilityCode); if (curStat > currMax * 7) { final String errorMsg = "Detected mob with " + curStat + "/" + currMax + " " + CharStats.CODES.ABBR(abilityCode); @SuppressWarnings({"unchecked", "rawtypes"}) Set<String> errs = (Set) Resources.getResource("SYSTEM_DEFCHARSTATS_ERRORS"); if (errs == null) { errs = new TreeSet<String>(); Resources.submitResource("SYSTEM_DEFCHARSTATS_ERRORS", errs); } if (!errs.contains(errorMsg)) { errs.add(errorMsg); final StringBuilder str = new StringBuilder(errorMsg); // ByteArrayOutputStream stream=new ByteArrayOutputStream(); // new Exception().printStackTrace(new PrintStream(stream)); // str.append("\n\r"+new String(stream.toByteArray())); Log.errOut("DefCharStats", str.toString()); } curStat = currMax * 7; } final int pctOfMax = Math.round(((float) curStat / (float) currMax) * racialMax); final int stdMaxAdj = Math.round((((float) (currMax - VALUE_ALLSTATS_DEFAULT)) / (float) currMax) * racialMax); final int racialStat = pctOfMax + stdMaxAdj; setStat(abilityCode, ((racialStat < 1) && (racialMax > 0)) ? 1 : racialStat); setStat(CharStats.CODES.toMAXBASE(abilityCode), racialMax - baseMax); } }
@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; } }
// update lot, since its called by the savethread, ONLY worries about itself @Override public void updateLot(List optPlayerList) { if (affected instanceof Room) { Room R = (Room) affected; synchronized (("SYNC" + R.roomID()).intern()) { R = CMLib.map().getRoom(R); lastItemNums = updateLotWithThisData(R, this, false, scheduleReset, optPlayerList, lastItemNums); if ((lastDayDone != R.getArea().getTimeObj().getDayOfMonth()) && (CMProps.getBoolVar(CMProps.Bool.MUDSTARTED))) { lastDayDone = R.getArea().getTimeObj().getDayOfMonth(); if ((getOwnerName().length() > 0) && rentalProperty() && (R.roomID().length() > 0)) if (doRentalProperty(R.getArea(), R.roomID(), getOwnerName(), getPrice())) { setOwnerName(""); CMLib.database().DBUpdateRoom(R); lastItemNums = updateLotWithThisData(R, this, false, scheduleReset, optPlayerList, lastItemNums); } } scheduleReset = false; } } }
@Override public String getStat(String code) { if (CMLib.coffeeMaker().getGenMobCodeNum(code) >= 0) return CMLib.coffeeMaker().getGenMobStat(this, code); switch (getCodeNum(code)) { case 0: return "" + getWhatIsSoldMask(); case 1: return prejudiceFactors(); case 2: return budget(); case 3: return devalueRate(); case 4: return "" + invResetRate(); case 5: return ignoreMask(); case 6: return CMParms.toStringList(itemPricingAdjustments()); default: return CMProps.getStatCodeExtensionValue(getStatCodes(), xtraValues, code); } }
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; }
@Override protected int DISEASE_DELAY() { return (int) (CMProps.getMillisPerMudHour() / CMProps.getTickMillis()); }