mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-08 00:13:11 +00:00
Scripting engine
Change-Id: I5d6df6fd0d76cc07fd2631b5589f5200d9e50000
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package script.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 script.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);
|
||||
}
|
||||
}
|
||||
41
data/template/script/template/armor/Dummy2ArmorTemplate.java
Normal file
41
data/template/script/template/armor/Dummy2ArmorTemplate.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package script.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;
|
||||
}
|
||||
}
|
||||
32
data/template/script/template/armor/DummyArmorTemplate.java
Normal file
32
data/template/script/template/armor/DummyArmorTemplate.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package script.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;
|
||||
}
|
||||
}
|
||||
12
data/template/script/template/item/AdenaItemTemplate.java
Normal file
12
data/template/script/template/item/AdenaItemTemplate.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package script.template.item;
|
||||
|
||||
import com.l2jserver.model.id.TemplateID;
|
||||
import com.l2jserver.model.template.ItemTemplate;
|
||||
|
||||
public class AdenaItemTemplate extends ItemTemplate {
|
||||
public static final TemplateID ID = new TemplateID(57);
|
||||
|
||||
public AdenaItemTemplate() {
|
||||
super(ID);
|
||||
}
|
||||
}
|
||||
16
data/template/script/template/item/TestPotionTemplate.java
Normal file
16
data/template/script/template/item/TestPotionTemplate.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package script.template.item;
|
||||
|
||||
import com.l2jserver.model.template.PotionTemplate;
|
||||
import com.l2jserver.model.world.capability.Attackable;
|
||||
import com.l2jserver.model.world.capability.Attacker;
|
||||
|
||||
public class TestPotionTemplate extends PotionTemplate {
|
||||
public TestPotionTemplate() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void consume(Attacker source, Attackable target) {
|
||||
//TODO consume item
|
||||
}
|
||||
}
|
||||
16
data/template/script/template/skill/TestSkillTemplate.java
Normal file
16
data/template/script/template/skill/TestSkillTemplate.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package script.template.skill;
|
||||
|
||||
import com.l2jserver.model.template.SkillTemplate;
|
||||
import com.l2jserver.model.world.capability.Castable;
|
||||
import com.l2jserver.model.world.capability.Caster;
|
||||
|
||||
public class TestSkillTemplate extends SkillTemplate {
|
||||
public TestSkillTemplate() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cast(Caster caster, Castable target) {
|
||||
// TODO do casting
|
||||
}
|
||||
}
|
||||
31
data/template/script/template/weapon/TestWeaponTemplate.java
Normal file
31
data/template/script/template/weapon/TestWeaponTemplate.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package script.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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user