public void newGame(Stage stage) {
   String name = null;
   curClan = new Clan(name);
   Member mem1 = new Member("Cooper", Stats.THIEF);
   mem1.setWeap(new Item("Dagger"));
   mem1.setArmor(new Item("Leather Clothing"));
   mem1.setHat(new Item("Plumed Hat"));
   curClan.addMember(mem1);
   mem1 = new Member("Ramza", Stats.SOLDIER);
   mem1.setWeap(new Item("Shortsword"));
   mem1.setArmor(new Item("Leather Cuirass"));
   mem1.setHat(new Item("Bronze Helm"));
   curClan.addMember(mem1);
   mem1 = new Member("Luke", Stats.HEALER);
   mem1.setWeap(new Item("White Staff"));
   mem1.setArmor(new Item("Hempen Robe"));
   mem1.setHat(new Item("Plumed Hat"));
   curClan.addMember(mem1);
   mem1 = new Member("Merlin", Stats.MAGE);
   mem1.setWeap(new Item("Rod"));
   mem1.setArmor(new Item("Hempen Robe"));
   mem1.setHat(new Item("Plumed Hat"));
   curClan.addMember(mem1);
   mem1 = new Member("Link", Stats.ARCHER);
   mem1.setWeap(new Item("Shortbow"));
   mem1.setArmor(new Item("Leather Clothing"));
   mem1.setHat(new Item("Plumed Hat"));
   curClan.addMember(mem1);
   missionSelectPane(stage);
 }
 public static boolean robberyCheck(LandTitle A, CMMsg msg) {
   if (((msg.targetMinor() == CMMsg.TYP_GET) && (!msg.isTarget(CMMsg.MASK_INTERMSG)))
       || (msg.targetMinor() == CMMsg.TYP_PUSH)
       || (msg.targetMinor() == CMMsg.TYP_PULL)) {
     if ((msg.target() instanceof Item)
         && (((Item) msg.target()).owner() == msg.source().location())
         && ((!(msg.tool() instanceof Item)) || (msg.source().isMine(msg.tool())))
         && (!msg.sourceMajor(CMMsg.MASK_ALWAYS))
         && (A.getOwnerName().length() > 0)
         && (msg.source().location() != null)
         && (msg.othersMessage() != null)
         && (msg.othersMessage().length() > 0)
         && (!shopkeeperMobPresent(msg.source().location()))
         && (!CMLib.law().doesHavePriviledgesHere(msg.source(), msg.source().location()))) {
       final Room R = msg.source().location();
       final LegalBehavior B = CMLib.law().getLegalBehavior(R);
       if (B != null) {
         for (int m = 0; m < R.numInhabitants(); m++) {
           final MOB M = R.fetchInhabitant(m);
           if (CMLib.law().doesHavePriviledgesHere(M, R)) return true;
         }
         MOB D = null;
         final Clan C = CMLib.clans().getClan(A.getOwnerName());
         if (C != null) D = C.getResponsibleMember();
         else D = CMLib.players().getLoadPlayer(A.getOwnerName());
         if (D == null) return true;
         B.accuse(
             CMLib.law().getLegalObject(R),
             msg.source(),
             D,
             new String[] {"PROPERTYROB", "THIEF_ROBBERY"});
       }
     }
     return true;
   }
   return false;
 }
 public void win() {
   Text t = new Text("You Win");
   t.setFont(Font.font("Impact", 45));
   t.setFill(Color.BLACK);
   root.getChildren().add(t);
   timeline =
       new Timeline(
           new KeyFrame(
               Duration.millis(100),
               new EventHandler() {
                 public void handle(Event e) {}
               }));
   timeline.setCycleCount(10);
   timeline.play();
   curClan.inventory.addAll(m.spoils);
   curClan.gold += m.gold;
   curClan.completed.add(m);
 }
