1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2025-12-06 07:32:46 +00:00

Open map implemented

Signed-off-by: Rogiel <rogiel@rogiel.com>
This commit is contained in:
2011-05-22 13:21:08 -03:00
parent 87ce7bb987
commit 0661b41cfd
31 changed files with 649 additions and 111 deletions

View File

@@ -36,4 +36,6 @@ public class WolfMonsterTemplate extends MonsterNPCTemplate {
this.collisionRadius = 13.00; this.collisionRadius = 13.00;
this.collisionHeight = 9.00; this.collisionHeight = 9.00;
} }
} }

View File

@@ -19,6 +19,9 @@ package script.template.actor.npc;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.l2jserver.model.id.template.provider.NPCTemplateIDProvider; import com.l2jserver.model.id.template.provider.NPCTemplateIDProvider;
import com.l2jserver.model.template.npc.TeleporterNPCTemplate; import com.l2jserver.model.template.npc.TeleporterNPCTemplate;
import com.l2jserver.util.exception.L2Exception;
import com.l2jserver.util.html.markup.HtmlTemplate;
import com.l2jserver.util.html.markup.MarkupTag;
/** /**
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
@@ -48,6 +51,57 @@ public class RoxxyGatekeeperTemplate extends TeleporterNPCTemplate {
addLocation("Talking Island, Northern Territor", addLocation("Talking Island, Northern Territor",
TALKING_ISLAND_NORTHERN_TERRITORY, 1000); TALKING_ISLAND_NORTHERN_TERRITORY, 1000);
addLocation("Obelisk of Victory", OBELISK_OF_VICTORY, 470); addLocation("Obelisk of Victory", OBELISK_OF_VICTORY, 470);
}
@Override
protected HtmlTemplate getChat(String name) throws L2Exception {
if (name.equals("")) {
return new HtmlTemplate() {
@Override
protected void build(MarkupTag body) {
body.text(
"Welcome! I am Gatekeeper Roxxy, dispatched from the Ivory Tower. "
+ "I'm very happy to return to my hometown. Have you perhaps been to "
+ "Einhovant's School of Magic? Grand Magister Gallint was my old "
+ "teacher. Now then, how can I help you?")
.br();
body.addLink("Ask about the airship wharf.",
"npc_${npcid}_Chat airship").br();
body.addLink("Ask about the Ivory Tower.",
"npc_${npcid}_Chat ivory").br();
body.addLink("Teleport", "npc_${npcid}_Chat teleport").br();
body.addLink("Exchange Dimension Diamonds. (TODO)",
"npc_${npcid}_multisell 002").br();
body.addLink("Noblesse Exclusive Teleport",
"npc_${npcid}_Quest 2000_NoblesseTeleport").br();
body.addLink("Receive your Birthday Gift! (TODO)",
"npc_${npcid}_Quest CharacterBirthday").br();
body.addLink("Quest", "npc_${npcid}_Quest").br();
}
};
} else if (name.equals("airship")) {
return new HtmlTemplate() {
@Override
protected void build(MarkupTag body) {
body.text("This text is not yet implemented.");
}
};
} else if (name.equals("ivory")) {
return new HtmlTemplate() {
@Override
protected void build(MarkupTag body) {
body.text(
"The Ivory Tower is the foremost temple of all Mystics. It has been "
+ "well known as such ever since the age of Elmoreden. I was born here, and "
+ "graduated from Einhovant's School of Wizardry. And now, I am working as a "
+ "gatekeeper by the order of the Ivory Tower. If you happen to go to the Ivory "
+ "Tower later on, please give my best regards to Grand Magister Valerie. She "
+ "is my teacher and a wonderful, caring person.")
.br();
body.addLink("Back", "npc_${npcid}");
}
};
}
return super.getChat(name);
} }
} }

View File

@@ -18,19 +18,18 @@ package script.template.item;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.l2jserver.model.id.template.provider.ItemTemplateIDProvider; import com.l2jserver.model.id.template.provider.ItemTemplateIDProvider;
import com.l2jserver.model.template.ItemTemplate;
import com.l2jserver.model.template.capability.Stackable; import com.l2jserver.model.template.capability.Stackable;
import com.l2jserver.model.template.item.EtcItemTemplate;
import com.l2jserver.model.world.Item; import com.l2jserver.model.world.Item;
public class AdenaItemTemplate extends ItemTemplate implements Stackable<Item> { public class AdenaItemTemplate extends EtcItemTemplate implements
Stackable<Item> {
public static final int ID = 57; public static final int ID = 57;
@Inject @Inject
public AdenaItemTemplate(ItemTemplateIDProvider factory) { public AdenaItemTemplate(ItemTemplateIDProvider factory) {
super(factory.createID(ID)); super(factory.createID(ID), "icon.etc_adena_i00", ItemMaterial.GOLD);
this.icon = "icon.etc_adena_i00";
this.immediateEffect = true; this.immediateEffect = true;
this.material = ItemMaterial.GOLD;
this.price = 1; this.price = 1;
} }
} }

View File

@@ -0,0 +1,39 @@
/*
* 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 script.template.item;
import com.google.inject.Inject;
import com.l2jserver.model.id.template.provider.ItemTemplateIDProvider;
import com.l2jserver.model.id.template.provider.SkillTemplateIDProvider;
import com.l2jserver.model.template.capability.Stackable;
import com.l2jserver.model.template.item.SkillEtcItemTemplate;
import com.l2jserver.model.world.Item;
public class LargaFireworkItemTemplate extends SkillEtcItemTemplate implements
Stackable<Item> {
public static final int ID = 6407;
@Inject
public LargaFireworkItemTemplate(ItemTemplateIDProvider provider,
SkillTemplateIDProvider skillProvider) {
// TODO set skill id
super(provider.createID(ID), "icon.etc_ultra_bomb_i00",
ItemMaterial.STEEL, skillProvider.createID(0));
this.immediateEffect = true;
this.price = 1;
}
}

View File

@@ -20,7 +20,6 @@ import com.google.inject.Inject;
import com.l2jserver.model.id.template.provider.ItemTemplateIDProvider; import com.l2jserver.model.id.template.provider.ItemTemplateIDProvider;
import com.l2jserver.model.world.capability.Attackable; import com.l2jserver.model.world.capability.Attackable;
import com.l2jserver.model.world.capability.Attacker; import com.l2jserver.model.world.capability.Attacker;
import com.l2jserver.model.world.capability.Damagable;
import com.l2jserver.model.world.capability.Enchantable; import com.l2jserver.model.world.capability.Enchantable;
public class Dummy2ArmorTemplate extends AbstractGradeAArmorTemplate { public class Dummy2ArmorTemplate extends AbstractGradeAArmorTemplate {
@@ -39,10 +38,6 @@ public class Dummy2ArmorTemplate extends AbstractGradeAArmorTemplate {
public void defend(Attacker source, Attackable target) { public void defend(Attacker source, Attackable target) {
} }
@Override
public void interceptIncomingDamage(Damagable target) {
}
@Override @Override
public void enchant(Enchantable target) { public void enchant(Enchantable target) {
if (target.getEnchantLevel() >= MAX_ENCHANT) if (target.getEnchantLevel() >= MAX_ENCHANT)

View File

@@ -20,7 +20,6 @@ import com.google.inject.Inject;
import com.l2jserver.model.id.template.provider.ItemTemplateIDProvider; import com.l2jserver.model.id.template.provider.ItemTemplateIDProvider;
import com.l2jserver.model.world.capability.Attackable; import com.l2jserver.model.world.capability.Attackable;
import com.l2jserver.model.world.capability.Attacker; import com.l2jserver.model.world.capability.Attacker;
import com.l2jserver.model.world.capability.Damagable;
public class DummyArmorTemplate extends AbstractNoGradeArmorTemplate { public class DummyArmorTemplate extends AbstractNoGradeArmorTemplate {
public static final int ID = 20; public static final int ID = 20;
@@ -37,10 +36,6 @@ public class DummyArmorTemplate extends AbstractNoGradeArmorTemplate {
public void defend(Attacker source, Attackable target) { public void defend(Attacker source, Attackable target) {
} }
@Override
public void interceptIncomingDamage(Damagable target) {
}
@Override @Override
public int getPhysicalDefense() { public int getPhysicalDefense() {
return REDUCED_DAMAGE_PHYSICAL; return REDUCED_DAMAGE_PHYSICAL;

View File

@@ -37,6 +37,7 @@ import com.l2jserver.game.net.packet.client.CharacterRequestActionUse;
import com.l2jserver.game.net.packet.client.CharacterRequestBypass; import com.l2jserver.game.net.packet.client.CharacterRequestBypass;
import com.l2jserver.game.net.packet.client.CharacterRequestInventoryPacket; import com.l2jserver.game.net.packet.client.CharacterRequestInventoryPacket;
import com.l2jserver.game.net.packet.client.CharacterRequestMovePacket; import com.l2jserver.game.net.packet.client.CharacterRequestMovePacket;
import com.l2jserver.game.net.packet.client.CharacterRequestOpenMap;
import com.l2jserver.game.net.packet.client.CharacterSelectPacket; import com.l2jserver.game.net.packet.client.CharacterSelectPacket;
import com.l2jserver.game.net.packet.client.CharacterValidatePositionPacket; import com.l2jserver.game.net.packet.client.CharacterValidatePositionPacket;
import com.l2jserver.game.net.packet.client.EnterWorld; import com.l2jserver.game.net.packet.client.EnterWorld;
@@ -178,6 +179,8 @@ public class Lineage2PacketReader extends OneToOneDecoder {
return CharacterAppearingPacket.class; return CharacterAppearingPacket.class;
case CharacterRequestActionUse.OPCODE: case CharacterRequestActionUse.OPCODE:
return CharacterRequestActionUse.class; return CharacterRequestActionUse.class;
case CharacterRequestOpenMap.OPCODE:
return CharacterRequestOpenMap.class;
default: default:
logger.warn("Unknown opcode: 0x{}", Integer.toHexString(opcode)); logger.warn("Unknown opcode: 0x{}", Integer.toHexString(opcode));
break; break;

View File

@@ -29,6 +29,7 @@ import com.l2jserver.model.id.object.ActorID;
import com.l2jserver.model.id.object.provider.ObjectIDResolver; import com.l2jserver.model.id.object.provider.ObjectIDResolver;
import com.l2jserver.model.world.L2Character; import com.l2jserver.model.world.L2Character;
import com.l2jserver.model.world.capability.Actor; import com.l2jserver.model.world.capability.Actor;
import com.l2jserver.service.game.character.ActorIsNotAttackableServiceException;
import com.l2jserver.service.game.character.CannotSetTargetServiceException; import com.l2jserver.service.game.character.CannotSetTargetServiceException;
import com.l2jserver.service.game.character.CharacterService; import com.l2jserver.service.game.character.CharacterService;
import com.l2jserver.util.dimensional.Coordinate; import com.l2jserver.util.dimensional.Coordinate;
@@ -129,6 +130,8 @@ public class CharacterAttackRequestPacket extends AbstractClientPacket {
charService.attack(character, actor); charService.attack(character, actor);
} catch (CannotSetTargetServiceException e) { } catch (CannotSetTargetServiceException e) {
conn.sendActionFailed(); conn.sendActionFailed();
} catch (ActorIsNotAttackableServiceException e) {
conn.sendActionFailed();
} }
} }
} }

View File

@@ -23,6 +23,8 @@ import com.l2jserver.game.net.Lineage2Connection;
import com.l2jserver.game.net.packet.AbstractClientPacket; import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.model.world.L2Character; import com.l2jserver.model.world.L2Character;
import com.l2jserver.model.world.L2Character.CharacterMoveType; import com.l2jserver.model.world.L2Character.CharacterMoveType;
import com.l2jserver.service.game.character.CharacterAlreadyRunningServiceException;
import com.l2jserver.service.game.character.CharacterAlreadyWalkingServiceException;
import com.l2jserver.service.game.character.CharacterService; import com.l2jserver.service.game.character.CharacterService;
/** /**
@@ -101,10 +103,16 @@ public class CharacterRequestActionUse extends AbstractClientPacket {
// TODO // TODO
break; break;
case WALK_RUN: case WALK_RUN:
if (character.getMoveType() == CharacterMoveType.WALK) { try {
charService.run(character); if (character.getMoveType() == CharacterMoveType.WALK) {
} else { charService.run(character);
charService.walk(character); } else {
charService.walk(character);
}
} catch (CharacterAlreadyWalkingServiceException e) {
conn.sendActionFailed();
} catch (CharacterAlreadyRunningServiceException e) {
conn.sendActionFailed();
} }
break; break;
} }

View File

@@ -49,7 +49,26 @@ public class CharacterRequestMovePacket extends AbstractClientPacket {
// packet // packet
private Coordinate target; private Coordinate target;
private Coordinate origin; private Coordinate origin;
private int moveMovement; @SuppressWarnings("unused")
private MovementType type;
public enum MovementType {
MOUSE(0x01), KEYBOARD(0x00);
public final int id;
MovementType(int id) {
this.id = id;
}
public static MovementType fromID(int id) {
for (final MovementType type : values()) {
if (type.id == id)
return type;
}
return null;
}
}
@Inject @Inject
public CharacterRequestMovePacket(CharacterService charService) { public CharacterRequestMovePacket(CharacterService charService) {
@@ -65,7 +84,7 @@ public class CharacterRequestMovePacket extends AbstractClientPacket {
// seems that L2Walker does not send this // seems that L2Walker does not send this
if (buffer.readableBytes() >= 4) { if (buffer.readableBytes() >= 4) {
// 0 keyboard, 1 mouse // 0 keyboard, 1 mouse
this.moveMovement = buffer.readInt(); this.type = MovementType.fromID(buffer.readInt());
} }
} }

View File

@@ -14,15 +14,31 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>. * along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.l2jserver.model.template.capability; package com.l2jserver.game.net.packet.client;
import com.l2jserver.model.world.capability.Damagable; import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Connection;
import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.game.net.packet.server.CharacterOpenMap;
/** /**
* Indicates that an template has the ability to intercept outgoing damage. * Executes an bypass command
* *
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public interface OutgoingDamageIntercept extends TemplateCapability { public class CharacterRequestOpenMap extends AbstractClientPacket {
void interceptOutgoingDamage(Damagable target); /**
* The packet OPCODE
*/
public static final int OPCODE = 0x6c;
@Override
public void read(Lineage2Connection conn, ChannelBuffer buffer) {
}
@Override
public void process(final Lineage2Connection conn) {
conn.write(new CharacterOpenMap(1665));
}
} }

