com.planet_ink.coffee_mud.Common
Class DefaultSocial

java.lang.Object
  extended by com.planet_ink.coffee_mud.Common.DefaultSocial
All Implemented Interfaces:
CMCommon, Social, CMObject, Contingent, Environmental, Modifiable, MsgListener, StatsAffecting, Tickable, java.lang.Cloneable, java.lang.Comparable<CMObject>

public class DefaultSocial
extends java.lang.Object
implements Social


Field Summary
protected  boolean amDestroyed
           
protected  java.lang.String failedTargetMsg
           
protected  boolean isTargetable
           
protected  int othersCode
           
protected  java.lang.String othersSeeMsg
           
protected  java.lang.String socialArg
           
protected  java.lang.String socialBaseName
           
protected  java.lang.String socialFullID
           
protected  java.lang.String socialFullTail
           
protected  java.lang.String socialTarget
           
protected  java.lang.String soundFile
           
protected  int sourceCode
           
protected  java.lang.String sourceMsg
           
protected  int targetCode
           
protected  java.lang.String targetSeesMsg
           
 
Fields inherited from interface com.planet_ink.coffee_mud.core.interfaces.Tickable
STATUS_AFFECT, STATUS_ALIVE, STATUS_BEHAVIOR, STATUS_CLASS, STATUS_DEAD, STATUS_END, STATUS_FIGHT, STATUS_MISC, STATUS_MISC2, STATUS_MISC3, STATUS_MISC4, STATUS_MISC5, STATUS_MISC6, STATUS_MISC7, STATUS_NOT, STATUS_OTHER, STATUS_RACE, STATUS_REBIRTH, STATUS_SCRIPT, STATUS_START, STATUS_WEATHER, TICKID_AREA, TICKID_BEAMWEAPON, TICKID_CLAN, TICKID_CLANITEM, TICKID_DEADBODY_DECAY, TICKID_ELECTRONICS, TICKID_EMAIL, TICKID_EXIT_BEHAVIOR, TICKID_EXIT_REOPEN, TICKID_ITEM_BEHAVIOR, TICKID_ITEM_BOUNCEBACK, TICKID_LIGHT_FLICKERS, TICKID_LIVEAUCTION, TICKID_LONGERMASK, TICKID_MISCELLANEOUS, TICKID_MOB, TICKID_PROPERTY_SPECIAL, TICKID_QUEST, TICKID_READYTOSTOP, TICKID_ROOM_BEHAVIOR, TICKID_ROOM_ITEM_REJUV, TICKID_SOLITARYMASK, TICKID_SPECIALCOMBAT, TICKID_SPECIALMANEUVER, TICKID_SPELL_AFFECT, TICKID_SUPPORT, TICKID_TIMEAUCTION, TICKID_TRAP_DESTRUCTION, TICKID_TRAP_RESET
 
Constructor Summary
DefaultSocial()
           
 
Method Summary
 double actionsCost(MOB mob, java.util.List<java.lang.String> cmds)
          Returns the number of actions required to completely activate this social.
 void affectCharState(MOB affectedMob, CharState affectableMaxState)
          This method is called by the recoverCharState() method on other MOB objects.
 void affectCharStats(MOB affectedMob, CharStats affectableStats)
          This method is called by the recoverCharStats() method on other MOB objects.
 void affectPhyStats(Physical affected, PhyStats affectableStats)
          This method is called by the recoverPhyStats() method on other Environmental objects.
 boolean amDestroyed()
          Whether the destroy() method has been previousy called on this object.
 java.lang.String argumentName()
          Argument name is the social's optional remaining argument.
protected  boolean awardRPXP(MOB mob)
           
 java.lang.String baseName()
          Base name is the name of the social's command word.
 double checkedActionsCost(MOB mob, java.util.List<java.lang.String> cmds)
          Returns the number of actions required to completely activate this social.
protected  void cloneFix(Social E)
           
 double combatActionsCost(MOB mob, java.util.List<java.lang.String> cmds)
          Returns the number of actions required to completely activate this social.
 int compareTo(CMObject o)
           
 CMObject copyOf()
          Similar to Cloneable.clone(), but does its best to make sure that any internal objects to this class are also copyOfed.
 java.lang.String description()
          The basic description of this object, as shown when the item is directly LOOKed at.
 void destroy()
          Utterly and permanently destroy this object, not only removing it from the map, but causing this object to be collected as garbage by Java.
 java.lang.String displayText()
          Gets the raw string used to show what this object looks like in the room.
 void executeMsg(Environmental myHost, CMMsg msg)
          The general message event handler for the object.
 long expirationDate()
          If this object expires, it should have a timestamp saying when it expires, in real time.