Beispiel #4
0
  @Override
  public void execute(Player player, String label, String[] args) {

    if (plugin.getPermissionsManager().has(player, "simpleclans.leader.kick")) {
      ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);

      if (cp != null) {
        Clan clan = cp.getClan();

        if (clan.isLeader(player)) {
          String kicked = args[0];

          if (kicked != null) {
            if (!kicked.equals(player.getName())) {
              if (clan.isMember(kicked)) {
                if (!clan.isLeader(kicked)) {
                  clan.addBb(
                      player.getName(),
                      ChatColor.AQUA
                          + MessageFormat.format(
                              plugin.getLang("has.been.kicked.by"),
                              Helper.capitalize(kicked),
                              player.getName()));
                  clan.removePlayerFromClan(kicked);
                } else {
                  ChatBlock.sendMessage(
                      player, ChatColor.RED + plugin.getLang("you.cannot.kick.another.leader"));
                }
              } else {
                ChatBlock.sendMessage(
                    player,
                    ChatColor.RED + plugin.getLang("the.player.is.not.a.member.of.your.clan"));
              }
            } else {
              ChatBlock.sendMessage(
                  player, ChatColor.RED + plugin.getLang("you.cannot.kick.yourself"));
            }
          } else {
            ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.player.matched"));
          }
        } else {
          ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
        }
      } else {
        ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
      }
    } else {
      ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
    }
  }
  @Override
  public boolean invoke(
      MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) {
    if (!mob.clans().iterator().hasNext()) {
      mob.tell(L("You aren't even a member of a clan."));
      return false;
    }
    final Pair<Clan, Integer> clanPair =
        CMLib.clans().findPrivilegedClan(mob, Clan.Function.CLAN_BENEFITS);
    if (clanPair == null) {
      mob.tell(L("You are not authorized to draw from the power of your clan."));
      return false;
    }
    final Clan C = clanPair.first;
    Room clanHomeRoom = null;
    clanHomeRoom = CMLib.map().getRoom(C.getRecall());
    if (clanHomeRoom == null) {
      mob.tell(L("Your clan does not have a clan home."));
      return false;
    }
    if (!CMLib.flags().canAccess(mob, clanHomeRoom)) {
      mob.tell(L("You can't use this magic to get there from here."));
      return false;
    }
    if (!CMLib.law().doesOwnThisProperty(C.clanID(), clanHomeRoom)) {
      mob.tell(L("Your clan no longer owns that room."));
      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,
              null,
              this,
              CMMsg.MASK_MOVE | verbalCastCode(mob, mob, auto),
              L("^S<S-NAME> invoke(s) a teleportation spell.^?"));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        final Set<MOB> h = properTargets(mob, givenTarget, false);
        if (h == null) return false;

        final Room thisRoom = mob.location();
        for (final Object element : h) {
          final MOB follower = (MOB) element;
          final CMMsg enterMsg =
              CMClass.getMsg(
                  follower,
                  clanHomeRoom,
                  this,
                  CMMsg.MSG_ENTER,
                  null,
                  CMMsg.MSG_ENTER,
                  null,
                  CMMsg.MSG_ENTER,
                  L("<S-NAME> appears in a puff of red smoke."));
          final CMMsg leaveMsg =
              CMClass.getMsg(
                  follower,
                  thisRoom,
                  this,
                  CMMsg.MSG_LEAVE | CMMsg.MASK_MAGIC,
                  L("<S-NAME> disappear(s) in a puff of red smoke."));
          if (thisRoom.okMessage(follower, leaveMsg)
              && clanHomeRoom.okMessage(follower, enterMsg)) {
            if (follower.isInCombat()) {
              CMLib.commands().postFlee(follower, ("NOWHERE"));
              follower.makePeace(false);
            }
            thisRoom.send(follower, leaveMsg);
            clanHomeRoom.bringMobHere(follower, false);
            clanHomeRoom.send(follower, enterMsg);
            follower.tell(L("\n\r\n\r"));
            CMLib.commands().postLook(follower, true);
          }
        }
      }

    } else
      beneficialWordsFizzle(
          mob, null, L("<S-NAME> attempt(s) to invoke transportation, but fizzle(s) the spell."));

    // return whether it worked
    return success;
  }
