1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2025-12-07 16:03:10 +00:00

Change-Id: I0000000000000000000000000000000000000000

Change-Id: I8636776eaf000fcdfb528cc403710f6d6ee9e73e
Change-Id: Iebc523681d07ecd6d7b7e89343b29a8034558f94
This commit is contained in:
rogiel
2011-05-07 01:06:17 -03:00
parent 81d2babede
commit 51aea46020
100 changed files with 2505 additions and 406 deletions

View File

@@ -1,21 +1,19 @@
package script.template;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Documented;
import java.lang.annotation.Target;
import java.lang.annotation.ElementType;
/**
* Marker annotation that is used to mark disabled DAO's so they will be ignored by {@link TemplateLoader}
* Marker annotation that is used to mark disabled DAO's so they will be ignored
* by {@link TemplateLoader}
*
* @author SoulKeeper
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface DisabledTemplate
{
public @interface DisabledTemplate {
}

View File

@@ -1,23 +1,11 @@
package script.template;/*
* This file is part of aion-emu <aion-emu.com>.
*
* aion-emu 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.
*
* aion-emu 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 aion-emu. If not, see <http://www.gnu.org/licenses/>.
*/
package script.template;
import java.lang.reflect.Modifier;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.inject.Inject;
import com.l2jserver.model.template.Template;
import com.l2jserver.service.game.scripting.classlistener.Loader;
@@ -35,6 +23,9 @@ import com.l2jserver.util.factory.CollectionFactory;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class TemplateLoader implements Loader, Unloader {
private static final Logger log = LoggerFactory
.getLogger(TemplateLoader.class);
private final StaticTemplateService templateService;
@Inject
@@ -44,16 +35,19 @@ public class TemplateLoader implements Loader, Unloader {
@Override
public void load(Class<?>[] classes) {
for (final Class<? extends Template> template : getSuitableClasses(classes)) {
log.debug("Loading templates from {} classes", classes.length);
for (final Class<? extends Template<?>> template : getSuitableClasses(classes)) {
log.debug("Found loadable template class: {}", template);
templateService.addTemplate(template);
System.out.println("Loading template: " + template);
}
}
@Override
public void unload(Class<?>[] classes) {
for (final Class<? extends Template> template : getSuitableClasses(classes)) {
System.out.println("Unloading template: " + template);
log.debug("Unloading templates from {} classes", classes.length);
for (final Class<? extends Template<?>> template : getSuitableClasses(classes)) {
log.debug("Found unloadable template class: {}", template);
// TODO unloading
}
}
@@ -63,9 +57,9 @@ public class TemplateLoader implements Loader, Unloader {
* @return list of Template classes to load/unload
*/
@SuppressWarnings({ "unchecked" })
private static Set<Class<? extends Template>> getSuitableClasses(
private static Set<Class<? extends Template<?>>> getSuitableClasses(
Class<?>[] classes) {
final Set<Class<? extends Template>> suitable = CollectionFactory
final Set<Class<? extends Template<?>>> suitable = CollectionFactory
.newSet(null);
for (Class<?> clazz : classes) {
if (!ClassUtils.isSubclass(clazz, Template.class))
@@ -78,7 +72,7 @@ public class TemplateLoader implements Loader, Unloader {
if (clazz.isAnnotationPresent(DisabledTemplate.class))
continue;
suitable.add((Class<? extends Template>) clazz);
suitable.add((Class<? extends Template<?>>) clazz);
}
return suitable;

View File

@@ -0,0 +1,30 @@
package script.template.character;
import com.l2jserver.model.id.template.CharacterTemplateID;
import com.l2jserver.model.template.CharacterTemplate;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.model.world.character.CharacterClass;
import com.l2jserver.util.Coordinate;
public class AbstractCharacterTemplate extends CharacterTemplate {
protected AbstractCharacterTemplate(CharacterTemplateID id,
CharacterClass characterClass, int intelligence, int strength,
int concentration, int mentality, int dextry, int witness,
int physicalAttack, int magicalAttack, int physicalDefense,
int magicalDefense, int attackSpeed, int castSpeed, int accuracy,
int criticalChance, int evasionChance, int moveSpeed,
int maxWeigth, boolean craft, Coordinate spawnLocation) {
super(id, characterClass, intelligence, strength, concentration,
mentality, dextry, witness, physicalAttack, magicalAttack,
physicalDefense, magicalDefense, attackSpeed, castSpeed,
accuracy, criticalChance, evasionChance, maxWeigth, moveSpeed,
craft, spawnLocation);
}
@Override
public L2Character create() {
final L2Character character = super.create();
// TODO register skills
return character;
}
}

View File

@@ -0,0 +1,29 @@
package script.template.character;
import com.l2jserver.model.id.template.CharacterTemplateID;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.model.world.character.CharacterClass;
import com.l2jserver.util.Coordinate;
public class HumanCharacterTemplate extends AbstractCharacterTemplate {
protected HumanCharacterTemplate(CharacterTemplateID id,
CharacterClass characterClass, int intelligence, int strength,
int concentration, int mentality, int dextry, int witness,
int physicalAttack, int magicalAttack, int physicalDefense,
int magicalDefense, int attackSpeed, int castSpeed, int accuracy,
int criticalChance, int evasionChance, int moveSpeed,
int maxWeigth, boolean craft, Coordinate spawnLocation) {
super(id, characterClass, intelligence, strength, concentration,
mentality, dextry, witness, physicalAttack, magicalAttack,
physicalDefense, magicalDefense, attackSpeed, castSpeed,
accuracy, criticalChance, evasionChance, moveSpeed, maxWeigth,
false, spawnLocation);
}
@Override
public L2Character create() {
final L2Character character = super.create();
// TODO register skills
return character;
}
}

View File

@@ -0,0 +1,43 @@
package script.template.character;
import com.google.inject.Inject;
import com.l2jserver.model.id.template.factory.CharacterTemplateIDFactory;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.model.world.character.CharacterClass;
import com.l2jserver.util.Coordinate;
public class HumanFighterTemplate extends HumanCharacterTemplate {
@Inject
public HumanFighterTemplate(CharacterTemplateIDFactory factory) {
super(factory.createID(CharacterClass.HUMAN_FIGHTER.id),
CharacterClass.HUMAN_FIGHTER,
// ATTRIBUTES
21,// INT
40,// STR
43,// CON
25,// MEN
30,// DEX
11,// WIT
4,// physical attack
6,// magical attack
80,// physical def
4,// magical def
300,// attack speed
333,// cast speed
33,// accuracy
44,// critical
33,// evasion
115,// move speed
81900,// max inventory weight
false,// can craft
Coordinate.fromXYZ(-71338, 258271, -3104)// spawn location
);
}
@Override
public L2Character create() {
final L2Character character = super.create();
// TODO register skills
return character;
}
}

View File

@@ -0,0 +1,43 @@
package script.template.character;
import com.google.inject.Inject;
import com.l2jserver.model.id.template.factory.CharacterTemplateIDFactory;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.model.world.character.CharacterClass;
import com.l2jserver.util.Coordinate;
public class HumanMysticTemplate extends HumanCharacterTemplate {
@Inject
public HumanMysticTemplate(CharacterTemplateIDFactory factory) {
super(factory.createID(CharacterClass.HUMAN_FIGHTER.id),
CharacterClass.HUMAN_FIGHTER,
// ATTRIBUTES
21,// INT
40,// STR
43,// CON
25,// MEN
30,// DEX
11,// WIT
4,// physical attack
6,// magical attack
80,// physical def
4,// magical def
300,// attack speed
333,// cast speed
33,// accuracy
44,// critical
33,// evasion
115,// move speed
81900,// max inventory weight
false,// can craft
Coordinate.fromXYZ(-71338, 258271, -3104)// spawn location
);
}
@Override
public L2Character create() {
final L2Character character = super.create();
// TODO register skills
return character;
}
}

View File

@@ -1,5 +1,6 @@
package script.template.item;
import com.google.inject.Inject;
import com.l2jserver.model.id.template.factory.ItemTemplateIDFactory;
import com.l2jserver.model.template.ItemTemplate;
import com.l2jserver.model.template.capability.Stackable;
@@ -8,6 +9,7 @@ import com.l2jserver.model.world.Item;
public class AdenaItemTemplate extends ItemTemplate implements Stackable<Item> {
public static final int ID = 57;
@Inject
public AdenaItemTemplate(ItemTemplateIDFactory factory) {
super(factory.createID(ID));
}

View File

@@ -1,5 +1,6 @@
package script.template.item;
import com.google.inject.Inject;
import com.l2jserver.model.id.template.factory.ItemTemplateIDFactory;
import com.l2jserver.model.template.PotionTemplate;
import com.l2jserver.model.world.capability.Attackable;
@@ -8,6 +9,7 @@ import com.l2jserver.model.world.capability.Attacker;
public class TestPotionTemplate extends PotionTemplate {
public static final int ID = 15;
@Inject
public TestPotionTemplate(ItemTemplateIDFactory factory) {
super(factory.createID(ID));
}

View File

@@ -21,12 +21,13 @@ public abstract class AbstractGradeAArmorTemplate extends ArmorTemplate
@Override
public void penalty(Equiper user) {
if (!(user instanceof Levelable) && !(user instanceof Castable) && !(user instanceof Equiper))
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) {
}
}
}

View File

@@ -1,5 +1,6 @@
package script.template.item.armor;
import com.google.inject.Inject;
import com.l2jserver.model.id.template.factory.ItemTemplateIDFactory;
import com.l2jserver.model.world.capability.Attackable;
import com.l2jserver.model.world.capability.Attacker;
@@ -8,11 +9,12 @@ import com.l2jserver.model.world.capability.Enchantable;
public class Dummy2ArmorTemplate extends AbstractGradeAArmorTemplate {
public static final int ID = 10;
private static final int REDUCED_DAMAGE_PHYSICAL = 10;
private static final int REDUCED_DAMAGE_MAGICAL = 10;
private static final int MAX_ENCHANT = 10;
@Inject
public Dummy2ArmorTemplate(ItemTemplateIDFactory factory) {
super(factory.createID(ID));
}

View File

@@ -1,5 +1,6 @@
package script.template.item.armor;
import com.google.inject.Inject;
import com.l2jserver.model.id.template.factory.ItemTemplateIDFactory;
import com.l2jserver.model.world.capability.Attackable;
import com.l2jserver.model.world.capability.Attacker;
@@ -7,10 +8,11 @@ import com.l2jserver.model.world.capability.Damagable;
public class DummyArmorTemplate extends AbstractNoGradeArmorTemplate {
public static final int ID = 20;
private static final int REDUCED_DAMAGE_PHYSICAL = 10;
private static final int REDUCED_DAMAGE_MAGICAL = 10;
@Inject
public DummyArmorTemplate(ItemTemplateIDFactory factory) {
super(factory.createID(ID));
}

View File

@@ -1,17 +1,25 @@
package script.template.skill;
import com.google.inject.Inject;
import com.l2jserver.model.id.template.factory.SkillTemplateIDFactory;
import com.l2jserver.model.template.SkillTemplate;
import com.l2jserver.model.world.capability.Castable;
import com.l2jserver.model.world.capability.Caster;
import com.l2jserver.model.world.character.CharacterClass;
public class TestSkillTemplate extends SkillTemplate {
public static final int ID = 10;
@Inject
public TestSkillTemplate(SkillTemplateIDFactory factory) {
super(factory.createID(ID));
}
@Override
public CharacterClass[] getClasses() {
return new CharacterClass[] { CharacterClass.HUMAN_FIGHTER };
}
@Override
public void cast(Caster caster, Castable... targets) {
// TODO do casting