protected  int getCodeNum(java.lang.String code)
           
 java.lang.String getFailedTargetMessage()
          See_when_no_target: what the player sees when this social is used targeted, but the target is not available.
 int getOthersCode()
          The official CoffeeMud message code used as the others code for this social, which reflects what the player appears to be doing.
 java.lang.String getOthersMessage()
          Third_party_sees: what everyone but the player and their target sees when a player uses this social.
 int getSaveStatIndex()
          Returns the index into the stat codes array where extra savable fields begins.
 java.lang.String getSoundFile()
          Returns the name of the MSP sound file associated with this social.
 int getSourceCode()
          The official CoffeeMud message code used as the source code for this social, which reflects what the player is doing.
 java.lang.String getSourceMessage()
          You_see: what the player themself sees when they use this social.
 java.lang.String getStat(java.lang.String code)
          An alternative means of retreiving the values of those fields on this object which are modifiable at run-time by builders.
 java.lang.String[] getStatCodes()
          Returns an array of the string names of those fields which are modifiable on this object at run-time by builders.
 int getTargetCode()
          The official CoffeeMud message code used as the target code for this social, which reflects what is being done to the target.
 java.lang.String getTargetMessage()
          Target_sees: what the target of this social sees when social is used on them.
 int getTickStatus()
          A coded status for this object during the period where its tick method is being called.
 java.lang.String ID()
          The CoffeeMud Java Class ID shared by all instances of this object.
 java.lang.String image()
          Returns the fully qualified and determined name of the image file displayed for this object when MXP is used.
 void initializeClass()
          Called ONCE after all objects are loaded, but before the map is read in during initialization.
 boolean invoke(MOB mob, java.util.List<java.lang.String> commands, Physical target, boolean auto)
          Executes this social by the given mob, using the target provided, with help from the provided command line strings in a vector, and with override message code flag.
 boolean isGeneric()
          Whether the fields of this item are set in code, or set by builders.
 boolean isSavable()
          Whether, if this object is in a room, whether it is appropriate to save this object to the database as a permanent feature of its container.
 boolean isStat(java.lang.String code)
          An alternative means of retreiving the values of those fields on this object which are modifiable at run-time by builders.
 boolean isTargetable()
          Returns whether targetName is an -NAME> code, meaning it is targettable at a person or mob or something.
 java.lang.String L(java.lang.String str, java.lang.String... xs)
          Localize an internal string -- shortcut.
 CMMsg makeChannelMsg(MOB mob, int channelInt, java.lang.String channelName, java.util.List<java.lang.String> commands, boolean makeTarget)
          Manufactures a proper channel message that represents executing this social over a public chat channel.
 CMMsg makeMessage(MOB mob, java.lang.String str, java.lang.String end, int srcMask, int fullCode, java.util.List<java.lang.String> commands, java.lang.String I3channelName, boolean makeTarget)
          Manufactures a proper message that represents executing this social as an action
 int maxRange()
          the maximum range of this object, if applicable.
 int minRange()
          the minimum range of this object, if applicable.
 java.lang.String miscTextFormat()
          Unimplemented as of yet, but will hold a string telling the system what the proper format of any miscText data.
 java.lang.String name()
          The nice displayable name of this instance of this object
 java.lang.String Name()
          The raw unmodified name of this object as stored in the database.
 CMObject newInstance()
          Returns a new instance of this class.
 boolean okMessage(Environmental myHost, CMMsg msg)
          The general message event previewer for the object.
 java.lang.String rawImage()
          Returns the raw name of the image file to display for this object when MXP is used.
 boolean sameAs(Environmental E)
          Whether this object instance is functionally identical to the object passed in.
 void setDescription(java.lang.String str)
          Sets the basic description of this object, as shown when the item is directly LOOKed at.
 void setDisplayText(java.lang.String str)
          Sets the raw string used to show what this object looks like in the room.
 void setExpirationDate(long time)
          If this object expires, it should have a timestamp saying when it expires, in real time.
 void setFailedMessage(java.lang.String str)
          See_when_no_target: what the player sees when this social is used targeted, but the target is not available.
 void setImage(java.lang.String newImage)
          Sets the raw name of the image file to display for this object when MXP is used.
 void setMiscText(java.lang.String newMiscText)
          For objects which have false for their isGeneric method, this is used to set any internally coded strings to change the nature or behavior of the object.
 void setName(java.lang.String newName)
          Sets the raw unmodified name of this object as stored in the database.
 void setOthersCode(int code)
          Sets the official CoffeeMud message code used as the others code for this social, which reflects what the player appears to be doing.
 void setOthersMessage(java.lang.String str)
          Third_party_sees: what everyone but the player and their target sees when a player uses this social.
 void setSavable(boolean truefalse)
          Sets whether this object can be saved as a permanent aspect of its host.
 void setSoundFile(java.lang.String newFile)
          Sets the name of the MSP sound file associated with this social.
 void setSourceCode(int code)
          Sets the official CoffeeMud message code used as the source code for this social, which reflects what the player is doing.
 void setSourceMessage(java.lang.String str)
          You_see: what the player themself sees when they use this social.
 void setStat(java.lang.String code, java.lang.String val)
          An alternative means of setting the values of those fields on this object which are modifiable at run-time by builders.
 void setTargetCode(int code)
          Sets the official CoffeeMud message code used as the target code for this social, which reflects what is being done to the target.
 void setTargetMessage(java.lang.String str)
          Target_sees: what the target of this social sees when social is used on them.
 java.lang.String tailName()
          Tail name is the full remainder of the social's target AND optional argument(s).
 boolean targetable(Environmental E)
          Whether this social variation can be targeted.
 java.lang.String targetName()
          Target name is the social's target argument only, such as .
 java.lang.String text()
          For objects which have false for their isGeneric method, this is used to set any internally coded strings to change the nature or behavior of the object.
 boolean tick(Tickable ticking, int tickID)
          this is the method which is called periodically by the threading engine.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