Beispiel #6
0
  public boolean invoke(
      MOB mob, Vector commands, Environmental givenTarget, boolean auto, int asLevel) {
    if (type.length() == 0) return false;
    if ((mob.getClanID() == null)
        || (mob.getClanID().equalsIgnoreCase(""))
        || (mob.getClanRole() == 0)) {
      mob.tell("You aren't even a member of a clan.");
      return false;
    }
    Clan C = CMLib.clans().getClan(mob.getClanID());
    if (C == null) {
      mob.tell("You aren't even a member of a clan.");
      return false;
    }
    if (C.allowedToDoThis(mob, Clan.FUNC_CLANENCHANT) != 1) {
      mob.tell("You are not authorized to draw from the power of your " + C.typeName() + ".");
      return false;
    }
    String ClanName = C.clanID();
    String ClanType = C.typeName();

    // Invoking will be like:
    //   CAST [CLANEQSPELL] ITEM QUANTITY
    //   -2   -1            0    1
    if (commands.size() < 1) {
      mob.tell("Enchant which spell onto what?");
      return false;
    }
    if (commands.size() < 2) {
      mob.tell("Use how much clan enchantment power?");
      return false;
    }
    Environmental target =
        mob.location()
            .fetchFromMOBRoomFavorsItems(
                mob, null, (String) commands.elementAt(0), Item.WORNREQ_UNWORNONLY);
    if ((target == null) || (!CMLib.flags().canBeSeenBy(target, mob))) {
      mob.tell("You don't see '" + ((String) commands.elementAt(0)) + "' here.");
      return false;
    }
    // Add clan power check start
    int points = CMath.s_int((String) commands.elementAt(1));
    if (points <= 0) {
      mob.tell("You need to use at least 1 enchantment point.");
      return false;
    }
    long exp = points * CMProps.getIntVar(CMProps.SYSTEMI_CLANENCHCOST);
    if ((C.getExp() < exp) || (exp < 0)) {
      mob.tell(
          "You need "
              + exp
              + " to do that, but your "
              + C.typeName()
              + " has only "
              + C.getExp()
              + " experience points.");
      return false;
    }

    // Add clan power check end
    if (target.fetchEffect("Prop_ClanEquipment") != null) {
      mob.tell(target.name() + " is already clan enchanted.");
      return false;
    }

    // lose all the mana!
    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

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

    C.setExp(C.getExp() - exp);
    C.update();

    if (success) {
      CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              verbalCastCode(mob, target, auto),
              "^S<S-NAME> move(s) <S-HIS-HER> fingers around <T-NAMESELF>, encanting intensely.^?");
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        Ability A = CMClass.getAbility("Prop_ClanEquipment");
        StringBuffer str = new StringBuffer("");
        str.append(type); // Type of Enchantment
        str.append(" ");
        str.append("" + points); // Power of Enchantment
        str.append(" \"");
        str.append(ClanName); // Clan Name
        str.append("\" \"");
        str.append(ClanType); // Clan Type
        str.append("\"");
        A.setMiscText(str.toString());
        target.addEffect(A);
      }
    } else
      beneficialWordsFizzle(
          mob,
          target,
          "<S-NAME> move(s) <S-HIS-HER> fingers around <T-NAMESELF>, encanting intensely, and looking very frustrated.");
    return success;
  }
  @Override
  public void execute(CommandSender sender, String label, String[] args) {
    String headColor = plugin.getSettingsManager().getPageHeadingsColor();
    String subColor = plugin.getSettingsManager().getPageSubTitleColor();

    if (plugin.getPermissionsManager().has(sender, "simpleclans.anyone.rivalries")) {
      List<Clan> clans = plugin.getClanManager().getClans();
      plugin.getClanManager().sortClansByKDR(clans);

      ChatBlock chatBlock = new ChatBlock();

      ChatBlock.sendBlank(sender);
      ChatBlock.saySingle(
          sender,
          plugin.getSettingsManager().getServerName()
              + subColor
              + " "
              + plugin.getLang("rivalries")
              + " "
              + headColor
              + Helper.generatePageSeparator(plugin.getSettingsManager().getPageSep()));
      ChatBlock.sendBlank(sender);
      ChatBlock.sendMessage(
          sender,
          headColor
              + plugin.getLang("legend")
              + ChatColor.DARK_RED
              + " ["
              + plugin.getLang("war")
              + "]");
      ChatBlock.sendBlank(sender);

      chatBlock.setAlignment("l", "l");
      chatBlock.addRow(plugin.getLang("clan"), plugin.getLang("rivals"));

      for (Clan clan : clans) {
        if (!clan.isVerified()) {
          continue;
        }

        chatBlock.addRow(
            "  " + ChatColor.AQUA + clan.getName(),
            clan.getRivalString(ChatColor.DARK_GRAY + ", "));
      }

      boolean more = chatBlock.sendBlock(sender, plugin.getSettingsManager().getPageSize());

      if (more) {
        plugin.getStorageManager().addChatBlock(sender, chatBlock);
        ChatBlock.sendBlank(sender);
        ChatBlock.sendMessage(
            sender,
            headColor
                + MessageFormat.format(
                    plugin.getLang("view.next.page"),
                    plugin.getSettingsManager().getCommandMore()));
      }

      ChatBlock.sendBlank(sender);
    } else {
      ChatBlock.sendMessage(sender, ChatColor.RED + plugin.getLang("insufficient.permissions"));
    }
  }
