<NME> Score.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.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.util.*;

/*
   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 Score extends Affect
{
	public Score()
	{
	}

	private final String[]	access	= I(new String[] { "SCORE", "SC" });

	@Override
	public String[] getAccessWords()
	{
		return access;
	}

	public StringBuilder getScore(final MOB mob)
	{
		return getScore(mob, "");
	}

	protected String getExtremeValue(final int extreme)
	{
		final StringBuilder str=new StringBuilder("");
		for(final char c : CMath.convertToRoman(extreme).toCharArray())
		{
			switch(c)
			{
			case 'I':
				str.append(CMProps.getListFileChoiceFromIndexedList(CMProps.ListFile.EXTREME_ADVS,0)).append(" ");
				break;
			case 'V':
				str.append(CMProps.getListFileChoiceFromIndexedList(CMProps.ListFile.EXTREME_ADVS,1)).append(" ");
				break;
			case 'X':
				str.append(CMProps.getListFileChoiceFromIndexedList(CMProps.ListFile.EXTREME_ADVS,2)).append(" ");
				break;
			case 'L':
				str.append(CMProps.getListFileChoiceFromIndexedList(CMProps.ListFile.EXTREME_ADVS,3)).append(" ");
				break;
			case 'C':
				str.append(CMProps.getListFileChoiceFromIndexedList(CMProps.ListFile.EXTREME_ADVS,4)).append(" ");
				break;
			case 'D':
				str.append(CMProps.getListFileChoiceFromIndexedList(CMProps.ListFile.EXTREME_ADVS,5)).append(" ");
				break;
			case 'M':
				str.append(CMProps.getListFileChoiceFromIndexedList(CMProps.ListFile.EXTREME_ADVS,6)).append(" ");
				break;
			}
		}
		return str.toString();
	}

	public StringBuilder getScore(final MOB mob, final String parm)
	{
		final int prowessCode = CMProps.getIntVar(CMProps.Int.COMBATPROWESS);

		final StringBuilder msg=new StringBuilder("^N");

		final int classLevel=mob.charStats().getClassLevel(mob.charStats().getCurrentClass());
		final int powerLevel=CMLib.leveler().getEffectFudgedLevel(mob);
		final boolean showPowerLevel=CMProps.Int.Prowesses.POWER_LEVEL.is(prowessCode);
		if((!CMSecurity.isDisabled(CMSecurity.DisFlag.CLASSES))
		&&(!mob.charStats().getMyRace().classless())
		&&(!CMSecurity.isDisabled(CMSecurity.DisFlag.LEVELS))
		&&(!mob.charStats().getMyRace().leveless())
		&&(!mob.charStats().getCurrentClass().leveless()))
		{
			String levelStr=null;
			if(classLevel>=mob.phyStats().level())
				levelStr=L("level ")+mob.phyStats().level()+" "+mob.charStats().getCurrentClass().name(mob.charStats().getCurrentClassLevel());
			else
				levelStr=mob.charStats().getCurrentClass().name(mob.charStats().getCurrentClassLevel())+" "+classLevel+"/"+mob.phyStats().level();
			if((powerLevel != mob.phyStats().level())&&(showPowerLevel))
				msg.append(L("You are ^H@x1^? the ^H@x2^?, power level ^H@x3^?.",mob.Name(),levelStr,""+powerLevel));
			else
				msg.append(L("You are ^H@x1^? the ^H@x2^?.",mob.Name(),levelStr));
		}
		else
		if((!CMSecurity.isDisabled(CMSecurity.DisFlag.LEVELS))
		&&(!mob.charStats().getCurrentClass().leveless())
		&&(!mob.charStats().getMyRace().leveless()))
		{
			String levelStr=null;
			if(classLevel>=mob.phyStats().level())
				levelStr=L(", level ")+mob.phyStats().level();
			else
				levelStr=L(", level ")+classLevel+"/"+mob.phyStats().level();
			if((powerLevel != mob.phyStats().level())&&(showPowerLevel))
				msg.append(L("You are ^H@x1^?^H@x2^?, power level ^H@x3^?.",mob.Name(),levelStr,""+powerLevel));
			else
				msg.append(L("You are ^H@x1^?^H@x2^?.",mob.Name(),levelStr));
		}
		else
        int max=CommonStrings.getIntVar(CommonStrings.SYSTEMI_BASEMAXSTAT);
        CharStats CT=mob.charStats();
        msg.append(CommonStrings.mxpImage(mob," ALIGN=RIGHT H=70 W=70"));
        msg.append(Util.padRight("^<HELP^>Strength^</HELP^>",15)+": "+Util.padRight(Integer.toString(CT.getStat(CharStats.STRENGTH)),2)+"/"+(max+CT.getStat(CharStats.MAX_STRENGTH_ADJ))+"\n\r");
        msg.append(Util.padRight("^<HELP^>Intelligence^</HELP^>",15)+": "+Util.padRight(Integer.toString(CT.getStat(CharStats.INTELLIGENCE)),2)+"/"+(max+CT.getStat(CharStats.MAX_INTELLIGENCE_ADJ))+"\n\r");
        msg.append(Util.padRight("^<HELP^>Dexterity^</HELP^>",15)+": "+Util.padRight(Integer.toString(CT.getStat(CharStats.DEXTERITY)),2)+"/"+(max+CT.getStat(CharStats.MAX_DEXTERITY_ADJ))+"\n\r");
			final String[] cmds=CMParms.toStringArray(CMParms.parseCommas(CMProps.get(mob.session()).getStr(CMProps.Str.PLAYERDEATH),true));
			for(final String cmd : cmds)
			{
				if(cmd.toUpperCase().startsWith("PUR"))
				{
					int maxLives = 1;
					final int x = cmd.indexOf(' ');
					if(x>0)
						maxLives = CMath.s_int(cmd.substring(x+1).trim());
					if(maxLives > 1)
					{
						final int remain = (maxLives-mob.playerStats().deathCounter(0));
						if(remain == 1)
							msg.append(L("  (^H1^? life remaining)"));
						else
							msg.append(L("  (^H@x1^? lives remaining)",""+remain));
					}
				}
			}
		}
		msg.append("\n\r");

		if((!CMSecurity.isDisabled(CMSecurity.DisFlag.CLASSES))
		&&(classLevel<mob.phyStats().level()))
		{
			msg.append(L("You also have levels in: "));
			final StringBuilder classList=new StringBuilder("");
			for(int c=0;c<mob.charStats().numClasses()-1;c++)
			{
				final CharClass C=mob.charStats().getMyClass(c);
				if(C!=mob.charStats().getCurrentClass())
				{
					if(classList.length()>0)
						if(c==mob.charStats().numClasses()-2)
							classList.append(L(", and "));
						else
							classList.append(", ");
					classList.append(C.name(mob.charStats().getClassLevel(C))+" ("+mob.charStats().getClassLevel(C)+") ");
				}
			}
			msg.append(classList.toString()+".\n\r");
		}

		if(CMProps.getBoolVar(CMProps.Bool.ACCOUNTEXPIRATION)&&(mob.playerStats()!=null))
			msg.append(L("Your account is Registered and Active until: @x1!\n\r",CMLib.time().date2String(mob.playerStats().getAccountExpiration())));

		String genderName=L("^!neuter");
		if(mob.charStats().getStat(CharStats.STAT_GENDER)=='M')
			genderName=L("^!male");
		else
		if(mob.charStats().getStat(CharStats.STAT_GENDER)=='F')
			genderName=L("^!female");
		msg.append(L("You are a "));
		if((mob.baseCharStats().getStat(CharStats.STAT_AGE)>0)&&(!CMSecurity.isDisabled(CMSecurity.DisFlag.ALL_AGEING)))
			msg.append(L("^!@x1^? year old ",""+mob.baseCharStats().getStat(CharStats.STAT_AGE)));
		msg.append(genderName);
		if((!CMSecurity.isDisabled(CMSecurity.DisFlag.RACES))
		&&(!mob.charStats().getCurrentClass().raceless()))
			msg.append(" "+mob.charStats().getMyRace().name() + "^?");
		else
			msg.append("^?");
		if(mob.getLiegeID().length()>0)
		{
			if(mob.isMarriedToLiege())
				msg.append(L(" who is married to ^H@x1^?",mob.getLiegeID()));
			else
				msg.append(L(" who serves ^H@x1^?",mob.getLiegeID()));
		}
		if(mob.charStats().deityName().length()>0)
			msg.append(L(" worshipping ^H@x1^?",mob.charStats().deityName()));
		msg.append(".\n\r");
		if(mob.clans().iterator().hasNext())
		{
			msg.append(L("You are "));
			for(final Iterator<Pair<Clan,Integer>> c = mob.clans().iterator();c.hasNext();)
			{
				final Pair<Clan,Integer> p=c.next();
				final Clan C=p.first;
				String role=C.getRoleName(p.second.intValue(),true,false);
				role=CMLib.english().startWithAorAn(role);
				msg.append(L("@x1 of ^H@x2^?^.",role,C.getName()));
				if(c.hasNext())
					msg.append(", ");
			}
			msg.append("\n\r");
		}
		if(!CMSecurity.isDisabled(CMSecurity.DisFlag.ATTRIBS))
		{
			msg.append(L("\n\r^NYour stats are: "));
			msg.append(CMLib.protocol().mxpImage(mob," ALIGN=RIGHT H=70 W=70"));
			msg.append("\n\r");
			CharStats CT=mob.charStats();
			if(parm.equalsIgnoreCase("BASE"))
				CT=mob.baseCharStats();
			msg.append("^N^!");
			final int longest=CharStats.CODES.LONNGEST_BASECODE_NAME();
			final boolean useWords=CMProps.Int.Prowesses.STAT_PROFICIENCY.is(prowessCode);
			final String[] charStatList = CMProps.getListFileStringList(CMProps.ListFile.CHARSTAT_CHART);
			for(final int i : CharStats.CODES.BASECODES())
			{
				final String statDesc;
				if(useWords)
				{
					final int val=CT.getStat(i);
					if(val < 0)
						statDesc=CMStrings.capitalizeAndLower(charStatList[0]);
					else
					if(val < charStatList.length)
						statDesc=CMStrings.capitalizeAndLower(charStatList[val]);
					else
						statDesc=CMStrings.capitalizeAndLower(getExtremeValue(val-charStatList.length+1))+" "+CMStrings.capitalizeAndLower(charStatList[charStatList.length-1]);
				}
				else
					statDesc=CMStrings.padRight(Integer.toString(CT.getStat(i)),2)+"/"+(CT.getMaxStat(i));
				msg.append(CMStrings.padRight("^<HELP^>^N^!" + CMStrings.capitalizeAndLower(CharStats.CODES.NAME(i))+"^</HELP^>",longest)
						+"^N: ^H"+statDesc+"^?\n\r");
			}
			msg.append("^N\n\r");
		}
		msg.append(L("You have ^H@x1^? ^<HELP^>hit points^</HELP^>, ^H",mob.curState().getHitPoints()+"/"+mob.maxState().getHitPoints()));
		msg.append(L("@x1^? ^<HELP^>mana^</HELP^>, and ^H",mob.curState().getMana()+"/"+mob.maxState().getMana()));
		msg.append(L("@x1^? ^<HELP^>movement^</HELP^>.\n\r",mob.curState().getMovement()+"/"+mob.maxState().getMovement()));
		if(mob.phyStats().height()<0)
			msg.append(L("You are incorporeal, but still weigh ^!@x1^? pounds.\n\r",""+mob.baseWeight()));
		else
			msg.append(L("You are ^!@x1^? inches tall and weigh ^!@x2^? pounds.\n\r",""+mob.phyStats().height(),""+mob.baseWeight()));
		if(CMSecurity.isAllowed(mob,mob.location(),CMSecurity.SecFlag.CARRYALL))
			msg.append(L("You are carrying ^!@x1^? items weighing ^!@x2^? pounds.\n\r",""+mob.numItems(),""+mob.phyStats().weight()));
		else
			msg.append(L("You are carrying ^!@x1^?/^!@x2^? items weighing ^!@x3^? pounds.\n\r",
							""+mob.numItems(),""+mob.maxItems(),mob.phyStats().weight()+"^?/^!"+mob.maxCarry()));
		msg.append(L("You have ^!@x1^? ^<HELP^>practices^</HELP^>, ^!@x2^? ^<HELP^>training sessions^</HELP^>, and ^!@x3^? ^<HELP^>quest points^</HELP^>.\n\r",""+mob.getPractices(),""+mob.getTrains(),""+mob.getQuestPoint()));
		if((!CMSecurity.isDisabled(CMSecurity.DisFlag.EXPERIENCE))
		&&(!CMSecurity.isDisabled(CMSecurity.DisFlag.SHOWXP))
		&&!mob.charStats().getCurrentClass().expless()
		&&!mob.charStats().getMyRace().expless())
		{
			if((!CMSecurity.isDisabled(CMSecurity.DisFlag.LEVELS))
			&&(!mob.charStats().getCurrentClass().leveless())
			&&(!mob.charStats().getMyRace().leveless()))
			{
				if(((CMProps.get(mob.session()).getInt(CMProps.Int.LASTPLAYERLEVEL)>0)
					&&(mob.basePhyStats().level()>CMProps.get(mob.session()).getInt(CMProps.Int.LASTPLAYERLEVEL)))
				||(mob.getExpNeededLevel()==Integer.MAX_VALUE)
				||(mob.charStats().isLevelCapped(mob.charStats().getCurrentClass())))
					msg.append(L("You have scored ^!@x1^? ^<HELP^>experience points^</HELP^>, ^!@x2^? over your last level.\n\r",""+mob.getExperience(),""+mob.getExpNeededDelevel()));
				else
				{
					msg.append(L("You have scored ^!@x1^? ^<HELP^>experience points^</HELP^>, and need ^!@x2^? to advance.\n\r",""+mob.getExperience(),""+mob.getExpNeededLevel()));
					final PlayerStats pStats = mob.playerStats();
					if((CMProps.getIntVar(CMProps.Int.EXPDEFER_PCT)>0)
					&&(pStats != null))
					{
						if(pStats.getDeferredXP() + pStats.getRolePlayXP() < pStats.getMaxDeferredXP())
						{
							if(((mob.getExperience()+pStats.getDeferredXP() + pStats.getRolePlayXP())>=mob.getExpNextLevel())
							&&(mob.getExpNeededLevel()<Integer.MAX_VALUE))
								msg.append(L("^!You've earned enough experience to gain a level.^?\n\r"));
						}
						else
							msg.append(L("^!You cannot defer any more experience for later.^?\n\r"));
					}
				}
			}
			else
				msg.append(L("You have scored ^!@x1^? ^<HELP^>experience points^</HELP^>.\n\r",""+mob.getExperience()));
		}
		msg.append(L("You have been online for ^!@x1^? hours.\n\r",""+Math.round(CMath.div(mob.getAgeMinutes(),60.0))));
		final FactionManager fac=CMLib.factions();
		final boolean useFactionWords=CMProps.Int.Prowesses.FACTION_RANGE.is(prowessCode);
		for(final Enumeration<String> e=mob.factions();e.hasMoreElements();)
		{
			final String factionID=e.nextElement();
			final Faction F=fac.getFaction(factionID);
			if(F!=null)
			{
				final int factionAmt=mob.fetchFaction(factionID);
				final Faction.FRange FR=fac.getRange(factionID,factionAmt);
				if((FR!=null)
				&&(F.showInScore()))
				{
					if(useFactionWords)
						msg.append(L("^NYour ")+CMStrings.padRight(L("^<HELP^>@x1^</HELP^>",F.name()),15)+": ^H"+FR.name()+" ^.\n\r");
					else
						msg.append(L("^NYour ")+CMStrings.padRight(L("^<HELP^>@x1^</HELP^>",F.name()),15)+": ^H"+FR.name()+" ^.("+factionAmt+")\n\r");
				}
			}
		}
		if((CMProps.getIntVar(CMProps.Int.COMBATPROWESS)&CMProps.Int.ANY_ARMOR_PROWESS)!=0)
			msg.append(L("Your ^<HELP^>armored defence^</HELP^>: ^H@x1^.^N\n\r",CMLib.combat().armorStr(mob)));
		if((CMProps.getIntVar(CMProps.Int.COMBATPROWESS)&CMProps.Int.ANY_COMBAT_PROWESS)!=0)
			msg.append(L("Your ^<HELP^>combat prowess^</HELP^> : ^H@x1^.^N\n\r",CMLib.combat().fightingProwessStr(mob)));
		if((CMProps.getIntVar(CMProps.Int.COMBATPROWESS)&CMProps.Int.ANY_DAMAGE_PROWESS)!=0)
			msg.append(L("Your ^<HELP^>damage threat^</HELP^>  : ^H@x1^.^N\n\r",CMLib.combat().damageProwessStr(mob)));
		//if(CMLib.flags().canSeeHidden(mob))
		//    msg.append(L("Your ^<HELP^>observation score^</HELP^> : ^H@x1^?.\n\r",CMLib.flags().getDetectScore(mob)));
		msg.append(L("Wimpy is set to ^!@x1^? hit points.\n\r",""+mob.getWimpHitPoint()));

		msg.append(getMOBState(mob));
		msg.append(getAffects(mob.session(),mob,false,false));
		return msg;
	}

	@Override
	public boolean execute(final MOB mob, final List<String> commands, final int metaFlags)
		throws java.io.IOException
	{
		String parm="";
		if(commands.size()>1)
			parm=CMParms.combine(commands,1);
		final StringBuilder msg=getScore(mob,parm);
		if(commands.size()==0)
		{
			commands.add(msg.toString());
			return false;
		}
		if(!mob.isMonster())
			mob.session().wraplessPrintln(msg.toString());
		return false;
	}

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

}

<MSG> 

git-svn-id: svn://192.168.1.10/public/CoffeeMud@4988 0d6f1817-ed0e-0410-87c9-987e46238f29

<DFF> @@ -128,6 +128,7 @@ public class Score extends Affect
         int max=CommonStrings.getIntVar(CommonStrings.SYSTEMI_BASEMAXSTAT);
         CharStats CT=mob.charStats();
         msg.append(CommonStrings.mxpImage(mob," ALIGN=RIGHT H=70 W=70"));
+        msg.append("^N^!");
         msg.append(Util.padRight("^<HELP^>Strength^</HELP^>",15)+": "+Util.padRight(Integer.toString(CT.getStat(CharStats.STRENGTH)),2)+"/"+(max+CT.getStat(CharStats.MAX_STRENGTH_ADJ))+"\n\r");
         msg.append(Util.padRight("^<HELP^>Intelligence^</HELP^>",15)+": "+Util.padRight(Integer.toString(CT.getStat(CharStats.INTELLIGENCE)),2)+"/"+(max+CT.getStat(CharStats.MAX_INTELLIGENCE_ADJ))+"\n\r");
         msg.append(Util.padRight("^<HELP^>Dexterity^</HELP^>",15)+": "+Util.padRight(Integer.toString(CT.getStat(CharStats.DEXTERITY)),2)+"/"+(max+CT.getStat(CharStats.MAX_DEXTERITY_ADJ))+"\n\r");

{'commit': 'diff --git a/com/planet_ink/coffee_mud/Commands/Score.java b/com/planet_ink/coffee_mud/Commands/Score.java\nindex be74e5af92..0f8cc237be 100644\n--- a/com/planet_ink/coffee_mud/Commands/Score.java\n+++ b/com/planet_ink/coffee_mud/Commands/Score.java\n@@ -128,6 +128,7 @@ public class Score extends Affect\n         int max=CommonStrings.getIntVar(CommonStrings.SYSTEMI_BASEMAXSTAT);\r\n         CharStats CT=mob.charStats();\r\n         msg.append(CommonStrings.mxpImage(mob," ALIGN=RIGHT H=70 W=70"));\r\n+        msg.append("^N^!");\r\n         msg.append(Util.padRight("^<HELP^>Strength^</HELP^>",15)+": "+Util.padRight(Integer.toString(CT.getStat(CharStats.STRENGTH)),2)+"/"+(max+CT.getStat(CharStats.MAX_STRENGTH_ADJ))+"\\n\\r");\r\n         msg.append(Util.padRight("^<HELP^>Intelligence^</HELP^>",15)+": "+Util.padRight(Integer.toString(CT.getStat(CharStats.INTELLIGENCE)),2)+"/"+(max+CT.getStat(CharStats.MAX_INTELLIGENCE_ADJ))+"\\n\\r");\r\n         msg.append(Util.padRight("^<HELP^>Dexterity^</HELP^>",15)+": "+Util.padRight(Integer.toString(CT.getStat(CharStats.DEXTERITY)),2)+"/"+(max+CT.getStat(CharStats.MAX_DEXTERITY_ADJ))+"\\n\\r");\r\n', 'commit_subject': '', 'repo_name': 'bozimmerman/CoffeeMud', 'committer': {'name': 'bozimmerman', 'email': 'dc45fe023482b3b890b5e574e53c1d051f45b1ef@zimmers.net', 'time_sec': '1131677430', 'tz_offset': '0', 'date': {'seconds': '1131677430'}}, 'commit_tree': '6297b332982c8d0d7a91db835b250cfb4ff90125', 'commit_message': '\n\ngit-svn-id: svn://192.168.1.10/public/CoffeeMud@4988 0d6f1817-ed0e-0410-87c9-987e46238f29\n', 'language_name': 'Shell', 'license': 'apache-2.0', 'hunks': '@@ -128,6 +128,7 @@ public class Score extends Affect\n         int max=CommonStrings.getIntVar(CommonStrings.SYSTEMI_BASEMAXSTAT);\r\n         CharStats CT=mob.charStats();\r\n         msg.append(CommonStrings.mxpImage(mob," ALIGN=RIGHT H=70 W=70"));\r\n+        msg.append("^N^!");\r\n         msg.append(Util.padRight("^<HELP^>Strength^</HELP^>",15)+": "+Util.padRight(Integer.toString(CT.getStat(CharStats.STRENGTH)),2)+"/"+(max+CT.getStat(CharStats.MAX_STRENGTH_ADJ))+"\\n\\r");\r\n         msg.append(Util.padRight("^<HELP^>Intelligence^</HELP^>",15)+": "+Util.padRight(Integer.toString(CT.getStat(CharStats.INTELLIGENCE)),2)+"/"+(max+CT.getStat(CharStats.MAX_INTELLIGENCE_ADJ))+"\\n\\r");\r\n         msg.append(Util.padRight("^<HELP^>Dexterity^</HELP^>",15)+": "+Util.padRight(Integer.toString(CT.getStat(CharStats.DEXTERITY)),2)+"/"+(max+CT.getStat(CharStats.MAX_DEXTERITY_ADJ))+"\\n\\r");\r\n', 'addition_count': 1, 'deletion_count': 0, 'src_file': 'a/com/planet_ink/coffee_mud/Commands/Score.java', 'tgt_file': 'b/com/planet_ink/coffee_mud/Commands/Score.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.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.util.*;\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 Score extends Affect\n{\n\tpublic Score()\n\t{\n\t}\n\n\tprivate final String[]\taccess\t= I(new String[] { "SCORE", "SC" });\n\n\t@Override\n\tpublic String[] getAccessWords()\n\t{\n\t\treturn access;\n\t}\n\n\tpublic StringBuilder getScore(final MOB mob)\n\t{\n\t\treturn getScore(mob, "");\n\t}\n\n\tprotected String getExtremeValue(final int extreme)\n\t{\n\t\tfinal StringBuilder str=new StringBuilder("");\n\t\tfor(final char c : CMath.convertToRoman(extreme).toCharArray())\n\t\t{\n\t\t\tswitch(c)\n\t\t\t{\n\t\t\tcase \'I\':\n\t\t\t\tstr.append(CMProps.getListFileChoiceFromIndexedList(CMProps.ListFile.EXTREME_ADVS,0)).append(" ");\n\t\t\t\tbreak;\n\t\t\tcase \'V\':\n\t\t\t\tstr.append(CMProps.getListFileChoiceFromIndexedList(CMProps.ListFile.EXTREME_ADVS,1)).append(" ");\n\t\t\t\tbreak;\n\t\t\tcase \'X\':\n\t\t\t\tstr.append(CMProps.getListFileChoiceFromIndexedList(CMProps.ListFile.EXTREME_ADVS,2)).append(" ");\n\t\t\t\tbreak;\n\t\t\tcase \'L\':\n\t\t\t\tstr.append(CMProps.getListFileChoiceFromIndexedList(CMProps.ListFile.EXTREME_ADVS,3)).append(" ");\n\t\t\t\tbreak;\n\t\t\tcase \'C\':\n\t\t\t\tstr.append(CMProps.getListFileChoiceFromIndexedList(CMProps.ListFile.EXTREME_ADVS,4)).append(" ");\n\t\t\t\tbreak;\n\t\t\tcase \'D\':\n\t\t\t\tstr.append(CMProps.getListFileChoiceFromIndexedList(CMProps.ListFile.EXTREME_ADVS,5)).append(" ");\n\t\t\t\tbreak;\n\t\t\tcase \'M\':\n\t\t\t\tstr.append(CMProps.getListFileChoiceFromIndexedList(CMProps.ListFile.EXTREME_ADVS,6)).append(" ");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn str.toString();\n\t}\n\n\tpublic StringBuilder getScore(final MOB mob, final String parm)\n\t{\n\t\tfinal int prowessCode = CMProps.getIntVar(CMProps.Int.COMBATPROWESS);\n\n\t\tfinal StringBuilder msg=new StringBuilder("^N");\n\n\t\tfinal int classLevel=mob.charStats().getClassLevel(mob.charStats().getCurrentClass());\n\t\tfinal int powerLevel=CMLib.leveler().getEffectFudgedLevel(mob);\n\t\tfinal boolean showPowerLevel=CMProps.Int.Prowesses.POWER_LEVEL.is(prowessCode);\n\t\tif((!CMSecurity.isDisabled(CMSecurity.DisFlag.CLASSES))\n\t\t&&(!mob.charStats().getMyRace().classless())\n\t\t&&(!CMSecurity.isDisabled(CMSecurity.DisFlag.LEVELS))\n\t\t&&(!mob.charStats().getMyRace().leveless())\n\t\t&&(!mob.charStats().getCurrentClass().leveless()))\n\t\t{\n\t\t\tString levelStr=null;\n\t\t\tif(classLevel>=mob.phyStats().level())\n\t\t\t\tlevelStr=L("level ")+mob.phyStats().level()+" "+mob.charStats().getCurrentClass().name(mob.charStats().getCurrentClassLevel());\n\t\t\telse\n\t\t\t\tlevelStr=mob.charStats().getCurrentClass().name(mob.charStats().getCurrentClassLevel())+" "+classLevel+"/"+mob.phyStats().level();\n\t\t\tif((powerLevel != mob.phyStats().level())&&(showPowerLevel))\n\t\t\t\tmsg.append(L("You are ^H@x1^? the ^H@x2^?, power level ^H@x3^?.",mob.Name(),levelStr,""+powerLevel));\n\t\t\telse\n\t\t\t\tmsg.append(L("You are ^H@x1^? the ^H@x2^?.",mob.Name(),levelStr));\n\t\t}\n\t\telse\n\t\tif((!CMSecurity.isDisabled(CMSecurity.DisFlag.LEVELS))\n\t\t&&(!mob.charStats().getCurrentClass().leveless())\n\t\t&&(!mob.charStats().getMyRace().leveless()))\n\t\t{\n\t\t\tString levelStr=null;\n\t\t\tif(classLevel>=mob.phyStats().level())\n\t\t\t\tlevelStr=L(", level ")+mob.phyStats().level();\n\t\t\telse\n\t\t\t\tlevelStr=L(", level ")+classLevel+"/"+mob.phyStats().level();\n\t\t\tif((powerLevel != mob.phyStats().level())&&(showPowerLevel))\n\t\t\t\tmsg.append(L("You are ^H@x1^?^H@x2^?, power level ^H@x3^?.",mob.Name(),levelStr,""+powerLevel));\n\t\t\telse\n\t\t\t\tmsg.append(L("You are ^H@x1^?^H@x2^?.",mob.Name(),levelStr));\n\t\t}\n\t\telse\n        int max=CommonStrings.getIntVar(CommonStrings.SYSTEMI_BASEMAXSTAT);\r\n        CharStats CT=mob.charStats();\r\n        msg.append(CommonStrings.mxpImage(mob," ALIGN=RIGHT H=70 W=70"));\r\n        msg.append(Util.padRight("^<HELP^>Strength^</HELP^>",15)+": "+Util.padRight(Integer.toString(CT.getStat(CharStats.STRENGTH)),2)+"/"+(max+CT.getStat(CharStats.MAX_STRENGTH_ADJ))+"\\n\\r");\r\n        msg.append(Util.padRight("^<HELP^>Intelligence^</HELP^>",15)+": "+Util.padRight(Integer.toString(CT.getStat(CharStats.INTELLIGENCE)),2)+"/"+(max+CT.getStat(CharStats.MAX_INTELLIGENCE_ADJ))+"\\n\\r");\r\n        msg.append(Util.padRight("^<HELP^>Dexterity^</HELP^>",15)+": "+Util.padRight(Integer.toString(CT.getStat(CharStats.DEXTERITY)),2)+"/"+(max+CT.getStat(CharStats.MAX_DEXTERITY_ADJ))+"\\n\\r");\r\n\t\t\tfinal String[] cmds=CMParms.toStringArray(CMParms.parseCommas(CMProps.get(mob.session()).getStr(CMProps.Str.PLAYERDEATH),true));\n\t\t\tfor(final String cmd : cmds)\n\t\t\t{\n\t\t\t\tif(cmd.toUpperCase().startsWith("PUR"))\n\t\t\t\t{\n\t\t\t\t\tint maxLives = 1;\n\t\t\t\t\tfinal int x = cmd.indexOf(\' \');\n\t\t\t\t\tif(x>0)\n\t\t\t\t\t\tmaxLives = CMath.s_int(cmd.substring(x+1).trim());\n\t\t\t\t\tif(maxLives > 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal int remain = (maxLives-mob.playerStats().deathCounter(0));\n\t\t\t\t\t\tif(remain == 1)\n\t\t\t\t\t\t\tmsg.append(L("  (^H1^? life remaining)"));\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tmsg.append(L("  (^H@x1^? lives remaining)",""+remain));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tmsg.append("\\n\\r");\n\n\t\tif((!CMSecurity.isDisabled(CMSecurity.DisFlag.CLASSES))\n\t\t&&(classLevel<mob.phyStats().level()))\n\t\t{\n\t\t\tmsg.append(L("You also have levels in: "));\n\t\t\tfinal StringBuilder classList=new StringBuilder("");\n\t\t\tfor(int c=0;c<mob.charStats().numClasses()-1;c++)\n\t\t\t{\n\t\t\t\tfinal CharClass C=mob.charStats().getMyClass(c);\n\t\t\t\tif(C!=mob.charStats().getCurrentClass())\n\t\t\t\t{\n\t\t\t\t\tif(classList.length()>0)\n\t\t\t\t\t\tif(c==mob.charStats().numClasses()-2)\n\t\t\t\t\t\t\tclassList.append(L(", and "));\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tclassList.append(", ");\n\t\t\t\t\tclassList.append(C.name(mob.charStats().getClassLevel(C))+" ("+mob.charStats().getClassLevel(C)+") ");\n\t\t\t\t}\n\t\t\t}\n\t\t\tmsg.append(classList.toString()+".\\n\\r");\n\t\t}\n\n\t\tif(CMProps.getBoolVar(CMProps.Bool.ACCOUNTEXPIRATION)&&(mob.playerStats()!=null))\n\t\t\tmsg.append(L("Your account is Registered and Active until: @x1!\\n\\r",CMLib.time().date2String(mob.playerStats().getAccountExpiration())));\n\n\t\tString genderName=L("^!neuter");\n\t\tif(mob.charStats().getStat(CharStats.STAT_GENDER)==\'M\')\n\t\t\tgenderName=L("^!male");\n\t\telse\n\t\tif(mob.charStats().getStat(CharStats.STAT_GENDER)==\'F\')\n\t\t\tgenderName=L("^!female");\n\t\tmsg.append(L("You are a "));\n\t\tif((mob.baseCharStats().getStat(CharStats.STAT_AGE)>0)&&(!CMSecurity.isDisabled(CMSecurity.DisFlag.ALL_AGEING)))\n\t\t\tmsg.append(L("^!@x1^? year old ",""+mob.baseCharStats().getStat(CharStats.STAT_AGE)));\n\t\tmsg.append(genderName);\n\t\tif((!CMSecurity.isDisabled(CMSecurity.DisFlag.RACES))\n\t\t&&(!mob.charStats().getCurrentClass().raceless()))\n\t\t\tmsg.append(" "+mob.charStats().getMyRace().name() + "^?");\n\t\telse\n\t\t\tmsg.append("^?");\n\t\tif(mob.getLiegeID().length()>0)\n\t\t{\n\t\t\tif(mob.isMarriedToLiege())\n\t\t\t\tmsg.append(L(" who is married to ^H@x1^?",mob.getLiegeID()));\n\t\t\telse\n\t\t\t\tmsg.append(L(" who serves ^H@x1^?",mob.getLiegeID()));\n\t\t}\n\t\tif(mob.charStats().deityName().length()>0)\n\t\t\tmsg.append(L(" worshipping ^H@x1^?",mob.charStats().deityName()));\n\t\tmsg.append(".\\n\\r");\n\t\tif(mob.clans().iterator().hasNext())\n\t\t{\n\t\t\tmsg.append(L("You are "));\n\t\t\tfor(final Iterator<Pair<Clan,Integer>> c = mob.clans().iterator();c.hasNext();)\n\t\t\t{\n\t\t\t\tfinal Pair<Clan,Integer> p=c.next();\n\t\t\t\tfinal Clan C=p.first;\n\t\t\t\tString role=C.getRoleName(p.second.intValue(),true,false);\n\t\t\t\trole=CMLib.english().startWithAorAn(role);\n\t\t\t\tmsg.append(L("@x1 of ^H@x2^?^.",role,C.getName()));\n\t\t\t\tif(c.hasNext())\n\t\t\t\t\tmsg.append(", ");\n\t\t\t}\n\t\t\tmsg.append("\\n\\r");\n\t\t}\n\t\tif(!CMSecurity.isDisabled(CMSecurity.DisFlag.ATTRIBS))\n\t\t{\n\t\t\tmsg.append(L("\\n\\r^NYour stats are: "));\n\t\t\tmsg.append(CMLib.protocol().mxpImage(mob," ALIGN=RIGHT H=70 W=70"));\n\t\t\tmsg.append("\\n\\r");\n\t\t\tCharStats CT=mob.charStats();\n\t\t\tif(parm.equalsIgnoreCase("BASE"))\n\t\t\t\tCT=mob.baseCharStats();\n\t\t\tmsg.append("^N^!");\n\t\t\tfinal int longest=CharStats.CODES.LONNGEST_BASECODE_NAME();\n\t\t\tfinal boolean useWords=CMProps.Int.Prowesses.STAT_PROFICIENCY.is(prowessCode);\n\t\t\tfinal String[] charStatList = CMProps.getListFileStringList(CMProps.ListFile.CHARSTAT_CHART);\n\t\t\tfor(final int i : CharStats.CODES.BASECODES())\n\t\t\t{\n\t\t\t\tfinal String statDesc;\n\t\t\t\tif(useWords)\n\t\t\t\t{\n\t\t\t\t\tfinal int val=CT.getStat(i);\n\t\t\t\t\tif(val < 0)\n\t\t\t\t\t\tstatDesc=CMStrings.capitalizeAndLower(charStatList[0]);\n\t\t\t\t\telse\n\t\t\t\t\tif(val < charStatList.length)\n\t\t\t\t\t\tstatDesc=CMStrings.capitalizeAndLower(charStatList[val]);\n\t\t\t\t\telse\n\t\t\t\t\t\tstatDesc=CMStrings.capitalizeAndLower(getExtremeValue(val-charStatList.length+1))+" "+CMStrings.capitalizeAndLower(charStatList[charStatList.length-1]);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tstatDesc=CMStrings.padRight(Integer.toString(CT.getStat(i)),2)+"/"+(CT.getMaxStat(i));\n\t\t\t\tmsg.append(CMStrings.padRight("^<HELP^>^N^!" + CMStrings.capitalizeAndLower(CharStats.CODES.NAME(i))+"^</HELP^>",longest)\n\t\t\t\t\t\t+"^N: ^H"+statDesc+"^?\\n\\r");\n\t\t\t}\n\t\t\tmsg.append("^N\\n\\r");\n\t\t}\n\t\tmsg.append(L("You have ^H@x1^? ^<HELP^>hit points^</HELP^>, ^H",mob.curState().getHitPoints()+"/"+mob.maxState().getHitPoints()));\n\t\tmsg.append(L("@x1^? ^<HELP^>mana^</HELP^>, and ^H",mob.curState().getMana()+"/"+mob.maxState().getMana()));\n\t\tmsg.append(L("@x1^? ^<HELP^>movement^</HELP^>.\\n\\r",mob.curState().getMovement()+"/"+mob.maxState().getMovement()));\n\t\tif(mob.phyStats().height()<0)\n\t\t\tmsg.append(L("You are incorporeal, but still weigh ^!@x1^? pounds.\\n\\r",""+mob.baseWeight()));\n\t\telse\n\t\t\tmsg.append(L("You are ^!@x1^? inches tall and weigh ^!@x2^? pounds.\\n\\r",""+mob.phyStats().height(),""+mob.baseWeight()));\n\t\tif(CMSecurity.isAllowed(mob,mob.location(),CMSecurity.SecFlag.CARRYALL))\n\t\t\tmsg.append(L("You are carrying ^!@x1^? items weighing ^!@x2^? pounds.\\n\\r",""+mob.numItems(),""+mob.phyStats().weight()));\n\t\telse\n\t\t\tmsg.append(L("You are carrying ^!@x1^?/^!@x2^? items weighing ^!@x3^? pounds.\\n\\r",\n\t\t\t\t\t\t\t""+mob.numItems(),""+mob.maxItems(),mob.phyStats().weight()+"^?/^!"+mob.maxCarry()));\n\t\tmsg.append(L("You have ^!@x1^? ^<HELP^>practices^</HELP^>, ^!@x2^? ^<HELP^>training sessions^</HELP^>, and ^!@x3^? ^<HELP^>quest points^</HELP^>.\\n\\r",""+mob.getPractices(),""+mob.getTrains(),""+mob.getQuestPoint()));\n\t\tif((!CMSecurity.isDisabled(CMSecurity.DisFlag.EXPERIENCE))\n\t\t&&(!CMSecurity.isDisabled(CMSecurity.DisFlag.SHOWXP))\n\t\t&&!mob.charStats().getCurrentClass().expless()\n\t\t&&!mob.charStats().getMyRace().expless())\n\t\t{\n\t\t\tif((!CMSecurity.isDisabled(CMSecurity.DisFlag.LEVELS))\n\t\t\t&&(!mob.charStats().getCurrentClass().leveless())\n\t\t\t&&(!mob.charStats().getMyRace().leveless()))\n\t\t\t{\n\t\t\t\tif(((CMProps.get(mob.session()).getInt(CMProps.Int.LASTPLAYERLEVEL)>0)\n\t\t\t\t\t&&(mob.basePhyStats().level()>CMProps.get(mob.session()).getInt(CMProps.Int.LASTPLAYERLEVEL)))\n\t\t\t\t||(mob.getExpNeededLevel()==Integer.MAX_VALUE)\n\t\t\t\t||(mob.charStats().isLevelCapped(mob.charStats().getCurrentClass())))\n\t\t\t\t\tmsg.append(L("You have scored ^!@x1^? ^<HELP^>experience points^</HELP^>, ^!@x2^? over your last level.\\n\\r",""+mob.getExperience(),""+mob.getExpNeededDelevel()));\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tmsg.append(L("You have scored ^!@x1^? ^<HELP^>experience points^</HELP^>, and need ^!@x2^? to advance.\\n\\r",""+mob.getExperience(),""+mob.getExpNeededLevel()));\n\t\t\t\t\tfinal PlayerStats pStats = mob.playerStats();\n\t\t\t\t\tif((CMProps.getIntVar(CMProps.Int.EXPDEFER_PCT)>0)\n\t\t\t\t\t&&(pStats != null))\n\t\t\t\t\t{\n\t\t\t\t\t\tif(pStats.getDeferredXP() + pStats.getRolePlayXP() < pStats.getMaxDeferredXP())\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(((mob.getExperience()+pStats.getDeferredXP() + pStats.getRolePlayXP())>=mob.getExpNextLevel())\n\t\t\t\t\t\t\t&&(mob.getExpNeededLevel()<Integer.MAX_VALUE))\n\t\t\t\t\t\t\t\tmsg.append(L("^!You\'ve earned enough experience to gain a level.^?\\n\\r"));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tmsg.append(L("^!You cannot defer any more experience for later.^?\\n\\r"));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t\tmsg.append(L("You have scored ^!@x1^? ^<HELP^>experience points^</HELP^>.\\n\\r",""+mob.getExperience()));\n\t\t}\n\t\tmsg.append(L("You have been online for ^!@x1^? hours.\\n\\r",""+Math.round(CMath.div(mob.getAgeMinutes(),60.0))));\n\t\tfinal FactionManager fac=CMLib.factions();\n\t\tfinal boolean useFactionWords=CMProps.Int.Prowesses.FACTION_RANGE.is(prowessCode);\n\t\tfor(final Enumeration<String> e=mob.factions();e.hasMoreElements();)\n\t\t{\n\t\t\tfinal String factionID=e.nextElement();\n\t\t\tfinal Faction F=fac.getFaction(factionID);\n\t\t\tif(F!=null)\n\t\t\t{\n\t\t\t\tfinal int factionAmt=mob.fetchFaction(factionID);\n\t\t\t\tfinal Faction.FRange FR=fac.getRange(factionID,factionAmt);\n\t\t\t\tif((FR!=null)\n\t\t\t\t&&(F.showInScore()))\n\t\t\t\t{\n\t\t\t\t\tif(useFactionWords)\n\t\t\t\t\t\tmsg.append(L("^NYour ")+CMStrings.padRight(L("^<HELP^>@x1^</HELP^>",F.name()),15)+": ^H"+FR.name()+" ^.\\n\\r");\n\t\t\t\t\telse\n\t\t\t\t\t\tmsg.append(L("^NYour ")+CMStrings.padRight(L("^<HELP^>@x1^</HELP^>",F.name()),15)+": ^H"+FR.name()+" ^.("+factionAmt+")\\n\\r");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif((CMProps.getIntVar(CMProps.Int.COMBATPROWESS)&CMProps.Int.ANY_ARMOR_PROWESS)!=0)\n\t\t\tmsg.append(L("Your ^<HELP^>armored defence^</HELP^>: ^H@x1^.^N\\n\\r",CMLib.combat().armorStr(mob)));\n\t\tif((CMProps.getIntVar(CMProps.Int.COMBATPROWESS)&CMProps.Int.ANY_COMBAT_PROWESS)!=0)\n\t\t\tmsg.append(L("Your ^<HELP^>combat prowess^</HELP^> : ^H@x1^.^N\\n\\r",CMLib.combat().fightingProwessStr(mob)));\n\t\tif((CMProps.getIntVar(CMProps.Int.COMBATPROWESS)&CMProps.Int.ANY_DAMAGE_PROWESS)!=0)\n\t\t\tmsg.append(L("Your ^<HELP^>damage threat^</HELP^>  : ^H@x1^.^N\\n\\r",CMLib.combat().damageProwessStr(mob)));\n\t\t//if(CMLib.flags().canSeeHidden(mob))\n\t\t//    msg.append(L("Your ^<HELP^>observation score^</HELP^> : ^H@x1^?.\\n\\r",CMLib.flags().getDetectScore(mob)));\n\t\tmsg.append(L("Wimpy is set to ^!@x1^? hit points.\\n\\r",""+mob.getWimpHitPoint()));\n\n\t\tmsg.append(getMOBState(mob));\n\t\tmsg.append(getAffects(mob.session(),mob,false,false));\n\t\treturn msg;\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\tString parm="";\n\t\tif(commands.size()>1)\n\t\t\tparm=CMParms.combine(commands,1);\n\t\tfinal StringBuilder msg=getScore(mob,parm);\n\t\tif(commands.size()==0)\n\t\t{\n\t\t\tcommands.add(msg.toString());\n\t\t\treturn false;\n\t\t}\n\t\tif(!mob.isMonster())\n\t\t\tmob.session().wraplessPrintln(msg.toString());\n\t\treturn false;\n\t}\n\n\t@Override\n\tpublic boolean canBeOrdered()\n\t{\n\t\treturn true;\n\t}\n\n}\n', 'message': '\n\ngit-svn-id: svn://192.168.1.10/public/CoffeeMud@4988 0d6f1817-ed0e-0410-87c9-987e46238f29\n', 'author_name': 'bozimmerman', 'lang': 'java'}