socialFullID

protected java.lang.String socialFullID

socialFullTail

protected java.lang.String socialFullTail

socialBaseName

protected java.lang.String socialBaseName

socialTarget

protected java.lang.String socialTarget

isTargetable

protected boolean isTargetable

socialArg

protected java.lang.String socialArg

sourceMsg

protected java.lang.String sourceMsg

othersSeeMsg

protected java.lang.String othersSeeMsg

targetSeesMsg

protected java.lang.String targetSeesMsg

failedTargetMsg

protected java.lang.String failedTargetMsg

soundFile

protected java.lang.String soundFile

sourceCode

protected int sourceCode

othersCode

protected int othersCode

targetCode

protected int targetCode

amDestroyed

protected boolean amDestroyed
Constructor Detail

DefaultSocial

public DefaultSocial()
Method Detail

ID

public java.lang.String ID()
Description copied from interface: CMObject
The CoffeeMud Java Class ID shared by all instances of this object. Unlike the Java Class name, this method does not include package information. However, it must return a String value unique to its class category in the ClassLoader. Class categories include Libraries, Common, Areas, Abilities, Behaviors, CharClasses, Commands, Exits Locales, MOBS, Races, WebMacros, Basic Items, Armor, Weapons, ClanItems, Tech. The name is typically identical to the class name.

Specified by:
ID in interface CMObject
Returns:
the name of this class

name

public java.lang.String name()
Description copied from interface: Tickable
The nice displayable name of this instance of this object

Specified by:
name in interface CMObject
Specified by:
name in interface Tickable
Returns:
the displayable name of this object instance
See Also:
Environmental.Name()

Name

public java.lang.String Name()
Description copied from interface: Environmental
The raw unmodified name of this object as stored in the database. This is the name set by builders and used as a basis for the name() method.

Specified by:
Name in interface Environmental
Returns:
the raw base name of this object on the map.
See Also:
Tickable.name()

baseName

public java.lang.String baseName()
Description copied from interface: Social
Base name is the name of the social's command word. It is NOT unique to a social object however, since a socials name usually includes its target extension.

Specified by:
baseName in interface Social
Returns:
the base name

tailName

public java.lang.String tailName()
Description copied from interface: Social
Tail name is the full remainder of the social's target AND optional argument(s). It is NOT unique to a social object however, since a socials name usually includes its target extension.

Specified by:
tailName in interface Social
Returns:
the full tail name

isTargetable

public boolean isTargetable()
Description copied from interface: Social
Returns whether targetName is an -NAME> code, meaning it is targettable at a person or mob or something.

Specified by:
isTargetable in interface Social
Returns:
true if this social is targetable at someone other than the user

targetName

public java.lang.String targetName()
Description copied from interface: Social
Target name is the social's target argument only, such as . It is NOT unique to a social object however, since a socials name usually includes their target extension.

Specified by:
targetName in interface Social
Returns:
the target name, if any

argumentName

public java.lang.String argumentName()
Description copied from interface: Social
Argument name is the social's optional remaining argument. This requires that the social be targetable, and further specifies something about the target, or a qualifier. It is NOT unique to a social object however, since a socials name usually includes their target extension and name and stuff.

Specified by:
argumentName in interface Social
Returns:
the socials optional remaining argument.

L

public java.lang.String L(java.lang.String str,
                          java.lang.String... xs)
Description copied from interface: Environmental
Localize an internal string -- shortcut. Same as calling:

Specified by:
L in interface Environmental
Parameters:
str - the string to translate
xs - the array of variables to replace
Returns:
the translated string, with all variables in place
See Also:
Call with the string to translate, which may contain variables of the form @x1, @x2, etc. The array in xs is then used to replace the variables AFTER the string is translated.

setName

public void setName(java.lang.String newName)
Description copied from interface: Environmental
Sets the raw unmodified name of this object as stored in the database. This is the name set by builders and used as a basis for the name() method.

Specified by:
setName in interface Environmental
Parameters:
newName - the raw base name of this object on the map.
See Also:
Environmental.Name()

getSourceMessage

public java.lang.String getSourceMessage()
Description copied from interface: Social
You_see: what the player themself sees when they use this social.

Specified by:
getSourceMessage in interface Social
Returns:
what the player themself sees when they use this social.
See Also:
Social.setSourceMessage(String)

getOthersMessage

public java.lang.String getOthersMessage()
Description copied from interface: Social
Third_party_sees: what everyone but the player and their target sees when a player uses this social.

Specified by:
getOthersMessage in interface Social
Returns:
the string everyone else sees
See Also:
Social.setOthersMessage(String)

getTargetMessage

public java.lang.String getTargetMessage()
Description copied from interface: Social
Target_sees: what the target of this social sees when social is used on them.

Specified by:
getTargetMessage in interface Social
Returns:
what the target of this social sees when social is used on them
See Also:
Social.setTargetMessage(String)

getFailedTargetMessage

public java.lang.String getFailedTargetMessage()
Description copied from interface: Social
See_when_no_target: what the player sees when this social is used targeted, but the target is not available.

Specified by:
getFailedTargetMessage in interface Social
Returns:
the string seen by the player when the target has left
See Also:
Social.setFailedMessage(String)

getSourceCode

public int getSourceCode()
Description copied from interface: Social
The official CoffeeMud message code used as the source code for this social, which reflects what the player is doing. Only certain codes allowed.

Specified by:
getSourceCode in interface Social
Returns:
the CMMsg social code, fully formed
See Also:
Social.setSourceCode(int), CMMsg.MSG_SPEAK, CMMsg.MSG_HANDS, CMMsg.MSG_NOISE, CMMsg.MSG_NOISYMOVEMENT

getOthersCode

public int getOthersCode()
Description copied from interface: Social
The official CoffeeMud message code used as the others code for this social, which reflects what the player appears to be doing. Only certain codes allowed.

Specified by:
getOthersCode in interface Social
Returns:
the CMMsg social code, fully formed
See Also:
Social.setOthersCode(int), CMMsg.MSG_SPEAK, CMMsg.MSG_HANDS, CMMsg.MSG_NOISE, CMMsg.MSG_NOISYMOVEMENT, CMMsg.MSG_OK_VISUAL

getTargetCode

public int getTargetCode()
Description copied from interface: Social
The official CoffeeMud message code used as the target code for this social, which reflects what is being done to the target. Only certain codes allowed.

Specified by:
getTargetCode in interface Social
Returns:
the CMMsg social code, fully formed
See Also:
Social.setTargetCode(int), CMMsg.MSG_SPEAK, CMMsg.MSG_HANDS, CMMsg.MSG_NOISE, CMMsg.MSG_NOISYMOVEMENT, CMMsg.MSG_OK_VISUAL

setSourceMessage

public void setSourceMessage(java.lang.String str)
Description copied from interface: Social
You_see: what the player themself sees when they use this social.

Specified by:
setSourceMessage in interface Social
Parameters:
str - what the player themself sees when they use this social.
See Also:
Social.getSourceMessage()

setOthersMessage

public void setOthersMessage(java.lang.String str)
Description copied from interface: Social
Third_party_sees: what everyone but the player and their target sees when a player uses this social.

Specified by:
setOthersMessage in interface Social
Parameters:
str - the string everyone else sees
See Also:
Social.getOthersMessage()

setTargetMessage

public void setTargetMessage(java.lang.String str)
Description copied from interface: Social
Target_sees: what the target of this social sees when social is used on them.

Specified by:
setTargetMessage in interface Social
Parameters:
str - what the target of this social sees when social is used on them
See Also:
Social.getTargetMessage()

setFailedMessage

public void setFailedMessage(java.lang.String str)
Description copied from interface: Social
See_when_no_target: what the player sees when this social is used targeted, but the target is not available.

Specified by:
setFailedMessage in interface Social
Parameters:
str - the string seen by the player when the target has left
See Also:
Social.getFailedTargetMessage()

setSourceCode

public void setSourceCode(int code)
Description copied from interface: Social
Sets the official CoffeeMud message code used as the source code for this social, which reflects what the player is doing. Only certain codes allowed.

Specified by:
setSourceCode in interface Social
Parameters:
code - the CMMsg social code, fully formed
See Also:
Social.getSourceCode(), CMMsg.MSG_SPEAK, CMMsg.MSG_HANDS, CMMsg.MSG_NOISE, CMMsg.MSG_NOISYMOVEMENT

setOthersCode

public void setOthersCode(int code)
Description copied from interface: Social
Sets the official CoffeeMud message code used as the others code for this social, which reflects what the player appears to be doing. Only certain codes allowed.

