Gridarta Editor
net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R > Interface Template Reference

Reflects a game object (object on a map). More...

+ Inheritance diagram for net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >:
+ Collaboration diagram for net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >:

Public Member Functions

void addFirst (@NotNull G gameObject)
 Add the given GameObject at the beginning of this Container. More...
 
void addLast (@NotNull G gameObject)
 Add the given GameObject at the end of this Container. More...
 
void applyMassChange (@NotNull Integer[] layers, @NotNull Integer[] subLayers, @NotNull String changes)
 Applies mass changes to the specified object if all the match conditions are met. More...
 
GameObjectContainer< G, A, R > getContainer ()
 Returns container of this GameObject. More...
 
getContainerGameObject ()
 Returns the environment game object if this game object is in the inventory or. More...
 
getFirst ()
 Return the first GameObject contained in this container. More...
 
getLast ()
 Return the last GameObject contained in this container. More...
 
int getLightRadius ()
 Returns the effective light radius of this game object. More...
 
MapSquare< G, A, R > getMapSquare ()
 Get the MapSquare of this GameObjectContainer. More...
 
getNext ()
 Returns the game object succeeding this game object. More...
 
getPrev ()
 Returns the game object preceding this game object. More...
 
getTopContainer ()
 Get the topmost container of this GameObject (in Game sense, which means being in a MapSquare isn't, but being in an GameObject is). More...
 
boolean hasUndefinedArchetype ()
 Return whether this instance references an undefined archetype. More...
 
void insertAfter (@NotNull G node)
 Insert a GameObject after this GameObject. More...
 
void insertBefore (@NotNull G node)
 Insert a GameObject before this GameObject. More...
 
boolean isBottom ()
 Returns whether this game object is the bottom-most one. More...
 
boolean isEmpty ()
 Check whether this square is empty. More...
 
boolean isInContainer ()
 Check whether this GameObject is in a Container (in Gridarta sense, which means being in a MapSquare isn't, but being in an GameObject is). More...
 
boolean isScripted ()
 Returns whether this GameObject has one or more scripted events defined. More...
 
boolean isTop ()
 Returns whether this game object is the top-most one. More...
 
Iterator< G > iterator ()
 The Iterator returned does not recurse, it only contains objects on the first level. More...
 
void markModified ()
 Marks this game object as "modified". More...
 
void moveBottom ()
 Move this GameObject bottom. More...
 
void moveDown ()
 Move this GameObject down. More...
 
void moveTop ()
 Move this GameObject top. More...
 
void moveUp ()
 Move this GameObject up. More...
 
void propagateElevation (@NotNull BaseObject<?, ?, ?, ?> gameObject)
 If there is elevation data in the other game object, move it to here. More...
 
Iterable< G > recursive ()
 Return an object that is a recursive representation. More...
 
void remove ()
 Remove this GameObject from its container. More...
 
void removeAll ()
 Removes all GameObjects from this container. More...
 
Iterable< G > reverse ()
 Return an object that is the reverse representation. More...
 
void setArchetype (@NotNull R archetype)
 Set the Archetype of this GameObject. More...
 
void setContainer (@Nullable GameObjectContainer< G, A, R > container, int mapX, int mapY)
 Sets container of this GameObject. More...
 
void updateTileStretch (int heightValue, boolean isAbsolute, @Nullable Integer[] subLayers)
 Updates the tile stretching value of the selected object. More...
 
- Public Member Functions inherited from net.sf.gridarta.model.baseobject.BaseObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R, T extends BaseObject< G, A, R, T >
void addMsgTextLine (@NotNull String text)
 Adds a line of message text. More...
 
void addObjectText (@NotNull String line)
 Appends. More...
 
void addTailPart (@NotNull T tail)
 Appends a tail to this GameObject. More...
 
clone ()
 Creates a clone of this base object. More...
 
int countInvObjects ()
 Counts the number of all inventory items (recursively). More...
 
void facesReloaded ()
 Will be called whenever the archetype faces have been reloaded. More...
 
String getAnimName ()
 DaiEditor only: Returns the name of the animation. More...
 
getArchetype ()
 Returns the Archetype this GameObject is based on. More...
 
double getAttributeDouble (@NotNull String attributeName, boolean queryArchetype)
 Returns the requested attribute value of this GameObject as. More...
 
int getAttributeInt (@NotNull String attributeName, boolean queryArchetype)
 Returns the requested attribute value of this GameObject as. More...
 
long getAttributeLong (@NotNull String attributeName, boolean queryArchetype)
 Returns the requested attribute value of this GameObject as. More...
 
String getAttributeString (@NotNull String attributeName, boolean queryArchetype)
 Returns the requested attribute value of this GameObject as String. More...
 
String getBestName ()
 Returns the name which is best appropriate to describe this GameObject. More...
 
int getDirection ()
 Returns the direction of this Archetype or GameObject. More...
 
int getEditType ()
 Returns the edit type. More...
 
String getFaceName ()
 Returns the name of the face of this Archetype or GameObject. More...
 
String getFaceObjName ()
 Returns the face name, can be from animation or face. More...
 
FaceSource getFaceObjSource ()
 Returns the FaceSource of this base object. More...
 
getHead ()
 Return the head part of a multi-part object. More...
 
String getLoreText ()
 Returns the map lore. More...
 
Point getMapLocation ()
 Returns the coordinate of this GameObject on its map. More...
 
int getMapX ()
 Returns the X coordinate of this GameObject on its map. More...
 
int getMapY ()
 Returns the Y coordinate of this GameObject on its map. More...
 
int getMaxX ()
 Determines the maximum x-coordinate of any part relative to the head part. More...
 
int getMaxY ()
 Determines the maximum y-coordinate of any part relative to the head part. More...
 
int getMinX ()
 Determines the minimum x-coordinate of any part relative to the head part. More...
 
int getMinY ()
 Determines the minimum y-coordinate of any part relative to the head part. More...
 
String getMsgText ()
 Returns the message bound to this object. More...
 
getMultiNext ()
 Returns the next of this multi-part object. More...
 
int getMultiRefCount ()
 Returns the number of parts for multi-part heads. More...
 
ImageIcon getNormalImage ()
 Returns the normal face for this GameObject. More...
 
String getObjectText ()
 Returns the object text of this GameObject as String. More...
 
String getObjName ()
 Returns the name of the object as shown to the player. More...
 
int getSizeX ()
 Determines the horizontal extent in squares. More...
 
int getSizeY ()
 Determines the vertical extent in squares. More...
 
int getTypeNo ()
 Returns the type number of this Archetype. More...
 
boolean hasAttribute (@NotNull String attributeName, boolean queryArchetype)
 Returns whether an attribute name exists. More...
 
boolean isDefaultGameObject ()
 Returns whether this game object is unmodified from its underlying archetype. More...
 
boolean isEqual (@NotNull BaseObject<?, ?, ?, ?> gameObject)
 Compares this object to another game object. More...
 
boolean isHead ()
 Returns whether this object is a single-part object or the head of the multi-part object. More...
 
boolean isMulti ()
 Returns whether this Archetype is a multi-part object. More...
 
boolean isTail ()
 Determines if this part is a tail part. More...
 
newInstance (@NotNull GameObjectFactory< G, A, R > gameObjectFactory)
 Creates a new GameObject instance: an Archetype is instantiated, a GameObject is cloned. More...
 
void notifyBeginChange ()
 Notifies the map model that this container is about to change. More...
 
void notifyEndChange ()
 Notifies the map model that this container has changed. More...
 
void notifyTransientChange ()
 Notifies the map model that this container has changed but need not be restored by undo/redo. More...
 
void removeTailParts ()
 Removes all tail parts of this game object. More...
 
void setAttributeString (@NotNull String attributeName, @NotNull String value)
 Sets the String of an archetype attribute in the objectText. More...
 
void setEditType (int editType)
 Sets the edit type. More...
 
void setLoreText (@NotNull CharSequence loreText)
 Sets the map lore. More...
 
void setMapX (int mapX)
 Sets the X coordinate of this GameObject on its map. More...
 
void setMapY (int mapY)
 Sets the Y coordinate of this GameObject on its map. More...
 
void setMsgText (@Nullable String msgText)
 Sets the message text. More...
 
void setMulti (@NotNull MultiArchData< G, A, R, T > multi)
 
void setObjectFace ()
 We set here the real face of the objects, depending on the set face and the set animation. More...
 
void setObjectText (@NotNull String objectText)
 Sets. More...
 
String toString (@NotNull String format)
 Returns a string representation of this game object. More...
 
boolean usesDirection ()
 Return whether this base object uses the "direction" attribute. More...
 
void visit (@NotNull BaseObjectVisitor< G, A, R > baseObjectVisitor)
 Calls the appropriate. More...
 
- Public Member Functions inherited from net.sf.gridarta.model.baseobject.Attributes
double getAttributeDouble (@NotNull String attributeName)
 Returns an attribute value of this Archetype as double. More...
 
int getAttributeInt (@NotNull String attributeName)
 Returns an attribute value of this Archetype as int. More...
 
long getAttributeLong (@NotNull String attributeName)
 Returns an attribute value of this Archetype as long. More...
 
String getAttributeString (@NotNull String attributeName)
 Returns the requested attribute value of this GameObject as String. More...
 
boolean hasAttribute (@NotNull String attributeName)
 Returns whether an attribute name exists. More...
 
void removeAttribute (@NotNull String attributeName)
 Removes the String of an archetype attribute from the objectText. More...
 
void setAttributeInt (@NotNull String attributeName, int value)
 Sets an int value attribute. More...
 

Public Attributes

String EDITOR_FOLDER_INTERN = "intern"
 The editor folder name for server-internal archetypes. More...
 
- Public Attributes inherited from net.sf.gridarta.model.baseobject.BaseObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R, T extends BaseObject< G, A, R, T >
String ANIM_SPEED = "anim_speed"
 The name of the "anim_speed" attribute. More...
 
String ANIMATION = "animation"
 The attribute name of the object's animation. More...
 
String BLOCKSVIEW = "blocksview"
 The name of the "blocksview" attribute. More...
 
String DIRECTION = "direction"
 The attribute name of the object's direction. More...
 
int EDIT_TYPE_NONE = 0x10000
 
String FACE = "face"
 The attribute name of the object's face. More...
 
String HP = "hp"
 The attribute name of the "hp" attribute. More...
 
String IS_ANIMATED = "is_animated"
 The attribute name of the "is_animated" flag. More...
 
String IS_TURNABLE = "is_turnable"
 The name of the "is_turnable" attribute. More...
 
String LAST_HEAL = "last_heal"
 The name of the "last_heal" attribute. More...
 
String LEVEL = "level"
 The name of the "level" attribute. More...
 
String NAME = "name"
 The attribute name of the object's name. More...
 
String NO_PASS = "no_pass"
 The name of the "no_pass" attribute. More...
 
String NO_PICK = "no_pick"
 The name of the "no_pick" attribute. More...
 
String SLAYING = "slaying"
 The name of the "slaying" attribute. More...
 
String SP = "sp"
 The attribute name of the "sp" attribute. More...
 
String TITLE = "title"
 The attribute name of the object's title. More...
 
String TYPE = "type"
 The attribute name of the object's type. More...
 

Detailed Description

Reflects a game object (object on a map).

Author
Christian Hujer
Andreas Kirschbaum

Definition at line 36 of file GameObject.java.

Member Function Documentation

◆ addFirst()

void net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.addFirst ( @NotNull G  gameObject)

Add the given GameObject at the beginning of this Container.

Parameters
gameObjectthe free yet unlinked
GameObject
to be placed in the inventory
Exceptions
IllegalArgumentExceptionif
gameObject
already is inside another container

◆ addLast()

void net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.addLast ( @NotNull G  gameObject)

Add the given GameObject at the end of this Container.

Parameters
gameObjectthe free yet unlinked
GameObject
to be placed in the inventory
Exceptions
IllegalArgumentExceptionif
gameObject
already is inside another container

Referenced by net.sf.gridarta.model.mapmodel.DefaultMapModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.insertArchToMap(), and net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl< G, A, R >.mapArchAddInv().

+ Here is the caller graph for this function:

◆ applyMassChange()

void net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.applyMassChange ( @NotNull Integer []  layers,
@NotNull Integer []  subLayers,
@NotNull String  changes 
)

Applies mass changes to the specified object if all the match conditions are met.

Parameters
layerslayers to match, can be empty
subLayerssub-layers to match, can be empty
changeschanges to apply

◆ getContainer()

GameObjectContainer<G, A, R> net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getContainer ( )

Returns container of this GameObject.

There are two possibilities for the container:

  • Another GameObject, which means this object is in the inventory of that GameObject.
  • A MapSquare, which means that this GameObject is top level on that MapSquare (Crossfire returns
    null
    for this).
Returns
the container of this game object
See also
getTopContainer()

◆ getContainerGameObject()

◆ getFirst()

G net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getFirst ( )

Return the first GameObject contained in this container.

Returns
first GameObject contained or
null
if isEmpty() returns
true

Referenced by net.sf.gridarta.gui.map.renderer.SimpleIsoMapRenderer< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.paint().

+ Here is the caller graph for this function:

◆ getLast()

G net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getLast ( )

Return the last GameObject contained in this container.

Returns
first GameObject contained or
null
if isEmpty() returns
true

◆ getLightRadius()

int net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getLightRadius ( )

Returns the effective light radius of this game object.

Returns
the effective light radius or
0
if this object does not emit light

◆ getMapSquare()

◆ getNext()

G net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getNext ( )

Returns the game object succeeding this game object.

Returns
the preceding game object or
null
if no successor game object exists.

◆ getPrev()

G net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getPrev ( )

Returns the game object preceding this game object.

Returns
the successor game object or
null
if no preceding game object exists.

Referenced by net.sf.gridarta.action.MoveSquareInvAction< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.doAction().

+ Here is the caller graph for this function:

◆ getTopContainer()

G net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getTopContainer ( )

Get the topmost container of this GameObject (in Game sense, which means being in a MapSquare isn't, but being in an GameObject is).

Returns
the topmost container but always GameObject, never a map square; if this object is topmost itself, it returns itself
See also
getContainer()

Referenced by net.sf.gridarta.model.mapmodel.DefaultMapModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.discardInvalidGameObjects().

+ Here is the caller graph for this function:

◆ hasUndefinedArchetype()

boolean net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.hasUndefinedArchetype ( )

Return whether this instance references an undefined archetype.

Returns
true
if this instance references an undefined archetype

◆ insertAfter()

void net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.insertAfter ( @NotNull G  node)

Insert a GameObject after this GameObject.

Parameters
nodeGameObject to append

◆ insertBefore()

void net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.insertBefore ( @NotNull G  node)

Insert a GameObject before this GameObject.

Parameters
nodeGameObject to append

◆ isBottom()

boolean net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.isBottom ( )

Returns whether this game object is the bottom-most one.

Returns true if it has no container.

Returns
whether this game object is the bottom-most one

◆ isEmpty()

boolean net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.isEmpty ( )

Check whether this square is empty.

Returns
true
if this square is empty, otherwise
false

◆ isInContainer()

boolean net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.isInContainer ( )

Check whether this GameObject is in a Container (in Gridarta sense, which means being in a MapSquare isn't, but being in an GameObject is).

Returns
true
if this GameObject has a Container and the Container is an GameObject, otherwise (no Container or Container is not an GameObject) false

Referenced by net.sf.gridarta.model.mapmanager.AbstractMapManager< G, A, R >.decodeMapFile().

+ Here is the caller graph for this function:

◆ isScripted()

boolean net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.isScripted ( )

Returns whether this GameObject has one or more scripted events defined.

Returns
true
if this GameObject has one or more scripted events, otherwise
false

◆ isTop()

boolean net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.isTop ( )

Returns whether this game object is the top-most one.

Returns true if it has no container.

Returns
whether this game object is the top-most one

◆ iterator()

Iterator<G> net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.iterator ( )

The Iterator returned does not recurse, it only contains objects on the first level.

The Iterator returned is transparent, that means modifying the iterator's collection actually modifies the underlying GameObjectContainer.

Referenced by net.sf.gridarta.gui.dialog.gameobjectattributes.DialogAttributeInvSpell< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getObjectText(), and net.sf.gridarta.var.crossfire.model.io.ArchetypeParserTest.testInventoryGameObjects().

+ Here is the caller graph for this function:

◆ markModified()

void net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.markModified ( )

Marks this game object as "modified".

◆ moveBottom()

void net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.moveBottom ( )

Move this GameObject bottom.

Does nothing if the object has no container.

◆ moveDown()

void net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.moveDown ( )

Move this GameObject down.

Does nothing if the object has no container.

◆ moveTop()

void net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.moveTop ( )

Move this GameObject top.

Does nothing if the object has no container.

◆ moveUp()

void net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.moveUp ( )

Move this GameObject up.

Does nothing if the object has no container.

◆ propagateElevation()

void net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.propagateElevation ( @NotNull BaseObject<?, ?, ?, ?>  gameObject)

If there is elevation data in the other game object, move it to here.

Parameters
gameObjectthe other game object

◆ recursive()

◆ remove()

void net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.remove ( )

Remove this GameObject from its container.

Does nothing if the object has no container. This method also takes perfectly well care of multi-part GameObjects.

Referenced by net.sf.gridarta.gui.scripts.ScriptArchEditor< G, A, R >.createNewEvent().

+ Here is the caller graph for this function:

◆ removeAll()

void net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.removeAll ( )

Removes all GameObjects from this container.

this implementation does not take care of multi square objects.

◆ reverse()

Iterable<G> net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.reverse ( )

Return an object that is the reverse representation.

Invoke this method if you want to iterate over the contained GameObjects in reverse order.

Returns
reverse representation

◆ setArchetype()

◆ setContainer()

void net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.setContainer ( @Nullable GameObjectContainer< G, A, R >  container,
int  mapX,
int  mapY 
)

Sets container of this GameObject.

There are two possibilities for the container:

  • Another GameObject, which means this object is in the inventory of that GameObject.
  • A MapSquare, which means that this GameObject is top level on that MapSquare.
Parameters
containerthe container of this game object
mapXthe x coordinate on the map or
0
mapYthe y coordinate on the map or
0
Exceptions
IllegalStateExceptionin case this GameObject is an Archetype (Archetypes must not be added to a map).

◆ updateTileStretch()

void net.sf.gridarta.model.gameobject.GameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.updateTileStretch ( int  heightValue,
boolean  isAbsolute,
@Nullable Integer []  subLayers 
)

Updates the tile stretching value of the selected object.

Parameters
heightValueheight value
isAbsolutewhether the height change value is absolute or relative
subLayerssub-layers to affect or
null
to affect all layers

Member Data Documentation

◆ EDITOR_FOLDER_INTERN


The documentation for this interface was generated from the following file: