mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-11 09:42:54 +00:00
Gatekeeper complete implementation
Signed-off-by: Rogiel <rogiel@rogiel.com>
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
@@ -33,19 +32,16 @@ import org.eclipse.persistence.oxm.annotations.XmlCDATA;
|
||||
|
||||
import com.l2jserver.model.id.template.ItemTemplateID;
|
||||
import com.l2jserver.model.id.template.NPCTemplateID;
|
||||
import com.l2jserver.model.id.template.TeleportationTemplateID;
|
||||
import com.l2jserver.model.template.NPCTemplate.TeleporterMetadata.TeleporterTeleportMetadata;
|
||||
import com.l2jserver.model.world.Actor.ActorSex;
|
||||
import com.l2jserver.model.world.NPC;
|
||||
import com.l2jserver.util.jaxb.ItemTemplateIDAdapter;
|
||||
import com.l2jserver.util.jaxb.NPCTemplateIDAdapter;
|
||||
import com.l2jserver.util.jaxb.TeleportationTemplateIDAdapter;
|
||||
|
||||
/**
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
@XmlRootElement(name = "npc")
|
||||
@XmlType(namespace = "npc")
|
||||
@XmlType(namespace = "npc", name = "npc")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class NPCTemplate extends ActorTemplate<NPC> {
|
||||
@XmlAttribute(name = "id")
|
||||
@@ -226,60 +222,6 @@ public class NPCTemplate extends ActorTemplate<NPC> {
|
||||
protected String script = null;
|
||||
}
|
||||
|
||||
@XmlElement(name = "teleporter")
|
||||
protected TeleporterMetadata teleporter = null;
|
||||
|
||||
@XmlType(namespace = "npc")
|
||||
protected static class TeleporterMetadata {
|
||||
@XmlAttribute(name = "default")
|
||||
protected String defaultTeleport = null;
|
||||
@XmlElement(name = "teleport")
|
||||
protected List<TeleporterTeleportMetadata> teleports = null;
|
||||
|
||||
@XmlType(namespace = "npc")
|
||||
protected static class TeleporterTeleportMetadata {
|
||||
@XmlAttribute(name = "id")
|
||||
protected String id;
|
||||
@XmlElement(name = "region")
|
||||
protected List<TeleportRegion> regions = null;
|
||||
}
|
||||
}
|
||||
|
||||
@XmlType(namespace = "npc")
|
||||
public static class TeleportRegion {
|
||||
@XmlAttribute(name = "id")
|
||||
@XmlJavaTypeAdapter(value = TeleportationTemplateIDAdapter.class)
|
||||
protected TeleportationTemplateID id;
|
||||
@XmlAttribute(name = "price")
|
||||
protected int price = 0;
|
||||
@XmlAttribute(name = "item")
|
||||
@XmlJavaTypeAdapter(ItemTemplateIDAdapter.class)
|
||||
protected ItemTemplateID item;
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public TeleportationTemplateID getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the price
|
||||
*/
|
||||
public int getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the item
|
||||
*/
|
||||
public ItemTemplateID getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
// TODO implement conditions
|
||||
}
|
||||
|
||||
@XmlElement(name = "talk")
|
||||
protected TalkMetadata talk = null;
|
||||
|
||||
@@ -746,28 +688,6 @@ public class NPCTemplate extends ActorTemplate<NPC> {
|
||||
return ai.script;
|
||||
}
|
||||
|
||||
public List<TeleportRegion> getTeleportRegions(String id) {
|
||||
if (teleporter == null)
|
||||
return Collections.emptyList();
|
||||
for (final TeleporterTeleportMetadata teleport : teleporter.teleports) {
|
||||
if (teleport.id.equals(id)) {
|
||||
return Collections.unmodifiableList(teleport.regions);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<TeleportRegion> getTeleportRegions() {
|
||||
if (teleporter == null)
|
||||
return Collections.emptyList();
|
||||
for (final TeleporterTeleportMetadata teleport : teleporter.teleports) {
|
||||
if (teleport.id.equals(teleporter.defaultTeleport)) {
|
||||
return Collections.unmodifiableList(teleport.regions);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getHTML(String id) {
|
||||
if (talk == null)
|
||||
return null;
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
*/
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
@@ -24,9 +26,11 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
|
||||
import com.l2jserver.model.id.template.ItemTemplateID;
|
||||
import com.l2jserver.model.id.template.TeleportationTemplateID;
|
||||
import com.l2jserver.util.dimensional.Coordinate;
|
||||
import com.l2jserver.util.jaxb.CoordinateAdapter;
|
||||
import com.l2jserver.util.jaxb.ItemTemplateIDAdapter;
|
||||
import com.l2jserver.util.jaxb.TeleportationTemplateIDAdapter;
|
||||
|
||||
/**
|
||||
@@ -40,12 +44,25 @@ import com.l2jserver.util.jaxb.TeleportationTemplateIDAdapter;
|
||||
public class TeleportationTemplate extends AbstractTemplate<Coordinate> {
|
||||
@XmlAttribute(name = "id")
|
||||
@XmlJavaTypeAdapter(TeleportationTemplateIDAdapter.class)
|
||||
private TeleportationTemplateID id;
|
||||
@XmlElement(name = "name")
|
||||
private String name;
|
||||
@XmlElement(name = "coordinate")
|
||||
protected TeleportationTemplateID id;
|
||||
@XmlAttribute(name = "name")
|
||||
protected String name;
|
||||
|
||||
@XmlAttribute(name = "item")
|
||||
@XmlJavaTypeAdapter(ItemTemplateIDAdapter.class)
|
||||
protected ItemTemplateID itemTemplateID;
|
||||
@XmlAttribute(name = "price")
|
||||
protected int price;
|
||||
|
||||
@XmlElement(name = "point")
|
||||
@XmlJavaTypeAdapter(CoordinateAdapter.class)
|
||||
private Coordinate coordinate;
|
||||
protected Coordinate coordinate;
|
||||
|
||||
protected List<TeleportRestriction> restrictions;
|
||||
|
||||
public enum TeleportRestriction {
|
||||
NOBLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Coordinate create() {
|
||||
@@ -59,6 +76,27 @@ public class TeleportationTemplate extends AbstractTemplate<Coordinate> {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public TeleportationTemplateID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the itemTemplateID
|
||||
*/
|
||||
public ItemTemplateID getItemTemplateID() {
|
||||
return itemTemplateID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the price
|
||||
*/
|
||||
public int getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the coordinate
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user