Specified by:
setOthersCode in interface Social
Parameters:
code - the CMMsg social code, fully formed
See Also:
Social.getOthersCode(), CMMsg.MSG_SPEAK, CMMsg.MSG_HANDS, CMMsg.MSG_NOISE, CMMsg.MSG_NOISYMOVEMENT, CMMsg.MSG_OK_VISUAL

setTargetCode

public void setTargetCode(int code)
Description copied from interface: Social
Sets the official CoffeeMud message code used as the target code for this social, which reflects what is being done to the target. Only certain codes allowed.

Specified by:
setTargetCode in interface Social
Parameters:
code - the CMMsg social code, fully formed
See Also:
Social.getTargetCode(), CMMsg.MSG_SPEAK, CMMsg.MSG_HANDS, CMMsg.MSG_NOISE, CMMsg.MSG_NOISYMOVEMENT, CMMsg.MSG_OK_VISUAL

getTickStatus

public int getTickStatus()
Description copied from interface: Tickable
A coded status for this object during the period where its tick method is being called. The statis is defined, at least in part, by constants in this interface STATUS_*. STATUS_NOT should be returned when the objects tick method is not currently in execution. It should never return STATUS_NOT when the objects tick method is in execution.

Specified by:
getTickStatus in interface Tickable
Returns:
the numeric status of this object
See Also:
Tickable.tick(Tickable, int)

getSoundFile

public java.lang.String getSoundFile()
Description copied from interface: Social
Returns the name of the MSP sound file associated with this social.

Specified by:
getSoundFile in interface Social
Returns:
the msp sound file name
See Also:
Social.setSoundFile(String)

setSoundFile

public void setSoundFile(java.lang.String newFile)
Description copied from interface: Social
Sets the name of the MSP sound file associated with this social.

Specified by:
setSoundFile in interface Social
Parameters:
newFile - the msp sound file name
See Also:
Social.getSoundFile()

expirationDate

public long expirationDate()
Description copied from interface: Environmental
If this object expires, it should have a timestamp saying when it expires, in real time. When it expires, a MSG_EXPIRE message will be sent to it.

Specified by:
expirationDate in interface Environmental
Returns:
the time stamp when this thing expires
See Also:
Environmental.setExpirationDate(long)

setExpirationDate

public void setExpirationDate(long time)
Description copied from interface: Environmental
If this object expires, it should have a timestamp saying when it expires, in real time. When it expires, a MSG_EXPIRE message will be sent to it.

Specified by:
setExpirationDate in interface Environmental
Parameters:
time - the time stamp when this thing expires
See Also:
Environmental.expirationDate()

targetable

public boolean targetable(Environmental E)
Description copied from interface: Social
Whether this social variation can be targeted. Is determined by whether there is a target parameter in the name.

Specified by:
targetable in interface Social
Parameters:
E - The object to check to see if this is targetable against.
Returns:
true, if it can be targeted
See Also:
Environmental.Name()

awardRPXP

protected boolean awardRPXP(MOB mob)

invoke

public boolean invoke(MOB mob,
                      java.util.List<java.lang.String> commands,
                      Physical target,
                      boolean auto)
Description copied from interface: Social
Executes this social by the given mob, using the target provided, with help from the provided command line strings in a vector, and with override message code flag. It will generate a proper message and send it to the same room as the mob.

Specified by:
invoke in interface Social
Parameters:
mob - the source of the social action
commands - the vector of strings
target - the target of the social
auto - true to override physical constraints of the source or target
Returns:
true, if successful

makeChannelMsg

public CMMsg makeChannelMsg(MOB mob,
                            int channelInt,
                            java.lang.String channelName,
                            java.util.List<java.lang.String> commands,
                            boolean makeTarget)
Description copied from interface: Social
Manufactures a proper channel message that represents executing this social over a public chat channel.

Specified by:
makeChannelMsg in interface Social
Parameters:
mob - the mob doing the social
channelInt - the channel int representing which chat channel
channelName - the channel name of the chat channel
commands - the commands as a string vector entered by the user
makeTarget - true to create a fake target, or false to find a real one.
Returns:
the CMMsg that can now be sent to the world as a chat channel message
See Also:
CMMsg, Social.makeMessage(MOB, String, String, int, int, List, String, boolean)

makeMessage

public CMMsg makeMessage(MOB mob,
                         java.lang.String str,
                         java.lang.String end,
                         int srcMask,
                         int fullCode,
                         java.util.List<java.lang.String> commands,
                         java.lang.String I3channelName,
                         boolean makeTarget)
Description copied from interface: Social
Manufactures a proper message that represents executing this social as an action

Specified by:
makeMessage in interface Social
Parameters:
mob - the mob doing the social
str - the str an optional "header" string for the msg, usually mxp related
end - the end an optional "trailer" string for the msg, usually mxp related
srcMask - the src mask to logically OR with the generated message source code
fullCode - the override target and others code from the one in this social
commands - the commands as a string vector entered by the user
I3channelName - the i3channel name or null if n/a
makeTarget - true to manufacture a target, or false to use a real one
Returns:
the CMMsg that can now be sent to the world as a chat channel message
See Also:
CMMsg, Social.makeChannelMsg(MOB, int, String, List, boolean)