Beispiel #8
0
  public String runMacro(ExternalHTTPRequests httpReq, String parm) {
    if (!CMProps.getBoolVar(CMProps.SYSTEMB_MUDSTARTED))
      return CMProps.getVar(CMProps.SYSTEM_MUDSTATUS);

    Hashtable parms = parseParms(parm);
    String last = httpReq.getRequestParameter("PLAYER");
    if (last == null) return " @break@";
    if (last.length() > 0) {
      MOB M = CMLib.players().getLoadPlayer(last);
      if (M == null) {
        MOB authM = Authenticate.getAuthenticatedMob(httpReq);
        if ((authM != null) && (authM.Name().equalsIgnoreCase(last))) M = authM;
        else return " @break@";
      }

      boolean firstTime =
          (!httpReq.isRequestParameter("ACTION"))
              || (httpReq.getRequestParameter("ACTION")).equals("FIRSTTIME");
      StringBuffer str = new StringBuffer("");
      for (int i = 0; i < MOB.AUTODESC.length; i++) {
        if (parms.containsKey(MOB.AUTODESC[i])) {
          boolean set = CMath.isSet(M.getBitmap(), i);
          if (MOB.AUTOREV[i]) set = !set;
          str.append((set ? "ON" : "OFF") + ",");
        }
      }
      for (int i : CharStats.CODES.ALL()) {
        String stat = CharStats.CODES.NAME(i);
        if (!stat.equalsIgnoreCase("GENDER")) {
          CharStats C = M.charStats();
          if (parms.containsKey(stat)) {
            String old = httpReq.getRequestParameter(stat);
            if ((firstTime) || (old.length() == 0)) {
              if ((!CharStats.CODES.isBASE(i)) && (i != CharStats.STAT_GENDER))
                old = "" + C.getSave(i);
              else old = "" + C.getStat(i);
            }
            str.append(old + ", ");
          }
        }
      }
      for (int i : CharStats.CODES.ALL()) {
        String stat = CharStats.CODES.NAME(i);
        if (!stat.equalsIgnoreCase("GENDER")) {
          CharStats C = M.baseCharStats();
          if (parms.containsKey("BASE" + stat)) {
            String old = httpReq.getRequestParameter("BASE" + stat);
            if ((firstTime) || (old.length() == 0)) old = "" + C.getStat(i);
            str.append(old + ", ");
          }
        }
      }
      for (int i = 0; i < BASICS.length; i++) {
        if (parms.containsKey(BASICS[i])) {
          if (httpReq.isRequestParameter(BASICS[i]))
            str.append(httpReq.getRequestParameter(BASICS[i]) + ", ");
          else str.append(getBasic(M, i));
        }
      }
      if (parms.containsKey("RACE")) {
        String old = httpReq.getRequestParameter("RACE");
        if ((firstTime) || (old.length() == 0)) old = "" + M.baseCharStats().getMyRace().ID();
        for (Enumeration r = CMClass.races(); r.hasMoreElements(); ) {
          Race R2 = (Race) r.nextElement();
          str.append("<OPTION VALUE=\"" + R2.ID() + "\"");
          if (R2.ID().equals(old)) str.append(" SELECTED");
          str.append(">" + R2.name());
        }
      }
      if (parms.containsKey("DEITY")) {
        String old = httpReq.getRequestParameter("DEITY");
        if (firstTime) old = M.getWorshipCharID();
        str.append("<OPTION " + ((old.length() == 0) ? "SELECTED" : "") + " VALUE=\"\">Godless");
        for (Enumeration e = CMLib.map().deities(); e.hasMoreElements(); ) {
          Deity E = (Deity) e.nextElement();
          str.append("<OPTION VALUE=\"" + E.Name() + "\"");
          if (E.Name().equalsIgnoreCase(old)) str.append(" SELECTED");
          str.append(">" + E.Name());
        }
      }
      if (parms.containsKey("TITLELIST")) {
        if (M.playerStats() != null) {
          int b = 0;
          Vector titles = new Vector();
          if (firstTime) CMParms.addToVector(M.playerStats().getTitles(), titles);
          else
            while (httpReq.isRequestParameter("TITLE" + b)) {
              String B = httpReq.getRequestParameter("TITLE" + b);
              if ((B != null) && (B.trim().length() > 0)) titles.addElement(B);
              b++;
            }
          for (b = 0; b < titles.size(); b++) {
            String B = (String) titles.elementAt(b);
            if (B != null)
              str.append(
                  "<INPUT TYPE=TEXT NAME=TITLE"
                      + b
                      + " SIZE="
                      + B.length()
                      + " VALUE=\""
                      + CMStrings.replaceAll(B, "\"", "&quot;")
                      + "\"><BR>");
          }
          str.append("<INPUT TYPE=TEXT NAME=TITLE" + titles.size() + " SIZE=60 VALUE=\"\">");
        }
      }
      if (parms.containsKey("CLAN")) {
        String old = httpReq.getRequestParameter("CLAN");
        if (firstTime) old = M.getClanID();
        str.append("<OPTION " + ((old.length() == 0) ? "SELECTED" : "") + " VALUE=\"\">Clanless");
        for (Enumeration e = CMLib.clans().allClans(); e.hasMoreElements(); ) {
          Clan C = (Clan) e.nextElement();
          str.append("<OPTION VALUE=\"" + C.clanID() + "\"");
          if (C.clanID().equalsIgnoreCase(old)) str.append(" SELECTED");
          str.append(">" + C.getName());
        }
      }
      if (parms.containsKey("ALIGNMENT")) {
        String old = httpReq.getRequestParameter("ALIGNMENT");
        if ((firstTime) || (old.length() == 0))
          old = "" + M.fetchFaction(CMLib.factions().AlignID());
        if (CMLib.factions().getFaction(CMLib.factions().AlignID()) != null) {
          for (int v = 1; v < Faction.ALIGN_NAMES.length; v++) {
            str.append("<OPTION VALUE=" + Faction.ALIGN_NAMES[v]);
            if (old.equalsIgnoreCase(Faction.ALIGN_NAMES[v])) str.append(" SELECTED");
            str.append(">" + CMStrings.capitalizeAndLower(Faction.ALIGN_NAMES[v].toLowerCase()));
          }
        }
      }
      if (parms.containsKey("BASEGENDER")) {
        String old = httpReq.getRequestParameter("BASEGENDER");
        if (firstTime) old = "" + M.baseCharStats().getStat(CharStats.STAT_GENDER);
        str.append("<OPTION VALUE=M " + ((old.equalsIgnoreCase("M")) ? "SELECTED" : "") + ">M");
        str.append("<OPTION VALUE=F " + ((old.equalsIgnoreCase("F")) ? "SELECTED" : "") + ">F");
        str.append("<OPTION VALUE=N " + ((old.equalsIgnoreCase("N")) ? "SELECTED" : "") + ">N");
      }
      str.append(MobData.expertiseList(M, httpReq, parms));
      str.append(MobData.classList(M, httpReq, parms));
      str.append(MobData.itemList(M, M, httpReq, parms, 0));
      str.append(MobData.abilities(M, httpReq, parms, 0));
      str.append(MobData.factions(M, httpReq, parms, 0));
      str.append(AreaData.affectsNBehaves(M, httpReq, parms, 0));
      str.append(ExitData.dispositions(M, firstTime, httpReq, parms));
      str.append(MobData.senses(M, firstTime, httpReq, parms));
      String strstr = str.toString();
      if (strstr.endsWith(", ")) strstr = strstr.substring(0, strstr.length() - 2);
      return clearWebMacros(strstr);
    }
    return "";
  }
