@Override public void destroy() { try { CharStats savedCStats = charStats; if (charStats == baseCharStats) savedCStats = (CharStats) CMClass.getCommon("DefaultCharStats"); PhyStats savedPStats = phyStats; if (phyStats == basePhyStats) savedPStats = (PhyStats) CMClass.getCommon("DefaultPhyStats"); final CharState savedCState = curState; if ((curState == baseState) || (curState == maxState)) curState = (CharState) CMClass.getCommon("DefaultCharState"); super.destroy(); removeFromGame = false; charStats = savedCStats; phyStats = savedPStats; curState = savedCState; baseCharStats.reset(); basePhyStats.reset(); baseState.reset(); maxState.reset(); curState.reset(); phyStats.reset(); charStats.reset(); finalize(); } catch (final Throwable t) { Log.errOut(ID(), t); } }
public TimeClock globalClock() { if (globalClock == null) { globalClock = (TimeClock) CMClass.getCommon("DefaultTimeClock"); if (globalClock != null) globalClock.setLoadName("GLOBAL"); } return globalClock; }
@Override public boolean invoke( MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target = CMLib.players().getLoadPlayer(CMParms.combine(commands, 0)); if (target == null) target = getTargetAnywhere(mob, commands, givenTarget, false, true, false); if (target == null) return false; final Archon_Record A = (Archon_Record) target.fetchEffect(ID()); if (A != null) { target.delEffect(A); if (target.playerStats() != null) target.playerStats().setLastUpdated(0); mob.tell(L("@x1 will no longer be recorded.", target.Name())); return true; } 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, target, this, CMMsg.MASK_MOVE | CMMsg.TYP_JUSTICE | (auto ? CMMsg.MASK_ALWAYS : 0), L("^F<S-NAME> begin(s) recording <T-NAMESELF>.^?")); CMLib.color().fixSourceFightColor(msg); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); final String filename = "/" + target.Name() + System.currentTimeMillis() + ".log"; final CMFile file = new CMFile(filename, null, CMFile.FLAG_LOGERRORS); if (!file.canWrite()) { if (!CMSecurity.isASysOp(mob) || (CMSecurity.isASysOp(target))) Log.sysOut("Record", mob.Name() + " failed to start recording " + target.name() + "."); } else { if (!CMSecurity.isASysOp(mob) || (CMSecurity.isASysOp(target))) Log.sysOut( "Record", mob.Name() + " started recording " + target.name() + " to /" + filename + "."); final Archon_Record A2 = (Archon_Record) copyOf(); final Session F = (Session) CMClass.getCommon("FakeSession"); F.initializeSession(null, Thread.currentThread().getThreadGroup().getName(), filename); if (target.session() == null) target.setSession(F); A2.sess = F; target.addNonUninvokableEffect(A2); mob.tell(L("Enter RECORD @x1 again to stop recording.", target.Name())); } } } else return beneficialVisualFizzle( mob, target, L("<S-NAME> attempt(s) to hush <T-NAMESELF>, but fail(s).")); return success; }
public boolean execute(MOB mob, Vector commands, int metaFlags) throws java.io.IOException { String memberStr = (commands.size() > 1) ? (String) commands.get(commands.size() - 1) : ""; String clanName = (commands.size() > 2) ? CMParms.combine(commands, 1, commands.size() - 1) : ""; Clan C = null; boolean skipChecks = mob.getClanRole(mob.Name()) != null; if (skipChecks) C = mob.getClanRole(mob.Name()).first; if (C == null) for (Pair<Clan, Integer> c : mob.clans()) if ((clanName.length() == 0) || (CMLib.english().containsString(c.first.getName(), clanName)) && (c.first.getAuthority(c.second.intValue(), Clan.Function.EXILE) != Authority.CAN_NOT_DO)) { C = c.first; break; } commands.clear(); commands.addElement(getAccessWords()[0]); commands.addElement(memberStr); StringBuffer msg = new StringBuffer(""); boolean found = false; if (memberStr.length() > 0) { if (C == null) { mob.tell( "You aren't allowed to exile anyone from " + ((clanName.length() == 0) ? "anything" : clanName) + "."); return false; } if (skipChecks || CMLib.clans().goForward(mob, C, commands, Clan.Function.EXILE, false)) { List<MemberRecord> apps = C.getMemberList(); if (apps.size() < 1) { mob.tell("There are no members in your " + C.getGovernmentName() + "."); return false; } for (MemberRecord member : apps) { if (member.name.equalsIgnoreCase(memberStr)) { found = true; } } if (found) { MOB M = CMLib.players().getLoadPlayer(memberStr); if (M == null) { mob.tell( memberStr + " was not found. Could not exile from " + C.getGovernmentName() + "."); return false; } if (skipChecks || CMLib.clans().goForward(mob, C, commands, Clan.Function.EXILE, true)) { if (C.getGovernment().getExitScript().trim().length() > 0) { Pair<Clan, Integer> curClanRole = M.getClanRole(C.clanID()); if (curClanRole != null) M.setClan(C.clanID(), curClanRole.second.intValue()); ScriptingEngine S = (ScriptingEngine) CMClass.getCommon("DefaultScriptingEngine"); S.setSavable(false); S.setVarScope("*"); S.setScript(C.getGovernment().getExitScript()); CMMsg msg2 = CMClass.getMsg(M, M, null, CMMsg.MSG_OK_VISUAL, null, null, "CLANEXIT"); S.executeMsg(M, msg2); S.dequeResponses(); S.tick(M, Tickable.TICKID_MOB); } CMLib.clans() .clanAnnounce( mob, "Member exiled from " + C.getGovernmentName() + " " + C.name() + ": " + M.Name()); mob.tell( M.Name() + " has been exiled from " + C.getGovernmentName() + " '" + C.clanID() + "'."); if ((M.session() != null) && (M.session().mob() == M)) M.tell( "You have been exiled from " + C.getGovernmentName() + " '" + C.clanID() + "'."); C.delMember(M); return false; } } else { msg.append(memberStr + " isn't a member of your " + C.getGovernmentName() + "."); } } else { msg.append( "You aren't in the right position to exile anyone from your " + C.getGovernmentName() + "."); } } else { msg.append("You haven't specified which member you are exiling."); } mob.tell(msg.toString()); return false; }