Esempio n. 1
0
 @Override
 public boolean mayICraft(final Item I) {
   if (I == null) return false;
   if (!super.mayBeCrafted(I)) return false;
   if (((I.material() & RawMaterial.MATERIAL_MASK) != RawMaterial.MATERIAL_METAL)
       && ((I.material() & RawMaterial.MATERIAL_MASK) != RawMaterial.MATERIAL_MITHRIL))
     return false;
   if (CMLib.flags().isDeadlyOrMaliciousEffect(I)) return false;
   if (isANativeItem(I.Name()) && (!(I instanceof Armor)) && (!(I instanceof Weapon))) return true;
   if (I instanceof Rideable) {
     final Rideable R = (Rideable) I;
     final int rideType = R.rideBasis();
     switch (rideType) {
       case Rideable.RIDEABLE_LADDER:
       case Rideable.RIDEABLE_SLEEP:
       case Rideable.RIDEABLE_SIT:
       case Rideable.RIDEABLE_TABLE:
         return true;
       default:
         return false;
     }
   }
   if (I instanceof DoorKey) return true;
   if (I instanceof Shield) return false;
   if (I instanceof Weapon) return false;
   if (I instanceof Light) return true;
   if (I instanceof Armor) return false;
   if (I instanceof Container) return true;
   if ((I instanceof Drink) && (!(I instanceof Potion))) return true;
   if (I instanceof FalseLimb) return true;
   if (I.rawProperLocationBitmap() == Wearable.WORN_HELD) return true;
   return (isANativeItem(I.Name()));
 }
Esempio n. 2
0
 @Override
 public boolean mayICraft(final Item I) {
   if (I == null) return false;
   if (!super.mayBeCrafted(I)) return false;
   if (((I.material() & RawMaterial.MATERIAL_MASK) != RawMaterial.MATERIAL_METAL)
       && ((I.material() & RawMaterial.MATERIAL_MASK) != RawMaterial.MATERIAL_MITHRIL))
     return false;
   if (CMLib.flags().isDeadlyOrMaliciousEffect(I)) return false;
   if (!(I instanceof Armor)) return false;
   if (I instanceof Shield) return true;
   if (!masterCraftCheck(I)) return isANativeItem(I.Name());
   if (I.fitsOn(Wearable.WORN_RIGHT_FINGER)
       || I.fitsOn(Wearable.WORN_LEFT_FINGER)
       || I.fitsOn(Wearable.WORN_EARS)
       || I.fitsOn(Wearable.WORN_HELD)
       || I.fitsOn(Wearable.WORN_EYES)) return isANativeItem(I.Name());
   return true;
 }
Esempio n. 3
0
 @Override
 public boolean mayICraft(final Item I) {
   if (I == null) return false;
   if (!super.mayBeCrafted(I)) return false;
   if ((I.material() & RawMaterial.MATERIAL_MASK) != RawMaterial.MATERIAL_WOODEN) return false;
   if (CMLib.flags().isDeadlyOrMaliciousEffect(I)) return false;
   if (!(I instanceof Container)) return false;
   final Container C = (Container) I;
   if ((C.containTypes() == Container.CONTAIN_CAGED)
       || (C.containTypes() == (Container.CONTAIN_BODIES | Container.CONTAIN_CAGED))) return true;
   if (isANativeItem(I.Name())) return true;
   return false;
 }
 @Override
 public boolean mayICraft(final Item I) {
   if (I == null) return false;
   if (!super.mayBeCrafted(I)) return false;
   if ((I.material() & RawMaterial.MATERIAL_MASK) != RawMaterial.MATERIAL_LEATHER) return false;
   if (CMLib.flags().isDeadlyOrMaliciousEffect(I)) return false;
   if (I.basePhyStats().level() < 31) return (isANativeItem(I.Name()));
   if (I instanceof Armor) {
     final long noWearLocations =
         Wearable.WORN_LEFT_FINGER | Wearable.WORN_RIGHT_FINGER | Wearable.WORN_EARS;
     if ((I.rawProperLocationBitmap() & noWearLocations) > 0) return (isANativeItem(I.Name()));
     return true;
   }
   if (I instanceof Rideable) {
     final Rideable R = (Rideable) I;
     final int rideType = R.rideBasis();
     switch (rideType) {
       case Rideable.RIDEABLE_SLEEP:
       case Rideable.RIDEABLE_SIT:
       case Rideable.RIDEABLE_TABLE:
         return true;
       default:
         return false;
     }
   }
   if (I instanceof Shield) return true;
   if (I instanceof Weapon) {
     final Weapon W = (Weapon) I;
     if (((W instanceof AmmunitionWeapon) && ((AmmunitionWeapon) W).requiresAmmunition())
         || (W.weaponClassification() == Weapon.CLASS_FLAILED)) return true;
     return (isANativeItem(I.Name()));
   }
   if (I instanceof Container) return true;
   if ((I instanceof Drink) && (!(I instanceof Potion))) return true;
   if (I instanceof FalseLimb) return true;
   if (I.rawProperLocationBitmap() == Wearable.WORN_HELD) return true;
   return (isANativeItem(I.Name()));
 }
