@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 "";
 }
Exemple #2
0
 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;
 }
Exemple #3
0
 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;
         }
     }
   }
 }
Exemple #4
0
  @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;
 }
 @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);
       }
     }
   }
 }
Exemple #7
0
  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;
  }
Exemple #8
0
  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 "";
  }
Exemple #9
0
 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);
 }
 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;
 }
 // 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);
   }
 }
Exemple #12
0
  @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;
  }
Exemple #13
0
 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;
 }
 @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;
 }
Exemple #15
0
 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;
 }
Exemple #16
0
 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);
   }
 }
Exemple #17
0
  @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);
     }
   }
 }
  @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;
 }
 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;
 }
Exemple #23
0
 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);
     }
   }
 }
 @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();
         }
       }
     }
   }
 }
Exemple #25
0
 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;
 }
Exemple #26
0
 public static java.util.List<Ability> returnOffensiveAffects(Physical fromMe) {
   final MOB newMOB = CMClass.getFactoryMOB();
   newMOB.setLocation(CMLib.map().roomLocation(fromMe));
   final List<Ability> offenders = new Vector<Ability>();
   for (int a = 0; a < fromMe.numEffects(); a++) // personal
   {
     final Ability A = fromMe.fetchEffect(a);
     if ((A != null) && (A.canBeUninvoked())) {
       try {
         newMOB.recoverPhyStats();
         A.affectPhyStats(newMOB, newMOB.phyStats());
         if (CMLib.flags().isInvisible(newMOB) || CMLib.flags().isHidden(newMOB)) offenders.add(A);
       } catch (final Exception e) {
       }
     }
   }
   newMOB.destroy();
   return offenders;
 }
Exemple #27
0
 public void clearGrid(Room bringBackHere) {
   try {
     DVector myRooms = rooms.copyOf();
     for (int r = 0; r < myRooms.size(); r++) {
       Room room = (Room) myRooms.elementAt(r, 1);
       CMLib.map().emptyRoom(room, bringBackHere);
     }
     while (myRooms.size() > 0) {
       Room room = (Room) myRooms.elementAt(0, 1);
       room.destroy();
       myRooms.removeElementAt(0);
     }
     try {
       rooms.clear();
     } catch (Exception e) {
     }
   } catch (Exception e) {
     Log.debugOut("StdThinGrid", e);
   }
 }
Exemple #28
0
 public boolean tick(Tickable ticking, int tickID) {
   if (!super.tick(ticking, tickID)) return false;
   if (CMath.bset(flags(), Area.FLAG_INSTANCE_CHILD)) return true;
   if ((--childCheckDown) <= 0) {
     childCheckDown = CHILD_CHECK_INTERVAL;
     synchronized (children) {
       for (int i = children.size() - 1; i >= 0; i--) {
         StdThinInstance childA = (StdThinInstance) children.elementAt(i, 2);
         if (childA.getAreaState() > Area.STATE_ACTIVE) {
           Vector V = (Vector) children.elementAt(i, 3);
           boolean anyInside = false;
           for (int v = 0; v < V.size(); v++) {
             MOB M = (MOB) V.elementAt(v);
             if (CMLib.flags().isInTheGame(M, true)
                 && (M.location() != null)
                 && (M.location().getArea() == childA)) anyInside = true;
           }
           if (!anyInside) {
             children.removeElementsAt(i);
             for (int v = 0; v < V.size(); v++) {
               MOB M = (MOB) V.elementAt(v);
               if ((M.location() != null) && (M.location().getArea() == this))
                 M.setLocation(M.getStartRoom());
             }
             MOB mob = CMClass.sampleMOB();
             for (Enumeration e = childA.getProperMap(); e.hasMoreElements(); ) {
               Room R = (Room) e.nextElement();
               R.executeMsg(mob, CMClass.getMsg(mob, R, null, CMMsg.MSG_EXPIRE, null));
             }
             CMLib.map().delArea(childA);
             childA.destroy();
           }
         }
       }
     }
   }
   return true;
 }
Exemple #29
0
 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;
 }
 // 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;
     }
   }
 }