1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2025-12-13 10:42:54 +00:00

Completed documentation

Signed-off-by: Rogiel <rogiel@rogiel.com>
This commit is contained in:
2011-05-14 13:27:28 -03:00
parent e9c6f1b027
commit 4b9d52e724
56 changed files with 716 additions and 26 deletions

View File

@@ -1,5 +1,15 @@
package com.l2jserver.model.world.character;
import com.l2jserver.model.template.CharacterTemplate;
/**
* Defines attributes of the character. Implementations can use an static value
* (i.e. from {@link CharacterTemplate}) or can use an calculator to define
* values, composed from many attributes objects.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*
*/
public interface CharacterAttributes {
/**
* @return the intelligence

View File

@@ -1,9 +1,23 @@
package com.l2jserver.model.world.character;
import com.l2jserver.model.template.CharacterTemplate;
import com.l2jserver.model.world.L2Character;
/**
* This {@link CharacterAttributes} implementation calculates the <b>real</b>
* character attributes based on it's {@link CharacterTemplate} and active
* buffs.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CharacterCalculatedAttributes implements CharacterAttributes {
/**
* The character
*/
private final L2Character character;
/**
* The base attributes (from {@link CharacterTemplate})
*/
private final CharacterAttributes baseAttributes;
public CharacterCalculatedAttributes(L2Character character) {

View File

@@ -143,12 +143,41 @@ public enum CharacterClass {
null, null), DUMMY_ENTRY_33(0x79, null, false, null, null), DUMMY_ENTRY_34(
0x7a, null, false, null, null);
/**
* The Class ID
*/
public final int id;
/**
* The class type
*/
public final ClassType type;
/**
* Is this class summoner?
*/
public final boolean summoner;
/**
* The class race
*/
public final Race race;
/**
* The parent class
*/
public final CharacterClass parent;
/**
* Creates a new class
*
* @param id
* the id
* @param type
* the type
* @param summoner
* is summoner
* @param race
* the race
* @param parent
* the parent
*/
private CharacterClass(int id, ClassType type, boolean summoner, Race race,
CharacterClass parent) {
this.id = id;
@@ -158,31 +187,104 @@ public enum CharacterClass {
this.parent = parent;
}
/**
* Creates a new instance, will inherit <tt>type</tt>, <tt>summoner</tt> and
* <tt>race</tt> from <tt>parent</tt>
*
* @param id
* the id
* @param parent
* the parent
*/
private CharacterClass(int id, CharacterClass parent) {
this(id, parent.type, parent.summoner, parent.race, parent);
}
/**
* Creates a new instance, will inherit <tt>type</tt> and <tt>race</tt> from
* <tt>parent</tt>
*
* @param id
* the class id
* @param summoner
* is summoner
* @param parent
* the parent
*/
private CharacterClass(int id, boolean summoner, CharacterClass parent) {
this(id, parent.type, summoner, parent.race, parent);
}
/**
* Creates a new instance, will inherit <tt>type</tt> and <tt>summoner</tt>
* from <tt>parent</tt>
*
* @param id
* the class id
* @param race
* the race
* @param parent
* the parent class
*/
private CharacterClass(int id, Race race, CharacterClass parent) {
this(id, parent.type, parent.summoner, race, parent);
}
/**
* Creates a new instance, will inherit <tt>summoner</tt> will be false and
* <tt>parent</tt> null.
*
* @param id
* the id
* @param type
* the class type
* @param race
* the class race
*/
private CharacterClass(int id, ClassType type, Race race) {
this(id, type, false, race, null);
}
/**
* Creates a new instance will inherit <tt>race</tt> from <tt/>parent</tt>.
* <tt>summoner</tt> will be false
*
* @param id
* the class id
* @param type
* the class type
* @param parent
* the parent class
*/
private CharacterClass(int id, ClassType type, CharacterClass parent) {
this(id, type, false, parent.race, parent);
}
/**
* Creates a new instance will inherit <tt>race</tt> from <tt/>parent</tt>
*
* @param id
* the class id
* @param type
* the class type
* @param summoner
* is class summoner
* @param parent
* the parent class
*/
private CharacterClass(int id, ClassType type, boolean summoner,
CharacterClass parent) {
this(id, type, summoner, parent.race, parent);
}
/**
* Tries to locate the class based on its ID. If not found, <tt>null</tt> is
* returned.
*
* @param id
* the class id
* @return the {@link CharacterClass} instance found
*/
public CharacterClass fromID(int id) {
for (final CharacterClass c : values()) {
if (c.id == id)
@@ -202,6 +304,11 @@ public enum CharacterClass {
return 1 + parent.level();
}
/**
* The class type
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public enum ClassType {
FIGHTER, MYSTIC, PRIEST;
}

View File

@@ -10,16 +10,28 @@ import com.l2jserver.model.world.L2Character;
import com.l2jserver.util.factory.CollectionFactory;
/**
* Defines how an character looks in-game.
* Controls the friend list of an {@link L2Character}
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CharacterFriendList implements Iterable<L2Character> {
/**
* The character
*/
private final L2Character character;
/**
* The list of friends of this character
*/
private final Set<CharacterID> friends = CollectionFactory
.newSet(CharacterID.class);
/**
* Creates a new instance
*
* @param character
* the parent character
*/
public CharacterFriendList(L2Character character) {
this.character = character;
}
@@ -45,6 +57,14 @@ public class CharacterFriendList implements Iterable<L2Character> {
return new WorldObjectIterator<L2Character>(friends.iterator());
}
/**
* Load an {@link Collection} of {@link CharacterID} to this object.
* <p>
* Note that this is normally used by DAOs do load data.
*
* @param list
* the id list
*/
public void load(Collection<CharacterID> list) {
friends.addAll(list);
}

View File

@@ -8,7 +8,15 @@ import com.l2jserver.model.world.Item;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.util.factory.CollectionFactory;
/**
* This class controls an {@link L2Character} inventory
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CharacterInventory implements Iterable<Item> {
/**
* The character
*/
private final L2Character character;
/**
@@ -16,6 +24,12 @@ public class CharacterInventory implements Iterable<Item> {
*/
private final Set<Item> items = CollectionFactory.newSet(Item.class);
/**
* Creates a new instance
*
* @param character
* the character
*/
public CharacterInventory(L2Character character) {
this.character = character;
}
@@ -43,10 +57,31 @@ public class CharacterInventory implements Iterable<Item> {
return items.iterator();
}
/**
* Location of an item
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public enum InventoryLocation {
PAPERDOLL, INVENTORY;
/**
* The item is equipped
*/
PAPERDOLL,
/**
* The item is stored in the inventory
*/
INVENTORY,
/**
* The item is in the warehouse
*/
WAREHOUSE;
}
/**
* {@link InventoryLocation#PAPERDOLL Paperdoll} slots for items
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public enum InventoryPaperdoll {
UNDERWEAR, HEAD, HAIR1, HAIR2, NECK, RIGHT_HAND, LEFT_HAND, RIGHT_EAR, LEFT_EAR, GLOVES, LEGS, LEFT_FEET, RIGHT_FEET, RIGHT_FINGER, LEFT_FINGER, LEFT_BRACELET, RIGHT_BRACELET, DECORATION_1, DECOREATION_2, DECORATION_3, DECORATION_4, DECORATION_5, DECORATION_6, CLOAK, BELT;
}