Beispiel #9
0
 public static String getBasic(MOB M, int i) {
   StringBuffer str = new StringBuffer("");
   switch (i) {
     case 0:
       str.append(M.Name() + ", ");
       break;
     case 1:
       str.append(M.description() + ", ");
       break;
     case 2:
       if (M.playerStats() != null)
         str.append(CMLib.time().date2String(M.playerStats().lastDateTime()) + ", ");
       break;
     case 3:
       if (M.playerStats() != null) str.append(M.playerStats().getEmail() + ", ");
       break;
     case 4:
       str.append(M.baseCharStats().getMyRace().name() + ", ");
       break;
     case 5:
       str.append(
           M.baseCharStats().getCurrentClass().name(M.baseCharStats().getCurrentClassLevel())
               + ", ");
       break;
     case 6:
       str.append(M.baseEnvStats().level() + ", ");
       break;
     case 7:
       str.append(M.baseCharStats().displayClassLevel(M, true) + ", ");
       break;
     case 8:
       str.append(M.baseCharStats().getClassLevel(M.baseCharStats().getCurrentClass()) + ", ");
       break;
     case 9:
       {
         for (int c = M.charStats().numClasses() - 1; c >= 0; c--) {
           CharClass C = M.charStats().getMyClass(c);
           str.append(
               C.name(M.baseCharStats().getCurrentClassLevel())
                   + " ("
                   + M.charStats().getClassLevel(C)
                   + ") ");
         }
         str.append(", ");
         break;
       }
     case 10:
       if (M.maxCarry() > (Integer.MAX_VALUE / 3)) str.append("NA, ");
       else str.append(M.maxCarry() + ", ");
       break;
     case 11:
       str.append(CMStrings.capitalizeAndLower(CMLib.combat().fightingProwessStr(M)) + ", ");
       break;
     case 12:
       str.append(CMStrings.capitalizeAndLower(CMLib.combat().armorStr(M)) + ", ");
       break;
     case 13:
       str.append(CMLib.combat().adjustedDamage(M, null, null) + ", ");
       break;
     case 14:
       str.append(Math.round(CMath.div(M.getAgeHours(), 60.0)) + ", ");
       break;
     case 15:
       str.append(M.getPractices() + ", ");
       break;
     case 16:
       str.append(M.getExperience() + ", ");
       break;
     case 17:
       if (M.getExpNeededLevel() == Integer.MAX_VALUE) str.append("N/A, ");
       else str.append(M.getExpNextLevel() + ", ");
       break;
     case 18:
       str.append(M.getTrains() + ", ");
       break;
     case 19:
       str.append(CMLib.beanCounter().getMoney(M) + ", ");
       break;
     case 20:
       str.append(M.getWorshipCharID() + ", ");
       break;
     case 21:
       str.append(M.getLiegeID() + ", ");
       break;
     case 22:
       str.append(M.getClanID() + ", ");
       break;
     case 23:
       if (M.getClanID().length() > 0) {
         Clan C = CMLib.clans().getClan(M.getClanID());
         if (C != null)
           str.append(
               CMLib.clans().getRoleName(C.getGovernment(), M.getClanRole(), true, false) + ", ");
       }
       break;
     case 24:
       str.append(M.fetchFaction(CMLib.factions().AlignID()) + ", ");
       break;
     case 25:
       {
         Faction.FactionRange FR =
             CMLib.factions()
                 .getRange(CMLib.factions().AlignID(), M.fetchFaction(CMLib.factions().AlignID()));
         if (FR != null) str.append(FR.name() + ", ");
         else str.append(M.fetchFaction(CMLib.factions().AlignID()));
         break;
       }
     case 26:
       str.append(M.getWimpHitPoint() + ", ");
       break;
     case 27:
       if (M.getStartRoom() != null) str.append(M.getStartRoom().displayText() + ", ");
       break;
     case 28:
       if (M.location() != null) str.append(M.location().displayText() + ", ");
       break;
     case 29:
       if (M.getStartRoom() != null) str.append(M.getStartRoom().roomID() + ", ");
       break;
     case 30:
       if (M.location() != null) str.append(M.location().roomID() + ", ");
       break;
     case 31:
       {
         for (int inv = 0; inv < M.inventorySize(); inv++) {
           Item I = M.fetchInventory(inv);
           if ((I != null) && (I.container() == null)) str.append(I.name() + ", ");
         }
         break;
       }
     case 32:
       str.append(M.baseEnvStats().weight() + ", ");
       break;
     case 33:
       str.append(M.envStats().weight() + ", ");
       break;
     case 34:
       str.append(CMStrings.capitalizeAndLower(M.baseCharStats().genderName()) + ", ");
       break;
     case 35:
       if (M.playerStats() != null) str.append(M.playerStats().lastDateTime() + ", ");
       break;
     case 36:
       str.append(M.curState().getHitPoints() + ", ");
       break;
     case 37:
       str.append(M.curState().getMana() + ", ");
       break;
     case 38:
       str.append(M.curState().getMovement() + ", ");
       break;
     case 39:
       if (M.riding() != null) str.append(M.riding().name() + ", ");
       break;
     case 40:
       str.append(M.baseEnvStats().height() + ", ");
       break;
     case 41:
       if (!M.isMonster()) str.append(M.session().getAddress() + ", ");
       else if (M.playerStats() != null) str.append(M.playerStats().lastIP() + ", ");
       break;
     case 42:
       str.append(M.getQuestPoint() + ", ");
       break;
     case 43:
       str.append(M.maxState().getHitPoints() + ", ");
       break;
     case 44:
       str.append(M.maxState().getMana() + ", ");
       break;
     case 45:
       str.append(M.maxState().getMovement() + ", ");
       break;
     case 46:
       str.append(M.rawImage() + ", ");
       break;
     case 47:
       str.append(M.maxItems() + ", ");
       break;
     case 48:
       {
         String[] paths = CMProps.mxpImagePath(M.image());
         if (paths[0].length() > 0) str.append(paths[0] + paths[1] + ", ");
         break;
       }
     case 49:
       if (CMProps.mxpImagePath(M.image())[0].length() > 0) str.append("true, ");
       else str.append("false, ");
       break;
     case 50:
       if (M.playerStats() != null) str.append(M.playerStats().notes() + ", ");
       break;
     case 51:
       if (M.playerStats() != null) {
         long lastDateTime = -1;
         for (int level = 0; level <= M.envStats().level(); level++) {
           long dateTime = M.playerStats().leveledDateTime(level);
           if ((dateTime > 1529122205) && (dateTime != lastDateTime)) {
             str.append("<TR>");
             if (level == 0) str.append("<TD><FONT COLOR=WHITE>Created</FONT></TD>");
             else str.append("<TD><FONT COLOR=WHITE>" + level + "</FONT></TD>");
             str.append(
                 "<TD><FONT COLOR=WHITE>"
                     + CMLib.time().date2String(dateTime)
                     + "</FONT></TD></TR>");
           }
         }
         str.append(", ");
       }
       break;
     case 52:
       str.append(M.baseEnvStats().attackAdjustment() + ", ");
       break;
     case 53:
       str.append(M.baseEnvStats().damage() + ", ");
       break;
     case 54:
       str.append(M.baseEnvStats().armor() + ", ");
       break;
     case 55:
       str.append(M.envStats().speed() + ", ");
       break;
     case 56:
       str.append(M.baseEnvStats().speed() + ", ");
       break;
     case 57:
       {
         for (int e = 0; e < M.numExpertises(); e++) {
           String E = M.fetchExpertise(e);
           ExpertiseLibrary.ExpertiseDefinition X = CMLib.expertises().getDefinition(E);
           if (X == null) str.append(E + ", ");
           else str.append(X.name + ", ");
         }
         break;
       }
     case 58:
       {
         for (int t = 0; t < M.numTattoos(); t++) {
           String E = M.fetchTattoo(t);
           str.append(E + ", ");
         }
         break;
       }
     case 59:
       {
         if (M.playerStats() != null)
           for (int b = 0; b < M.playerStats().getSecurityGroups().size(); b++) {
             String B = (String) M.playerStats().getSecurityGroups().elementAt(b);
             if (B != null) str.append(B + ", ");
           }
         break;
       }
     case 60:
       {
         if (M.playerStats() != null)
           for (int b = 0; b < M.playerStats().getTitles().size(); b++) {
             String B = (String) M.playerStats().getTitles().elementAt(b);
             if (B != null) str.append(B + ", ");
           }
         break;
       }
     case 61:
       {
         for (Enumeration e = M.fetchFactions(); e.hasMoreElements(); ) {
           String FID = (String) e.nextElement();
           Faction F = CMLib.factions().getFaction(FID);
           int value = M.fetchFaction(FID);
           if (F != null) str.append(F.name() + " (" + value + "), ");
         }
         break;
       }
     case 62:
       str.append(CMProps.getBoolVar(CMProps.SYSTEMB_ACCOUNTEXPIRATION) ? "true" : "false");
       break;
     case 63:
       if (M.playerStats() != null)
         str.append(CMLib.time().date2String(M.playerStats().getAccountExpiration()));
       break;
     case 64:
       {
         for (int f = 0; f < M.numFollowers(); f++)
           str.append(M.fetchFollower(f).name()).append(", ");
         // Vector V=CMLib.database().DBScanFollowers(M);
         // for(int v=0;v<V.size();v++)
         //    str.append(((MOB)V.elementAt(v)).name()).append(", ");
         break;
       }
     case 65:
       if ((M.playerStats() != null) && (M.playerStats().getAccount() != null))
         str.append(M.playerStats().getAccount().accountName());
       break;
   }
   return str.toString();
 }
