mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-13 10:42:54 +00:00
@@ -50,6 +50,21 @@ public class CharacterInventory implements Iterable<Item> {
|
||||
this.character = character;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the item in the given <tt>paperdoll</tt> slot
|
||||
*
|
||||
* @param paperdoll
|
||||
* the paperdoll slot
|
||||
* @return the item in slot, null if emptys
|
||||
*/
|
||||
public Item getItem(InventoryPaperdoll paperdoll) {
|
||||
for (final Item item : items) {
|
||||
if (item.getPaperdoll() == paperdoll)
|
||||
return item;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will add new items to the inventory. This is normally called
|
||||
* from the DAO object.
|
||||
@@ -74,7 +89,7 @@ public class CharacterInventory implements Iterable<Item> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Location of an item
|
||||
* Location of an item in the player's inventory
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
@@ -99,7 +114,11 @@ public class CharacterInventory implements Iterable<Item> {
|
||||
* @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;
|
||||
UNDERWEAR, HEAD, HAIR1, HAIR2, NECK, RIGHT_HAND, FEET, LEFT_HAND, RIGHT_EAR, LEFT_EAR, GLOVES,
|
||||
|
||||
LEGS, LEFT_FEET, RIGHT_FEET, RIGHT_FINGER, LEFT_FINGER, CHEST, LEFT_BRACELET, RIGHT_BRACELET,
|
||||
|
||||
DECORATION_1, DECORATION_2, DECORATION_3, DECORATION_4, DECORATION_5, DECORATION_6, CLOAK, BELT;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* l2jserver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.event;
|
||||
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.player.event.PlayerEvent;
|
||||
|
||||
/**
|
||||
* Base event for character
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface CharacterEvent extends PlayerEvent {
|
||||
/**
|
||||
* The character issue in this event
|
||||
*
|
||||
* @return the character
|
||||
*/
|
||||
L2Character getCharacter();
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* l2jserver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.event;
|
||||
|
||||
import com.l2jserver.model.world.player.event.PlayerEvent;
|
||||
import com.l2jserver.model.world.player.event.PlayerListener;
|
||||
import com.l2jserver.service.game.world.event.WorldEvent;
|
||||
import com.l2jserver.service.game.world.event.WorldListener;
|
||||
|
||||
/**
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*
|
||||
*/
|
||||
public abstract class CharacterListener extends PlayerListener {
|
||||
@Override
|
||||
protected boolean dispatch(PlayerEvent e) {
|
||||
if (!(e instanceof CharacterEvent))
|
||||
return false;
|
||||
return dispatch((CharacterEvent) e);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see WorldListener#dispatch(WorldEvent)
|
||||
*/
|
||||
protected abstract boolean dispatch(CharacterEvent e);
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* l2jserver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.event;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.Player;
|
||||
import com.l2jserver.model.world.WorldObject;
|
||||
import com.l2jserver.model.world.capability.Actor;
|
||||
import com.l2jserver.model.world.capability.Listenable;
|
||||
|
||||
/**
|
||||
* Event triggered once a character logs-in.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterLoggedInEvent implements CharacterEvent {
|
||||
/**
|
||||
* The character that is logging in
|
||||
*/
|
||||
private final L2Character character;
|
||||
/**
|
||||
* The time that this character has logged in
|
||||
*/
|
||||
private final Date date;
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param character
|
||||
* the character
|
||||
* @param date
|
||||
* the login date
|
||||
*/
|
||||
public CharacterLoggedInEvent(L2Character character, Date date) {
|
||||
this.character = character;
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance. Login date is set to now.
|
||||
*
|
||||
* @param character
|
||||
* the character
|
||||
*/
|
||||
public CharacterLoggedInEvent(L2Character character) {
|
||||
this(character, new Date());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the date
|
||||
*/
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Player getPlayer() {
|
||||
return character;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Actor getActor() {
|
||||
return character;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorldObject getObject() {
|
||||
return character;
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2Character getCharacter() {
|
||||
return character;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Listenable<?, ?>[] getDispatchableObjects() {
|
||||
return new Listenable<?, ?>[] { character };
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user