cleoni.adv
Class AdvObject

java.lang.Object
  extended by cleoni.adv.ManageableObject
      extended by cleoni.adv.DimxObject
          extended by cleoni.adv.AdvObject
Direct Known Subclasses:
Character, Link, PeopleContainer

public class AdvObject
extends DimxObject

Game's base object. CHARACTER, ITEM, LINK and ROOM are AdvObjects All the common tasks and properties are here. Most of the DimX game code is here. Please see Class hierarchy of the Javadoc.


Field Summary
 Token capacity
           
 AdvObject container
           
 java.lang.String defContainer
           
 Token facing
           
 Token images
           
static int[] methodArgs
           
static java.lang.String[] methods
           
 Token showfor
           
 Token showmode
           
 Token volume
           
 
Fields inherited from class cleoni.adv.DimxObject
contents, id, name, properties, world
 
Constructor Summary
AdvObject(World aWorld, java.lang.String aName, java.lang.String anId, java.lang.String aDescription, java.lang.String anIcon, java.lang.String attrList, int aCapacity, int aVolume, boolean setDefShowpos, java.lang.String aDefContainer)
          AdvObject constructor comment.
 
Method Summary
 void afterWorldChange()
          Does any final operations after world change (typically calls reset() )
 boolean attachEvent(java.lang.String eventid, java.lang.String copyfromid, Token tcopyfrom)
          Attaches and event to the current object
 boolean close(Character agent)
           
protected  boolean contains(java.lang.String whatId)
           
 void copyFacesInto(java.lang.String[] res)
           
 void debug(java.lang.String s)
           
 void die(boolean removeFromContainer, int contentsPolicy)
          makes internal cleaning before object destruction
 Dict getContents(boolean checkOpen)
           
 java.lang.String getDescription(AdvObject agent, DictSorted input)
           
 Image getExactImage(java.lang.String face)
           
protected  int getFreeSpace()
           
 java.lang.String getIcon()
           
 int getMethodArgs(java.lang.String mname)
           
 java.lang.String[] getMethods()
           
 java.lang.Object[] getNearestImage(java.lang.String face)
           
 Panel getPanel()
           
 PeopleContainer getPeopleContainer()
          Gets the current container but checks if it is a regular "people container", that is, a Container object type.
 Room getRoom()
           
 java.lang.String getType()
           
 java.lang.String getType(boolean incSubTypes)
           
 java.lang.String getTypePrefix()
           
protected  int getUsedSpace()
           
 boolean go(java.lang.String wayId)
          Moves the object along a Link.
 boolean hasImageUrl(java.lang.String imageUrl)
           
protected  boolean hasSeveralFaces()
           
 boolean hear(DimxObject from, java.lang.String msg)
           
 boolean hide(java.lang.StringBuffer msg)
           
protected  boolean isAccessibleFrom(AdvObject from)
           
 boolean isHidden()
           
 boolean isHideable()
          only returns true if "hideable" exists and is true, or if "hideable" does not exist, returns true if "hidden" exists.
 boolean isLink()
           
 boolean isLockable()
          By default, items are NOT lockable
 boolean isLocked()
           
protected  boolean isNear(java.lang.String targFullId)
           
 boolean isOpen()
           
 boolean isOpenable()
           
 boolean isPeopleContainer()
           
 boolean isPickable()
           
 boolean isPlayer()
           
 boolean isRobot()
           
 boolean isVehicle()
           
 java.lang.String listImages()
           
 boolean moveTo(AdvObject where, AdvObject agent, boolean checkOpen, boolean checkEvents)
           
 boolean objPlace(AdvObject what, boolean checkOpen, AdvObject agent, boolean checkEvents)
          Places an object into this one.
 AdvObject objRemove(AdvObject what, AdvObject agent, AdvObject source, AdvObject dest, boolean checkOpen, boolean checkEvents)
           
 boolean open(Character agent)
           
 void reset()
          Resets the object in its initial position
 void setDescription(java.lang.String adescription)
           
 void setFacing(java.lang.String aDirection)
           
 void setHidden(boolean hidden)
          Only works on something that is already hideable.
 void setHideable(boolean hideable)
          Set "hideable" to the value provided.
 boolean setImage(java.lang.String face, Image anImage)
          sets the image for the specified face.
 void setLockable(boolean lockable)
          set the "lockable" property to the value provided.
 void setLocked(boolean locked)
          Only works on something that is already lockable.
 void setOpenable(boolean openable)
          set "openable" to the value provided.
 java.lang.String toString()
           
 Token varGet(java.lang.String varId, boolean getReference)
          Gets a property
protected  java.lang.String varGetIdAt(int i)
           
