mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-08 16:33:07 +00:00
Change-Id: I3d4cd283cff0f3ea0202c4fe9b60ec5ed0b42ebd
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import com.l2jserver.model.world.capability.Attackable;
|
||||
import com.l2jserver.model.world.capability.Attacker;
|
||||
import com.l2jserver.model.world.capability.Enchantable;
|
||||
|
||||
public class TestWeaponTemplate extends WeaponTemplate {
|
||||
private static final int DAMAGE = 10;
|
||||
private static final int MAX_ENCHANT_LEVEL = 10;
|
||||
|
||||
public TestWeaponTemplate() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attack(Attacker source, Attackable target) {
|
||||
// TODO deal damage!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enchant(Enchantable target) {
|
||||
if (target.getEnchantLevel() == MAX_ENCHANT_LEVEL)
|
||||
return;
|
||||
// TODO do enchant
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDamage() {
|
||||
return DAMAGE;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.l2jserver.model.template.armor;
|
||||
|
||||
import com.l2jserver.model.id.TemplateID;
|
||||
import com.l2jserver.model.template.ArmorTemplate;
|
||||
import com.l2jserver.model.template.capability.Enchantable;
|
||||
import com.l2jserver.model.template.capability.Penalty;
|
||||
import com.l2jserver.model.world.capability.Castable;
|
||||
import com.l2jserver.model.world.capability.Equiper;
|
||||
import com.l2jserver.model.world.capability.Levelable;
|
||||
|
||||
public abstract class AbstractGradeAArmorTemplate extends ArmorTemplate
|
||||
implements Enchantable, Penalty {
|
||||
public AbstractGradeAArmorTemplate(TemplateID id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enchant(com.l2jserver.model.world.capability.Enchantable target) {
|
||||
target.setEnchantLevel(target.getEnchantLevel() + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void penalty(Equiper user) {
|
||||
if (!(user instanceof Levelable) && !(user instanceof Castable) && !(user instanceof Equiper))
|
||||
return;
|
||||
final Levelable levelable = (Levelable) user;
|
||||
final Castable castable = (Castable) user;
|
||||
if (levelable.getLevel() < 20) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.l2jserver.model.template.armor;
|
||||
|
||||
import com.l2jserver.model.id.TemplateID;
|
||||
import com.l2jserver.model.template.ArmorTemplate;
|
||||
|
||||
public abstract class AbstractNoGradeArmorTemplate extends ArmorTemplate {
|
||||
public AbstractNoGradeArmorTemplate(TemplateID id) {
|
||||
super(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.l2jserver.model.template.armor;
|
||||
|
||||
import com.l2jserver.model.world.capability.Attackable;
|
||||
import com.l2jserver.model.world.capability.Attacker;
|
||||
import com.l2jserver.model.world.capability.Damagable;
|
||||
import com.l2jserver.model.world.capability.Enchantable;
|
||||
|
||||
public class Dummy2ArmorTemplate extends AbstractGradeAArmorTemplate {
|
||||
private static final int REDUCED_DAMAGE_PHYSICAL = 10;
|
||||
private static final int REDUCED_DAMAGE_MAGICAL = 10;
|
||||
private static final int MAX_ENCHANT = 10;
|
||||
|
||||
public Dummy2ArmorTemplate() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void defend(Attacker source, Attackable target) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void interceptIncomingDamage(Damagable target) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enchant(Enchantable target) {
|
||||
if (target.getEnchantLevel() >= MAX_ENCHANT)
|
||||
return;
|
||||
super.enchant(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPhysicalDefense() {
|
||||
return REDUCED_DAMAGE_PHYSICAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMagicalDefense() {
|
||||
return REDUCED_DAMAGE_MAGICAL;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.l2jserver.model.template.armor;
|
||||
|
||||
import com.l2jserver.model.world.capability.Attackable;
|
||||
import com.l2jserver.model.world.capability.Attacker;
|
||||
import com.l2jserver.model.world.capability.Damagable;
|
||||
|
||||
public class DummyArmorTemplate extends AbstractNoGradeArmorTemplate {
|
||||
private static final int REDUCED_DAMAGE_PHYSICAL = 10;
|
||||
private static final int REDUCED_DAMAGE_MAGICAL = 10;
|
||||
|
||||
public DummyArmorTemplate() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void defend(Attacker source, Attackable target) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void interceptIncomingDamage(Damagable target) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPhysicalDefense() {
|
||||
return REDUCED_DAMAGE_PHYSICAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMagicalDefense() {
|
||||
return REDUCED_DAMAGE_MAGICAL;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.l2jserver.model.template;
|
||||
package com.l2jserver.model.template.item;
|
||||
|
||||
import com.l2jserver.model.template.PotionTemplate;
|
||||
import com.l2jserver.model.world.capability.Attackable;
|
||||
import com.l2jserver.model.world.capability.Attacker;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.l2jserver.model.template;
|
||||
package com.l2jserver.model.template.skill;
|
||||
|
||||
import com.l2jserver.model.template.SkillTemplate;
|
||||
import com.l2jserver.model.world.capability.Castable;
|
||||
import com.l2jserver.model.world.capability.Caster;
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.l2jserver.model.template.weapon;
|
||||
|
||||
import com.l2jserver.model.template.WeaponTemplate;
|
||||
import com.l2jserver.model.world.capability.Attackable;
|
||||
import com.l2jserver.model.world.capability.Attacker;
|
||||
|
||||
public class TestWeaponTemplate extends WeaponTemplate {
|
||||
private static final int DAMAGE_PHYSICAL = 10;
|
||||
private static final int DAMAGE_MAGICAL = 10;
|
||||
private static final int MAX_ENCHANT_LEVEL = 10;
|
||||
|
||||
public TestWeaponTemplate() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attack(Attacker source, Attackable target) {
|
||||
source.attack(target, this);
|
||||
target.receiveAttack(source, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPhysicalDamage() {
|
||||
return DAMAGE_PHYSICAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMagicalDamage() {
|
||||
return DAMAGE_MAGICAL;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import static org.jboss.netty.channel.Channels.pipeline;
|
||||
import org.jboss.netty.channel.ChannelPipeline;
|
||||
import org.jboss.netty.channel.ChannelPipelineFactory;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Injector;
|
||||
import com.l2jserver.game.net.codec.Lineage2Decoder;
|
||||
import com.l2jserver.game.net.codec.Lineage2Decrypter;
|
||||
@@ -18,6 +19,7 @@ import com.l2jserver.service.logging.LoggingService;
|
||||
public class Lineage2PipelineFactory implements ChannelPipelineFactory {
|
||||
private final Injector injector;
|
||||
|
||||
@Inject
|
||||
public Lineage2PipelineFactory(Injector injector) {
|
||||
this.injector = injector;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import com.l2jserver.model.id.TemplateID;
|
||||
import com.l2jserver.model.template.capability.Defendable;
|
||||
import com.l2jserver.model.template.capability.IncomingDamageIntercept;
|
||||
|
||||
public abstract class ArmorTemplate extends ItemTemplate implements Defendable,
|
||||
IncomingDamageIntercept {
|
||||
public ArmorTemplate(TemplateID id) {
|
||||
super(id);
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,8 @@ package com.l2jserver.model.template;
|
||||
|
||||
import com.l2jserver.model.id.TemplateID;
|
||||
import com.l2jserver.model.template.capability.Attackable;
|
||||
import com.l2jserver.model.template.capability.Enchantable;
|
||||
|
||||
public abstract class WeaponTemplate extends ItemTemplate implements
|
||||
Attackable, Enchantable {
|
||||
public abstract class WeaponTemplate extends ItemTemplate implements Attackable {
|
||||
public WeaponTemplate(TemplateID id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
@@ -6,5 +6,6 @@ public interface Attackable extends TemplateCapability {
|
||||
void attack(Attacker source,
|
||||
com.l2jserver.model.world.capability.Attackable target);
|
||||
|
||||
public int getDamage();
|
||||
public int getPhysicalDamage();
|
||||
public int getMagicalDamage();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.l2jserver.model.template.capability;
|
||||
|
||||
import com.l2jserver.model.world.capability.Attacker;
|
||||
|
||||
public interface Defendable extends TemplateCapability {
|
||||
void defend(Attacker source,
|
||||
com.l2jserver.model.world.capability.Attackable target);
|
||||
|
||||
public int getPhysicalDefense();
|
||||
public int getMagicalDefense();
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.l2jserver.model.template.capability;
|
||||
|
||||
import com.l2jserver.model.world.capability.Equiper;
|
||||
|
||||
public interface Equipable extends TemplateCapability {
|
||||
void equip(Equiper equiper);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.l2jserver.model.template.capability;
|
||||
|
||||
import com.l2jserver.model.world.capability.Damagable;
|
||||
|
||||
/**
|
||||
* Indicates that an template has the ability to intercept incoming damage.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*
|
||||
*/
|
||||
public interface IncomingDamageIntercept extends TemplateCapability {
|
||||
void interceptIncomingDamage(Damagable target);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.l2jserver.model.template.capability;
|
||||
|
||||
import com.l2jserver.model.world.capability.Damagable;
|
||||
|
||||
/**
|
||||
* Indicates that an template has the ability to intercept outgoing damage.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface OutgoingDamageIntercept extends TemplateCapability {
|
||||
void interceptOutgoingDamage(Damagable target);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.l2jserver.model.template.capability;
|
||||
|
||||
import com.l2jserver.model.template.AbstractTemplate;
|
||||
import com.l2jserver.model.world.capability.Equiper;
|
||||
|
||||
/**
|
||||
* Indicated than an {@link AbstractTemplate} can add penalties to an given
|
||||
* user.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface Penalty extends TemplateCapability {
|
||||
void penalty(Equiper user);
|
||||
}
|
||||
@@ -2,8 +2,6 @@ package com.l2jserver.model.world;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jserver.model.world.capability.Attackable;
|
||||
import com.l2jserver.model.world.capability.Attacker;
|
||||
import com.l2jserver.model.world.capability.Child;
|
||||
import com.l2jserver.model.world.capability.Listenable;
|
||||
import com.l2jserver.model.world.capability.Playable;
|
||||
@@ -14,8 +12,7 @@ import com.l2jserver.util.Coordinate;
|
||||
import com.l2jserver.util.factory.CollectionFactory;
|
||||
|
||||
public class Item extends AbstractObject implements Playable, Spawnable,
|
||||
Attacker, Attackable, Child<Player>,
|
||||
Listenable<ItemListener, ItemEvent> {
|
||||
Child<Player>, Listenable<ItemListener, ItemEvent> {
|
||||
private final List<ItemListener> listeners = CollectionFactory
|
||||
.newList(ItemListener.class);
|
||||
|
||||
@@ -24,18 +21,6 @@ public class Item extends AbstractObject implements Playable, Spawnable,
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveAttack(Attacker attacker) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attack(Attackable target) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(ItemListener listener) {
|
||||
listeners.add(listener);
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.l2jserver.model.world.capability.Attackable;
|
||||
import com.l2jserver.model.world.capability.Attacker;
|
||||
import com.l2jserver.model.world.capability.Castable;
|
||||
import com.l2jserver.model.world.capability.Caster;
|
||||
import com.l2jserver.model.world.capability.Levelable;
|
||||
import com.l2jserver.model.world.capability.Listenable;
|
||||
import com.l2jserver.model.world.capability.Parent;
|
||||
import com.l2jserver.model.world.capability.Playable;
|
||||
@@ -24,7 +25,7 @@ import com.l2jserver.util.factory.CollectionFactory;
|
||||
*/
|
||||
public abstract class Player extends AbstractObject implements Playable,
|
||||
Spawnable, Attacker, Attackable,
|
||||
Listenable<PlayerListener, PlayerEvent>, Caster, Parent {
|
||||
Listenable<PlayerListener, PlayerEvent>, Caster, Parent, Levelable {
|
||||
private final List<PlayerListener> listeners = CollectionFactory
|
||||
.newList(PlayerListener.class);
|
||||
|
||||
@@ -34,14 +35,14 @@ public abstract class Player extends AbstractObject implements Playable,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveAttack(Attacker attacker) {
|
||||
// TODO Auto-generated method stub
|
||||
public void attack(Attackable target,
|
||||
com.l2jserver.model.template.capability.Attackable weapon) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attack(Attackable target) {
|
||||
// TODO Auto-generated method stub
|
||||
public void receiveAttack(Attacker attacker,
|
||||
com.l2jserver.model.template.capability.Attackable weapon) {
|
||||
|
||||
}
|
||||
|
||||
@@ -79,4 +80,15 @@ public abstract class Player extends AbstractObject implements Playable,
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLevel() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLevel(int level) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,5 +9,6 @@ import com.l2jserver.model.world.AbstractObject;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface Attackable extends ObjectCapability {
|
||||
void receiveAttack(Attacker attacker);
|
||||
void receiveAttack(Attacker attacker,
|
||||
com.l2jserver.model.template.capability.Attackable weapon);
|
||||
}
|
||||
|
||||
@@ -8,5 +8,6 @@ import com.l2jserver.model.world.AbstractObject;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface Attacker extends ObjectCapability {
|
||||
void attack(Attackable target);
|
||||
void attack(Attackable target,
|
||||
com.l2jserver.model.template.capability.Attackable weapon);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.l2jserver.model.world.capability;
|
||||
|
||||
import com.l2jserver.model.world.AbstractObject;
|
||||
|
||||
/**
|
||||
* Defines an {@link AbstractObject} that can be damaged (HP)
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface Damagable extends ObjectCapability {
|
||||
void receiveDamage(int damage);
|
||||
|
||||
int getHP();
|
||||
|
||||
void setHP(int hp);
|
||||
}
|
||||
@@ -8,7 +8,18 @@ import com.l2jserver.model.world.AbstractObject;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface Enchantable extends ObjectCapability {
|
||||
public int getEnchantLevel();
|
||||
/**
|
||||
* Get the current enchant level in the object
|
||||
*
|
||||
* @return the enchant level
|
||||
*/
|
||||
int getEnchantLevel();
|
||||
|
||||
public int setEnchantLevel();
|
||||
/**
|
||||
* Set the new enchant level in the object
|
||||
*
|
||||
* @param level
|
||||
* the enchant level
|
||||
*/
|
||||
void setEnchantLevel(int level);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,9 @@ import com.l2jserver.model.world.AbstractObject;
|
||||
*/
|
||||
public interface Equiper extends ObjectCapability {
|
||||
void equip(Equipable equipable);
|
||||
|
||||
boolean isEquiped(Equipable equipment);
|
||||
boolean isEquiped(com.l2jserver.model.template.capability.Equipable equipable);
|
||||
|
||||
void setEquipment(Object slot, Equipable equipment);
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.l2jserver.model.world.capability;
|
||||
|
||||
import com.l2jserver.model.world.AbstractObject;
|
||||
import com.l2jserver.model.world.WorldObject;
|
||||
|
||||
/**
|
||||
* Defines an {@link AbstractObject} that can be killed.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface Killable extends ObjectCapability {
|
||||
/**
|
||||
* Process the dying routines. Note that if the object killed himself,
|
||||
* <tt>killer</tt> must be his instance.
|
||||
*
|
||||
* @param killer
|
||||
* the killer. Can be null if unknown.
|
||||
*/
|
||||
void die(WorldObject killer);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.l2jserver.model.world.capability;
|
||||
|
||||
import com.l2jserver.model.world.AbstractObject;
|
||||
|
||||
/**
|
||||
* Defines an {@link AbstractObject} that has levels.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface Levelable extends ObjectCapability {
|
||||
/**
|
||||
* Get this object`s level
|
||||
*
|
||||
* @return the level
|
||||
*/
|
||||
int getLevel();
|
||||
|
||||
/**
|
||||
* Set this object's level
|
||||
*
|
||||
* @param level
|
||||
*/
|
||||
void setLevel(int level);
|
||||
}
|
||||
16
src/main/java/com/l2jserver/model/world/capability/Mana.java
Normal file
16
src/main/java/com/l2jserver/model/world/capability/Mana.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.l2jserver.model.world.capability;
|
||||
|
||||
import com.l2jserver.model.world.AbstractObject;
|
||||
|
||||
/**
|
||||
* Defines an {@link AbstractObject} that can be damaged (HP)
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface Mana extends ObjectCapability {
|
||||
void consumeMana(int amount);
|
||||
|
||||
int getMP();
|
||||
|
||||
void setMP(int mana);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.l2jserver.routines;
|
||||
|
||||
public class InitializationRoutine implements Routine {
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
4
src/main/java/com/l2jserver/routines/Routine.java
Normal file
4
src/main/java/com/l2jserver/routines/Routine.java
Normal file
@@ -0,0 +1,4 @@
|
||||
package com.l2jserver.routines;
|
||||
|
||||
public interface Routine extends Runnable {
|
||||
}
|
||||
@@ -4,10 +4,8 @@ import java.net.InetSocketAddress;
|
||||
|
||||
import com.l2jserver.service.configuration.Configuration;
|
||||
import com.l2jserver.service.configuration.Configuration.ConfigurationName;
|
||||
import com.l2jserver.service.configuration.Configuration.ConfigurationPrefix;
|
||||
|
||||
@ConfigurationName("network")
|
||||
@ConfigurationPrefix("net")
|
||||
public interface NetworkConfiguration extends Configuration {
|
||||
// TODO set default value
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user