1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2025-12-11 09:42:54 +00:00

TeleporterTemplate

Signed-off-by: Rogiel <rogiel@rogiel.com>
This commit is contained in:
2011-05-25 00:54:21 -03:00
parent cc44946831
commit ad6a2e89d2
9129 changed files with 128 additions and 673228 deletions

View File

@@ -1,34 +0,0 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.world.npc;
import com.l2jserver.model.id.template.NPCTemplateID;
import com.l2jserver.model.world.NPC;
/**
* @author <a href="http://www.rogiel.com">Rogiel</a>
*
*/
public class Teleporter extends NPC {
/**
* @param templateID
* the NPC template ID
*/
public Teleporter(NPCTemplateID templateID) {
super(templateID);
}
}

View File

@@ -0,0 +1,65 @@
/*
* 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.npc.controller;
import com.l2jserver.game.net.Lineage2Connection;
import com.l2jserver.game.net.packet.server.NPCHtmlMessagePacket;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.model.world.NPC;
import com.l2jserver.util.exception.L2Exception;
import com.l2jserver.util.html.markup.HtmlTemplate;
import com.l2jserver.util.html.markup.MarkupTag;
/**
* The {@link AbstractNPCController} handful methods for controlling NPCs.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class AbstractNPCController implements NPCController {
@Override
public void action(NPC npc, Lineage2Connection conn, L2Character character,
String... args) throws L2Exception {
}
/**
* Talks with this NPC
*
* @param npc
* the {@link NPC} instance
* @param conn
* the connection to {@link L2Character}
* @param character
* the interacting character
* @param args
* the action arguments
* @throws L2Exception
*/
protected void talk(NPC npc, Lineage2Connection conn,
L2Character character, String... args) throws L2Exception {
// not yet available message
final HtmlTemplate template = new HtmlTemplate() {
@Override
protected void build(MarkupTag body) {
body.text("Sorry, but I'm not implemented yet!");
}
};
conn.write(new NPCHtmlMessagePacket(npc, template));
conn.sendActionFailed();
}
}

View File

@@ -17,39 +17,24 @@
package com.l2jserver.model.world.npc.controller;
import com.l2jserver.game.net.Lineage2Connection;
import com.l2jserver.model.template.NPCTemplate;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.model.world.NPC;
import com.l2jserver.util.exception.L2Exception;
/**
* @author <a href="http://www.rogiel.com">Rogiel</a>
* The {@link NPC} controller is used to control any given NPC. Implementations
* will add behaviors to each NPC.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class NPCController {
public interface NPCController {
/**
* The {@link NPC} instance
*/
protected final NPC npc;
/**
* The {@link NPC} template
*/
protected final NPCTemplate template;
/**
* Creates a new instance
* Performs an interaction with this {@link NPC}.
*
* @param npc
* the {@link NPC}
*/
public NPCController(NPC npc) {
this.npc = npc;
this.template = null;
}
/**
* Performs an interaction with this template.
*
* the {@link NPC} instance
* @param conn
* the connection to {@link L2Character}
* @param character
* the interacting character
* @param args
@@ -57,27 +42,6 @@ public class NPCController {
* @throws L2Exception
* any {@link L2Exception}
*/
public void action(NPC npc, L2Character character, String... args)
throws L2Exception {
}
/**
* Talks with this NPC
*
* @param npc
* the npc
* @param character
* the character
* @param conn
* the lineage 2 connection
* @param args
* the action arguments
* @throws L2Exception
*/
protected void talk(NPC npc, L2Character character,
Lineage2Connection conn, String... args) throws L2Exception {
conn.sendActionFailed();
}
void action(NPC npc, Lineage2Connection conn, L2Character character,
String... args) throws L2Exception;
}

View File

@@ -16,23 +16,19 @@
*/
package com.l2jserver.model.world.npc.controller;
import com.l2jserver.model.world.NPC;
import com.google.inject.Inject;
import com.l2jserver.service.game.spawn.SpawnService;
/**
* @author <a href="http://www.rogiel.com">Rogiel</a>
* This controller is used to control teleporters (e.g. gatekeepers)
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class TeleporterController extends NPCController {
public class TeleporterController extends AbstractNPCController {
/**
* The {@link SpawnService}
*/
@Inject
protected SpawnService spawnService;
/**
* @param npc
*/
public TeleporterController(NPC npc) {
super(npc);
}
}