description

public java.lang.String description()
Description copied from interface: Environmental
The basic description of this object, as shown when the item is directly LOOKed at.

Specified by:
description in interface Environmental
Returns:
the basic detail description of this object

setDescription

public void setDescription(java.lang.String str)
Description copied from interface: Environmental
Sets the basic description of this object, as shown when the item is directly LOOKed at.

Specified by:
setDescription in interface Environmental
Parameters:
str - the basic detail description of this object

displayText

public java.lang.String displayText()
Description copied from interface: Environmental
Gets the raw string used to show what this object looks like in the room. May be used as a basis for other methods, such as the title of rooms, and what an exit looks like when open. The value for Items may be null if the item is not displayed when the room is seen.

Specified by:
displayText in interface Environmental
Returns:
the string describing how this object looks in the room

setDisplayText

public void setDisplayText(java.lang.String str)
Description copied from interface: Environmental
Sets the raw string used to show what this object looks like in the room. May be used as a basis for other methods, such as the title of rooms, and what an exit looks like when open. The value for Items may be null if the item is not displayed when the room is seen.

Specified by:
setDisplayText in interface Environmental
Parameters:
str - the string describing how this object looks in the room

newInstance

public CMObject newInstance()
Description copied from interface: CMObject
Returns a new instance of this class.

Specified by:
newInstance in interface CMObject
Returns:
a new instance of this class

initializeClass

public void initializeClass()
Description copied from interface: CMObject
Called ONCE after all objects are loaded, but before the map is read in during initialization.

Specified by:
initializeClass in interface CMObject

compareTo

public int compareTo(CMObject o)
Specified by:
compareTo in interface java.lang.Comparable<CMObject>

destroy

public void destroy()
Description copied from interface: Contingent
Utterly and permanently destroy this object, not only removing it from the map, but causing this object to be collected as garbage by Java. Containers, rooms. and mobs who have their destroy() method called will also call the destroy() methods on all items and other objects listed as content, recursively.

Specified by:
destroy in interface Contingent

amDestroyed

public boolean amDestroyed()
Description copied from interface: Contingent
Whether the destroy() method has been previousy called on this object.

Specified by:
amDestroyed in interface Contingent
Returns:
whether the object is destroy()ed.

isSavable

public boolean isSavable()
Description copied from interface: Contingent
Whether, if this object is in a room, whether it is appropriate to save this object to the database as a permanent feature of its container. It always returns true except under unique circumstances.

Specified by:
isSavable in interface Contingent
Returns:
true, usually.

setSavable

public void setSavable(boolean truefalse)
Description copied from interface: Contingent
Sets whether this object can be saved as a permanent aspect of its host.

Specified by:
setSavable in interface Contingent
Parameters:
truefalse - whether this behavior can be saved as part of its host.
See Also:
Contingent.isSavable()

getSaveStatIndex

public int getSaveStatIndex()
Description copied from interface: Modifiable
Returns the index into the stat codes array where extra savable fields begins. This number is always the same as getStatCodes().length unless there are extra fields which need to be saved in xml for generic objects. This method is used by editors for post-build user-defined fields.

Specified by:
getSaveStatIndex in interface Modifiable
Returns:
the index into getStatCodes()
See Also:
Modifiable.getStatCodes(), Modifiable.getStat(String), Modifiable.setStat(String, String)

getStatCodes

public java.lang.String[] getStatCodes()
Description copied from interface: Modifiable
Returns an array of the string names of those fields which are modifiable on this object at run-time by builders.

Specified by:
getStatCodes in interface Modifiable
Returns:
list of the fields which may be set.
See Also:
Modifiable.getStat(String), Modifiable.setStat(String, String)

isStat

public boolean isStat(java.lang.String code)
Description copied from interface: Modifiable
An alternative means of retreiving the values of those fields on this object which are modifiable at run-time by builders. See getStatCodes() for possible values for the code passed to this method. Values returned are always strings, even if the field itself is numeric or a list.

Specified by:
isStat in interface Modifiable
Parameters:
code - the name of the field to read.
Returns:
true if the code is a real value, false otherwise
See Also:
Modifiable.getStatCodes()

getCodeNum

protected int getCodeNum(java.lang.String code)

getStat

public java.lang.String getStat(java.lang.String code)
Description copied from interface: Modifiable
An alternative means of retreiving the values of those fields on this object which are modifiable at run-time by builders. See getStatCodes() for possible values for the code passed to this method. Values returned are always strings, even if the field itself is numeric or a list.

Specified by:
getStat in interface Modifiable
Parameters:
code - the name of the field to read.
Returns:
the value of the field read
See Also:
Modifiable.getStatCodes()

setStat

public void setStat(java.lang.String code,
                    java.lang.String val)
Description copied from interface: Modifiable
An alternative means of setting the values of those fields on this object which are modifiable at run-time by builders. See getStatCodes() for possible values for the code passed to this method. The value passed in is always a string, even if the field itself is numeric or a list.

Specified by:
setStat in interface Modifiable
Parameters:
code - the name of the field to set
val - the value to set the field to
See Also:
Modifiable.getStatCodes()

sameAs

public boolean sameAs(Environmental E)
Description copied from interface: Environmental
Whether this object instance is functionally identical to the object passed in. Works by repeatedly calling getStat on both objects and comparing the values.

Specified by:
sameAs in interface Environmental
Parameters:
E - the object to compare this one to
Returns:
whether this object is the same as the one passed in
See Also:
Modifiable.getStatCodes(), Modifiable.getStat(String)

cloneFix

protected void cloneFix(Social E)

copyOf

public CMObject copyOf()
Description copied from interface: CMObject
Similar to Cloneable.clone(), but does its best to make sure that any internal objects to this class are also copyOfed.

Specified by:
copyOf in interface CMObject
Returns:
a clone of this object

setMiscText

public void setMiscText(java.lang.String newMiscText)
Description copied from interface: Environmental
For objects which have false for their isGeneric method, this is used to set any internally coded strings to change the nature or behavior of the object. For objects which have true for their isGeneric method, this is used to set and parse the XML which will be used to fill out the fields in this object. Since Ability objects are never Generic, this will always be where parameters are read from an Ability instance.

Specified by:
setMiscText in interface Environmental
Parameters:
newMiscText - either an open internal text string, or XML

text

public java.lang.String text()
Description copied from interface: Environmental
For objects which have false for their isGeneric method, this is used to set any internally coded strings to change the nature or behavior of the object. For objects which have true for their isGeneric method, this is used to set and parse the XML which will be used to fill out the fields in this object. Since Ability objects are never Generic, this will always be where parameters are read from an Ability instance.

Specified by:
text in interface Environmental
Returns:
either an open internal text string, or XML

miscTextFormat

public java.lang.String miscTextFormat()
Description copied from interface: Environmental
Unimplemented as of yet, but will hold a string telling the system what the proper format of any miscText data. Will use the CMParms.MTFORMAT_* constants for definition.

Specified by:
miscTextFormat in interface Environmental
Returns:
the format expected for the miscText field
See Also:
CMParms, Environmental.text(), Environmental.setMiscText(String)

affectPhyStats

public void affectPhyStats(Physical affected,
                           PhyStats affectableStats)
Description copied from interface: StatsAffecting
This method is called by the recoverPhyStats() method on other Environmental objects. It is used to transform the Environmental basePhyStats() object into a finished phyStats() object, both of which are objects implementing the PhyStats interface. See those methods for more information.

Specified by:
affectPhyStats in interface StatsAffecting
Parameters:
affected - the host of the PhyStats object being affected
affectableStats - the particular PhyStats object being affected
See Also:
PhyStats, Environmental, Affectable.basePhyStats(), Affectable.phyStats(), Affectable.recoverPhyStats()

affectCharStats

public void affectCharStats(MOB affectedMob,
                            CharStats affectableStats)
Description copied from interface: StatsAffecting
This method is called by the recoverCharStats() method on other MOB objects. It is used to transform the MOB baseCharStats() object into a finished charStats() object, both of which are objects implementing the CharStats interface. See those methods for more information.

Specified by:
affectCharStats in interface StatsAffecting
Parameters:
affectedMob - the host of the CharStats object being affected
affectableStats - the particular CharStats object being affected
See Also:
CharStats, MOB, MOB.baseCharStats(), MOB.charStats(), MOB.recoverCharStats()

affectCharState

public void affectCharState(MOB affectedMob,
                            CharState affectableMaxState)
Description copied from interface: StatsAffecting
This method is called by the recoverCharState() method on other MOB objects. It is used to transform the MOB baseCharState() object into a finished charState() object, both of which are objects implementing the CharState interface. See those methods for more information.

Specified by:
affectCharState in interface StatsAffecting
Parameters:
affectedMob - the host of the CharState object being affected
affectableMaxState - the particular CharState object being affected
See Also:
CharState, MOB, MOB.baseState(), MOB.curState(), MOB.recoverMaxState()

executeMsg

public void executeMsg(Environmental myHost,
                       CMMsg msg)
Description copied from interface: MsgListener
The general message event handler for the object. Messages passed herein may not necessarily be FOR this object, or from it, but will almost always represent events happening in the same room. The messages have already been through an approval process, so this method is called only to affect the final execution of the meaning of the message. Every game event goes through these methods.

Specified by:
executeMsg in interface MsgListener
Parameters:
myHost - either the initiator of the event, or the host of this object
msg - the CMMsg that needs to be executed
See Also:
CMMsg