Esempio n. 5
0
 public Item isRuinedLoot(DVector policies, Item I) {
   if (I == null) return null;
   if ((CMath.bset(I.envStats().disposition(), EnvStats.IS_UNSAVABLE))
       || (CMath.bset(I.envStats().sensesMask(), EnvStats.SENSE_ITEMNORUIN))
       || (I instanceof Coins)) return I;
   if (I.name().toLowerCase().indexOf("ruined ") >= 0) return I;
   for (int d = 0; d < policies.size(); d++) {
     if ((((Vector) policies.elementAt(d, 3)).size() > 0)
         && (!CMLib.masking().maskCheck((Vector) policies.elementAt(d, 3), I, true))) continue;
     if (CMLib.dice().rollPercentage() > ((Integer) policies.elementAt(d, 1)).intValue()) continue;
     int flags = ((Integer) policies.elementAt(d, 2)).intValue();
     if (CMath.bset(flags, CMMiscUtils.LOOTFLAG_WORN) && I.amWearingAt(Wearable.IN_INVENTORY))
       continue;
     else if (CMath.bset(flags, CMMiscUtils.LOOTFLAG_UNWORN)
         && (!I.amWearingAt(Wearable.IN_INVENTORY))) continue;
     if (CMath.bset(flags, CMMiscUtils.LOOTFLAG_LOSS)) return null;
     Item I2 = CMClass.getItem("GenItem");
     I2.baseEnvStats().setWeight(I.baseEnvStats().weight());
     I2.setName(I.Name());
     I2.setDisplayText(I.displayText());
     I2.setDescription(I2.description());
     I2.recoverEnvStats();
     I2.setMaterial(I.material());
     String ruinDescAdder = null;
     switch (I2.material() & RawMaterial.MATERIAL_MASK) {
       case RawMaterial.MATERIAL_LEATHER:
       case RawMaterial.MATERIAL_CLOTH:
       case RawMaterial.MATERIAL_VEGETATION:
       case RawMaterial.MATERIAL_FLESH:
       case RawMaterial.MATERIAL_PAPER:
         ruinDescAdder =
             CMStrings.capitalizeFirstLetter(I2.name()) + " is torn and ruined beyond repair.";
         break;
       case RawMaterial.MATERIAL_METAL:
       case RawMaterial.MATERIAL_MITHRIL:
       case RawMaterial.MATERIAL_WOODEN:
         ruinDescAdder =
             CMStrings.capitalizeFirstLetter(I2.name()) + " is battered and ruined beyond repair.";
         break;
       case RawMaterial.MATERIAL_GLASS:
         ruinDescAdder =
             CMStrings.capitalizeFirstLetter(I2.name())
                 + " is shattered and ruined beyond repair.";
         break;
       case RawMaterial.MATERIAL_ROCK:
       case RawMaterial.MATERIAL_PRECIOUS:
       case RawMaterial.MATERIAL_PLASTIC:
         ruinDescAdder =
             CMStrings.capitalizeFirstLetter(I2.name()) + " is cracked and ruined beyond repair.";
         break;
       case RawMaterial.MATERIAL_UNKNOWN:
       case RawMaterial.MATERIAL_ENERGY:
       case RawMaterial.MATERIAL_LIQUID:
       default:
         ruinDescAdder = CMStrings.capitalizeFirstLetter(I2.name()) + " is ruined beyond repair.";
         break;
     }
     I2.setDescription(CMStrings.endWithAPeriod(I2.description()) + " " + ruinDescAdder);
     String oldName = I2.Name();
     I2.setName(CMLib.english().insertUnColoredAdjective(I2.Name(), "ruined"));
     int x = I2.displayText().toUpperCase().indexOf(oldName.toUpperCase());
     I2.setBaseValue(0);
     if (x >= 0)
       I2.setDisplayText(
           I2.displayText().substring(0, x)
               + I2.Name()
               + I2.displayText().substring(x + oldName.length()));
     return I2;
   }
   return I;
 }