View File

@@ -22,6 +22,7 @@ import com.l2jserver.game.net.Lineage2Connection;
import com.l2jserver.game.net.packet.AbstractServerPacket; import com.l2jserver.game.net.packet.AbstractServerPacket;
import com.l2jserver.game.net.packet.server.CharacterCreateFailPacket.Reason; import com.l2jserver.game.net.packet.server.CharacterCreateFailPacket.Reason;
import com.l2jserver.model.world.L2Character; import com.l2jserver.model.world.L2Character;
import com.l2jserver.model.world.capability.Actor;
import com.l2jserver.service.game.chat.ChatMessageDestination; import com.l2jserver.service.game.chat.ChatMessageDestination;
import com.l2jserver.util.BufferUtils; import com.l2jserver.util.BufferUtils;
@@ -39,27 +40,51 @@ public class ActorChatMessagePacket extends AbstractServerPacket {
public static final int OPCODE = 0x4a; public static final int OPCODE = 0x4a;
/** /**
* The selected character * The sending actor
*/
private final Actor actor;
/**
* The message destination
*/ */
private final L2Character character;
private ChatMessageDestination destination; private ChatMessageDestination destination;
/**
* The message
*/
private String message = null; private String message = null;
/**
* The message ID
*/
private int messageID = 0; private int messageID = 0;
public ActorChatMessagePacket(L2Character character, public ActorChatMessagePacket(Actor character,
ChatMessageDestination destination, String message) { ChatMessageDestination destination, String message) {
super(OPCODE); super(OPCODE);
this.character = character; this.actor = character;
this.destination = destination; this.destination = destination;
this.message = message; this.message = message;
} }
public ActorChatMessagePacket(Actor actor,
ChatMessageDestination destination, int messageID) {
super(OPCODE);
this.actor = actor;
this.destination = destination;
this.messageID = messageID;
}
@Override @Override
public void write(Lineage2Connection conn, ChannelBuffer buffer) { public void write(Lineage2Connection conn, ChannelBuffer buffer) {
buffer.writeInt(character.getID().getID()); buffer.writeInt(actor.getID().getID());
buffer.writeInt(destination.id); buffer.writeInt(destination.id);
BufferUtils.writeString(buffer, character.getName()); // TODO can be if (actor instanceof L2Character) {
// char id! BufferUtils.writeString(buffer, ((L2Character) actor).getName());
BufferUtils.writeString(buffer, message); // TODO can be msg id } else {
buffer.writeInt(actor.getID().getID());
}
if (message != null) {
BufferUtils.writeString(buffer, message);
} else {
buffer.writeInt(messageID);
}
} }
} }

