コード例 #1
0
ファイル: ClanMorgueSet.java プロジェクト: Cocanuta/Marble
  public boolean execute(MOB mob, Vector commands, int metaFlags) throws java.io.IOException {
    boolean skipChecks = mob.Name().equals(mob.getClanID());
    Room R = mob.location();
    if (skipChecks) {
      commands.setElementAt(getAccessWords()[0], 0);
      R = CMLib.map().getRoom(CMParms.combine(commands, 1));
    } else {
      commands.clear();
      commands.addElement(getAccessWords()[0]);
      commands.addElement(CMLib.map().getExtendedRoomID(R));
    }

    if ((mob.getClanID() == null) || (R == null) || (mob.getClanID().equalsIgnoreCase(""))) {
      mob.tell("You aren't even a member of a clan.");
      return false;
    }
    Clan C = mob.getMyClan();
    if (C == null) {
      mob.tell("There is no longer a clan called " + mob.getClanID() + ".");
      return false;
    }
    if (C.getStatus() > Clan.CLANSTATUS_ACTIVE) {
      mob.tell(
          "You cannot set a morgue.  Your "
              + C.getGovernmentName()
              + " does not have enough members to be considered active.");
      return false;
    }
    if (skipChecks || CMLib.clans().goForward(mob, C, commands, Clan.Function.SET_HOME, false)) {
      if (!CMLib.law().doesOwnThisProperty(C.clanID(), R)) {
        mob.tell("Your " + C.getGovernmentName() + " does not own this room.");
        return false;
      }
      if (skipChecks || CMLib.clans().goForward(mob, C, commands, Clan.Function.SET_HOME, true)) {
        C.setMorgue(CMLib.map().getExtendedRoomID(R));
        C.update();
        mob.tell(
            "Your " + C.getGovernmentName() + " morgue is now set to " + R.roomTitle(mob) + ".");
        CMLib.clans()
            .clanAnnounce(
                mob,
                "The morgue of "
                    + C.getGovernmentName()
                    + " "
                    + C.clanID()
                    + " is now set to "
                    + R.roomTitle(mob)
                    + ".");
        return true;
      }
    } else {
      mob.tell(
          "You aren't in the right position to set your " + C.getGovernmentName() + "'s morgue.");
      return false;
    }
    return false;
  }
コード例 #2
0
ファイル: Thief_Squatting.java プロジェクト: Cocanuta/Marble
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    MOB target = mob;
    if ((auto) && (givenTarget != null) && (givenTarget instanceof MOB)) target = (MOB) givenTarget;
    if (target.fetchEffect(ID()) != null) {
      mob.tell(target, null, null, "<S-NAME> <S-IS-ARE> already squatting.");
      return false;
    }
    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

    if (CMLib.law().doesHavePriviledgesHere(mob, mob.location())) {
      mob.tell("This is your place already!");
      return false;
    }
    LandTitle T = CMLib.law().getLandTitle(mob.location());
    boolean confirmed = false;
    for (final Enumeration<Ability> a = mob.location().effects(); a.hasMoreElements(); ) {
      final Ability A = a.nextElement();
      if (A == T) confirmed = true;
    }
    if (T == null) {
      mob.tell("This property is not available for sale, and cannot be squatted upon.");
      return false;
    }
    MOB warnMOB = null;
    if (T.landOwner().length() > 0) {
      Clan C = CMLib.clans().getClan(T.landOwner());
      if (C == null) {
        MOB M = CMLib.players().getLoadPlayer(T.landOwner());
        if (M != null) warnMOB = M;
      } else {
        for (Session S : CMLib.sessions().localOnlineIterable()) {
          if ((S.mob() != null) && (S.mob() != mob) && (S.mob().getClanID().equals(C.clanID())))
            warnMOB = S.mob();
        }
      }
      if ((warnMOB == null) || (!CMLib.flags().isInTheGame(warnMOB, true))) {
        mob.tell("The owners must be in the game for you to begin squatting.");
        return false;
      }
    }
    if (!confirmed) {
      mob.tell("You cannot squat on an area for sale.");
      return false;
    }
    if (!CMLib.flags().isSitting(mob)) {
      mob.tell("You must be sitting!");
      return false;
    }

    boolean success = proficiencyCheck(mob, 0, auto);

    CMMsg msg =
        CMClass.getMsg(
            mob,
            null,
            this,
            auto ? CMMsg.MASK_ALWAYS : CMMsg.MSG_DELICATE_SMALL_HANDS_ACT,
            CMMsg.MSG_DELICATE_SMALL_HANDS_ACT,
            CMMsg.MSG_DELICATE_SMALL_HANDS_ACT,
            auto ? "" : "<S-NAME> start(s) squatting.");
    if (!success)
      return beneficialVisualFizzle(
          mob, null, auto ? "" : "<S-NAME> can't seem to get comfortable here.");
    else if (mob.location().okMessage(mob, msg)) {
      mob.location().send(mob, msg);
      failed = false;
      room = mob.location();
      title = T;
      beneficialAffect(mob, target, asLevel, (CMProps.getIntVar(CMProps.SYSTEMI_TICKSPERMUDMONTH)));
      if (warnMOB != null)
        warnMOB.tell(
            "You've heard a rumor that someone is squatting on " + T.landOwner() + "'s property.");
    }
    return success;
  }