Gridarta Editor
BaseObject.java
Go to the documentation of this file.
1 /*
2  * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3  * Copyright (C) 2000-2015 The Gridarta Developers.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 package net.sf.gridarta.model.baseobject;
21 
22 import java.awt.Point;
23 import java.io.Serializable;
24 import javax.swing.ImageIcon;
31 import org.jetbrains.annotations.NotNull;
32 import org.jetbrains.annotations.Nullable;
33 
34 public interface BaseObject<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, T extends BaseObject<G, A, R, T>> extends Attributes, Cloneable, Iterable<G>, Serializable {
35 
36  int EDIT_TYPE_NONE = 0x10000; // special case
37 
41  @NotNull
42  String ANIMATION = "animation";
43 
47  @NotNull
48  String DIRECTION = "direction";
49 
53  @NotNull
54  String FACE = "face";
55 
59  @NotNull
60  String NAME = "name";
61 
65  @NotNull
66  String TYPE = "type";
67 
71  @NotNull
72  String TITLE = "title";
73 
77  @NotNull
78  String IS_ANIMATED = "is_animated";
79 
83  @NotNull
84  String IS_TURNABLE = "is_turnable";
85 
89  @NotNull
90  String HP = "hp";
91 
95  @NotNull
96  String SP = "sp";
97 
101  @NotNull
102  String NO_PASS = "no_pass";
103 
107  @NotNull
108  String NO_PICK = "no_pick";
109 
113  @NotNull
114  String LEVEL = "level";
115 
119  @NotNull
120  String SLAYING = "slaying";
121 
125  @NotNull
126  String LAST_HEAL = "last_heal";
127 
131  @NotNull
132  String BLOCKSVIEW = "blocksview";
133 
137  @NotNull
138  String ANIM_SPEED = "anim_speed";
139 
144  int getTypeNo();
145 
150  @Nullable
151  String getFaceName();
152 
158  int countInvObjects();
159 
168  boolean hasAttribute(@NotNull String attributeName, boolean queryArchetype);
169 
186  @NotNull
187  String getAttributeString(@NotNull String attributeName, boolean queryArchetype);
188 
197  int getAttributeInt(@NotNull String attributeName, boolean queryArchetype);
198 
208  long getAttributeLong(@NotNull String attributeName, boolean queryArchetype);
209 
219  double getAttributeDouble(@NotNull String attributeName, boolean queryArchetype);
220 
226  void setAttributeString(@NotNull String attributeName, @NotNull String value);
227 
231  void notifyBeginChange();
232 
236  void notifyEndChange();
237 
242  void notifyTransientChange();
243 
249  @NotNull
250  R getArchetype();
251 
256  int getEditType();
257 
262  void setEditType(int editType);
263 
269  void addMsgTextLine(@NotNull String text);
270 
277  @Nullable
278  String getMsgText();
279 
284  void setMsgText(@Nullable String msgText);
285 
294  int getMapX();
295 
304  int getMapY();
305 
313  Point getMapLocation();
314 
320  void setMapX(int mapX);
321 
327  void setMapY(int mapY);
328 
335  boolean isHead();
336 
342  @Nullable
343  T getMultiNext();
344 
352  int getMultiRefCount();
353 
358  void addTailPart(@NotNull T tail);
359 
364  void removeTailParts();
365 
371  T getHead();
372 
378  boolean isTail();
379 
385  int getSizeX();
386 
392  int getSizeY();
393 
399  int getMaxX();
400 
406  int getMaxY();
407 
413  int getMinX();
414 
420  int getMinY();
421 
426  @NotNull
427  String getObjName();
428 
434  @NotNull
435  String getBestName();
436 
441  @NotNull
442  String getObjectText();
443 
449  void addObjectText(@NotNull String line);
450 
455  void setObjectText(@NotNull String objectText);
456 
462  boolean isDefaultGameObject();
463 
469  boolean isEqual(@NotNull BaseObject<?, ?, ?, ?> gameObject);
470 
475  int getDirection();
476 
481  @NotNull
483 
488  @Nullable
489  String getAnimName();
490 
496  boolean isMulti();
497 
498  void setMulti(@NotNull MultiArchData<G, A, R, T> multi);
499 
504  @Nullable
505  String getFaceObjName();
506 
514  void setObjectFace();
515 
520  @NotNull
521  ImageIcon getNormalImage();
522 
526  @NotNull
527  T clone();
528 
533  @NotNull
534  String getLoreText();
535 
540  void setLoreText(@NotNull CharSequence loreText);
541 
549  @NotNull
550  G newInstance(@NotNull GameObjectFactory<G, A, R> gameObjectFactory);
551 
557  void visit(@NotNull BaseObjectVisitor<G, A, R> baseObjectVisitor);
558 
563  boolean usesDirection();
564 
568  void facesReloaded();
569 
584  @NotNull
585  String toString(@NotNull String format);
586 
587 }
ImageIcon getNormalImage()
Returns the normal face for this GameObject.
String IS_TURNABLE
The name of the "is_turnable" attribute.
Definition: BaseObject.java:84
T getHead()
Return the head part of a multi-part object.
int getMaxX()
Determines the maximum x-coordinate of any part relative to the head part.
String LEVEL
The name of the "level" attribute.
String getObjName()
Returns the name of the object as shown to the player.
boolean hasAttribute(@NotNull String attributeName, boolean queryArchetype)
Returns whether an attribute name exists.
T getMultiNext()
Returns the next of this multi-part object.
void facesReloaded()
Will be called whenever the archetype faces have been reloaded.
String getFaceObjName()
Returns the face name, can be from animation or face.
String ANIM_SPEED
The name of the "anim_speed" attribute.
void notifyTransientChange()
Notifies the map model that this container has changed but need not be restored by undo/redo...
Enumeration describing the state of the face.
Definition: FaceSource.java:28
String ANIMATION
The attribute name of the object&#39;s animation.
Definition: BaseObject.java:42
String FACE
The attribute name of the object&#39;s face.
Definition: BaseObject.java:54
void setMsgText(@Nullable String msgText)
Sets the message text.
void addMsgTextLine(@NotNull String text)
Adds a line of message text.
void setLoreText(@NotNull CharSequence loreText)
Sets the map lore.
FaceSource getFaceObjSource()
Returns the FaceSource of this base object.
int getMultiRefCount()
Returns the number of parts for multi-part heads.
int getSizeY()
Determines the vertical extent in squares.
String SLAYING
The name of the "slaying" attribute.
String getAttributeString(@NotNull String attributeName, boolean queryArchetype)
Returns the requested attribute value of this GameObject as String.
String TYPE
The attribute name of the object&#39;s type.
Definition: BaseObject.java:66
String NO_PASS
The name of the "no_pass" attribute.
void notifyEndChange()
Notifies the map model that this container has changed.
String LAST_HEAL
The name of the "last_heal" attribute.
int getMapX()
Returns the X coordinate of this GameObject on its map.
Base package of all Gridarta classes.
void setMapX(int mapX)
Sets the X coordinate of this GameObject on its map.
String getFaceName()
Returns the name of the face of this Archetype or GameObject.
Reflects a game object (object on a map).
Definition: GameObject.java:36
void addObjectText(@NotNull String line)
Appends.
int getEditType()
Returns the edit type.
Abstract factory for creating GameObject instances.
void visit(@NotNull BaseObjectVisitor< G, A, R > baseObjectVisitor)
Calls the appropriate.
int getSizeX()
Determines the horizontal extent in squares.
String DIRECTION
The attribute name of the object&#39;s direction.
Definition: BaseObject.java:48
String getAnimName()
DaiEditor only: Returns the name of the animation.
int getMaxY()
Determines the maximum y-coordinate of any part relative to the head part.
int getMapY()
Returns the Y coordinate of this GameObject on its map.
int getMinX()
Determines the minimum x-coordinate of any part relative to the head part.
String HP
The attribute name of the "hp" attribute.
Definition: BaseObject.java:90
String getLoreText()
Returns the map lore.
GameObjects are the objects based on Archetypes found on maps.
boolean usesDirection()
Return whether this base object uses the "direction" attribute.
void setObjectFace()
We set here the real face of the objects, depending on the set face and the set animation.
void setEditType(int editType)
Sets the edit type.
long getAttributeLong(@NotNull String attributeName, boolean queryArchetype)
Returns the requested attribute value of this GameObject as.
String getMsgText()
Returns the message bound to this object.
G newInstance(@NotNull GameObjectFactory< G, A, R > gameObjectFactory)
Creates a new GameObject instance: an Archetype is instantiated, a GameObject is cloned.
Point getMapLocation()
Returns the coordinate of this GameObject on its map.
void setMapY(int mapY)
Sets the Y coordinate of this GameObject on its map.
void addTailPart(@NotNull T tail)
Appends a tail to this GameObject.
int countInvObjects()
Counts the number of all inventory items (recursively).
int getAttributeInt(@NotNull String attributeName, boolean queryArchetype)
Returns the requested attribute value of this GameObject as.
void setObjectText(@NotNull String objectText)
Sets.
R getArchetype()
Returns the Archetype this GameObject is based on.
String getBestName()
Returns the name which is best appropriate to describe this GameObject.
T clone()
Creates a clone of this base object.
boolean isHead()
Returns whether this object is a single-part object or the head of the multi-part object...
void notifyBeginChange()
Notifies the map model that this container is about to change.
String IS_ANIMATED
The attribute name of the "is_animated" flag.
Definition: BaseObject.java:78
String toString(@NotNull String format)
Returns a string representation of this game object.
void setMulti(@NotNull MultiArchData< G, A, R, T > multi)
String SP
The attribute name of the "sp" attribute.
Definition: BaseObject.java:96
String NAME
The attribute name of the object&#39;s name.
Definition: BaseObject.java:60
boolean isEqual(@NotNull BaseObject<?, ?, ?, ?> gameObject)
Compares this object to another game object.
int getDirection()
Returns the direction of this Archetype or GameObject.
boolean isTail()
Determines if this part is a tail part.
boolean isDefaultGameObject()
Returns whether this game object is unmodified from its underlying archetype.
String getObjectText()
Returns the object text of this GameObject as String.
boolean isMulti()
Returns whether this Archetype is a multi-part object.
String BLOCKSVIEW
The name of the "blocksview" attribute.
int getMinY()
Determines the minimum y-coordinate of any part relative to the head part.
String TITLE
The attribute name of the object&#39;s title.
Definition: BaseObject.java:72
void removeTailParts()
Removes all tail parts of this game object.
double getAttributeDouble(@NotNull String attributeName, boolean queryArchetype)
Returns the requested attribute value of this GameObject as.
int getTypeNo()
Returns the type number of this Archetype.
Class related to GameObject to store multi-part information.
void setAttributeString(@NotNull String attributeName, @NotNull String value)
Sets the String of an archetype attribute in the objectText.
String NO_PICK
The name of the "no_pick" attribute.