okMessage

public boolean okMessage(Environmental myHost,
                         CMMsg msg)
Description copied from interface: MsgListener
The general message event previewer for the object. Messages passed herein are in a pending state, and may be safely modified or rejected without fear that they might be in the middle of being executed. Messages passed herein may not necessarily be FOR or FROM this object, but will almost always represent events which want to happen in the same rom. This method should always always return true UNLESS this message needs to be canceled, in which case it is necessary to tell the mob initiating the event (CMMsg.source()) why it is being cancelled. Every game event goes through these methods.

Specified by:
okMessage in interface MsgListener
Parameters:
myHost - either the initiator of the event, or the host of this object
msg - the CMMsg that wants to be executed
Returns:
whether this message is allowed to execute
See Also:
CMMsg, CMMsg.source()

tick

public boolean tick(Tickable ticking,
                    int tickID)
Description copied from interface: Tickable
this is the method which is called periodically by the threading engine. How often it is called depends on the parameters passed to the threadding engine when it is submitted for thread access. Typically the period is once per TIME_TICK period, but that is determined when the object is submitted to the thread engine.

Specified by:
tick in interface Tickable
Parameters:
ticking - a reference to this Tickable object
tickID - the TICKID_ constant describing this periodic call, as defined in Tickable
Returns:
true always, unless this object no longer wishes to ever tick again, in which case false
See Also:
Tickable, ServiceEngine, TickableGroup

maxRange

public int maxRange()
Description copied from interface: Environmental
the maximum range of this object, if applicable. Can refer to the size of a room, the range of a weapon, or the calculated range of a mob in combat.

Specified by:
maxRange in interface Environmental
Returns:
the maximum range

minRange

public int minRange()
Description copied from interface: Environmental
the minimum range of this object, if applicable. Can refer to the size of a room, the range of a weapon, or the calculated range of a mob in combat. Usually 0.

Specified by:
minRange in interface Environmental
Returns:
the minimum range

image

public java.lang.String image()
Description copied from interface: Environmental
Returns the fully qualified and determined name of the image file displayed for this object when MXP is used. If rawImage() is non-empty, it will return rawImage, and otherwise use the mxp default data file.

Specified by:
image in interface Environmental
Returns:
the name of the mxp image to display for this object.

rawImage

public java.lang.String rawImage()
Description copied from interface: Environmental
Returns the raw name of the image file to display for this object when MXP is used. This is the value set by the builder, and may be returned by image() if it is non-empty.

Specified by:
rawImage in interface Environmental
Returns:
the raw name of the mxp image file

setImage

public void setImage(java.lang.String newImage)
Description copied from interface: Environmental
Sets the raw name of the image file to display for this object when MXP is used. This is the value set by the builder, and may be returned by image() if it is non-empty.

Specified by:
setImage in interface Environmental
Parameters:
newImage - the raw name of the mxp image file

isGeneric

public boolean isGeneric()
Description copied from interface: Environmental
Whether the fields of this item are set in code, or set by builders. Generic means that they are set by builders, in which case XML is returned by the text() method containing all of the values for all the fields.

Specified by:
isGeneric in interface Environmental
Returns:
whether this item is modifiable by builders
See Also:
Environmental.text()

actionsCost

public double actionsCost(MOB mob,
                          java.util.List<java.lang.String> cmds)
Description copied from interface: Social
Returns the number of actions required to completely activate this social. A value of 0.0 means perform instantly. This method only applies when the user is not in combat.

Specified by:
actionsCost in interface Social
Parameters:
mob - the mob executing the social, if any
cmds - the parameters to be passed to the social, if any
Returns:
the number of player free actions required to do this
See Also:
Social.combatActionsCost(MOB, List), Social.checkedActionsCost(MOB, List)

combatActionsCost

public double combatActionsCost(MOB mob,
                                java.util.List<java.lang.String> cmds)
Description copied from interface: Social
Returns the number of actions required to completely activate this social. A value of 0.0 means perform instantly. This method only applies when the user is fighting in social.

Specified by:
combatActionsCost in interface Social
Parameters:
mob - the mob executing the social, if any
cmds - the parameters to be passed to the social, if any
Returns:
the number of player free actions required to do this
See Also:
Social.actionsCost(MOB, List), Social.checkedActionsCost(MOB, List)

checkedActionsCost

public double checkedActionsCost(MOB mob,
                                 java.util.List<java.lang.String> cmds)
Description copied from interface: Social
Returns the number of actions required to completely activate this social. A value of 0.0 means perform instantly. This method only should check whether the user is in combat and return a proper value.

Specified by:
checkedActionsCost in interface Social
Parameters:
mob - the mob executing the social, if any
cmds - the parameters to be passed to the social, if any
Returns:
the number of player free actions required to do this
See Also:
Social.combatActionsCost(MOB, List), Social.actionsCost(MOB, List)