@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); } } } }
@Override public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; final boolean success = proficiencyCheck(mob, 0, auto); final String str = auto ? L("The unholy word is spoken.") : L("^S<S-NAME> speak(s) the unholy word@x1 to <T-NAMESELF>.^?", ofDiety(mob)); final Room room = mob.location(); if (room != null) for (int i = 0; i < room.numInhabitants(); i++) { final MOB target = room.fetchInhabitant(i); if (target == null) break; int affectType = CMMsg.MSG_CAST_VERBAL_SPELL; if (auto) affectType = affectType | CMMsg.MASK_ALWAYS; if (CMLib.flags().isGood(target)) affectType = affectType | CMMsg.MASK_MALICIOUS; if (success) { final CMMsg msg = CMClass.getMsg(mob, target, this, affectType, str); if (room.okMessage(mob, msg)) { room.send(mob, msg); if (msg.value() <= 0) { if (CMLib.flags().canBeHeardSpeakingBy(mob, target)) { final Item I = Prayer_Curse.getSomething(mob, true); if (I != null) { Prayer_Curse.endLowerBlessings(I, CMLib.ableMapper().lowestQualifyingLevel(ID())); I.recoverPhyStats(); } Prayer_Curse.endLowerBlessings( target, CMLib.ableMapper().lowestQualifyingLevel(ID())); beneficialAffect(mob, target, asLevel, 0); target.recoverPhyStats(); } else if (CMath.bset(affectType, CMMsg.MASK_MALICIOUS)) maliciousFizzle(mob, target, L("<T-NAME> did not hear the unholy word!")); else beneficialWordsFizzle(mob, target, L("<T-NAME> did not hear the unholy word!")); } } } else { if (CMath.bset(affectType, CMMsg.MASK_MALICIOUS)) maliciousFizzle( mob, target, L("<S-NAME> attempt(s) to speak the unholy word to <T-NAMESELF>, but flub(s) it.")); else beneficialWordsFizzle( mob, target, L("<S-NAME> attempt(s) to speak the unholy word to <T-NAMESELF>, but flub(s) it.")); return false; } } // return whether it worked return success; }
protected MOB getCharmer() { if (charmer != null) return charmer; if ((invoker != null) && (invoker != affected)) charmer = invoker; else if ((text().length() > 0) && (affected instanceof MOB)) { final Room R = ((MOB) affected).location(); if (R != null) charmer = R.fetchInhabitant(text()); } if (charmer == null) return invoker; return charmer; }
public static boolean shopkeeperMobPresent(Room R) { if (R == null) return false; MOB M = null; for (int i = 0; i < R.numInhabitants(); i++) { M = R.fetchInhabitant(i); if ((M.getStartRoom() == R) && (M.isMonster()) && (CMLib.coffeeShops().getShopKeeper(M) != null)) return true; } return false; }
@Override public boolean tick(Tickable ticking, int tickID) { if ((affected == null) || (!(affected instanceof Room))) return super.tick(ticking, tickID); if ((--damageTickDown) >= 0) return super.tick(ticking, tickID); damageTickDown = 4; HashSet H = null; if ((invoker() != null) && (invoker().location() == affected)) { H = new HashSet(); invoker().getGroupMembers(H); } final Room R = (Room) affected; for (int i = 0; i < R.numInhabitants(); i++) { final MOB M = R.fetchInhabitant(i); if ((M != null) && ((H == null) || (!H.contains(M)))) { if (invoker() != null) { final int harming = CMLib.dice().roll(1, adjustedLevel(invoker(), 0) / 3, 1); CMLib.combat() .postDamage( invoker(), M, this, harming, CMMsg.MASK_MALICIOUS | CMMsg.TYP_UNDEAD, Weapon.TYPE_BURSTING, L("The unholy aura <DAMAGE> <T-NAME>!")); } else { final int harming = CMLib.dice().roll(1, CMLib.ableMapper().lowestQualifyingLevel(ID()) / 3, 1); CMLib.combat() .postDamage( M, M, this, harming, CMMsg.MASK_MALICIOUS | CMMsg.TYP_UNDEAD, Weapon.TYPE_BURSTING, L("The unholy aura <DAMAGE> <T-NAME>!")); } if ((!M.isInCombat()) && (M.isMonster()) && (M != invoker) && (invoker != null) && (M.location() == invoker.location()) && (M.location().isInhabitant(invoker)) && (CMLib.flags().canBeSeenBy(invoker, M))) CMLib.combat().postAttack(M, invoker, M.fetchWieldedItem()); } } return super.tick(ticking, tickID); }
public MOB victimHere(Room room, MOB mob) { if (room == null) return null; if (mob == null) return null; for (int i = 0; i < room.numInhabitants(); i++) { final MOB M = room.fetchInhabitant(i); if ((M != null) && (M != mob) && (!CMLib.flags().isEvil(M)) && (mob.mayIFight(M)) && (M.phyStats().level() < (mob.phyStats().level() + 5))) return M; } return null; }
public boolean nonIPnonMonsterWithMe(MOB me) { if ((me.location() != null) && (me.session() != null)) { final Room R = me.location(); for (int i = 0; i < R.numInhabitants(); i++) { final MOB M = R.fetchInhabitant(i); if ((M == null) || (M == me)) continue; if ((M.session() != null) && (M.session().getAddress().equals(me.session().getAddress()))) return true; } } return false; }
private void fillCheckDeviations(Room R, String type, Vector<Environmental> check) { if (type.equalsIgnoreCase("mobs") || type.equalsIgnoreCase("both")) { for (int m = 0; m < R.numInhabitants(); m++) { final MOB M = R.fetchInhabitant(m); if ((M != null) && (M.isSavable()) && (!alreadyDone(M, check))) check.add(M); } } if (type.equalsIgnoreCase("items") || type.equalsIgnoreCase("both")) { for (int i = 0; i < R.numItems(); i++) { final Item I = R.getItem(i); if ((I != null) && ((I instanceof Armor) || (I instanceof Weapon)) && (!alreadyDone(I, check))) check.add(I); } for (int m = 0; m < R.numInhabitants(); m++) { final MOB M = R.fetchInhabitant(m); if (M != null) { for (int i = 0; i < M.numItems(); i++) { final Item I = M.getItem(i); if ((I != null) && ((I instanceof Armor) || (I instanceof Weapon)) && (!alreadyDone(I, check))) check.add(I); } final ShopKeeper SK = CMLib.coffeeShops().getShopKeeper(M); if (SK != null) { for (final Iterator<Environmental> i = SK.getShop().getStoreInventory(); i.hasNext(); ) { final Environmental E2 = i.next(); if (E2 instanceof Item) { final Item I = (Item) E2; if (((I instanceof Armor) || (I instanceof Weapon)) && (!alreadyDone(I, check))) check.add(I); } } } } } } }
public Set<MOB> getEveryoneHere(MOB spareMe, Room R) { final Set<MOB> V = new HashSet<MOB>(); if (R == null) return V; for (int i = 0; i < R.numInhabitants(); i++) { final MOB M = R.fetchInhabitant(i); if ((spareMe != null) && (spareMe == M)) continue; if ((M != null) && (!CMSecurity.isAllowed(M, R, CMSecurity.SecFlag.IMMORT)) && ((mask == null) || (CMLib.masking().maskCheck(mask, M, false)))) V.add(M); } return V; // CMLib.combat().postDeath(null,M,null); }
@Override public int castingQuality(MOB mob, Physical target) { if (mob != null) { if (target instanceof MOB) { final Room R = ((MOB) target).location(); boolean found = false; if (R != null) for (int r = 0; r < R.numInhabitants(); r++) { final MOB M = R.fetchInhabitant(r); if ((M != null) && (M != mob) && (M != target) && (CMLib.flags().isInvisible(M))) { found = true; break; } } if (!found) return Ability.QUALITY_INDIFFERENT; } } return super.castingQuality(mob, target); }
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; }
@Override public boolean execute(MOB mob, Vector commands, int metaFlags) throws java.io.IOException { final boolean noisy = CMSecurity.isDebugging(CMSecurity.DbgFlag.MERGE); Vector placesToDo = new Vector(); commands.remove(0); if (commands.size() == 0) { mob.tell(L("Merge what? Try DATABASE or a filename")); return false; } if (mob.isMonster()) { mob.tell(L("No can do.")); return false; } if ((commands.size() > 0) && ((String) commands.get(0)).equalsIgnoreCase("noprompt")) commands.remove(0); if ((commands.size() > 0) && ((String) commands.get(0)).equalsIgnoreCase("?")) { final StringBuffer allFieldsMsg = new StringBuffer(""); final Vector allKnownFields = new Vector(); sortEnumeratedList(CMClass.mobTypes(), allKnownFields, allFieldsMsg); sortEnumeratedList(CMClass.basicItems(), allKnownFields, allFieldsMsg); sortEnumeratedList(CMClass.weapons(), allKnownFields, allFieldsMsg); sortEnumeratedList(CMClass.armor(), allKnownFields, allFieldsMsg); sortEnumeratedList(CMClass.clanItems(), allKnownFields, allFieldsMsg); sortEnumeratedList(CMClass.miscMagic(), allKnownFields, allFieldsMsg); sortEnumeratedList(CMClass.tech(), allKnownFields, allFieldsMsg); mob.tell(L("Valid field names are @x1", allFieldsMsg.toString())); return false; } String scope = "WORLD"; if ((commands.size() > 0) && ((String) commands.get(0)).equalsIgnoreCase("room")) { if (!CMSecurity.isAllowed(mob, mob.location(), CMSecurity.SecFlag.MERGE)) { mob.tell(L("You are not allowed to do that here.")); return false; } commands.remove(0); placesToDo.add(mob.location()); scope = "ROOM"; } if ((commands.size() > 0) && ((String) commands.get(0)).equalsIgnoreCase("area")) { if (!CMSecurity.isAllowed(mob, mob.location(), CMSecurity.SecFlag.MERGE)) { mob.tell(L("You are not allowed to do that here.")); return false; } commands.remove(0); placesToDo.add(mob.location().getArea()); scope = "AREA"; } if ((commands.size() > 0) && ((String) commands.get(0)).equalsIgnoreCase("world")) { if (!CMSecurity.isAllowedEverywhere(mob, CMSecurity.SecFlag.MERGE)) { mob.tell(L("You are not allowed to do that.")); return false; } commands.remove(0); placesToDo = new Vector(); scope = "WORLD"; } if (commands.size() == 0) { mob.tell(L("Merge what? DATABASE or filename")); return false; } String firstWord = (String) commands.get(0); if (firstWord.equalsIgnoreCase("DATABASE")) { commands.remove(0); if (commands.size() == 0) { mob.tell(L("Merge parameters missing: DBCLASS, DBSERVICE, DBUSER, DBPASS")); return false; } firstWord = (String) commands.get(0); return doArchonDBCompare(mob, scope, firstWord, commands); } final String filename = (String) commands.lastElement(); commands.remove(filename); final StringBuffer buf = new CMFile(filename, mob, CMFile.FLAG_LOGERRORS).text(); if ((buf == null) || (buf.length() == 0)) { mob.tell(L("File not found at: '@x1'!", filename)); return false; } final List<String> changes = new Vector(); final List<String> onfields = new Vector(); final List<String> ignore = new Vector(); List<String> use = null; final List<String> allKnownFields = new Vector(); final List things = new Vector(); boolean aremobs = false; if ((buf.length() > 20) && (buf.substring(0, 20).indexOf("<MOBS>") >= 0)) { if (mob.session() != null) mob.session().rawPrint(L("Unpacking mobs from file: '@x1'...", filename)); final String error = CMLib.coffeeMaker().addMOBsFromXML(buf.toString(), things, mob.session()); if (mob.session() != null) mob.session().rawPrintln("!"); if (error.length() > 0) { mob.tell(L("An error occurred on merge: @x1", error)); mob.tell(L("Please correct the problem and try the import again.")); return false; } aremobs = true; } else if ((buf.length() > 20) && (buf.substring(0, 20).indexOf("<ITEMS>") >= 0)) { if (mob.session() != null) mob.session().rawPrint(L("Unpacking items from file: '@x1'...", filename)); final String error = CMLib.coffeeMaker().addItemsFromXML(buf.toString(), things, mob.session()); if (mob.session() != null) mob.session().rawPrintln("!"); if (error.length() > 0) { mob.tell(L("An error occurred on merge: @x1", error)); mob.tell(L("Please correct the problem and try the import again.")); return false; } } else { mob.tell( L( "Files of this type are not yet supported by MERGE. You must merge an ITEMS or MOBS file at this time.")); return false; } if (things.size() == 0) { mob.tell(L("Nothing was found in the file to merge!")); return false; } final StringBuffer allFieldsMsg = new StringBuffer(""); if (aremobs) sortEnumeratedList(CMClass.mobTypes(), allKnownFields, allFieldsMsg); else { sortEnumeratedList(CMClass.basicItems(), allKnownFields, allFieldsMsg); sortEnumeratedList(CMClass.weapons(), allKnownFields, allFieldsMsg); sortEnumeratedList(CMClass.armor(), allKnownFields, allFieldsMsg); sortEnumeratedList(CMClass.clanItems(), allKnownFields, allFieldsMsg); sortEnumeratedList(CMClass.miscMagic(), allKnownFields, allFieldsMsg); sortEnumeratedList(CMClass.tech(), allKnownFields, allFieldsMsg); } allKnownFields.add("REJUV"); allFieldsMsg.append(L("REJUV ")); for (int i = 0; i < commands.size(); i++) { String str = ((String) commands.get(i)).toUpperCase(); if (str.startsWith("CHANGE=")) { use = changes; str = str.substring(7).trim(); } if (str.startsWith("ON=")) { use = onfields; str = str.substring(3).trim(); } if (str.startsWith("IGNORE=")) { use = ignore; str = str.substring(7).trim(); } int x = str.indexOf(','); while (x >= 0) { final String s = str.substring(0, x).trim(); if (s.length() > 0) { if (use == null) { mob.tell(L("'@x1' is an unknown parameter!", str)); return false; } if (allKnownFields.contains(s)) use.add(s); else { mob.tell( L( "'@x1' is an unknown field name. Valid fields include: @x2", s, allFieldsMsg.toString())); return false; } } str = str.substring(x + 1).trim(); x = str.indexOf(','); } if (str.length() > 0) { if (use == null) { mob.tell(L("'@x1' is an unknown parameter!", str)); return false; } if (allKnownFields.contains(str)) use.add(str); else { mob.tell( L( "'@x1' is an unknown field name. Valid fields include: @x2", str, allFieldsMsg.toString())); return false; } } } if ((onfields.size() == 0) && (ignore.size() == 0) && (changes.size() == 0)) { mob.tell( L( "You must specify either an ON, CHANGES, or IGNORE parameter for valid matches to be made.")); return false; } if (placesToDo.size() == 0) for (final Enumeration a = CMLib.map().areas(); a.hasMoreElements(); ) { final Area A = (Area) a.nextElement(); if (A.getCompleteMap().hasMoreElements() && CMSecurity.isAllowed( mob, (A.getCompleteMap().nextElement()), CMSecurity.SecFlag.MERGE)) placesToDo.add(A); } if (placesToDo.size() == 0) { mob.tell(L("There are no rooms to merge into!")); return false; } for (int i = placesToDo.size() - 1; i >= 0; i--) { if (placesToDo.get(i) instanceof Area) { final Area A = (Area) placesToDo.get(i); placesToDo.removeElement(A); for (final Enumeration r = A.getCompleteMap(); r.hasMoreElements(); ) { final Room R = (Room) r.nextElement(); if (CMSecurity.isAllowed(mob, R, CMSecurity.SecFlag.MERGE)) placesToDo.add(R); } } else if (placesToDo.get(i) instanceof Room) if (mob.session() != null) mob.session().rawPrint("."); else return false; } // now do the merge... if (mob.session() != null) mob.session().rawPrint(L("Merging and saving...")); if (noisy) mergedebugtell(mob, "Rooms to do: " + placesToDo.size()); if (noisy) mergedebugtell(mob, "Things loaded: " + things.size()); if (noisy) mergedebugtell(mob, "On fields=" + CMParms.toStringList(onfields)); if (noisy) mergedebugtell(mob, "Ignore fields=" + CMParms.toStringList(ignore)); if (noisy) mergedebugtell(mob, "Change fields=" + CMParms.toStringList(changes)); Log.sysOut("Import", mob.Name() + " merge '" + filename + "'."); for (int r = 0; r < placesToDo.size(); r++) { Room R = (Room) placesToDo.get(r); if (!CMSecurity.isAllowed(mob, R, CMSecurity.SecFlag.MERGE)) continue; if (R.roomID().length() == 0) continue; synchronized (("SYNC" + R.roomID()).intern()) { R = CMLib.map().getRoom(R); final Area.State oldFlags = R.getArea().getAreaState(); R.getArea().setAreaState(Area.State.FROZEN); CMLib.map().resetRoom(R); boolean savemobs = false; boolean saveitems = false; if (aremobs) { for (int m = 0; m < R.numInhabitants(); m++) { final MOB M = R.fetchInhabitant(m); if ((M != null) && (M.isSavable())) if (tryMerge(mob, R, M, things, changes, onfields, ignore, noisy)) savemobs = true; } } else { for (int i = 0; i < R.numItems(); i++) { final Item I = R.getItem(i); if ((I != null) && (tryMerge(mob, R, I, things, changes, onfields, ignore, noisy))) saveitems = true; } for (int m = 0; m < R.numInhabitants(); m++) { final MOB M = R.fetchInhabitant(m); if ((M != null) && (M.isSavable())) { for (int i = 0; i < M.numItems(); i++) { final Item I = M.getItem(i); if ((I != null) && (tryMerge(mob, R, I, things, changes, onfields, ignore, noisy))) savemobs = true; } final ShopKeeper SK = CMLib.coffeeShops().getShopKeeper(M); if (SK != null) { for (final Iterator<Environmental> i = SK.getShop().getStoreInventory(); i.hasNext(); ) { final Environmental E = i.next(); if (E instanceof Item) { final Item I = (Item) E; if (tryMerge(mob, R, I, things, changes, onfields, ignore, noisy)) savemobs = true; } } } } } } if (saveitems) CMLib.database().DBUpdateItems(R); if (savemobs) CMLib.database().DBUpdateMOBs(R); if (mob.session() != null) mob.session().rawPrint("."); R.getArea().setAreaState(oldFlags); } } if (mob.session() != null) mob.session().rawPrintln(L("!\n\rDone!")); Area A = null; for (int i = 0; i < placesToDo.size(); i++) { A = ((Room) placesToDo.get(i)).getArea(); if ((A != null) && (A.getAreaState() != Area.State.ACTIVE)) A.setAreaState(Area.State.ACTIVE); } return false; }
@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; }