View File

@@ -0,0 +1,50 @@
/*
* 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.game.net.packet.server;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Connection;
import com.l2jserver.game.net.packet.AbstractServerPacket;
/**
* An packet informing that the character was created with success.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CharacterOpenMap extends AbstractServerPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0xa3;
/**
* The map ID
*/
private final int mapID;
public CharacterOpenMap(int mapID) {
super(OPCODE);
this.mapID = mapID;
}
@Override
public void write(Lineage2Connection conn, ChannelBuffer buffer) {
buffer.writeInt(mapID);
buffer.writeByte(0x00); // seven signs period
}
}

View File

@@ -19,6 +19,9 @@ package com.l2jserver.model.template;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
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.id.template.ItemTemplateID;
import com.l2jserver.model.template.capability.Depositable; import com.l2jserver.model.template.capability.Depositable;
import com.l2jserver.model.template.capability.Dropable; import com.l2jserver.model.template.capability.Dropable;
@@ -27,6 +30,8 @@ import com.l2jserver.model.template.capability.Sellable;
import com.l2jserver.model.template.capability.Tradable; import com.l2jserver.model.template.capability.Tradable;
import com.l2jserver.model.template.capability.Usable; import com.l2jserver.model.template.capability.Usable;
import com.l2jserver.model.world.Item; import com.l2jserver.model.world.Item;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.service.network.NetworkService;
/** /**
* Template for an {@link Item} * Template for an {@link Item}
@@ -40,6 +45,9 @@ public abstract class ItemTemplate extends AbstractTemplate<Item> {
private static final Logger log = LoggerFactory private static final Logger log = LoggerFactory
.getLogger(ItemTemplate.class); .getLogger(ItemTemplate.class);
@Inject
protected NetworkService networkService;
protected int weight = 0; protected int weight = 0;
protected int price = 0; protected int price = 0;
protected String icon; protected String icon;
@@ -68,6 +76,16 @@ public abstract class ItemTemplate extends AbstractTemplate<Item> {
return new Item(this.getID()); return new Item(this.getID());
} }
public final void use(Item item, L2Character character) {
final CharacterID id = character.getID();
final Lineage2Connection conn = networkService.discover(id);
this.use(item, character, conn);
}
protected void use(Item item, L2Character character, Lineage2Connection conn) {
conn.sendActionFailed();
}
public void stack(Item... object) { public void stack(Item... object) {
} }

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jserver.model.template; package com.l2jserver.model.template;
import com.google.common.base.Preconditions;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.l2jserver.game.net.Lineage2Connection; import com.l2jserver.game.net.Lineage2Connection;
import com.l2jserver.game.net.packet.server.NPCHtmlMessagePacket; import com.l2jserver.game.net.packet.server.NPCHtmlMessagePacket;
@@ -32,7 +33,6 @@ import com.l2jserver.service.network.NetworkService;
import com.l2jserver.util.calculator.Calculator; import com.l2jserver.util.calculator.Calculator;
import com.l2jserver.util.exception.L2Exception; import com.l2jserver.util.exception.L2Exception;
import com.l2jserver.util.html.markup.HtmlTemplate; import com.l2jserver.util.html.markup.HtmlTemplate;
import com.l2jserver.util.html.markup.MarkupTag;
/** /**
* Template for {@link NPC} * Template for {@link NPC}
@@ -106,6 +106,10 @@ public abstract class NPCTemplate extends ActorTemplate<NPC> {
*/ */
public void action(NPC npc, L2Character character, String... args) public void action(NPC npc, L2Character character, String... args)
throws L2Exception { throws L2Exception {
Preconditions.checkNotNull(npc, "npc");
Preconditions.checkNotNull(character, "character");
Preconditions.checkNotNull(args, "args");
final Lineage2Connection conn = networkService.discover(character final Lineage2Connection conn = networkService.discover(character
.getID()); .getID());
if (conn == null) if (conn == null)
@@ -119,17 +123,40 @@ public abstract class NPCTemplate extends ActorTemplate<NPC> {
return; return;
} }
// generate not implemented message if (args.length == 0 || args[0].equals("Chat"))
final HtmlTemplate template = new HtmlTemplate(name) { talk(npc, character, conn, args);
@Override }
public void build(MarkupTag body) {
body.text("The NPC ${name} is not yet implemented!", "ff0000") /**
.p().p(); * Talks with this NPC
body.addLink("Click me!", "test"); *
* @param npc
* the npc
* @param character
* the character
* @param conn
* the lineage 2 connection
* @param args
* the action arguments
* @throws L2Exception
*/
public 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 = "";
if (args.length == 2)
name = args[1];
final HtmlTemplate template = getChat(name);
if (template != null) {
template.register("npcid", npc.getID().getID());
conn.write(new NPCHtmlMessagePacket(npc, template));
} }
}; }
template.register("name", name); conn.sendActionFailed();
conn.write(new NPCHtmlMessagePacket(npc, template)); }
protected HtmlTemplate getChat(String name) throws L2Exception {
return null;
} }
/** /**

View File

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

View File

@@ -14,16 +14,19 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>. * along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.l2jserver.model.template.capability; package com.l2jserver.model.template.item;
import com.l2jserver.model.world.capability.Damagable; import com.l2jserver.model.id.template.ItemTemplateID;
import com.l2jserver.model.template.ItemTemplate;
import com.l2jserver.model.world.Item;
/** /**
* Indicates that an template has the ability to intercept incoming damage. * Template for general items {@link Item}
* *
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*
*/ */
public interface IncomingDamageIntercept extends TemplateCapability { public abstract class EtcItemTemplate extends ItemTemplate {
void interceptIncomingDamage(Damagable target); public EtcItemTemplate(ItemTemplateID id, String icon, ItemMaterial material) {
super(id, icon, material);
}
} }