Beispiel #10
0
  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;
  }
Beispiel #11
0
  @Override
  public boolean okMessage(final Environmental myHost, final CMMsg msg) {
    if ((clanID().length() > 0) && (msg.amITarget(this))) {
      if (msg.source().getClanRole(clanID()) == null) {
        if ((msg.targetMinor() == CMMsg.TYP_GET)
            || (msg.targetMinor() == CMMsg.TYP_PUSH)
            || (msg.targetMinor() == CMMsg.TYP_PULL)
            || (msg.targetMinor() == CMMsg.TYP_CAST_SPELL)) {
          final Room R = CMLib.map().roomLocation(this);
          if (CMLib.clans().findRivalrousClan(msg.source()) == null) {
            msg.source().tell(L("You must belong to an elligible clan to take a clan item."));
            return false;
          } else if (R != null) {
            for (int i = 0; i < R.numInhabitants(); i++) {
              final MOB M = R.fetchInhabitant(i);
              if ((M != null)
                  && (M.isMonster())
                  && (M.getClanRole(clanID()) != null)
                  && (CMLib.flags().aliveAwakeMobileUnbound(M, true))
                  && (CMLib.flags().canBeSeenBy(this, M))
                  && (!CMLib.flags().isAnimalIntelligence(M))) {
                R.show(
                    M, null, CMMsg.MSG_QUIETMOVEMENT, L("<S-NAME> guard(s) @x1 closely.", name()));
                return false;
              }
            }
            String rulingClan = "";
            final LegalBehavior B = CMLib.law().getLegalBehavior(R);
            if (B != null) rulingClan = B.rulingOrganization();
            if (msg.source().getClanRole(rulingClan) == null) {
              msg.source()
                  .tell(L("You must conquer and fully control this area to take the clan flag."));
              return false;
            }
            if ((B != null) && (!B.isFullyControlled())) {
              msg.source().tell(L("Your clan does not yet fully control the area."));
              return false;
            }
          }
        } else if ((msg.targetMinor() == CMMsg.TYP_DROP)
            && (!CMath.bset(msg.targetMajor(), CMMsg.MASK_INTERMSG))) {
          final Room R = msg.source().location();
          LandTitle T = null;
          Area A = null;
          LegalBehavior B = null;
          if (R != null) {
            A = R.getArea();
            T = CMLib.law().getLandTitle(R);
          }
          if ((T == null)
              || ((!T.getOwnerName().equals(clanID()))
                  && ((!T.getOwnerName().equals(msg.source().getLiegeID()))
                      || (!msg.source().isMarriedToLiege()))
                  && (!T.getOwnerName().equals(msg.source().Name())))) {
            boolean ok = false;
            if (A != null) {
              B = CMLib.law().getLegalBehavior(R);
              if (B != null) ok = B.controlPoints() > 0;
            }
            if (!ok) {
              msg.source()
                  .tell(
                      L("You can not place a flag here, this place is controlled by the Archons."));
              return false;
            }
          }
        }
      } else if ((msg.targetMinor() == CMMsg.TYP_GET)
          && (msg.source().location() != null)
          && (msg.source().isMonster())) {
        boolean foundOne = false;
        for (int i = 0; i < msg.source().location().numInhabitants(); i++) {
          final MOB M = msg.source().location().fetchInhabitant(i);
          if ((M != null) && (!M.isMonster()) && (M.getClanRole(clanID()) != null)) {
            foundOne = true;
            break;
          }
        }
        if (!foundOne) {
          msg.source().tell(L("You are guarding @x1 too closely.", name()));
          return false;
        }
      }
    }

    if (StdClanItem.stdOkMessage(this, msg)) {
      if ((clanID().length() > 0)
          && (msg.amITarget(this))
          && (msg.targetMinor() == CMMsg.TYP_DROP)) {
        final LegalBehavior B = CMLib.law().getLegalBehavior(msg.source().location());
        final String rulingClan = (B != null) ? B.rulingOrganization() : "";
        if (rulingClan.length() == 0)
          msg.source()
              .tell(
                  L("Area '@x1' is presently neutral.", msg.source().location().getArea().name()));
        else {
          msg.source()
              .tell(
                  L(
                      "Area '@x1' is presently controlled by @x2.",
                      msg.source().location().getArea().name(),
                      rulingClan));
          if (!rulingClan.equals(clanID())) {
            int relation = Clan.REL_WAR;
            final Clan C = CMLib.clans().getClan(clanID());
            if (C == null) {
              msg.source().tell(L("This ancient relic from a lost clan fades out of existence."));
              this.destroy();
              return false;
            }
            relation = C.getClanRelations(rulingClan);
            if (relation != Clan.REL_WAR) {
              msg.source()
                  .tell(
                      L("You must be at war with this clan to put down your flag on their area."));
              return false;
            }
          }
        }
      }
      return super.okMessage(myHost, msg);
    }
    return false;
  }
Beispiel #12
0
  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;
  }