@Override public boolean tick(Tickable ticking, int tickID) { if (!super.tick(ticking, tickID)) return false; if ((tickID == Tickable.TICKID_MOB) && (affected instanceof MOB)) { final MOB mob = (MOB) affected; if (!DATA.containsKey(mob)) DATA.put(mob, new int[DATA_TOTAL]); final int[] data = DATA.get(mob); if ((mob.session() != null) && (mob.session().getPreviousCMD() != null)) { if ((lastCommand != null) && (!CMParms.combine(mob.session().getPreviousCMD(), 0).equals(lastCommand))) { data[DATA_TYPEDCOMMAND]++; List<MOB> V = null; if (mob.session().getAddress() != null) V = IPS.get(mob.session().getAddress()); if (V != null) for (int v = 0; v < V.size(); v++) { final MOB M = V.get(v); if (M == mob) continue; if (M.session() == null) continue; if (!CMLib.flags().isInTheGame(M, true)) continue; final String hisLastCmd = CMParms.combine(mob.session().getPreviousCMD(), 0); final Archon_Multiwatch A = (Archon_Multiwatch) M.fetchEffect(ID()); if (A != null) { if ((A.lastCommand != null) && (!A.lastCommand.equals(hisLastCmd))) data[DATA_SYNCHROFOUND]++; break; } } } lastCommand = CMParms.combine(mob.session().getPreviousCMD(), 0); } } return true; }
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { if ((whom != null) && (song == null) && (msg.amISource(whom)) && (CMLib.flags().canBeSeenBy(whom, invoker()))) { if (trail == null) trail = new StringBuffer(""); ensureCmds(); if (cmds.containsKey("" + msg.sourceMinor())) trail.append(msg.sourceMinor() + ";"); } super.executeMsg(myHost, msg); }
public String runMacro(ExternalHTTPRequests httpReq, String parm) { Hashtable parms = parseParms(parm); String journalName = httpReq.getRequestParameter("JOURNAL"); if (journalName == null) return " @break@"; if (CMLib.journals().isArchonJournalName(journalName)) { MOB M = Authenticate.getAuthenticatedMob(httpReq); if ((M == null) || (!CMSecurity.isASysOp(M))) return " @break@"; } String srch = httpReq.getRequestParameter("JOURNALMESSAGESEARCH"); if (srch != null) srch = srch.toLowerCase(); String last = httpReq.getRequestParameter("JOURNALMESSAGE"); int cardinal = CMath.s_int(httpReq.getRequestParameter("JOURNALCARDINAL")); if (parms.containsKey("RESET")) { if (last != null) { httpReq.removeRequestParameter("JOURNALMESSAGE"); httpReq.removeRequestParameter("JOURNALCARDINAL"); } return ""; } MOB M = Authenticate.getAuthenticatedMob(httpReq); cardinal++; JournalsLibrary.JournalEntry entry = null; List<JournalsLibrary.JournalEntry> msgs = JournalInfo.getMessages(httpReq, journalName); while ((entry == null) || (!CMLib.journals().canReadMessage(entry, srch, M, parms.contains("NOPRIV")))) { entry = JournalInfo.getNextEntry(msgs, last); if (entry == null) { httpReq.addRequestParameters("JOURNALMESSAGE", ""); if (parms.containsKey("EMPTYOK")) return "<!--EMPTY-->"; return " @break@"; } last = entry.key; } entry.cardinal = cardinal; httpReq.addRequestParameters("JOURNALCARDINAL", "" + cardinal); httpReq.addRequestParameters("JOURNALMESSAGE", last); return ""; }
@Override public void executeMsg(Environmental host, CMMsg msg) { super.executeMsg(host, msg); if ((affected instanceof MOB) && (msg.amISource((MOB) affected))) { if (!DATA.containsKey(msg.source())) DATA.put(msg.source(), new int[DATA_TOTAL]); final int[] data = DATA.get(msg.source()); if (data == null) return; if (msg.tool() instanceof Social) { if (nonIPnonMonsterWithMe(msg.source())) data[DATA_GOODSOCIAL]++; if ((msg.target() instanceof MOB) && (!((MOB) msg.target()).isMonster())) data[DATA_DIRSOCIAL]++; data[DATA_ANYSOCIAL]++; } else switch (msg.sourceMinor()) { case CMMsg.TYP_SPEAK: if ((msg.othersMessage() != null) && (msg.sourceMessage() != null) && (msg.othersMinor() == msg.sourceMinor()) && (msg.source().location() != null) && (msg.source().session() != null)) { if (msg.sourceMessage().indexOf("order(s)") > 0) { if ((msg.target() instanceof MOB) && (((MOB) msg.target()).session() != null) && (((MOB) msg.target()) .session() .getAddress() .equals(msg.source().session().getAddress()))) data[DATA_ORDER]++; } else { if (nonIPnonMonsterWithMe(msg.source())) data[DATA_GOODSPEECH]++; if ((msg.target() instanceof MOB) && (!((MOB) msg.target()).isMonster())) data[DATA_DIRSPEECH]++; data[DATA_ANYSPEECH]++; } } break; } } }
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, "\"", """) + "\"><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 ""; }