View File

@@ -0,0 +1,51 @@
/*
* 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.item;
import com.l2jserver.game.net.Lineage2Connection;
import com.l2jserver.model.id.template.ItemTemplateID;
import com.l2jserver.model.id.template.SkillTemplateID;
import com.l2jserver.model.template.ItemTemplate;
import com.l2jserver.model.world.Item;
import com.l2jserver.model.world.L2Character;
/**
* Template for general items {@link Item}
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public abstract class SkillEtcItemTemplate extends ItemTemplate {
protected SkillTemplateID skill;
public SkillEtcItemTemplate(ItemTemplateID id, String icon,
ItemMaterial material, SkillTemplateID skill) {
super(id, icon, material);
}
@Override
protected void use(Item item, L2Character character, Lineage2Connection conn) {
super.use(item, character, conn);
}
/**
* @return the skill
*/
public SkillTemplateID getSkill() {
return skill;
}
}

View File

@@ -18,6 +18,9 @@ package com.l2jserver.model.template.npc;
import com.l2jserver.model.id.template.NPCTemplateID; import com.l2jserver.model.id.template.NPCTemplateID;
import com.l2jserver.model.template.NPCTemplate; import com.l2jserver.model.template.NPCTemplate;
import com.l2jserver.util.exception.L2Exception;
import com.l2jserver.util.html.markup.HtmlTemplate;
import com.l2jserver.util.html.markup.MarkupTag;
/** /**
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
@@ -35,4 +38,14 @@ public class MonsterNPCTemplate extends NPCTemplate {
protected MonsterNPCTemplate(NPCTemplateID id) { protected MonsterNPCTemplate(NPCTemplateID id) {
super(id); super(id);
} }
@Override
protected HtmlTemplate getChat(String name) throws L2Exception {
return new HtmlTemplate() {
@Override
protected void build(MarkupTag body) {
body.text("Sorry, but you can't interact with me yet.");
}
};
}
} }

View File

@@ -20,7 +20,6 @@ import java.util.List;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.l2jserver.game.net.Lineage2Connection; import com.l2jserver.game.net.Lineage2Connection;
import com.l2jserver.game.net.packet.server.NPCHtmlMessagePacket;
import com.l2jserver.model.id.template.NPCTemplateID; import com.l2jserver.model.id.template.NPCTemplateID;
import com.l2jserver.model.template.NPCTemplate; import com.l2jserver.model.template.NPCTemplate;
import com.l2jserver.model.world.L2Character; import com.l2jserver.model.world.L2Character;
@@ -100,40 +99,44 @@ public class TeleporterNPCTemplate extends NPCTemplate {
@Override @Override
public void action(NPC npc, L2Character character, String... args) public void action(NPC npc, L2Character character, String... args)
throws L2Exception { throws L2Exception {
talk(npc, character, args);
}
public void talk(NPC npc, L2Character character, String... args)
throws NotSpawnedServiceException {
final Lineage2Connection conn = networkService.discover(character final Lineage2Connection conn = networkService.discover(character
.getID()); .getID());
if (args.length == 0) { if (args.length >= 2 && args[0].equals("goto")) {
final HtmlTemplate template = new HtmlTemplate() { teleport(npc, character, conn, args[1]);
}
super.action(npc, character, args);
}
@Override
protected HtmlTemplate getChat(String name) throws L2Exception {
if (name.equals("") || name.equals("teleport")) {
return new HtmlTemplate() {
@Override @Override
protected void build(MarkupTag body) { protected void build(MarkupTag body) {
body.textcode(556).br().br(); body.textcode(556).br().br();
// TODO this should not be hard coded!
int i = 0; int i = 0;
for (final TeleportationMetadata location : locations) { for (final TeleportationMetadata location : locations) {
body.addLink( body.addLink(
location.name + " - " + location.price location.name + " - " + location.price
+ " Adena", + " Adena", "npc_${npcid}_goto " + i++)
"npc_${npcid}_teleport " + i++).br(); .br();
} }
} }
}; };
template.register("npcid", String.valueOf(npc.getID().getID()));
conn.write(new NPCHtmlMessagePacket(npc, template));
} else if (args[0].equals("teleport")) {
final int location = Integer.parseInt(args[1]);
final TeleportationMetadata metadata = locations.get(location);
if (metadata == null) {
conn.sendActionFailed();
return;
}
spawnService.teleport(character, metadata.point);
} }
conn.sendActionFailed(); return super.getChat(name);
}
protected void teleport(NPC npc, L2Character character,
Lineage2Connection conn, String name)
throws NotSpawnedServiceException {
final int location = Integer.parseInt(name);
final TeleportationMetadata metadata = locations.get(location);
if (metadata == null) {
conn.sendActionFailed();
return;
}
spawnService.teleport(character, metadata.point);
} }
protected void addLocation(String name, Coordinate coordinate, int price) { protected void addLocation(String name, Coordinate coordinate, int price) {

View File

@@ -125,12 +125,12 @@ public class L2Character extends Player {
*/ */
private ActorID<?> targetID; private ActorID<?> targetID;
/** /**
* State if the player is being teleported * State of the character. Will be null if it is idle
*/ */
private CharacterState state; private CharacterState state;
public enum CharacterState { public enum CharacterState {
TELEPORTING; TELEPORTING, CASTING, ATTACKING, MOVING;
} }
/** /**

View File

@@ -0,0 +1,70 @@
/*
* 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.id.ObjectID;
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;
/**
* Event triggered once a character starts running
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CharacterRunningEvent implements CharacterEvent {
/**
* The character that is logging in
*/
private final L2Character character;
/**
* Creates a new instance
*
* @param character
* the character
*/
public CharacterRunningEvent(L2Character character) {
this.character = character;
}
@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 ObjectID<?>[] getDispatchableObjects() {
return new ObjectID<?>[] { character.getID() };
}
}

