1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2025-12-09 17:02:53 +00:00

Removed object capabilities

Signed-off-by: Rogiel <rogiel@rogiel.com>
This commit is contained in:
2011-05-22 14:55:54 -03:00
parent 3554664367
commit 49a8513ec5
109 changed files with 158 additions and 1569 deletions

View File

@@ -20,9 +20,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.l2jserver.model.id.template.ActorTemplateID;
import com.l2jserver.model.world.AbstractActor.Race;
import com.l2jserver.model.world.Actor;
import com.l2jserver.model.world.Actor.Race;
import com.l2jserver.model.world.actor.ActorAttributes;
import com.l2jserver.model.world.capability.Actor;
/**
* Template for {@link Actor}

View File

@@ -23,12 +23,10 @@ import com.google.inject.Inject;
import com.l2jserver.game.net.Lineage2Connection;
import com.l2jserver.model.id.object.CharacterID;
import com.l2jserver.model.id.template.ItemTemplateID;
import com.l2jserver.model.template.capability.Depositable;
import com.l2jserver.model.template.capability.Dropable;
import com.l2jserver.model.template.capability.Enchantable;
import com.l2jserver.model.template.capability.Sellable;
import com.l2jserver.model.template.capability.Tradable;
import com.l2jserver.model.template.capability.Usable;
import com.l2jserver.model.world.Item;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.service.network.NetworkService;
@@ -117,20 +115,6 @@ public abstract class ItemTemplate extends AbstractTemplate<Item> {
return (this instanceof Tradable);
}
/**
* @return the usable
*/
public boolean isUsable() {
return (this instanceof Usable);
}
/**
* @return the usable
*/
public boolean isDepositable() {
return (this instanceof Depositable);
}
/**
* @return the weight
*/

View File

