public PhysicalAgent getTarget(String parameters) { if (parameters.equalsIgnoreCase("USER")) return req.getUser(); int x = parameters.indexOf('@'); String who = parameters; String where = ""; PhysicalAgent P = req.getTarget(); if (x > 0) { who = parameters.substring(0, x); where = parameters.substring(x + 1); Room R = CMLib.map().getRoom(where); if (R == null) { Area A = CMLib.map().getArea(where); if (A != null) R = A.getRandomMetroRoom(); } if (who.length() == 0) P = R; } else { MOB M = CMLib.players().getLoadPlayer(who); if (M != null) return M; } Room R = CMLib.map().roomLocation(P); if (R == null) CMLib.map().roomLocation(req.getTarget()); if (R == null) return null; P = R.fetchFromRoomFavorMOBs(null, who); if ((P == null) && (req.getTarget() instanceof MOB)) P = R.fetchFromRoomFavorMOBs(null, who); return P; }
public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { if (commands.size() < 1) { mob.tell("Grow plants where?"); return false; } String areaName = CMParms.combine(commands, 0).trim().toUpperCase(); Room anyRoom = null; Room newRoom = null; try { List<Room> rooms = CMLib.map().findRooms(CMLib.map().rooms(), mob, areaName, true, 10); for (Room R : rooms) { anyRoom = R; if (R.domainType() == Room.DOMAIN_INDOORS_CAVE) { newRoom = R; break; } } } catch (NoSuchElementException e) { } if (newRoom == null) { if (anyRoom == null) mob.tell("You don't know of a place called '" + CMParms.combine(commands, 0) + "'."); else if ((anyRoom.domainType() & Room.INDOORS) == 0) mob.tell("There IS such a place, but it is outdoors, where your fungus will not grow."); else if ((anyRoom.domainType() == Room.DOMAIN_INDOORS_UNDERWATER) || (anyRoom.domainType() == Room.DOMAIN_INDOORS_WATERSURFACE)) mob.tell("There IS such a place, but it is on or in the water, so your magic would fail."); else mob.tell("There IS such a place, but it is not in a cave, so your magic would fail."); return false; } if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; boolean success = proficiencyCheck(mob, 0, auto); if (success) { CMMsg msg = CMClass.getMsg( mob, null, this, verbalCastCode(mob, null, auto), "^S<S-NAME> chant(s) about a far away place.^?"); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); Item newItem = Chant_SummonFungus.buildFungus(mob, newRoom); mob.tell("You feel a distant connection with " + newItem.name()); } } else beneficialWordsFizzle( mob, null, "<S-NAME> chant(s) about a far away place, but the magic fades."); // return whether it worked return success; }
@Override public String getTitleID() { if (affected instanceof Room) return "LAND_TITLE_FOR#" + CMLib.map().getExtendedRoomID((Room) affected); else { final Room R = CMLib.map().getRoom(landPropertyID()); if (R != null) return "LAND_TITLE_FOR#" + CMLib.map().getExtendedRoomID(R); } return ""; }
public String getFormattedDate(Environmental E) { String date = CMStrings.padRight("Unknown", 11); if (E != null) { TimeClock C = (E instanceof Area) ? ((Area) E).getTimeObj() : ((CMLib.map().roomLocation(E) != null) ? CMLib.map().roomLocation(E).getArea().getTimeObj() : null); if (C != null) date = CMStrings.padRight(C.getDayOfMonth() + "-" + C.getMonth() + "-" + C.getYear(), 11); } return date; }
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { super.executeMsg(myHost, msg); if (((msg.sourceMinor() == CMMsg.TYP_SHUTDOWN) || ((msg.targetMinor() == CMMsg.TYP_EXPIRE) && (msg.target() == affected)) || (msg.sourceMinor() == CMMsg.TYP_ROOMRESET)) && (affected instanceof Room)) { updateLot(null); final Vector mobs = new Vector(); Room R = (Room) affected; if (R != null) { synchronized (("SYNC" + R.roomID()).intern()) { R = CMLib.map().getRoom(R); for (int m = 0; m < R.numInhabitants(); m++) { final MOB M = R.fetchInhabitant(m); if ((M != null) && (M.isSavable()) && (M.getStartRoom() == R) && ((M.basePhyStats().rejuv() == 0) || (M.basePhyStats().rejuv() == PhyStats.NO_REJUV))) { CMLib.catalog().updateCatalogIntegrity(M); mobs.addElement(M); } } if (!CMSecurity.isSaveFlag(CMSecurity.SaveFlag.NOPROPERTYMOBS)) CMLib.database().DBUpdateTheseMOBs(R, mobs); } } } }
@Override public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { MOB target = this.getTarget(mob, commands, givenTarget); if (target == null) return false; Room R = CMLib.map().roomLocation(target); if (R == null) R = mob.location(); if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; if ((auto) && (givenTarget != null) && (givenTarget instanceof MOB)) target = (MOB) givenTarget; // now see if it worked final boolean success = proficiencyCheck(mob, 0, auto); if (success) { final CMMsg msg = CMClass.getMsg( mob, target, this, somanticCastCode(mob, target, auto), auto ? "" : L("^S<S-NAME> speak(s) and gesture(s) to <T-NAMESELF>.^?")); if (R.okMessage(mob, msg)) { R.send(mob, msg); R.show(target, null, CMMsg.MSG_OK_VISUAL, L("<S-NAME> seem(s) much more likeable!")); beneficialAffect(mob, target, asLevel, 0); } } else return beneficialVisualFizzle( mob, target, L("<S-NAME> incant(s) gracefully to <T-NAMESELF>, but nothing more happens.")); // return whether it worked return success; }
@Override public void executeMsg(Environmental host, CMMsg msg) { super.executeMsg(host, msg); if ((msg.sourceMinor() == CMMsg.TYP_DEATH) && (msg.source() != host) && (msg.source().location() != CMLib.map().roomLocation(host))) DoneEquipping = false; }
public void reloadCharClasses(CharClass oldC) { for (Enumeration e = CMLib.map().rooms(); e.hasMoreElements(); ) { Room room = (Room) e.nextElement(); for (int i = 0; i < room.numInhabitants(); i++) { MOB M = room.fetchInhabitant(i); if (M == null) continue; for (int c = 0; c < M.baseCharStats().numClasses(); c++) if (M.baseCharStats().getMyClass(c) == oldC) { M.baseCharStats().setMyClasses(M.baseCharStats().getMyClassesStr()); break; } for (int c = 0; c < M.charStats().numClasses(); c++) if (M.charStats().getMyClass(c) == oldC) { M.charStats().setMyClasses(M.charStats().getMyClassesStr()); break; } } for (e = CMLib.players().players(); e.hasMoreElements(); ) { MOB M = (MOB) e.nextElement(); for (int c = 0; c < M.baseCharStats().numClasses(); c++) if (M.baseCharStats().getMyClass(c) == oldC) { M.baseCharStats().setMyClasses(M.baseCharStats().getMyClassesStr()); break; } for (int c = 0; c < M.charStats().numClasses(); c++) if (M.charStats().getMyClass(c) == oldC) { M.charStats().setMyClasses(M.charStats().getMyClassesStr()); break; } } } }
protected final Map<String, Double> getRatesFor(final Environmental affecting, String currency) { if (spaceMaxCut <= 0.0) return rates; currency = currency.toUpperCase(); if (rates.containsKey(currency)) return rates; String myCurrency = CMLib.beanCounter().getCurrency(affecting); if (myCurrency.equalsIgnoreCase(currency)) { rates.put(currency, Double.valueOf(cut)); return rates; } SpaceObject homeO = CMLib.map().getSpaceObject(affecting, false); if (homeO != null) { myCurrency = CMLib.beanCounter().getCurrency(homeO); if (myCurrency.equalsIgnoreCase(currency)) { rates.put(currency, Double.valueOf(cut)); return rates; } } else { // no space object, wtf? this SHOULD fail if (!complainedAboutSpaceError) { complainedAboutSpaceError = true; Log.errOut( "MoneyChanger", affecting.Name() + " is not on a planet, so space rates cannot apply!"); } return rates; } for (Enumeration<Area> a = CMLib.map().spaceAreas(); a.hasMoreElements(); ) { Area A = a.nextElement(); if ((A != null) && (A != homeO)) { myCurrency = CMLib.beanCounter().getCurrency(A); if (myCurrency.equalsIgnoreCase(currency)) { SpaceObject oA = (SpaceObject) A; long distance = CMLib.map().getDistanceFrom(homeO, oA); if ((distance < 0) || (distance > spaceMaxDistance)) { rates.put(currency, Double.valueOf(spaceMaxCut)); } else { double pct = CMath.div(distance, spaceMaxDistance); double amt = spaceMaxCut * pct; if (amt < cut) amt = cut; rates.put(currency, Double.valueOf(cut)); } return rates; } } } return rates; }
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 ""; }
public MOB getInvokerMOB(Environmental source, Environmental target) { MOB mob = getBestInvokerMOB(affected); if (mob == null) mob = getBestInvokerMOB(source); if (mob == null) mob = getBestInvokerMOB(target); if (mob == null) mob = invokerMOB; if (mob == null) { Room R = CMLib.map().roomLocation(target); if (R == null) R = CMLib.map().roomLocation(target); if (R == null) R = CMLib.map().getRandomRoom(); mob = CMLib.map().getFactoryMOB(R); mob.setName(L("invoker")); mob.basePhyStats().setLevel(affected.phyStats().level()); mob.phyStats().setLevel(affected.phyStats().level()); } invokerMOB = mob; return invokerMOB; }
public Room prepareRoomInDir(Room fromRoom, int direction) { if (amDestroyed) { Room R = CMLib.map().getRoom(roomID()); if (R != null) return R.prepareRoomInDir(fromRoom, direction); return super.prepareRoomInDir(fromRoom, direction); } return getAltRoomFrom(fromRoom, direction); }
// update title, since it may affect clusters, worries about ALL involved @Override public void updateTitle() { if (affected instanceof Room) CMLib.database().DBUpdateRoom((Room) affected); else { final Room R = CMLib.map().getRoom(landPropertyID()); if (R != null) CMLib.database().DBUpdateRoom(R); } }
@Override public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { final Item target = getTarget(mob, mob.location(), givenTarget, commands, Wearable.FILTER_ANY); if (target == null) return false; final Room room = CMLib.map().roomLocation(mob); if ((room == null) || (room.getArea() == null)) return false; final String roomID = CMLib.map().getExtendedRoomID(room); if ((CMath.bset(room.getArea().flags(), Area.FLAG_INSTANCE_CHILD)) || (roomID.length() == 0)) { mob.tell(L("The magic in this place will not permit it to become a refuge.")); 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("^S<S-NAME> point(s) at <T-NAMESELF> and @x1.^?", prayWord(mob))); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); mob.location().show(mob, target, CMMsg.MSG_OK_VISUAL, L("<T-NAME> glows slightly!")); mob.tell( L( "@x1 will now await someone to 'SAYTO \"@x1\" Refuge' to it before teleporting you back here.", target.name(mob))); final Ability A = beneficialAffect(mob, target, asLevel, Ability.TICKS_ALMOST_FOREVER); if (A != null) A.setMiscText(roomID); target.recoverPhyStats(); mob.recoverPhyStats(); } } else beneficialVisualFizzle( mob, target, L("<S-NAME> point(s) at <T-NAMESELF>, but fail(s) to properly pray.")); // return whether it worked return success; }
public int[] getRoomXY(String roomID) { Room room = CMLib.map().getRoom(roomID); if (room == null) return null; if (!isMyGridChild(room)) return null; int[] xy = new int[2]; xy[0] = getGridChildX(room); xy[1] = getGridChildY(room); return xy; }
protected Area getParentArea() { int x = Name().indexOf("_"); if (x < 0) return null; if (!CMath.isNumber(Name().substring(0, x))) return null; Area parentA = CMLib.map().getArea(Name().substring(x + 1)); if ((parentA == null) || (!CMath.bset(parentA.flags(), Area.FLAG_INSTANCE_PARENT)) || (CMath.bset(parentA.flags(), Area.FLAG_INSTANCE_CHILD))) return null; return parentA; }
@Override public List<Room> getAllTitledRooms() { final List<Room> V = new Vector(); if (affected instanceof Room) V.add((Room) affected); else { final Room R = CMLib.map().getRoom(landPropertyID()); if (R != null) V.add(R); } return V; }
public void tryFillInExtraneousExternal(WorldMap.CrossExit EX, Exit ox, Room linkFrom) { if (EX == null) return; Room linkTo = CMLib.map().getRoom(EX.destRoomID); if ((linkTo != null) && (linkTo.getGridParent() != null)) linkTo = linkTo.getGridParent(); if ((linkTo != null) && (linkFrom.rawDoors()[EX.dir] != linkTo)) { if (ox == null) ox = CMClass.getExit("Open"); linkFrom.rawDoors()[EX.dir] = linkTo; linkFrom.setRawExit(EX.dir, ox); } }
@Override public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target = this.getTarget(mob, commands, givenTarget); if (target == null) return false; Room R = CMLib.map().roomLocation(target); if (R == null) R = mob.location(); 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, somanticCastCode(mob, target, auto), L( auto ? "<T-NAME> <T-IS-ARE> sprayed with acid." : "^S<S-NAME> reach(es) for <T-NAMESELF>, spraying acid all over <T-HIM-HER>!^?") + CMLib.protocol().msp("spelldam1.wav", 40)); final CMMsg msg2 = CMClass.getMsg( mob, target, this, CMMsg.MSK_CAST_MALICIOUS_VERBAL | CMMsg.TYP_ACID | (auto ? CMMsg.MASK_ALWAYS : 0), null); if ((R.okMessage(mob, msg)) && ((R.okMessage(mob, msg2)))) { R.send(mob, msg); R.send(mob, msg2); invoker = mob; final int numDice = (adjustedLevel(mob, asLevel) + (2 * super.getX1Level(invoker()))) / 2; int damage = CMLib.dice().roll(2, numDice, 1); if ((msg2.value() > 0) || (msg.value() > 0)) damage = (int) Math.round(CMath.div(damage, 2.0)); CMLib.combat() .postDamage( mob, target, this, damage, CMMsg.MASK_ALWAYS | CMMsg.TYP_ACID, Weapon.TYPE_MELTING, L("The acid <DAMAGE> <T-NAME>!")); maliciousAffect(mob, target, asLevel, 3, -1); } } else return maliciousFizzle( mob, target, L("<S-NAME> reach(es) for <T-NAMESELF>, but nothing more happens.")); return success; }
@Override public void unInvoke() { // undo the affects of this spell if (affected == null) return; if (canBeUninvoked()) { final Room R = CMLib.map().roomLocation(affected); if ((R != null) && (CMLib.flags().isInTheGame(affected, true))) R.showHappens(CMMsg.MSG_OK_VISUAL, L("The piercing moon sets.")); } super.unInvoke(); }
public static void colorForSale(Room R, boolean rental, boolean reset) { synchronized (("SYNC" + R.roomID()).intern()) { R = CMLib.map().getRoom(R); final String theStr = rental ? RENTSTR : SALESTR; final String otherStr = rental ? SALESTR : RENTSTR; int x = R.description().indexOf(otherStr); while (x >= 0) { R.setDescription(R.description().substring(0, x)); CMLib.database().DBUpdateRoom(R); x = R.description().indexOf(otherStr); } final String oldDescription = R.description(); x = R.description().indexOf(theStr.trim()); if ((x < 0) || (reset && (!R.displayText() .equals(CMath.bset(R.domainType(), Room.INDOORS) ? INDOORSTR : OUTDOORSTR)))) { if (reset) { R.setDescription(""); R.setDisplayText(CMath.bset(R.domainType(), Room.INDOORS) ? INDOORSTR : OUTDOORSTR); x = -1; } if (x < 0) R.setDescription(R.description() + theStr); else if (!reset) R.setDescription(R.description().substring(0, x + theStr.trim().length())); if (!R.description().equals(oldDescription)) CMLib.database().DBUpdateRoom(R); } else { R.setDescription(R.description().substring(0, x + theStr.trim().length())); if (!R.description().equals(oldDescription)) CMLib.database().DBUpdateRoom(R); } Item I = R.findItem(null, "$id$"); if ((I == null) || (!I.ID().equals("GenWallpaper"))) { I = CMClass.getItem("GenWallpaper"); CMLib.flags().setReadable(I, true); I.setName(("id")); I.setReadableText(CMLib.lang().L("This room is " + CMLib.map().getExtendedRoomID(R))); I.setDescription(CMLib.lang().L("This room is @x1", CMLib.map().getExtendedRoomID(R))); R.addItem(I); CMLib.database().DBUpdateItems(R); } } }
public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { MOB target = this.getTarget(mob, commands, givenTarget); if (target == null) return false; Room R = CMLib.map().roomLocation(target); if (R == null) R = mob.location(); if (!CMLib.flags().isAnimalIntelligence(target)) { mob.tell(target.name(mob) + " is not an animal!"); return false; } // the invoke method for spells receives as // parameters the invoker, and the REMAINING // command line parameters, divided into words, // and added as String objects to a vector. if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; // now see if it worked boolean success = proficiencyCheck(mob, 0, auto); if (success) { // it worked, so build a copy of this ability, // and add it to the affects list of the // affected MOB. Then tell everyone else // what happened. String str = auto ? "" : "^S<S-NAME> chant(s) at <T-NAMESELF>.^?"; CMMsg msg = CMClass.getMsg(mob, target, this, verbalCastCode(mob, target, auto), str); if (R.okMessage(mob, msg)) { R.send(mob, msg); if (msg.value() <= 0) { success = maliciousAffect( mob, target, asLevel, 0, CMMsg.MSK_CAST_VERBAL | CMMsg.TYP_MIND | (auto ? CMMsg.MASK_ALWAYS : 0)); if (success) { if (target.isInCombat()) target.makePeace(); CMLib.commands().postFollow(target, mob, false); CMLib.combat().makePeaceInGroup(mob); if (target.amFollowing() != mob) mob.tell(target.name(mob) + " seems unwilling to follow you."); } } } } if (!success) return maliciousFizzle( mob, target, "<S-NAME> chant(s) at <T-NAMESELF>, but nothing happens."); // return whether it worked return success; }
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if (!super.okMessage(myHost, msg)) return false; if (((msg.sourceMinor() == CMMsg.TYP_TELL) || (msg.othersMajor(CMMsg.MASK_CHANNEL))) && ((msg.source() == affected) || ((msg.source().location() == CMLib.map().roomLocation(affected)) && (msg.source().isMonster()) && (msg.source().willFollowOrdersOf((MOB) affected))))) { msg.source().tell(L("Your message drifts into oblivion.")); return false; } return true; }
@Override public boolean tick(Tickable ticking, int tickID) { if (!super.tick(ticking, tickID)) return false; if (!(affected instanceof MOB)) return true; final MOB M = (MOB) affected; if (M.location() != null) { if ((!M.getWorshipCharID().equals(godName)) && (godName.length() > 0)) { final Deity D = CMLib.map().getDeity(godName); if (M.getWorshipCharID().length() > 0) { final Deity D2 = CMLib.map().getDeity(M.getWorshipCharID()); if (D2 != null) { final CMMsg msg2 = CMClass.getMsg(M, D2, this, CMMsg.MSG_REBUKE, null); if (M.location().okMessage(M, msg2)) M.location().send(M, msg2); } } final CMMsg msg2 = CMClass.getMsg(M, D, this, CMMsg.MSG_SERVE, null); if (M.location().okMessage(M, msg2)) { M.location().send(M, msg2); M.setWorshipCharID(godName); } } } return true; }
public void swapRaces(Race newR, Race oldR) { for (Enumeration e = CMLib.map().rooms(); e.hasMoreElements(); ) { Room room = (Room) e.nextElement(); for (int i = 0; i < room.numInhabitants(); i++) { MOB M = room.fetchInhabitant(i); if (M == null) continue; if (M.baseCharStats().getMyRace() == oldR) M.baseCharStats().setMyRace(newR); if (M.charStats().getMyRace() == oldR) M.charStats().setMyRace(newR); } for (e = CMLib.players().players(); e.hasMoreElements(); ) { MOB M = (MOB) e.nextElement(); if (M.baseCharStats().getMyRace() == oldR) M.baseCharStats().setMyRace(newR); if (M.charStats().getMyRace() == oldR) M.charStats().setMyRace(newR); } } }
public Hashtable makeMapRooms(int width) { String newText = getMapArea(); List<String> mapAreas = CMParms.parseSemicolons(newText, true); Hashtable mapRooms = new Hashtable(); for (int a = 0; a < mapAreas.size(); a++) { String area = mapAreas.get(a); Room room = CMLib.map().getRoom(area); if (room != null) { MapRoom mr = new MapRoom(); mr.r = room; mapRooms.put(room, mr); } } super.clearTheSkys(mapRooms); return mapRooms; }
protected static boolean reportError( final Electronics me, final Software controlI, final MOB mob, final String literalMessage, final String controlMessage) { if ((mob != null) && (mob.location() == CMLib.map().roomLocation(me)) && (literalMessage != null)) mob.tell(literalMessage); if (controlMessage != null) { if (controlI != null) controlI.addScreenMessage(controlMessage); else if ((mob != null) && (me != null)) mob.tell(CMLib.lang().L("A panel on @x1 reports '@x2'.", me.name(mob), controlMessage)); } return false; }
@Override public void unInvoke() { final Physical P = affected; super.unInvoke(); if ((P instanceof MOB) && (this.canBeUninvoked) && (this.unInvoked)) { if ((!P.amDestroyed()) && (((MOB) P).amFollowing() == null)) { final Room R = CMLib.map().roomLocation(P); if (CMLib.law().getLandOwnerName(R).length() == 0) { if (!CMLib.law().doesHavePriviledgesHere(invoker(), R)) { if ((R != null) && (!((MOB) P).amDead())) R.showHappens(CMMsg.MSG_OK_ACTION, P, L("<S-NAME> wander(s) off.")); P.destroy(); } } } } }
protected Room alternativeLink(Room room, Room defaultRoom, int dir) { if (room.getGridParent() == this) for (int d = 0; d < gridexits.size(); d++) { WorldMap.CrossExit EX = (WorldMap.CrossExit) gridexits.elementAt(d); try { if ((EX.out) && (EX.dir == dir) && (getGridRoomIfExists(EX.x, EX.y) == room)) { Room R = CMLib.map().getRoom(EX.destRoomID); if (R != null) { if (R.getGridParent() != null) return R.getGridParent(); return R; } } } catch (Exception e) { } } return defaultRoom; }
public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { try { for (Enumeration r = CMLib.map().rooms(); r.hasMoreElements(); ) { Room R = (Room) r.nextElement(); if (CMLib.flags().canAccess(mob, R)) for (final Enumeration<Ability> a = R.effects(); a.hasMoreElements(); ) { final Ability A = a.nextElement(); if ((A != null) && (A.ID().equals(ID())) && (A.invoker() == mob)) { A.unInvoke(); break; } } } } catch (NoSuchElementException nse) { } if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; boolean success = proficiencyCheck(mob, 0, auto); if (success) { CMMsg msg = CMClass.getMsg( mob, mob.location(), this, verbalCastCode(mob, null, auto), auto ? "" : "^S<S-NAME> summon(s) <S-HIS-HER> marker energy to this place!^?"); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); mob.location() .show( mob, mob.location(), CMMsg.MSG_OK_VISUAL, "The spot <S-NAME> pointed to glows for brief moment."); beneficialAffect(mob, mob.location(), 0, (adjustedLevel(mob, asLevel) * 240) + 450); } } else beneficialWordsFizzle( mob, null, "<S-NAME> attempt(s) to summon <S-HIS-HER> marker energy, but fail(s)."); // return whether it worked return success; }