View File

@@ -0,0 +1,70 @@
/*
* 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.id.ObjectID;
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;
/**
* Event triggered once a character starts walking
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CharacterWalkingEvent implements CharacterEvent {
/**
* The character that is logging in
*/
private final L2Character character;
/**
* Creates a new instance
*
* @param character
* the character
*/
public CharacterWalkingEvent(L2Character character) {
this.character = character;
}
@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 ObjectID<?>[] getDispatchableObjects() {
return new ObjectID<?>[] { character.getID() };
}
}

View File

@@ -23,7 +23,7 @@ import com.l2jserver.util.exception.L2Exception;
* *
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class ServiceException extends L2Exception { public abstract class ServiceException extends L2Exception {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public ServiceException() { public ServiceException() {

View File

@@ -0,0 +1,14 @@
package com.l2jserver.service.game.character;
import com.l2jserver.model.world.capability.Actor;
/**
* Exception thrown when the character is trying to attack an {@link Actor} that
* is not attackable
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class ActorIsNotAttackableServiceException extends
CharacterServiceException {
private static final long serialVersionUID = 1L;
}

View File

@@ -0,0 +1,11 @@
package com.l2jserver.service.game.character;
/**
* Exception thrown when the character is already running
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CharacterAlreadyRunningServiceException extends
CharacterServiceException {
private static final long serialVersionUID = 1L;
}

View File

@@ -0,0 +1,11 @@
package com.l2jserver.service.game.character;
/**
* Exception thrown when the character is already walking
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CharacterAlreadyWalkingServiceException extends
CharacterServiceException {
private static final long serialVersionUID = 1L;
}

View File

@@ -77,9 +77,12 @@ public interface CharacterService extends Service {
* the target * the target
* @throws CannotSetTargetServiceException * @throws CannotSetTargetServiceException
* if target cannot be set * if target cannot be set
* @throws ActorIsNotAttackableServiceException
* if the target is not attackable
*/ */
void attack(L2Character character, Actor target) void attack(L2Character character, Actor target)
throws CannotSetTargetServiceException; throws CannotSetTargetServiceException,
ActorIsNotAttackableServiceException;
/** /**
* Informs that an given <tt>character</tt> is appearing in the world. * Informs that an given <tt>character</tt> is appearing in the world.
@@ -152,14 +155,20 @@ public interface CharacterService extends Service {
* *
* @param character * @param character
* the character * the character
* @throws CharacterAlreadyWalkingServiceException
* if the character is already walking
*/ */
void walk(L2Character character); void walk(L2Character character)
throws CharacterAlreadyWalkingServiceException;
/** /**
* Set the character to run mode * Set the character to run mode
* *
* @param character * @param character
* the character * the character
* @throws CharacterAlreadyRunningServiceException
* if the character is already running
*/ */
void run(L2Character character); void run(L2Character character)
throws CharacterAlreadyRunningServiceException;
} }

View File

@@ -21,7 +21,6 @@ import com.google.inject.Inject;
import com.l2jserver.db.dao.ItemDAO; import com.l2jserver.db.dao.ItemDAO;
import com.l2jserver.game.net.Lineage2Connection; import com.l2jserver.game.net.Lineage2Connection;
import com.l2jserver.game.net.SystemMessage; import com.l2jserver.game.net.SystemMessage;
import com.l2jserver.game.net.packet.server.ActionFailedPacket;
import com.l2jserver.game.net.packet.server.ActorChatMessagePacket; import com.l2jserver.game.net.packet.server.ActorChatMessagePacket;
import com.l2jserver.game.net.packet.server.ActorMovementPacket; import com.l2jserver.game.net.packet.server.ActorMovementPacket;
import com.l2jserver.game.net.packet.server.CharacterInformationExtraPacket; import com.l2jserver.game.net.packet.server.CharacterInformationExtraPacket;
@@ -35,6 +34,7 @@ import com.l2jserver.model.id.object.CharacterID;
import com.l2jserver.model.template.NPCTemplate; import com.l2jserver.model.template.NPCTemplate;
import com.l2jserver.model.world.L2Character; import com.l2jserver.model.world.L2Character;
import com.l2jserver.model.world.L2Character.CharacterMoveType; import com.l2jserver.model.world.L2Character.CharacterMoveType;
import com.l2jserver.model.world.L2Character.CharacterState;
import com.l2jserver.model.world.NPC; import com.l2jserver.model.world.NPC;
import com.l2jserver.model.world.WorldObject; import com.l2jserver.model.world.WorldObject;
import com.l2jserver.model.world.capability.Actor; import com.l2jserver.model.world.capability.Actor;
@@ -44,8 +44,10 @@ import com.l2jserver.model.world.character.event.CharacterEvent;
import com.l2jserver.model.world.character.event.CharacterLeaveWorldEvent; import com.l2jserver.model.world.character.event.CharacterLeaveWorldEvent;
import com.l2jserver.model.world.character.event.CharacterListener; import com.l2jserver.model.world.character.event.CharacterListener;
import com.l2jserver.model.world.character.event.CharacterMoveEvent; import com.l2jserver.model.world.character.event.CharacterMoveEvent;
import com.l2jserver.model.world.character.event.CharacterRunningEvent;
import com.l2jserver.model.world.character.event.CharacterTargetDeselectedEvent; import com.l2jserver.model.world.character.event.CharacterTargetDeselectedEvent;
import com.l2jserver.model.world.character.event.CharacterTargetSelectedEvent; import com.l2jserver.model.world.character.event.CharacterTargetSelectedEvent;
import com.l2jserver.model.world.character.event.CharacterWalkingEvent;
import com.l2jserver.model.world.npc.event.NPCSpawnEvent; import com.l2jserver.model.world.npc.event.NPCSpawnEvent;
import com.l2jserver.model.world.player.event.PlayerTeleportedEvent; import com.l2jserver.model.world.player.event.PlayerTeleportedEvent;
import com.l2jserver.service.AbstractService; import com.l2jserver.service.AbstractService;
@@ -162,26 +164,25 @@ public class CharacterServiceImpl extends AbstractService implements
protected boolean dispatch(WorldEvent e, Positionable object) { protected boolean dispatch(WorldEvent e, Positionable object) {
if (e instanceof NPCSpawnEvent) { if (e instanceof NPCSpawnEvent) {
conn.write(new NPCInformationPacket((NPC) object)); conn.write(new NPCInformationPacket((NPC) object));
} else if (e instanceof CharacterEnterWorldEvent) {
// conn.write(packet)
// TODO char broadcast
} else if (e instanceof CharacterMoveEvent) { } else if (e instanceof CharacterMoveEvent) {
final CharacterMoveEvent evt = (CharacterMoveEvent) e; final CharacterMoveEvent evt = (CharacterMoveEvent) e;
if (object.equals(character)) if (object.equals(character))
return true; return true;
conn.write(new ActorMovementPacket((L2Character) object, conn.write(new ActorMovementPacket((L2Character) object,
evt.getPoint().getCoordinate())); evt.getPoint().getCoordinate()));
} else if (e instanceof PlayerTeleportedEvent) { } else if (e instanceof PlayerTeleportedEvent
|| e instanceof CharacterEnterWorldEvent) {
// TODO this should not be here! // TODO this should not be here!
System.out.println(((PlayerTeleportedEvent) e).getPoint()
.getCoordinate());
System.out.println(character.getPosition());
for (final WorldObject o : worldService for (final WorldObject o : worldService
.iterable(new KnownListFilter(character))) { .iterable(new KnownListFilter(character))) {
if (o instanceof NPC) { if (o instanceof NPC) {
conn.write(new NPCInformationPacket((NPC) o)); conn.write(new NPCInformationPacket((NPC) o));
} }
} }
} else if (e instanceof CharacterWalkingEvent
|| e instanceof CharacterRunningEvent) {
conn.write(new CharacterMovementTypePacket(
((CharacterWalkingEvent) e).getCharacter()));
} }
// keep listener alive // keep listener alive
return true; return true;
@@ -227,7 +228,11 @@ public class CharacterServiceImpl extends AbstractService implements
conn.sendMessage("Please note that many of the features are not yet implemented."); conn.sendMessage("Please note that many of the features are not yet implemented.");
// characters start in run mode // characters start in run mode
run(character); try {
run(character);
} catch (CharacterAlreadyRunningServiceException e1) {
// we can ignore this one
}
// broadcast knownlist -- trashy implementation // broadcast knownlist -- trashy implementation
// TODO should be moved to world service or a newly created broadcast // TODO should be moved to world service or a newly created broadcast
@@ -295,7 +300,7 @@ public class CharacterServiceImpl extends AbstractService implements
@Override @Override
public void attack(L2Character character, Actor target) public void attack(L2Character character, Actor target)
throws CannotSetTargetServiceException { throws CannotSetTargetServiceException, ActorIsNotAttackableServiceException {
Preconditions.checkNotNull(character, "character"); Preconditions.checkNotNull(character, "character");
Preconditions.checkNotNull(target, "target"); Preconditions.checkNotNull(target, "target");
final CharacterID id = character.getID(); final CharacterID id = character.getID();
@@ -305,8 +310,7 @@ public class CharacterServiceImpl extends AbstractService implements
final NPC npc = (NPC) target; final NPC npc = (NPC) target;
final NPCTemplate template = npc.getTemplate(); final NPCTemplate template = npc.getTemplate();
if (!template.isAttackable()) { if (!template.isAttackable()) {
conn.write(ActionFailedPacket.SHARED_INSTANCE); throw new ActorIsNotAttackableServiceException();
return;
} }
// first try to target this, if it is not already // first try to target this, if it is not already
target(character, target); target(character, target);
@@ -356,6 +360,8 @@ public class CharacterServiceImpl extends AbstractService implements
// we don't set the character coordinate here, this will be done by // we don't set the character coordinate here, this will be done by
// validation packets, sent by client // validation packets, sent by client
character.setState(CharacterState.MOVING);
// for now, let's just write the packet, we don't have much validation // for now, let's just write the packet, we don't have much validation
// to be done yet. With character validation packet, another packet of // to be done yet. With character validation packet, another packet of
// these will be broadcasted. // these will be broadcasted.
@@ -380,36 +386,39 @@ public class CharacterServiceImpl extends AbstractService implements
// validation just before teleport packet // validation just before teleport packet
return; return;
character.setPoint(point); character.setPoint(point);
character.setState(CharacterState.MOVING);
eventDispatcher.dispatch(new CharacterMoveEvent(character, point)); eventDispatcher.dispatch(new CharacterMoveEvent(character, point));
} }
@Override @Override
public void walk(L2Character character) { public void walk(L2Character character)
throws CharacterAlreadyWalkingServiceException {
Preconditions.checkNotNull(character, "character"); Preconditions.checkNotNull(character, "character");
final CharacterID id = character.getID(); final CharacterID id = character.getID();
final Lineage2Connection conn = networkService.discover(id); final Lineage2Connection conn = networkService.discover(id);
// test if character is running // test if character is running
if (character.getMoveType() == CharacterMoveType.RUN) { if (character.getMoveType() == CharacterMoveType.WALK)
// if running set mode to walk and broadcast packet throw new CharacterAlreadyWalkingServiceException();
character.setMoveType(CharacterMoveType.WALK); // if running set mode to walk and broadcast packet
conn.broadcast(new CharacterMovementTypePacket(character)); character.setMoveType(CharacterMoveType.WALK);
// TODO dispatch move change type event
} eventDispatcher.dispatch(new CharacterWalkingEvent(character));
// TODO we need to throw an exception if character is not running conn.write(new CharacterMovementTypePacket(character));
} }
@Override @Override
public void run(L2Character character) { public void run(L2Character character)
throws CharacterAlreadyRunningServiceException {
Preconditions.checkNotNull(character, "character"); Preconditions.checkNotNull(character, "character");
final CharacterID id = character.getID(); final CharacterID id = character.getID();
final Lineage2Connection conn = networkService.discover(id); final Lineage2Connection conn = networkService.discover(id);
// test if character is walking // test if character is walking
if (character.getMoveType() == CharacterMoveType.WALK) { if (character.getMoveType() == CharacterMoveType.RUN)
// if running walking mode to run and broadcast packet throw new CharacterAlreadyRunningServiceException();
character.setMoveType(CharacterMoveType.RUN); // if running walking mode to run and broadcast packet
conn.broadcast(new CharacterMovementTypePacket(character)); character.setMoveType(CharacterMoveType.RUN);
// TODO dispatch move change type event
} eventDispatcher.dispatch(new CharacterRunningEvent(character));
// TODO we need to throw an exception if character is not walking conn.write(new CharacterMovementTypePacket(character));
} }
} }

View File

@@ -21,7 +21,7 @@ package com.l2jserver.util.exception;
* *
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class L2Exception extends Exception { public abstract class L2Exception extends Exception {
/** /**
* Default Serial Version UID * Default Serial Version UID
*/ */
@@ -54,4 +54,15 @@ public class L2Exception extends Exception {
public L2Exception(Throwable cause) { public L2Exception(Throwable cause) {
super(cause); super(cause);
} }
// /**
// * Each {@link L2Exception} has an {@link SystemMessage} attacked to it.
// It
// * is an <b><u>recommendation</u></b> of which message should be sent to
// the
// * client in case the exception is thrown.
// *
// * @return the recommended system message
// */
// public abstract SystemMessage getSystemMessage();
} }

View File

@@ -116,6 +116,18 @@ public abstract class HtmlTemplate {
public void register(String name, String value) { public void register(String name, String value) {
variables.put(name, value); variables.put(name, value);
} }
/**
* Register an variable for this template
*
* @param name
* the name
* @param value
* the value
*/
public void register(String name, int value) {
variables.put(name, Integer.toString(value));
}
/** /**
* Creates a new {@link Html} object using the {@link HtmlTemplate} provided * Creates a new {@link Html} object using the {@link HtmlTemplate} provided