Esempio n. 6
0
  public boolean doArchonDBCompare(MOB mob, String scope, String firstWord, Vector commands)
      throws java.io.IOException {
    CMClass.CMObjectType doType = OBJECT_TYPES.get(firstWord.toUpperCase());
    if (doType == null) doType = OBJECT_TYPES.get(firstWord.toUpperCase() + "S");
    if (doType != null) commands.remove(0);
    else doType = CMClass.CMObjectType.LOCALE;

    final String theRest = CMParms.combineQuoted(commands, 0);
    DBConnector dbConnector = null;
    final String dbClass = CMParms.getParmStr(theRest, "DBCLASS", "");
    final String dbService = CMParms.getParmStr(theRest, "DBSERVICE", "");
    final String dbUser = CMParms.getParmStr(theRest, "DBUSER", "");
    final String dbPass = CMParms.getParmStr(theRest, "DBPASS", "");
    final int dbConns = CMParms.getParmInt(theRest, "DBCONNECTIONS", 3);
    final int dbPingIntMins = CMParms.getParmInt(theRest, "DBPINGINTERVALMINS", 30);
    final boolean dbReuse = CMParms.getParmBool(theRest, "DBREUSE", true);
    final String ignore = CMParms.getParmStr(theRest, "IGNORE", "");
    final String maskStr = CMParms.getParmStr(theRest, "MASK", "");
    final Set<String> ignores = new SHashSet(CMParms.parseCommas(ignore.toUpperCase(), true));
    final MaskingLibrary.CompiledZapperMask mask = CMLib.masking().maskCompile(maskStr);
    if (dbClass.length() == 0) {
      mob.tell(L("This command requires DBCLASS= to be set."));
      return false;
    }
    if (dbService.length() == 0) {
      mob.tell(L("This command requires DBSERVICE= to be set."));
      return false;
    }
    if (dbUser.length() == 0) {
      mob.tell(L("This command requires DBUSER= to be set."));
      return false;
    }
    if (dbPass.length() == 0) {
      mob.tell(L("This command requires DBPASS= to be set."));
      return false;
    }

    dbConnector =
        new DBConnector(
            dbClass, dbService, dbUser, dbPass, dbConns, dbPingIntMins, dbReuse, false, false);
    dbConnector.reconnect();
    final DBInterface dbInterface = new DBInterface(dbConnector, null);

    final DBConnection DBTEST = dbConnector.DBFetch();
    if (DBTEST != null) dbConnector.DBDone(DBTEST);
    mob.tell(L("Loading database rooms..."));
    final List<Room> rooms = new LinkedList<Room>();
    if ((!dbConnector.amIOk()) || (!dbInterface.isConnected())) {
      mob.tell(L("Failed to connect to database."));
      return false;
    }
    if (scope.equalsIgnoreCase("AREA"))
      rooms.addAll(
          Arrays.asList(dbInterface.DBReadRoomObjects(mob.location().getArea().Name(), false)));
    else if (scope.equalsIgnoreCase("ROOM")) {
      final Room R = dbInterface.DBReadRoomObject(mob.location().roomID(), false);
      if (R != null) rooms.add(R);
    } else
      for (final Enumeration<Area> e = CMLib.map().areas(); e.hasMoreElements(); )
        rooms.addAll(Arrays.asList(dbInterface.DBReadRoomObjects(e.nextElement().Name(), false)));
    if (rooms.size() == 0) {
      mob.tell(L("No rooms found."));
      return false;
    }
    for (final Room R : rooms) dbInterface.DBReadContent(R.roomID(), R, false);
    mob.tell(L("Data loaded, starting scan."));
    final Comparator<MOB> convM =
        new Comparator<MOB>() {
          @Override
          public int compare(MOB arg0, MOB arg1) {
            final int x = arg0.ID().compareTo(arg1.ID());
            return (x != 0) ? x : arg0.Name().compareTo(arg1.Name());
          }
        };
    final Comparator<Item> convI =
        new Comparator<Item>() {
          @Override
          public int compare(Item arg0, Item arg1) {
            final int x = arg0.ID().compareTo(arg1.ID());
            return (x != 0) ? x : arg0.Name().compareTo(arg1.Name());
          }
        };
    try {
      for (final Room dbR : rooms) {
        Room R = CMLib.map().getRoom(dbR.roomID());
        if (R == null) {
          if (doType == CMClass.CMObjectType.LOCALE)
            Log.sysOut("Merge", dbR.roomID() + " not in database");
          // import, including exits!
          continue;
        }
        synchronized (("SYNC" + dbR.roomID()).intern()) {
          final Area.State oldFlags = R.getArea().getAreaState();
          R.getArea().setAreaState(Area.State.FROZEN);

          boolean updateMobs = false;
          boolean updateItems = false;
          final boolean updateRoom = false;
          R = CMLib.map().getRoom(R);
          CMLib.map().resetRoom(R);
          final List<MOB> mobSetL = new Vector<MOB>();
          for (final Enumeration<MOB> e = dbR.inhabitants(); e.hasMoreElements(); )
            mobSetL.add(e.nextElement());
          final MOB[] mobSet = mobSetL.toArray(new MOB[0]);
          Arrays.sort(mobSet, convM);
          String lastName = "";
          int ct = 1;
          final HashSet<MOB> doneM = new HashSet<MOB>();
          for (final MOB dbM : mobSet) {
            if (!lastName.equals(dbM.Name())) ct = 1;
            else ct++;
            final String rName = dbM.Name() + "." + ct;
            MOB M = null;
            int ctr = ct;
            for (final Enumeration<MOB> m = R.inhabitants(); m.hasMoreElements(); ) {
              final MOB M1 = m.nextElement();
              if (M1.Name().equalsIgnoreCase(dbM.Name()) && ((--ctr) <= 0)) {
                M = M1;
                break;
              }
            }
            if (M == null) {
              if (amMerging(doType, mask, dbM) && (!ignore.contains("MISSING"))) {
                if (mob.session()
                    .confirm(
                        L(
                            "MOB: @x1.@x2 not in local room.\n\rWould you like to add it (y/N)?",
                            dbR.roomID(),
                            rName),
                        L("N"))) {
                  M = (MOB) dbM.copyOf();
                  M.bringToLife(R, true);
                  doneM.add(M);
                  updateMobs = true;
                  Log.sysOut("Merge", mob.Name() + " added mob " + dbR.roomID() + "." + rName);
                }
              }
            } else {
              doneM.add(M);
              if (amMerging(doType, mask, dbM)) {
                if (!dbM.sameAs(M)) {
                  final MOB oldM = (MOB) M.copyOf();
                  if ((dbMerge(mob, "^MMOB " + dbR.roomID() + "." + rName + "^N", dbM, M, ignores))
                      && (!oldM.sameAs(M))) {
                    Log.sysOut("Merge", mob.Name() + " modified mob " + dbR.roomID() + "." + rName);
                    updateMobs = true;
                  }
                }
              }
              final STreeSet<Item> itemSetL = new STreeSet<Item>(convI);
              for (final Enumeration<Item> e = dbM.items(); e.hasMoreElements(); )
                itemSetL.add(e.nextElement());
              final Item[] itemSet = itemSetL.toArray(new Item[0]);
              Arrays.sort(itemSet, convI);
              String lastIName = "";
              int ict = 1;
              final HashSet<Item> doneI = new HashSet<Item>();
              for (final Item dbI : itemSet) {
                if (!lastIName.equals(dbI.Name())) ict = 1;
                else ict++;
                final String rIName = dbI.Name() + "." + ict;
                Item I = null;
                ctr = ict;
                for (final Enumeration<Item> i = M.items(); i.hasMoreElements(); ) {
                  final Item I1 = i.nextElement();
                  if (I1.Name().equalsIgnoreCase(dbI.Name()) && ((--ctr) <= 0)) {
                    I = I1;
                    break;
                  }
                }
                if (I == null) {
                  if (amMerging(doType, mask, dbI) && (!ignore.contains("MISSING"))) {
                    if (mob.session()
                        .confirm(
                            L(
                                "Item: @x1.@x2.@x3 not in local room.\n\rWould you like to add it (y/N)?",
                                dbR.roomID(),
                                dbM.Name(),
                                rIName),
                            L("N"))) {
                      I = (Item) dbI.copyOf();
                      M.addItem(I);
                      doneI.add(I);
                      final Item cI =
                          (dbI.container() == null) ? null : M.findItem(dbI.container().Name());
                      if (cI instanceof Container) I.setContainer((Container) cI);
                      updateMobs = true;
                      Log.sysOut(
                          "Merge",
                          mob.Name()
                              + " added item "
                              + dbR.roomID()
                              + "."
                              + dbM.Name()
                              + "."
                              + rIName);
                    }
                  }
                } else if (amMerging(doType, mask, dbI)) {
                  doneI.add(I);
                  if (!dbI.sameAs(I)) {
                    final Item oldI = (Item) I.copyOf();
                    if ((dbMerge(
                            mob,
                            "^IITEM ^M" + dbR.roomID() + "." + dbM.Name() + "." + rIName + "^N",
                            dbI,
                            I,
                            ignores))
                        && (!oldI.sameAs(I))) {
                      Log.sysOut(
                          "Merge",
                          mob.Name()
                              + " modified item "
                              + dbR.roomID()
                              + "."
                              + dbM.Name()
                              + "."
                              + rIName);
                      updateMobs = true;
                    }
                  }
                }
                lastIName = dbI.Name();
              }
              for (final Enumeration<Item> i = M.items(); i.hasMoreElements(); ) {
                final Item I = i.nextElement();
                if (amMerging(doType, mask, I)
                    && (!doneI.contains(I))
                    && (!ignore.contains("EXTRA"))) {
                  if (mob.session()
                      .confirm(
                          L(
                              "Item: @x1.@x2.@x3 not in database.\n\rWould you like to delete it (y/N)?",
                              R.roomID(),
                              M.Name(),
                              I.Name()),
                          L("N"))) {
                    M.delItem(I);
                    updateMobs = true;
                    Log.sysOut(
                        "Merge",
                        mob.Name()
                            + " deleted item "
                            + R.roomID()
                            + "."
                            + M.Name()
                            + "."
                            + I.Name());
                  }
                }
              }
            }
            lastName = dbM.Name();
          }
          for (final Enumeration<MOB> r = R.inhabitants(); r.hasMoreElements(); ) {
            final MOB M = r.nextElement();
            if (amMerging(doType, mask, M)
                && (!doneM.contains(M))
                && (M.isMonster())
                && (!ignore.contains("EXTRA"))) {
              if (mob.session()
                  .confirm(
                      L(
                          "MOB: @x1.@x2 not in database.\n\rWould you like to delete it (y/N)?",
                          R.roomID(),
                          M.Name()),
                      L("N"))) {
                R.delInhabitant(M);
                updateMobs = true;
                Log.sysOut("Merge", mob.Name() + " deleted mob " + R.roomID() + "." + M.Name());
              }
            }
          }

          final STreeSet<Item> itemSetL = new STreeSet<Item>(convI);
          for (final Enumeration<Item> e = dbR.items(); e.hasMoreElements(); )
            itemSetL.add(e.nextElement());
          final Item[] itemSet = itemSetL.toArray(new Item[0]);
          Arrays.sort(itemSet, convI);
          lastName = "";
          ct = 1;
          final HashSet<Item> doneI = new HashSet<Item>();
          for (final Item dbI : itemSet) {
            if (!lastName.equals(dbI.Name())) ct = 1;
            else ct++;
            final String rName = dbI.Name() + "." + ct;
            Item I = null;
            int ctr = ct;
            for (final Enumeration<Item> i = R.items(); i.hasMoreElements(); ) {
              final Item I1 = i.nextElement();
              if (I1.Name().equalsIgnoreCase(dbI.Name()) && ((--ctr) <= 0)) {
                I = I1;
                break;
              }
            }
            if (I == null) {
              if (amMerging(doType, mask, dbI) && (!ignore.contains("MISSING"))) {
                if (mob.session()
                    .confirm(
                        L(
                            "Item: @x1.@x2 not in local room.\n\rWould you like to add it (y/N)?",
                            dbR.roomID(),
                            rName),
                        L("N"))) {
                  I = (Item) dbI.copyOf();
                  R.addItem(I);
                  doneI.add(I);
                  final Item cI =
                      (dbI.container() == null) ? null : R.findItem(dbI.container().Name());
                  if (cI instanceof Container) I.setContainer((Container) cI);
                  updateItems = true;
                  Log.sysOut("Merge", mob.Name() + " added item " + dbR.roomID() + "." + rName);
                }
              }
            } else if (amMerging(doType, mask, dbI)) {
              doneI.add(I);
              if (!dbI.sameAs(I)) {
                final Item oldI = (Item) I.copyOf();
                if ((dbMerge(mob, "^IITEM " + dbR.roomID() + "." + rName + "^N", dbI, I, ignores))
                    && (!oldI.sameAs(I))) {
                  Log.sysOut("Merge", mob.Name() + " modified item " + dbR.roomID() + "." + rName);
                  updateItems = true;
                }
              }
            }
            lastName = dbI.Name();
          }
          for (final Enumeration<Item> i = R.items(); i.hasMoreElements(); ) {
            final Item I = i.nextElement();
            if (amMerging(doType, mask, I) && (!doneI.contains(I)) && (!ignore.contains("EXTRA"))) {
              if (mob.session()
                  .confirm(
                      L(
                          "Item: @x1.@x2 not in database.\n\rWould you like to delete it (y/N)?",
                          R.roomID(),
                          I.Name()),
                      L("N"))) {
                R.delItem(I);
                updateItems = true;
                Log.sysOut("Merge", mob.Name() + " deleted item " + R.roomID() + "." + I.Name());
              }
            }
          }
          if (updateRoom) CMLib.database().DBUpdateRoom(R);
          if (updateItems) CMLib.database().DBUpdateItems(R);
          if (updateMobs) CMLib.database().DBUpdateMOBs(R);
          CMLib.map().resetRoom(R);
          R.getArea().setAreaState(oldFlags);
        }
        dbR.destroy();
      }
      mob.tell(L("Done"));
    } catch (final CMException cme) {
      mob.tell(L("Cancelled."));
    }
    dbInterface.shutdown();
    return true;
  }
 public String correctItem(MOB mob) {
   for (int i = 0; i < mob.numItems(); i++) {
     final Item I = mob.getItem(i);
     if ((I != null)
         && (CMLib.flags().canBeSeenBy(I, mob))
         && (I.amWearingAt(Wearable.IN_INVENTORY))
         && (!((((I instanceof Armor) && (I.basePhyStats().armor() > 1))
             || ((I instanceof Weapon) && (I.basePhyStats().damage() > 1)))))) return I.Name();
   }
   return null;
 }