protected  int varsCount()
           
 boolean varsSet(java.lang.String attrlist)
           
 int varsToHtmlTable(java.lang.StringBuffer sb, java.lang.String title)
           
 void worldChange(World toWorld, java.lang.String newid, java.lang.String defContainer)
          Changes references to the world for the current object, and all its inner objects.
 
Methods inherited from class cleoni.adv.DimxObject
display, displayRight, execMethod, getContents, getId, getName, getObjectsByName, hasMethod, isaCharacter, isanItem, isaRoom, playBackground, playSound, refreshView, sendCmd, setPanel, useView, varExists, varGetAdvObj, varGetBool, varGetDimxObj, varGetInt, varGetStr, varSet, varSet, varSet, varSet, varSet
 
Methods inherited from class cleoni.adv.ManageableObject
varGet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

capacity

public Token capacity

volume

public Token volume

defContainer

public java.lang.String defContainer

images

public Token images

showfor

public Token showfor

showmode

public Token showmode

facing

public Token facing

container

public AdvObject container

methods

public static java.lang.String[] methods

methodArgs

public static int[] methodArgs
Constructor Detail

AdvObject

public AdvObject(World aWorld,
                 java.lang.String aName,
                 java.lang.String anId,
                 java.lang.String aDescription,
                 java.lang.String anIcon,
                 java.lang.String attrList,
                 int aCapacity,
                 int aVolume,
                 boolean setDefShowpos,
                 java.lang.String aDefContainer)
          throws DimxException
AdvObject constructor comment.

Throws:
DimxException
Method Detail

contains

protected boolean contains(java.lang.String whatId)

getRoom

public Room getRoom()

getPeopleContainer

public PeopleContainer getPeopleContainer()
Gets the current container but checks if it is a regular "people container", that is, a Container object type.

Returns:
The reference, or null if it i not a Container object

getContents

public Dict getContents(boolean checkOpen)

getIcon

public java.lang.String getIcon()

setDescription

public void setDescription(java.lang.String adescription)
                    throws DimxException
Throws:
DimxException

getDescription

public java.lang.String getDescription(AdvObject agent,
                                       DictSorted input)
                                throws DimxException
Throws:
DimxException

getFreeSpace

protected int getFreeSpace()

getTypePrefix

public java.lang.String getTypePrefix()

getType

public java.lang.String getType()
Returns:
the primary type string of the object. Same as calling overloaded function getType(incsubType==false);

getType

public java.lang.String getType(boolean incSubTypes)
Returns:
the type string of the object. If incSubTypes = true then the string will be complete with any type.sub.type data. If incSubTypes = false then the string will be only the main type with all subtype data excluded.

getUsedSpace

protected int getUsedSpace()

hear

public boolean hear(DimxObject from,
                    java.lang.String msg)
             throws DimxException
Overrides:
hear in class DimxObject
Throws:
DimxException

hide

public boolean hide(java.lang.StringBuffer msg)
             throws DimxException
Throws:
DimxException

isAccessibleFrom

protected boolean isAccessibleFrom(AdvObject from)

isRobot

public boolean isRobot()

isVehicle

public boolean isVehicle()

isPeopleContainer

public boolean isPeopleContainer()

isPlayer

public boolean isPlayer()

isHidden

public boolean isHidden()
Returns:
true only if "hidden" exists and boolVal()==true

setHidden

public void setHidden(boolean hidden)
Only works on something that is already hideable.

Parameters:
hidden -
See Also:
isHideable()

isHideable

public boolean isHideable()
only returns true if "hideable" exists and is true, or if "hideable" does not exist, returns true if "hidden" exists.

Returns:
true if "hideable" or "hidden".exists()

setHideable

public void setHideable(boolean hideable)
Set "hideable" to the value provided. If "hidden".exists() then "hidden" is set to false.

Parameters:
hideable -

isLink

public boolean isLink()
Overrides:
isLink in class DimxObject

isLocked

public boolean isLocked()
Returns:
true only if "locked".exists() && is true

setLocked

public void setLocked(boolean locked)
Only works on something that is already lockable.

Parameters:
locked -
See Also:
isLockable()

isLockable

public boolean isLockable()
By default, items are NOT lockable

Returns:
true if "lockable".exists() and is TRUE, or if "lockable" does not exist, returns true if "locked".exists()

setLockable

public void setLockable(boolean lockable)
set the "lockable" property to the value provided. if "lockable" is set to false then we also set "locked" to false, if it exists.

Parameters:
lockable -

isNear

protected boolean isNear(java.lang.String targFullId)

isOpen

public boolean isOpen()
Returns:
true only if "open".exists() and is true;

isOpenable

public boolean isOpenable()
Returns:
true if "openable".exists() and is true, or if "open" or "locked" exists.

