mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-13 10:42:54 +00:00
@@ -17,8 +17,8 @@ public enum CharacterClass {
|
||||
KNIGHT), ROGUE(0x07, HUMAN_FIGHTER), TREASURE_HUNTER(0x08, ROGUE), HAWKEYE(
|
||||
0x09, ROGUE),
|
||||
// 3rd classes
|
||||
DUELIST(0x58, GLADIATOR), DREADNOUGHT(0x59, WARLORD), phoenixKnight(0x5a,
|
||||
PALADIN), hellKnight(0x5b, DARK_AVENGER), sagittarius(0x5c, HAWKEYE), adventurer(
|
||||
DUELIST(0x58, GLADIATOR), DREADNOUGHT(0x59, WARLORD), PHOENIX_KNIGHT(0x5a,
|
||||
PALADIN), HELL_KNIGHT(0x5b, DARK_AVENGER), SAGITTARIUS(0x5c, HAWKEYE), ADVENTURER(
|
||||
0x5d, TREASURE_HUNTER),
|
||||
|
||||
/**
|
||||
@@ -61,8 +61,8 @@ public enum CharacterClass {
|
||||
0x22, PALUS_KNIGHT), ASSASSIN(0x23, DARK_FIGHTER), ABYSS_WALKER(
|
||||
0x24, ASSASSIN), PHANTOM_RANGER(0x25, ASSASSIN),
|
||||
// 3rd classes
|
||||
SHILLIEN_TEMPLAR(0x6a, SHILLIEN_KNIGHT), spectralDancer(0x6b, BLADEDANCER), ghostHunter(
|
||||
0x6c, ABYSS_WALKER), ghostSentinel(0x6d, PHANTOM_RANGER),
|
||||
SHILLIEN_TEMPLAR(0x6a, SHILLIEN_KNIGHT), spectralDancer(0x6b, BLADEDANCER), GHOST_HUNTER(
|
||||
0x6c, ABYSS_WALKER), GHOST_SENTINEL(0x6d, PHANTOM_RANGER),
|
||||
|
||||
/**
|
||||
* Dark elf mystic
|
||||
|
||||
@@ -46,10 +46,10 @@ public class CharacterInventory implements Iterable<Item> {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the character
|
||||
* @return the amount if items in inventory
|
||||
*/
|
||||
public L2Character getCharacter() {
|
||||
return character;
|
||||
public int getItemCount() {
|
||||
return items.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,4 +85,11 @@ public class CharacterInventory implements Iterable<Item> {
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the character
|
||||
*/
|
||||
public L2Character getCharacter() {
|
||||
return character;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.l2jserver.model.world.character;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jserver.model.game.CharacterShortcut;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.util.factory.CollectionFactory;
|
||||
|
||||
/**
|
||||
* Container that controls shortcut for character instances
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterShortcutContainer implements Iterable<CharacterShortcut> {
|
||||
/**
|
||||
* The character
|
||||
*/
|
||||
private final L2Character character;
|
||||
/**
|
||||
* The shortcut list
|
||||
*/
|
||||
private List<CharacterShortcut> shortcuts = CollectionFactory
|
||||
.newList(CharacterShortcut.class);
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param character
|
||||
* the character
|
||||
*/
|
||||
public CharacterShortcutContainer(L2Character character) {
|
||||
this.character = character;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a new shortcut to this container
|
||||
*
|
||||
* @param shortcut
|
||||
* the shortcut to be added
|
||||
*/
|
||||
public void register(CharacterShortcut shortcut) {
|
||||
shortcuts.add(shortcut);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters the given shortcut from this container
|
||||
*
|
||||
* @param shortcut
|
||||
* the shortcut to be removed
|
||||
*/
|
||||
public void unregister(CharacterShortcut shortcut) {
|
||||
shortcuts.remove(shortcut);
|
||||
}
|
||||
|
||||
/**
|
||||
* Swap two shortcuts between them. Once swap is complete,
|
||||
* <tt>shortcut1</tt> will be in the place of <tt>shortcut2</tt>, and
|
||||
* <tt>shortcut2</tt> in <tt>shortcut1</tt>.
|
||||
*
|
||||
* @param shortcut1
|
||||
* the first shortcut
|
||||
* @param shortcut2
|
||||
* the second shortcut
|
||||
*/
|
||||
public void swap(CharacterShortcut shortcut1, CharacterShortcut shortcut2) {
|
||||
// only swap if is registered already
|
||||
if (!shortcuts.contains(shortcut1) || !shortcuts.contains(shortcut2))
|
||||
return;
|
||||
|
||||
final int slot1 = shortcut1.getSlot();
|
||||
final int page1 = shortcut1.getPage();
|
||||
shortcut1.setSlot(shortcut2.getSlot());
|
||||
shortcut1.setPage(shortcut2.getPage());
|
||||
shortcut2.setSlot(slot1);
|
||||
shortcut2.setPage(page1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if container is full
|
||||
*/
|
||||
public boolean isFull() {
|
||||
return shortcuts.size() >= 12 * 4;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if there is not shortcut registered
|
||||
*/
|
||||
public boolean isEmpty() {
|
||||
return shortcuts.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads all shortcuts in the given {@link Collection}. This method is
|
||||
* normally called from a DAO.
|
||||
*
|
||||
* @param shortcuts
|
||||
* the collection of shortcuts
|
||||
*/
|
||||
public void load(Collection<CharacterShortcut> shortcuts) {
|
||||
this.shortcuts.addAll(shortcuts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<CharacterShortcut> iterator() {
|
||||
return shortcuts.iterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the character
|
||||
*/
|
||||
public L2Character getCharacter() {
|
||||
return character;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user