@@ -23,10 +23,11 @@ import com.l2jserver.game.net.packet.server.NPCHtmlMessagePacket;
import com.l2jserver.model.id.template.ItemTemplateID;
import com.l2jserver.model.id.template.NPCTemplateID;
import com.l2jserver.model.id.template.provider.ItemTemplateIDProvider;
import com.l2jserver.model.world.AbstractActor.Race;
import com.l2jserver.model.template.capability.Interactable;
import com.l2jserver.model.world.Actor;
import com.l2jserver.model.world.Actor.Race;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.model.world.NPC;
import com.l2jserver.model.world.capability.Actor;
import com.l2jserver.service.game.character.CannotSetTargetServiceException;
import com.l2jserver.service.game.character.CharacterService;
import com.l2jserver.service.network.NetworkService;
@@ -39,7 +40,8 @@ import com.l2jserver.util.html.markup.HtmlTemplate;
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public abstract class NPCTemplate extends ActorTemplate<NPC> {
public abstract class NPCTemplate extends ActorTemplate<NPC> implements
Interactable<NPC> {
/**
* The {@link NetworkService}
*/
@@ -93,17 +95,7 @@ public abstract class NPCTemplate extends ActorTemplate<NPC> {
super(id, null);
}
/**
* Performs an interaction with this NPC. This is normally invoked from
* <tt>npc</tt> instance.
*
* @param character
* the interacting character
* @param args
* the action arguments
* @throws L2Exception
* any {@link L2Exception}
*/
@Override
public void action(NPC npc, L2Character character, String... args)
throws L2Exception {
Preconditions.checkNotNull(npc, "npc");
@@ -140,7 +132,7 @@ public abstract class NPCTemplate extends ActorTemplate<NPC> {
* the action arguments
* @throws L2Exception
*/
public void talk(NPC npc, L2Character character, Lineage2Connection conn,
protected void talk(NPC npc, L2Character character, Lineage2Connection conn,
String... args) throws L2Exception {
if (args.length == 0 || (args.length >= 1 && args[0].equals("Chat"))) {
String name = "";

View File

@@ -18,7 +18,6 @@ package com.l2jserver.model.template;
import com.l2jserver.model.game.Skill;
import com.l2jserver.model.id.template.SkillTemplateID;
import com.l2jserver.model.template.capability.Castable;
import com.l2jserver.model.world.character.CharacterClass;
/**
@@ -26,8 +25,7 @@ import com.l2jserver.model.world.character.CharacterClass;
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public abstract class SkillTemplate extends AbstractTemplate<Skill> implements
Castable {
public abstract class SkillTemplate extends AbstractTemplate<Skill> {
/**
* The maximum level supported by this skill
*/

View File

@@ -1,33 +0,0 @@
/*
* 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.template.capability;
import com.l2jserver.model.template.Template;
import com.l2jserver.model.world.capability.Caster;
/**
* Defines an {@link Template template} {@link TemplateCapability capability}
* that an {@link Caster} can cast on an
* {@link com.l2jserver.model.world.capability.Castable}.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*
*/
public interface Castable extends TemplateCapability {
void cast(Caster caster,
com.l2jserver.model.world.capability.Castable... targets);
}

View File

@@ -1,31 +0,0 @@
/*
* 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.template.capability;
import com.l2jserver.model.template.Template;
import com.l2jserver.model.world.capability.Attacker;
/**
* Defines an {@link Template template} {@link TemplateCapability capability}
* that can be consumed.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface Consumable extends TemplateCapability {
void consume(Attacker source,
com.l2jserver.model.world.capability.Attackable target);
}

View File

@@ -1,36 +0,0 @@
/*
* 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.template.capability;
import com.l2jserver.model.template.Template;
import com.l2jserver.model.world.capability.Attacker;
/**
* Defines an {@link Template template} {@link TemplateCapability capability}
* that an {@link com.l2jserver.model.world.capability.Attackable} can use to
* defend from an {@link Attacker}.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface Defendable extends TemplateCapability {
void defend(Attacker source,
com.l2jserver.model.world.capability.Attackable target);
int getPhysicalDefense();
int getMagicalDefense();
}

View File

@@ -1,31 +0,0 @@
/*
* 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.template.capability;
import com.l2jserver.model.template.Template;
import com.l2jserver.model.world.capability.Attacker;
/**
* Defines an {@link Template template} {@link TemplateCapability capability}
* that can be selled.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface Depositable extends TemplateCapability {
void sell(Attacker source,
com.l2jserver.model.world.capability.Attackable target);
}

View File

@@ -17,7 +17,6 @@
package com.l2jserver.model.template.capability;
import com.l2jserver.model.template.Template;
import com.l2jserver.model.world.capability.Attacker;
/**
* Defines an {@link Template template} {@link TemplateCapability capability}
@@ -26,6 +25,5 @@ import com.l2jserver.model.world.capability.Attacker;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface Dropable extends TemplateCapability {
void sell(Attacker source,
com.l2jserver.model.world.capability.Attackable target);
}

View File

@@ -25,5 +25,5 @@ import com.l2jserver.model.template.Template;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface Enchantable extends TemplateCapability {
void enchant(com.l2jserver.model.world.capability.Enchantable target);
}

View File

@@ -1,31 +0,0 @@
/*
* 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.template.capability;
import com.l2jserver.model.template.Template;
import com.l2jserver.model.world.capability.Equiper;
/**
* Defines an {@link Template template} {@link TemplateCapability capability}
* for an object that acn be equipable by an {@link Equiper}.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*
*/
public interface Equipable extends TemplateCapability {
void equip(Equiper equiper);
}

View File

@@ -17,17 +17,27 @@
package com.l2jserver.model.template.capability;
import com.l2jserver.model.template.Template;
import com.l2jserver.model.world.capability.Attacker;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.model.world.WorldObject;
import com.l2jserver.util.exception.L2Exception;
/**
* Defines an {@link Template template} {@link TemplateCapability capability}
* that an {@link Attacker} can use to attack an
* {@link com.l2jserver.model.world.capability.Attackable}
* Defines an {@link Template} which the player can interact with
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*
*/
public interface Attackable extends TemplateCapability {
void attack(Attacker source,
com.l2jserver.model.world.capability.Attackable target);
public interface Interactable<T extends WorldObject> extends TemplateCapability {
/**
* Performs an interaction with this template.
*
* @param character
* the interacting character
* @param args
* the action arguments
* @throws L2Exception
* any {@link L2Exception}
*/
void action(T object, L2Character character, String... args)
throws L2Exception;
}

View File

@@ -1,30 +0,0 @@
/*
* 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.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
* {@link Equiper}.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface Penalty extends TemplateCapability {
void penalty(Equiper user);
}

View File

@@ -17,7 +17,6 @@
package com.l2jserver.model.template.capability;
import com.l2jserver.model.template.Template;
import com.l2jserver.model.world.capability.Attacker;
/**
* Defines an {@link Template template} {@link TemplateCapability capability}
@@ -26,6 +25,5 @@ import com.l2jserver.model.world.capability.Attacker;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface Sellable extends TemplateCapability {
void sell(Attacker source,
com.l2jserver.model.world.capability.Attackable target);
}

View File

@@ -1,29 +0,0 @@
/*
* 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.template.capability;
import com.l2jserver.model.world.WorldObject;
/**
* Defines an template that can be stacked (i.e. more then one item per slot in
* the inventory)
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface Stackable<T extends WorldObject> extends TemplateCapability {
void stack(T... object);
}

View File

@@ -17,7 +17,6 @@
package com.l2jserver.model.template.capability;
import com.l2jserver.model.template.Template;
import com.l2jserver.model.world.capability.Attacker;
/**
* Defines an {@link Template template} {@link TemplateCapability capability}
@@ -26,6 +25,5 @@ import com.l2jserver.model.world.capability.Attacker;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface Tradable extends TemplateCapability {
void sell(Attacker source,
com.l2jserver.model.world.capability.Attackable target);
}

View File

@@ -1,29 +0,0 @@
/*
* 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.template.capability;
import com.l2jserver.model.template.Template;
/**
* Defines an {@link Template template} {@link TemplateCapability capability}
* that can be used.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface Usable extends TemplateCapability {
void canUse();
}

View File

@@ -18,7 +18,6 @@ package com.l2jserver.model.template.item;
import com.l2jserver.model.id.template.ItemTemplateID;
import com.l2jserver.model.template.ItemTemplate;
import com.l2jserver.model.template.capability.Defendable;
import com.l2jserver.model.world.Item;
/**
@@ -26,7 +25,7 @@ import com.l2jserver.model.world.Item;
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public abstract class ArmorTemplate extends ItemTemplate implements Defendable {
public abstract class ArmorTemplate extends ItemTemplate {
public ArmorTemplate(ItemTemplateID id) {
super(id);
}

View File

@@ -18,7 +18,6 @@ package com.l2jserver.model.template.item;
import com.l2jserver.model.id.template.ItemTemplateID;
import com.l2jserver.model.template.ItemTemplate;
import com.l2jserver.model.template.capability.Consumable;
import com.l2jserver.model.world.Item;
/**
@@ -26,8 +25,7 @@ import com.l2jserver.model.world.Item;
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public abstract class ConsumableTemplate extends ItemTemplate implements
Consumable {
public abstract class ConsumableTemplate extends ItemTemplate {
public ConsumableTemplate(ItemTemplateID id, String icon,
ItemMaterial material) {
super(id, icon, material);

View File

@@ -17,7 +17,6 @@
package com.l2jserver.model.template.item;
import com.l2jserver.model.id.template.ItemTemplateID;
import com.l2jserver.model.template.capability.Stackable;
import com.l2jserver.model.world.Item;
/**
@@ -25,8 +24,7 @@ import com.l2jserver.model.world.Item;
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public abstract class PotionTemplate extends ConsumableTemplate implements
Stackable<Item> {
public abstract class PotionTemplate extends ConsumableTemplate {
public PotionTemplate(ItemTemplateID id, String icon) {
super(id, icon, ItemMaterial.LIQUID);
}

View File

@@ -21,7 +21,6 @@ import java.util.Map.Entry;
import com.l2jserver.model.id.template.ItemTemplateID;
import com.l2jserver.model.template.ItemTemplate;
import com.l2jserver.model.template.capability.Attackable;
import com.l2jserver.model.world.Item;
import com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll;
import com.l2jserver.util.calculator.Calculator;
@@ -38,7 +37,7 @@ import com.l2jserver.util.factory.CollectionFactory;
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public abstract class WeaponTemplate extends ItemTemplate implements Attackable {
public abstract class WeaponTemplate extends ItemTemplate {
/**
* The paperldoll slot used by this weapon
*/