setOpenable

public void setOpenable(boolean openable)
set "openable" to the value provided. If "openable" is true and "open" did not exist then we initialize "open" as false.

Parameters:
openable -

isPickable

public boolean isPickable()
Returns:
false unless "pickable".exists() and is true

objPlace

public boolean objPlace(AdvObject what,
                        boolean checkOpen,
                        AdvObject agent,
                        boolean checkEvents)
                 throws DimxException
Places an object into this one.

Parameters:
what - Object to be placed
checkOpen - Shall I check "open" property first?
agent - Object causing the action
Returns:
true if succeeded
Throws:
DimxException - any error

open

public boolean open(Character agent)
             throws DimxException
Throws:
DimxException

setImage

public boolean setImage(java.lang.String face,
                        Image anImage)
sets the image for the specified face. You must specify a valid value (N S E W) otherwise the results may be unpredictable

Parameters:
face -
anImage -
Returns:

toString

public java.lang.String toString()
Overrides:
toString in class ManageableObject

setFacing

public void setFacing(java.lang.String aDirection)

attachEvent

public boolean attachEvent(java.lang.String eventid,
                           java.lang.String copyfromid,
                           Token tcopyfrom)
                    throws DimxException
Attaches and event to the current object

Parameters:
eventid - Id of the event you want the object to respond to
copyfromid - ID of the event you are copying from
tcopyfrom - Event you are copying from, incapsulated into a Token object
Returns:
true upon success, throws exception otherwise
Throws:
DimxException - in case of problems

close

public boolean close(Character agent)
              throws DimxException
Throws:
DimxException

copyFacesInto

public void copyFacesInto(java.lang.String[] res)

debug

public void debug(java.lang.String s)
Overrides:
debug in class DimxObject

die

public void die(boolean removeFromContainer,
                int contentsPolicy)
         throws DimxException
makes internal cleaning before object destruction

Parameters:
removeFromContainer - Should the object be removed from its container?
contentsPolicy - 0 = Drop them to floor 1 = Recurse death 2 = Keep them (warning - this may lead to inconsistent results)
Throws:
DimxException - in case of problems

getExactImage

public Image getExactImage(java.lang.String face)

getMethods

public java.lang.String[] getMethods()
Overrides:
getMethods in class DimxObject

getMethodArgs

public int getMethodArgs(java.lang.String mname)
Overrides:
getMethodArgs in class DimxObject

getNearestImage

public java.lang.Object[] getNearestImage(java.lang.String face)

getPanel

public Panel getPanel()

go

public boolean go(java.lang.String wayId)
           throws DimxException
Moves the object along a Link. Should be used only on Character and Vehicle objects.

Parameters:
wayId -
Returns:
Throws:
DimxException

hasImageUrl

public boolean hasImageUrl(java.lang.String imageUrl)

hasSeveralFaces

protected boolean hasSeveralFaces()

objRemove

public AdvObject objRemove(AdvObject what,
                           AdvObject agent,
                           AdvObject source,
                           AdvObject dest,
                           boolean checkOpen,
                           boolean checkEvents)
                    throws DimxException
Throws:
DimxException

reset

public void reset()
           throws DimxException
Resets the object in its initial position

Throws:
DimxException - in case of problems

varGet

public Token varGet(java.lang.String varId,
                    boolean getReference)
             throws DimxException
Description copied from class: DimxObject
Gets a property

Overrides:
varGet in class DimxObject
Parameters:
varId - Id of the property to be found
getReference - Do you need its reference?
Returns:
always returns a valid Token
Throws:
DimxException

varGetIdAt

protected java.lang.String varGetIdAt(int i)

varsCount

protected int varsCount()

varsToHtmlTable

public int varsToHtmlTable(java.lang.StringBuffer sb,
                           java.lang.String title)

varsSet

public boolean varsSet(java.lang.String attrlist)
                throws DimxException
Throws:
DimxException

listImages

public java.lang.String listImages()

moveTo

public boolean moveTo(AdvObject where,
                      AdvObject agent,
                      boolean checkOpen,
                      boolean checkEvents)
               throws DimxException
Parameters:
agent -
wheres -
checkOpen -
Returns:
Throws:
DimxException

worldChange

public void worldChange(World toWorld,
                        java.lang.String newid,
                        java.lang.String defContainer)
                 throws DimxException
Changes references to the world for the current object, and all its inner objects.

Parameters:
toWorld - reference to the new world this object should belong to
newid - new id that the object should have. null = get new one automatically
Throws:
DimxException - in case of problems

afterWorldChange

public void afterWorldChange()
                      throws DimxException
Does any final operations after world change (typically calls reset() )

Throws:
DimxException - if problems