Esempio n. 8
0
  public static int updateLotWithThisData(
      Room R,
      LandTitle T,
      boolean resetRoomName,
      boolean clearAllItems,
      List optPlayerList,
      int lastNumItems) {
    boolean updateItems = false;
    boolean updateExits = false;
    boolean updateRoom = false;
    synchronized (("SYNC" + R.roomID()).intern()) {
      R = CMLib.map().getRoom(R);
      if (T.getOwnerName().length() == 0) {
        Item I = null;
        for (int i = R.numItems() - 1; i >= 0; i--) {
          I = R.getItem(i);
          if ((I == null) || (I.Name().equalsIgnoreCase("id"))) continue;
          CMLib.catalog().updateCatalogIntegrity(I);
          if (clearAllItems) {
            I.destroy();
            updateItems = true;
          } else {
            if (I.expirationDate() == 0) {
              long now = System.currentTimeMillis();
              now += (TimeManager.MILI_MINUTE * CMProps.getIntVar(CMProps.Int.EXPIRE_PLAYER_DROP));
              I.setExpirationDate(now);
            }
            if ((I.phyStats().rejuv() != PhyStats.NO_REJUV) && (I.phyStats().rejuv() != 0)) {
              I.basePhyStats().setRejuv(PhyStats.NO_REJUV);
              I.recoverPhyStats();
            }
          }
        }
        Ability A = null;
        if (clearAllItems)
          for (final Enumeration<Ability> a = R.effects(); a.hasMoreElements(); ) {
            A = a.nextElement();
            if (((A != null)
                && ((A.classificationCode() & Ability.ALL_ACODES) != Ability.ACODE_PROPERTY))) {
              A.unInvoke();
              R.delEffect(A);
              updateRoom = true;
            }
          }
        for (int d = Directions.NUM_DIRECTIONS() - 1; d >= 0; d--) {
          final Room R2 = R.rawDoors()[d];
          Exit E = R.getRawExit(d);
          if ((E != null) && (E.hasALock()) && (E.isGeneric())) {
            E.setKeyName("");
            E.setDoorsNLocks(E.hasADoor(), E.isOpen(), E.defaultsClosed(), false, false, false);
            updateExits = true;
            if (R2 != null) {
              E = R2.getRawExit(Directions.getOpDirectionCode(d));
              if ((E != null) && (E.hasALock()) && (E.isGeneric())) {
                E.setKeyName("");
                E.setDoorsNLocks(E.hasADoor(), E.isOpen(), E.defaultsClosed(), false, false, false);
                CMLib.database().DBUpdateExits(R2);
                R2.getArea().fillInAreaRoom(R2);
              }
            }
          }
        }
        if (updateExits) {
          CMLib.database().DBUpdateExits(R);
          R.getArea().fillInAreaRoom(R);
        }
        if (updateItems) CMLib.database().DBUpdateItems(R);
        if (updateRoom) CMLib.database().DBUpdateRoom(R);
        colorForSale(R, T.rentalProperty(), resetRoomName);
        return -1;
      }

      if ((lastNumItems < 0)
          && (!CMSecurity.isDisabled(CMSecurity.DisFlag.PROPERTYOWNERCHECKS))
          && (optPlayerList != null)) {
        boolean playerExists = (CMLib.players().getPlayer(T.getOwnerName()) != null);
        if (!playerExists) playerExists = (CMLib.clans().getClan(T.getOwnerName()) != null);
        if (!playerExists) playerExists = optPlayerList.contains(T.getOwnerName());
        if (!playerExists)
          for (int i = 0; i < optPlayerList.size(); i++)
            if (((String) optPlayerList.get(i)).equalsIgnoreCase(T.getOwnerName())) {
              playerExists = true;
              break;
            }
        if (!playerExists) {
          T.setOwnerName("");
          T.updateLot(null);
          return -1;
        }
      }

      int x = R.description().indexOf(SALESTR);
      if (x >= 0) {
        R.setDescription(R.description().substring(0, x));
        CMLib.database().DBUpdateRoom(R);
      }
      x = R.description().indexOf(RENTSTR);
      if (x >= 0) {
        R.setDescription(R.description().substring(0, x));
        CMLib.database().DBUpdateRoom(R);
      }

      // this works on the priciple that
      // 1. if an item has ONLY been removed, the lastNumItems will be != current # items
      // 2. if an item has ONLY been added, the dispossessiontime will be != null
      // 3. if an item has been added AND removed, the dispossession time will be != null on the
      // added
      if ((lastNumItems >= 0) && (R.numItems() != lastNumItems)) updateItems = true;

      for (int i = 0; i < R.numItems(); i++) {
        final Item I = R.getItem(i);
        if ((I.expirationDate() != 0)
            && ((I.isSavable()) || (I.Name().equalsIgnoreCase("id")))
            && ((!(I instanceof DeadBody)) || (((DeadBody) I).isPlayerCorpse()))) {
          I.setExpirationDate(0);
          updateItems = true;
        }

        if ((I.phyStats().rejuv() != Integer.MAX_VALUE) && (I.phyStats().rejuv() != 0)) {
          I.basePhyStats().setRejuv(PhyStats.NO_REJUV);
          I.recoverPhyStats();
          updateItems = true;
        }
      }
      lastNumItems = R.numItems();
      if ((!CMSecurity.isSaveFlag(CMSecurity.SaveFlag.NOPROPERTYITEMS)) && (updateItems))
        CMLib.database().DBUpdateItems(R);
    }
    return lastNumItems;
  }