Пример #1
0
 @Override
 public void executeMsg(final Environmental myHost, final CMMsg msg) {
   if ((System.currentTimeMillis() - lastClanCheck) > TimeManager.MILI_HOUR) {
     lastClanCheck = System.currentTimeMillis();
     if ((clanID().length() > 0) && (CMLib.clans().getClan(clanID()) == null)) {
       destroy();
       return;
     }
   }
   if (StdClanItem.stdExecuteMsg(this, msg)) {
     super.executeMsg(myHost, msg);
     if ((msg.amITarget(this))
         && (clanID().length() > 0)
         && (msg.source().getClanRole(clanID()) != null)) {
       final Room R = msg.source().location();
       if (R == null) return;
       if ((msg.targetMinor() == CMMsg.TYP_DROP) && (msg.trailerMsgs() == null)) {
         msg.addTrailerMsg(CMClass.getMsg(msg.source(), this, CMMsg.MSG_LOOK, null));
         setRightfulOwner(R);
       } else if ((msg.targetMinor() == CMMsg.TYP_LOOK)
           || (msg.targetMinor() == CMMsg.TYP_EXAMINE)) {
         final LegalBehavior B = CMLib.law().getLegalBehavior(R);
         String s = "";
         if (B != null) s = B.conquestInfo(CMLib.law().getLegalObject(R));
         if (s.length() > 0) msg.source().tell(s);
         else msg.source().tell(L("This area is under the control of the Archons."));
         return;
       } else if ((msg.targetMinor() == CMMsg.TYP_SPEAK)
           && (CMSecurity.isAllowed(msg.source(), R, CMSecurity.SecFlag.CMDROOMS))
           && (msg.targetMessage() != null)) {
         final String msgStr = CMStrings.getSayFromMessage(msg.targetMessage().toUpperCase());
         final String alert = "I HEREBY DECLARE THIS AREA";
         final int msgIndex = msgStr.indexOf(alert);
         if (msgIndex >= 0) {
           final LegalBehavior B = CMLib.law().getLegalBehavior(R);
           if (B != null) B.setControlPoints(clanID(), B.controlPoints() + 1);
         }
       }
     }
   }
 }
Пример #2
0
  @Override
  public void executeMsg(final Environmental myHost, final CMMsg msg) {
    final MOB mob = msg.source();

    switch (msg.targetMinor()) {
      case CMMsg.TYP_WAND_USE:
        if (msg.amITarget(this) && ((msg.tool() == null) || (msg.tool() instanceof Physical)))
          waveIfAble(mob, (Physical) msg.tool(), msg.targetMessage());
        break;
      case CMMsg.TYP_SPEAK:
        if ((msg.sourceMinor() == CMMsg.TYP_SPEAK) && (!amWearingAt(Wearable.IN_INVENTORY))) {
          boolean alreadyWanding = false;
          final List<CMMsg> trailers = msg.trailerMsgs();
          if (trailers != null)
            for (final CMMsg msg2 : trailers)
              if (msg2.targetMinor() == CMMsg.TYP_WAND_USE) alreadyWanding = true;
          final String said = CMStrings.getSayFromMessage(msg.sourceMessage());
          if ((!alreadyWanding) && (checkWave(mob, said)))
            msg.addTrailerMsg(
                CMClass.getMsg(
                    msg.source(),
                    this,
                    msg.target(),
                    CMMsg.NO_EFFECT,
                    null,
                    CMMsg.MASK_ALWAYS | CMMsg.TYP_WAND_USE,
                    said,
                    CMMsg.NO_EFFECT,
                    null));
        }
        break;
      default:
        break;
    }
    super.executeMsg(myHost, msg);
  }