<NME> Stat.java
<BEF> package com.planet_ink.coffee_mud.Commands;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.PlayerStats.PlayerCombatStat;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;

import java.io.IOException;
import java.util.*;
import java.util.concurrent.TimeUnit;

/*
   Copyright 2004-2022 Bo Zimmerman

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

	   http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
public class Stat  extends Skills
{
	public Stat()
	{
	}

	private final String[] access=I(new String[]{"STAT"});
	@Override
	public String[] getAccessWords()
	{
		return access;
	}

	public static final int	ABLETYPE_EQUIPMENT		= -2;
	public static final int	ABLETYPE_INVENTORY		= -3;
	public static final int	ABLETYPE_QUESTWINS		= -4;
	public static final int	ABLETYPE_TATTOOS		= -5;
	public static final int	ABLETYPE_COMBAT			= -6;
	public static final int	ABLETYPE_SCRIPTS		= -7;
	public static final int	ABLETYPE_TITLES			= -8;
	public static final int	ABLETYPE_ROOMSEXPLORED	= -9;
	public static final int	ABLETYPE_AREASEXPLORED	= -10;
	public static final int	ABLETYPE_WORLDEXPLORED	= -11;
	public static final int	ABLETYPE_FACTIONS		= -12;
	public static final int	ABLETYPE_CHARSTATS		= -13;
	public static final int	ABLETYPE_LEVELTIMES		= -14;
	public static final int	ABLETYPE_AFFECTS		= -15;

	public static final String[][] ABLETYPE_DESCS={
		{"EQUIPMENT","EQ","EQUIP"},
		{"INVENTORY","INVEN","INV"},
		{"QUESTWINS","QUESTS","QUEST","QUESTWIN"},
		{"TATTOOS","TATTOO","TATT"},
		{"COMBAT"},
		{"SCRIPTS"},
		{"TITLES","TITLE"},
		{"ROOMSEXPLORED"},
		{"AREASEXPLORED"},
		{"WORLDEXPLORED"},
		{"FACTIONS","FACTION"},
		{"CHARSTATISTICS","CSTAT","CHARSTATS"},
		{"LEVELTIMES","LVLS"},
		{"AFFECTS","EFFECTS","EFF"},
	};

	public MOB getTarget(final MOB mob, final String targetName, final boolean quiet)
	{
		MOB target=null;
		if(targetName.length()>0)
		{
			target=mob.location().fetchInhabitant(targetName);
			if(target==null)
			{
				final Environmental t=mob.location().fetchFromRoomFavorItems(null,targetName);
				if((t!=null)&&(!(t instanceof MOB)))
				{
					if(!quiet)
						mob.tell(mob,t,null,L("You can't do that to <T-NAMESELF>."));
					return null;
				}
			}
		}
		return target;
	}

	public String doSenses(final int senseMask)
	{
		final StringBuilder str=new StringBuilder("");
		for(int i=0;i<PhyStats.CAN_SEE_DESCS.length;i++)
		{
			if(CMath.isSet(senseMask, i))
				str.append(PhyStats.CAN_SEE_DESCS[i].replace(' ','_')).append(" ");
		}
		if(str.length()==0)
			str.append("NONE ");
		return str.toString().trim();
	}

	public String doDisposition(final int dispositionMask)
	{
		final StringBuilder str=new StringBuilder("");
		for(int i=0;i<PhyStats.IS_DESCS.length;i++)
		{
			if(CMath.isSet(dispositionMask, i))
				str.append(PhyStats.IS_DESCS[i].replace(' ','_')).append(" ");
		}
		if(str.length()==0)
			str.append("NONE ");
		return str.toString().trim();
	}

	public boolean showTableStats(final MOB mob, final int days, final int scale, String rest)
	{
		final Calendar ENDQ=Calendar.getInstance();
		ENDQ.add(Calendar.DATE,-days);
		ENDQ.set(Calendar.HOUR_OF_DAY,23);
		ENDQ.set(Calendar.MINUTE,59);
		ENDQ.set(Calendar.SECOND,59);
		ENDQ.set(Calendar.MILLISECOND,999);
		CMLib.coffeeTables().update();
		final List<CoffeeTableRow> V=CMLib.coffeeTables().readRawStats(ENDQ.getTimeInMillis()-1,0);
		if (V.size() == 0)
		{
			mob.tell(L("No Stats?!"));
			return false;
		}
		final StringBuffer table=new StringBuffer("");
		boolean skillUse=false;
		boolean socUse=false;
		boolean cmdUse=false;
		boolean questStats=false;
		boolean crimeStats=false;
		boolean areaStats=false;
		boolean players=false;
		if(rest.toUpperCase().trim().startsWith("SKILLUSE"))
		{
			skillUse=true;
			final int x=rest.indexOf(' ');
			if(x>0)
				rest=rest.substring(x+1).trim();
			else
				rest="";
		}
		if(rest.toUpperCase().trim().startsWith("SOCUSE"))
		{
			socUse=true;
			final int x=rest.indexOf(' ');
			if(x>0)
				rest=rest.substring(x+1).trim();
			else
				rest="";
		}
		if(rest.toUpperCase().trim().startsWith("CMDUSE"))
		{
			cmdUse=true;
			final int x=rest.indexOf(' ');
			if(x>0)
				rest=rest.substring(x+1).trim();
			else
				rest="";
		}
		if(rest.toUpperCase().trim().startsWith("QUEST"))
		{
			questStats=true;
			final int x=rest.indexOf(' ');
			if(x>0)
				rest=rest.substring(x+1).trim();
			else
				rest="";
		}
		if(rest.toUpperCase().trim().startsWith("CRIME"))
		{
			crimeStats=true;
			final int x=rest.indexOf(' ');
			if(x>0)
				rest=rest.substring(x+1).trim();
			else
				rest="";
		}
		if(rest.toUpperCase().trim().startsWith("AREA"))
		{
			areaStats=true;
			final int x=rest.indexOf(' ');
			if(x>0)
				rest=rest.substring(x+1).trim();
			else
				rest="";
		}
		if(rest.toUpperCase().trim().startsWith("PLAY"))
		{
			players=true;
			final int x=rest.indexOf(' ');
			if(x>0)
				rest=rest.substring(x+1).trim();
			else
				rest="";
		}
		table.append("^xStatistics since "+CMLib.time().date2String(ENDQ.getTimeInMillis())+":^.^N\n\r\n\r");
		if(skillUse)
			table.append(CMStrings.padRight(L("Skill"),25)+CMStrings.padRight(L("Uses"),10)+CMStrings.padRight(L("Skill"),25)+CMStrings.padRight(L("Uses"),10)+"\n\r");
		else
		if(socUse)
			table.append(CMStrings.padRight(L("Social"),25)+CMStrings.padRight(L("Uses"),10)+CMStrings.padRight(L("Social"),25)+CMStrings.padRight(L("Uses"),10)+"\n\r");
		else
		if(cmdUse)
			table.append(CMStrings.padRight(L("Command"),25)+CMStrings.padRight(L("Uses"),10)+CMStrings.padRight(L("Command"),25)+CMStrings.padRight(L("Uses"),10)+"\n\r");
		else
		if(questStats)
		{
			table.append(CMStrings.padRight(L("Quest"),30)
	   					+CMStrings.padRight(L("STRT"),5)
						+CMStrings.padRight(L("TSRT"),5)
						+CMStrings.padRight(L("FLST"),5)
						+CMStrings.padRight(L("ACPT"),5)
						+CMStrings.padRight(L("WINS"),5)
						+CMStrings.padRight(L("FAIL"),5)
						+CMStrings.padRight(L("DROP"),5)
						+CMStrings.padRight(L("TSTP"),5)
						+CMStrings.padRight(L("STOP"),5)
						+"\n\r");
		}
		else
		if(crimeStats)
		{
			table.append(CMStrings.padRight(L("Date"),25)
						+CMStrings.padRight(L("Warrants"),10)
	   					+CMStrings.padRight(L("Arrests"),10)
						+CMStrings.padRight(L("Paroles"),10)
						+CMStrings.padRight(L("Jailings"),10)
						+CMStrings.padRight(L("Executions"),10)
						+"\n\r");
		}
		else
		if(areaStats)
		{
			table.append(CMStrings.padRight(L("Area"),25)
						 +CMStrings.padRight(L("CONs"),5)
						 +CMStrings.padRight(L("HIGH"),5)
						 +CMStrings.padRight(L("ONLN"),5)
						 +CMStrings.padRight(L("AVGM"),5)
						 +CMStrings.padRight(L("NEWB"),5)
						 +CMStrings.padRight(L("DTHs"),5)
						 +CMStrings.padRight(L("PKDs"),5)
						 +CMStrings.padRight(L("CLAS"),5)
						 +CMStrings.padRight(L("PURG"),5)
						 +CMStrings.padRight(L("MARR"),5)+"\n\r");
		}
		else
			table.append(CMStrings.padRight(L("Date"),25)
						 +CMStrings.padRight(L("CONs"),5)
						 +CMStrings.padRight(L("HIGH"),5)
						 +CMStrings.padRight(L("ONLN"),5)
						 +CMStrings.padRight(L("AVGM"),5)
						 +CMStrings.padRight(L("NEWB"),5)
						 +CMStrings.padRight(L("DTHs"),5)
						 +CMStrings.padRight(L("PKDs"),5)
						 +CMStrings.padRight(L("CLAS"),5)
						 +CMStrings.padRight(L("PURG"),5)
						 +CMStrings.padRight(L("MARR"),5)+"\n\r");
		table.append(CMStrings.repeat('-',75)+"\n\r");
		final Calendar C=Calendar.getInstance();
		C.set(Calendar.HOUR_OF_DAY,23);
		C.set(Calendar.MINUTE,59);
		C.set(Calendar.SECOND,59);
		C.set(Calendar.MILLISECOND,999);
		long curTime=C.getTimeInMillis();
		String code="*";
		if(rest.length()>0)
			code=""+rest.toUpperCase().charAt(0);
		long lastCur=System.currentTimeMillis();
		if(skillUse)
		{
			final CharClass CharC=CMClass.getCharClass(rest);
			final ArrayList<Ability> allSkills=new ArrayList<Ability>();
			for(final Enumeration<Ability> e=CMClass.abilities();e.hasMoreElements();)
				allSkills.add(e.nextElement());
			final long[][] totals=new long[allSkills.size()][CoffeeTableRow.STAT_TOTAL];
			while((V.size()>0)&&(curTime>(ENDQ.getTimeInMillis())))
			{
				lastCur=curTime;
				final Calendar C2=Calendar.getInstance();
				C2.setTimeInMillis(curTime);
				C2.add(Calendar.DATE,-(scale));
				curTime=C2.getTimeInMillis();
				C2.set(Calendar.HOUR_OF_DAY,23);
				C2.set(Calendar.MINUTE,59);
				C2.set(Calendar.SECOND,59);
				C2.set(Calendar.MILLISECOND,999);
				curTime=C2.getTimeInMillis();
				final ArrayList<CoffeeTableRow> set=new ArrayList<CoffeeTableRow>();
				for(int v=V.size()-1;v>=0;v--)
				{
					final CoffeeTableRow T=V.get(v);
					if((T.startTime()>curTime)&&(T.endTime()<=lastCur))
					{
						set.add(T);
						V.remove(v);
					}
				}
				for(int s=0;s<set.size();s++)
				{
					final CoffeeTableRow T=set.get(s);
					for(int x=0;x<allSkills.size();x++)
						T.totalUp("A"+allSkills.get(x).ID().toUpperCase(),totals[x]);
				}
				if(scale==0)
					break;
			}
			boolean cr=false;
			for(int x=0;x<allSkills.size();x++)
			{
				Ability A=allSkills.get(x);
				if((CharC!=null)&&(CMLib.ableMapper().getQualifyingLevel(CharC.ID(),true,A.ID())<0))
					continue;
				if(totals[x][CoffeeTableRow.STAT_SKILLUSE]>0)
				{
					table.append(CMStrings.padRight(""+A.ID(),25)
							+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_SKILLUSE],10));
					if(cr)
						table.append("\n\r");
					cr=!cr;
				}
				x++;
				if(x<allSkills.size())
				{
					A=allSkills.get(x);
					if(totals[x][CoffeeTableRow.STAT_SKILLUSE]>0)
					{

						table.append(CMStrings.padRight(""+A.ID(),25)
								+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_SKILLUSE],10));
						if(cr)
							table.append("\n\r");
						cr=!cr;
					}
				}
			}
			if(cr)
				table.append("\n\r");
		}
		else
		if(socUse)
		{
			final ArrayList<Social> allSocials=new ArrayList<Social>();
			for(final Enumeration<Social> e=CMLib.socials().getAllSocials();e.hasMoreElements();)
				allSocials.add(e.nextElement());
			final long[][] totals=new long[allSocials.size()][CoffeeTableRow.STAT_TOTAL];
			while((V.size()>0)&&(curTime>(ENDQ.getTimeInMillis())))
			{
				lastCur=curTime;
				final Calendar C2=Calendar.getInstance();
				C2.setTimeInMillis(curTime);
				C2.add(Calendar.DATE,-(scale));
				curTime=C2.getTimeInMillis();
				C2.set(Calendar.HOUR_OF_DAY,23);
				C2.set(Calendar.MINUTE,59);
				C2.set(Calendar.SECOND,59);
				C2.set(Calendar.MILLISECOND,999);
				curTime=C2.getTimeInMillis();
				final ArrayList<CoffeeTableRow> set=new ArrayList<CoffeeTableRow>();
				for(int v=V.size()-1;v>=0;v--)
				{
					final CoffeeTableRow T=V.get(v);
					if((T.startTime()>curTime)&&(T.endTime()<=lastCur))
					{
						set.add(T);
						V.remove(v);
					}
				}
				for(int s=0;s<set.size();s++)
				{
					final CoffeeTableRow T=set.get(s);
					for(int x=0;x<allSocials.size();x++)
						T.totalUp("S"+allSocials.get(x).baseName().toUpperCase(),totals[x]);
				}
				if(scale==0)
					break;
			}
			boolean cr=false;
			for(int x=0;x<allSocials.size();x++)
			{
				Social S=allSocials.get(x);
				if(totals[x][CoffeeTableRow.STAT_SKILLUSE]>0)
				{
					table.append(CMStrings.padRight(""+S.baseName(),25)
							+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_SOCUSE],10));
					if(cr)
						table.append("\n\r");
					cr=!cr;
				}
				x++;
				if(x<allSocials.size())
				{
					S=allSocials.get(x);
					if(totals[x][CoffeeTableRow.STAT_SOCUSE]>0)
					{

						table.append(CMStrings.padRight(""+S.baseName(),25)
								+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_SOCUSE],10));
						if(cr)
							table.append("\n\r");
						cr=!cr;
					}
				}
			}
			if(cr)
				table.append("\n\r");
		}
		else
		if(cmdUse)
		{
			final ArrayList<Command> allCommands=new ArrayList<Command>();
			for(final Enumeration<Command> e=CMClass.commands();e.hasMoreElements();)
				allCommands.add(e.nextElement());
			final long[][] totals=new long[allCommands.size()][CoffeeTableRow.STAT_TOTAL];
			while((V.size()>0)&&(curTime>(ENDQ.getTimeInMillis())))
			{
				lastCur=curTime;
				final Calendar C2=Calendar.getInstance();
				C2.setTimeInMillis(curTime);
				C2.add(Calendar.DATE,-(scale));
				curTime=C2.getTimeInMillis();
				C2.set(Calendar.HOUR_OF_DAY,23);
				C2.set(Calendar.MINUTE,59);
				C2.set(Calendar.SECOND,59);
				C2.set(Calendar.MILLISECOND,999);
				curTime=C2.getTimeInMillis();
				final ArrayList<CoffeeTableRow> set=new ArrayList<CoffeeTableRow>();
				for(int v=V.size()-1;v>=0;v--)
				{
					final CoffeeTableRow T=V.get(v);
					if((T.startTime()>curTime)&&(T.endTime()<=lastCur))
					{
						set.add(T);
						V.remove(v);
					}
				}
				for(int s=0;s<set.size();s++)
				{
					final CoffeeTableRow T=set.get(s);
					for(int x=0;x<allCommands.size();x++)
						T.totalUp("M"+allCommands.get(x).ID().toUpperCase(),totals[x]);
				}
				if(scale==0)
					break;
			}
			boolean cr=false;
			for(int x=0;x<allCommands.size();x++)
			{
				Command M=allCommands.get(x);
				if(totals[x][CoffeeTableRow.STAT_CMDUSE]>0)
				{
					table.append(CMStrings.padRight(""+M.ID(),25)
							+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_CMDUSE],10));
					if(cr)
						table.append("\n\r");
					cr=!cr;
				}
				x++;
				if(x<allCommands.size())
				{
					M=allCommands.get(x);
					if(totals[x][CoffeeTableRow.STAT_CMDUSE]>0)
					{

						table.append(CMStrings.padRight(""+M.ID(),25)
								+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_CMDUSE],10));
						if(cr)
							table.append("\n\r");
						cr=!cr;
					}
				}
			}
			if(cr)
				table.append("\n\r");
		}
		else
		if(questStats)
		{
			final List<Quest> sortedQuests=new XVector<Quest>(CMLib.quests().enumQuests());
			Collections.sort(sortedQuests,new Comparator<Quest>()
			{
				@Override
				public int compare(final Quest o1, final Quest o2)
				{
					return o1.name().toLowerCase().compareTo(o2.name().toLowerCase());
				}
			});
			final long[][] totals=new long[sortedQuests.size()][CoffeeTableRow.STAT_TOTAL];
			while((V.size()>0)&&(curTime>(ENDQ.getTimeInMillis())))
			{
				lastCur=curTime;
				final Calendar C2=Calendar.getInstance();
				C2.setTimeInMillis(curTime);
				C2.add(Calendar.DATE,-(scale));
				curTime=C2.getTimeInMillis();
				C2.set(Calendar.HOUR_OF_DAY,23);
				C2.set(Calendar.MINUTE,59);
				C2.set(Calendar.SECOND,59);
				C2.set(Calendar.MILLISECOND,999);
				curTime=C2.getTimeInMillis();
				final ArrayList<CoffeeTableRow> set=new ArrayList<CoffeeTableRow>();
				for(int v=V.size()-1;v>=0;v--)
				{
					final CoffeeTableRow T=V.get(v);
					if((T.startTime()>curTime)&&(T.endTime()<=lastCur))
					{
						set.add(T);
						V.remove(v);
					}
				}
				if(set.size()==0)
				{
					set.addAll(V);
					V.clear();
				}
				for(int s=0;s<set.size();s++)
				{
					final CoffeeTableRow T=set.get(s);
					for(int x=0;x<sortedQuests.size();x++)
						T.totalUp("U"+T.tagFix(sortedQuests.get(x).name()),totals[x]);
				}
				if(scale==0)
					break;
			}
			for(int x=0;x<sortedQuests.size();x++)
			{
				final Quest Q=sortedQuests.get(x);
				table.append(
						 CMStrings.padRight(Q.name(),30)
						+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_QUESTSTARTATTEMPT],5)
						+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_QUESTTIMESTART],5)
						+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_QUESTFAILEDSTART],5)
						+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_QUESTACCEPTED],5)
						+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_QUESTSUCCESS],5)
						+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_QUESTFAILED],5)
						+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_QUESTDROPPED],5)
						+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_QUESTTIMESTOP],5)
						+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_QUESTSTOP],5));
				table.append("\n\r");
			}
			table.append("\n\r");
		}
		else
		if(crimeStats)
		{
			while((V.size()>0)&&(curTime>(ENDQ.getTimeInMillis())))
			{
				lastCur=curTime;
				final Calendar C2=Calendar.getInstance();
				C2.setTimeInMillis(curTime);
				C2.add(Calendar.DATE,-(scale));
				curTime=C2.getTimeInMillis();
				C2.set(Calendar.HOUR_OF_DAY,23);
				C2.set(Calendar.MINUTE,59);
				C2.set(Calendar.SECOND,59);
				C2.set(Calendar.MILLISECOND,999);
				curTime=C2.getTimeInMillis();
				final ArrayList<CoffeeTableRow> set=new ArrayList<CoffeeTableRow>();
				for(int v=V.size()-1;v>=0;v--)
				{
					final CoffeeTableRow T=V.get(v);
					if((T.startTime()>curTime)&&(T.endTime()<=lastCur))
					{
						set.add(T);
						V.remove(v);
					}
				}
				final long[] totals=new long[CoffeeTableRow.STAT_TOTAL];
				long highestCOnline=0;
				long numberCOnlineTotal=0;
				long highestPOnline=0;
				long numberPOnlineTotal=0;
				long numberOnlineCounter=0;
				for(int s=0;s<set.size();s++)
				{
					final CoffeeTableRow T=set.get(s);
					T.totalUp(code,totals);
					if(T.highestCharsOnline()>highestCOnline)
						highestCOnline=T.highestCharsOnline();
					numberCOnlineTotal+=T.numberCharsOnlineTotal();
					if(T.highestOnline()>highestPOnline)
						highestPOnline=T.highestOnline();
					numberPOnlineTotal+=T.numberOnlineTotal();
					numberOnlineCounter+=T.numberOnlineCounter();
				}
				if(players)
				{
					highestCOnline=highestPOnline;
					numberCOnlineTotal=numberPOnlineTotal;
				}
				totals[CoffeeTableRow.STAT_TICKSONLINE]=(totals[CoffeeTableRow.STAT_TICKSONLINE]*CMProps.getTickMillis())/scale/(1000*60);
				double avgOnline=(numberOnlineCounter>0)?CMath.div(numberCOnlineTotal,numberOnlineCounter):0.0;
				avgOnline=CMath.div(Math.round(avgOnline*10.0),10.0);
				table.append(CMStrings.padRight(CMLib.time().date2DateString(curTime+1)+" - "+CMLib.time().date2DateString(lastCur-1),25)
							 +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_WARRANTS],10)
							 +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_ARRESTS],10)
							 +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_PAROLES],10)
							 +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_JAILINGS],10)
							 +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_EXECUTIONS],10)+"\n\r");
				if(scale==0)
					break;
			}
			table.append("\n\r");
		}
		else
		if(areaStats)
		{
			lastCur=ENDQ.getTimeInMillis();
			final ArrayList<CoffeeTableRow> set=new ArrayList<CoffeeTableRow>();
			for(int v=V.size()-1;v>=0;v--)
			{
				final CoffeeTableRow T=V.get(v);
				if((T.startTime()>lastCur)&&(T.endTime()<=curTime))
				{
					set.add(T);
					V.remove(v);
				}
			}
			for(final Enumeration<Area> a=CMLib.map().areas();a.hasMoreElements();)
			{
				final Area A=a.nextElement();
				if(CMLib.flags().canAccess(mob,A)&&(!CMath.bset(A.flags(),Area.FLAG_INSTANCE_CHILD))&&(!(A instanceof SpaceObject)))
				{
					code = "X"+A.Name().toUpperCase().replace(' ','_');
					final long[] totals=new long[CoffeeTableRow.STAT_TOTAL];
					long highestCOnline=0;
					long numberCOnlineTotal=0;
					long highestPOnline=0;
					long numberPOnlineTotal=0;
					long numberOnlineCounter=0;
					for(int s=0;s<set.size();s++)
					{
						final CoffeeTableRow T=set.get(s);
						T.totalUp(code,totals);
						if(T.highestCharsOnline()>highestCOnline)
							highestCOnline=T.highestCharsOnline();
						numberCOnlineTotal+=T.numberCharsOnlineTotal();
						if(T.highestOnline()>highestPOnline)
							highestPOnline=T.highestOnline();
						numberPOnlineTotal+=T.numberOnlineTotal();
						numberOnlineCounter+=T.numberOnlineCounter();
					}
					if(players)
					{
						highestCOnline=highestPOnline;
						numberCOnlineTotal=numberPOnlineTotal;
					}
					double avgOnline=(numberOnlineCounter>0)?CMath.div(numberCOnlineTotal,numberOnlineCounter):0.0;
					avgOnline=CMath.div(Math.round(avgOnline*10.0),10.0);
					totals[CoffeeTableRow.STAT_TICKSONLINE]=(totals[CoffeeTableRow.STAT_TICKSONLINE]*CMProps.getTickMillis())/scale/(1000*60);
					table.append(CMStrings.padRight(A.Name(),25)
								 +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_LOGINS],5)
								 +CMStrings.centerPreserve(""+highestCOnline,5)
								 +CMStrings.centerPreserve(""+avgOnline,5)
								 +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_TICKSONLINE],5)
								 +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_NEWPLAYERS],5)
								 +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_DEATHS],5)
								 +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_PKDEATHS],5)
								 +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_CLASSCHANGE],5)
								 +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_PURGES],5)
								 +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_MARRIAGES],5)+"\n\r");
				}
			}
		}
		else
		{
			while((V.size()>0)&&(curTime>(ENDQ.getTimeInMillis())))
			{
				lastCur=curTime;
				final Calendar C2=Calendar.getInstance();
				C2.setTimeInMillis(curTime);
				C2.add(Calendar.DATE,-(scale));
				curTime=C2.getTimeInMillis();
				C2.set(Calendar.HOUR_OF_DAY,23);
				C2.set(Calendar.MINUTE,59);
				C2.set(Calendar.SECOND,59);
				C2.set(Calendar.MILLISECOND,999);
				curTime=C2.getTimeInMillis();
				final ArrayList<CoffeeTableRow> set=new ArrayList<CoffeeTableRow>();
				for(int v=V.size()-1;v>=0;v--)
				{
					final CoffeeTableRow T=V.get(v);
					if((T.startTime()>curTime)&&(T.endTime()<=lastCur))
					{
						set.add(T);
						V.remove(v);
					}
				}
				final long[] totals=new long[CoffeeTableRow.STAT_TOTAL];
				long highestCOnline=0;
				long numberCOnlineTotal=0;
				long highestPOnline=0;
				long numberPOnlineTotal=0;
				long numberOnlineCounter=0;
				for(int s=0;s<set.size();s++)
				{
					final CoffeeTableRow T=set.get(s);
					T.totalUp(code,totals);
					if(T.highestCharsOnline()>highestCOnline)
						highestCOnline=T.highestCharsOnline();
					numberCOnlineTotal+=T.numberCharsOnlineTotal();
					if(T.highestOnline()>highestPOnline)
						highestPOnline=T.highestOnline();
					numberPOnlineTotal+=T.numberOnlineTotal();
					numberOnlineCounter+=T.numberOnlineCounter();
				}
				if(players)
				{
					highestCOnline=highestPOnline;
					numberCOnlineTotal=numberPOnlineTotal;
				}
				double avgOnline=(numberOnlineCounter>0)?CMath.div(numberCOnlineTotal,numberOnlineCounter):0.0;
				avgOnline=CMath.div(Math.round(avgOnline*10.0),10.0);
				totals[CoffeeTableRow.STAT_TICKSONLINE]=(totals[CoffeeTableRow.STAT_TICKSONLINE]*CMProps.getTickMillis())/scale/(1000*60);
				table.append(CMStrings.padRight(CMLib.time().date2DateString(curTime+1)+" - "+CMLib.time().date2DateString(lastCur-1),25)
							 +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_LOGINS],5)
							 +CMStrings.centerPreserve(""+highestCOnline,5)
							 +CMStrings.centerPreserve(""+avgOnline,5)
							 +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_TICKSONLINE],5)
							 +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_NEWPLAYERS],5)
							 +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_DEATHS],5)
							 +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_PKDEATHS],5)
							 +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_CLASSCHANGE],5)
							 +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_PURGES],5)
							 +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_MARRIAGES],5)+"\n\r");
				if(scale==0)
					break;
			}
		}
		mob.tell(table.toString());
		return false;
	}

	public int averageDamage(final MOB M)
	{
		double total=0;
		final double num=5000;
		for(int i=0;i<num;i++)
		{
			total+=CMLib.combat().adjustedDamage(M,null,null,0,true, false);
		}
		return (int)Math.round(Math.floor(total / num));
	}

	protected void addCharStatsChars(final CharStats cstats, final int headerWidth, final int numberWidth, final int[] col, final StringBuilder str)
	{
		for(int i=0;i<cstats.getStatCodes().length;i++)
		{
			str.append("^g"+CMStrings.padRight(cstats.getStatCodes()[i]+"^w", headerWidth));
			str.append(" ");
			str.append(CMStrings.padRight(""+cstats.getStat(cstats.getStatCodes()[i]), numberWidth));
			col[0]++;
			if(col[0]==4)
				str.append("\n\r");
		}
	}

	protected void addCharThing(final int headerWidth, final int numberWidth, final int[] col, final StringBuilder str, final String title, final String val)
	{
		str.append("^y"+CMStrings.padRight(title+"^w", headerWidth));
		str.append(" ");
		str.append(CMStrings.padRight(""+val, numberWidth));
		col[0]++;
		if(col[0]==4)
			str.append("\n\r");
	}

	protected void addCharStatsState(final CharState cstats, final int headerWidth, final int numberWidth, final int[] col, final StringBuilder str)
	{
		for(int i=0;i<cstats.getStatCodes().length;i++)
		{
			str.append("^y"+CMStrings.padRight(cstats.getStatCodes()[i]+"^w", headerWidth));
			str.append(" ");
			str.append(CMStrings.padRight(""+cstats.getStat(cstats.getStatCodes()[i]), numberWidth));
			col[0]++;
			if(col[0]==4)
				str.append("\n\r");
		}
	}

	protected MOB getMOBTarget(final MOB mob, final String MOBname)
	{
		MOB target=getTarget(mob,MOBname,true);
		if(target==null)
			target=CMLib.players().getLoadPlayer(MOBname);
		if(target==null)
		{
			try
			{
				final List<MOB> inhabs=CMLib.map().findInhabitantsFavorExact(mob.location().getArea().getProperMap(), mob,MOBname,false,100);
				if(inhabs.size()==0)
					inhabs.addAll(CMLib.map().findInhabitantsFavorExact(CMLib.map().rooms(), mob,MOBname,false,100));
				for(final MOB mob2 : inhabs)
				{
					final Room R=mob2.location();
					if(CMSecurity.isAllowed(mob,R,CMSecurity.SecFlag.STAT))
					{
						target=mob2;
						break;
					}
				}
			}
			catch (final NoSuchElementException nse)
			{
			}
		}
		return target;
	}

	protected Item getItemTarget(final MOB mob, final String itemName)
	{
		Item target=null;
		//if(target == null)
			target=mob.findItem(itemName);
		if(target == null)
			target=mob.location().findItem(itemName);
		if(target==null)
		{
			try
			{
				final List<Item> items=CMLib.map().findRoomItems(mob.location().getArea().getProperMap(), mob,itemName,true,100);
				if(items.size()==0)
					items.addAll(CMLib.map().findRoomItems(CMLib.map().rooms(), mob,itemName,true,100));
				for(final Item item2 : items)
				{
					final Room R=CMLib.map().roomLocation(item2);
					if(CMSecurity.isAllowed(mob,R,CMSecurity.SecFlag.STAT))
					{
						target=item2;
						break;
					}
				}
			}
			catch (final NoSuchElementException nse)
			{
			}
		}
		if(target==null)
		{
			try
			{
				final List<Item> items=CMLib.map().findInventory(mob.location().getArea().getProperMap(), mob,itemName,100);
				if(items.size()==0)
					items.addAll(CMLib.map().findInventory(CMLib.map().rooms(), mob,itemName,100));
				for(final Item item2 : items)
				{
					final Room R=CMLib.map().roomLocation(item2);
					if(CMSecurity.isAllowed(mob,R,CMSecurity.SecFlag.STAT))
					{
						target=item2;
						break;
					}
				}
			}
			catch (final NoSuchElementException nse)
			{
			}
		}
		return target;
	}

	protected void addCharStatsPhys(final PhyStats pstats, final int headerWidth, final int numberWidth, final int[] col, final StringBuilder str)
	{
		for(int i=0;i<pstats.getStatCodes().length;i++)
		{
			str.append("^c"+CMStrings.padRight(pstats.getStatCodes()[i]+"^w", headerWidth));
			str.append(" ");
			str.append(CMStrings.padRight(""+pstats.getStat(pstats.getStatCodes()[i]), numberWidth));
			col[0]++;
			if(col[0]==4)
				str.append("\n\r");
		}
		for(int i=0;i<PhyStats.CAN_SEE_CODES.length;i++)
		{
			str.append("^c"+CMStrings.padRight(PhyStats.CAN_SEE_CODES[i]+"^w", headerWidth));
			str.append(" ");
			str.append(CMStrings.padRight(""+CMath.isSet(pstats.sensesMask(), i), numberWidth));
			col[0]++;
			if(col[0]==4)
				str.append("\n\r");
		}
		for(int i=0;i<PhyStats.IS_CODES.length;i++)
		{
			str.append("^c"+CMStrings.padRight(PhyStats.IS_CODES[i]+"^w", headerWidth));
			str.append(" ");
			str.append(CMStrings.padRight(""+CMath.isSet(pstats.disposition(), i), numberWidth));
			col[0]++;
			if(col[0]==4)
				str.append("\n\r");
		}
	}

	protected String getPrivilegedStat(final MOB mob, MOB target, final List<String> commands, final boolean overrideAuthCheck) throws IOException
	{
		StringBuilder str=new StringBuilder("");
		int ableTypes=-1;
		if(commands.size()>1)
		{
			final String s=commands.get(0).toUpperCase();
			for(int i=0;i<ABLETYPE_DESCS.length;i++)
			{
				for(int is=0;is<ABLETYPE_DESCS[i].length;is++)
				{
					if(s.equals(ABLETYPE_DESCS[i][is]))
					{
						ableTypes=-2 -i;
						commands.remove(0);
						break;
					}
				}
			}
			if(ableTypes==-1)
			{
				for(int a=0;a<Ability.ACODE_DESCS.length;a++)
				{
					if((Ability.ACODE_DESCS[a]+"S").equals(s)||(Ability.ACODE_DESCS[a]).equals(s))
					{
						ableTypes=a;
						commands.remove(0);
						break;
					}
				}
			}
		}
		final String MOBname=CMParms.combine(commands,0);
		if(target == null)
			target=getMOBTarget(mob,MOBname);
		if((target!=null)
		&&(((target.isMonster())&&(CMSecurity.isAllowed(mob, target.location(), CMSecurity.SecFlag.CMDMOBS)))
			||(overrideAuthCheck)
			||((target.isPlayer())&&(CMSecurity.isAllowed(mob, target.location(), CMSecurity.SecFlag.CMDPLAYERS)))))
		{
			if(ableTypes>=0)
			{
				final List<Integer> V=new ArrayList<Integer>();
				final int mask=Ability.ALL_ACODES;
				V.add(Integer.valueOf(ableTypes));
				str=getAbilities(mob,target,V,mask,false,-1);
			}
			else
			if(ableTypes==ABLETYPE_EQUIPMENT)
				str=CMLib.commands().getEquipment(mob,target);
			else
			if(ableTypes==ABLETYPE_INVENTORY)
				str=CMLib.commands().getInventory(mob,target);
			else
			if(ableTypes==ABLETYPE_QUESTWINS)
			{
				str.append(L("Quests won by @x1: ",target.Name()));
				final StringBuffer won=new StringBuffer("");
				for(int q=0;q<CMLib.quests().numQuests();q++)
				{
					final Quest Q=CMLib.quests().fetchQuest(q);
					final Long wonTime = Q.whenLastWon(target.Name());
					if(wonTime != null)
					{
						final String name=Q.displayName().trim().length()>0?Q.displayName():Q.name();
						won.append(" "+name+" on "+CMLib.time().date2String(wonTime.longValue())+" ,");
					}
				}
				if(won.length()==0)
					won.append(L(" None!"));
				won.deleteCharAt(won.length()-1);
				str.append(won);
				str.append("\n\r");
			}
			else
			if(ableTypes==ABLETYPE_TITLES)
			{
				str.append(L("Titles:"));
				final StringBuffer ttl=new StringBuffer("");
				if(target.playerStats()!=null)
				{
					final List<String> roTitles = target.playerStats().getTitles();
					for(int t=0;t<roTitles.size();t++)
					{
						final String title = roTitles.get(t);
						ttl.append(" "+title+",");
					}
				}
				if(ttl.length()==0)
					ttl.append(L(" None!"));
				ttl.deleteCharAt(ttl.length()-1);
				str.append(ttl);
				str.append("\n\r");
			}
			else
			if(ableTypes==ABLETYPE_SCRIPTS)
			{
				str.append(L("Scripts covered:\n\r"));
				int q=1;
				for(final Enumeration<ScriptingEngine> e=target.scripts();e.hasMoreElements();q++)
				{
					final ScriptingEngine SE=e.nextElement();
					str.append(L("Script #@x1\n\r",""+q));
					str.append(L("Quest: @x1\n\r",SE.defaultQuestName()));
					str.append(L("Savable: @x1\n\r",""+SE.isSavable()));
					str.append(L("Scope: @x1\n\r",SE.getVarScope()));
					str.append(L("Vars: @x1\n\r",SE.getLocalVarXML()));
					str.append(L("Script: @x1\n\r",SE.getScript()));
					str.append("\n\r");
				}
				str.append("\n\r");
			}
			else
			if(ableTypes==ABLETYPE_TATTOOS)
			{
				str.append(L("Tattoos:"));
				for(final Enumeration<Tattoo> e=target.tattoos();e.hasMoreElements();)
					str.append(" "+e.nextElement().getTattooName()+",");
				str.deleteCharAt(str.length()-1);
				str.append("\n\r");
			}
			else
			if(ableTypes==ABLETYPE_AFFECTS)
			{
				str.append(L("Effects:"));
				for(final Enumeration<Ability> e=target.effects();e.hasMoreElements();)
					str.append(" "+e.nextElement().Name()+",");
				str.deleteCharAt(str.length()-1);
				str.append("\n\r");
			}
			else
			if(ableTypes==ABLETYPE_FACTIONS)
			{
				str.append(L("Factions:\n\r"));
				for(final Enumeration<String> f=target.factions();f.hasMoreElements();)
				{
					final Faction F=CMLib.factions().getFaction(f.nextElement());
					if(F!=null)
						str.append("^W[^H"+F.name()+"^N("+F.factionID()+"): "+target.fetchFaction(F.factionID())+"^W]^N, ");
				}
				str.append("\n\r");
			}
			else
			if(ableTypes == ABLETYPE_LEVELTIMES)
			{
				if(target.playerStats() != null)
				{
					long lastDateTime=-1;
					for(int level=0;level<=target.phyStats().level();level++)
					{
						final long dateTime=target.playerStats().leveledDateTime(level);
						final long ageMinutes=target.playerStats().leveledMinutesPlayed(level);
					 	final String roomID=target.playerStats().leveledRoomID(level);
						if((dateTime>1529122205)&&(dateTime!=lastDateTime))
						{
							lastDateTime = dateTime;
							if(level==0)
							 	str.append(CMStrings.padRight(L("Created"),8));
							else
							 	str.append(CMStrings.padRight(""+level,8));
							str.append(CMStrings.padRight(CMLib.time().date2String(dateTime),21));
							str.append(CMStrings.padRight(""+CMLib.time().date2EllapsedTime(ageMinutes * 60000L,TimeUnit.MINUTES,true),17));
							final Room R=CMLib.map().getRoom(roomID);
							if(R==null)
								str.append(roomID);
							else
								str.append(CMStrings.limit(R.displayText(), 25)).append("("+roomID+")");
							str.append("\n\r");
						}
					}
				}
				str.append("\n\r");
			}
			else
			if(ableTypes==ABLETYPE_CHARSTATS)
			{
				str.append(L("^XCurrent Character Statistics:^.^N\n\r"));
				final int[] col={0};
				final int headerWidth=CMLib.lister().fixColWidth(12, mob);
				final int numberWidth=CMLib.lister().fixColWidth(6, mob);
				addCharStatsChars(target.charStats(), headerWidth, numberWidth, col, str);
				addCharStatsPhys(target.phyStats(), headerWidth, numberWidth, col, str);
				addCharStatsState(target.curState(), headerWidth, numberWidth, col, str);
				if(target.playerStats()!=null)
					addCharThing(headerWidth,numberWidth,col,str,"STINK",CMath.toPct(target.playerStats().getHygiene()/PlayerStats.HYGIENE_DELIMIT));
				str.append("\n\r\n\r");
				str.append(L("^XBase Character Statistics:^.^N\n\r"));
				col[0]=0;
				addCharStatsChars(target.baseCharStats(), headerWidth, numberWidth, col, str);
				addCharStatsPhys(target.basePhyStats(), headerWidth, numberWidth, col, str);
				addCharStatsState(target.baseState(), headerWidth, numberWidth, col, str);
				str.append("\n\r\n\r");
				str.append(L("^XMax Character State:^.^N\n\r"));
				col[0]=0;
				addCharStatsState(target.maxState(), headerWidth, numberWidth, col, str);
				str.append("\n\r");
			}
			else
			if(ableTypes==ABLETYPE_WORLDEXPLORED)
			{
				if(target.playerStats()!=null)
					if((target.playerStats()!=null)&&(CMProps.isUsingAccountSystem()))
						str.append(L("\n\r^xMember of Account:^.^N ^w@x1^?",(target.playerStats().getAccount()!=null)?target.playerStats().getAccount().getAccountName():L("None"))).append("\n\r");
					str.append(CMLib.commands().getScore(target));
					if(target.playerStats()!=null)
						CMLib.genEd().modifyPlayer(mob, target, -950);
					else
						CMLib.genEd().genMiscSet(mob, target, -950);
				}
			}
		}
					}
					str=new StringBuilder(str.toString().substring(0,str.toString().length()-2)+"\n\r");
				}
				else
					str.append(L("Exploration data is not kept on mobs.\n\r"));
			}
			else
			if(ableTypes==ABLETYPE_ROOMSEXPLORED)
			{
				if(target.playerStats()!=null)
				{
					for(final Enumeration<Room> e=CMLib.map().rooms();e.hasMoreElements();)
					{
						final Room R=e.nextElement();
						if((R.roomID().length()>0)&&(target.playerStats().hasVisited(R)))
							str.append("^H"+R.roomID()+"^N, ");
					}
					str=new StringBuilder(str.toString().substring(0,str.toString().length()-2)+"\n\r");
				}
				else
					str.append(L("Exploration data is not kept on mobs.\n\r"));
			}
			else
			if(ableTypes==ABLETYPE_COMBAT)
			{
				final PlayerStats pStats = target.playerStats();
				if((pStats != null)
				&&(!CMSecurity.isDisabled(CMSecurity.DisFlag.COMBATSTATS)))
				{
					final int level=target.basePhyStats().level();
					long combats = pStats.bumpLevelCombatStat(PlayerCombatStat.COMBATS_TOTAL, level, 0);
					if(combats == 0)
						combats=1;
					long rounds = pStats.bumpLevelCombatStat(PlayerCombatStat.ROUNDS_TOTAL, level, 0);
					if(rounds == 0)
						rounds=1;
					Environmental itarget=getItemTarget(mob, restWords);
					if(itarget!=null)
					{
						CMLib.genEd().genMiscSet(mob, itarget, -950);
						return true;
					}
						.append(pStats.bumpLevelCombatStat(PlayerCombatStat.DEATHS_DONE, level, 0))
						.append("\n\r");
					str.append(CMStrings.padRight(L("Total Deaths"),20)).append(": ")
						.append(pStats.bumpLevelCombatStat(PlayerCombatStat.DEATHS_TAKEN, level, 0))
						.append("\n\r");
					str.append(CMStrings.padRight(L("Experience"),20)).append(": ")
						.append(CMStrings.padRight(""+xp,15))
						.append(" ").append(CMath.round(CMath.div(xp,combats),2)).append("/combat ")
						.append(", ").append(CMath.round(CMath.div(xp,rounds),2)).append("/round")
						.append("\n\r");
					str.append(CMStrings.padRight(L("Damage Done"),20)).append(": ")
						.append(CMStrings.padRight(""+damage,15))
						.append(" ").append(CMath.round(CMath.div(damage,combats),2)).append("/combat ")
						.append(", ").append(CMath.round(CMath.div(damage,rounds),2)).append("/round")
						.append("\n\r");
					str.append(CMStrings.padRight(L("Damage Taken"),20)).append(": ")
						.append(CMStrings.padRight(""+hurt,15))
						.append(" ").append(CMath.round(CMath.div(hurt,combats),2)).append("/combat ")
						.append(", ").append(CMath.round(CMath.div(hurt,rounds),2)).append("/round")
						.append("\n\r");
					str.append(CMStrings.padRight(L("Hits Done"),20)).append(": ")
						.append(CMStrings.padRight(""+hits,15))
						.append(" ").append(CMath.round(CMath.div(hits,combats),2)).append("/combat ")
						.append(", ").append(CMath.round(CMath.div(hits,rounds),2)).append("/round")
						.append("\n\r");
					str.append(CMStrings.padRight(L("Hits Taken"),20)).append(": ")
						.append(CMStrings.padRight(""+hitstaken,15))
						.append(" ").append(CMath.round(CMath.div(hitstaken,combats),2)).append("/combat ")
						.append(", ").append(CMath.round(CMath.div(hitstaken,rounds),2)).append("/round")
						.append("\n\r");
					str.append(CMStrings.padRight(L("Actions Done"),20)).append(": ")
						.append(CMStrings.padRight(""+actions,15))
						.append(" ").append(CMath.round(CMath.div(actions,combats),2)).append("/combat ")
						.append(", ").append(CMath.round(CMath.div(actions,rounds),2)).append("/round")
						.append("\n\r");
					str.append("^W-------------------------\n\r");
				}
				str.append(L("\n\r^cCombat summary:\n\r\n\r^N"));
				final MOB M=CMClass.getMOB("StdMOB");
				M.setBaseCharStats((CharStats)target.baseCharStats().copyOf());
				M.setBasePhyStats((PhyStats)target.basePhyStats().copyOf());
				M.setBaseState((CharState)target.baseState().copyOf());
				recoverMOB(target);
				recoverMOB(M);
				int base=M.basePhyStats().attackAdjustment();
				str.append("^c"+CMStrings.padRight(L("Base Attack"),40)+": ^W"+base+"\n\r");
				for(int i=0;i<target.numItems();i++)
				{
					final Item I=target.getItem(i);
					if ((I != null) && (!I.amWearingAt(Wearable.IN_INVENTORY)))
					{
						recoverMOB(M);
						base = M.phyStats().attackAdjustment();
						testMOB(target, M, I);
						final int diff = M.phyStats().attackAdjustment() - base;
						reportOnDiffMOB(I, diff, str);
					}
				}
				recoverMOB(M);
				for(final Enumeration<Ability> a=target.effects();a.hasMoreElements();)
				{
					final Ability A=a.nextElement();
					if (A != null)
					{
						recoverMOB(M);
						base = M.phyStats().attackAdjustment();
						testMOB(target, M, A);
						final int diff = M.phyStats().attackAdjustment() - base;
						reportOnDiffMOB(A, diff, str);
					}
				}
							itarget=mob.location().fetchExit(MOBname);
						if(itarget!=null)
						{
							CMLib.genEd().genMiscSet(mob, itarget, -950);
							return true;
						}
						base = M.phyStats().armor();
						testMOB(target, M, I);
						final int diff = M.phyStats().armor() - base;
						reportOnDiffMOB(I, diff, str);
					}
				}
				recoverMOB(M);
				for(final Enumeration<Ability> a=target.effects();a.hasMoreElements();)
				{
					final Ability A=a.nextElement();
					if (A != null)
					{
						recoverMOB(M);
						base = M.phyStats().armor();
						testMOB(target, M, A);
						final int diff = M.phyStats().armor() - base;
						reportOnDiffMOB(A, diff, str);
					}
				}
				recoverMOB(target);
				recoverMOB(M);
				reportOnDiffMOB("Other Stuff", CMLib.combat().adjustedArmor(target)-M.basePhyStats().attackAdjustment(), str);
				str.append("^W-------------------------\n\r");
				str.append("^C"+CMStrings.padRight(L("Total"),40)+": ^W"+CMLib.combat().adjustedArmor(target)+"\n\r");
				str.append("\n\r");
				base=M.basePhyStats().damage();
				str.append("^C"+CMStrings.padRight(L("Base Damage"),40)+": ^W"+base+"\n\r");
				for(int i=0;i<target.numItems();i++)
				{
					final Item I=target.getItem(i);
					if (I != null)
					{
						recoverMOB(M);
						base = M.phyStats().damage();
						testMOB(target, M, I);
						final int diff = M.phyStats().damage() - base;
						reportOnDiffMOB(I, diff, str);
					}
				}
				recoverMOB(M);
				for(final Enumeration<Ability> a=target.effects();a.hasMoreElements();)
				{
					final Ability A=a.nextElement();
					if (A != null)
					{
						recoverMOB(M);
						base = M.phyStats().damage();
						testMOB(target, M, A);
						final int diff = M.phyStats().damage() - base;
						reportOnDiffMOB(A, diff, str);
					}
				}
				recoverMOB(target);
				recoverMOB(M);
				reportOnDiffMOB("Other Stuff", CMLib.combat().adjustedDamage(target,null,null,0, false, false)-M.basePhyStats().damage(), str);
				str.append("^W-------------------------\n\r");
				str.append("^C"+CMStrings.padRight(L("Total"),40)+": ^W"+CMLib.combat().adjustedDamage(target, null, null, 0, false, false)+"\n\r");
				str.append("\n\r");
				base=(int)Math.round(M.phyStats().speed()*100);
				str.append("^C"+CMStrings.padRight(L("Base Attacks%"),40)+": ^W"+base+"\n\r");
				for(int i=0;i<target.numItems();i++)
				{
					final Item I=target.getItem(i);
					if (I != null)
					{
						recoverMOB(M);
						base = (int) Math.round(M.phyStats().speed() * 100);
						testMOB(target, M, I);
						final int diff = (int) Math.round(M.phyStats().speed() * 100) - base;
						reportOnDiffMOB(I, diff, str);
					}
				}
				recoverMOB(M);
				for(final Enumeration<Ability> a=target.effects();a.hasMoreElements();)
				{
					final Ability A=a.nextElement();
					if (A != null)
					{
						recoverMOB(M);
						base = (int) Math.round(M.phyStats().speed() * 100);
						testMOB(target, M, A);
						final int diff = (int) Math.round(M.phyStats().speed() * 100) - base;
						reportOnDiffMOB(A, diff, str);
					}
				}
				recoverMOB(target);
				recoverMOB(M);
				str.append("^W-------------------------\n\r");
				str.append("^C"+CMStrings.padRight(L("Total"),40)+": ^W"+(int)Math.round(target.phyStats().speed()*100)+"\n\r");
				str.append("\n\r");
				base=M.maxState().getHitPoints();
				str.append("^C"+CMStrings.padRight(L("Base Hit Points"),40)+": ^W"+base+"\n\r");
				for(int i=0;i<target.numItems();i++)
				{
					final Item I=target.getItem(i);
					if (I != null)
					{
						recoverMOB(M);
						base = M.maxState().getHitPoints();
						testMOB(target, M, I);
						final int diff = M.maxState().getHitPoints() - base;
						reportOnDiffMOB(I, diff, str);
					}
				}
				recoverMOB(M);
				for(int i=0;i<target.numAllEffects();i++)
				{
					final Ability A=target.fetchEffect(i);
					if (A != null)
					{
						recoverMOB(M);
						base = M.maxState().getHitPoints();
						testMOB(target, M, A);
						final int diff = M.maxState().getHitPoints() - base;
						reportOnDiffMOB(A, diff, str);
					}
				}
				recoverMOB(M);
				str.append("^W-------------------------\n\r");
				str.append("^C"+CMStrings.padRight(L("Total"),40)+": ^W"+target.maxState().getHitPoints()+"\n\r");
				recoverMOB(target);
			}
			else
			{
				if((target.playerStats()!=null)&&(CMProps.isUsingAccountSystem()))
					str.append(L("\n\r^xMember of Account:^.^N ^w@x1^?",(target.playerStats().getAccount()!=null)?target.playerStats().getAccount().getAccountName():L("None"))).append("\n\r");
				str.append(CMLib.commands().getScore(target));
				for(final Enumeration<Quest> q= CMLib.quests().enumQuests();q.hasMoreElements();)
				{
					final Quest Q=q.nextElement();
					if((Q!=null)
					&&(Q.running())
					&&(Q.isObjectInUse(target)))
						str.append(L("\n\r^xIn use by quest:^.^N ^w@x1^?",Q.name())).append("\n\r");
				}
				CMLib.genEd().genMiscSet(mob, target, -950);
			}
		}
		return str.toString();
	}

	@Override
	public boolean execute(final MOB mob, final List<String> commands, final int metaFlags)
		throws java.io.IOException
	{
		commands.remove(0);
		if(((commands.size()>0)&&commands.get(0).equals("?"))
		||((commands.size()==0)&&(!(CMSecurity.isAllowed(mob,mob.location(),CMSecurity.SecFlag.STAT)))))
		{
			final StringBuilder msg = new StringBuilder("STAT allows the following options: \n\r");
			for(final String stat : mob.curState().getStatCodes())
				msg.append(stat).append(", ");
			for(final String stat : mob.curState().getStatCodes())
				msg.append("MAX"+stat).append(", ");
			for(final String stat : mob.charStats().getStatCodes())
				msg.append(stat).append(", ");
			for(final String stat : mob.charStats().getStatCodes())
				msg.append("BASE"+stat).append(", ");
			for(final String stat : mob.phyStats().getStatCodes())
				msg.append(stat).append(", ");
			msg.append("STINK, XP, XPTNL, XPFNL, QUESTPOINTS, TRAINS, PRACTICES, HEALTH, RESISTS, ATTRIBUTES");
			for(final Enumeration<Faction> f=CMLib.factions().factions();f.hasMoreElements();)
			{
				final Faction F=f.nextElement();
				if((F!=null)&&(F.showInScore()))
					msg.append(", "+F.name().toUpperCase().replace(' ','_'));
			}
			if(CMSecurity.isAllowed(mob,mob.location(),CMSecurity.SecFlag.STAT))
			{
				msg.append(L(", [MOB/PLAYER NAME], [NUMBER] [DAYS/WEEKS/MONTHS], "));
				for (final String[] element : ABLETYPE_DESCS)
					msg.append(element[0]+", ");
				msg.append(CMParms.toListString(Ability.ACODE_DESCS));
			}
			mob.tell(msg.toString());
			return false;
		}
		final StringBuilder str=new StringBuilder("");
		if(CMSecurity.isAllowed(mob,mob.location(),CMSecurity.SecFlag.STAT))
		{
			if(commands.size()==0)
				commands.add("TODAY");
			final String s1=(commands.size()>0)?commands.get(0).toUpperCase():"";
			final String s2=(commands.size()>1)?commands.get(1).toUpperCase():"";
			if(s1.equalsIgnoreCase("TODAY"))
				return showTableStats(mob,1,1,CMParms.combine(commands,1));
			else
			if((commands.size()==1)
			&&(s1.equalsIgnoreCase("SKILLUSE")||s1.equalsIgnoreCase("AREA")||s1.equalsIgnoreCase("QUEST")||s1.equalsIgnoreCase("CRIME")))
				return showTableStats(mob,1,1,CMParms.combine(commands,0));
			else
			if(commands.size()>1)
			{
				final String rest=(commands.size()>2)?CMParms.combine(commands,2):"";
				if(s2.equals("DAY")&&(CMath.isNumber(s1)))
					return showTableStats(mob,(CMath.s_int(s1)),1,rest);
				else
				if(s2.equals("DAYS")&&(CMath.isNumber(s1)))
					return showTableStats(mob,(CMath.s_int(s1)),1,rest);
				else
				if(s2.equals("WEEK")&&(CMath.isNumber(s1)))
					return showTableStats(mob,(CMath.s_int(s1)*7),7,rest);
				else
				if(s2.equals("WEEKS")&&(CMath.isNumber(s1)))
					return showTableStats(mob,(CMath.s_int(s1)*7),7,rest);
				else
				if(s2.equals("MONTH")&&(CMath.isNumber(s1)))
					return showTableStats(mob,(CMath.s_int(s1)*30),30,rest);
				else
				if(s2.equals("MONTHS")&&(CMath.isNumber(s1)))
					return showTableStats(mob,(CMath.s_int(s1)*30),30,rest);
				else
				if(s2.equals("YEAR")&&(CMath.isNumber(s1)))
					return showTableStats(mob,(CMath.s_int(s1)*365),365,rest);
				else
				if(s2.equals("YEARS")&&(CMath.isNumber(s1)))
					return showTableStats(mob,(CMath.s_int(s1)*365),365,rest);
			}
			str.append(this.getPrivilegedStat(mob, null, commands, false));
		}
		if((commands.size()>0)&&(str.length()==0))
		{
			String mobName=commands.get(commands.size()-1).toString();
			MOB M=mob;
			if(CMSecurity.isAllowed(mob,mob.location(),CMSecurity.SecFlag.STAT))
			{
				final String firstWord = (commands.size()> 1) ? commands.get(0) : "";
				final String restWords = (commands.size() > 1) ? CMParms.combine(commands,1) : "";
				mobName = CMParms.combine(commands,0);
				if(mobName.equalsIgnoreCase("ROOM"))
				{
					CMLib.genEd().modifyRoom(mob, mob.location(), -950);
					return true;
				}
				else
				if(mobName.equalsIgnoreCase("AREA"))
				{
					final Set<Area> alsoUpdateAreas=new HashSet<Area>();
					CMLib.genEd().modifyArea(mob, mob.location().getArea(), alsoUpdateAreas, -950);
					return true;
				}
				else
				if(firstWord.equalsIgnoreCase("CLAN"))
				{
					final Clan C=CMLib.clans().findClan(restWords);
					if(C!=null)
					{
						str.setLength(0);
						str.append(CMStrings.padRight(""+C.getClanLevel(),7)).append(": ").append(L("Clan Level")).append("\n\r");
						for(final Clan.Trophy t : Clan.Trophy.values())
							str.append(CMStrings.padRight(""+C.getTrophyData(t),7)).append(": ").append(L(t.codeString)).append("\n\r");
						mob.tell(str.toString());
						return true;
					}
					mob.tell(L("You can't stat clan '@x1'!",restWords));
					return false;
				}
				else
				if(firstWord.equalsIgnoreCase("EXIT"))
				{
					Environmental itarget=getItemTarget(mob, mobName);
					if(itarget==null)
					{
						itarget=mob.location().fetchExit(mobName);
						return true;
					}
					mob.tell(L("You can't stat exit '@x1'!",restWords));
					return false;
				}
				else
				if(firstWord.equalsIgnoreCase("ITEM"))
				{
					final Environmental itarget=getItemTarget(mob, restWords);
					if(itarget!=null)
					{
						for(final Enumeration<Quest> q= CMLib.quests().enumQuests();q.hasMoreElements();)
						{
							final Quest Q=q.nextElement();
							if((Q!=null)
							&&(Q.running())
							&&(Q.isObjectInUse(itarget)))
								mob.tell(L("\n\r^xIn use by quest:^.^N ^w@x1^?",Q.name()));
						}
						CMLib.genEd().genMiscSet(mob, itarget, -950);
						return true;
					}
					mob.tell(L("You can't stat item '@x1'!",restWords));
					return false;
				}
				else
				if(firstWord.equalsIgnoreCase("ROOM"))
				{
					Environmental itarget = null;
					try
					{
						final List<Room> rooms=CMLib.map().findRooms(mob.location().getArea().getProperMap(), mob,restWords,true,100);
						if(rooms.size()==0)
							rooms.addAll(CMLib.map().findRooms(mob.location().getArea().getProperMap(), mob,restWords,false,100));
						if(rooms.size()==0)
							rooms.addAll(CMLib.map().findRooms(CMLib.map().rooms(), mob,restWords,true,100));
						if(rooms.size()==0)
							rooms.addAll(CMLib.map().findRooms(CMLib.map().rooms(), mob,restWords,false,100));
						for(final Room room : rooms)
						{
							final Room R=CMLib.map().roomLocation(room);
							if(CMSecurity.isAllowed(mob,R,CMSecurity.SecFlag.STAT))
							{
								itarget=room;
								break;
							}
						}
					}
					catch (final NoSuchElementException nse)
					{
					}
					if(itarget != null)
					{
						CMLib.genEd().modifyRoom(mob, (Room)itarget, -950);
						return true;
					}
					else
					{
						mob.tell(L("You can't stat room '@x1'!",restWords));
						return false;
					}
				}
				else
				if(firstWord.equalsIgnoreCase("AREA"))
				{
					final Environmental itarget = CMLib.map().findArea(restWords);
					if(itarget != null)
					{
						final Set<Area> alsoUpdateAreas=new HashSet<Area>();
						CMLib.genEd().modifyArea(mob, (Area)itarget, alsoUpdateAreas, -950);
						return true;
					}
					mob.tell(L("You can't stat area '@x1'!",restWords));
					return false;
				}
				else
				{
					mobName=commands.get(commands.size()-1).toString();
					final MOB target=this.getMOBTarget(mob, mobName);
					if((target!=null)
					&&(((target.isMonster())&&(CMSecurity.isAllowed(mob, target.location(), CMSecurity.SecFlag.CMDMOBS)))
						||((target.isPlayer())&&(CMSecurity.isAllowed(mob, target.location(), CMSecurity.SecFlag.CMDPLAYERS)))))
					{
						M=target;
						commands.remove(commands.size()-1);
					}
					else
					{
						mobName = CMParms.combine(commands,0);
						Environmental itarget=null;
						//if(itarget==null)
							itarget=this.getItemTarget(mob, mobName);
						if(itarget==null)
							itarget=mob.location().fetchExit(mobName);
						if(itarget!=null)
						{
							for(final Enumeration<Quest> q= CMLib.quests().enumQuests();q.hasMoreElements();)
							{
								final Quest Q=q.nextElement();
								if((Q!=null)
								&&(Q.running())
								&&(Q.isObjectInUse(itarget)))
									mob.tell(L("\n\r^xIn use by quest:^.^N ^w@x1^?",Q.name()));
							}
							CMLib.genEd().genMiscSet(mob, itarget, -950);
							return true;
						}
						else
						{
							itarget = CMLib.map().findArea(mobName);
							if(itarget != null)
							{
								final Set<Area> alsoUpdateAreas=new HashSet<Area>();
								CMLib.genEd().modifyArea(mob, (Area)itarget, alsoUpdateAreas, -950);
								return true;
							}
							else
							{
								try
								{
									final List<Room> rooms=CMLib.map().findRooms(mob.location().getArea().getProperMap(), mob,mobName,true,100);
									if(rooms.size()==0)
										rooms.addAll(CMLib.map().findRooms(mob.location().getArea().getProperMap(), mob,mobName,false,100));
									if(rooms.size()==0)
										rooms.addAll(CMLib.map().findRooms(CMLib.map().rooms(), mob,mobName,true,100));
									if(rooms.size()==0)
										rooms.addAll(CMLib.map().findRooms(CMLib.map().rooms(), mob,mobName,false,100));
									for(final Room room : rooms)
									{
										final Room R=CMLib.map().roomLocation(room);
										if(CMSecurity.isAllowed(mob,R,CMSecurity.SecFlag.STAT))
										{
											itarget=room;
											break;
										}
									}
								}
								catch (final NoSuchElementException nse)
								{
								}
								if(itarget != null)
								{
									CMLib.genEd().modifyRoom(mob, (Room)itarget, -950);
									return true;
								}
								else
								{
									mob.tell(L("You can't stat mob/player/item/exit/clan/room/whatever '@x1'!",mobName));
									return false;
								}
							}
						}
					}
				}
			}

			for(int i=0;i<commands.size()-1;i++)
			{
				if(commands.get(i).toString().toUpperCase().equals("MAX"))
				{
					commands.remove(i);
					commands.set(i,"MAX"+commands.get(i).toString());
				}
			}
			for(int i=0;i<commands.size()-1;i++)
			{
				if(commands.get(i).toString().toUpperCase().equals("BASE"))
				{
					commands.remove(i);
					commands.set(i,"BASE"+commands.get(i).toString());
				}
			}
			for(int i=0;i<commands.size()-1;i++)
				commands.set(i,CMStrings.replaceAll(commands.get(i).toString()," ",""));
			for(int i=0;i<commands.size();i++)
			{
				final String thisStat=commands.get(i).toString().toUpperCase().trim();
				boolean found=false;
				if(thisStat.equals("XP"))
				{
					str.append(M.getExperience()).append(" ");
					found=true;
				}
				else
				if(thisStat.equals("ATTRIBUTES"))
				{
					final CharStats CT=mob.charStats();
					for(final int stat : CharStats.CODES.BASECODES())
						str.append(CMStrings.capitalizeAndLower(CharStats.CODES.NAME(stat))+"("+CT.getStat(stat)).append(") ");
					found=true;
				}
				else
				if(thisStat.equals("RESISTS"))
				{
					final CharStats CT=mob.charStats();
					for(final int stat : CharStats.CODES.SAVING_THROWS())
						str.append(CMStrings.capitalizeAndLower(CharStats.CODES.NAME(stat))+"("+CT.getStat(stat)).append(") ");
					found=true;
				}
				else
				if(thisStat.equals("HEALTH"))
				{
					for(final String stat : M.curState().getStatCodes())
						str.append(CMStrings.capitalizeAndLower(stat)).append("(").append(M.curState().getStat(stat)).append(") ");
					found=true;
				}
				else
				if(thisStat.equals("TRAINS"))
				{
					str.append(M.getTrains()).append(" ");
					found=true;
				}
				else
				if(thisStat.equals("PRACTICES"))
				{
					str.append(M.getPractices()).append(" ");
					found=true;
				}
				else
				if(thisStat.equals("ATTACK"))
				{
					str.append(CMLib.combat().fightingProwessStr(M)).append(" ");
					found=true;
				}
				else
				if(thisStat.equals("ARMOR"))
				{
					str.append(CMLib.combat().armorStr(M)).append(" ");
					found=true;
				}
				else
				if(thisStat.equals("DAMAGE"))
				{
					M.tell(""+M.phyStats().damage());
					str.append(CMLib.combat().damageProwessStr(M)).append(" ");
					found=true;
				}
				else
				if(thisStat.equals("QUESTPOINTS"))
				{
					str.append(M.getQuestPoint()).append(" ");
					found=true;
				}
				else
				if(thisStat.equals("XPTNL"))
				{
					str.append(M.getExpNeededLevel()).append(" ");
					found=true;
				}
				else
				if(thisStat.equals("XPFNL"))
				{
					str.append(M.getExpNextLevel()).append(" ");
					found=true;
				}
				if(!found)
				{
					for(final String stat : M.curState().getStatCodes())
					{
						if(stat.equals(thisStat))
						{
							str.append(M.curState().getStat(stat)).append(" ");
							found=true;
							break;
						}
					}
				}
				if((!found)&&(thisStat.equals("STINK"))&&(M.playerStats()!=null))
				{
					str.append(CMath.toPct(M.playerStats().getHygiene()/PlayerStats.HYGIENE_DELIMIT)).append(" ");
					found=true;
				}
				if((!found)&&(thisStat.startsWith("MAX")))
				{
					for(final String stat : M.maxState().getStatCodes())
					{
						if(stat.equals(thisStat.substring(3)))
						{
							str.append(M.maxState().getStat(stat)).append(" ");
							found=true;
							break;
						}
					}
				}
				if((!found)&&(thisStat.startsWith("BASE")))
				{
					for(final String stat : M.baseCharStats().getStatCodes())
					{
						if(stat.equals(thisStat.substring(4)))
						{
							final CharStats base=(CharStats)M.baseCharStats().copyOf();
							//M.baseCharStats().getMyRace().affectCharStats(M, base);
							str.append(base.getStat(stat)).append(" ");
							found=true;
							break;
						}
					}
				}
				if(!found)
				{
					for(final String stat : M.charStats().getStatCodes())
					{
						if(stat.equals(thisStat))
						{
							if(stat.startsWith("MAX"))
								str.append(CMProps.getIntVar(CMProps.Int.BASEMAXSTAT)+CMath.s_int(M.charStats().getStat(stat))).append(" ");
							else
								str.append(M.charStats().getStat(stat)).append(" ");
							found=true;
							break;
						}
					}
				}
				if(!found)
				{
					for(final String stat : M.phyStats().getStatCodes())
					{
						if(stat.equals(thisStat))
						{
							if(stat.equals("SENSES"))
								str.append(doSenses(CMath.s_int(M.phyStats().getStat(stat))));
							else
							if(stat.equals("DISPOSITION"))
								str.append(doDisposition(CMath.s_int(M.phyStats().getStat(stat))));
							else
								str.append(M.phyStats().getStat(stat)).append(" ");
							found=true;
							break;
						}
					}
				}
				if(!found)
				{
					for(final Enumeration<Faction> f=CMLib.factions().factions();f.hasMoreElements();)
					{
						final Faction F=f.nextElement();
						if((F!=null)
						&&(F.showInScore())
						&&(thisStat.equals(F.name().toUpperCase().replace(' ','_'))))
						{
							str.append(M.fetchFaction(F.factionID())).append(" ");
							found=true;
						}
					}
				}
				if(!found)
				{
					if(CMLib.coffeeMaker().isAnyGenStat(M, thisStat))
					{
						str.append(CMLib.coffeeMaker().getAnyGenStat(M, thisStat)).append(" ");
						found=true;
					}
				}
				if(!found)
				{
					for(final String stat : M.curState().getStatCodes())
					{
						if(stat.startsWith(thisStat))
						{
							str.append(M.curState().getStat(stat)).append(" ");
							found=true;
							break;
						}
					}
				}
				if((!found)&&(thisStat.startsWith("MAX")))
				{
					for(final String stat : M.maxState().getStatCodes())
					{
						if(stat.startsWith(thisStat.substring(3)))
						{
							str.append(M.maxState().getStat(stat)).append(" ");
							found=true;
							break;
						}
					}
				}
				if((!found)&&(thisStat.startsWith("BASE")))
				{
					for(final String stat : M.maxState().getStatCodes())
					{
						if(stat.startsWith(thisStat.substring(4)))
						{
							final CharStats base=(CharStats)M.baseCharStats().copyOf();
							//M.baseCharStats().getMyRace().affectCharStats(M, base);
							str.append(base.getStat(stat)).append(" ");
							found=true;
							break;
						}
					}
				}
				if(!found)
				{
					for(final String stat : M.charStats().getStatCodes())
					{
						if(stat.startsWith(thisStat))
						{
							if(stat.startsWith("MAX"))
								str.append(CMProps.getIntVar(CMProps.Int.BASEMAXSTAT)+CMath.s_int(M.charStats().getStat(stat))).append(" ");
							else
								str.append(M.charStats().getStat(stat)).append(" ");
							found=true;
							break;
						}
					}
				}
				if(!found)
				{
					for(final String stat : M.phyStats().getStatCodes())
					{
						if(stat.startsWith(thisStat))
						{
							if(stat.equals("SENSES"))
								str.append(doSenses(CMath.s_int(M.phyStats().getStat(stat))));
							else
							if(stat.equals("DISPOSITION"))
								str.append(doDisposition(CMath.s_int(M.phyStats().getStat(stat))));
							else
								str.append(M.phyStats().getStat(stat)).append(" ");
							found=true;
							break;
						}
					}
				}
				if(!found)
				{
					for(final Enumeration<Faction> f=CMLib.factions().factions();f.hasMoreElements();)
					{
						final Faction F=f.nextElement();
						if((F!=null)
						&&(F.showInScore())
						&&(F.name().toUpperCase().replace(' ','_').startsWith(thisStat)))
						{
							str.append(M.fetchFaction(F.factionID())).append(" ");
							found=true;
						}
					}
				}
				if(!found)
					str.append(" *UNKNOWN:"+thisStat+"* ");
			}
		}
		if(!mob.isMonster())
			mob.session().wraplessPrintln(str.toString());
		return false;
	}

	public void recoverMOB(final MOB M)
	{
		M.recoverCharStats();
		M.recoverPhyStats();
		M.recoverMaxState();
		M.resetToMaxState();
	}

	public void testMOB(final MOB target,final MOB M, final Environmental test)
	{
		test.affectCharStats(target,M.charStats());
		test.affectPhyStats(target,M.phyStats());
		test.affectCharState(target,M.maxState());
	}

	public void reportOnDiffMOB(final String name, final int diff, final StringBuilder str)
	{
		if(diff>0)
			str.append("^C"+CMStrings.padRight(name,40)+": ^W+"+diff+"\n\r");
		else
		if(diff<0)
			str.append("^C"+CMStrings.padRight(name,40)+": ^W"+diff+"\n\r");
	}

	public void reportOnDiffMOB(final Environmental test, final int diff, final StringBuilder str)
	{
		reportOnDiffMOB(test.Name(),diff,str);
	}

	private final static Class<?>[][] internalParameters=new Class<?>[][]{{String.class,MOB.class}};

	@Override
	public Object executeInternal(final MOB mob, final int metaFlags, final Object... args) throws java.io.IOException
	{
		if(!super.checkArguments(internalParameters, args))
			return Boolean.FALSE;
		final String statName=(String)args[0];
		final MOB M=(MOB)args[1];
		final List<String> cmds=new XVector<String>("STAT", statName.toUpperCase().trim(), M.Name());
		return getPrivilegedStat(mob, M, cmds, true);
	}

	@Override
	public boolean canBeOrdered()
	{
		return true;
	}

	@Override
	public boolean securityCheck(final MOB mob)
	{
		return true;
	}
}

<MSG> fix to stat quest mob/item integrity

git-svn-id: 0cdf8356e41b2d8ccbb41bb76c82068fe80b2514@15723 0d6f1817-ed0e-0410-87c9-987e46238f29

<DFF> @@ -1112,10 +1112,15 @@ public class Stat  extends Skills
 					if((target.playerStats()!=null)&&(CMProps.isUsingAccountSystem()))
 						str.append(L("\n\r^xMember of Account:^.^N ^w@x1^?",(target.playerStats().getAccount()!=null)?target.playerStats().getAccount().getAccountName():L("None"))).append("\n\r");
 					str.append(CMLib.commands().getScore(target));
-					if(target.playerStats()!=null)
-						CMLib.genEd().modifyPlayer(mob, target, -950);
-					else
-						CMLib.genEd().genMiscSet(mob, target, -950);
+					for(Enumeration<Quest> q= CMLib.quests().enumQuests();q.hasMoreElements();)
+					{
+						final Quest Q=q.nextElement();
+						if((Q!=null)
+						&&(Q.running())
+						&&(Q.isObjectInUse(target)))
+							str.append(L("\n\r^xIn use by quest:^.^N ^w@x1^?",Q.name())).append("\n\r");
+					}
+					CMLib.genEd().genMiscSet(mob, target, -950);
 				}
 			}
 		}
@@ -1158,6 +1163,14 @@ public class Stat  extends Skills
 					Environmental itarget=getItemTarget(mob, restWords);
 					if(itarget!=null)
 					{
+						for(Enumeration<Quest> q= CMLib.quests().enumQuests();q.hasMoreElements();)
+						{
+							final Quest Q=q.nextElement();
+							if((Q!=null)
+							&&(Q.running())
+							&&(Q.isObjectInUse(itarget)))
+								mob.tell(L("\n\r^xIn use by quest:^.^N ^w@x1^?",Q.name()));
+						}
 						CMLib.genEd().genMiscSet(mob, itarget, -950);
 						return true;
 					}
@@ -1235,6 +1248,14 @@ public class Stat  extends Skills
 							itarget=mob.location().fetchExit(MOBname);
 						if(itarget!=null)
 						{
+							for(Enumeration<Quest> q= CMLib.quests().enumQuests();q.hasMoreElements();)
+							{
+								final Quest Q=q.nextElement();
+								if((Q!=null)
+								&&(Q.running())
+								&&(Q.isObjectInUse(itarget)))
+									mob.tell(L("\n\r^xIn use by quest:^.^N ^w@x1^?",Q.name()));
+							}
 							CMLib.genEd().genMiscSet(mob, itarget, -950);
 							return true;
 						}

{'commit': 'diff --git a/com/planet_ink/coffee_mud/Commands/Stat.java b/com/planet_ink/coffee_mud/Commands/Stat.java\nindex bf8056bafe..4d72bd775c 100644\n--- a/com/planet_ink/coffee_mud/Commands/Stat.java\n+++ b/com/planet_ink/coffee_mud/Commands/Stat.java\n@@ -1112,10 +1112,15 @@ public class Stat  extends Skills\n \t\t\t\t\tif((target.playerStats()!=null)&&(CMProps.isUsingAccountSystem()))\r\n \t\t\t\t\t\tstr.append(L("\\n\\r^xMember of Account:^.^N ^w@x1^?",(target.playerStats().getAccount()!=null)?target.playerStats().getAccount().getAccountName():L("None"))).append("\\n\\r");\r\n \t\t\t\t\tstr.append(CMLib.commands().getScore(target));\r\n-\t\t\t\t\tif(target.playerStats()!=null)\r\n-\t\t\t\t\t\tCMLib.genEd().modifyPlayer(mob, target, -950);\r\n-\t\t\t\t\telse\r\n-\t\t\t\t\t\tCMLib.genEd().genMiscSet(mob, target, -950);\r\n+\t\t\t\t\tfor(Enumeration<Quest> q= CMLib.quests().enumQuests();q.hasMoreElements();)\r\n+\t\t\t\t\t{\r\n+\t\t\t\t\t\tfinal Quest Q=q.nextElement();\r\n+\t\t\t\t\t\tif((Q!=null)\r\n+\t\t\t\t\t\t&&(Q.running())\r\n+\t\t\t\t\t\t&&(Q.isObjectInUse(target)))\r\n+\t\t\t\t\t\t\tstr.append(L("\\n\\r^xIn use by quest:^.^N ^w@x1^?",Q.name())).append("\\n\\r");\r\n+\t\t\t\t\t}\r\n+\t\t\t\t\tCMLib.genEd().genMiscSet(mob, target, -950);\r\n \t\t\t\t}\r\n \t\t\t}\r\n \t\t}\r\n@@ -1158,6 +1163,14 @@ public class Stat  extends Skills\n \t\t\t\t\tEnvironmental itarget=getItemTarget(mob, restWords);\r\n \t\t\t\t\tif(itarget!=null)\r\n \t\t\t\t\t{\r\n+\t\t\t\t\t\tfor(Enumeration<Quest> q= CMLib.quests().enumQuests();q.hasMoreElements();)\r\n+\t\t\t\t\t\t{\r\n+\t\t\t\t\t\t\tfinal Quest Q=q.nextElement();\r\n+\t\t\t\t\t\t\tif((Q!=null)\r\n+\t\t\t\t\t\t\t&&(Q.running())\r\n+\t\t\t\t\t\t\t&&(Q.isObjectInUse(itarget)))\r\n+\t\t\t\t\t\t\t\tmob.tell(L("\\n\\r^xIn use by quest:^.^N ^w@x1^?",Q.name()));\r\n+\t\t\t\t\t\t}\r\n \t\t\t\t\t\tCMLib.genEd().genMiscSet(mob, itarget, -950);\r\n \t\t\t\t\t\treturn true;\r\n \t\t\t\t\t}\r\n@@ -1235,6 +1248,14 @@ public class Stat  extends Skills\n \t\t\t\t\t\t\titarget=mob.location().fetchExit(MOBname);\r\n \t\t\t\t\t\tif(itarget!=null)\r\n \t\t\t\t\t\t{\r\n+\t\t\t\t\t\t\tfor(Enumeration<Quest> q= CMLib.quests().enumQuests();q.hasMoreElements();)\r\n+\t\t\t\t\t\t\t{\r\n+\t\t\t\t\t\t\t\tfinal Quest Q=q.nextElement();\r\n+\t\t\t\t\t\t\t\tif((Q!=null)\r\n+\t\t\t\t\t\t\t\t&&(Q.running())\r\n+\t\t\t\t\t\t\t\t&&(Q.isObjectInUse(itarget)))\r\n+\t\t\t\t\t\t\t\t\tmob.tell(L("\\n\\r^xIn use by quest:^.^N ^w@x1^?",Q.name()));\r\n+\t\t\t\t\t\t\t}\r\n \t\t\t\t\t\t\tCMLib.genEd().genMiscSet(mob, itarget, -950);\r\n \t\t\t\t\t\t\treturn true;\r\n \t\t\t\t\t\t}\r\ndiff --git a/com/planet_ink/coffee_mud/Libraries/CMGenEditor.java b/com/planet_ink/coffee_mud/Libraries/CMGenEditor.java\nindex 6b7e344d06..bd1d80dcb7 100644\n--- a/com/planet_ink/coffee_mud/Libraries/CMGenEditor.java\n+++ b/com/planet_ink/coffee_mud/Libraries/CMGenEditor.java\n@@ -2719,7 +2719,7 @@ public class CMGenEditor extends StdLibrary implements GenericEditor\n \t\t\t\telse\r\n \t\t\t\t\tmodifyGenItem(mob,(Item)E,showFlag);\r\n \t\t\t}\r\n-\t\t\tif(E instanceof Physical)\r\n+\t\t\tif((E instanceof Physical)&&(showFlag != -950))\r\n \t\t\t\tcatalogCheckUpdate(mob, (Physical)E);\r\n \t\t}\r\n \t\tfinally\r\n', 'commit_subject': 'fix to stat quest mob/item integrity', 'repo_name': 'bozimmerman/CoffeeMud', 'committer': {'name': 'bozimmerman', 'email': 'dc45fe023482b3b890b5e574e53c1d051f45b1ef@zimmers.net', 'time_sec': '1511251164', 'tz_offset': '0', 'date': {'seconds': '1511251164'}}, 'commit_tree': 'd03cd082451af5d93d52eed51349956c32a48107', 'commit_message': 'fix to stat quest mob/item integrity\n\ngit-svn-id: 0cdf8356e41b2d8ccbb41bb76c82068fe80b2514@15723 0d6f1817-ed0e-0410-87c9-987e46238f29\n', 'language_name': 'JavaScript', 'license': 'apache-2.0', 'hunks': '@@ -1112,10 +1112,15 @@ public class Stat  extends Skills\n \t\t\t\t\tif((target.playerStats()!=null)&&(CMProps.isUsingAccountSystem()))\r\n \t\t\t\t\t\tstr.append(L("\\n\\r^xMember of Account:^.^N ^w@x1^?",(target.playerStats().getAccount()!=null)?target.playerStats().getAccount().getAccountName():L("None"))).append("\\n\\r");\r\n \t\t\t\t\tstr.append(CMLib.commands().getScore(target));\r\n-\t\t\t\t\tif(target.playerStats()!=null)\r\n-\t\t\t\t\t\tCMLib.genEd().modifyPlayer(mob, target, -950);\r\n-\t\t\t\t\telse\r\n-\t\t\t\t\t\tCMLib.genEd().genMiscSet(mob, target, -950);\r\n+\t\t\t\t\tfor(Enumeration<Quest> q= CMLib.quests().enumQuests();q.hasMoreElements();)\r\n+\t\t\t\t\t{\r\n+\t\t\t\t\t\tfinal Quest Q=q.nextElement();\r\n+\t\t\t\t\t\tif((Q!=null)\r\n+\t\t\t\t\t\t&&(Q.running())\r\n+\t\t\t\t\t\t&&(Q.isObjectInUse(target)))\r\n+\t\t\t\t\t\t\tstr.append(L("\\n\\r^xIn use by quest:^.^N ^w@x1^?",Q.name())).append("\\n\\r");\r\n+\t\t\t\t\t}\r\n+\t\t\t\t\tCMLib.genEd().genMiscSet(mob, target, -950);\r\n \t\t\t\t}\r\n \t\t\t}\r\n \t\t}\r\n@@ -1158,6 +1163,14 @@ public class Stat  extends Skills\n \t\t\t\t\tEnvironmental itarget=getItemTarget(mob, restWords);\r\n \t\t\t\t\tif(itarget!=null)\r\n \t\t\t\t\t{\r\n+\t\t\t\t\t\tfor(Enumeration<Quest> q= CMLib.quests().enumQuests();q.hasMoreElements();)\r\n+\t\t\t\t\t\t{\r\n+\t\t\t\t\t\t\tfinal Quest Q=q.nextElement();\r\n+\t\t\t\t\t\t\tif((Q!=null)\r\n+\t\t\t\t\t\t\t&&(Q.running())\r\n+\t\t\t\t\t\t\t&&(Q.isObjectInUse(itarget)))\r\n+\t\t\t\t\t\t\t\tmob.tell(L("\\n\\r^xIn use by quest:^.^N ^w@x1^?",Q.name()));\r\n+\t\t\t\t\t\t}\r\n \t\t\t\t\t\tCMLib.genEd().genMiscSet(mob, itarget, -950);\r\n \t\t\t\t\t\treturn true;\r\n \t\t\t\t\t}\r\n@@ -1235,6 +1248,14 @@ public class Stat  extends Skills\n \t\t\t\t\t\t\titarget=mob.location().fetchExit(MOBname);\r\n \t\t\t\t\t\tif(itarget!=null)\r\n \t\t\t\t\t\t{\r\n+\t\t\t\t\t\t\tfor(Enumeration<Quest> q= CMLib.quests().enumQuests();q.hasMoreElements();)\r\n+\t\t\t\t\t\t\t{\r\n+\t\t\t\t\t\t\t\tfinal Quest Q=q.nextElement();\r\n+\t\t\t\t\t\t\t\tif((Q!=null)\r\n+\t\t\t\t\t\t\t\t&&(Q.running())\r\n+\t\t\t\t\t\t\t\t&&(Q.isObjectInUse(itarget)))\r\n+\t\t\t\t\t\t\t\t\tmob.tell(L("\\n\\r^xIn use by quest:^.^N ^w@x1^?",Q.name()));\r\n+\t\t\t\t\t\t\t}\r\n \t\t\t\t\t\t\tCMLib.genEd().genMiscSet(mob, itarget, -950);\r\n \t\t\t\t\t\t\treturn true;\r\n \t\t\t\t\t\t}\r\n', 'addition_count': 25, 'deletion_count': 4, 'src_file': 'a/com/planet_ink/coffee_mud/Commands/Stat.java', 'tgt_file': 'b/com/planet_ink/coffee_mud/Commands/Stat.java', 'file_extension': '.java', 'before_file': 'package com.planet_ink.coffee_mud.Commands;\nimport com.planet_ink.coffee_mud.core.interfaces.*;\nimport com.planet_ink.coffee_mud.core.*;\nimport com.planet_ink.coffee_mud.core.collections.*;\nimport com.planet_ink.coffee_mud.Abilities.interfaces.*;\nimport com.planet_ink.coffee_mud.Areas.interfaces.*;\nimport com.planet_ink.coffee_mud.Behaviors.interfaces.*;\nimport com.planet_ink.coffee_mud.CharClasses.interfaces.*;\nimport com.planet_ink.coffee_mud.Commands.interfaces.*;\nimport com.planet_ink.coffee_mud.Common.interfaces.*;\nimport com.planet_ink.coffee_mud.Common.interfaces.PlayerStats.PlayerCombatStat;\nimport com.planet_ink.coffee_mud.Exits.interfaces.*;\nimport com.planet_ink.coffee_mud.Items.interfaces.*;\nimport com.planet_ink.coffee_mud.Libraries.interfaces.*;\nimport com.planet_ink.coffee_mud.Locales.interfaces.*;\nimport com.planet_ink.coffee_mud.MOBS.interfaces.*;\nimport com.planet_ink.coffee_mud.Races.interfaces.*;\n\nimport java.io.IOException;\nimport java.util.*;\nimport java.util.concurrent.TimeUnit;\n\n/*\n   Copyright 2004-2022 Bo Zimmerman\n\n   Licensed under the Apache License, Version 2.0 (the "License");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n\t   http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an "AS IS" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n*/\npublic class Stat  extends Skills\n{\n\tpublic Stat()\n\t{\n\t}\n\n\tprivate final String[] access=I(new String[]{"STAT"});\n\t@Override\n\tpublic String[] getAccessWords()\n\t{\n\t\treturn access;\n\t}\n\n\tpublic static final int\tABLETYPE_EQUIPMENT\t\t= -2;\n\tpublic static final int\tABLETYPE_INVENTORY\t\t= -3;\n\tpublic static final int\tABLETYPE_QUESTWINS\t\t= -4;\n\tpublic static final int\tABLETYPE_TATTOOS\t\t= -5;\n\tpublic static final int\tABLETYPE_COMBAT\t\t\t= -6;\n\tpublic static final int\tABLETYPE_SCRIPTS\t\t= -7;\n\tpublic static final int\tABLETYPE_TITLES\t\t\t= -8;\n\tpublic static final int\tABLETYPE_ROOMSEXPLORED\t= -9;\n\tpublic static final int\tABLETYPE_AREASEXPLORED\t= -10;\n\tpublic static final int\tABLETYPE_WORLDEXPLORED\t= -11;\n\tpublic static final int\tABLETYPE_FACTIONS\t\t= -12;\n\tpublic static final int\tABLETYPE_CHARSTATS\t\t= -13;\n\tpublic static final int\tABLETYPE_LEVELTIMES\t\t= -14;\n\tpublic static final int\tABLETYPE_AFFECTS\t\t= -15;\n\n\tpublic static final String[][] ABLETYPE_DESCS={\n\t\t{"EQUIPMENT","EQ","EQUIP"},\n\t\t{"INVENTORY","INVEN","INV"},\n\t\t{"QUESTWINS","QUESTS","QUEST","QUESTWIN"},\n\t\t{"TATTOOS","TATTOO","TATT"},\n\t\t{"COMBAT"},\n\t\t{"SCRIPTS"},\n\t\t{"TITLES","TITLE"},\n\t\t{"ROOMSEXPLORED"},\n\t\t{"AREASEXPLORED"},\n\t\t{"WORLDEXPLORED"},\n\t\t{"FACTIONS","FACTION"},\n\t\t{"CHARSTATISTICS","CSTAT","CHARSTATS"},\n\t\t{"LEVELTIMES","LVLS"},\n\t\t{"AFFECTS","EFFECTS","EFF"},\n\t};\n\n\tpublic MOB getTarget(final MOB mob, final String targetName, final boolean quiet)\n\t{\n\t\tMOB target=null;\n\t\tif(targetName.length()>0)\n\t\t{\n\t\t\ttarget=mob.location().fetchInhabitant(targetName);\n\t\t\tif(target==null)\n\t\t\t{\n\t\t\t\tfinal Environmental t=mob.location().fetchFromRoomFavorItems(null,targetName);\n\t\t\t\tif((t!=null)&&(!(t instanceof MOB)))\n\t\t\t\t{\n\t\t\t\t\tif(!quiet)\n\t\t\t\t\t\tmob.tell(mob,t,null,L("You can\'t do that to <T-NAMESELF>."));\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn target;\n\t}\n\n\tpublic String doSenses(final int senseMask)\n\t{\n\t\tfinal StringBuilder str=new StringBuilder("");\n\t\tfor(int i=0;i<PhyStats.CAN_SEE_DESCS.length;i++)\n\t\t{\n\t\t\tif(CMath.isSet(senseMask, i))\n\t\t\t\tstr.append(PhyStats.CAN_SEE_DESCS[i].replace(\' \',\'_\')).append(" ");\n\t\t}\n\t\tif(str.length()==0)\n\t\t\tstr.append("NONE ");\n\t\treturn str.toString().trim();\n\t}\n\n\tpublic String doDisposition(final int dispositionMask)\n\t{\n\t\tfinal StringBuilder str=new StringBuilder("");\n\t\tfor(int i=0;i<PhyStats.IS_DESCS.length;i++)\n\t\t{\n\t\t\tif(CMath.isSet(dispositionMask, i))\n\t\t\t\tstr.append(PhyStats.IS_DESCS[i].replace(\' \',\'_\')).append(" ");\n\t\t}\n\t\tif(str.length()==0)\n\t\t\tstr.append("NONE ");\n\t\treturn str.toString().trim();\n\t}\n\n\tpublic boolean showTableStats(final MOB mob, final int days, final int scale, String rest)\n\t{\n\t\tfinal Calendar ENDQ=Calendar.getInstance();\n\t\tENDQ.add(Calendar.DATE,-days);\n\t\tENDQ.set(Calendar.HOUR_OF_DAY,23);\n\t\tENDQ.set(Calendar.MINUTE,59);\n\t\tENDQ.set(Calendar.SECOND,59);\n\t\tENDQ.set(Calendar.MILLISECOND,999);\n\t\tCMLib.coffeeTables().update();\n\t\tfinal List<CoffeeTableRow> V=CMLib.coffeeTables().readRawStats(ENDQ.getTimeInMillis()-1,0);\n\t\tif (V.size() == 0)\n\t\t{\n\t\t\tmob.tell(L("No Stats?!"));\n\t\t\treturn false;\n\t\t}\n\t\tfinal StringBuffer table=new StringBuffer("");\n\t\tboolean skillUse=false;\n\t\tboolean socUse=false;\n\t\tboolean cmdUse=false;\n\t\tboolean questStats=false;\n\t\tboolean crimeStats=false;\n\t\tboolean areaStats=false;\n\t\tboolean players=false;\n\t\tif(rest.toUpperCase().trim().startsWith("SKILLUSE"))\n\t\t{\n\t\t\tskillUse=true;\n\t\t\tfinal int x=rest.indexOf(\' \');\n\t\t\tif(x>0)\n\t\t\t\trest=rest.substring(x+1).trim();\n\t\t\telse\n\t\t\t\trest="";\n\t\t}\n\t\tif(rest.toUpperCase().trim().startsWith("SOCUSE"))\n\t\t{\n\t\t\tsocUse=true;\n\t\t\tfinal int x=rest.indexOf(\' \');\n\t\t\tif(x>0)\n\t\t\t\trest=rest.substring(x+1).trim();\n\t\t\telse\n\t\t\t\trest="";\n\t\t}\n\t\tif(rest.toUpperCase().trim().startsWith("CMDUSE"))\n\t\t{\n\t\t\tcmdUse=true;\n\t\t\tfinal int x=rest.indexOf(\' \');\n\t\t\tif(x>0)\n\t\t\t\trest=rest.substring(x+1).trim();\n\t\t\telse\n\t\t\t\trest="";\n\t\t}\n\t\tif(rest.toUpperCase().trim().startsWith("QUEST"))\n\t\t{\n\t\t\tquestStats=true;\n\t\t\tfinal int x=rest.indexOf(\' \');\n\t\t\tif(x>0)\n\t\t\t\trest=rest.substring(x+1).trim();\n\t\t\telse\n\t\t\t\trest="";\n\t\t}\n\t\tif(rest.toUpperCase().trim().startsWith("CRIME"))\n\t\t{\n\t\t\tcrimeStats=true;\n\t\t\tfinal int x=rest.indexOf(\' \');\n\t\t\tif(x>0)\n\t\t\t\trest=rest.substring(x+1).trim();\n\t\t\telse\n\t\t\t\trest="";\n\t\t}\n\t\tif(rest.toUpperCase().trim().startsWith("AREA"))\n\t\t{\n\t\t\tareaStats=true;\n\t\t\tfinal int x=rest.indexOf(\' \');\n\t\t\tif(x>0)\n\t\t\t\trest=rest.substring(x+1).trim();\n\t\t\telse\n\t\t\t\trest="";\n\t\t}\n\t\tif(rest.toUpperCase().trim().startsWith("PLAY"))\n\t\t{\n\t\t\tplayers=true;\n\t\t\tfinal int x=rest.indexOf(\' \');\n\t\t\tif(x>0)\n\t\t\t\trest=rest.substring(x+1).trim();\n\t\t\telse\n\t\t\t\trest="";\n\t\t}\n\t\ttable.append("^xStatistics since "+CMLib.time().date2String(ENDQ.getTimeInMillis())+":^.^N\\n\\r\\n\\r");\n\t\tif(skillUse)\n\t\t\ttable.append(CMStrings.padRight(L("Skill"),25)+CMStrings.padRight(L("Uses"),10)+CMStrings.padRight(L("Skill"),25)+CMStrings.padRight(L("Uses"),10)+"\\n\\r");\n\t\telse\n\t\tif(socUse)\n\t\t\ttable.append(CMStrings.padRight(L("Social"),25)+CMStrings.padRight(L("Uses"),10)+CMStrings.padRight(L("Social"),25)+CMStrings.padRight(L("Uses"),10)+"\\n\\r");\n\t\telse\n\t\tif(cmdUse)\n\t\t\ttable.append(CMStrings.padRight(L("Command"),25)+CMStrings.padRight(L("Uses"),10)+CMStrings.padRight(L("Command"),25)+CMStrings.padRight(L("Uses"),10)+"\\n\\r");\n\t\telse\n\t\tif(questStats)\n\t\t{\n\t\t\ttable.append(CMStrings.padRight(L("Quest"),30)\n\t   \t\t\t\t\t+CMStrings.padRight(L("STRT"),5)\n\t\t\t\t\t\t+CMStrings.padRight(L("TSRT"),5)\n\t\t\t\t\t\t+CMStrings.padRight(L("FLST"),5)\n\t\t\t\t\t\t+CMStrings.padRight(L("ACPT"),5)\n\t\t\t\t\t\t+CMStrings.padRight(L("WINS"),5)\n\t\t\t\t\t\t+CMStrings.padRight(L("FAIL"),5)\n\t\t\t\t\t\t+CMStrings.padRight(L("DROP"),5)\n\t\t\t\t\t\t+CMStrings.padRight(L("TSTP"),5)\n\t\t\t\t\t\t+CMStrings.padRight(L("STOP"),5)\n\t\t\t\t\t\t+"\\n\\r");\n\t\t}\n\t\telse\n\t\tif(crimeStats)\n\t\t{\n\t\t\ttable.append(CMStrings.padRight(L("Date"),25)\n\t\t\t\t\t\t+CMStrings.padRight(L("Warrants"),10)\n\t   \t\t\t\t\t+CMStrings.padRight(L("Arrests"),10)\n\t\t\t\t\t\t+CMStrings.padRight(L("Paroles"),10)\n\t\t\t\t\t\t+CMStrings.padRight(L("Jailings"),10)\n\t\t\t\t\t\t+CMStrings.padRight(L("Executions"),10)\n\t\t\t\t\t\t+"\\n\\r");\n\t\t}\n\t\telse\n\t\tif(areaStats)\n\t\t{\n\t\t\ttable.append(CMStrings.padRight(L("Area"),25)\n\t\t\t\t\t\t +CMStrings.padRight(L("CONs"),5)\n\t\t\t\t\t\t +CMStrings.padRight(L("HIGH"),5)\n\t\t\t\t\t\t +CMStrings.padRight(L("ONLN"),5)\n\t\t\t\t\t\t +CMStrings.padRight(L("AVGM"),5)\n\t\t\t\t\t\t +CMStrings.padRight(L("NEWB"),5)\n\t\t\t\t\t\t +CMStrings.padRight(L("DTHs"),5)\n\t\t\t\t\t\t +CMStrings.padRight(L("PKDs"),5)\n\t\t\t\t\t\t +CMStrings.padRight(L("CLAS"),5)\n\t\t\t\t\t\t +CMStrings.padRight(L("PURG"),5)\n\t\t\t\t\t\t +CMStrings.padRight(L("MARR"),5)+"\\n\\r");\n\t\t}\n\t\telse\n\t\t\ttable.append(CMStrings.padRight(L("Date"),25)\n\t\t\t\t\t\t +CMStrings.padRight(L("CONs"),5)\n\t\t\t\t\t\t +CMStrings.padRight(L("HIGH"),5)\n\t\t\t\t\t\t +CMStrings.padRight(L("ONLN"),5)\n\t\t\t\t\t\t +CMStrings.padRight(L("AVGM"),5)\n\t\t\t\t\t\t +CMStrings.padRight(L("NEWB"),5)\n\t\t\t\t\t\t +CMStrings.padRight(L("DTHs"),5)\n\t\t\t\t\t\t +CMStrings.padRight(L("PKDs"),5)\n\t\t\t\t\t\t +CMStrings.padRight(L("CLAS"),5)\n\t\t\t\t\t\t +CMStrings.padRight(L("PURG"),5)\n\t\t\t\t\t\t +CMStrings.padRight(L("MARR"),5)+"\\n\\r");\n\t\ttable.append(CMStrings.repeat(\'-\',75)+"\\n\\r");\n\t\tfinal Calendar C=Calendar.getInstance();\n\t\tC.set(Calendar.HOUR_OF_DAY,23);\n\t\tC.set(Calendar.MINUTE,59);\n\t\tC.set(Calendar.SECOND,59);\n\t\tC.set(Calendar.MILLISECOND,999);\n\t\tlong curTime=C.getTimeInMillis();\n\t\tString code="*";\n\t\tif(rest.length()>0)\n\t\t\tcode=""+rest.toUpperCase().charAt(0);\n\t\tlong lastCur=System.currentTimeMillis();\n\t\tif(skillUse)\n\t\t{\n\t\t\tfinal CharClass CharC=CMClass.getCharClass(rest);\n\t\t\tfinal ArrayList<Ability> allSkills=new ArrayList<Ability>();\n\t\t\tfor(final Enumeration<Ability> e=CMClass.abilities();e.hasMoreElements();)\n\t\t\t\tallSkills.add(e.nextElement());\n\t\t\tfinal long[][] totals=new long[allSkills.size()][CoffeeTableRow.STAT_TOTAL];\n\t\t\twhile((V.size()>0)&&(curTime>(ENDQ.getTimeInMillis())))\n\t\t\t{\n\t\t\t\tlastCur=curTime;\n\t\t\t\tfinal Calendar C2=Calendar.getInstance();\n\t\t\t\tC2.setTimeInMillis(curTime);\n\t\t\t\tC2.add(Calendar.DATE,-(scale));\n\t\t\t\tcurTime=C2.getTimeInMillis();\n\t\t\t\tC2.set(Calendar.HOUR_OF_DAY,23);\n\t\t\t\tC2.set(Calendar.MINUTE,59);\n\t\t\t\tC2.set(Calendar.SECOND,59);\n\t\t\t\tC2.set(Calendar.MILLISECOND,999);\n\t\t\t\tcurTime=C2.getTimeInMillis();\n\t\t\t\tfinal ArrayList<CoffeeTableRow> set=new ArrayList<CoffeeTableRow>();\n\t\t\t\tfor(int v=V.size()-1;v>=0;v--)\n\t\t\t\t{\n\t\t\t\t\tfinal CoffeeTableRow T=V.get(v);\n\t\t\t\t\tif((T.startTime()>curTime)&&(T.endTime()<=lastCur))\n\t\t\t\t\t{\n\t\t\t\t\t\tset.add(T);\n\t\t\t\t\t\tV.remove(v);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor(int s=0;s<set.size();s++)\n\t\t\t\t{\n\t\t\t\t\tfinal CoffeeTableRow T=set.get(s);\n\t\t\t\t\tfor(int x=0;x<allSkills.size();x++)\n\t\t\t\t\t\tT.totalUp("A"+allSkills.get(x).ID().toUpperCase(),totals[x]);\n\t\t\t\t}\n\t\t\t\tif(scale==0)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tboolean cr=false;\n\t\t\tfor(int x=0;x<allSkills.size();x++)\n\t\t\t{\n\t\t\t\tAbility A=allSkills.get(x);\n\t\t\t\tif((CharC!=null)&&(CMLib.ableMapper().getQualifyingLevel(CharC.ID(),true,A.ID())<0))\n\t\t\t\t\tcontinue;\n\t\t\t\tif(totals[x][CoffeeTableRow.STAT_SKILLUSE]>0)\n\t\t\t\t{\n\t\t\t\t\ttable.append(CMStrings.padRight(""+A.ID(),25)\n\t\t\t\t\t\t\t+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_SKILLUSE],10));\n\t\t\t\t\tif(cr)\n\t\t\t\t\t\ttable.append("\\n\\r");\n\t\t\t\t\tcr=!cr;\n\t\t\t\t}\n\t\t\t\tx++;\n\t\t\t\tif(x<allSkills.size())\n\t\t\t\t{\n\t\t\t\t\tA=allSkills.get(x);\n\t\t\t\t\tif(totals[x][CoffeeTableRow.STAT_SKILLUSE]>0)\n\t\t\t\t\t{\n\n\t\t\t\t\t\ttable.append(CMStrings.padRight(""+A.ID(),25)\n\t\t\t\t\t\t\t\t+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_SKILLUSE],10));\n\t\t\t\t\t\tif(cr)\n\t\t\t\t\t\t\ttable.append("\\n\\r");\n\t\t\t\t\t\tcr=!cr;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(cr)\n\t\t\t\ttable.append("\\n\\r");\n\t\t}\n\t\telse\n\t\tif(socUse)\n\t\t{\n\t\t\tfinal ArrayList<Social> allSocials=new ArrayList<Social>();\n\t\t\tfor(final Enumeration<Social> e=CMLib.socials().getAllSocials();e.hasMoreElements();)\n\t\t\t\tallSocials.add(e.nextElement());\n\t\t\tfinal long[][] totals=new long[allSocials.size()][CoffeeTableRow.STAT_TOTAL];\n\t\t\twhile((V.size()>0)&&(curTime>(ENDQ.getTimeInMillis())))\n\t\t\t{\n\t\t\t\tlastCur=curTime;\n\t\t\t\tfinal Calendar C2=Calendar.getInstance();\n\t\t\t\tC2.setTimeInMillis(curTime);\n\t\t\t\tC2.add(Calendar.DATE,-(scale));\n\t\t\t\tcurTime=C2.getTimeInMillis();\n\t\t\t\tC2.set(Calendar.HOUR_OF_DAY,23);\n\t\t\t\tC2.set(Calendar.MINUTE,59);\n\t\t\t\tC2.set(Calendar.SECOND,59);\n\t\t\t\tC2.set(Calendar.MILLISECOND,999);\n\t\t\t\tcurTime=C2.getTimeInMillis();\n\t\t\t\tfinal ArrayList<CoffeeTableRow> set=new ArrayList<CoffeeTableRow>();\n\t\t\t\tfor(int v=V.size()-1;v>=0;v--)\n\t\t\t\t{\n\t\t\t\t\tfinal CoffeeTableRow T=V.get(v);\n\t\t\t\t\tif((T.startTime()>curTime)&&(T.endTime()<=lastCur))\n\t\t\t\t\t{\n\t\t\t\t\t\tset.add(T);\n\t\t\t\t\t\tV.remove(v);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor(int s=0;s<set.size();s++)\n\t\t\t\t{\n\t\t\t\t\tfinal CoffeeTableRow T=set.get(s);\n\t\t\t\t\tfor(int x=0;x<allSocials.size();x++)\n\t\t\t\t\t\tT.totalUp("S"+allSocials.get(x).baseName().toUpperCase(),totals[x]);\n\t\t\t\t}\n\t\t\t\tif(scale==0)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tboolean cr=false;\n\t\t\tfor(int x=0;x<allSocials.size();x++)\n\t\t\t{\n\t\t\t\tSocial S=allSocials.get(x);\n\t\t\t\tif(totals[x][CoffeeTableRow.STAT_SKILLUSE]>0)\n\t\t\t\t{\n\t\t\t\t\ttable.append(CMStrings.padRight(""+S.baseName(),25)\n\t\t\t\t\t\t\t+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_SOCUSE],10));\n\t\t\t\t\tif(cr)\n\t\t\t\t\t\ttable.append("\\n\\r");\n\t\t\t\t\tcr=!cr;\n\t\t\t\t}\n\t\t\t\tx++;\n\t\t\t\tif(x<allSocials.size())\n\t\t\t\t{\n\t\t\t\t\tS=allSocials.get(x);\n\t\t\t\t\tif(totals[x][CoffeeTableRow.STAT_SOCUSE]>0)\n\t\t\t\t\t{\n\n\t\t\t\t\t\ttable.append(CMStrings.padRight(""+S.baseName(),25)\n\t\t\t\t\t\t\t\t+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_SOCUSE],10));\n\t\t\t\t\t\tif(cr)\n\t\t\t\t\t\t\ttable.append("\\n\\r");\n\t\t\t\t\t\tcr=!cr;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(cr)\n\t\t\t\ttable.append("\\n\\r");\n\t\t}\n\t\telse\n\t\tif(cmdUse)\n\t\t{\n\t\t\tfinal ArrayList<Command> allCommands=new ArrayList<Command>();\n\t\t\tfor(final Enumeration<Command> e=CMClass.commands();e.hasMoreElements();)\n\t\t\t\tallCommands.add(e.nextElement());\n\t\t\tfinal long[][] totals=new long[allCommands.size()][CoffeeTableRow.STAT_TOTAL];\n\t\t\twhile((V.size()>0)&&(curTime>(ENDQ.getTimeInMillis())))\n\t\t\t{\n\t\t\t\tlastCur=curTime;\n\t\t\t\tfinal Calendar C2=Calendar.getInstance();\n\t\t\t\tC2.setTimeInMillis(curTime);\n\t\t\t\tC2.add(Calendar.DATE,-(scale));\n\t\t\t\tcurTime=C2.getTimeInMillis();\n\t\t\t\tC2.set(Calendar.HOUR_OF_DAY,23);\n\t\t\t\tC2.set(Calendar.MINUTE,59);\n\t\t\t\tC2.set(Calendar.SECOND,59);\n\t\t\t\tC2.set(Calendar.MILLISECOND,999);\n\t\t\t\tcurTime=C2.getTimeInMillis();\n\t\t\t\tfinal ArrayList<CoffeeTableRow> set=new ArrayList<CoffeeTableRow>();\n\t\t\t\tfor(int v=V.size()-1;v>=0;v--)\n\t\t\t\t{\n\t\t\t\t\tfinal CoffeeTableRow T=V.get(v);\n\t\t\t\t\tif((T.startTime()>curTime)&&(T.endTime()<=lastCur))\n\t\t\t\t\t{\n\t\t\t\t\t\tset.add(T);\n\t\t\t\t\t\tV.remove(v);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor(int s=0;s<set.size();s++)\n\t\t\t\t{\n\t\t\t\t\tfinal CoffeeTableRow T=set.get(s);\n\t\t\t\t\tfor(int x=0;x<allCommands.size();x++)\n\t\t\t\t\t\tT.totalUp("M"+allCommands.get(x).ID().toUpperCase(),totals[x]);\n\t\t\t\t}\n\t\t\t\tif(scale==0)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tboolean cr=false;\n\t\t\tfor(int x=0;x<allCommands.size();x++)\n\t\t\t{\n\t\t\t\tCommand M=allCommands.get(x);\n\t\t\t\tif(totals[x][CoffeeTableRow.STAT_CMDUSE]>0)\n\t\t\t\t{\n\t\t\t\t\ttable.append(CMStrings.padRight(""+M.ID(),25)\n\t\t\t\t\t\t\t+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_CMDUSE],10));\n\t\t\t\t\tif(cr)\n\t\t\t\t\t\ttable.append("\\n\\r");\n\t\t\t\t\tcr=!cr;\n\t\t\t\t}\n\t\t\t\tx++;\n\t\t\t\tif(x<allCommands.size())\n\t\t\t\t{\n\t\t\t\t\tM=allCommands.get(x);\n\t\t\t\t\tif(totals[x][CoffeeTableRow.STAT_CMDUSE]>0)\n\t\t\t\t\t{\n\n\t\t\t\t\t\ttable.append(CMStrings.padRight(""+M.ID(),25)\n\t\t\t\t\t\t\t\t+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_CMDUSE],10));\n\t\t\t\t\t\tif(cr)\n\t\t\t\t\t\t\ttable.append("\\n\\r");\n\t\t\t\t\t\tcr=!cr;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(cr)\n\t\t\t\ttable.append("\\n\\r");\n\t\t}\n\t\telse\n\t\tif(questStats)\n\t\t{\n\t\t\tfinal List<Quest> sortedQuests=new XVector<Quest>(CMLib.quests().enumQuests());\n\t\t\tCollections.sort(sortedQuests,new Comparator<Quest>()\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int compare(final Quest o1, final Quest o2)\n\t\t\t\t{\n\t\t\t\t\treturn o1.name().toLowerCase().compareTo(o2.name().toLowerCase());\n\t\t\t\t}\n\t\t\t});\n\t\t\tfinal long[][] totals=new long[sortedQuests.size()][CoffeeTableRow.STAT_TOTAL];\n\t\t\twhile((V.size()>0)&&(curTime>(ENDQ.getTimeInMillis())))\n\t\t\t{\n\t\t\t\tlastCur=curTime;\n\t\t\t\tfinal Calendar C2=Calendar.getInstance();\n\t\t\t\tC2.setTimeInMillis(curTime);\n\t\t\t\tC2.add(Calendar.DATE,-(scale));\n\t\t\t\tcurTime=C2.getTimeInMillis();\n\t\t\t\tC2.set(Calendar.HOUR_OF_DAY,23);\n\t\t\t\tC2.set(Calendar.MINUTE,59);\n\t\t\t\tC2.set(Calendar.SECOND,59);\n\t\t\t\tC2.set(Calendar.MILLISECOND,999);\n\t\t\t\tcurTime=C2.getTimeInMillis();\n\t\t\t\tfinal ArrayList<CoffeeTableRow> set=new ArrayList<CoffeeTableRow>();\n\t\t\t\tfor(int v=V.size()-1;v>=0;v--)\n\t\t\t\t{\n\t\t\t\t\tfinal CoffeeTableRow T=V.get(v);\n\t\t\t\t\tif((T.startTime()>curTime)&&(T.endTime()<=lastCur))\n\t\t\t\t\t{\n\t\t\t\t\t\tset.add(T);\n\t\t\t\t\t\tV.remove(v);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(set.size()==0)\n\t\t\t\t{\n\t\t\t\t\tset.addAll(V);\n\t\t\t\t\tV.clear();\n\t\t\t\t}\n\t\t\t\tfor(int s=0;s<set.size();s++)\n\t\t\t\t{\n\t\t\t\t\tfinal CoffeeTableRow T=set.get(s);\n\t\t\t\t\tfor(int x=0;x<sortedQuests.size();x++)\n\t\t\t\t\t\tT.totalUp("U"+T.tagFix(sortedQuests.get(x).name()),totals[x]);\n\t\t\t\t}\n\t\t\t\tif(scale==0)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tfor(int x=0;x<sortedQuests.size();x++)\n\t\t\t{\n\t\t\t\tfinal Quest Q=sortedQuests.get(x);\n\t\t\t\ttable.append(\n\t\t\t\t\t\t CMStrings.padRight(Q.name(),30)\n\t\t\t\t\t\t+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_QUESTSTARTATTEMPT],5)\n\t\t\t\t\t\t+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_QUESTTIMESTART],5)\n\t\t\t\t\t\t+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_QUESTFAILEDSTART],5)\n\t\t\t\t\t\t+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_QUESTACCEPTED],5)\n\t\t\t\t\t\t+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_QUESTSUCCESS],5)\n\t\t\t\t\t\t+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_QUESTFAILED],5)\n\t\t\t\t\t\t+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_QUESTDROPPED],5)\n\t\t\t\t\t\t+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_QUESTTIMESTOP],5)\n\t\t\t\t\t\t+CMStrings.centerPreserve(""+totals[x][CoffeeTableRow.STAT_QUESTSTOP],5));\n\t\t\t\ttable.append("\\n\\r");\n\t\t\t}\n\t\t\ttable.append("\\n\\r");\n\t\t}\n\t\telse\n\t\tif(crimeStats)\n\t\t{\n\t\t\twhile((V.size()>0)&&(curTime>(ENDQ.getTimeInMillis())))\n\t\t\t{\n\t\t\t\tlastCur=curTime;\n\t\t\t\tfinal Calendar C2=Calendar.getInstance();\n\t\t\t\tC2.setTimeInMillis(curTime);\n\t\t\t\tC2.add(Calendar.DATE,-(scale));\n\t\t\t\tcurTime=C2.getTimeInMillis();\n\t\t\t\tC2.set(Calendar.HOUR_OF_DAY,23);\n\t\t\t\tC2.set(Calendar.MINUTE,59);\n\t\t\t\tC2.set(Calendar.SECOND,59);\n\t\t\t\tC2.set(Calendar.MILLISECOND,999);\n\t\t\t\tcurTime=C2.getTimeInMillis();\n\t\t\t\tfinal ArrayList<CoffeeTableRow> set=new ArrayList<CoffeeTableRow>();\n\t\t\t\tfor(int v=V.size()-1;v>=0;v--)\n\t\t\t\t{\n\t\t\t\t\tfinal CoffeeTableRow T=V.get(v);\n\t\t\t\t\tif((T.startTime()>curTime)&&(T.endTime()<=lastCur))\n\t\t\t\t\t{\n\t\t\t\t\t\tset.add(T);\n\t\t\t\t\t\tV.remove(v);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfinal long[] totals=new long[CoffeeTableRow.STAT_TOTAL];\n\t\t\t\tlong highestCOnline=0;\n\t\t\t\tlong numberCOnlineTotal=0;\n\t\t\t\tlong highestPOnline=0;\n\t\t\t\tlong numberPOnlineTotal=0;\n\t\t\t\tlong numberOnlineCounter=0;\n\t\t\t\tfor(int s=0;s<set.size();s++)\n\t\t\t\t{\n\t\t\t\t\tfinal CoffeeTableRow T=set.get(s);\n\t\t\t\t\tT.totalUp(code,totals);\n\t\t\t\t\tif(T.highestCharsOnline()>highestCOnline)\n\t\t\t\t\t\thighestCOnline=T.highestCharsOnline();\n\t\t\t\t\tnumberCOnlineTotal+=T.numberCharsOnlineTotal();\n\t\t\t\t\tif(T.highestOnline()>highestPOnline)\n\t\t\t\t\t\thighestPOnline=T.highestOnline();\n\t\t\t\t\tnumberPOnlineTotal+=T.numberOnlineTotal();\n\t\t\t\t\tnumberOnlineCounter+=T.numberOnlineCounter();\n\t\t\t\t}\n\t\t\t\tif(players)\n\t\t\t\t{\n\t\t\t\t\thighestCOnline=highestPOnline;\n\t\t\t\t\tnumberCOnlineTotal=numberPOnlineTotal;\n\t\t\t\t}\n\t\t\t\ttotals[CoffeeTableRow.STAT_TICKSONLINE]=(totals[CoffeeTableRow.STAT_TICKSONLINE]*CMProps.getTickMillis())/scale/(1000*60);\n\t\t\t\tdouble avgOnline=(numberOnlineCounter>0)?CMath.div(numberCOnlineTotal,numberOnlineCounter):0.0;\n\t\t\t\tavgOnline=CMath.div(Math.round(avgOnline*10.0),10.0);\n\t\t\t\ttable.append(CMStrings.padRight(CMLib.time().date2DateString(curTime+1)+" - "+CMLib.time().date2DateString(lastCur-1),25)\n\t\t\t\t\t\t\t +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_WARRANTS],10)\n\t\t\t\t\t\t\t +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_ARRESTS],10)\n\t\t\t\t\t\t\t +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_PAROLES],10)\n\t\t\t\t\t\t\t +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_JAILINGS],10)\n\t\t\t\t\t\t\t +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_EXECUTIONS],10)+"\\n\\r");\n\t\t\t\tif(scale==0)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\ttable.append("\\n\\r");\n\t\t}\n\t\telse\n\t\tif(areaStats)\n\t\t{\n\t\t\tlastCur=ENDQ.getTimeInMillis();\n\t\t\tfinal ArrayList<CoffeeTableRow> set=new ArrayList<CoffeeTableRow>();\n\t\t\tfor(int v=V.size()-1;v>=0;v--)\n\t\t\t{\n\t\t\t\tfinal CoffeeTableRow T=V.get(v);\n\t\t\t\tif((T.startTime()>lastCur)&&(T.endTime()<=curTime))\n\t\t\t\t{\n\t\t\t\t\tset.add(T);\n\t\t\t\t\tV.remove(v);\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(final Enumeration<Area> a=CMLib.map().areas();a.hasMoreElements();)\n\t\t\t{\n\t\t\t\tfinal Area A=a.nextElement();\n\t\t\t\tif(CMLib.flags().canAccess(mob,A)&&(!CMath.bset(A.flags(),Area.FLAG_INSTANCE_CHILD))&&(!(A instanceof SpaceObject)))\n\t\t\t\t{\n\t\t\t\t\tcode = "X"+A.Name().toUpperCase().replace(\' \',\'_\');\n\t\t\t\t\tfinal long[] totals=new long[CoffeeTableRow.STAT_TOTAL];\n\t\t\t\t\tlong highestCOnline=0;\n\t\t\t\t\tlong numberCOnlineTotal=0;\n\t\t\t\t\tlong highestPOnline=0;\n\t\t\t\t\tlong numberPOnlineTotal=0;\n\t\t\t\t\tlong numberOnlineCounter=0;\n\t\t\t\t\tfor(int s=0;s<set.size();s++)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal CoffeeTableRow T=set.get(s);\n\t\t\t\t\t\tT.totalUp(code,totals);\n\t\t\t\t\t\tif(T.highestCharsOnline()>highestCOnline)\n\t\t\t\t\t\t\thighestCOnline=T.highestCharsOnline();\n\t\t\t\t\t\tnumberCOnlineTotal+=T.numberCharsOnlineTotal();\n\t\t\t\t\t\tif(T.highestOnline()>highestPOnline)\n\t\t\t\t\t\t\thighestPOnline=T.highestOnline();\n\t\t\t\t\t\tnumberPOnlineTotal+=T.numberOnlineTotal();\n\t\t\t\t\t\tnumberOnlineCounter+=T.numberOnlineCounter();\n\t\t\t\t\t}\n\t\t\t\t\tif(players)\n\t\t\t\t\t{\n\t\t\t\t\t\thighestCOnline=highestPOnline;\n\t\t\t\t\t\tnumberCOnlineTotal=numberPOnlineTotal;\n\t\t\t\t\t}\n\t\t\t\t\tdouble avgOnline=(numberOnlineCounter>0)?CMath.div(numberCOnlineTotal,numberOnlineCounter):0.0;\n\t\t\t\t\tavgOnline=CMath.div(Math.round(avgOnline*10.0),10.0);\n\t\t\t\t\ttotals[CoffeeTableRow.STAT_TICKSONLINE]=(totals[CoffeeTableRow.STAT_TICKSONLINE]*CMProps.getTickMillis())/scale/(1000*60);\n\t\t\t\t\ttable.append(CMStrings.padRight(A.Name(),25)\n\t\t\t\t\t\t\t\t +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_LOGINS],5)\n\t\t\t\t\t\t\t\t +CMStrings.centerPreserve(""+highestCOnline,5)\n\t\t\t\t\t\t\t\t +CMStrings.centerPreserve(""+avgOnline,5)\n\t\t\t\t\t\t\t\t +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_TICKSONLINE],5)\n\t\t\t\t\t\t\t\t +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_NEWPLAYERS],5)\n\t\t\t\t\t\t\t\t +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_DEATHS],5)\n\t\t\t\t\t\t\t\t +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_PKDEATHS],5)\n\t\t\t\t\t\t\t\t +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_CLASSCHANGE],5)\n\t\t\t\t\t\t\t\t +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_PURGES],5)\n\t\t\t\t\t\t\t\t +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_MARRIAGES],5)+"\\n\\r");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\twhile((V.size()>0)&&(curTime>(ENDQ.getTimeInMillis())))\n\t\t\t{\n\t\t\t\tlastCur=curTime;\n\t\t\t\tfinal Calendar C2=Calendar.getInstance();\n\t\t\t\tC2.setTimeInMillis(curTime);\n\t\t\t\tC2.add(Calendar.DATE,-(scale));\n\t\t\t\tcurTime=C2.getTimeInMillis();\n\t\t\t\tC2.set(Calendar.HOUR_OF_DAY,23);\n\t\t\t\tC2.set(Calendar.MINUTE,59);\n\t\t\t\tC2.set(Calendar.SECOND,59);\n\t\t\t\tC2.set(Calendar.MILLISECOND,999);\n\t\t\t\tcurTime=C2.getTimeInMillis();\n\t\t\t\tfinal ArrayList<CoffeeTableRow> set=new ArrayList<CoffeeTableRow>();\n\t\t\t\tfor(int v=V.size()-1;v>=0;v--)\n\t\t\t\t{\n\t\t\t\t\tfinal CoffeeTableRow T=V.get(v);\n\t\t\t\t\tif((T.startTime()>curTime)&&(T.endTime()<=lastCur))\n\t\t\t\t\t{\n\t\t\t\t\t\tset.add(T);\n\t\t\t\t\t\tV.remove(v);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfinal long[] totals=new long[CoffeeTableRow.STAT_TOTAL];\n\t\t\t\tlong highestCOnline=0;\n\t\t\t\tlong numberCOnlineTotal=0;\n\t\t\t\tlong highestPOnline=0;\n\t\t\t\tlong numberPOnlineTotal=0;\n\t\t\t\tlong numberOnlineCounter=0;\n\t\t\t\tfor(int s=0;s<set.size();s++)\n\t\t\t\t{\n\t\t\t\t\tfinal CoffeeTableRow T=set.get(s);\n\t\t\t\t\tT.totalUp(code,totals);\n\t\t\t\t\tif(T.highestCharsOnline()>highestCOnline)\n\t\t\t\t\t\thighestCOnline=T.highestCharsOnline();\n\t\t\t\t\tnumberCOnlineTotal+=T.numberCharsOnlineTotal();\n\t\t\t\t\tif(T.highestOnline()>highestPOnline)\n\t\t\t\t\t\thighestPOnline=T.highestOnline();\n\t\t\t\t\tnumberPOnlineTotal+=T.numberOnlineTotal();\n\t\t\t\t\tnumberOnlineCounter+=T.numberOnlineCounter();\n\t\t\t\t}\n\t\t\t\tif(players)\n\t\t\t\t{\n\t\t\t\t\thighestCOnline=highestPOnline;\n\t\t\t\t\tnumberCOnlineTotal=numberPOnlineTotal;\n\t\t\t\t}\n\t\t\t\tdouble avgOnline=(numberOnlineCounter>0)?CMath.div(numberCOnlineTotal,numberOnlineCounter):0.0;\n\t\t\t\tavgOnline=CMath.div(Math.round(avgOnline*10.0),10.0);\n\t\t\t\ttotals[CoffeeTableRow.STAT_TICKSONLINE]=(totals[CoffeeTableRow.STAT_TICKSONLINE]*CMProps.getTickMillis())/scale/(1000*60);\n\t\t\t\ttable.append(CMStrings.padRight(CMLib.time().date2DateString(curTime+1)+" - "+CMLib.time().date2DateString(lastCur-1),25)\n\t\t\t\t\t\t\t +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_LOGINS],5)\n\t\t\t\t\t\t\t +CMStrings.centerPreserve(""+highestCOnline,5)\n\t\t\t\t\t\t\t +CMStrings.centerPreserve(""+avgOnline,5)\n\t\t\t\t\t\t\t +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_TICKSONLINE],5)\n\t\t\t\t\t\t\t +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_NEWPLAYERS],5)\n\t\t\t\t\t\t\t +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_DEATHS],5)\n\t\t\t\t\t\t\t +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_PKDEATHS],5)\n\t\t\t\t\t\t\t +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_CLASSCHANGE],5)\n\t\t\t\t\t\t\t +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_PURGES],5)\n\t\t\t\t\t\t\t +CMStrings.centerPreserve(""+totals[CoffeeTableRow.STAT_MARRIAGES],5)+"\\n\\r");\n\t\t\t\tif(scale==0)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tmob.tell(table.toString());\n\t\treturn false;\n\t}\n\n\tpublic int averageDamage(final MOB M)\n\t{\n\t\tdouble total=0;\n\t\tfinal double num=5000;\n\t\tfor(int i=0;i<num;i++)\n\t\t{\n\t\t\ttotal+=CMLib.combat().adjustedDamage(M,null,null,0,true, false);\n\t\t}\n\t\treturn (int)Math.round(Math.floor(total / num));\n\t}\n\n\tprotected void addCharStatsChars(final CharStats cstats, final int headerWidth, final int numberWidth, final int[] col, final StringBuilder str)\n\t{\n\t\tfor(int i=0;i<cstats.getStatCodes().length;i++)\n\t\t{\n\t\t\tstr.append("^g"+CMStrings.padRight(cstats.getStatCodes()[i]+"^w", headerWidth));\n\t\t\tstr.append(" ");\n\t\t\tstr.append(CMStrings.padRight(""+cstats.getStat(cstats.getStatCodes()[i]), numberWidth));\n\t\t\tcol[0]++;\n\t\t\tif(col[0]==4)\n\t\t\t\tstr.append("\\n\\r");\n\t\t}\n\t}\n\n\tprotected void addCharThing(final int headerWidth, final int numberWidth, final int[] col, final StringBuilder str, final String title, final String val)\n\t{\n\t\tstr.append("^y"+CMStrings.padRight(title+"^w", headerWidth));\n\t\tstr.append(" ");\n\t\tstr.append(CMStrings.padRight(""+val, numberWidth));\n\t\tcol[0]++;\n\t\tif(col[0]==4)\n\t\t\tstr.append("\\n\\r");\n\t}\n\n\tprotected void addCharStatsState(final CharState cstats, final int headerWidth, final int numberWidth, final int[] col, final StringBuilder str)\n\t{\n\t\tfor(int i=0;i<cstats.getStatCodes().length;i++)\n\t\t{\n\t\t\tstr.append("^y"+CMStrings.padRight(cstats.getStatCodes()[i]+"^w", headerWidth));\n\t\t\tstr.append(" ");\n\t\t\tstr.append(CMStrings.padRight(""+cstats.getStat(cstats.getStatCodes()[i]), numberWidth));\n\t\t\tcol[0]++;\n\t\t\tif(col[0]==4)\n\t\t\t\tstr.append("\\n\\r");\n\t\t}\n\t}\n\n\tprotected MOB getMOBTarget(final MOB mob, final String MOBname)\n\t{\n\t\tMOB target=getTarget(mob,MOBname,true);\n\t\tif(target==null)\n\t\t\ttarget=CMLib.players().getLoadPlayer(MOBname);\n\t\tif(target==null)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tfinal List<MOB> inhabs=CMLib.map().findInhabitantsFavorExact(mob.location().getArea().getProperMap(), mob,MOBname,false,100);\n\t\t\t\tif(inhabs.size()==0)\n\t\t\t\t\tinhabs.addAll(CMLib.map().findInhabitantsFavorExact(CMLib.map().rooms(), mob,MOBname,false,100));\n\t\t\t\tfor(final MOB mob2 : inhabs)\n\t\t\t\t{\n\t\t\t\t\tfinal Room R=mob2.location();\n\t\t\t\t\tif(CMSecurity.isAllowed(mob,R,CMSecurity.SecFlag.STAT))\n\t\t\t\t\t{\n\t\t\t\t\t\ttarget=mob2;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (final NoSuchElementException nse)\n\t\t\t{\n\t\t\t}\n\t\t}\n\t\treturn target;\n\t}\n\n\tprotected Item getItemTarget(final MOB mob, final String itemName)\n\t{\n\t\tItem target=null;\n\t\t//if(target == null)\n\t\t\ttarget=mob.findItem(itemName);\n\t\tif(target == null)\n\t\t\ttarget=mob.location().findItem(itemName);\n\t\tif(target==null)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tfinal List<Item> items=CMLib.map().findRoomItems(mob.location().getArea().getProperMap(), mob,itemName,true,100);\n\t\t\t\tif(items.size()==0)\n\t\t\t\t\titems.addAll(CMLib.map().findRoomItems(CMLib.map().rooms(), mob,itemName,true,100));\n\t\t\t\tfor(final Item item2 : items)\n\t\t\t\t{\n\t\t\t\t\tfinal Room R=CMLib.map().roomLocation(item2);\n\t\t\t\t\tif(CMSecurity.isAllowed(mob,R,CMSecurity.SecFlag.STAT))\n\t\t\t\t\t{\n\t\t\t\t\t\ttarget=item2;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (final NoSuchElementException nse)\n\t\t\t{\n\t\t\t}\n\t\t}\n\t\tif(target==null)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tfinal List<Item> items=CMLib.map().findInventory(mob.location().getArea().getProperMap(), mob,itemName,100);\n\t\t\t\tif(items.size()==0)\n\t\t\t\t\titems.addAll(CMLib.map().findInventory(CMLib.map().rooms(), mob,itemName,100));\n\t\t\t\tfor(final Item item2 : items)\n\t\t\t\t{\n\t\t\t\t\tfinal Room R=CMLib.map().roomLocation(item2);\n\t\t\t\t\tif(CMSecurity.isAllowed(mob,R,CMSecurity.SecFlag.STAT))\n\t\t\t\t\t{\n\t\t\t\t\t\ttarget=item2;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (final NoSuchElementException nse)\n\t\t\t{\n\t\t\t}\n\t\t}\n\t\treturn target;\n\t}\n\n\tprotected void addCharStatsPhys(final PhyStats pstats, final int headerWidth, final int numberWidth, final int[] col, final StringBuilder str)\n\t{\n\t\tfor(int i=0;i<pstats.getStatCodes().length;i++)\n\t\t{\n\t\t\tstr.append("^c"+CMStrings.padRight(pstats.getStatCodes()[i]+"^w", headerWidth));\n\t\t\tstr.append(" ");\n\t\t\tstr.append(CMStrings.padRight(""+pstats.getStat(pstats.getStatCodes()[i]), numberWidth));\n\t\t\tcol[0]++;\n\t\t\tif(col[0]==4)\n\t\t\t\tstr.append("\\n\\r");\n\t\t}\n\t\tfor(int i=0;i<PhyStats.CAN_SEE_CODES.length;i++)\n\t\t{\n\t\t\tstr.append("^c"+CMStrings.padRight(PhyStats.CAN_SEE_CODES[i]+"^w", headerWidth));\n\t\t\tstr.append(" ");\n\t\t\tstr.append(CMStrings.padRight(""+CMath.isSet(pstats.sensesMask(), i), numberWidth));\n\t\t\tcol[0]++;\n\t\t\tif(col[0]==4)\n\t\t\t\tstr.append("\\n\\r");\n\t\t}\n\t\tfor(int i=0;i<PhyStats.IS_CODES.length;i++)\n\t\t{\n\t\t\tstr.append("^c"+CMStrings.padRight(PhyStats.IS_CODES[i]+"^w", headerWidth));\n\t\t\tstr.append(" ");\n\t\t\tstr.append(CMStrings.padRight(""+CMath.isSet(pstats.disposition(), i), numberWidth));\n\t\t\tcol[0]++;\n\t\t\tif(col[0]==4)\n\t\t\t\tstr.append("\\n\\r");\n\t\t}\n\t}\n\n\tprotected String getPrivilegedStat(final MOB mob, MOB target, final List<String> commands, final boolean overrideAuthCheck) throws IOException\n\t{\n\t\tStringBuilder str=new StringBuilder("");\n\t\tint ableTypes=-1;\n\t\tif(commands.size()>1)\n\t\t{\n\t\t\tfinal String s=commands.get(0).toUpperCase();\n\t\t\tfor(int i=0;i<ABLETYPE_DESCS.length;i++)\n\t\t\t{\n\t\t\t\tfor(int is=0;is<ABLETYPE_DESCS[i].length;is++)\n\t\t\t\t{\n\t\t\t\t\tif(s.equals(ABLETYPE_DESCS[i][is]))\n\t\t\t\t\t{\n\t\t\t\t\t\tableTypes=-2 -i;\n\t\t\t\t\t\tcommands.remove(0);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(ableTypes==-1)\n\t\t\t{\n\t\t\t\tfor(int a=0;a<Ability.ACODE_DESCS.length;a++)\n\t\t\t\t{\n\t\t\t\t\tif((Ability.ACODE_DESCS[a]+"S").equals(s)||(Ability.ACODE_DESCS[a]).equals(s))\n\t\t\t\t\t{\n\t\t\t\t\t\tableTypes=a;\n\t\t\t\t\t\tcommands.remove(0);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfinal String MOBname=CMParms.combine(commands,0);\n\t\tif(target == null)\n\t\t\ttarget=getMOBTarget(mob,MOBname);\n\t\tif((target!=null)\n\t\t&&(((target.isMonster())&&(CMSecurity.isAllowed(mob, target.location(), CMSecurity.SecFlag.CMDMOBS)))\n\t\t\t||(overrideAuthCheck)\n\t\t\t||((target.isPlayer())&&(CMSecurity.isAllowed(mob, target.location(), CMSecurity.SecFlag.CMDPLAYERS)))))\n\t\t{\n\t\t\tif(ableTypes>=0)\n\t\t\t{\n\t\t\t\tfinal List<Integer> V=new ArrayList<Integer>();\n\t\t\t\tfinal int mask=Ability.ALL_ACODES;\n\t\t\t\tV.add(Integer.valueOf(ableTypes));\n\t\t\t\tstr=getAbilities(mob,target,V,mask,false,-1);\n\t\t\t}\n\t\t\telse\n\t\t\tif(ableTypes==ABLETYPE_EQUIPMENT)\n\t\t\t\tstr=CMLib.commands().getEquipment(mob,target);\n\t\t\telse\n\t\t\tif(ableTypes==ABLETYPE_INVENTORY)\n\t\t\t\tstr=CMLib.commands().getInventory(mob,target);\n\t\t\telse\n\t\t\tif(ableTypes==ABLETYPE_QUESTWINS)\n\t\t\t{\n\t\t\t\tstr.append(L("Quests won by @x1: ",target.Name()));\n\t\t\t\tfinal StringBuffer won=new StringBuffer("");\n\t\t\t\tfor(int q=0;q<CMLib.quests().numQuests();q++)\n\t\t\t\t{\n\t\t\t\t\tfinal Quest Q=CMLib.quests().fetchQuest(q);\n\t\t\t\t\tfinal Long wonTime = Q.whenLastWon(target.Name());\n\t\t\t\t\tif(wonTime != null)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal String name=Q.displayName().trim().length()>0?Q.displayName():Q.name();\n\t\t\t\t\t\twon.append(" "+name+" on "+CMLib.time().date2String(wonTime.longValue())+" ,");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(won.length()==0)\n\t\t\t\t\twon.append(L(" None!"));\n\t\t\t\twon.deleteCharAt(won.length()-1);\n\t\t\t\tstr.append(won);\n\t\t\t\tstr.append("\\n\\r");\n\t\t\t}\n\t\t\telse\n\t\t\tif(ableTypes==ABLETYPE_TITLES)\n\t\t\t{\n\t\t\t\tstr.append(L("Titles:"));\n\t\t\t\tfinal StringBuffer ttl=new StringBuffer("");\n\t\t\t\tif(target.playerStats()!=null)\n\t\t\t\t{\n\t\t\t\t\tfinal List<String> roTitles = target.playerStats().getTitles();\n\t\t\t\t\tfor(int t=0;t<roTitles.size();t++)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal String title = roTitles.get(t);\n\t\t\t\t\t\tttl.append(" "+title+",");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(ttl.length()==0)\n\t\t\t\t\tttl.append(L(" None!"));\n\t\t\t\tttl.deleteCharAt(ttl.length()-1);\n\t\t\t\tstr.append(ttl);\n\t\t\t\tstr.append("\\n\\r");\n\t\t\t}\n\t\t\telse\n\t\t\tif(ableTypes==ABLETYPE_SCRIPTS)\n\t\t\t{\n\t\t\t\tstr.append(L("Scripts covered:\\n\\r"));\n\t\t\t\tint q=1;\n\t\t\t\tfor(final Enumeration<ScriptingEngine> e=target.scripts();e.hasMoreElements();q++)\n\t\t\t\t{\n\t\t\t\t\tfinal ScriptingEngine SE=e.nextElement();\n\t\t\t\t\tstr.append(L("Script #@x1\\n\\r",""+q));\n\t\t\t\t\tstr.append(L("Quest: @x1\\n\\r",SE.defaultQuestName()));\n\t\t\t\t\tstr.append(L("Savable: @x1\\n\\r",""+SE.isSavable()));\n\t\t\t\t\tstr.append(L("Scope: @x1\\n\\r",SE.getVarScope()));\n\t\t\t\t\tstr.append(L("Vars: @x1\\n\\r",SE.getLocalVarXML()));\n\t\t\t\t\tstr.append(L("Script: @x1\\n\\r",SE.getScript()));\n\t\t\t\t\tstr.append("\\n\\r");\n\t\t\t\t}\n\t\t\t\tstr.append("\\n\\r");\n\t\t\t}\n\t\t\telse\n\t\t\tif(ableTypes==ABLETYPE_TATTOOS)\n\t\t\t{\n\t\t\t\tstr.append(L("Tattoos:"));\n\t\t\t\tfor(final Enumeration<Tattoo> e=target.tattoos();e.hasMoreElements();)\n\t\t\t\t\tstr.append(" "+e.nextElement().getTattooName()+",");\n\t\t\t\tstr.deleteCharAt(str.length()-1);\n\t\t\t\tstr.append("\\n\\r");\n\t\t\t}\n\t\t\telse\n\t\t\tif(ableTypes==ABLETYPE_AFFECTS)\n\t\t\t{\n\t\t\t\tstr.append(L("Effects:"));\n\t\t\t\tfor(final Enumeration<Ability> e=target.effects();e.hasMoreElements();)\n\t\t\t\t\tstr.append(" "+e.nextElement().Name()+",");\n\t\t\t\tstr.deleteCharAt(str.length()-1);\n\t\t\t\tstr.append("\\n\\r");\n\t\t\t}\n\t\t\telse\n\t\t\tif(ableTypes==ABLETYPE_FACTIONS)\n\t\t\t{\n\t\t\t\tstr.append(L("Factions:\\n\\r"));\n\t\t\t\tfor(final Enumeration<String> f=target.factions();f.hasMoreElements();)\n\t\t\t\t{\n\t\t\t\t\tfinal Faction F=CMLib.factions().getFaction(f.nextElement());\n\t\t\t\t\tif(F!=null)\n\t\t\t\t\t\tstr.append("^W[^H"+F.name()+"^N("+F.factionID()+"): "+target.fetchFaction(F.factionID())+"^W]^N, ");\n\t\t\t\t}\n\t\t\t\tstr.append("\\n\\r");\n\t\t\t}\n\t\t\telse\n\t\t\tif(ableTypes == ABLETYPE_LEVELTIMES)\n\t\t\t{\n\t\t\t\tif(target.playerStats() != null)\n\t\t\t\t{\n\t\t\t\t\tlong lastDateTime=-1;\n\t\t\t\t\tfor(int level=0;level<=target.phyStats().level();level++)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal long dateTime=target.playerStats().leveledDateTime(level);\n\t\t\t\t\t\tfinal long ageMinutes=target.playerStats().leveledMinutesPlayed(level);\n\t\t\t\t\t \tfinal String roomID=target.playerStats().leveledRoomID(level);\n\t\t\t\t\t\tif((dateTime>1529122205)&&(dateTime!=lastDateTime))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlastDateTime = dateTime;\n\t\t\t\t\t\t\tif(level==0)\n\t\t\t\t\t\t\t \tstr.append(CMStrings.padRight(L("Created"),8));\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t \tstr.append(CMStrings.padRight(""+level,8));\n\t\t\t\t\t\t\tstr.append(CMStrings.padRight(CMLib.time().date2String(dateTime),21));\n\t\t\t\t\t\t\tstr.append(CMStrings.padRight(""+CMLib.time().date2EllapsedTime(ageMinutes * 60000L,TimeUnit.MINUTES,true),17));\n\t\t\t\t\t\t\tfinal Room R=CMLib.map().getRoom(roomID);\n\t\t\t\t\t\t\tif(R==null)\n\t\t\t\t\t\t\t\tstr.append(roomID);\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tstr.append(CMStrings.limit(R.displayText(), 25)).append("("+roomID+")");\n\t\t\t\t\t\t\tstr.append("\\n\\r");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tstr.append("\\n\\r");\n\t\t\t}\n\t\t\telse\n\t\t\tif(ableTypes==ABLETYPE_CHARSTATS)\n\t\t\t{\n\t\t\t\tstr.append(L("^XCurrent Character Statistics:^.^N\\n\\r"));\n\t\t\t\tfinal int[] col={0};\n\t\t\t\tfinal int headerWidth=CMLib.lister().fixColWidth(12, mob);\n\t\t\t\tfinal int numberWidth=CMLib.lister().fixColWidth(6, mob);\n\t\t\t\taddCharStatsChars(target.charStats(), headerWidth, numberWidth, col, str);\n\t\t\t\taddCharStatsPhys(target.phyStats(), headerWidth, numberWidth, col, str);\n\t\t\t\taddCharStatsState(target.curState(), headerWidth, numberWidth, col, str);\n\t\t\t\tif(target.playerStats()!=null)\n\t\t\t\t\taddCharThing(headerWidth,numberWidth,col,str,"STINK",CMath.toPct(target.playerStats().getHygiene()/PlayerStats.HYGIENE_DELIMIT));\n\t\t\t\tstr.append("\\n\\r\\n\\r");\n\t\t\t\tstr.append(L("^XBase Character Statistics:^.^N\\n\\r"));\n\t\t\t\tcol[0]=0;\n\t\t\t\taddCharStatsChars(target.baseCharStats(), headerWidth, numberWidth, col, str);\n\t\t\t\taddCharStatsPhys(target.basePhyStats(), headerWidth, numberWidth, col, str);\n\t\t\t\taddCharStatsState(target.baseState(), headerWidth, numberWidth, col, str);\n\t\t\t\tstr.append("\\n\\r\\n\\r");\n\t\t\t\tstr.append(L("^XMax Character State:^.^N\\n\\r"));\n\t\t\t\tcol[0]=0;\n\t\t\t\taddCharStatsState(target.maxState(), headerWidth, numberWidth, col, str);\n\t\t\t\tstr.append("\\n\\r");\n\t\t\t}\n\t\t\telse\n\t\t\tif(ableTypes==ABLETYPE_WORLDEXPLORED)\n\t\t\t{\n\t\t\t\tif(target.playerStats()!=null)\n\t\t\t\t\tif((target.playerStats()!=null)&&(CMProps.isUsingAccountSystem()))\r\n\t\t\t\t\t\tstr.append(L("\\n\\r^xMember of Account:^.^N ^w@x1^?",(target.playerStats().getAccount()!=null)?target.playerStats().getAccount().getAccountName():L("None"))).append("\\n\\r");\r\n\t\t\t\t\tstr.append(CMLib.commands().getScore(target));\r\n\t\t\t\t\tif(target.playerStats()!=null)\r\n\t\t\t\t\t\tCMLib.genEd().modifyPlayer(mob, target, -950);\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tCMLib.genEd().genMiscSet(mob, target, -950);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\t\t\t}\n\t\t\t\t\tstr=new StringBuilder(str.toString().substring(0,str.toString().length()-2)+"\\n\\r");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tstr.append(L("Exploration data is not kept on mobs.\\n\\r"));\n\t\t\t}\n\t\t\telse\n\t\t\tif(ableTypes==ABLETYPE_ROOMSEXPLORED)\n\t\t\t{\n\t\t\t\tif(target.playerStats()!=null)\n\t\t\t\t{\n\t\t\t\t\tfor(final Enumeration<Room> e=CMLib.map().rooms();e.hasMoreElements();)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal Room R=e.nextElement();\n\t\t\t\t\t\tif((R.roomID().length()>0)&&(target.playerStats().hasVisited(R)))\n\t\t\t\t\t\t\tstr.append("^H"+R.roomID()+"^N, ");\n\t\t\t\t\t}\n\t\t\t\t\tstr=new StringBuilder(str.toString().substring(0,str.toString().length()-2)+"\\n\\r");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tstr.append(L("Exploration data is not kept on mobs.\\n\\r"));\n\t\t\t}\n\t\t\telse\n\t\t\tif(ableTypes==ABLETYPE_COMBAT)\n\t\t\t{\n\t\t\t\tfinal PlayerStats pStats = target.playerStats();\n\t\t\t\tif((pStats != null)\n\t\t\t\t&&(!CMSecurity.isDisabled(CMSecurity.DisFlag.COMBATSTATS)))\n\t\t\t\t{\n\t\t\t\t\tfinal int level=target.basePhyStats().level();\n\t\t\t\t\tlong combats = pStats.bumpLevelCombatStat(PlayerCombatStat.COMBATS_TOTAL, level, 0);\n\t\t\t\t\tif(combats == 0)\n\t\t\t\t\t\tcombats=1;\n\t\t\t\t\tlong rounds = pStats.bumpLevelCombatStat(PlayerCombatStat.ROUNDS_TOTAL, level, 0);\n\t\t\t\t\tif(rounds == 0)\n\t\t\t\t\t\trounds=1;\n\t\t\t\t\tEnvironmental itarget=getItemTarget(mob, restWords);\r\n\t\t\t\t\tif(itarget!=null)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tCMLib.genEd().genMiscSet(mob, itarget, -950);\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\t.append(pStats.bumpLevelCombatStat(PlayerCombatStat.DEATHS_DONE, level, 0))\n\t\t\t\t\t\t.append("\\n\\r");\n\t\t\t\t\tstr.append(CMStrings.padRight(L("Total Deaths"),20)).append(": ")\n\t\t\t\t\t\t.append(pStats.bumpLevelCombatStat(PlayerCombatStat.DEATHS_TAKEN, level, 0))\n\t\t\t\t\t\t.append("\\n\\r");\n\t\t\t\t\tstr.append(CMStrings.padRight(L("Experience"),20)).append(": ")\n\t\t\t\t\t\t.append(CMStrings.padRight(""+xp,15))\n\t\t\t\t\t\t.append(" ").append(CMath.round(CMath.div(xp,combats),2)).append("/combat ")\n\t\t\t\t\t\t.append(", ").append(CMath.round(CMath.div(xp,rounds),2)).append("/round")\n\t\t\t\t\t\t.append("\\n\\r");\n\t\t\t\t\tstr.append(CMStrings.padRight(L("Damage Done"),20)).append(": ")\n\t\t\t\t\t\t.append(CMStrings.padRight(""+damage,15))\n\t\t\t\t\t\t.append(" ").append(CMath.round(CMath.div(damage,combats),2)).append("/combat ")\n\t\t\t\t\t\t.append(", ").append(CMath.round(CMath.div(damage,rounds),2)).append("/round")\n\t\t\t\t\t\t.append("\\n\\r");\n\t\t\t\t\tstr.append(CMStrings.padRight(L("Damage Taken"),20)).append(": ")\n\t\t\t\t\t\t.append(CMStrings.padRight(""+hurt,15))\n\t\t\t\t\t\t.append(" ").append(CMath.round(CMath.div(hurt,combats),2)).append("/combat ")\n\t\t\t\t\t\t.append(", ").append(CMath.round(CMath.div(hurt,rounds),2)).append("/round")\n\t\t\t\t\t\t.append("\\n\\r");\n\t\t\t\t\tstr.append(CMStrings.padRight(L("Hits Done"),20)).append(": ")\n\t\t\t\t\t\t.append(CMStrings.padRight(""+hits,15))\n\t\t\t\t\t\t.append(" ").append(CMath.round(CMath.div(hits,combats),2)).append("/combat ")\n\t\t\t\t\t\t.append(", ").append(CMath.round(CMath.div(hits,rounds),2)).append("/round")\n\t\t\t\t\t\t.append("\\n\\r");\n\t\t\t\t\tstr.append(CMStrings.padRight(L("Hits Taken"),20)).append(": ")\n\t\t\t\t\t\t.append(CMStrings.padRight(""+hitstaken,15))\n\t\t\t\t\t\t.append(" ").append(CMath.round(CMath.div(hitstaken,combats),2)).append("/combat ")\n\t\t\t\t\t\t.append(", ").append(CMath.round(CMath.div(hitstaken,rounds),2)).append("/round")\n\t\t\t\t\t\t.append("\\n\\r");\n\t\t\t\t\tstr.append(CMStrings.padRight(L("Actions Done"),20)).append(": ")\n\t\t\t\t\t\t.append(CMStrings.padRight(""+actions,15))\n\t\t\t\t\t\t.append(" ").append(CMath.round(CMath.div(actions,combats),2)).append("/combat ")\n\t\t\t\t\t\t.append(", ").append(CMath.round(CMath.div(actions,rounds),2)).append("/round")\n\t\t\t\t\t\t.append("\\n\\r");\n\t\t\t\t\tstr.append("^W-------------------------\\n\\r");\n\t\t\t\t}\n\t\t\t\tstr.append(L("\\n\\r^cCombat summary:\\n\\r\\n\\r^N"));\n\t\t\t\tfinal MOB M=CMClass.getMOB("StdMOB");\n\t\t\t\tM.setBaseCharStats((CharStats)target.baseCharStats().copyOf());\n\t\t\t\tM.setBasePhyStats((PhyStats)target.basePhyStats().copyOf());\n\t\t\t\tM.setBaseState((CharState)target.baseState().copyOf());\n\t\t\t\trecoverMOB(target);\n\t\t\t\trecoverMOB(M);\n\t\t\t\tint base=M.basePhyStats().attackAdjustment();\n\t\t\t\tstr.append("^c"+CMStrings.padRight(L("Base Attack"),40)+": ^W"+base+"\\n\\r");\n\t\t\t\tfor(int i=0;i<target.numItems();i++)\n\t\t\t\t{\n\t\t\t\t\tfinal Item I=target.getItem(i);\n\t\t\t\t\tif ((I != null) && (!I.amWearingAt(Wearable.IN_INVENTORY)))\n\t\t\t\t\t{\n\t\t\t\t\t\trecoverMOB(M);\n\t\t\t\t\t\tbase = M.phyStats().attackAdjustment();\n\t\t\t\t\t\ttestMOB(target, M, I);\n\t\t\t\t\t\tfinal int diff = M.phyStats().attackAdjustment() - base;\n\t\t\t\t\t\treportOnDiffMOB(I, diff, str);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trecoverMOB(M);\n\t\t\t\tfor(final Enumeration<Ability> a=target.effects();a.hasMoreElements();)\n\t\t\t\t{\n\t\t\t\t\tfinal Ability A=a.nextElement();\n\t\t\t\t\tif (A != null)\n\t\t\t\t\t{\n\t\t\t\t\t\trecoverMOB(M);\n\t\t\t\t\t\tbase = M.phyStats().attackAdjustment();\n\t\t\t\t\t\ttestMOB(target, M, A);\n\t\t\t\t\t\tfinal int diff = M.phyStats().attackAdjustment() - base;\n\t\t\t\t\t\treportOnDiffMOB(A, diff, str);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\t\t\titarget=mob.location().fetchExit(MOBname);\r\n\t\t\t\t\t\tif(itarget!=null)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tCMLib.genEd().genMiscSet(mob, itarget, -950);\r\n\t\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbase = M.phyStats().armor();\n\t\t\t\t\t\ttestMOB(target, M, I);\n\t\t\t\t\t\tfinal int diff = M.phyStats().armor() - base;\n\t\t\t\t\t\treportOnDiffMOB(I, diff, str);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trecoverMOB(M);\n\t\t\t\tfor(final Enumeration<Ability> a=target.effects();a.hasMoreElements();)\n\t\t\t\t{\n\t\t\t\t\tfinal Ability A=a.nextElement();\n\t\t\t\t\tif (A != null)\n\t\t\t\t\t{\n\t\t\t\t\t\trecoverMOB(M);\n\t\t\t\t\t\tbase = M.phyStats().armor();\n\t\t\t\t\t\ttestMOB(target, M, A);\n\t\t\t\t\t\tfinal int diff = M.phyStats().armor() - base;\n\t\t\t\t\t\treportOnDiffMOB(A, diff, str);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trecoverMOB(target);\n\t\t\t\trecoverMOB(M);\n\t\t\t\treportOnDiffMOB("Other Stuff", CMLib.combat().adjustedArmor(target)-M.basePhyStats().attackAdjustment(), str);\n\t\t\t\tstr.append("^W-------------------------\\n\\r");\n\t\t\t\tstr.append("^C"+CMStrings.padRight(L("Total"),40)+": ^W"+CMLib.combat().adjustedArmor(target)+"\\n\\r");\n\t\t\t\tstr.append("\\n\\r");\n\t\t\t\tbase=M.basePhyStats().damage();\n\t\t\t\tstr.append("^C"+CMStrings.padRight(L("Base Damage"),40)+": ^W"+base+"\\n\\r");\n\t\t\t\tfor(int i=0;i<target.numItems();i++)\n\t\t\t\t{\n\t\t\t\t\tfinal Item I=target.getItem(i);\n\t\t\t\t\tif (I != null)\n\t\t\t\t\t{\n\t\t\t\t\t\trecoverMOB(M);\n\t\t\t\t\t\tbase = M.phyStats().damage();\n\t\t\t\t\t\ttestMOB(target, M, I);\n\t\t\t\t\t\tfinal int diff = M.phyStats().damage() - base;\n\t\t\t\t\t\treportOnDiffMOB(I, diff, str);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trecoverMOB(M);\n\t\t\t\tfor(final Enumeration<Ability> a=target.effects();a.hasMoreElements();)\n\t\t\t\t{\n\t\t\t\t\tfinal Ability A=a.nextElement();\n\t\t\t\t\tif (A != null)\n\t\t\t\t\t{\n\t\t\t\t\t\trecoverMOB(M);\n\t\t\t\t\t\tbase = M.phyStats().damage();\n\t\t\t\t\t\ttestMOB(target, M, A);\n\t\t\t\t\t\tfinal int diff = M.phyStats().damage() - base;\n\t\t\t\t\t\treportOnDiffMOB(A, diff, str);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trecoverMOB(target);\n\t\t\t\trecoverMOB(M);\n\t\t\t\treportOnDiffMOB("Other Stuff", CMLib.combat().adjustedDamage(target,null,null,0, false, false)-M.basePhyStats().damage(), str);\n\t\t\t\tstr.append("^W-------------------------\\n\\r");\n\t\t\t\tstr.append("^C"+CMStrings.padRight(L("Total"),40)+": ^W"+CMLib.combat().adjustedDamage(target, null, null, 0, false, false)+"\\n\\r");\n\t\t\t\tstr.append("\\n\\r");\n\t\t\t\tbase=(int)Math.round(M.phyStats().speed()*100);\n\t\t\t\tstr.append("^C"+CMStrings.padRight(L("Base Attacks%"),40)+": ^W"+base+"\\n\\r");\n\t\t\t\tfor(int i=0;i<target.numItems();i++)\n\t\t\t\t{\n\t\t\t\t\tfinal Item I=target.getItem(i);\n\t\t\t\t\tif (I != null)\n\t\t\t\t\t{\n\t\t\t\t\t\trecoverMOB(M);\n\t\t\t\t\t\tbase = (int) Math.round(M.phyStats().speed() * 100);\n\t\t\t\t\t\ttestMOB(target, M, I);\n\t\t\t\t\t\tfinal int diff = (int) Math.round(M.phyStats().speed() * 100) - base;\n\t\t\t\t\t\treportOnDiffMOB(I, diff, str);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trecoverMOB(M);\n\t\t\t\tfor(final Enumeration<Ability> a=target.effects();a.hasMoreElements();)\n\t\t\t\t{\n\t\t\t\t\tfinal Ability A=a.nextElement();\n\t\t\t\t\tif (A != null)\n\t\t\t\t\t{\n\t\t\t\t\t\trecoverMOB(M);\n\t\t\t\t\t\tbase = (int) Math.round(M.phyStats().speed() * 100);\n\t\t\t\t\t\ttestMOB(target, M, A);\n\t\t\t\t\t\tfinal int diff = (int) Math.round(M.phyStats().speed() * 100) - base;\n\t\t\t\t\t\treportOnDiffMOB(A, diff, str);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trecoverMOB(target);\n\t\t\t\trecoverMOB(M);\n\t\t\t\tstr.append("^W-------------------------\\n\\r");\n\t\t\t\tstr.append("^C"+CMStrings.padRight(L("Total"),40)+": ^W"+(int)Math.round(target.phyStats().speed()*100)+"\\n\\r");\n\t\t\t\tstr.append("\\n\\r");\n\t\t\t\tbase=M.maxState().getHitPoints();\n\t\t\t\tstr.append("^C"+CMStrings.padRight(L("Base Hit Points"),40)+": ^W"+base+"\\n\\r");\n\t\t\t\tfor(int i=0;i<target.numItems();i++)\n\t\t\t\t{\n\t\t\t\t\tfinal Item I=target.getItem(i);\n\t\t\t\t\tif (I != null)\n\t\t\t\t\t{\n\t\t\t\t\t\trecoverMOB(M);\n\t\t\t\t\t\tbase = M.maxState().getHitPoints();\n\t\t\t\t\t\ttestMOB(target, M, I);\n\t\t\t\t\t\tfinal int diff = M.maxState().getHitPoints() - base;\n\t\t\t\t\t\treportOnDiffMOB(I, diff, str);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trecoverMOB(M);\n\t\t\t\tfor(int i=0;i<target.numAllEffects();i++)\n\t\t\t\t{\n\t\t\t\t\tfinal Ability A=target.fetchEffect(i);\n\t\t\t\t\tif (A != null)\n\t\t\t\t\t{\n\t\t\t\t\t\trecoverMOB(M);\n\t\t\t\t\t\tbase = M.maxState().getHitPoints();\n\t\t\t\t\t\ttestMOB(target, M, A);\n\t\t\t\t\t\tfinal int diff = M.maxState().getHitPoints() - base;\n\t\t\t\t\t\treportOnDiffMOB(A, diff, str);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trecoverMOB(M);\n\t\t\t\tstr.append("^W-------------------------\\n\\r");\n\t\t\t\tstr.append("^C"+CMStrings.padRight(L("Total"),40)+": ^W"+target.maxState().getHitPoints()+"\\n\\r");\n\t\t\t\trecoverMOB(target);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif((target.playerStats()!=null)&&(CMProps.isUsingAccountSystem()))\n\t\t\t\t\tstr.append(L("\\n\\r^xMember of Account:^.^N ^w@x1^?",(target.playerStats().getAccount()!=null)?target.playerStats().getAccount().getAccountName():L("None"))).append("\\n\\r");\n\t\t\t\tstr.append(CMLib.commands().getScore(target));\n\t\t\t\tfor(final Enumeration<Quest> q= CMLib.quests().enumQuests();q.hasMoreElements();)\n\t\t\t\t{\n\t\t\t\t\tfinal Quest Q=q.nextElement();\n\t\t\t\t\tif((Q!=null)\n\t\t\t\t\t&&(Q.running())\n\t\t\t\t\t&&(Q.isObjectInUse(target)))\n\t\t\t\t\t\tstr.append(L("\\n\\r^xIn use by quest:^.^N ^w@x1^?",Q.name())).append("\\n\\r");\n\t\t\t\t}\n\t\t\t\tCMLib.genEd().genMiscSet(mob, target, -950);\n\t\t\t}\n\t\t}\n\t\treturn str.toString();\n\t}\n\n\t@Override\n\tpublic boolean execute(final MOB mob, final List<String> commands, final int metaFlags)\n\t\tthrows java.io.IOException\n\t{\n\t\tcommands.remove(0);\n\t\tif(((commands.size()>0)&&commands.get(0).equals("?"))\n\t\t||((commands.size()==0)&&(!(CMSecurity.isAllowed(mob,mob.location(),CMSecurity.SecFlag.STAT)))))\n\t\t{\n\t\t\tfinal StringBuilder msg = new StringBuilder("STAT allows the following options: \\n\\r");\n\t\t\tfor(final String stat : mob.curState().getStatCodes())\n\t\t\t\tmsg.append(stat).append(", ");\n\t\t\tfor(final String stat : mob.curState().getStatCodes())\n\t\t\t\tmsg.append("MAX"+stat).append(", ");\n\t\t\tfor(final String stat : mob.charStats().getStatCodes())\n\t\t\t\tmsg.append(stat).append(", ");\n\t\t\tfor(final String stat : mob.charStats().getStatCodes())\n\t\t\t\tmsg.append("BASE"+stat).append(", ");\n\t\t\tfor(final String stat : mob.phyStats().getStatCodes())\n\t\t\t\tmsg.append(stat).append(", ");\n\t\t\tmsg.append("STINK, XP, XPTNL, XPFNL, QUESTPOINTS, TRAINS, PRACTICES, HEALTH, RESISTS, ATTRIBUTES");\n\t\t\tfor(final Enumeration<Faction> f=CMLib.factions().factions();f.hasMoreElements();)\n\t\t\t{\n\t\t\t\tfinal Faction F=f.nextElement();\n\t\t\t\tif((F!=null)&&(F.showInScore()))\n\t\t\t\t\tmsg.append(", "+F.name().toUpperCase().replace(\' \',\'_\'));\n\t\t\t}\n\t\t\tif(CMSecurity.isAllowed(mob,mob.location(),CMSecurity.SecFlag.STAT))\n\t\t\t{\n\t\t\t\tmsg.append(L(", [MOB/PLAYER NAME], [NUMBER] [DAYS/WEEKS/MONTHS], "));\n\t\t\t\tfor (final String[] element : ABLETYPE_DESCS)\n\t\t\t\t\tmsg.append(element[0]+", ");\n\t\t\t\tmsg.append(CMParms.toListString(Ability.ACODE_DESCS));\n\t\t\t}\n\t\t\tmob.tell(msg.toString());\n\t\t\treturn false;\n\t\t}\n\t\tfinal StringBuilder str=new StringBuilder("");\n\t\tif(CMSecurity.isAllowed(mob,mob.location(),CMSecurity.SecFlag.STAT))\n\t\t{\n\t\t\tif(commands.size()==0)\n\t\t\t\tcommands.add("TODAY");\n\t\t\tfinal String s1=(commands.size()>0)?commands.get(0).toUpperCase():"";\n\t\t\tfinal String s2=(commands.size()>1)?commands.get(1).toUpperCase():"";\n\t\t\tif(s1.equalsIgnoreCase("TODAY"))\n\t\t\t\treturn showTableStats(mob,1,1,CMParms.combine(commands,1));\n\t\t\telse\n\t\t\tif((commands.size()==1)\n\t\t\t&&(s1.equalsIgnoreCase("SKILLUSE")||s1.equalsIgnoreCase("AREA")||s1.equalsIgnoreCase("QUEST")||s1.equalsIgnoreCase("CRIME")))\n\t\t\t\treturn showTableStats(mob,1,1,CMParms.combine(commands,0));\n\t\t\telse\n\t\t\tif(commands.size()>1)\n\t\t\t{\n\t\t\t\tfinal String rest=(commands.size()>2)?CMParms.combine(commands,2):"";\n\t\t\t\tif(s2.equals("DAY")&&(CMath.isNumber(s1)))\n\t\t\t\t\treturn showTableStats(mob,(CMath.s_int(s1)),1,rest);\n\t\t\t\telse\n\t\t\t\tif(s2.equals("DAYS")&&(CMath.isNumber(s1)))\n\t\t\t\t\treturn showTableStats(mob,(CMath.s_int(s1)),1,rest);\n\t\t\t\telse\n\t\t\t\tif(s2.equals("WEEK")&&(CMath.isNumber(s1)))\n\t\t\t\t\treturn showTableStats(mob,(CMath.s_int(s1)*7),7,rest);\n\t\t\t\telse\n\t\t\t\tif(s2.equals("WEEKS")&&(CMath.isNumber(s1)))\n\t\t\t\t\treturn showTableStats(mob,(CMath.s_int(s1)*7),7,rest);\n\t\t\t\telse\n\t\t\t\tif(s2.equals("MONTH")&&(CMath.isNumber(s1)))\n\t\t\t\t\treturn showTableStats(mob,(CMath.s_int(s1)*30),30,rest);\n\t\t\t\telse\n\t\t\t\tif(s2.equals("MONTHS")&&(CMath.isNumber(s1)))\n\t\t\t\t\treturn showTableStats(mob,(CMath.s_int(s1)*30),30,rest);\n\t\t\t\telse\n\t\t\t\tif(s2.equals("YEAR")&&(CMath.isNumber(s1)))\n\t\t\t\t\treturn showTableStats(mob,(CMath.s_int(s1)*365),365,rest);\n\t\t\t\telse\n\t\t\t\tif(s2.equals("YEARS")&&(CMath.isNumber(s1)))\n\t\t\t\t\treturn showTableStats(mob,(CMath.s_int(s1)*365),365,rest);\n\t\t\t}\n\t\t\tstr.append(this.getPrivilegedStat(mob, null, commands, false));\n\t\t}\n\t\tif((commands.size()>0)&&(str.length()==0))\n\t\t{\n\t\t\tString mobName=commands.get(commands.size()-1).toString();\n\t\t\tMOB M=mob;\n\t\t\tif(CMSecurity.isAllowed(mob,mob.location(),CMSecurity.SecFlag.STAT))\n\t\t\t{\n\t\t\t\tfinal String firstWord = (commands.size()> 1) ? commands.get(0) : "";\n\t\t\t\tfinal String restWords = (commands.size() > 1) ? CMParms.combine(commands,1) : "";\n\t\t\t\tmobName = CMParms.combine(commands,0);\n\t\t\t\tif(mobName.equalsIgnoreCase("ROOM"))\n\t\t\t\t{\n\t\t\t\t\tCMLib.genEd().modifyRoom(mob, mob.location(), -950);\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\tif(mobName.equalsIgnoreCase("AREA"))\n\t\t\t\t{\n\t\t\t\t\tfinal Set<Area> alsoUpdateAreas=new HashSet<Area>();\n\t\t\t\t\tCMLib.genEd().modifyArea(mob, mob.location().getArea(), alsoUpdateAreas, -950);\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\tif(firstWord.equalsIgnoreCase("CLAN"))\n\t\t\t\t{\n\t\t\t\t\tfinal Clan C=CMLib.clans().findClan(restWords);\n\t\t\t\t\tif(C!=null)\n\t\t\t\t\t{\n\t\t\t\t\t\tstr.setLength(0);\n\t\t\t\t\t\tstr.append(CMStrings.padRight(""+C.getClanLevel(),7)).append(": ").append(L("Clan Level")).append("\\n\\r");\n\t\t\t\t\t\tfor(final Clan.Trophy t : Clan.Trophy.values())\n\t\t\t\t\t\t\tstr.append(CMStrings.padRight(""+C.getTrophyData(t),7)).append(": ").append(L(t.codeString)).append("\\n\\r");\n\t\t\t\t\t\tmob.tell(str.toString());\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tmob.tell(L("You can\'t stat clan \'@x1\'!",restWords));\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\tif(firstWord.equalsIgnoreCase("EXIT"))\n\t\t\t\t{\n\t\t\t\t\tEnvironmental itarget=getItemTarget(mob, mobName);\n\t\t\t\t\tif(itarget==null)\n\t\t\t\t\t{\n\t\t\t\t\t\titarget=mob.location().fetchExit(mobName);\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tmob.tell(L("You can\'t stat exit \'@x1\'!",restWords));\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\tif(firstWord.equalsIgnoreCase("ITEM"))\n\t\t\t\t{\n\t\t\t\t\tfinal Environmental itarget=getItemTarget(mob, restWords);\n\t\t\t\t\tif(itarget!=null)\n\t\t\t\t\t{\n\t\t\t\t\t\tfor(final Enumeration<Quest> q= CMLib.quests().enumQuests();q.hasMoreElements();)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfinal Quest Q=q.nextElement();\n\t\t\t\t\t\t\tif((Q!=null)\n\t\t\t\t\t\t\t&&(Q.running())\n\t\t\t\t\t\t\t&&(Q.isObjectInUse(itarget)))\n\t\t\t\t\t\t\t\tmob.tell(L("\\n\\r^xIn use by quest:^.^N ^w@x1^?",Q.name()));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tCMLib.genEd().genMiscSet(mob, itarget, -950);\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tmob.tell(L("You can\'t stat item \'@x1\'!",restWords));\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\tif(firstWord.equalsIgnoreCase("ROOM"))\n\t\t\t\t{\n\t\t\t\t\tEnvironmental itarget = null;\n\t\t\t\t\ttry\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal List<Room> rooms=CMLib.map().findRooms(mob.location().getArea().getProperMap(), mob,restWords,true,100);\n\t\t\t\t\t\tif(rooms.size()==0)\n\t\t\t\t\t\t\trooms.addAll(CMLib.map().findRooms(mob.location().getArea().getProperMap(), mob,restWords,false,100));\n\t\t\t\t\t\tif(rooms.size()==0)\n\t\t\t\t\t\t\trooms.addAll(CMLib.map().findRooms(CMLib.map().rooms(), mob,restWords,true,100));\n\t\t\t\t\t\tif(rooms.size()==0)\n\t\t\t\t\t\t\trooms.addAll(CMLib.map().findRooms(CMLib.map().rooms(), mob,restWords,false,100));\n\t\t\t\t\t\tfor(final Room room : rooms)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfinal Room R=CMLib.map().roomLocation(room);\n\t\t\t\t\t\t\tif(CMSecurity.isAllowed(mob,R,CMSecurity.SecFlag.STAT))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\titarget=room;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcatch (final NoSuchElementException nse)\n\t\t\t\t\t{\n\t\t\t\t\t}\n\t\t\t\t\tif(itarget != null)\n\t\t\t\t\t{\n\t\t\t\t\t\tCMLib.genEd().modifyRoom(mob, (Room)itarget, -950);\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tmob.tell(L("You can\'t stat room \'@x1\'!",restWords));\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\tif(firstWord.equalsIgnoreCase("AREA"))\n\t\t\t\t{\n\t\t\t\t\tfinal Environmental itarget = CMLib.map().findArea(restWords);\n\t\t\t\t\tif(itarget != null)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal Set<Area> alsoUpdateAreas=new HashSet<Area>();\n\t\t\t\t\t\tCMLib.genEd().modifyArea(mob, (Area)itarget, alsoUpdateAreas, -950);\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tmob.tell(L("You can\'t stat area \'@x1\'!",restWords));\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tmobName=commands.get(commands.size()-1).toString();\n\t\t\t\t\tfinal MOB target=this.getMOBTarget(mob, mobName);\n\t\t\t\t\tif((target!=null)\n\t\t\t\t\t&&(((target.isMonster())&&(CMSecurity.isAllowed(mob, target.location(), CMSecurity.SecFlag.CMDMOBS)))\n\t\t\t\t\t\t||((target.isPlayer())&&(CMSecurity.isAllowed(mob, target.location(), CMSecurity.SecFlag.CMDPLAYERS)))))\n\t\t\t\t\t{\n\t\t\t\t\t\tM=target;\n\t\t\t\t\t\tcommands.remove(commands.size()-1);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tmobName = CMParms.combine(commands,0);\n\t\t\t\t\t\tEnvironmental itarget=null;\n\t\t\t\t\t\t//if(itarget==null)\n\t\t\t\t\t\t\titarget=this.getItemTarget(mob, mobName);\n\t\t\t\t\t\tif(itarget==null)\n\t\t\t\t\t\t\titarget=mob.location().fetchExit(mobName);\n\t\t\t\t\t\tif(itarget!=null)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfor(final Enumeration<Quest> q= CMLib.quests().enumQuests();q.hasMoreElements();)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfinal Quest Q=q.nextElement();\n\t\t\t\t\t\t\t\tif((Q!=null)\n\t\t\t\t\t\t\t\t&&(Q.running())\n\t\t\t\t\t\t\t\t&&(Q.isObjectInUse(itarget)))\n\t\t\t\t\t\t\t\t\tmob.tell(L("\\n\\r^xIn use by quest:^.^N ^w@x1^?",Q.name()));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tCMLib.genEd().genMiscSet(mob, itarget, -950);\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\titarget = CMLib.map().findArea(mobName);\n\t\t\t\t\t\t\tif(itarget != null)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfinal Set<Area> alsoUpdateAreas=new HashSet<Area>();\n\t\t\t\t\t\t\t\tCMLib.genEd().modifyArea(mob, (Area)itarget, alsoUpdateAreas, -950);\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttry\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tfinal List<Room> rooms=CMLib.map().findRooms(mob.location().getArea().getProperMap(), mob,mobName,true,100);\n\t\t\t\t\t\t\t\t\tif(rooms.size()==0)\n\t\t\t\t\t\t\t\t\t\trooms.addAll(CMLib.map().findRooms(mob.location().getArea().getProperMap(), mob,mobName,false,100));\n\t\t\t\t\t\t\t\t\tif(rooms.size()==0)\n\t\t\t\t\t\t\t\t\t\trooms.addAll(CMLib.map().findRooms(CMLib.map().rooms(), mob,mobName,true,100));\n\t\t\t\t\t\t\t\t\tif(rooms.size()==0)\n\t\t\t\t\t\t\t\t\t\trooms.addAll(CMLib.map().findRooms(CMLib.map().rooms(), mob,mobName,false,100));\n\t\t\t\t\t\t\t\t\tfor(final Room room : rooms)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tfinal Room R=CMLib.map().roomLocation(room);\n\t\t\t\t\t\t\t\t\t\tif(CMSecurity.isAllowed(mob,R,CMSecurity.SecFlag.STAT))\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\titarget=room;\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcatch (final NoSuchElementException nse)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif(itarget != null)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tCMLib.genEd().modifyRoom(mob, (Room)itarget, -950);\n\t\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tmob.tell(L("You can\'t stat mob/player/item/exit/clan/room/whatever \'@x1\'!",mobName));\n\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor(int i=0;i<commands.size()-1;i++)\n\t\t\t{\n\t\t\t\tif(commands.get(i).toString().toUpperCase().equals("MAX"))\n\t\t\t\t{\n\t\t\t\t\tcommands.remove(i);\n\t\t\t\t\tcommands.set(i,"MAX"+commands.get(i).toString());\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int i=0;i<commands.size()-1;i++)\n\t\t\t{\n\t\t\t\tif(commands.get(i).toString().toUpperCase().equals("BASE"))\n\t\t\t\t{\n\t\t\t\t\tcommands.remove(i);\n\t\t\t\t\tcommands.set(i,"BASE"+commands.get(i).toString());\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int i=0;i<commands.size()-1;i++)\n\t\t\t\tcommands.set(i,CMStrings.replaceAll(commands.get(i).toString()," ",""));\n\t\t\tfor(int i=0;i<commands.size();i++)\n\t\t\t{\n\t\t\t\tfinal String thisStat=commands.get(i).toString().toUpperCase().trim();\n\t\t\t\tboolean found=false;\n\t\t\t\tif(thisStat.equals("XP"))\n\t\t\t\t{\n\t\t\t\t\tstr.append(M.getExperience()).append(" ");\n\t\t\t\t\tfound=true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\tif(thisStat.equals("ATTRIBUTES"))\n\t\t\t\t{\n\t\t\t\t\tfinal CharStats CT=mob.charStats();\n\t\t\t\t\tfor(final int stat : CharStats.CODES.BASECODES())\n\t\t\t\t\t\tstr.append(CMStrings.capitalizeAndLower(CharStats.CODES.NAME(stat))+"("+CT.getStat(stat)).append(") ");\n\t\t\t\t\tfound=true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\tif(thisStat.equals("RESISTS"))\n\t\t\t\t{\n\t\t\t\t\tfinal CharStats CT=mob.charStats();\n\t\t\t\t\tfor(final int stat : CharStats.CODES.SAVING_THROWS())\n\t\t\t\t\t\tstr.append(CMStrings.capitalizeAndLower(CharStats.CODES.NAME(stat))+"("+CT.getStat(stat)).append(") ");\n\t\t\t\t\tfound=true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\tif(thisStat.equals("HEALTH"))\n\t\t\t\t{\n\t\t\t\t\tfor(final String stat : M.curState().getStatCodes())\n\t\t\t\t\t\tstr.append(CMStrings.capitalizeAndLower(stat)).append("(").append(M.curState().getStat(stat)).append(") ");\n\t\t\t\t\tfound=true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\tif(thisStat.equals("TRAINS"))\n\t\t\t\t{\n\t\t\t\t\tstr.append(M.getTrains()).append(" ");\n\t\t\t\t\tfound=true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\tif(thisStat.equals("PRACTICES"))\n\t\t\t\t{\n\t\t\t\t\tstr.append(M.getPractices()).append(" ");\n\t\t\t\t\tfound=true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\tif(thisStat.equals("ATTACK"))\n\t\t\t\t{\n\t\t\t\t\tstr.append(CMLib.combat().fightingProwessStr(M)).append(" ");\n\t\t\t\t\tfound=true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\tif(thisStat.equals("ARMOR"))\n\t\t\t\t{\n\t\t\t\t\tstr.append(CMLib.combat().armorStr(M)).append(" ");\n\t\t\t\t\tfound=true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\tif(thisStat.equals("DAMAGE"))\n\t\t\t\t{\n\t\t\t\t\tM.tell(""+M.phyStats().damage());\n\t\t\t\t\tstr.append(CMLib.combat().damageProwessStr(M)).append(" ");\n\t\t\t\t\tfound=true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\tif(thisStat.equals("QUESTPOINTS"))\n\t\t\t\t{\n\t\t\t\t\tstr.append(M.getQuestPoint()).append(" ");\n\t\t\t\t\tfound=true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\tif(thisStat.equals("XPTNL"))\n\t\t\t\t{\n\t\t\t\t\tstr.append(M.getExpNeededLevel()).append(" ");\n\t\t\t\t\tfound=true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\tif(thisStat.equals("XPFNL"))\n\t\t\t\t{\n\t\t\t\t\tstr.append(M.getExpNextLevel()).append(" ");\n\t\t\t\t\tfound=true;\n\t\t\t\t}\n\t\t\t\tif(!found)\n\t\t\t\t{\n\t\t\t\t\tfor(final String stat : M.curState().getStatCodes())\n\t\t\t\t\t{\n\t\t\t\t\t\tif(stat.equals(thisStat))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstr.append(M.curState().getStat(stat)).append(" ");\n\t\t\t\t\t\t\tfound=true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif((!found)&&(thisStat.equals("STINK"))&&(M.playerStats()!=null))\n\t\t\t\t{\n\t\t\t\t\tstr.append(CMath.toPct(M.playerStats().getHygiene()/PlayerStats.HYGIENE_DELIMIT)).append(" ");\n\t\t\t\t\tfound=true;\n\t\t\t\t}\n\t\t\t\tif((!found)&&(thisStat.startsWith("MAX")))\n\t\t\t\t{\n\t\t\t\t\tfor(final String stat : M.maxState().getStatCodes())\n\t\t\t\t\t{\n\t\t\t\t\t\tif(stat.equals(thisStat.substring(3)))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstr.append(M.maxState().getStat(stat)).append(" ");\n\t\t\t\t\t\t\tfound=true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif((!found)&&(thisStat.startsWith("BASE")))\n\t\t\t\t{\n\t\t\t\t\tfor(final String stat : M.baseCharStats().getStatCodes())\n\t\t\t\t\t{\n\t\t\t\t\t\tif(stat.equals(thisStat.substring(4)))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfinal CharStats base=(CharStats)M.baseCharStats().copyOf();\n\t\t\t\t\t\t\t//M.baseCharStats().getMyRace().affectCharStats(M, base);\n\t\t\t\t\t\t\tstr.append(base.getStat(stat)).append(" ");\n\t\t\t\t\t\t\tfound=true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(!found)\n\t\t\t\t{\n\t\t\t\t\tfor(final String stat : M.charStats().getStatCodes())\n\t\t\t\t\t{\n\t\t\t\t\t\tif(stat.equals(thisStat))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(stat.startsWith("MAX"))\n\t\t\t\t\t\t\t\tstr.append(CMProps.getIntVar(CMProps.Int.BASEMAXSTAT)+CMath.s_int(M.charStats().getStat(stat))).append(" ");\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tstr.append(M.charStats().getStat(stat)).append(" ");\n\t\t\t\t\t\t\tfound=true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(!found)\n\t\t\t\t{\n\t\t\t\t\tfor(final String stat : M.phyStats().getStatCodes())\n\t\t\t\t\t{\n\t\t\t\t\t\tif(stat.equals(thisStat))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(stat.equals("SENSES"))\n\t\t\t\t\t\t\t\tstr.append(doSenses(CMath.s_int(M.phyStats().getStat(stat))));\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\tif(stat.equals("DISPOSITION"))\n\t\t\t\t\t\t\t\tstr.append(doDisposition(CMath.s_int(M.phyStats().getStat(stat))));\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tstr.append(M.phyStats().getStat(stat)).append(" ");\n\t\t\t\t\t\t\tfound=true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(!found)\n\t\t\t\t{\n\t\t\t\t\tfor(final Enumeration<Faction> f=CMLib.factions().factions();f.hasMoreElements();)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal Faction F=f.nextElement();\n\t\t\t\t\t\tif((F!=null)\n\t\t\t\t\t\t&&(F.showInScore())\n\t\t\t\t\t\t&&(thisStat.equals(F.name().toUpperCase().replace(\' \',\'_\'))))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstr.append(M.fetchFaction(F.factionID())).append(" ");\n\t\t\t\t\t\t\tfound=true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(!found)\n\t\t\t\t{\n\t\t\t\t\tif(CMLib.coffeeMaker().isAnyGenStat(M, thisStat))\n\t\t\t\t\t{\n\t\t\t\t\t\tstr.append(CMLib.coffeeMaker().getAnyGenStat(M, thisStat)).append(" ");\n\t\t\t\t\t\tfound=true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(!found)\n\t\t\t\t{\n\t\t\t\t\tfor(final String stat : M.curState().getStatCodes())\n\t\t\t\t\t{\n\t\t\t\t\t\tif(stat.startsWith(thisStat))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstr.append(M.curState().getStat(stat)).append(" ");\n\t\t\t\t\t\t\tfound=true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif((!found)&&(thisStat.startsWith("MAX")))\n\t\t\t\t{\n\t\t\t\t\tfor(final String stat : M.maxState().getStatCodes())\n\t\t\t\t\t{\n\t\t\t\t\t\tif(stat.startsWith(thisStat.substring(3)))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstr.append(M.maxState().getStat(stat)).append(" ");\n\t\t\t\t\t\t\tfound=true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif((!found)&&(thisStat.startsWith("BASE")))\n\t\t\t\t{\n\t\t\t\t\tfor(final String stat : M.maxState().getStatCodes())\n\t\t\t\t\t{\n\t\t\t\t\t\tif(stat.startsWith(thisStat.substring(4)))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfinal CharStats base=(CharStats)M.baseCharStats().copyOf();\n\t\t\t\t\t\t\t//M.baseCharStats().getMyRace().affectCharStats(M, base);\n\t\t\t\t\t\t\tstr.append(base.getStat(stat)).append(" ");\n\t\t\t\t\t\t\tfound=true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(!found)\n\t\t\t\t{\n\t\t\t\t\tfor(final String stat : M.charStats().getStatCodes())\n\t\t\t\t\t{\n\t\t\t\t\t\tif(stat.startsWith(thisStat))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(stat.startsWith("MAX"))\n\t\t\t\t\t\t\t\tstr.append(CMProps.getIntVar(CMProps.Int.BASEMAXSTAT)+CMath.s_int(M.charStats().getStat(stat))).append(" ");\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tstr.append(M.charStats().getStat(stat)).append(" ");\n\t\t\t\t\t\t\tfound=true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(!found)\n\t\t\t\t{\n\t\t\t\t\tfor(final String stat : M.phyStats().getStatCodes())\n\t\t\t\t\t{\n\t\t\t\t\t\tif(stat.startsWith(thisStat))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(stat.equals("SENSES"))\n\t\t\t\t\t\t\t\tstr.append(doSenses(CMath.s_int(M.phyStats().getStat(stat))));\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\tif(stat.equals("DISPOSITION"))\n\t\t\t\t\t\t\t\tstr.append(doDisposition(CMath.s_int(M.phyStats().getStat(stat))));\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tstr.append(M.phyStats().getStat(stat)).append(" ");\n\t\t\t\t\t\t\tfound=true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(!found)\n\t\t\t\t{\n\t\t\t\t\tfor(final Enumeration<Faction> f=CMLib.factions().factions();f.hasMoreElements();)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal Faction F=f.nextElement();\n\t\t\t\t\t\tif((F!=null)\n\t\t\t\t\t\t&&(F.showInScore())\n\t\t\t\t\t\t&&(F.name().toUpperCase().replace(\' \',\'_\').startsWith(thisStat)))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstr.append(M.fetchFaction(F.factionID())).append(" ");\n\t\t\t\t\t\t\tfound=true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(!found)\n\t\t\t\t\tstr.append(" *UNKNOWN:"+thisStat+"* ");\n\t\t\t}\n\t\t}\n\t\tif(!mob.isMonster())\n\t\t\tmob.session().wraplessPrintln(str.toString());\n\t\treturn false;\n\t}\n\n\tpublic void recoverMOB(final MOB M)\n\t{\n\t\tM.recoverCharStats();\n\t\tM.recoverPhyStats();\n\t\tM.recoverMaxState();\n\t\tM.resetToMaxState();\n\t}\n\n\tpublic void testMOB(final MOB target,final MOB M, final Environmental test)\n\t{\n\t\ttest.affectCharStats(target,M.charStats());\n\t\ttest.affectPhyStats(target,M.phyStats());\n\t\ttest.affectCharState(target,M.maxState());\n\t}\n\n\tpublic void reportOnDiffMOB(final String name, final int diff, final StringBuilder str)\n\t{\n\t\tif(diff>0)\n\t\t\tstr.append("^C"+CMStrings.padRight(name,40)+": ^W+"+diff+"\\n\\r");\n\t\telse\n\t\tif(diff<0)\n\t\t\tstr.append("^C"+CMStrings.padRight(name,40)+": ^W"+diff+"\\n\\r");\n\t}\n\n\tpublic void reportOnDiffMOB(final Environmental test, final int diff, final StringBuilder str)\n\t{\n\t\treportOnDiffMOB(test.Name(),diff,str);\n\t}\n\n\tprivate final static Class<?>[][] internalParameters=new Class<?>[][]{{String.class,MOB.class}};\n\n\t@Override\n\tpublic Object executeInternal(final MOB mob, final int metaFlags, final Object... args) throws java.io.IOException\n\t{\n\t\tif(!super.checkArguments(internalParameters, args))\n\t\t\treturn Boolean.FALSE;\n\t\tfinal String statName=(String)args[0];\n\t\tfinal MOB M=(MOB)args[1];\n\t\tfinal List<String> cmds=new XVector<String>("STAT", statName.toUpperCase().trim(), M.Name());\n\t\treturn getPrivilegedStat(mob, M, cmds, true);\n\t}\n\n\t@Override\n\tpublic boolean canBeOrdered()\n\t{\n\t\treturn true;\n\t}\n\n\t@Override\n\tpublic boolean securityCheck(final MOB mob)\n\t{\n\t\treturn true;\n\t}\n}\n', 'message': 'fix to stat quest mob/item integrity\n\ngit-svn-id: 0cdf8356e41b2d8ccbb41bb76c82068fe80b2514@15723 0d6f1817-ed0e-0410-87c9-987e46238f29\n', 'author_name': 'bozimmerman', 'lang': 'java'}