diff --git a/data/script/template/script/template/actor/npc/RoxxyGatekeeperTemplate.java b/data/script/template/script/template/actor/npc/RoxxyGatekeeperTemplate.java new file mode 100644 index 000000000..8dc2cd586 --- /dev/null +++ b/data/script/template/script/template/actor/npc/RoxxyGatekeeperTemplate.java @@ -0,0 +1,53 @@ +/* + * This file is part of l2jserver . + * + * 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 . + */ +package script.template.actor.npc; + +import com.google.inject.Inject; +import com.l2jserver.model.id.template.provider.NPCTemplateIDProvider; +import com.l2jserver.model.template.npc.TeleporterNPCTemplate; + +/** + * @author Rogiel + */ +public class RoxxyGatekeeperTemplate extends TeleporterNPCTemplate { + public static final int ID = 30006; + + @Inject + protected RoxxyGatekeeperTemplate(NPCTemplateIDProvider provider) { + super(provider.createID(ID)); + this.name = "Roxxy"; + this.title = "Gatekeeper"; + this.attackable = true; + this.maxHp = 200; + + this.collisionRadius = 8.00; + this.collisionHeight = 25.00; + + addLocation("The Village of Gludin", GLUDIN, 18000); + addLocation("Dark Elven Village", DARK_ELF_VILLAGE, 24000); + addLocation("Dwarven Village", DWARVEN_VILLAGE, 46000); + addLocation("Elven Village", ELVEN_VILLAGE, 2300); + addLocation("Orc Village", ORC_VILLAGE, 35000); + addLocation("Kamael Village", KAMAEL_VILLAGE, 20000); + addLocation("Elven Ruins", ELVEN_RUINS, 830); + addLocation("Singing Waterfall", SINGING_WATERFALL, 770); + addLocation("Talking Island, Northern Territor", + TALKING_ISLAND_NORTHERN_TERRITORY, 1000); + addLocation("Obelisk of Victory", OBELISK_OF_VICTORY, 470); + + } +} diff --git a/data/script/template/script/template/actor/npc/TamilGatekeeperTemplate.java b/data/script/template/script/template/actor/npc/TamilGatekeeperTemplate.java new file mode 100644 index 000000000..8fe4fdc05 --- /dev/null +++ b/data/script/template/script/template/actor/npc/TamilGatekeeperTemplate.java @@ -0,0 +1,54 @@ +/* + * This file is part of l2jserver . + * + * 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 . + */ +package script.template.actor.npc; + +import com.google.inject.Inject; +import com.l2jserver.model.id.template.provider.NPCTemplateIDProvider; +import com.l2jserver.model.template.npc.TeleporterNPCTemplate; + +/** + * @author Rogiel + */ +public class TamilGatekeeperTemplate extends TeleporterNPCTemplate { + public static final int ID = 30576; + + @Inject + protected TamilGatekeeperTemplate(NPCTemplateIDProvider provider) { + super(provider.createID(ID)); + this.name = "Tamil"; + this.title = "Gatekeeper"; + this.attackable = true; + this.maxHp = 200; + + this.collisionRadius = 8.00; + this.collisionHeight = 32.00; + + addLocation("The Town of Gludio", GLUDIO, 23000); + addLocation("Town of Schuttgart", SCHUTTGART, 13000); + addLocation("Dark Elven Village", DARK_ELF_VILLAGE, 13000); + addLocation("Dwarven Village", DWARVEN_VILLAGE, 17000); + addLocation("Talking Island Village", TALKING_ISLAND_VILLAGE, 35000); + addLocation("Elven Village", ELVEN_VILLAGE, 18000); + addLocation("Kamael Village", KAMAEL_VILLAGE, 17000); + addLocation("Immortal Plateau, Southern Region", + IMMORTAL_PLATEAU_SOUTHERN_REGION, 2000); + addLocation("The Immortal Plateau", IMMORTAL_PLATEAU, 960); + addLocation("Cave of Trials", CAVE_OF_TRIALS, 1500); + addLocation("Frozen Waterfall", FROZEN_WATERFALL, 1600); + + } +} diff --git a/src/main/java/com/l2jserver/L2JGameServerMain.java b/src/main/java/com/l2jserver/L2JGameServerMain.java index e487817c4..b4826a943 100644 --- a/src/main/java/com/l2jserver/L2JGameServerMain.java +++ b/src/main/java/com/l2jserver/L2JGameServerMain.java @@ -99,5 +99,19 @@ public class L2JGameServerMain { npc.setPoint(Point.fromXYZ(-71301, 258259, -3134)); spawnService.spawn(npc, null); + + // close spawn gatekepper + final NPCTemplateID gid = templateProvider.createID(30006); + final NPC gatekeeper = gid.getTemplate().create(); + gatekeeper.setID(provider.createID()); + gatekeeper.setPoint(Point.fromXYZ(-71301, 258559, -3134)); + spawnService.spawn(gatekeeper, null); + + // spawn tamil - orc village + final NPCTemplateID tamilId = templateProvider.createID(30576); + final NPC tamil = tamilId.getTemplate().create(); + tamil.setID(provider.createID()); + tamil.setPoint(Point.fromXYZ(-45264, -112512, -240)); + spawnService.spawn(tamil, null); } } diff --git a/src/main/java/com/l2jserver/game/net/codec/Lineage2PacketReader.java b/src/main/java/com/l2jserver/game/net/codec/Lineage2PacketReader.java index 92350270e..780944def 100644 --- a/src/main/java/com/l2jserver/game/net/codec/Lineage2PacketReader.java +++ b/src/main/java/com/l2jserver/game/net/codec/Lineage2PacketReader.java @@ -27,10 +27,14 @@ import com.google.inject.Inject; import com.google.inject.Injector; import com.l2jserver.game.net.Lineage2Connection; import com.l2jserver.game.net.packet.ClientPacket; +import com.l2jserver.game.net.packet.client.AdminCommandPacket; import com.l2jserver.game.net.packet.client.AuthLoginPacket; import com.l2jserver.game.net.packet.client.CharacterActionPacket; +import com.l2jserver.game.net.packet.client.CharacterAppearingPacket; import com.l2jserver.game.net.packet.client.CharacterChatMessagePacket; import com.l2jserver.game.net.packet.client.CharacterCreatePacket; +import com.l2jserver.game.net.packet.client.CharacterRequestActionUse; +import com.l2jserver.game.net.packet.client.CharacterRequestBypass; import com.l2jserver.game.net.packet.client.CharacterRequestInventoryPacket; import com.l2jserver.game.net.packet.client.CharacterRequestMovePacket; import com.l2jserver.game.net.packet.client.CharacterSelectPacket; @@ -166,6 +170,14 @@ public class Lineage2PacketReader extends OneToOneDecoder { return CharacterActionPacket.class; case CharacterRequestInventoryPacket.OPCODE: return CharacterRequestInventoryPacket.class; + case AdminCommandPacket.OPCODE: + return AdminCommandPacket.class; + case CharacterRequestBypass.OPCODE: + return CharacterRequestBypass.class; + case CharacterAppearingPacket.OPCODE: + return CharacterAppearingPacket.class; + case CharacterRequestActionUse.OPCODE: + return CharacterRequestActionUse.class; default: logger.warn("Unknown opcode: 0x{}", Integer.toHexString(opcode)); break; diff --git a/src/main/java/com/l2jserver/game/net/packet/client/AdminCommandPacket.java b/src/main/java/com/l2jserver/game/net/packet/client/AdminCommandPacket.java new file mode 100644 index 000000000..d3812b5fc --- /dev/null +++ b/src/main/java/com/l2jserver/game/net/packet/client/AdminCommandPacket.java @@ -0,0 +1,84 @@ +/* + * This file is part of l2jserver . + * + * 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 . + */ +package com.l2jserver.game.net.packet.client; + +import java.util.StringTokenizer; + +import org.jboss.netty.buffer.ChannelBuffer; + +import com.google.inject.Inject; +import com.l2jserver.game.net.Lineage2Connection; +import com.l2jserver.game.net.packet.AbstractClientPacket; +import com.l2jserver.service.admin.AdministratorService; +import com.l2jserver.service.game.spawn.NotSpawnedServiceException; +import com.l2jserver.service.game.spawn.SpawnService; +import com.l2jserver.util.BufferUtils; +import com.l2jserver.util.dimensional.Coordinate; + +/** + * Executes an administrator action + * + * @author Rogiel + */ +public class AdminCommandPacket extends AbstractClientPacket { + /** + * The packet OPCODE + */ + public static final int OPCODE = 0x74; + + /** + * The admin service + */ + private final AdministratorService adminService; + private final SpawnService spawnService; + + /** + * The command + */ + private String command; + + @Inject + public AdminCommandPacket(AdministratorService adminService, + SpawnService spawnService) { + this.adminService = adminService; + this.spawnService = spawnService; + } + + @Override + public void read(Lineage2Connection conn, ChannelBuffer buffer) { + command = BufferUtils.readString(buffer).trim(); + } + + @Override + public void process(final Lineage2Connection conn) { + final StringTokenizer tokenizer = new StringTokenizer(command, " "); + final String cmd = tokenizer.nextToken(); + if (cmd.equals("tele")) { + Coordinate coord = Coordinate.fromXYZ( + Integer.parseInt(tokenizer.nextToken()), + Integer.parseInt(tokenizer.nextToken()), + Integer.parseInt(tokenizer.nextToken())); + try { + spawnService.teleport(conn.getCharacter(), coord); + } catch (NotSpawnedServiceException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + // TODO implement admin commands + } +} diff --git a/src/main/java/com/l2jserver/game/net/packet/client/CharacterAppearingPacket.java b/src/main/java/com/l2jserver/game/net/packet/client/CharacterAppearingPacket.java new file mode 100644 index 000000000..ac0d63743 --- /dev/null +++ b/src/main/java/com/l2jserver/game/net/packet/client/CharacterAppearingPacket.java @@ -0,0 +1,56 @@ +/* + * This file is part of l2jserver . + * + * 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 . + */ +package com.l2jserver.game.net.packet.client; + +import org.jboss.netty.buffer.ChannelBuffer; + +import com.google.inject.Inject; +import com.l2jserver.game.net.Lineage2Connection; +import com.l2jserver.game.net.packet.AbstractClientPacket; +import com.l2jserver.service.game.character.CharacterService; + +/** + * Completes the creation of an character. Creates the object, inserts into the + * database and notifies the client about the status of the operation. + * + * @author Rogiel + */ +public class CharacterAppearingPacket extends AbstractClientPacket { + /** + * The packet OPCODE + */ + public static final int OPCODE = 0x3a; + + /** + * The {@link CharacterService} + */ + private final CharacterService charService; + + @Inject + public CharacterAppearingPacket(CharacterService charService) { + this.charService = charService; + } + + @Override + public void read(Lineage2Connection conn, ChannelBuffer buffer) { + } + + @Override + public void process(final Lineage2Connection conn) { + charService.appearing(conn.getCharacter()); + } +} diff --git a/src/main/java/com/l2jserver/game/net/packet/client/CharacterRequestBypass.java b/src/main/java/com/l2jserver/game/net/packet/client/CharacterRequestBypass.java new file mode 100644 index 000000000..3e076b91a --- /dev/null +++ b/src/main/java/com/l2jserver/game/net/packet/client/CharacterRequestBypass.java @@ -0,0 +1,103 @@ +/* + * This file is part of l2jserver . + * + * 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 . + */ +package com.l2jserver.game.net.packet.client; + +import java.util.StringTokenizer; + +import org.jboss.netty.buffer.ChannelBuffer; + +import com.google.inject.Inject; +import com.l2jserver.game.net.Lineage2Connection; +import com.l2jserver.game.net.packet.AbstractClientPacket; +import com.l2jserver.model.id.ObjectID; +import com.l2jserver.model.id.object.NPCID; +import com.l2jserver.model.id.object.provider.ObjectIDResolver; +import com.l2jserver.model.world.NPC; +import com.l2jserver.service.game.npc.ActionServiceException; +import com.l2jserver.service.game.npc.NPCService; +import com.l2jserver.util.BufferUtils; + +/** + * Executes an bypass command + * + * @author Rogiel + */ +public class CharacterRequestBypass extends AbstractClientPacket { + /** + * The packet OPCODE + */ + public static final int OPCODE = 0x23; + + /** + * The {@link ObjectID} resolver + */ + private final ObjectIDResolver idResolver; + /** + * The {@link NPC} service + */ + private final NPCService npcService; + + /** + * The bypass command + */ + private String command; + + @Inject + public CharacterRequestBypass(ObjectIDResolver idResolver, + NPCService npcService) { + this.idResolver = idResolver; + this.npcService = npcService; + } + + @Override + public void read(Lineage2Connection conn, ChannelBuffer buffer) { + this.command = BufferUtils.readString(buffer); + } + + @Override + public void process(final Lineage2Connection conn) { + // parse command + final StringTokenizer tokenizer = new StringTokenizer(command, "_ "); + final String type = tokenizer.nextToken(); + if (type.equals("npc")) { + final int objectId = Integer.parseInt(tokenizer.nextToken()); + final ObjectID id = idResolver.resolve(objectId); + if (!(id instanceof NPCID)) { + conn.sendActionFailed(); + return; + } + final NPC npc = id.getObject(); + try { + npcService.action(npc, conn.getCharacter(), + createArgumentArray(tokenizer)); + } catch (ActionServiceException e) { + conn.sendActionFailed(); + } + } + } + + private String[] createArgumentArray(StringTokenizer tokenizer) { + if (!tokenizer.hasMoreTokens()) + return new String[0]; + final String[] args = new String[tokenizer.countTokens()]; + int i = 0; + while (tokenizer.hasMoreTokens()) { + args[i++] = tokenizer.nextToken(); + } + return args; + } +} diff --git a/src/main/java/com/l2jserver/game/net/packet/server/CharacterInformationExtraPacket.java b/src/main/java/com/l2jserver/game/net/packet/server/CharacterInformationExtraPacket.java new file mode 100644 index 000000000..567545f2d --- /dev/null +++ b/src/main/java/com/l2jserver/game/net/packet/server/CharacterInformationExtraPacket.java @@ -0,0 +1,52 @@ +/* + * This file is part of l2jserver . + * + * 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 . + */ +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; +import com.l2jserver.model.world.L2Character; + +/** + * This is an message informing the client of extra informations from a player + * + * @author Rogiel + */ +public class CharacterInformationExtraPacket extends AbstractServerPacket { + /** + * The packet OPCODE + */ + public static final int OPCODE = 0xfe; + + /** + * The character + */ + private L2Character character; + + public CharacterInformationExtraPacket(L2Character character) { + super(OPCODE); + this.character = character; + } + + @Override + public void write(Lineage2Connection conn, ChannelBuffer buffer) { + buffer.writeShort(0xcf); // opcode2 + buffer.writeInt(character.getID().getID()); // object ID of Player + buffer.writeInt(0x00); // event effect id + } +} diff --git a/src/main/java/com/l2jserver/game/net/packet/server/CharacterInformationPacket.java b/src/main/java/com/l2jserver/game/net/packet/server/CharacterInformationPacket.java index 657a228a4..ea267148e 100644 --- a/src/main/java/com/l2jserver/game/net/packet/server/CharacterInformationPacket.java +++ b/src/main/java/com/l2jserver/game/net/packet/server/CharacterInformationPacket.java @@ -239,7 +239,7 @@ public class CharacterInformationPacket extends AbstractServerPacket { buffer.writeInt(character.getAppearance().getHairStyle().option); buffer.writeInt(character.getAppearance().getHairColor().option); buffer.writeInt(character.getAppearance().getFace().option); - buffer.writeInt(0x00); // is gm + buffer.writeInt(0x01); // is gm String title = "Testing"; // title BufferUtils.writeString(buffer, title); diff --git a/src/main/java/com/l2jserver/model/template/NPCTemplate.java b/src/main/java/com/l2jserver/model/template/NPCTemplate.java index 8aa668896..fd94853de 100644 --- a/src/main/java/com/l2jserver/model/template/NPCTemplate.java +++ b/src/main/java/com/l2jserver/model/template/NPCTemplate.java @@ -18,7 +18,6 @@ package com.l2jserver.model.template; import com.google.inject.Inject; import com.l2jserver.game.net.Lineage2Connection; -import com.l2jserver.game.net.packet.client.CharacterActionPacket.CharacterAction; import com.l2jserver.game.net.packet.server.NPCHtmlMessagePacket; import com.l2jserver.model.id.template.ItemTemplateID; import com.l2jserver.model.id.template.NPCTemplateID; @@ -100,12 +99,12 @@ public abstract class NPCTemplate extends ActorTemplate { * * @param character * the interacting character - * @param action - * the action performed + * @param args + * the action arguments * @throws L2Exception * any {@link L2Exception} */ - public void action(NPC npc, L2Character character, CharacterAction action) + public void action(NPC npc, L2Character character, String... args) throws L2Exception { final Lineage2Connection conn = networkService.discover(character .getID()); diff --git a/src/main/java/com/l2jserver/model/template/npc/TeleporterNPCTemplate.java b/src/main/java/com/l2jserver/model/template/npc/TeleporterNPCTemplate.java index 7fda0a0fb..65d1f3cd2 100644 --- a/src/main/java/com/l2jserver/model/template/npc/TeleporterNPCTemplate.java +++ b/src/main/java/com/l2jserver/model/template/npc/TeleporterNPCTemplate.java @@ -16,23 +16,139 @@ */ package com.l2jserver.model.template.npc; +import java.util.List; + +import com.google.inject.Inject; +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.template.NPCTemplate; +import com.l2jserver.model.world.L2Character; +import com.l2jserver.model.world.NPC; +import com.l2jserver.service.game.spawn.NotSpawnedServiceException; +import com.l2jserver.service.game.spawn.SpawnService; +import com.l2jserver.util.dimensional.Coordinate; +import com.l2jserver.util.exception.L2Exception; +import com.l2jserver.util.factory.CollectionFactory; +import com.l2jserver.util.html.markup.HtmlTemplate; +import com.l2jserver.util.html.markup.MarkupTag; /** * @author Rogiel * */ public class TeleporterNPCTemplate extends NPCTemplate { + // TOWNS + public static final Coordinate GLUDIN = Coordinate.fromXYZ(-80684, 149770, + -3040); + public static final Coordinate GLUDIO = Coordinate.fromXYZ(-12787, 122779, + -3112); + public static final Coordinate SCHUTTGART = Coordinate.fromXYZ(87126, + -143520, -1288); + + // VILLAGES + public static final Coordinate DARK_ELF_VILLAGE = Coordinate.fromXYZ(9709, + 15566, -4568); + public static final Coordinate DWARVEN_VILLAGE = Coordinate.fromXYZ(115120, + -178224, -880); + public static final Coordinate ELVEN_VILLAGE = Coordinate.fromXYZ(46951, + 51550, -2976); + public static final Coordinate ORC_VILLAGE = Coordinate.fromXYZ(-45158, + -112583, -240); + public static final Coordinate KAMAEL_VILLAGE = Coordinate.fromXYZ(-117251, + 46771, 360); + public static final Coordinate TALKING_ISLAND_VILLAGE = Coordinate.fromXYZ( + -84141, 244623, -3728); + public static final Coordinate TALKING_ISLAND_NORTHERN_TERRITORY = Coordinate + .fromXYZ(-106696, 214691, -3424); + + // TERRITORIES + public static final Coordinate ELVEN_RUINS = Coordinate.fromXYZ(-112367, + 234703, -3688); + public static final Coordinate SINGING_WATERFALL = Coordinate.fromXYZ( + -111728, 244330, -3448); + public static final Coordinate OBELISK_OF_VICTORY = Coordinate.fromXYZ( + -99586, 237637, -3568); + public static final Coordinate IMMORTAL_PLATEAU = Coordinate.fromXYZ( + -10983, -117484, -2464); + public static final Coordinate IMMORTAL_PLATEAU_SOUTHERN_REGION = Coordinate + .fromXYZ(-4190, -80040, -2696); + public static final Coordinate FROZEN_WATERFALL = Coordinate.fromXYZ(8652, + -139941, -1144); + public static final Coordinate CAVE_OF_TRIALS = Coordinate.fromXYZ(9340, + -112509, -2536); + + @Inject + protected SpawnService spawnService; + + /** + * The list of all possible teleportation locations + */ + protected final List locations = CollectionFactory + .newList(); + /** * Creates a new instance of this template * * @param id * the template id - * @param race - * the npc race */ protected TeleporterNPCTemplate(NPCTemplateID id) { super(id); } + + @Override + public void action(NPC npc, L2Character character, String... args) + throws L2Exception { + talk(npc, character, args); + } + + public void talk(NPC npc, L2Character character, String... args) + throws NotSpawnedServiceException { + final Lineage2Connection conn = networkService.discover(character + .getID()); + if (args.length == 0) { + final HtmlTemplate template = new HtmlTemplate() { + @Override + protected void build(MarkupTag body) { + body.textcode(556).br().br(); + // TODO this should not be hard coded! + int i = 0; + for (final TeleportationMetadata location : locations) { + body.addLink( + location.name + " - " + location.price + + " Adena", + "npc_${npcid}_teleport " + i++).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(); + } + + protected void addLocation(String name, Coordinate coordinate, int price) { + this.locations.add(new TeleportationMetadata(name, coordinate, price)); + } + + protected static class TeleportationMetadata { + public final String name; + public final Coordinate point; + public final int price; + + public TeleportationMetadata(String name, Coordinate point, int price) { + this.name = name; + this.point = point; + this.price = price; + } + } } diff --git a/src/main/java/com/l2jserver/model/world/L2Character.java b/src/main/java/com/l2jserver/model/world/L2Character.java index 7d2feb0eb..21866314d 100644 --- a/src/main/java/com/l2jserver/model/world/L2Character.java +++ b/src/main/java/com/l2jserver/model/world/L2Character.java @@ -98,17 +98,12 @@ public class L2Character extends Player { // //////////////////////////////////// // / RUNTIME // //////////////////////////////////// - /** * The character walk mode. *

* This field is not persisted. */ private CharacterMoveType moveType = CharacterMoveType.WALK; - /** - * The character target, if any. - */ - private ActorID targetID; /** * The character walking mode @@ -125,6 +120,19 @@ public class L2Character extends Player { } } + /** + * The character target, if any. + */ + private ActorID targetID; + /** + * State if the player is being teleported + */ + private CharacterState state; + + public enum CharacterState { + TELEPORTING; + } + /** * Creates a new instance * @@ -298,6 +306,28 @@ public class L2Character extends Player { this.targetID = target; } + /** + * @return the state + */ + public CharacterState getState() { + return state; + } + + /** + * @param state + * the state to set + */ + public void setState(CharacterState state) { + this.state = state; + } + + /** + * @return true if character is being teleported + */ + public boolean isTeleporting() { + return state == CharacterState.TELEPORTING; + } + /** * @return the inventory */ diff --git a/src/main/java/com/l2jserver/model/world/character/event/CharacterMoveEvent.java b/src/main/java/com/l2jserver/model/world/character/event/CharacterMoveEvent.java index 3cabe6788..2e7be5de6 100644 --- a/src/main/java/com/l2jserver/model/world/character/event/CharacterMoveEvent.java +++ b/src/main/java/com/l2jserver/model/world/character/event/CharacterMoveEvent.java @@ -52,7 +52,7 @@ public class CharacterMoveEvent implements CharacterEvent { } /** - * @return the point + * @return the new point */ public Point getPoint() { return point; diff --git a/src/main/java/com/l2jserver/model/world/player/event/PlayerTeleportEvent.java b/src/main/java/com/l2jserver/model/world/player/event/PlayerTeleportedEvent.java similarity index 83% rename from src/main/java/com/l2jserver/model/world/player/event/PlayerTeleportEvent.java rename to src/main/java/com/l2jserver/model/world/player/event/PlayerTeleportedEvent.java index e21bdd7b2..b272aae22 100644 --- a/src/main/java/com/l2jserver/model/world/player/event/PlayerTeleportEvent.java +++ b/src/main/java/com/l2jserver/model/world/player/event/PlayerTeleportedEvent.java @@ -20,11 +20,12 @@ import com.l2jserver.model.world.Player; import com.l2jserver.util.dimensional.Point; /** - * Event dispatched once an player is teleported to another location + * Event dispatched once an player has completed its teleportation to another + * location * * @author Rogiel */ -public class PlayerTeleportEvent extends PlayerSpawnEvent { +public class PlayerTeleportedEvent extends PlayerSpawnEvent { /** * Creates a new instance * @@ -33,7 +34,7 @@ public class PlayerTeleportEvent extends PlayerSpawnEvent { * @param point * the teleport point */ - public PlayerTeleportEvent(Player player, Point point) { + public PlayerTeleportedEvent(Player player, Point point) { super(player, point); } } diff --git a/src/main/java/com/l2jserver/model/world/player/event/PlayerTeleportingEvent.java b/src/main/java/com/l2jserver/model/world/player/event/PlayerTeleportingEvent.java new file mode 100644 index 000000000..912147c37 --- /dev/null +++ b/src/main/java/com/l2jserver/model/world/player/event/PlayerTeleportingEvent.java @@ -0,0 +1,76 @@ +/* + * This file is part of l2jserver . + * + * 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 . + */ +package com.l2jserver.model.world.player.event; + +import com.l2jserver.model.id.ObjectID; +import com.l2jserver.model.world.Player; +import com.l2jserver.model.world.WorldObject; +import com.l2jserver.model.world.capability.Actor; +import com.l2jserver.util.dimensional.Point; + +/** + * Event dispatched once an player has started his teleported to another + * location + * + * @author Rogiel + */ +public class PlayerTeleportingEvent implements PlayerEvent { + private final Player player; + private final Point point; + + /** + * Creates a new instance + * + * @param player + * the teleported player + * @param point + * the teleport point + */ + public PlayerTeleportingEvent(Player player, Point point) { + this.player = player; + this.point = point; + } + + @Override + public Actor getActor() { + return player; + } + + @Override + public WorldObject getObject() { + return player; + } + + @Override + public Player getPlayer() { + return player; + } + + /** + * The point to which this player was teleported. + * + * @return the teleported point + */ + public Point getPoint() { + return point; + } + + @Override + public ObjectID[] getDispatchableObjects() { + return new ObjectID[] { player.getID() }; + } +} diff --git a/src/main/java/com/l2jserver/service/admin/AdministratorService.java b/src/main/java/com/l2jserver/service/admin/AdministratorService.java new file mode 100644 index 000000000..7a5cebc52 --- /dev/null +++ b/src/main/java/com/l2jserver/service/admin/AdministratorService.java @@ -0,0 +1,48 @@ +/* + * This file is part of l2jserver . + * + * 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 . + */ +package com.l2jserver.service.admin; + +import com.l2jserver.model.world.L2Character; +import com.l2jserver.service.Service; + +/** + * This service handles administrators in the server + * + * @author Rogiel + */ +public interface AdministratorService extends Service { + /** + * Executes an command + * + * @param character + * the admin character + * @param command + * the command + * @param args + * the arguments + */ + void command(L2Character character, String command, String... args); + + /** + * The base interface for Administrator commands + * + * @author Rogiel + */ + public interface AdministratorCommand { + void administrator(L2Character character, String... args); + } +} diff --git a/src/main/java/com/l2jserver/service/admin/AdminService.java b/src/main/java/com/l2jserver/service/admin/AdministratorServiceImpl.java similarity index 69% rename from src/main/java/com/l2jserver/service/admin/AdminService.java rename to src/main/java/com/l2jserver/service/admin/AdministratorServiceImpl.java index cdbeb2ecd..a3e916976 100644 --- a/src/main/java/com/l2jserver/service/admin/AdminService.java +++ b/src/main/java/com/l2jserver/service/admin/AdministratorServiceImpl.java @@ -16,13 +16,21 @@ */ package com.l2jserver.service.admin; -import com.l2jserver.service.Service; +import com.l2jserver.model.world.L2Character; +import com.l2jserver.service.AbstractService; /** - * This service handles administrators in the server - * * @author Rogiel + * */ -public interface AdminService extends Service { - +public class AdministratorServiceImpl extends AbstractService implements + AdministratorService { + @Override + public void command(L2Character character, String command, String... args) { + if(command.equals("log")) { + if(args.length == 2) { + + } + } + } } diff --git a/src/main/java/com/l2jserver/service/admin/GMService.java b/src/main/java/com/l2jserver/service/admin/GMService.java index 00673b43e..73e0f5a4a 100644 --- a/src/main/java/com/l2jserver/service/admin/GMService.java +++ b/src/main/java/com/l2jserver/service/admin/GMService.java @@ -16,6 +16,7 @@ */ package com.l2jserver.service.admin; +import com.l2jserver.model.world.L2Character; import com.l2jserver.service.Service; /** @@ -24,5 +25,9 @@ import com.l2jserver.service.Service; * @author Rogiel */ public interface GMService extends Service { + void command(L2Character character, String command, String... args); + public interface GMCommand { + void gm(L2Character character, String... args); + } } diff --git a/src/main/java/com/l2jserver/service/core/Log4JLoggingService.java b/src/main/java/com/l2jserver/service/core/Log4JLoggingService.java index 5e2cfbe37..8f5c75f0c 100644 --- a/src/main/java/com/l2jserver/service/core/Log4JLoggingService.java +++ b/src/main/java/com/l2jserver/service/core/Log4JLoggingService.java @@ -37,6 +37,7 @@ public class Log4JLoggingService extends AbstractService implements private Logger rootLogger; private Logger l2jLogger; private Logger scriptLogger; + private Logger nettyLogger; @Override protected void doStart() throws ServiceStartException { @@ -47,6 +48,7 @@ public class Log4JLoggingService extends AbstractService implements rootLogger = Logger.getRootLogger(); l2jLogger = Logger.getLogger("com.l2jserver"); scriptLogger = Logger.getLogger("script"); + nettyLogger = Logger.getLogger("org.jboss.netty"); rootLogger.removeAllAppenders(); rootLogger.setLevel(Level.WARN); @@ -54,6 +56,7 @@ public class Log4JLoggingService extends AbstractService implements l2jLogger.setLevel(Level.DEBUG); scriptLogger.setLevel(Level.DEBUG); + nettyLogger.setLevel(Level.DEBUG); } @Override diff --git a/src/main/java/com/l2jserver/service/game/character/CharacterService.java b/src/main/java/com/l2jserver/service/game/character/CharacterService.java index b8778574c..2efb439c1 100644 --- a/src/main/java/com/l2jserver/service/game/character/CharacterService.java +++ b/src/main/java/com/l2jserver/service/game/character/CharacterService.java @@ -81,6 +81,16 @@ public interface CharacterService extends Service { void attack(L2Character character, Actor target) throws CannotSetTargetServiceException; + /** + * Informs that an given character is appearing in the world. + *

+ * This is normally called after an teleport. + * + * @param character + * the character + */ + void appearing(L2Character character); + /** * Jails the given character for time seconds. * diff --git a/src/main/java/com/l2jserver/service/game/character/CharacterServiceImpl.java b/src/main/java/com/l2jserver/service/game/character/CharacterServiceImpl.java index 0f7e03985..04a9824ba 100644 --- a/src/main/java/com/l2jserver/service/game/character/CharacterServiceImpl.java +++ b/src/main/java/com/l2jserver/service/game/character/CharacterServiceImpl.java @@ -24,6 +24,7 @@ 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.ActorMovementPacket; +import com.l2jserver.game.net.packet.server.CharacterInformationExtraPacket; import com.l2jserver.game.net.packet.server.CharacterInformationPacket; import com.l2jserver.game.net.packet.server.CharacterInventoryPacket; import com.l2jserver.game.net.packet.server.CharacterMovementTypePacket; @@ -46,6 +47,7 @@ import com.l2jserver.model.world.character.event.CharacterMoveEvent; import com.l2jserver.model.world.character.event.CharacterTargetDeselectedEvent; import com.l2jserver.model.world.character.event.CharacterTargetSelectedEvent; import com.l2jserver.model.world.npc.event.NPCSpawnEvent; +import com.l2jserver.model.world.player.event.PlayerTeleportedEvent; import com.l2jserver.service.AbstractService; import com.l2jserver.service.AbstractService.Depends; import com.l2jserver.service.game.chat.ChatMessageDestination; @@ -165,8 +167,21 @@ public class CharacterServiceImpl extends AbstractService implements // TODO char broadcast } else if (e instanceof CharacterMoveEvent) { final CharacterMoveEvent evt = (CharacterMoveEvent) e; + if (object.equals(character)) + return true; conn.write(new ActorMovementPacket((L2Character) object, evt.getPoint().getCoordinate())); + } else if (e instanceof PlayerTeleportedEvent) { + // TODO this should not be here! + System.out.println(((PlayerTeleportedEvent) e).getPoint() + .getCoordinate()); + System.out.println(character.getPosition()); + for (final WorldObject o : worldService + .iterable(new KnownListFilter(character))) { + if (o instanceof NPC) { + conn.write(new NPCInformationPacket((NPC) o)); + } + } } // keep listener alive return true; @@ -202,6 +217,7 @@ public class CharacterServiceImpl extends AbstractService implements // send this user information conn.write(new CharacterInformationPacket(character)); + conn.write(new CharacterInformationExtraPacket(character)); // TODO game guard enforcing conn.write(new GameGuardQueryPacket()); conn.write(new CharacterInventoryPacket(character.getInventory())); @@ -220,7 +236,6 @@ public class CharacterServiceImpl extends AbstractService implements character))) { if (o instanceof NPC) { conn.write(new NPCInformationPacket((NPC) o)); - // conn.write(new ServerObjectPacket((NPC) o)); } } @@ -300,6 +315,20 @@ public class CharacterServiceImpl extends AbstractService implements } } + @Override + public void appearing(L2Character character) { + Preconditions.checkNotNull(character, "character"); + final CharacterID id = character.getID(); + final Lineage2Connection conn = networkService.discover(id); + + character.setState(null); + + conn.write(new CharacterInformationPacket(character)); + conn.write(new CharacterInformationExtraPacket(character)); + eventDispatcher.dispatch(new PlayerTeleportedEvent(character, character + .getPoint())); + } + @Override public void jail(L2Character character, long time, String reason) throws CharacterInJailServiceException { @@ -346,6 +375,10 @@ public class CharacterServiceImpl extends AbstractService implements public void receivedValidation(L2Character character, Point point) { Preconditions.checkNotNull(character, "character"); Preconditions.checkNotNull(point, "point"); + if (character.isTeleporting()) + // ignore while teleporting, for some reason the client sends a + // validation just before teleport packet + return; character.setPoint(point); eventDispatcher.dispatch(new CharacterMoveEvent(character, point)); } diff --git a/src/main/java/com/l2jserver/service/game/chat/SimpleChatService.java b/src/main/java/com/l2jserver/service/game/chat/SimpleChatService.java index 981547d73..68429aeab 100644 --- a/src/main/java/com/l2jserver/service/game/chat/SimpleChatService.java +++ b/src/main/java/com/l2jserver/service/game/chat/SimpleChatService.java @@ -111,7 +111,6 @@ public class SimpleChatService extends AbstractService implements ChatService { ChatBanActiveChatServiceException { Preconditions.checkNotNull(sender, "sender"); Preconditions.checkNotNull(message, "message"); - Preconditions.checkNotNull(extra, "extra"); final ChatChannel channel; switch (chat) { diff --git a/src/main/java/com/l2jserver/service/game/npc/NPCService.java b/src/main/java/com/l2jserver/service/game/npc/NPCService.java index 80f66c7c5..58e60206a 100644 --- a/src/main/java/com/l2jserver/service/game/npc/NPCService.java +++ b/src/main/java/com/l2jserver/service/game/npc/NPCService.java @@ -42,6 +42,20 @@ public interface NPCService extends Service { void action(NPC npc, L2Character character, CharacterAction action) throws ActionServiceException; + /** + * Executes an action for an NPC. Each {@link NPCTemplate} have it's own + * actions. + * + * @param npc + * the npc + * @param character + * the character + * @param args + * the action arguments + */ + void action(NPC npc, L2Character character, String... args) + throws ActionServiceException; + /** * Attacks an given NPC, if possible. * diff --git a/src/main/java/com/l2jserver/service/game/npc/NPCServiceImpl.java b/src/main/java/com/l2jserver/service/game/npc/NPCServiceImpl.java index 2fb5b3ed7..4180f6904 100644 --- a/src/main/java/com/l2jserver/service/game/npc/NPCServiceImpl.java +++ b/src/main/java/com/l2jserver/service/game/npc/NPCServiceImpl.java @@ -39,7 +39,23 @@ public class NPCServiceImpl extends AbstractService implements NPCService { final NPCTemplate template = npc.getTemplate(); try { - template.action(npc, character, action); + template.action(npc, character, new String[0]); + } catch (L2Exception e) { + throw new ActionServiceException(e); + } + } + + @Override + public void action(NPC npc, L2Character character, String... args) + throws ActionServiceException { + Preconditions.checkNotNull(npc, "npc"); + Preconditions.checkNotNull(character, "character"); + if (args == null) + args = new String[0]; + + final NPCTemplate template = npc.getTemplate(); + try { + template.action(npc, character, args); } catch (L2Exception e) { throw new ActionServiceException(e); } diff --git a/src/main/java/com/l2jserver/service/game/pathing/MapperPathingService.java b/src/main/java/com/l2jserver/service/game/pathing/MapperPathingService.java index 93b9aa4fc..e093fff61 100644 --- a/src/main/java/com/l2jserver/service/game/pathing/MapperPathingService.java +++ b/src/main/java/com/l2jserver/service/game/pathing/MapperPathingService.java @@ -70,7 +70,7 @@ public class MapperPathingService extends AbstractService implements private final WorldEventDispatcher eventDispatcher; /** - * The database channel, will reamain open until service is stopped. + * The database channel, will remain open until service is stopped. */ private FileChannel channel; @@ -102,6 +102,7 @@ public class MapperPathingService extends AbstractService implements .fromCoordinate(point.getCoordinate()); try { channel.write(struct.getByteBuffer()); + channel.force(true); } catch (IOException e1) { log.warn("Error writing pathing file!", e1); } diff --git a/src/main/java/com/l2jserver/service/game/spawn/SpawnService.java b/src/main/java/com/l2jserver/service/game/spawn/SpawnService.java index 66460b7a0..0150967fd 100644 --- a/src/main/java/com/l2jserver/service/game/spawn/SpawnService.java +++ b/src/main/java/com/l2jserver/service/game/spawn/SpawnService.java @@ -19,7 +19,7 @@ package com.l2jserver.service.game.spawn; import com.l2jserver.model.world.Player; import com.l2jserver.model.world.capability.Spawnable; import com.l2jserver.model.world.event.SpawnEvent; -import com.l2jserver.model.world.player.event.PlayerTeleportEvent; +import com.l2jserver.model.world.player.event.PlayerTeleportingEvent; import com.l2jserver.service.Service; import com.l2jserver.util.dimensional.Coordinate; import com.l2jserver.util.dimensional.Point; @@ -54,7 +54,7 @@ public interface SpawnService extends Service { /** * Teleports the object to the given point. *

- * An {@link PlayerTeleportEvent} will be dispatched and the new position + * An {@link PlayerTeleportingEvent} will be dispatched and the new position * will be broadcast to all clients. * * @param player diff --git a/src/main/java/com/l2jserver/service/game/spawn/SpawnServiceImpl.java b/src/main/java/com/l2jserver/service/game/spawn/SpawnServiceImpl.java index c3277e9b9..a5c794c2a 100644 --- a/src/main/java/com/l2jserver/service/game/spawn/SpawnServiceImpl.java +++ b/src/main/java/com/l2jserver/service/game/spawn/SpawnServiceImpl.java @@ -25,12 +25,13 @@ import com.l2jserver.game.net.Lineage2Connection; import com.l2jserver.game.net.packet.server.CharacterTeleportPacket; import com.l2jserver.model.id.object.CharacterID; import com.l2jserver.model.world.L2Character; +import com.l2jserver.model.world.L2Character.CharacterState; import com.l2jserver.model.world.NPC; import com.l2jserver.model.world.Player; import com.l2jserver.model.world.capability.Spawnable; import com.l2jserver.model.world.event.SpawnEvent; import com.l2jserver.model.world.npc.event.NPCSpawnEvent; -import com.l2jserver.model.world.player.event.PlayerTeleportEvent; +import com.l2jserver.model.world.player.event.PlayerTeleportingEvent; import com.l2jserver.service.AbstractService; import com.l2jserver.service.AbstractService.Depends; import com.l2jserver.service.game.world.WorldService; @@ -113,6 +114,7 @@ public class SpawnServiceImpl extends AbstractService implements SpawnService { public void teleport(Player player, Coordinate coordinate) { Preconditions.checkNotNull(player, "player"); Preconditions.checkNotNull(coordinate, "coordinate"); + System.out.println("teleport: "+coordinate); player.setPosition(coordinate); if (player instanceof L2Character) { final Lineage2Connection conn = networkService @@ -121,9 +123,10 @@ public class SpawnServiceImpl extends AbstractService implements SpawnService { // TODO throw an exception here return; conn.write(new CharacterTeleportPacket(conn.getCharacter())); + ((L2Character) player).setState(CharacterState.TELEPORTING); } // dispatch teleport event - eventDispatcher.dispatch(new PlayerTeleportEvent(player, coordinate + eventDispatcher.dispatch(new PlayerTeleportingEvent(player, coordinate .toPoint())); // remember: broadcasting is done through events! } diff --git a/src/main/java/com/l2jserver/service/game/world/event/WorldEventDispatcherImpl.java b/src/main/java/com/l2jserver/service/game/world/event/WorldEventDispatcherImpl.java index b74ed8229..149e0618f 100644 --- a/src/main/java/com/l2jserver/service/game/world/event/WorldEventDispatcherImpl.java +++ b/src/main/java/com/l2jserver/service/game/world/event/WorldEventDispatcherImpl.java @@ -200,7 +200,10 @@ public class WorldEventDispatcherImpl implements WorldEventDispatcher { set = CollectionFactory.newSet(); listeners.put(id, set); } - return set; + final Set union = CollectionFactory.newSet(); + union.addAll(set); + union.addAll(globalListeners); + return union; } public void stop() { diff --git a/src/main/java/com/l2jserver/service/game/world/filter/ExcludeFilter.java b/src/main/java/com/l2jserver/service/game/world/filter/ExcludeFilter.java new file mode 100644 index 000000000..15f620055 --- /dev/null +++ b/src/main/java/com/l2jserver/service/game/world/filter/ExcludeFilter.java @@ -0,0 +1,65 @@ +/* + * This file is part of l2jserver . + * + * 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 . + */ +package com.l2jserver.service.game.world.filter; + +import java.util.Collection; +import java.util.Collections; +import java.util.Set; + +import com.l2jserver.model.world.WorldObject; +import com.l2jserver.util.factory.CollectionFactory; + +/** + * And filter that accepts all values that are not in objects + * + * @author Rogiel + * + * @param + * the object type + */ +public class ExcludeFilter implements + WorldObjectFilter { + /** + * The objects to be exluded + */ + private Set objects = CollectionFactory.newSet(); + + /** + * Creates a new instance + * + * @param objects + * the excluded objects + */ + public ExcludeFilter(WorldObject... objects) { + Collections.addAll(this.objects, objects); + } + + /** + * Creates a new instance + * + * @param objects + * the excluded objects + */ + public ExcludeFilter(Collection objects) { + this.objects.addAll(objects); + } + + @Override + public boolean accept(O object) { + return objects.contains(object); + } +} diff --git a/src/main/java/com/l2jserver/service/game/world/filter/impl/KnownListFilter.java b/src/main/java/com/l2jserver/service/game/world/filter/impl/KnownListFilter.java index a6e55b0e2..b79cea2f9 100644 --- a/src/main/java/com/l2jserver/service/game/world/filter/impl/KnownListFilter.java +++ b/src/main/java/com/l2jserver/service/game/world/filter/impl/KnownListFilter.java @@ -27,7 +27,7 @@ import com.l2jserver.service.game.world.filter.AndFilter; * @author Rogiel */ public class KnownListFilter extends AndFilter { - public static final int KNOWNLIST_RANGE = 200; + public static final int KNOWNLIST_RANGE = 2000; @SuppressWarnings("unchecked") public KnownListFilter(Positionable object) { diff --git a/src/main/java/com/l2jserver/util/html/markup/MarkupTag.java b/src/main/java/com/l2jserver/util/html/markup/MarkupTag.java index 2b4013196..b2d2369c5 100644 --- a/src/main/java/com/l2jserver/util/html/markup/MarkupTag.java +++ b/src/main/java/com/l2jserver/util/html/markup/MarkupTag.java @@ -91,6 +91,17 @@ public class MarkupTag { return this; } + /** + * Adds an internal text from an code + * + * @param text + * the text + * @return this {@link MarkupTag} + */ + public MarkupTag textcode(int code) { + return text("&$" + Integer.toString(code) + ";"); + } + /** * Adds a plain text to the tag, use the color formatting. *