mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-07 16:03:10 +00:00
Implements server version modularization
Now each server server has an maven module which implements changes to the default behavior within the "core" gameserver module. This allows to keep multiple server versions without the need of several branches and with little code duplication.
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<jaxb:bindings version="2.1" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb">
|
||||
<!--
|
||||
|
||||
This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4
|
||||
See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
Generated on: 2012.01.19 at 03:37:11 PM BRST
|
||||
|
||||
-->
|
||||
<jaxb:bindings scd="x-schema::tns" xmlns:tns="http://schemas.l2jserver2.com/skill">
|
||||
<jaxb:schemaBindings map="false"/>
|
||||
<jaxb:bindings scd="tns:skill">
|
||||
<jaxb:class ref="com.l2jserver.model.template.SkillTemplate"/>
|
||||
</jaxb:bindings>
|
||||
</jaxb:bindings>
|
||||
<jaxb:bindings scd="x-schema::tns" xmlns:tns="http://schemas.l2jserver2.com/character">
|
||||
<jaxb:schemaBindings map="false"/>
|
||||
<jaxb:bindings scd="tns:character">
|
||||
<jaxb:class ref="com.l2jserver.model.template.CharacterTemplate"/>
|
||||
</jaxb:bindings>
|
||||
</jaxb:bindings>
|
||||
<jaxb:bindings scd="x-schema::">
|
||||
<jaxb:schemaBindings map="false"/>
|
||||
<jaxb:bindings scd="~CalculatorFunction">
|
||||
<jaxb:class ref="com.l2jserver.model.template.CalculatorFunction"/>
|
||||
</jaxb:bindings>
|
||||
<jaxb:bindings scd="~AbstractTemplate">
|
||||
<jaxb:class ref="com.l2jserver.model.template.AbstractTemplate"/>
|
||||
</jaxb:bindings>
|
||||
<jaxb:bindings scd="~Coordinate">
|
||||
<jaxb:class ref="com.l2jserver.model.template.Coordinate"/>
|
||||
</jaxb:bindings>
|
||||
<jaxb:bindings scd="~ActorTemplate">
|
||||
<jaxb:class ref="com.l2jserver.model.template.ActorTemplate"/>
|
||||
</jaxb:bindings>
|
||||
<jaxb:bindings scd="~CalculatorFunctionOperation">
|
||||
<jaxb:class ref="com.l2jserver.model.template.CalculatorFunctionOperation"/>
|
||||
</jaxb:bindings>
|
||||
</jaxb:bindings>
|
||||
<jaxb:bindings scd="x-schema::tns" xmlns:tns="http://schemas.l2jserver2.com/teleport">
|
||||
<jaxb:schemaBindings map="false"/>
|
||||
<jaxb:bindings scd="tns:teleports">
|
||||
<jaxb:class ref="com.l2jserver.model.template.Teleports"/>
|
||||
</jaxb:bindings>
|
||||
</jaxb:bindings>
|
||||
<jaxb:bindings scd="x-schema::tns" xmlns:tns="http://schemas.l2jserver2.com/item">
|
||||
<jaxb:schemaBindings map="false"/>
|
||||
<jaxb:bindings scd="tns:item">
|
||||
<jaxb:class ref="com.l2jserver.model.template.ItemTemplate"/>
|
||||
</jaxb:bindings>
|
||||
</jaxb:bindings>
|
||||
<jaxb:bindings scd="x-schema::tns" xmlns:tns="http://schemas.l2jserver2.com/npc">
|
||||
<jaxb:schemaBindings map="false"/>
|
||||
<jaxb:bindings scd="tns:npc">
|
||||
<jaxb:class ref="com.l2jserver.model.template.NPCTemplate"/>
|
||||
</jaxb:bindings>
|
||||
</jaxb:bindings>
|
||||
<jaxb:bindings scd="x-schema::tns" xmlns:tns="zones">
|
||||
<jaxb:schemaBindings map="false"/>
|
||||
<jaxb:bindings scd="tns:zones">
|
||||
<jaxb:class ref="com.l2jserver.model.template.Zones"/>
|
||||
</jaxb:bindings>
|
||||
<jaxb:bindings scd="~tns:ZoneType">
|
||||
<jaxb:class ref="com.l2jserver.model.template.ZoneType"/>
|
||||
</jaxb:bindings>
|
||||
</jaxb:bindings>
|
||||
</jaxb:bindings>
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2012.01.19 at 03:37:11 PM BRST
|
||||
//
|
||||
|
||||
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for AbstractTemplate complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="AbstractTemplate">
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "AbstractTemplate")
|
||||
@XmlSeeAlso({
|
||||
ItemTemplate.class,
|
||||
ActorTemplate.class,
|
||||
SkillTemplate.class,
|
||||
com.l2jserver.model.template.Teleports.Teleport.class
|
||||
})
|
||||
public abstract class AbstractTemplate
|
||||
implements Template
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2012.01.19 at 03:37:11 PM BRST
|
||||
//
|
||||
|
||||
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for ActorTemplate complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="ActorTemplate">
|
||||
* <complexContent>
|
||||
* <extension base="{}AbstractTemplate">
|
||||
* </extension>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "ActorTemplate")
|
||||
@XmlSeeAlso({
|
||||
CharacterTemplate.class,
|
||||
NPCTemplate.class
|
||||
})
|
||||
public abstract class ActorTemplate
|
||||
extends AbstractTemplate
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2012.01.19 at 03:37:11 PM BRST
|
||||
//
|
||||
|
||||
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for CalculatorFunction complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="CalculatorFunction">
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="set" type="{}CalculatorFunctionOperation" minOccurs="0"/>
|
||||
* <element name="add" type="{}CalculatorFunctionOperation" minOccurs="0"/>
|
||||
* <element name="subtract" type="{}CalculatorFunctionOperation" minOccurs="0"/>
|
||||
* <element name="random" type="{}CalculatorFunctionOperation" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "CalculatorFunction", propOrder = {
|
||||
"set",
|
||||
"add",
|
||||
"subtract",
|
||||
"random"
|
||||
})
|
||||
public class CalculatorFunction {
|
||||
|
||||
protected CalculatorFunctionOperation set;
|
||||
protected CalculatorFunctionOperation add;
|
||||
protected CalculatorFunctionOperation subtract;
|
||||
protected CalculatorFunctionOperation random;
|
||||
|
||||
/**
|
||||
* Gets the value of the set property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link CalculatorFunctionOperation }
|
||||
*
|
||||
*/
|
||||
public CalculatorFunctionOperation getSet() {
|
||||
return set;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the set property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link CalculatorFunctionOperation }
|
||||
*
|
||||
*/
|
||||
public void setSet(CalculatorFunctionOperation value) {
|
||||
this.set = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the add property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link CalculatorFunctionOperation }
|
||||
*
|
||||
*/
|
||||
public CalculatorFunctionOperation getAdd() {
|
||||
return add;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the add property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link CalculatorFunctionOperation }
|
||||
*
|
||||
*/
|
||||
public void setAdd(CalculatorFunctionOperation value) {
|
||||
this.add = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the subtract property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link CalculatorFunctionOperation }
|
||||
*
|
||||
*/
|
||||
public CalculatorFunctionOperation getSubtract() {
|
||||
return subtract;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the subtract property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link CalculatorFunctionOperation }
|
||||
*
|
||||
*/
|
||||
public void setSubtract(CalculatorFunctionOperation value) {
|
||||
this.subtract = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the random property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link CalculatorFunctionOperation }
|
||||
*
|
||||
*/
|
||||
public CalculatorFunctionOperation getRandom() {
|
||||
return random;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the random property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link CalculatorFunctionOperation }
|
||||
*
|
||||
*/
|
||||
public void setRandom(CalculatorFunctionOperation value) {
|
||||
this.random = value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2012.01.19 at 03:37:11 PM BRST
|
||||
//
|
||||
|
||||
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for CalculatorFunctionOperation complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="CalculatorFunctionOperation">
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <attribute name="order" use="required" type="{http://www.w3.org/2001/XMLSchema}integer" />
|
||||
* <attribute name="value" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "CalculatorFunctionOperation")
|
||||
public class CalculatorFunctionOperation {
|
||||
|
||||
@XmlAttribute(name = "order", required = true)
|
||||
protected BigInteger order;
|
||||
@XmlAttribute(name = "value", required = true)
|
||||
protected double value;
|
||||
|
||||
/**
|
||||
* Gets the value of the order property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link BigInteger }
|
||||
*
|
||||
*/
|
||||
public BigInteger getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the order property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link BigInteger }
|
||||
*
|
||||
*/
|
||||
public void setOrder(BigInteger value) {
|
||||
this.order = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the value property.
|
||||
*
|
||||
*/
|
||||
public double getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the value property.
|
||||
*
|
||||
*/
|
||||
public void setValue(double value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,97 @@
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2012.01.19 at 03:37:11 PM BRST
|
||||
//
|
||||
|
||||
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for Coordinate complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="Coordinate">
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* </sequence>
|
||||
* <attribute name="x" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* <attribute name="y" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* <attribute name="z" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "Coordinate")
|
||||
public class Coordinate {
|
||||
|
||||
@XmlAttribute(name = "x", required = true)
|
||||
protected int x;
|
||||
@XmlAttribute(name = "y", required = true)
|
||||
protected int y;
|
||||
@XmlAttribute(name = "z", required = true)
|
||||
protected int z;
|
||||
|
||||
/**
|
||||
* Gets the value of the x property.
|
||||
*
|
||||
*/
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the x property.
|
||||
*
|
||||
*/
|
||||
public void setX(int value) {
|
||||
this.x = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the y property.
|
||||
*
|
||||
*/
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the y property.
|
||||
*
|
||||
*/
|
||||
public void setY(int value) {
|
||||
this.y = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the z property.
|
||||
*
|
||||
*/
|
||||
public int getZ() {
|
||||
return z;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the z property.
|
||||
*
|
||||
*/
|
||||
public void setZ(int value) {
|
||||
this.z = value;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,535 @@
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2012.01.19 at 03:37:11 PM BRST
|
||||
//
|
||||
|
||||
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRegistry;
|
||||
|
||||
|
||||
/**
|
||||
* This object contains factory methods for each
|
||||
* Java content interface and Java element interface
|
||||
* generated in the com.l2jserver.model.template package.
|
||||
* <p>An ObjectFactory allows you to programatically
|
||||
* construct new instances of the Java representation
|
||||
* for XML content. The Java representation of XML
|
||||
* content can consist of schema derived interfaces
|
||||
* and classes representing the binding of schema
|
||||
* type definitions, element declarations and model
|
||||
* groups. Factory methods for each of these are
|
||||
* provided in this class.
|
||||
*
|
||||
*/
|
||||
@XmlRegistry
|
||||
public class ObjectFactory {
|
||||
|
||||
|
||||
/**
|
||||
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.l2jserver.model.template
|
||||
*
|
||||
*/
|
||||
public ObjectFactory() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link NPCTemplate }
|
||||
*
|
||||
*/
|
||||
public NPCTemplate createNPCTemplate() {
|
||||
return new NPCTemplate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link NPCTemplate.Droplist }
|
||||
*
|
||||
*/
|
||||
public NPCTemplate.Droplist createNPCTemplateDroplist() {
|
||||
return new NPCTemplate.Droplist();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link NPCTemplate.Droplist.Item }
|
||||
*
|
||||
*/
|
||||
public NPCTemplate.Droplist.Item createNPCTemplateDroplistItem() {
|
||||
return new NPCTemplate.Droplist.Item();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link Teleports }
|
||||
*
|
||||
*/
|
||||
public Teleports createTeleports() {
|
||||
return new Teleports();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link Zones }
|
||||
*
|
||||
*/
|
||||
public Zones createZones() {
|
||||
return new Zones();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link ZoneType }
|
||||
*
|
||||
*/
|
||||
public ZoneType createZoneType() {
|
||||
return new ZoneType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link Zones.Castle }
|
||||
*
|
||||
*/
|
||||
public Zones.Castle createZonesCastle() {
|
||||
return new Zones.Castle();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link Teleports.Teleport }
|
||||
*
|
||||
*/
|
||||
public Teleports.Teleport createTeleportsTeleport() {
|
||||
return new Teleports.Teleport();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link NPCTemplate.Skills }
|
||||
*
|
||||
*/
|
||||
public NPCTemplate.Skills createNPCTemplateSkills() {
|
||||
return new NPCTemplate.Skills();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link NPCTemplate.Talk }
|
||||
*
|
||||
*/
|
||||
public NPCTemplate.Talk createNPCTemplateTalk() {
|
||||
return new NPCTemplate.Talk();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link NPCTemplate.Info }
|
||||
*
|
||||
*/
|
||||
public NPCTemplate.Info createNPCTemplateInfo() {
|
||||
return new NPCTemplate.Info();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link NPCTemplate.Info.Stats }
|
||||
*
|
||||
*/
|
||||
public NPCTemplate.Info.Stats createNPCTemplateInfoStats() {
|
||||
return new NPCTemplate.Info.Stats();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link NPCTemplate.Info.Stats.Defense }
|
||||
*
|
||||
*/
|
||||
public NPCTemplate.Info.Stats.Defense createNPCTemplateInfoStatsDefense() {
|
||||
return new NPCTemplate.Info.Stats.Defense();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link NPCTemplate.Info.Stats.Attack }
|
||||
*
|
||||
*/
|
||||
public NPCTemplate.Info.Stats.Attack createNPCTemplateInfoStatsAttack() {
|
||||
return new NPCTemplate.Info.Stats.Attack();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link ItemTemplate }
|
||||
*
|
||||
*/
|
||||
public ItemTemplate createItemTemplate() {
|
||||
return new ItemTemplate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link ItemTemplate.Armor }
|
||||
*
|
||||
*/
|
||||
public ItemTemplate.Armor createItemTemplateArmor() {
|
||||
return new ItemTemplate.Armor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link ItemTemplate.Attributes }
|
||||
*
|
||||
*/
|
||||
public ItemTemplate.Attributes createItemTemplateAttributes() {
|
||||
return new ItemTemplate.Attributes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link CharacterTemplate }
|
||||
*
|
||||
*/
|
||||
public CharacterTemplate createCharacterTemplate() {
|
||||
return new CharacterTemplate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link CharacterTemplate.Collision }
|
||||
*
|
||||
*/
|
||||
public CharacterTemplate.Collision createCharacterTemplateCollision() {
|
||||
return new CharacterTemplate.Collision();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link CharacterTemplate.Stats }
|
||||
*
|
||||
*/
|
||||
public CharacterTemplate.Stats createCharacterTemplateStats() {
|
||||
return new CharacterTemplate.Stats();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link CharacterTemplate.Stats.Defense }
|
||||
*
|
||||
*/
|
||||
public CharacterTemplate.Stats.Defense createCharacterTemplateStatsDefense() {
|
||||
return new CharacterTemplate.Stats.Defense();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link CharacterTemplate.Stats.Attack }
|
||||
*
|
||||
*/
|
||||
public CharacterTemplate.Stats.Attack createCharacterTemplateStatsAttack() {
|
||||
return new CharacterTemplate.Stats.Attack();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link CalculatorFunction }
|
||||
*
|
||||
*/
|
||||
public CalculatorFunction createCalculatorFunction() {
|
||||
return new CalculatorFunction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link Coordinate }
|
||||
*
|
||||
*/
|
||||
public Coordinate createCoordinate() {
|
||||
return new Coordinate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link CalculatorFunctionOperation }
|
||||
*
|
||||
*/
|
||||
public CalculatorFunctionOperation createCalculatorFunctionOperation() {
|
||||
return new CalculatorFunctionOperation();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link SkillTemplate }
|
||||
*
|
||||
*/
|
||||
public SkillTemplate createSkillTemplate() {
|
||||
return new SkillTemplate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link ZoneType.Point }
|
||||
*
|
||||
*/
|
||||
public ZoneType.Point createZoneTypePoint() {
|
||||
return new ZoneType.Point();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link Zones.Castle.Siege }
|
||||
*
|
||||
*/
|
||||
public Zones.Castle.Siege createZonesCastleSiege() {
|
||||
return new Zones.Castle.Siege();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link Teleports.Teleport.Restrictions }
|
||||
*
|
||||
*/
|
||||
public Teleports.Teleport.Restrictions createTeleportsTeleportRestrictions() {
|
||||
return new Teleports.Teleport.Restrictions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link NPCTemplate.Ai }
|
||||
*
|
||||
*/
|
||||
public NPCTemplate.Ai createNPCTemplateAi() {
|
||||
return new NPCTemplate.Ai();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link NPCTemplate.Skills.Skill }
|
||||
*
|
||||
*/
|
||||
public NPCTemplate.Skills.Skill createNPCTemplateSkillsSkill() {
|
||||
return new NPCTemplate.Skills.Skill();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link NPCTemplate.Talk.Chat }
|
||||
*
|
||||
*/
|
||||
public NPCTemplate.Talk.Chat createNPCTemplateTalkChat() {
|
||||
return new NPCTemplate.Talk.Chat();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link NPCTemplate.Info.Name }
|
||||
*
|
||||
*/
|
||||
public NPCTemplate.Info.Name createNPCTemplateInfoName() {
|
||||
return new NPCTemplate.Info.Name();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link NPCTemplate.Info.Title }
|
||||
*
|
||||
*/
|
||||
public NPCTemplate.Info.Title createNPCTemplateInfoTitle() {
|
||||
return new NPCTemplate.Info.Title();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link NPCTemplate.Info.Item }
|
||||
*
|
||||
*/
|
||||
public NPCTemplate.Info.Item createNPCTemplateInfoItem() {
|
||||
return new NPCTemplate.Info.Item();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link NPCTemplate.Info.Collision }
|
||||
*
|
||||
*/
|
||||
public NPCTemplate.Info.Collision createNPCTemplateInfoCollision() {
|
||||
return new NPCTemplate.Info.Collision();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link NPCTemplate.Info.Stats.Hp }
|
||||
*
|
||||
*/
|
||||
public NPCTemplate.Info.Stats.Hp createNPCTemplateInfoStatsHp() {
|
||||
return new NPCTemplate.Info.Stats.Hp();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link NPCTemplate.Info.Stats.Mp }
|
||||
*
|
||||
*/
|
||||
public NPCTemplate.Info.Stats.Mp createNPCTemplateInfoStatsMp() {
|
||||
return new NPCTemplate.Info.Stats.Mp();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link NPCTemplate.Info.Stats.Move }
|
||||
*
|
||||
*/
|
||||
public NPCTemplate.Info.Stats.Move createNPCTemplateInfoStatsMove() {
|
||||
return new NPCTemplate.Info.Stats.Move();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link NPCTemplate.Info.Stats.Base }
|
||||
*
|
||||
*/
|
||||
public NPCTemplate.Info.Stats.Base createNPCTemplateInfoStatsBase() {
|
||||
return new NPCTemplate.Info.Stats.Base();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link NPCTemplate.Info.Stats.Defense.Physical }
|
||||
*
|
||||
*/
|
||||
public NPCTemplate.Info.Stats.Defense.Physical createNPCTemplateInfoStatsDefensePhysical() {
|
||||
return new NPCTemplate.Info.Stats.Defense.Physical();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link NPCTemplate.Info.Stats.Defense.Magical }
|
||||
*
|
||||
*/
|
||||
public NPCTemplate.Info.Stats.Defense.Magical createNPCTemplateInfoStatsDefenseMagical() {
|
||||
return new NPCTemplate.Info.Stats.Defense.Magical();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link NPCTemplate.Info.Stats.Attack.Physical }
|
||||
*
|
||||
*/
|
||||
public NPCTemplate.Info.Stats.Attack.Physical createNPCTemplateInfoStatsAttackPhysical() {
|
||||
return new NPCTemplate.Info.Stats.Attack.Physical();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link NPCTemplate.Info.Stats.Attack.Magical }
|
||||
*
|
||||
*/
|
||||
public NPCTemplate.Info.Stats.Attack.Magical createNPCTemplateInfoStatsAttackMagical() {
|
||||
return new NPCTemplate.Info.Stats.Attack.Magical();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link ItemTemplate.Controller }
|
||||
*
|
||||
*/
|
||||
public ItemTemplate.Controller createItemTemplateController() {
|
||||
return new ItemTemplate.Controller();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link ItemTemplate.Effect }
|
||||
*
|
||||
*/
|
||||
public ItemTemplate.Effect createItemTemplateEffect() {
|
||||
return new ItemTemplate.Effect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link ItemTemplate.EtcItem }
|
||||
*
|
||||
*/
|
||||
public ItemTemplate.EtcItem createItemTemplateEtcItem() {
|
||||
return new ItemTemplate.EtcItem();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link ItemTemplate.Weapon }
|
||||
*
|
||||
*/
|
||||
public ItemTemplate.Weapon createItemTemplateWeapon() {
|
||||
return new ItemTemplate.Weapon();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link ItemTemplate.Armor.Cost }
|
||||
*
|
||||
*/
|
||||
public ItemTemplate.Armor.Cost createItemTemplateArmorCost() {
|
||||
return new ItemTemplate.Armor.Cost();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link ItemTemplate.Armor.Equipment }
|
||||
*
|
||||
*/
|
||||
public ItemTemplate.Armor.Equipment createItemTemplateArmorEquipment() {
|
||||
return new ItemTemplate.Armor.Equipment();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link ItemTemplate.Attributes.Cost }
|
||||
*
|
||||
*/
|
||||
public ItemTemplate.Attributes.Cost createItemTemplateAttributesCost() {
|
||||
return new ItemTemplate.Attributes.Cost();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link CharacterTemplate.Collision.Male }
|
||||
*
|
||||
*/
|
||||
public CharacterTemplate.Collision.Male createCharacterTemplateCollisionMale() {
|
||||
return new CharacterTemplate.Collision.Male();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link CharacterTemplate.Collision.Female }
|
||||
*
|
||||
*/
|
||||
public CharacterTemplate.Collision.Female createCharacterTemplateCollisionFemale() {
|
||||
return new CharacterTemplate.Collision.Female();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link CharacterTemplate.Stats.Hp }
|
||||
*
|
||||
*/
|
||||
public CharacterTemplate.Stats.Hp createCharacterTemplateStatsHp() {
|
||||
return new CharacterTemplate.Stats.Hp();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link CharacterTemplate.Stats.Mp }
|
||||
*
|
||||
*/
|
||||
public CharacterTemplate.Stats.Mp createCharacterTemplateStatsMp() {
|
||||
return new CharacterTemplate.Stats.Mp();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link CharacterTemplate.Stats.Cp }
|
||||
*
|
||||
*/
|
||||
public CharacterTemplate.Stats.Cp createCharacterTemplateStatsCp() {
|
||||
return new CharacterTemplate.Stats.Cp();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link CharacterTemplate.Stats.Move }
|
||||
*
|
||||
*/
|
||||
public CharacterTemplate.Stats.Move createCharacterTemplateStatsMove() {
|
||||
return new CharacterTemplate.Stats.Move();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link CharacterTemplate.Stats.Base }
|
||||
*
|
||||
*/
|
||||
public CharacterTemplate.Stats.Base createCharacterTemplateStatsBase() {
|
||||
return new CharacterTemplate.Stats.Base();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link CharacterTemplate.Stats.Defense.Physical }
|
||||
*
|
||||
*/
|
||||
public CharacterTemplate.Stats.Defense.Physical createCharacterTemplateStatsDefensePhysical() {
|
||||
return new CharacterTemplate.Stats.Defense.Physical();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link CharacterTemplate.Stats.Defense.Magical }
|
||||
*
|
||||
*/
|
||||
public CharacterTemplate.Stats.Defense.Magical createCharacterTemplateStatsDefenseMagical() {
|
||||
return new CharacterTemplate.Stats.Defense.Magical();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link CharacterTemplate.Stats.Attack.Physical }
|
||||
*
|
||||
*/
|
||||
public CharacterTemplate.Stats.Attack.Physical createCharacterTemplateStatsAttackPhysical() {
|
||||
return new CharacterTemplate.Stats.Attack.Physical();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link CharacterTemplate.Stats.Attack.Magical }
|
||||
*
|
||||
*/
|
||||
public CharacterTemplate.Stats.Attack.Magical createCharacterTemplateStatsAttackMagical() {
|
||||
return new CharacterTemplate.Stats.Attack.Magical();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2012.01.19 at 03:37:11 PM BRST
|
||||
//
|
||||
|
||||
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
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.SkillTemplateID;
|
||||
import com.l2jserver.util.jaxb.SkillTemplateIDAdapter;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for skill element declaration.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <element name="skill">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <extension base="{}AbstractTemplate">
|
||||
* <sequence>
|
||||
* <element name="maximumLevel" type="{http://www.w3.org/2001/XMLSchema}int"/>
|
||||
* </sequence>
|
||||
* <attribute name="id" use="required" type="{http://schemas.l2jserver2.com/skill}SkillTemplateID" />
|
||||
* <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* <attribute name="delay" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* <attribute name="cooldown" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* </extension>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "", propOrder = {
|
||||
"maximumLevel"
|
||||
})
|
||||
@XmlRootElement(name = "skill", namespace = "http://schemas.l2jserver2.com/skill")
|
||||
public class SkillTemplate
|
||||
extends AbstractTemplate
|
||||
{
|
||||
|
||||
protected int maximumLevel;
|
||||
@XmlAttribute(name = "id", required = true)
|
||||
@XmlJavaTypeAdapter(SkillTemplateIDAdapter.class)
|
||||
protected SkillTemplateID id;
|
||||
@XmlAttribute(name = "name", required = true)
|
||||
protected String name;
|
||||
@XmlAttribute(name = "delay", required = true)
|
||||
protected int delay;
|
||||
@XmlAttribute(name = "cooldown", required = true)
|
||||
protected int cooldown;
|
||||
|
||||
/**
|
||||
* Gets the value of the maximumLevel property.
|
||||
*
|
||||
*/
|
||||
public int getMaximumLevel() {
|
||||
return maximumLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the maximumLevel property.
|
||||
*
|
||||
*/
|
||||
public void setMaximumLevel(int value) {
|
||||
this.maximumLevel = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the id property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public SkillTemplateID getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the id property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setID(SkillTemplateID value) {
|
||||
this.id = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the name property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the name property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setName(String value) {
|
||||
this.name = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the delay property.
|
||||
*
|
||||
*/
|
||||
public int getDelay() {
|
||||
return delay;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the delay property.
|
||||
*
|
||||
*/
|
||||
public void setDelay(int value) {
|
||||
this.delay = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the cooldown property.
|
||||
*
|
||||
*/
|
||||
public int getCooldown() {
|
||||
return cooldown;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the cooldown property.
|
||||
*
|
||||
*/
|
||||
public void setCooldown(int value) {
|
||||
this.cooldown = value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,381 @@
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2012.01.19 at 03:37:11 PM BRST
|
||||
//
|
||||
|
||||
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
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.TeleportationTemplateID;
|
||||
import com.l2jserver.util.jaxb.TeleportationTemplateIDAdapter;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for anonymous complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="teleport" maxOccurs="unbounded">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <extension base="{}AbstractTemplate">
|
||||
* <sequence>
|
||||
* <element name="point" type="{}Coordinate" minOccurs="0"/>
|
||||
* <element name="restrictions" minOccurs="0">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="restriction" maxOccurs="unbounded">
|
||||
* <simpleType>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
|
||||
* <enumeration value="NOBLE"/>
|
||||
* </restriction>
|
||||
* </simpleType>
|
||||
* </element>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* </sequence>
|
||||
* <attribute name="id" use="required" type="{http://schemas.l2jserver2.com/teleport}TeleportationTemplateID" />
|
||||
* <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* <attribute name="item" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* <attribute name="price" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* </extension>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "", propOrder = {
|
||||
"teleport"
|
||||
})
|
||||
@XmlRootElement(name = "teleports", namespace = "http://schemas.l2jserver2.com/teleport")
|
||||
public class Teleports {
|
||||
|
||||
@XmlElement(required = true)
|
||||
protected List<Teleports.Teleport> teleport;
|
||||
|
||||
/**
|
||||
* Gets the value of the teleport property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the teleport property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getTeleport().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link Teleports.Teleport }
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<Teleports.Teleport> getTeleport() {
|
||||
if (teleport == null) {
|
||||
teleport = new ArrayList<Teleports.Teleport>();
|
||||
}
|
||||
return this.teleport;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for anonymous complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <extension base="{}AbstractTemplate">
|
||||
* <sequence>
|
||||
* <element name="point" type="{}Coordinate" minOccurs="0"/>
|
||||
* <element name="restrictions" minOccurs="0">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="restriction" maxOccurs="unbounded">
|
||||
* <simpleType>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
|
||||
* <enumeration value="NOBLE"/>
|
||||
* </restriction>
|
||||
* </simpleType>
|
||||
* </element>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* </sequence>
|
||||
* <attribute name="id" use="required" type="{http://schemas.l2jserver2.com/teleport}TeleportationTemplateID" />
|
||||
* <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* <attribute name="item" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* <attribute name="price" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* </extension>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "", propOrder = {
|
||||
"point",
|
||||
"restrictions"
|
||||
})
|
||||
public static class Teleport
|
||||
extends AbstractTemplate
|
||||
{
|
||||
|
||||
protected Coordinate point;
|
||||
protected Teleports.Teleport.Restrictions restrictions;
|
||||
@XmlAttribute(name = "id", required = true)
|
||||
@XmlJavaTypeAdapter(TeleportationTemplateIDAdapter.class)
|
||||
protected TeleportationTemplateID id;
|
||||
@XmlAttribute(name = "name")
|
||||
protected String name;
|
||||
@XmlAttribute(name = "item")
|
||||
protected Integer item;
|
||||
@XmlAttribute(name = "price", required = true)
|
||||
protected int price;
|
||||
|
||||
/**
|
||||
* Gets the value of the point property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Coordinate }
|
||||
*
|
||||
*/
|
||||
public Coordinate getPoint() {
|
||||
return point;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the point property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Coordinate }
|
||||
*
|
||||
*/
|
||||
public void setPoint(Coordinate value) {
|
||||
this.point = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the restrictions property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Teleports.Teleport.Restrictions }
|
||||
*
|
||||
*/
|
||||
public Teleports.Teleport.Restrictions getRestrictions() {
|
||||
return restrictions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the restrictions property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Teleports.Teleport.Restrictions }
|
||||
*
|
||||
*/
|
||||
public void setRestrictions(Teleports.Teleport.Restrictions value) {
|
||||
this.restrictions = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the id property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public TeleportationTemplateID getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the id property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setID(TeleportationTemplateID value) {
|
||||
this.id = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the name property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the name property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setName(String value) {
|
||||
this.name = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the item property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Integer }
|
||||
*
|
||||
*/
|
||||
public Integer getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the item property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Integer }
|
||||
*
|
||||
*/
|
||||
public void setItem(Integer value) {
|
||||
this.item = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the price property.
|
||||
*
|
||||
*/
|
||||
public int getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the price property.
|
||||
*
|
||||
*/
|
||||
public void setPrice(int value) {
|
||||
this.price = value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for anonymous complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="restriction" maxOccurs="unbounded">
|
||||
* <simpleType>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
|
||||
* <enumeration value="NOBLE"/>
|
||||
* </restriction>
|
||||
* </simpleType>
|
||||
* </element>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "", propOrder = {
|
||||
"restriction"
|
||||
})
|
||||
public static class Restrictions {
|
||||
|
||||
@XmlElement(required = true)
|
||||
protected List<String> restriction;
|
||||
|
||||
/**
|
||||
* Gets the value of the restriction property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the restriction property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getRestriction().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link String }
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<String> getRestriction() {
|
||||
if (restriction == null) {
|
||||
restriction = new ArrayList<String>();
|
||||
}
|
||||
return this.restriction;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2012.01.19 at 03:37:11 PM BRST
|
||||
//
|
||||
|
||||
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for ZoneType complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="ZoneType">
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="point" maxOccurs="unbounded">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* </sequence>
|
||||
* <attribute name="x" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* <attribute name="y" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* </sequence>
|
||||
* <attribute name="id" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "ZoneType", namespace = "zones", propOrder = {
|
||||
"point"
|
||||
})
|
||||
public class ZoneType {
|
||||
|
||||
@XmlElement(required = true)
|
||||
protected List<ZoneType.Point> point;
|
||||
@XmlAttribute(name = "id", required = true)
|
||||
protected String id;
|
||||
|
||||
/**
|
||||
* Gets the value of the point property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the point property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getPoint().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link ZoneType.Point }
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<ZoneType.Point> getPoint() {
|
||||
if (point == null) {
|
||||
point = new ArrayList<ZoneType.Point>();
|
||||
}
|
||||
return this.point;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the id property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the id property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setId(String value) {
|
||||
this.id = value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for anonymous complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* </sequence>
|
||||
* <attribute name="x" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* <attribute name="y" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "")
|
||||
public static class Point {
|
||||
|
||||
@XmlAttribute(name = "x", required = true)
|
||||
protected int x;
|
||||
@XmlAttribute(name = "y", required = true)
|
||||
protected int y;
|
||||
|
||||
/**
|
||||
* Gets the value of the x property.
|
||||
*
|
||||
*/
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the x property.
|
||||
*
|
||||
*/
|
||||
public void setX(int value) {
|
||||
this.x = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the y property.
|
||||
*
|
||||
*/
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the y property.
|
||||
*
|
||||
*/
|
||||
public void setY(int value) {
|
||||
this.y = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2012.01.19 at 03:37:11 PM BRST
|
||||
//
|
||||
|
||||
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for anonymous complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="castle">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="siege">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="zone" type="{zones}ZoneType"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "", propOrder = {
|
||||
"castle"
|
||||
})
|
||||
@XmlRootElement(name = "zones", namespace = "zones")
|
||||
public class Zones {
|
||||
|
||||
@XmlElement(required = true)
|
||||
protected Zones.Castle castle;
|
||||
|
||||
/**
|
||||
* Gets the value of the castle property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Zones.Castle }
|
||||
*
|
||||
*/
|
||||
public Zones.Castle getCastle() {
|
||||
return castle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the castle property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Zones.Castle }
|
||||
*
|
||||
*/
|
||||
public void setCastle(Zones.Castle value) {
|
||||
this.castle = value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for anonymous complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="siege">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="zone" type="{zones}ZoneType"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "", propOrder = {
|
||||
"siege"
|
||||
})
|
||||
public static class Castle {
|
||||
|
||||
@XmlElement(required = true)
|
||||
protected Zones.Castle.Siege siege;
|
||||
|
||||
/**
|
||||
* Gets the value of the siege property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Zones.Castle.Siege }
|
||||
*
|
||||
*/
|
||||
public Zones.Castle.Siege getSiege() {
|
||||
return siege;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the siege property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Zones.Castle.Siege }
|
||||
*
|
||||
*/
|
||||
public void setSiege(Zones.Castle.Siege value) {
|
||||
this.siege = value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for anonymous complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="zone" type="{zones}ZoneType"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "", propOrder = {
|
||||
"zone"
|
||||
})
|
||||
public static class Siege {
|
||||
|
||||
@XmlElement(required = true)
|
||||
protected ZoneType zone;
|
||||
|
||||
/**
|
||||
* Gets the value of the zone property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link ZoneType }
|
||||
*
|
||||
*/
|
||||
public ZoneType getZone() {
|
||||
return zone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the zone property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link ZoneType }
|
||||
*
|
||||
*/
|
||||
public void setZone(ZoneType value) {
|
||||
this.zone = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver;
|
||||
|
||||
import com.l2jserver.service.configuration.Configuration;
|
||||
|
||||
/**
|
||||
* General configuration interface
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface GeneralConfiguration extends Configuration {
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver;
|
||||
|
||||
import com.l2jserver.service.network.model.ProtocolVersion;
|
||||
|
||||
|
||||
/**
|
||||
* Constant values for this L2J compilation
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class L2JConstant {
|
||||
/**
|
||||
* Indicate the supported protocol for this compilation.
|
||||
* <p>
|
||||
* This <b>MUST</b> be hard-coded!
|
||||
*/
|
||||
public static final ProtocolVersion SUPPORTED_PROTOCOL = ProtocolVersion.FREYA;
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.apache.log4j.BasicConfigurator;
|
||||
import org.w3c.dom.DOMException;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.l2jserver.model.id.provider.IDProviderModule;
|
||||
import com.l2jserver.service.Service;
|
||||
import com.l2jserver.service.ServiceException;
|
||||
import com.l2jserver.service.ServiceManager;
|
||||
import com.l2jserver.service.ServiceStartException;
|
||||
import com.l2jserver.service.ServiceStopException;
|
||||
import com.l2jserver.service.cache.CacheService;
|
||||
import com.l2jserver.service.configuration.ConfigurationService;
|
||||
import com.l2jserver.service.database.DatabaseService;
|
||||
import com.l2jserver.service.game.character.CharacterService;
|
||||
import com.l2jserver.service.game.character.ShortcutService;
|
||||
import com.l2jserver.service.game.chat.ChatService;
|
||||
import com.l2jserver.service.game.item.ItemService;
|
||||
import com.l2jserver.service.game.map.pathing.PathingService;
|
||||
import com.l2jserver.service.game.npc.NPCService;
|
||||
import com.l2jserver.service.game.scripting.ScriptingService;
|
||||
import com.l2jserver.service.game.template.TemplateService;
|
||||
import com.l2jserver.service.game.world.WorldIDService;
|
||||
import com.l2jserver.service.network.NetworkService;
|
||||
import com.l2jserver.service.network.gameguard.GameGuardService;
|
||||
import com.l2jserver.service.network.keygen.BlowfishKeygenService;
|
||||
|
||||
/**
|
||||
* Main class
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class L2JGameServerMain {
|
||||
/**
|
||||
* List of start services
|
||||
*/
|
||||
private static final Class<?>[][] SERVICES = {
|
||||
// core services
|
||||
{ CacheService.class, ConfigurationService.class,
|
||||
DatabaseService.class, WorldIDService.class,
|
||||
ScriptingService.class, TemplateService.class },
|
||||
// game services
|
||||
{ ChatService.class, NPCService.class, ItemService.class,
|
||||
CharacterService.class, ShortcutService.class,
|
||||
PathingService.class },
|
||||
// network services - should be started at last!
|
||||
{ BlowfishKeygenService.class, GameGuardService.class,
|
||||
NetworkService.class } };
|
||||
|
||||
/**
|
||||
* Main method
|
||||
*
|
||||
* @param args
|
||||
* no arguments are used
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void main(String[] args) {
|
||||
BasicConfigurator.configure();
|
||||
|
||||
final ServiceManager serviceManager = new ServiceManager();
|
||||
try {
|
||||
serviceManager.load(Paths.get("services.xml"));
|
||||
} catch (ClassNotFoundException e) {
|
||||
System.out.println("Service class not found: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
return;
|
||||
} catch (SAXException | DOMException | IOException
|
||||
| ParserConfigurationException e) {
|
||||
System.out.println("Error parsing XML service descriptor");
|
||||
e.printStackTrace();
|
||||
return;
|
||||
} catch (ServiceException e) {
|
||||
System.out.println("Error loading XML service descriptor");
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
try {
|
||||
serviceManager.init(Guice.createInjector(new IDProviderModule(),
|
||||
serviceManager.newGuiceModule()));
|
||||
} catch (ServiceStartException e) {
|
||||
System.out.println("Error stating basic services");
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
for (final Class<?>[] category : SERVICES) {
|
||||
for (final Class<?> service : category) {
|
||||
serviceManager.start((Class<? extends Service>) service);
|
||||
}
|
||||
}
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (final Class<?>[] category : SERVICES) {
|
||||
for (final Class<?> service : category) {
|
||||
try {
|
||||
serviceManager
|
||||
.stop((Class<? extends Service>) service);
|
||||
} catch (ServiceStopException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println("GameServer could not be started!");
|
||||
e.printStackTrace();
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* 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.ai;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.l2jserver.game.ai.desires.Desire;
|
||||
import com.l2jserver.game.ai.desires.DesireQueue;
|
||||
import com.l2jserver.model.world.Actor;
|
||||
import com.l2jserver.service.game.world.WorldService;
|
||||
import com.l2jserver.service.game.world.event.WorldEventDispatcherService;
|
||||
|
||||
/**
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
* @param <T>
|
||||
* the {@link Actor} type for this {@link AI}
|
||||
*/
|
||||
public abstract class AI<T extends Actor> {
|
||||
/**
|
||||
* The desire queue for this AI
|
||||
*/
|
||||
protected DesireQueue desireQueue = new DesireQueue();
|
||||
/**
|
||||
* The actor controlled by this AI
|
||||
*/
|
||||
protected final T actor;
|
||||
|
||||
/**
|
||||
* The {@link WorldService} event dispatcher
|
||||
*/
|
||||
@Inject
|
||||
protected WorldEventDispatcherService eventDispatcher;
|
||||
|
||||
/**
|
||||
* Creates a new AI
|
||||
*
|
||||
* @param actor
|
||||
* the actor controlled by this {@link AI}
|
||||
*/
|
||||
protected AI(T actor) {
|
||||
this.actor = actor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes an AI tick
|
||||
*/
|
||||
protected void tick() {
|
||||
Desire desire = desireQueue.poll();
|
||||
handleDesire(desire);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the given desire
|
||||
*
|
||||
* @param desire
|
||||
* the desire
|
||||
*/
|
||||
protected abstract void handleDesire(Desire desire);
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* 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.ai.desires;
|
||||
|
||||
/**
|
||||
* This class implements basic functionality common for each desire
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
* @see com.l2jserver.game.ai.desires.Desire
|
||||
* @see com.l2jserver.game.ai.desires.DesireQueue
|
||||
* @see com.l2jserver.game.ai.AI
|
||||
* @see com.l2jserver.game.ai.AI#handleDesire(Desire)
|
||||
*/
|
||||
public abstract class AbstractDesire implements Desire {
|
||||
/**
|
||||
* Desire power. It's used to calculate what npc whants to do most of all.
|
||||
*/
|
||||
protected int desirePower;
|
||||
|
||||
/**
|
||||
* Creates new desire. By design any desire should have desire power. So
|
||||
* constructor accepts basic amout.
|
||||
*
|
||||
* @param desirePower
|
||||
* basic amount of desirePower
|
||||
*/
|
||||
protected AbstractDesire(int desirePower) {
|
||||
this.desirePower = desirePower;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares this desire with another, used by
|
||||
* {@link com.l2jserver.game.ai.desires.DesireQueue} to keep track of desire
|
||||
* priorities.
|
||||
*
|
||||
* @param o
|
||||
* desire to compare with
|
||||
* @return result of desire comparation
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(Desire o) {
|
||||
return o.getDesirePower() - getDesirePower();
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized int getDesirePower() {
|
||||
return desirePower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void increaseDesirePower(int desirePower) {
|
||||
this.desirePower = this.desirePower + desirePower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void reduceDesirePower(int desirePower) {
|
||||
this.desirePower = this.desirePower - desirePower;
|
||||
}
|
||||
}
|
||||
@@ -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.game.ai.desires;
|
||||
|
||||
import com.l2jserver.model.world.Actor;
|
||||
|
||||
/**
|
||||
* This class indicates that character wants to attack somebody
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public final class AttackDesire extends AbstractDesire {
|
||||
/**
|
||||
* Target of this desire
|
||||
*/
|
||||
protected final Actor target;
|
||||
|
||||
/**
|
||||
* Creates new attack desire, target can't be changed
|
||||
*
|
||||
* @param target
|
||||
* whom to attack
|
||||
* @param desirePower
|
||||
* initial attack power
|
||||
*/
|
||||
protected AttackDesire(Actor target, int desirePower) {
|
||||
super(desirePower);
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (!(o instanceof AttackDesire))
|
||||
return false;
|
||||
|
||||
AttackDesire that = (AttackDesire) o;
|
||||
|
||||
return target.equals(that.target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return target.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns target of this desire
|
||||
*
|
||||
* @return target of this desire
|
||||
*/
|
||||
public Actor getTarget() {
|
||||
return target;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* 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.ai.desires;
|
||||
|
||||
/**
|
||||
* This interface represents basic desire functions.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
* @see com.l2jserver.game.ai.AI
|
||||
* @see com.l2jserver.game.ai.AI#handleDesire(Desire)
|
||||
* @see com.l2jserver.game.ai.desires.AbstractDesire
|
||||
*/
|
||||
public interface Desire extends Comparable<Desire> {
|
||||
/**
|
||||
* Returns hashcode for this object, must be overrided by child
|
||||
*
|
||||
* @return hashcode for this object
|
||||
*/
|
||||
@Override
|
||||
int hashCode();
|
||||
|
||||
/**
|
||||
* Compares this Desire with another object, must overriden by child
|
||||
*
|
||||
* @param obj
|
||||
* another object to compare with
|
||||
* @return result of object comparation
|
||||
*/
|
||||
@Override
|
||||
boolean equals(Object obj);
|
||||
|
||||
/**
|
||||
* Returns desire power of this object
|
||||
*
|
||||
* @return desire power of the object
|
||||
*/
|
||||
int getDesirePower();
|
||||
|
||||
/**
|
||||
* Adds desire power to this desire, this call is synchronized.<br>
|
||||
* <br>
|
||||
* <b>WARNING!!! Changing desire power after adding it to queue will not
|
||||
* affect it's position, you have to call
|
||||
* {@link com.l2jserver.game.ai.desires.DesireQueue#addDesire(Desire)}
|
||||
* passing this instance as argument</b>
|
||||
*
|
||||
* @param desirePower
|
||||
* amount of desirePower to add
|
||||
* @see DesireQueue#addDesire(Desire)
|
||||
*/
|
||||
void increaseDesirePower(int desirePower);
|
||||
|
||||
/**
|
||||
* Reduces desire power by give amount.<br>
|
||||
* <br>
|
||||
* <b>WARNING!!! Changing desire power after adding it to queue will not
|
||||
* affect it's position, you have to call
|
||||
* {@link com.l2jserver.game.ai.desires.DesireQueue#addDesire(Desire)}
|
||||
* passing this instance as argument</b>
|
||||
*
|
||||
* @param desirePower
|
||||
* amount of desirePower to substract
|
||||
* @see DesireQueue#addDesire(Desire)
|
||||
*/
|
||||
void reduceDesirePower(int desirePower);
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* 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.ai.desires;
|
||||
|
||||
/**
|
||||
* This class represents simple filter for desire iterations.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface DesireIteratorFilter {
|
||||
/**
|
||||
* This method is called each time for every desire that is in the queue.<br>
|
||||
* <br>
|
||||
* {@link java.util.ConcurrentModificationException} will be thrown by
|
||||
* {@link com.l2jserver.game.ai.desires.DesireQueue#iterateDesires(DesireIteratorHandler, DesireIteratorFilter[])}
|
||||
* if any of the following methods will be called from here:
|
||||
* <ul>
|
||||
* <li>{@link com.l2jserver.game.ai.desires.DesireQueue#addDesire(Desire)}</li>
|
||||
* <li>{@link com.l2jserver.game.ai.desires.DesireQueue#poll()}</li>
|
||||
* <li>
|
||||
* {@link com.l2jserver.game.ai.desires.DesireQueue#removeDesire(Desire)}</li>
|
||||
* </ul>
|
||||
* <p/>
|
||||
* However {@link com.l2jserver.game.ai.desires.DesireQueue#clear()} can be
|
||||
* called.
|
||||
*
|
||||
* @param desire
|
||||
* current element of iteration that is beeing filtered
|
||||
* @return true if this filter accepted desire, false otherwise
|
||||
*/
|
||||
public boolean isOk(Desire desire);
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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.ai.desires;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* This class is designed to be a helper class for desires.<br>
|
||||
* Direct access to desire list is not allowed, however this interface can be
|
||||
* used for iteration.<br>
|
||||
* <br>
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
* @see com.l2jserver.game.ai.desires.DesireIteratorFilter
|
||||
* @see com.l2jserver.game.ai.desires.DesireQueue#iterateDesires(DesireIteratorHandler,
|
||||
* DesireIteratorFilter[])
|
||||
*/
|
||||
public interface DesireIteratorHandler {
|
||||
/**
|
||||
* This method is called each time for every desire that is in the queue.<br>
|
||||
* Remove of desire must be handeled by <b>iterator.remove();</b><br>
|
||||
* <br>
|
||||
* {@link java.util.ConcurrentModificationException} will be thrown by
|
||||
* {@link com.l2jserver.game.ai.desires.DesireQueue#iterateDesires(DesireIteratorHandler, DesireIteratorFilter[])}
|
||||
* if any of the following methods will be called from here:
|
||||
* <ul>
|
||||
* <li>{@link com.l2jserver.game.ai.desires.DesireQueue#addDesire(Desire)}</li>
|
||||
* <li>{@link com.l2jserver.game.ai.desires.DesireQueue#poll()}</li>
|
||||
* <li>
|
||||
* {@link com.l2jserver.game.ai.desires.DesireQueue#removeDesire(Desire)}</li>
|
||||
* </ul>
|
||||
* <p/>
|
||||
* However {@link com.l2jserver.game.ai.desires.DesireQueue#clear()} can be
|
||||
* called.
|
||||
*
|
||||
* @param desire
|
||||
* current element of iteration
|
||||
* @param iterator
|
||||
* iterator object
|
||||
*/
|
||||
public void next(Desire desire, Iterator<Desire> iterator);
|
||||
}
|
||||
@@ -0,0 +1,214 @@
|
||||
/*
|
||||
* 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.ai.desires;
|
||||
|
||||
import java.util.ConcurrentModificationException;
|
||||
import java.util.Iterator;
|
||||
import java.util.PriorityQueue;
|
||||
|
||||
import com.l2jserver.util.factory.CollectionFactory;
|
||||
|
||||
/**
|
||||
* This class represents desire queue, it's thread-safe. Desires can be added
|
||||
* and removed. If desire is added - previous desires will be checked, if same
|
||||
* desire found then desire previous one will be removed from the queue
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
* @see com.l2jserver.game.ai.desires.Desire
|
||||
* @see com.l2jserver.game.ai.desires.AbstractDesire
|
||||
*/
|
||||
public class DesireQueue {
|
||||
/**
|
||||
* Prioritized Queue of desires, lazy initialization.
|
||||
*/
|
||||
protected PriorityQueue<Desire> queue;
|
||||
|
||||
/**
|
||||
* Returns first element of this queue not removing it. Returns null if
|
||||
* there is no elements.
|
||||
*
|
||||
* @return first element or null
|
||||
*/
|
||||
public synchronized Desire peek() {
|
||||
return queue != null ? queue.peek() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes first element from the desires list and removes it. Returns null
|
||||
* if there are no elements.
|
||||
*
|
||||
* @return first element from the desires list or null.
|
||||
*/
|
||||
public synchronized Desire poll() {
|
||||
if (queue != null) {
|
||||
return queue.poll();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds desire to the queue.
|
||||
* <p/>
|
||||
* <p/>
|
||||
* When adding object this method checks first for the same object by
|
||||
* {@link AbstractDesire#equals(Object)}, if such object found, next actions
|
||||
* will be done:<br>
|
||||
* <br>
|
||||
* 1). Remove old desire instance from the list.<br>
|
||||
* 2). Check if those desires are same instances by "==".<br>
|
||||
* 3). If they are not the same instances, add desire power from old
|
||||
* instance to new instance, if they are - do nothing.<br>
|
||||
* <br>
|
||||
* After all add new desire instance to the list.
|
||||
*
|
||||
* @param desire
|
||||
* desire instance to add
|
||||
*/
|
||||
public synchronized void addDesire(Desire desire) {
|
||||
// Lazy initialization of desire queue
|
||||
if (queue == null) {
|
||||
queue = CollectionFactory.newPriorityQueue();
|
||||
}
|
||||
|
||||
// Iterate over the list to find similar desires
|
||||
Iterator<Desire> iterator = queue.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Desire iterated = iterator.next();
|
||||
|
||||
// Find similar desires by #equals method, they can be different
|
||||
// instances.
|
||||
if (desire.equals(iterated)) {
|
||||
// Remove the old desire from the list
|
||||
iterator.remove();
|
||||
|
||||
// If current desire instance was not at the list - increase
|
||||
// it's power by the value of another instance power
|
||||
// and after that add it to the list
|
||||
if (desire != iterated) {
|
||||
desire.increaseDesirePower(iterated.getDesirePower());
|
||||
}
|
||||
|
||||
// Break iteration, desire list can't contain two same desires
|
||||
break;
|
||||
}
|
||||
}
|
||||
// finally add desire to the list
|
||||
queue.add(desire);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes desire from this desireQueue. If desire was removed successfully
|
||||
* this method return true, false otherwise
|
||||
*
|
||||
* @param desire
|
||||
* what desire to remove
|
||||
* @return result of desire removal
|
||||
*/
|
||||
public synchronized boolean removeDesire(Desire desire) {
|
||||
return queue != null && queue.remove(desire);
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterates over desires, you have to provide iteration handler and
|
||||
* optionally filters.<br>
|
||||
* <br>
|
||||
* Handlers and filters can't call following methods:
|
||||
* <ul>
|
||||
* <li>{@link #addDesire(Desire)}</li>
|
||||
* <li>{@link #poll()}</li>
|
||||
* <li>{@link #removeDesire(Desire)}</li>
|
||||
* </ul>
|
||||
* <p/>
|
||||
* However, method {@link #clear() can be called}.
|
||||
*
|
||||
* @param handler
|
||||
* DesireIterationhandler that will be called on the iteration
|
||||
* @param filters
|
||||
* optional filters that will prevent passing unneeded desires to
|
||||
* the handler
|
||||
* @throws java.util.ConcurrentModificationException
|
||||
* only if called handler or filter modified this queue
|
||||
* @see com.l2jserver.game.ai.desires.DesireIteratorFilter
|
||||
* @see com.l2jserver.game.ai.desires.DesireIteratorFilter#isOk(Desire)
|
||||
* @see com.l2jserver.game.ai.desires.DesireIteratorHandler
|
||||
* @see com.l2jserver.game.ai.desires.DesireIteratorHandler#next(Desire ,
|
||||
* java.util.Iterator)
|
||||
*/
|
||||
public synchronized void iterateDesires(DesireIteratorHandler handler,
|
||||
DesireIteratorFilter... filters)
|
||||
throws ConcurrentModificationException {
|
||||
|
||||
if (queue == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Iterator<Desire> iterator = queue.iterator();
|
||||
outer: while (iterator.hasNext()) {
|
||||
Desire desire = iterator.next();
|
||||
|
||||
if (filters != null && filters.length > 0) {
|
||||
for (DesireIteratorFilter filter : filters) {
|
||||
if (!filter.isOk(desire)) {
|
||||
continue outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
handler.next(desire, iterator);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this desire list contains same desire. Desires are
|
||||
* compared by {@link AbstractDesire#equals(Object)} method.
|
||||
*
|
||||
* @param desire
|
||||
* what desire to search
|
||||
* @return true if there is equal desire, false in other case.
|
||||
*/
|
||||
public synchronized boolean contains(Desire desire) {
|
||||
return queue.contains(desire);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this NPC has no any desires added
|
||||
*
|
||||
* @return true if this NPC has no any desires added
|
||||
*/
|
||||
public synchronized boolean isEmpty() {
|
||||
return queue == null || queue.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all desires
|
||||
*/
|
||||
public synchronized void clear() {
|
||||
if (queue != null) {
|
||||
queue.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns size of the desire list
|
||||
*
|
||||
* @return size of remaining desires
|
||||
*/
|
||||
public synchronized int size() {
|
||||
return queue == null ? 0 : queue.size();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* 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.ai.desires;
|
||||
|
||||
import com.l2jserver.model.world.Actor;
|
||||
import com.l2jserver.util.geometry.Point3D;
|
||||
|
||||
/**
|
||||
* This class indicates that {@link Actor} wants to move somewhere
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public final class MoveDesire extends AbstractDesire {
|
||||
/**
|
||||
* Target of this desire
|
||||
*/
|
||||
protected final Point3D point;
|
||||
|
||||
/**
|
||||
* Creates new move desire. Target can't be changed
|
||||
*
|
||||
* @param point
|
||||
* where to move
|
||||
* @param desirePower
|
||||
* initial attack power
|
||||
*/
|
||||
protected MoveDesire(Point3D point, int desirePower) {
|
||||
super(desirePower);
|
||||
this.point = point;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (!(o instanceof MoveDesire))
|
||||
return false;
|
||||
|
||||
MoveDesire that = (MoveDesire) o;
|
||||
|
||||
return point.equals(that.point);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return point.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns target of this desire
|
||||
*
|
||||
* @return target of this desire
|
||||
*/
|
||||
public Point3D getTarget() {
|
||||
return point;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jserver.model.id.AccountID;
|
||||
import com.l2jserver.model.id.object.CharacterID;
|
||||
import com.l2jserver.model.world.Clan;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.service.database.DataAccessObject;
|
||||
|
||||
/**
|
||||
* The {@link CharacterDAO} is can load and save {@link Character character
|
||||
* instances} .
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface CharacterDAO extends
|
||||
DataAccessObject<L2Character, CharacterID> {
|
||||
/**
|
||||
* Load the members of the given <tt>clan</tt>
|
||||
*
|
||||
* @param clan
|
||||
* the clan
|
||||
*/
|
||||
void load(Clan clan);
|
||||
|
||||
/**
|
||||
* Select an character by its name.
|
||||
*
|
||||
* @param name
|
||||
* the character name
|
||||
* @return the found character. Null if does not exists.
|
||||
*/
|
||||
L2Character selectByName(String name);
|
||||
|
||||
/**
|
||||
* Select an character by its name.
|
||||
*
|
||||
* @param account
|
||||
* the account id
|
||||
* @return the found characters. An empty list if this account has no
|
||||
* characters.
|
||||
*/
|
||||
List<L2Character> selectByAccount(AccountID account);
|
||||
|
||||
/**
|
||||
* Counts the amount of characters for an given <code>account</code>.
|
||||
*
|
||||
* @param account
|
||||
* the account id
|
||||
* @return the number of characters for that <code>account</code>
|
||||
*/
|
||||
int countByAccount(AccountID account);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.dao;
|
||||
|
||||
import com.l2jserver.model.game.CharacterFriend;
|
||||
import com.l2jserver.model.id.FriendID;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.character.CharacterFriendList;
|
||||
import com.l2jserver.service.cache.IgnoreCaching;
|
||||
import com.l2jserver.service.database.DataAccessObject;
|
||||
|
||||
/**
|
||||
* The {@link CharacterFriendDAO} is can load and save
|
||||
* {@link CharacterFriendList character friend list}.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface CharacterFriendDAO extends
|
||||
DataAccessObject<CharacterFriend, FriendID> {
|
||||
/**
|
||||
* Load the friend list for character represented by <tt>character</tt> from
|
||||
* the database
|
||||
*
|
||||
* @param character
|
||||
* the character
|
||||
*/
|
||||
void load(L2Character character);
|
||||
|
||||
/**
|
||||
* Save the instance to the database. If a new database entry was created
|
||||
* returns true.
|
||||
*
|
||||
* @param friends
|
||||
* the friend list
|
||||
* @return true if created a new entry in database (i.e. insert), false if
|
||||
* not created (i.e. update)
|
||||
*/
|
||||
@IgnoreCaching
|
||||
boolean save(CharacterFriendList friends);
|
||||
|
||||
/**
|
||||
* Delete an entire friend list
|
||||
*
|
||||
* @param friends
|
||||
* the friend list
|
||||
* @return true if at least 1 item was removed
|
||||
*/
|
||||
boolean delete(CharacterFriendList friends);
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jserver.model.game.CharacterShortcut;
|
||||
import com.l2jserver.model.id.CharacterShortcutID;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.character.CharacterFriendList;
|
||||
import com.l2jserver.service.database.DataAccessObject;
|
||||
|
||||
/**
|
||||
* The {@link CharacterShortcutDAO} is can load and save
|
||||
* {@link CharacterFriendList character friend list}.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface CharacterShortcutDAO extends
|
||||
DataAccessObject<CharacterShortcut, CharacterShortcutID> {
|
||||
/**
|
||||
* Loads the shortcuts at the list fors <tt>character</tt> from the database
|
||||
*
|
||||
* @param character
|
||||
* the character
|
||||
* @return all shortcuts from the given character
|
||||
*/
|
||||
List<CharacterShortcut> selectByCharacter(L2Character character);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.dao;
|
||||
|
||||
import com.l2jserver.model.id.ChatMessageID;
|
||||
import com.l2jserver.model.server.ChatMessage;
|
||||
import com.l2jserver.service.database.DataAccessObject;
|
||||
|
||||
/**
|
||||
* The {@link ChatMessageDAO} is can load and save {@link ChatMessage chat
|
||||
* messages}.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface ChatMessageDAO extends
|
||||
DataAccessObject<ChatMessage, ChatMessageID> {
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.dao;
|
||||
|
||||
import com.l2jserver.model.id.object.ClanID;
|
||||
import com.l2jserver.model.world.Clan;
|
||||
import com.l2jserver.service.database.DataAccessObject;
|
||||
|
||||
/**
|
||||
* The {@link ClanDAO} is can load and save {@link Clan clan instances}.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface ClanDAO extends DataAccessObject<Clan, ClanID> {
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jserver.model.id.object.ItemID;
|
||||
import com.l2jserver.model.world.Item;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.service.database.DataAccessObject;
|
||||
|
||||
/**
|
||||
* The {@link ItemDAO} is can load and save {@link Character character
|
||||
* instances} .
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface ItemDAO extends DataAccessObject<Item, ItemID> {
|
||||
/**
|
||||
* Load the inventory for an {@link L2Character character}.
|
||||
*
|
||||
* @param character
|
||||
* the character
|
||||
* @return amount list of character items
|
||||
*/
|
||||
List<Item> selectByCharacter(L2Character character);
|
||||
|
||||
/**
|
||||
* Select from the database the items dropped on the ground
|
||||
*
|
||||
* @return an {@link List} of all items on the ground
|
||||
*/
|
||||
List<Item> selectDroppedItems();
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.dao;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jserver.model.id.object.NPCID;
|
||||
import com.l2jserver.model.id.template.NPCTemplateID;
|
||||
import com.l2jserver.model.world.NPC;
|
||||
import com.l2jserver.service.database.DataAccessObject;
|
||||
|
||||
/**
|
||||
* The {@link NPCDAO} is can load and save {@link NPC NPC instances}.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface NPCDAO extends DataAccessObject<NPC, NPCID> {
|
||||
/**
|
||||
* Load all {@link NPC} instances
|
||||
*
|
||||
* @return all NPC instances
|
||||
*/
|
||||
Collection<NPC> loadAll();
|
||||
|
||||
/**
|
||||
* Select an {@link NPC} by its template.
|
||||
*
|
||||
* @param templateID
|
||||
* the npc template id
|
||||
* @return the found NPC. Null if does not exists.
|
||||
*/
|
||||
List<NPC> selectByTemplate(NPCTemplateID templateID);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.dao;
|
||||
|
||||
import com.l2jserver.model.id.object.PetID;
|
||||
import com.l2jserver.model.world.Pet;
|
||||
import com.l2jserver.service.database.DataAccessObject;
|
||||
|
||||
/**
|
||||
* The {@link PetDAO} is can load and save {@link Pet pet instances}.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface PetDAO extends DataAccessObject<Pet, PetID> {
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.game;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.l2jserver.model.AbstractModel;
|
||||
import com.l2jserver.model.id.CastleID;
|
||||
import com.l2jserver.model.id.FortID;
|
||||
import com.l2jserver.model.id.object.CharacterID;
|
||||
|
||||
/**
|
||||
* An fort in Lineage II game world
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class Castle extends AbstractModel<FortID> {
|
||||
/**
|
||||
* The {@link Castle} of which this {@link Castle} belongs to
|
||||
*/
|
||||
private CastleID castleID;
|
||||
/**
|
||||
* The owner (clan leader) of which this {@link Castle} belongs to.
|
||||
*/
|
||||
private CharacterID ownerID;
|
||||
|
||||
/**
|
||||
* The castle name
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* The siege date
|
||||
*/
|
||||
private Date siegeDate;
|
||||
/**
|
||||
* The last time this fort was owned by someone
|
||||
*/
|
||||
private Date lastOwnedTime;
|
||||
|
||||
/**
|
||||
* @return the castleID
|
||||
*/
|
||||
public CastleID getCastleID() {
|
||||
return castleID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param castleID
|
||||
* the castleID to set
|
||||
*/
|
||||
public void setCastleID(CastleID castleID) {
|
||||
desireUpdate();
|
||||
this.castleID = castleID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ownerID
|
||||
*/
|
||||
public CharacterID getOwnerID() {
|
||||
return ownerID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ownerID
|
||||
* the ownerID to set
|
||||
*/
|
||||
public void setOwnerID(CharacterID ownerID) {
|
||||
desireUpdate();
|
||||
this.ownerID = ownerID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
desireUpdate();
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the siegeDate
|
||||
*/
|
||||
public Date getSiegeDate() {
|
||||
return siegeDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param siegeDate
|
||||
* the siegeDate to set
|
||||
*/
|
||||
public void setSiegeDate(Date siegeDate) {
|
||||
desireUpdate();
|
||||
this.siegeDate = siegeDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the lastOwnedTime
|
||||
*/
|
||||
public Date getLastOwnedTime() {
|
||||
return lastOwnedTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param lastOwnedTime
|
||||
* the lastOwnedTime to set
|
||||
*/
|
||||
public void setLastOwnedTime(Date lastOwnedTime) {
|
||||
desireUpdate();
|
||||
this.lastOwnedTime = lastOwnedTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.game;
|
||||
|
||||
import com.l2jserver.model.AbstractModel;
|
||||
import com.l2jserver.model.id.FriendID;
|
||||
import com.l2jserver.model.id.object.CharacterID;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
|
||||
/**
|
||||
* Represents a pair of two {@link CharacterID} whose characters are friends.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterFriend extends AbstractModel<FriendID> {
|
||||
/**
|
||||
* @param id
|
||||
* the friend id
|
||||
*/
|
||||
public CharacterFriend(FriendID id) {
|
||||
this.setID(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the character id
|
||||
*/
|
||||
public CharacterID getCharacterID() {
|
||||
return id.getID1();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the character
|
||||
*/
|
||||
public L2Character getCharacter() {
|
||||
return id.getID1().getObject();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the friend id
|
||||
*/
|
||||
public CharacterID getFriendID() {
|
||||
return id.getID2();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the friend
|
||||
*/
|
||||
public L2Character getFriend() {
|
||||
return id.getID2().getObject();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,383 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.game;
|
||||
|
||||
import com.l2jserver.model.AbstractModel;
|
||||
import com.l2jserver.model.id.CharacterShortcutID;
|
||||
import com.l2jserver.model.id.object.CharacterID;
|
||||
import com.l2jserver.model.id.object.ItemID;
|
||||
import com.l2jserver.model.id.template.SkillTemplateID;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.Pet;
|
||||
|
||||
/**
|
||||
* An shortcut in Lineage II game interface
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterShortcut extends AbstractModel<CharacterShortcutID> {
|
||||
/**
|
||||
* The character id
|
||||
*/
|
||||
private CharacterID characterID;
|
||||
/**
|
||||
* The shortcut skill id (only if <tt>type</tt> is
|
||||
* {@link ShortcutType#SKILL})
|
||||
*/
|
||||
private SkillTemplateID skillID;
|
||||
|
||||
/**
|
||||
* The shortcut item id (only if <tt>type</tt> is {@link ShortcutType#ITEM})
|
||||
*/
|
||||
private ItemID itemID;
|
||||
|
||||
/**
|
||||
* The shortcut slot (0 - 11 = 12 slots/page)
|
||||
*/
|
||||
private int slot;
|
||||
/**
|
||||
* The shortcut page (0-3 = 4 pages)
|
||||
*/
|
||||
private int page;
|
||||
/**
|
||||
* The shortcut type
|
||||
*/
|
||||
private ShortcutType type;
|
||||
|
||||
/**
|
||||
* Enum with all shortcut types supported
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public enum ShortcutType {
|
||||
/**
|
||||
* Item shortcut
|
||||
*/
|
||||
ITEM(1),
|
||||
/**
|
||||
* Skill shortcut
|
||||
*/
|
||||
SKILL(2),
|
||||
/**
|
||||
* Social action shortcut
|
||||
*/
|
||||
ACTION(3),
|
||||
/**
|
||||
* Macro shortcut
|
||||
*/
|
||||
MACRO(4),
|
||||
/**
|
||||
* Recipe shortcut
|
||||
*/
|
||||
RECIPE(5),
|
||||
/**
|
||||
* Bookmark shortcut
|
||||
*/
|
||||
TPBOOKMARK(6);
|
||||
|
||||
/**
|
||||
* The shortcut type id
|
||||
*/
|
||||
public final int id;
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* the numeric id
|
||||
*/
|
||||
ShortcutType(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
* the type id
|
||||
* @return the {@link ShortcutType}
|
||||
*/
|
||||
public static ShortcutType fromID(int id) {
|
||||
for (final ShortcutType shortcut : values()) {
|
||||
if (shortcut.id == id)
|
||||
return shortcut;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The skill level (only if <tt>type</tt> is {@link ShortcutType#SKILL})
|
||||
*/
|
||||
private int level;
|
||||
/**
|
||||
* The kind of actor that this shortcut is attached to
|
||||
*/
|
||||
private ShortcutActorType actorType;
|
||||
|
||||
/**
|
||||
* Enum with all supported actor types
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public enum ShortcutActorType {
|
||||
/**
|
||||
* Shortcut is for an {@link L2Character}
|
||||
*/
|
||||
CHARACTER(1),
|
||||
/**
|
||||
* Shortcut is for an {@link Pet}
|
||||
*/
|
||||
PET(2);
|
||||
|
||||
/**
|
||||
* The shortcut type id
|
||||
*/
|
||||
public final int id;
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* the numeric id
|
||||
*/
|
||||
ShortcutActorType(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
* the type id
|
||||
* @return the {@link ShortcutType}
|
||||
*/
|
||||
public static ShortcutActorType fromID(int id) {
|
||||
for (final ShortcutActorType shortcut : values()) {
|
||||
if (shortcut.id == id)
|
||||
return shortcut;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
*/
|
||||
public CharacterShortcut() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param characterID
|
||||
* the character id
|
||||
*/
|
||||
public CharacterShortcut(CharacterID characterID) {
|
||||
this.characterID = characterID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Item Shortcut
|
||||
*
|
||||
* @param characterID
|
||||
* the character id
|
||||
* @param itemID
|
||||
* the item id
|
||||
* @param actorType
|
||||
* the actor type
|
||||
*/
|
||||
public CharacterShortcut(CharacterID characterID, ItemID itemID,
|
||||
ShortcutActorType actorType) {
|
||||
this.type = ShortcutType.ITEM;
|
||||
this.characterID = characterID;
|
||||
this.itemID = itemID;
|
||||
this.actorType = actorType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Skill Shortcut
|
||||
*
|
||||
* @param characterID
|
||||
* the character id
|
||||
* @param skillID
|
||||
* the skill id
|
||||
* @param level
|
||||
* the skill level
|
||||
* @param actorType
|
||||
* the actor type
|
||||
*/
|
||||
public CharacterShortcut(CharacterID characterID, SkillTemplateID skillID,
|
||||
int level, ShortcutActorType actorType) {
|
||||
this.type = ShortcutType.SKILL;
|
||||
this.characterID = characterID;
|
||||
this.skillID = skillID;
|
||||
this.level = level;
|
||||
this.actorType = actorType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates another type of shortcut
|
||||
*
|
||||
* @param characterID
|
||||
* the character id
|
||||
* @param type
|
||||
* the shortcut type
|
||||
* @param slot
|
||||
* the shortcut slot
|
||||
* @param page
|
||||
* the shortcut page
|
||||
* @param actorType
|
||||
* the actor type
|
||||
*/
|
||||
public CharacterShortcut(CharacterID characterID, ShortcutType type,
|
||||
int slot, int page, ShortcutActorType actorType) {
|
||||
this.characterID = characterID;
|
||||
this.slot = slot;
|
||||
this.page = page;
|
||||
this.type = type;
|
||||
this.actorType = actorType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the character id
|
||||
*/
|
||||
public CharacterID getCharacterID() {
|
||||
return characterID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the character
|
||||
*/
|
||||
public L2Character getCharacter() {
|
||||
return characterID.getObject();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param characterID
|
||||
* the character ID to set
|
||||
*/
|
||||
public void setCharacterID(CharacterID characterID) {
|
||||
this.characterID = characterID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the skillID
|
||||
*/
|
||||
public SkillTemplateID getSkillID() {
|
||||
return skillID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param skillID
|
||||
* the skillID to set
|
||||
*/
|
||||
public void setSkillID(SkillTemplateID skillID) {
|
||||
desireUpdate();
|
||||
this.skillID = skillID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the itemID
|
||||
*/
|
||||
public ItemID getItemID() {
|
||||
return itemID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param itemID
|
||||
* the itemID to set
|
||||
*/
|
||||
public void setItemID(ItemID itemID) {
|
||||
desireUpdate();
|
||||
this.itemID = itemID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the slot
|
||||
*/
|
||||
public int getSlot() {
|
||||
return slot;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param slot
|
||||
* the slot to set
|
||||
*/
|
||||
public void setSlot(int slot) {
|
||||
desireUpdate();
|
||||
this.slot = slot;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the page
|
||||
*/
|
||||
public int getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param page
|
||||
* the page to set
|
||||
*/
|
||||
public void setPage(int page) {
|
||||
desireUpdate();
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the type
|
||||
*/
|
||||
public ShortcutType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type
|
||||
* the type to set
|
||||
*/
|
||||
public void setType(ShortcutType type) {
|
||||
desireUpdate();
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the level
|
||||
*/
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param level
|
||||
* the level to set
|
||||
*/
|
||||
public void setLevel(int level) {
|
||||
desireUpdate();
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the actorType
|
||||
*/
|
||||
public ShortcutActorType getCharacterType() {
|
||||
return actorType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param actorType
|
||||
* the actorType to set
|
||||
*/
|
||||
public void setCharacterType(ShortcutActorType actorType) {
|
||||
desireUpdate();
|
||||
this.actorType = actorType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,230 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.game;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.l2jserver.model.AbstractModel;
|
||||
import com.l2jserver.model.id.CastleID;
|
||||
import com.l2jserver.model.id.FortID;
|
||||
import com.l2jserver.model.id.object.CharacterID;
|
||||
|
||||
/**
|
||||
* An fort in Lineage II game world
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class Fort extends AbstractModel<FortID> {
|
||||
/**
|
||||
* The {@link Castle} of which this {@link Fort} belongs to
|
||||
*/
|
||||
private CastleID castleID;
|
||||
/**
|
||||
* The owner (clan leader) of which this {@link Fort} belongs to.
|
||||
*/
|
||||
private CharacterID ownerID;
|
||||
|
||||
/**
|
||||
* The fort name
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* The siege date
|
||||
*/
|
||||
private Date siegeDate;
|
||||
/**
|
||||
* The last time this fort was owned by someone
|
||||
*/
|
||||
private Date lastOwnedTime;
|
||||
/**
|
||||
* The fort type. TODO values names are unknown so far!
|
||||
*/
|
||||
private FortType fortType;
|
||||
|
||||
/**
|
||||
* The {@link Fort} types
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public enum FortType {
|
||||
/**
|
||||
* Fort type 1
|
||||
*/
|
||||
TYPE1,
|
||||
/**
|
||||
* Fort type 2
|
||||
*/
|
||||
TYPE2;
|
||||
}
|
||||
|
||||
/**
|
||||
* The {@link Fort} state
|
||||
*/
|
||||
private boolean state;
|
||||
/**
|
||||
* The {@link Fort} blood state
|
||||
*/
|
||||
private boolean blood;
|
||||
/**
|
||||
* The {@link Fort} supply level
|
||||
*/
|
||||
private int supplyLvL;
|
||||
|
||||
/**
|
||||
* @return the castleID
|
||||
*/
|
||||
public CastleID getCastleID() {
|
||||
return castleID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param castleID
|
||||
* the castleID to set
|
||||
*/
|
||||
public void setCastleID(CastleID castleID) {
|
||||
desireUpdate();
|
||||
this.castleID = castleID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ownerID
|
||||
*/
|
||||
public CharacterID getOwnerID() {
|
||||
return ownerID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ownerID
|
||||
* the ownerID to set
|
||||
*/
|
||||
public void setOwnerID(CharacterID ownerID) {
|
||||
desireUpdate();
|
||||
this.ownerID = ownerID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
desireUpdate();
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the siegeDate
|
||||
*/
|
||||
public Date getSiegeDate() {
|
||||
return siegeDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param siegeDate
|
||||
* the siegeDate to set
|
||||
*/
|
||||
public void setSiegeDate(Date siegeDate) {
|
||||
desireUpdate();
|
||||
this.siegeDate = siegeDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the lastOwnedTime
|
||||
*/
|
||||
public Date getLastOwnedTime() {
|
||||
return lastOwnedTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param lastOwnedTime
|
||||
* the lastOwnedTime to set
|
||||
*/
|
||||
public void setLastOwnedTime(Date lastOwnedTime) {
|
||||
desireUpdate();
|
||||
this.lastOwnedTime = lastOwnedTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the fortType
|
||||
*/
|
||||
public FortType getFortType() {
|
||||
return fortType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param fortType
|
||||
* the fortType to set
|
||||
*/
|
||||
public void setFortType(FortType fortType) {
|
||||
desireUpdate();
|
||||
this.fortType = fortType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the state
|
||||
*/
|
||||
public boolean isState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param state
|
||||
* the state to set
|
||||
*/
|
||||
public void setState(boolean state) {
|
||||
desireUpdate();
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the blood
|
||||
*/
|
||||
public boolean isBlood() {
|
||||
return blood;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param blood
|
||||
* the blood to set
|
||||
*/
|
||||
public void setBlood(boolean blood) {
|
||||
desireUpdate();
|
||||
this.blood = blood;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the supplyLvL
|
||||
*/
|
||||
public int getSupplyLvL() {
|
||||
return supplyLvL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param supplyLvL
|
||||
* the supplyLvL to set
|
||||
*/
|
||||
public void setSupplyLvL(int supplyLvL) {
|
||||
desireUpdate();
|
||||
this.supplyLvL = supplyLvL;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.game;
|
||||
|
||||
import com.l2jserver.model.AbstractModel;
|
||||
import com.l2jserver.model.id.SkillID;
|
||||
import com.l2jserver.model.id.object.ActorID;
|
||||
import com.l2jserver.model.id.template.SkillTemplateID;
|
||||
import com.l2jserver.model.template.SkillTemplate;
|
||||
import com.l2jserver.model.world.Actor;
|
||||
|
||||
/**
|
||||
* Register the state of a skill known by an {@link Actor}.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class Skill extends AbstractModel<SkillID> {
|
||||
/**
|
||||
* The {@link Skill} template id
|
||||
*/
|
||||
private final SkillTemplateID templateID;
|
||||
/**
|
||||
* The skill level learned
|
||||
*/
|
||||
private int level;
|
||||
|
||||
/**
|
||||
* Creates a new instance in level one
|
||||
*
|
||||
* @param templateID
|
||||
* the {@link SkillTemplateID} instance
|
||||
* @param level
|
||||
* the level of this skill
|
||||
*/
|
||||
public Skill(SkillTemplateID templateID, int level) {
|
||||
this.templateID = templateID;
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance in level one
|
||||
*
|
||||
* @param templateID
|
||||
* the {@link SkillTemplateID} instance
|
||||
*/
|
||||
public Skill(SkillTemplateID templateID) {
|
||||
this(templateID, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if this skill is learned in the maximum level
|
||||
*/
|
||||
public boolean isMaximumLevel() {
|
||||
return level >= getTemplate().getMaximumLevel();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the actorID
|
||||
*/
|
||||
public ActorID<?> getActorID() {
|
||||
return id.getID1();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the actor
|
||||
*/
|
||||
public Actor getActor() {
|
||||
return getActorID().getObject();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the actor ID. Note that this will change the skill ID and because of
|
||||
* this, the ID can only be set once.
|
||||
*
|
||||
* @param actorID
|
||||
* set the actor ID
|
||||
* @see Skill#setID(SkillID)
|
||||
*/
|
||||
public void setActorID(ActorID<?> actorID) {
|
||||
setID(new SkillID(actorID, templateID));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the level
|
||||
*/
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param level
|
||||
* the level to set
|
||||
*/
|
||||
public void setLevel(int level) {
|
||||
desireUpdate();
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the skillTemplateID
|
||||
*/
|
||||
public SkillTemplateID getTemplateID() {
|
||||
return id.getID2();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the skillTemplate
|
||||
*/
|
||||
public SkillTemplate getTemplate() {
|
||||
return getTemplateID().getTemplate();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.model.id.provider.IDProvider;
|
||||
|
||||
/**
|
||||
* Each account is identified by its {@link ID}. This {@link ID} is equal to the
|
||||
* account username or login.
|
||||
* <p>
|
||||
* Please, do not directly instantiate this class, use an {@link IDProvider}
|
||||
* instead.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class AccountID extends ID<String> {
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param login
|
||||
* the login
|
||||
*/
|
||||
@Inject
|
||||
public AccountID(@Assisted String login) {
|
||||
super(login);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.model.game.Castle;
|
||||
import com.l2jserver.model.id.provider.IDProvider;
|
||||
|
||||
/**
|
||||
* Each {@link Castle} is identified by an {@link ID}.
|
||||
* <p>
|
||||
* Please, do not directly instantiate this class, use an {@link IDProvider}
|
||||
* instead.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CastleID extends ID<Integer> {
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param id
|
||||
* the id
|
||||
*/
|
||||
@Inject
|
||||
public CastleID(@Assisted int id) {
|
||||
super(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.model.dao.CharacterShortcutDAO;
|
||||
import com.l2jserver.model.game.CharacterShortcut;
|
||||
import com.l2jserver.model.id.provider.IDProvider;
|
||||
|
||||
/**
|
||||
* Each {@link CharacterShortcut} is identified by an {@link ID}.
|
||||
* <p>
|
||||
* Please, do not directly instantiate this class, use an {@link IDProvider}
|
||||
* instead.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterShortcutID extends
|
||||
AbstractModelID<Integer, CharacterShortcut> {
|
||||
/**
|
||||
* The {@link CharacterShortcutDAO} instance
|
||||
*/
|
||||
private final CharacterShortcutDAO shortcutDao;
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param id
|
||||
* the id
|
||||
* @param shortcutDao the shortcut DAO
|
||||
*/
|
||||
@Inject
|
||||
public CharacterShortcutID(@Assisted int id, CharacterShortcutDAO shortcutDao) {
|
||||
super(id);
|
||||
this.shortcutDao = shortcutDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharacterShortcut getObject() {
|
||||
return shortcutDao.select(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.model.id.provider.IDProvider;
|
||||
import com.l2jserver.model.server.ChatMessage;
|
||||
|
||||
/**
|
||||
* Each {@link ChatMessage} log entry is identified by an {@link ID}.
|
||||
* <p>
|
||||
* Please, do not directly instantiate this class, use an {@link IDProvider}
|
||||
* instead.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class ChatMessageID extends ID<Integer> {
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param id
|
||||
* the id
|
||||
*/
|
||||
@Inject
|
||||
public ChatMessageID(@Assisted int id) {
|
||||
super(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.model.game.Fort;
|
||||
import com.l2jserver.model.id.provider.IDProvider;
|
||||
|
||||
/**
|
||||
* Each {@link Fort} is identified by an {@link ID}.
|
||||
* <p>
|
||||
* Please, do not directly instantiate this class, use an {@link IDProvider}
|
||||
* instead.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class FortID extends AbstractModelID<Integer, Fort> {
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param id
|
||||
* the id
|
||||
*/
|
||||
@Inject
|
||||
public FortID(@Assisted int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fort getObject() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.model.game.CharacterFriend;
|
||||
import com.l2jserver.model.id.compound.AbstractCompoundID;
|
||||
import com.l2jserver.model.id.object.CharacterID;
|
||||
import com.l2jserver.model.id.provider.IDProvider;
|
||||
|
||||
/**
|
||||
* Each {@link CharacterFriend} is identified by an {@link ID}.
|
||||
* <p>
|
||||
* Please, do not directly instantiate this class, use an {@link IDProvider}
|
||||
* instead.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class FriendID extends AbstractCompoundID<CharacterID, CharacterID> {
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param id1
|
||||
* the first id
|
||||
* @param id2
|
||||
* the second id
|
||||
*/
|
||||
@Inject
|
||||
public FriendID(@Assisted("id1") CharacterID id1,
|
||||
@Assisted("id2") CharacterID id2) {
|
||||
super(id1, id2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the character ID
|
||||
*/
|
||||
public CharacterID getCharacterID() {
|
||||
return getID1();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the friend ID
|
||||
*/
|
||||
public CharacterID getFriendID() {
|
||||
return getID2();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id;
|
||||
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.model.id.provider.IDProvider;
|
||||
import com.l2jserver.model.world.WorldObject;
|
||||
|
||||
/**
|
||||
* {@link ObjectID}s cannot be instantiated directly. This must be done through
|
||||
* an {@link IDProvider}. The {@link ObjectID} provides a facility
|
||||
* {@link #getObject() method} that allows easily fetch this object from
|
||||
* database without the need to directly use DAOs.
|
||||
* <p>
|
||||
* Please, do not directly instantiate this class, use an {@link IDProvider}
|
||||
* instead.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*
|
||||
* @param <T>
|
||||
* the {@link WorldObject} type
|
||||
*/
|
||||
public abstract class ObjectID<T extends WorldObject> extends
|
||||
AbstractModelID<Integer, T> {
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param id
|
||||
* the raw id
|
||||
*/
|
||||
protected ObjectID(@Assisted int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link WorldObject} associated with this {@link ID}
|
||||
*
|
||||
* @return the {@link WorldObject} if existent, <tt>null</tt> otherwise
|
||||
*/
|
||||
public abstract T getObject();
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
// this way we generate an unique hash code for all ObjectID and another
|
||||
// ID with same id number will still generate another hash code.
|
||||
result = prime * result + id.hashCode() + ObjectID.class.hashCode();
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
// we have unique id across all objects
|
||||
// accept all subclasses of ObjectID is a requirement
|
||||
if (!(obj instanceof ObjectID))
|
||||
return false;
|
||||
@SuppressWarnings("rawtypes")
|
||||
ObjectID other = (ObjectID) obj;
|
||||
if (other.id != null)
|
||||
return false;
|
||||
if (!id.equals(other.id))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.model.game.CharacterFriend;
|
||||
import com.l2jserver.model.id.compound.AbstractCompoundID;
|
||||
import com.l2jserver.model.id.object.ActorID;
|
||||
import com.l2jserver.model.id.provider.IDProvider;
|
||||
import com.l2jserver.model.id.template.SkillTemplateID;
|
||||
|
||||
/**
|
||||
* Each {@link CharacterFriend} is identified by an {@link ID}.
|
||||
* <p>
|
||||
* Please, do not directly instantiate this class, use an {@link IDProvider}
|
||||
* instead.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class SkillID extends AbstractCompoundID<ActorID<?>, SkillTemplateID> {
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param id1
|
||||
* the actor id
|
||||
* @param id2
|
||||
* the skill template id
|
||||
*/
|
||||
@Inject
|
||||
public SkillID(@Assisted("id1") ActorID<?> id1,
|
||||
@Assisted("id2") SkillTemplateID id2) {
|
||||
super(id1, id2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id;
|
||||
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.SoftReference;
|
||||
|
||||
import com.l2jserver.model.id.provider.IDProvider;
|
||||
import com.l2jserver.model.template.Template;
|
||||
import com.l2jserver.service.game.template.TemplateService;
|
||||
|
||||
/**
|
||||
* Templates IDs, different from {@link ObjectID}s, can be repeated and are
|
||||
* defined in the template class.
|
||||
* <p>
|
||||
* Please, do not directly instantiate this class, use an {@link IDProvider}
|
||||
* instead.
|
||||
*
|
||||
* @param <T>
|
||||
* the template type provided by this {@link TemplateID}
|
||||
* @param <I>
|
||||
* the raw ID type
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public abstract class TemplateID<T extends Template, I> extends ID<I> {
|
||||
/**
|
||||
* The cached template {@link Reference}
|
||||
* <p>
|
||||
* Please, avoid using it directly. Instead use {@link #getTemplate()} to
|
||||
* retrieve the template object, since it will check if the reference is
|
||||
* still valid and if not, will request the template with
|
||||
* {@link TemplateService}.
|
||||
*/
|
||||
private Reference<T> cached;
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param id
|
||||
* the raw id
|
||||
*/
|
||||
public TemplateID(I id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link Template} associated with this {@link ID}
|
||||
*
|
||||
* @return the {@link Template} if existent, <tt>null</tt> otherwise
|
||||
*/
|
||||
public T getTemplate() {
|
||||
if (cached == null || cached.get() == null)
|
||||
cached = createReference(loadTemplate());
|
||||
return cached.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link Template} associated with this {@link ID}
|
||||
*
|
||||
* @return the {@link Template} if existent, <tt>null</tt> otherwise
|
||||
*/
|
||||
protected abstract T loadTemplate();
|
||||
|
||||
/**
|
||||
* Creates a new reference for the given template. TemplateID
|
||||
* implementations can override this method if desired another reference.
|
||||
*
|
||||
* @param template
|
||||
* the template object
|
||||
* @return the newly created {@link Reference}
|
||||
*/
|
||||
protected Reference<T> createReference(T template) {
|
||||
return new SoftReference<T>(template);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.object;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.model.id.ObjectID;
|
||||
import com.l2jserver.model.id.provider.IDProvider;
|
||||
import com.l2jserver.model.world.Actor;
|
||||
|
||||
/**
|
||||
* An {@link ObjectID} instance representing an {@link Actor} object
|
||||
* <p>
|
||||
* Please, do not directly instantiate this class, use an {@link IDProvider}
|
||||
* instead.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
* @param <T>
|
||||
* the actor subclass
|
||||
*/
|
||||
public abstract class ActorID<T extends Actor> extends ObjectID<T> {
|
||||
/**
|
||||
* @param id
|
||||
* the raw id
|
||||
*/
|
||||
@Inject
|
||||
public ActorID(@Assisted int id) {
|
||||
super(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.object;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.model.dao.CharacterDAO;
|
||||
import com.l2jserver.model.id.ObjectID;
|
||||
import com.l2jserver.model.id.provider.IDProvider;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
|
||||
/**
|
||||
* An {@link ObjectID} instance representing an {@link L2Character} object
|
||||
* <p>
|
||||
* Please, do not directly instantiate this class, use an {@link IDProvider}
|
||||
* instead.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public final class CharacterID extends ActorID<L2Character> {
|
||||
/**
|
||||
* Data Access Object (DAO) for characters
|
||||
*/
|
||||
private transient final CharacterDAO characterDao;
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* the raw id
|
||||
* @param characterDao
|
||||
* the character DAO
|
||||
*/
|
||||
@Inject
|
||||
public CharacterID(@Assisted int id, CharacterDAO characterDao) {
|
||||
super(id);
|
||||
this.characterDao = characterDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2Character getObject() {
|
||||
return characterDao.select(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.object;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.model.dao.ClanDAO;
|
||||
import com.l2jserver.model.id.ObjectID;
|
||||
import com.l2jserver.model.id.provider.IDProvider;
|
||||
import com.l2jserver.model.world.Clan;
|
||||
|
||||
/**
|
||||
* An {@link ObjectID} instance representing an {@link Clan} object
|
||||
* <p>
|
||||
* Please, do not directly instantiate this class, use an {@link IDProvider}
|
||||
* instead.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public final class ClanID extends ObjectID<Clan> {
|
||||
/**
|
||||
* Data Access Object (DAO) for clans
|
||||
*/
|
||||
private final ClanDAO clanDao;
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* the raw id
|
||||
* @param clanDao
|
||||
* the clan DAO
|
||||
*/
|
||||
@Inject
|
||||
protected ClanID(@Assisted int id, ClanDAO clanDao) {
|
||||
super(id);
|
||||
this.clanDao = clanDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Clan getObject() {
|
||||
return clanDao.select(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.object;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.model.dao.ItemDAO;
|
||||
import com.l2jserver.model.id.ObjectID;
|
||||
import com.l2jserver.model.id.provider.IDProvider;
|
||||
import com.l2jserver.model.world.Item;
|
||||
|
||||
/**
|
||||
* An {@link ObjectID} instance representing an {@link Item} object
|
||||
* <p>
|
||||
* Please, do not directly instantiate this class, use an {@link IDProvider}
|
||||
* instead.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public final class ItemID extends ObjectID<Item> {
|
||||
/**
|
||||
* Data Access Object (DAO) for items
|
||||
*/
|
||||
private final ItemDAO itemDao;
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* the raw id
|
||||
* @param itemDao
|
||||
* the item DAO
|
||||
*/
|
||||
@Inject
|
||||
protected ItemID(@Assisted int id, ItemDAO itemDao) {
|
||||
super(id);
|
||||
this.itemDao = itemDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getObject() {
|
||||
return itemDao.select(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.object;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.model.dao.NPCDAO;
|
||||
import com.l2jserver.model.id.ObjectID;
|
||||
import com.l2jserver.model.id.provider.IDProvider;
|
||||
import com.l2jserver.model.world.NPC;
|
||||
import com.l2jserver.service.database.DataAccessObject;
|
||||
import com.l2jserver.service.game.world.WorldService;
|
||||
|
||||
/**
|
||||
* An {@link ObjectID} instance representing an {@link NPC} object. Since NPC
|
||||
* instances can be stored in run-time only, the search is performed first in
|
||||
* the {@link WorldService}, if no match is found, search is descended to an
|
||||
* {@link DataAccessObject}.
|
||||
* <p>
|
||||
* <h1>Search order</h1>
|
||||
* <ol>
|
||||
* <li>{@link WorldService}: for run-time only {@link NPC NPCs}, but will also
|
||||
* include all spawned {@link NPC NPCs};</li>
|
||||
* <li>{@link NPCDAO}: for persisted {@link NPC NPCs}. Only for {@link NPC NPCs}
|
||||
* that are not currently spawned in the world.</li>
|
||||
* </ol>
|
||||
* <p>
|
||||
* Please, do not directly instantiate this class, use an {@link IDProvider}
|
||||
* instead.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public final class NPCID extends ActorID<NPC> {
|
||||
/**
|
||||
* {@link WorldService} used to locate objects
|
||||
*/
|
||||
private final WorldService worldService;
|
||||
/**
|
||||
* {@link NPCDAO} used to locate objects if not located first by
|
||||
* {@link WorldService}
|
||||
*/
|
||||
private final NPCDAO npcDao;
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* the raw id
|
||||
* @param worldService
|
||||
* the world service
|
||||
* @param npcDao
|
||||
* the {@link NPC} {@link DataAccessObject DAO}
|
||||
*/
|
||||
@Inject
|
||||
public NPCID(@Assisted int id, WorldService worldService, NPCDAO npcDao) {
|
||||
super(id);
|
||||
this.worldService = worldService;
|
||||
this.npcDao = npcDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getObject() {
|
||||
NPC npc = worldService.find(this);
|
||||
if (npc == null)
|
||||
npc = npcDao.select(this);
|
||||
return npc;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.object;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.l2jserver.model.dao.PetDAO;
|
||||
import com.l2jserver.model.id.ObjectID;
|
||||
import com.l2jserver.model.id.provider.IDProvider;
|
||||
import com.l2jserver.model.world.Pet;
|
||||
|
||||
/**
|
||||
* An {@link ObjectID} instance representing an {@link Pet} object
|
||||
* <p>
|
||||
* Please, do not directly instantiate this class, use an {@link IDProvider}
|
||||
* instead.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public final class PetID extends ActorID<Pet> {
|
||||
/**
|
||||
* Data Access Object (DAO) for pets
|
||||
*/
|
||||
private final PetDAO petDao;
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* the raw id
|
||||
* @param petDao
|
||||
* the pet DAO
|
||||
*/
|
||||
@Inject
|
||||
protected PetID(int id, PetDAO petDao) {
|
||||
super(id);
|
||||
this.petDao = petDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pet getObject() {
|
||||
return petDao.select(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.object.iterator;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import com.l2jserver.model.world.WorldObject;
|
||||
|
||||
/**
|
||||
* This is a simple {@link Iterable} implementation that always return the same
|
||||
* {@link Iterator}.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
* @param <T>
|
||||
* the return object type
|
||||
*/
|
||||
public class WorldObjectIterable<T extends WorldObject> implements Iterable<T> {
|
||||
/**
|
||||
* The {@link Iterator}
|
||||
*/
|
||||
private final Iterator<T> iterator;
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param iterator
|
||||
* the iterator
|
||||
*/
|
||||
public WorldObjectIterable(Iterator<T> iterator) {
|
||||
this.iterator = iterator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<T> iterator() {
|
||||
return iterator;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.object.iterator;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import com.l2jserver.model.id.ObjectID;
|
||||
import com.l2jserver.model.world.WorldObject;
|
||||
import com.l2jserver.util.ArrayIterator;
|
||||
|
||||
/**
|
||||
* This {@link Iterator} will iterate trough another {@link Iterator} which
|
||||
* return {@link ObjectID} instances. For each ID, the
|
||||
* {@link ObjectID#getObject()} method will be called and its result will be
|
||||
* returned.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
* @param <T>
|
||||
* the object type
|
||||
*/
|
||||
public class WorldObjectIterator<T extends WorldObject> implements Iterator<T> {
|
||||
/**
|
||||
* The {@link ObjectID} iterator
|
||||
*/
|
||||
private final Iterator<? extends ObjectID<T>> ids;
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param ids
|
||||
* the {@link ObjectID} var-arg
|
||||
*/
|
||||
@SafeVarargs
|
||||
public WorldObjectIterator(ObjectID<T>... ids) {
|
||||
this(new ArrayIterator<ObjectID<T>>(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param ids
|
||||
* the {@link ObjectID} iterator
|
||||
*/
|
||||
public WorldObjectIterator(Iterator<? extends ObjectID<T>> ids) {
|
||||
this.ids = ids;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return ids.hasNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public T next() {
|
||||
return ids.next().getObject();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
ids.remove();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.object.provider;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.model.id.object.CharacterID;
|
||||
import com.l2jserver.model.id.object.allocator.IDAllocator;
|
||||
import com.l2jserver.model.id.provider.IDProvider;
|
||||
import com.l2jserver.service.game.world.WorldIDService;
|
||||
|
||||
/**
|
||||
* {@link IDProvider} for {@link CharacterID}.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterIDProvider implements ObjectIDProvider<CharacterID> {
|
||||
/**
|
||||
* The ID allocator
|
||||
*/
|
||||
private final IDAllocator allocator;
|
||||
/**
|
||||
* The {@link WorldIDService} instance. Used to locate existing IDs.
|
||||
*/
|
||||
private final WorldIDService idService;
|
||||
/**
|
||||
* The Guice Factory
|
||||
*/
|
||||
private final CharacterIDGuiceFactory factory;
|
||||
|
||||
/**
|
||||
* @param allocator
|
||||
* the id allocator
|
||||
* @param idService
|
||||
* the world id service
|
||||
* @param factory
|
||||
* the character id factory
|
||||
*/
|
||||
@Inject
|
||||
public CharacterIDProvider(IDAllocator allocator, WorldIDService idService,
|
||||
CharacterIDGuiceFactory factory) {
|
||||
this.allocator = allocator;
|
||||
this.idService = idService;
|
||||
this.factory = factory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharacterID createID() {
|
||||
final CharacterID id = factory.create(allocator.allocate());
|
||||
idService.add(id);
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharacterID resolveID(Integer id) {
|
||||
CharacterID idObject = idService.resolve(id);
|
||||
if (idObject == null) {
|
||||
idObject = factory.create(id);
|
||||
idService.add(idObject);
|
||||
}
|
||||
return idObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy(CharacterID id) {
|
||||
idService.remove(id);
|
||||
allocator.release(id.getID());
|
||||
}
|
||||
|
||||
/**
|
||||
* This is an Google Guice factory. Assistect Inject extension will
|
||||
* automatically implement it and create the injected instances.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface CharacterIDGuiceFactory {
|
||||
/**
|
||||
* Creates a new ID instance
|
||||
*
|
||||
* @param id
|
||||
* the numeric ID
|
||||
* @return the new ID created by injection
|
||||
*/
|
||||
CharacterID create(@Assisted int id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.object.provider;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.model.id.object.ClanID;
|
||||
import com.l2jserver.model.id.object.allocator.IDAllocator;
|
||||
import com.l2jserver.model.id.provider.IDProvider;
|
||||
import com.l2jserver.service.game.world.WorldIDService;
|
||||
|
||||
/**
|
||||
* {@link IDProvider} for {@link ClanID}.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class ClanIDProvider implements ObjectIDProvider<ClanID> {
|
||||
/**
|
||||
* The ID allocator
|
||||
*/
|
||||
private final IDAllocator allocator;
|
||||
/**
|
||||
* The {@link WorldIDService}
|
||||
*/
|
||||
private final WorldIDService idService;
|
||||
/**
|
||||
* The Guice factory
|
||||
*/
|
||||
private final ClanIDGuiceFactory factory;
|
||||
|
||||
/**
|
||||
* @param allocator
|
||||
* the id allocator
|
||||
* @param idService
|
||||
* the world id service
|
||||
* @param factory
|
||||
* the clan id factory
|
||||
*/
|
||||
@Inject
|
||||
public ClanIDProvider(IDAllocator allocator, WorldIDService idService,
|
||||
ClanIDGuiceFactory factory) {
|
||||
super();
|
||||
this.allocator = allocator;
|
||||
this.idService = idService;
|
||||
this.factory = factory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClanID createID() {
|
||||
final ClanID id = factory.create(allocator.allocate());
|
||||
idService.add(id);
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClanID resolveID(Integer id) {
|
||||
ClanID idObject = idService.resolve(id);
|
||||
if (idObject == null) {
|
||||
idObject = factory.create(id);
|
||||
idService.add(idObject);
|
||||
}
|
||||
return idObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy(ClanID id) {
|
||||
idService.remove(id);
|
||||
allocator.release(id.getID());
|
||||
}
|
||||
|
||||
/**
|
||||
* This is an Google Guice factory. Assistect Inject extension will
|
||||
* automatically implement it and create the injected instances.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface ClanIDGuiceFactory {
|
||||
/**
|
||||
* Creates a new ID instance
|
||||
*
|
||||
* @param id
|
||||
* the numeric ID
|
||||
* @return the new ID created by injection
|
||||
*/
|
||||
ClanID create(@Assisted int id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.object.provider;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.model.id.object.ItemID;
|
||||
import com.l2jserver.model.id.object.allocator.IDAllocator;
|
||||
import com.l2jserver.model.id.provider.IDProvider;
|
||||
import com.l2jserver.service.game.world.WorldIDService;
|
||||
|
||||
/**
|
||||
* {@link IDProvider} for {@link ItemID}.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class ItemIDProvider implements ObjectIDProvider<ItemID> {
|
||||
/**
|
||||
* The ID allocator
|
||||
*/
|
||||
private final IDAllocator allocator;
|
||||
/**
|
||||
* The {@link WorldIDService}
|
||||
*/
|
||||
private final WorldIDService idService;
|
||||
/**
|
||||
* The Guice factory
|
||||
*/
|
||||
private final ItemIDGuiceFactory factory;
|
||||
|
||||
/**
|
||||
* @param allocator
|
||||
* the id allocator
|
||||
* @param idService
|
||||
* the world id service
|
||||
* @param factory
|
||||
* the item id factory
|
||||
*/
|
||||
@Inject
|
||||
public ItemIDProvider(IDAllocator allocator, WorldIDService idService,
|
||||
ItemIDGuiceFactory factory) {
|
||||
super();
|
||||
this.allocator = allocator;
|
||||
this.idService = idService;
|
||||
this.factory = factory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemID createID() {
|
||||
final ItemID id = factory.create(allocator.allocate());
|
||||
idService.add(id);
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemID resolveID(Integer id) {
|
||||
ItemID idObject = idService.resolve(id);
|
||||
if (idObject == null) {
|
||||
idObject = factory.create(id);
|
||||
idService.add(idObject);
|
||||
}
|
||||
return idObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy(ItemID id) {
|
||||
idService.remove(id);
|
||||
allocator.release(id.getID());
|
||||
}
|
||||
|
||||
/**
|
||||
* This is an Google Guice factory. Assistect Inject extension will
|
||||
* automatically implement it and create the injected instances.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface ItemIDGuiceFactory {
|
||||
/**
|
||||
* Creates a new ID instance
|
||||
*
|
||||
* @param id
|
||||
* the numeric ID
|
||||
* @return the new ID created by injection
|
||||
*/
|
||||
ItemID create(@Assisted int id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.object.provider;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.model.id.object.NPCID;
|
||||
import com.l2jserver.model.id.object.allocator.IDAllocator;
|
||||
import com.l2jserver.model.id.provider.IDProvider;
|
||||
import com.l2jserver.service.game.world.WorldIDService;
|
||||
|
||||
/**
|
||||
* {@link IDProvider} for {@link NPCID}.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class NPCIDProvider implements ObjectIDProvider<NPCID> {
|
||||
/**
|
||||
* The ID allocator
|
||||
*/
|
||||
private final IDAllocator allocator;
|
||||
/**
|
||||
* The {@link WorldIDService} instance. Used to locate existing IDs.
|
||||
*/
|
||||
private final WorldIDService idService;
|
||||
/**
|
||||
* The Guice Factory
|
||||
*/
|
||||
private final NPCIDGuiceFactory factory;
|
||||
|
||||
/**
|
||||
* @param allocator
|
||||
* the id allocator
|
||||
* @param idService
|
||||
* the world id service
|
||||
* @param factory
|
||||
* the npc id factory
|
||||
*/
|
||||
@Inject
|
||||
public NPCIDProvider(IDAllocator allocator, WorldIDService idService,
|
||||
NPCIDGuiceFactory factory) {
|
||||
this.allocator = allocator;
|
||||
this.idService = idService;
|
||||
this.factory = factory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPCID createID() {
|
||||
final NPCID id = factory.create(allocator.allocate());
|
||||
idService.add(id);
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPCID resolveID(Integer id) {
|
||||
NPCID idObject = idService.resolve(id);
|
||||
if (idObject == null) {
|
||||
idObject = factory.create(id);
|
||||
idService.add(idObject);
|
||||
}
|
||||
return idObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy(NPCID id) {
|
||||
idService.remove(id);
|
||||
allocator.release(id.getID());
|
||||
}
|
||||
|
||||
/**
|
||||
* This is an Google Guice factory. Assistect Inject extension will
|
||||
* automatically implement it and create the injected instances.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface NPCIDGuiceFactory {
|
||||
/**
|
||||
* Creates a new ID instance
|
||||
*
|
||||
* @param id
|
||||
* the numeric ID
|
||||
* @return the new ID created by injection
|
||||
*/
|
||||
NPCID create(@Assisted int id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.object.provider;
|
||||
|
||||
import com.l2jserver.model.id.ObjectID;
|
||||
import com.l2jserver.model.id.provider.IDProvider;
|
||||
|
||||
/**
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*
|
||||
* @param <T>
|
||||
* the ID type provided
|
||||
*/
|
||||
public interface ObjectIDProvider<T extends ObjectID<?>> extends
|
||||
IDProvider<Integer, T> {
|
||||
/**
|
||||
* Generates a new ID
|
||||
*
|
||||
* @return the new ID
|
||||
*/
|
||||
T createID();
|
||||
|
||||
/**
|
||||
* Destroy this ID. Releases this value to be used once again.
|
||||
*
|
||||
* @param id
|
||||
* the id to be destroyed.
|
||||
*/
|
||||
void destroy(T id);
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.object.provider;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.l2jserver.model.id.ObjectID;
|
||||
import com.l2jserver.model.id.object.ActorID;
|
||||
import com.l2jserver.model.id.object.CharacterID;
|
||||
import com.l2jserver.model.id.object.NPCID;
|
||||
import com.l2jserver.service.game.world.WorldIDService;
|
||||
|
||||
/**
|
||||
* <b>THIS PROVIDER IS READ ONLY!</b>
|
||||
* <p>
|
||||
* This is an ID resolver that will lookup for <b>existing</b> IDs in
|
||||
* {@link WorldIDService}. Since this is only a resolver, only read operations
|
||||
* can be performed. Methods {@link #createID()} and {@link #destroy(ObjectID)}
|
||||
* will throw {@link UnsupportedOperationException}.
|
||||
* <p>
|
||||
* Another important aspect is that in {@link #resolveID(Integer)} if the ID is
|
||||
* not found, it will <b>NOT</b> create it, instead <tt>null</tt> will be
|
||||
* returned. You must use specific a {@link ObjectIDProvider} for that.
|
||||
* <p>
|
||||
* <h1>Use case</h1>
|
||||
* You should only use this class if you don't know which {@link ObjectID} to
|
||||
* expect or you are expecting multiple types (like {@link CharacterID} or
|
||||
* {@link NPCID} both of them extend {@link ActorID}).
|
||||
* <p>
|
||||
* <h1>Type safe notice</h1>
|
||||
* All IDs returned by this class are {@link ObjectID}. However sub-types cannot
|
||||
* be ensured and you must check them manually in order to avoid unneeded
|
||||
* {@link ClassCastException}. Even if you are sure that an given
|
||||
* {@link ObjectID} is from an certain sub-type, do not assume that it will be
|
||||
* always and do an checking.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class ObjectIDResolver implements ObjectIDProvider<ObjectID<?>> {
|
||||
/**
|
||||
* The {@link WorldIDService}
|
||||
*/
|
||||
private final WorldIDService idService;
|
||||
|
||||
/**
|
||||
* @param idService
|
||||
* the world id service
|
||||
*/
|
||||
@Inject
|
||||
public ObjectIDResolver(WorldIDService idService) {
|
||||
this.idService = idService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolvers do not support creating new IDs
|
||||
*
|
||||
* @throws UnsupportedOperationException
|
||||
* always
|
||||
*/
|
||||
@Override
|
||||
public ObjectID<?> createID() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectID<?> resolveID(Integer id) {
|
||||
return idService.resolve(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves an integer ID to an {@link ObjectID}. If the ID does not exists
|
||||
* <tt>null</tt> is returned.
|
||||
*
|
||||
* @param <T>
|
||||
* the ID type
|
||||
* @param id
|
||||
* the id
|
||||
* @return the id found, null if non existent
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends ObjectID<?>> T resolve(Integer id) {
|
||||
return (T) resolveID(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolvers do not support destroying IDs
|
||||
*
|
||||
* @throws UnsupportedOperationException
|
||||
* always
|
||||
*/
|
||||
@Override
|
||||
public void destroy(ObjectID<?> id) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.object.provider;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.model.id.object.PetID;
|
||||
import com.l2jserver.model.id.object.allocator.IDAllocator;
|
||||
import com.l2jserver.model.id.provider.IDProvider;
|
||||
import com.l2jserver.service.game.world.WorldIDService;
|
||||
|
||||
/**
|
||||
* {@link IDProvider} for {@link PetID}.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class PetIDProvider implements ObjectIDProvider<PetID> {
|
||||
/**
|
||||
* The ID allocator
|
||||
*/
|
||||
private final IDAllocator allocator;
|
||||
/**
|
||||
* The {@link WorldIDService}
|
||||
*/
|
||||
private final WorldIDService idService;
|
||||
/**
|
||||
* The Guice factory
|
||||
*/
|
||||
private final PetIDGuiceFactory factory;
|
||||
|
||||
/**
|
||||
* @param allocator
|
||||
* the id allocator
|
||||
* @param idService
|
||||
* the world id service
|
||||
* @param factory
|
||||
* the pet id factory
|
||||
*/
|
||||
@Inject
|
||||
public PetIDProvider(IDAllocator allocator, WorldIDService idService,
|
||||
PetIDGuiceFactory factory) {
|
||||
super();
|
||||
this.allocator = allocator;
|
||||
this.idService = idService;
|
||||
this.factory = factory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PetID createID() {
|
||||
final PetID id = factory.create(allocator.allocate());
|
||||
idService.add(id);
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PetID resolveID(Integer id) {
|
||||
PetID idObject = idService.resolve(id);
|
||||
if (idObject == null) {
|
||||
idObject = factory.create(id);
|
||||
idService.add(idObject);
|
||||
}
|
||||
return idObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy(PetID id) {
|
||||
idService.remove(id);
|
||||
allocator.release(id.getID());
|
||||
}
|
||||
|
||||
/**
|
||||
* This is an Google Guice factory. Assistect Inject extension will
|
||||
* automatically implement it and create the injected instances.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface PetIDGuiceFactory {
|
||||
/**
|
||||
* Creates a new ID instance
|
||||
*
|
||||
* @param id
|
||||
* the numeric ID
|
||||
* @return the new ID created by injection
|
||||
*/
|
||||
PetID create(@Assisted int id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.provider;
|
||||
|
||||
import com.l2jserver.model.id.AccountID;
|
||||
|
||||
/**
|
||||
* Creates a new {@link AccountID}
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface AccountIDProvider extends IDProvider<String, AccountID> {
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.provider;
|
||||
|
||||
import com.l2jserver.model.id.CastleID;
|
||||
|
||||
/**
|
||||
* Creates a new {@link CastleID}
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface CastleIDProvider extends IDProvider<Integer, CastleID> {
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.provider;
|
||||
|
||||
import com.l2jserver.model.id.CastleID;
|
||||
import com.l2jserver.model.id.CharacterShortcutID;
|
||||
|
||||
/**
|
||||
* Creates a new {@link CastleID}
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface CharacterShortcutIDProvider extends
|
||||
IDProvider<Integer, CharacterShortcutID> {
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.provider;
|
||||
|
||||
import com.l2jserver.model.id.ChatMessageID;
|
||||
|
||||
/**
|
||||
* Creates a new {@link ChatMessageID}
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface ChatMessageIDProvider extends
|
||||
IDProvider<Integer, ChatMessageID> {
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.provider;
|
||||
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.model.id.ID;
|
||||
import com.l2jserver.model.id.compound.AbstractCompoundID;
|
||||
|
||||
/**
|
||||
* The ID factory is used to create instances of IDs. It will automatically make
|
||||
* sure the ID is free before allocating it.
|
||||
*
|
||||
* @param <I1>
|
||||
* the first compound {@link ID} type
|
||||
* @param <I2>
|
||||
* the second compound {@link ID} type
|
||||
* @param <T>
|
||||
* the {@link CompoundIDProvider} type
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface CompoundIDProvider<I1 extends ID<?>, I2 extends ID<?>, T extends AbstractCompoundID<I1, I2>> {
|
||||
/**
|
||||
* Creates the ID object for an <b>EXISTING</b> ID.
|
||||
*
|
||||
* @param id1
|
||||
* the first id
|
||||
* @param id2
|
||||
* the second id
|
||||
* @return the created compound {@link ID}
|
||||
*/
|
||||
T createID(@Assisted("id1") I1 id1, @Assisted("id2") I2 id2);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.provider;
|
||||
|
||||
import com.l2jserver.model.id.FortID;
|
||||
|
||||
/**
|
||||
* Creates a new {@link FortID}
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface FortIDProvider extends IDProvider<Integer, FortID> {
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.provider;
|
||||
|
||||
import com.l2jserver.model.id.FriendID;
|
||||
import com.l2jserver.model.id.object.CharacterID;
|
||||
|
||||
/**
|
||||
* Creates a new {@link FriendID}
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface FriendIDProvider extends
|
||||
CompoundIDProvider<CharacterID, CharacterID, FriendID> {
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.provider;
|
||||
|
||||
import com.l2jserver.model.id.ID;
|
||||
|
||||
/**
|
||||
* ID objects should never be directly instantiated and an provider
|
||||
* implementation must be used to create and generate them.
|
||||
* <p>
|
||||
*
|
||||
* The ID provider is used to create instances of IDs. It will automatically
|
||||
* make sure the ID is free before allocating it.
|
||||
* <p>
|
||||
* The provider will also make sure only a single instance for each raw ID
|
||||
* exits, that is for any given ID instance for raw value <b>1</b> only a single
|
||||
* object will be created and following calls will always return the same
|
||||
* object.
|
||||
*
|
||||
* @param <I>
|
||||
* the raw id type
|
||||
* @param <T>
|
||||
* the {@link ID} implementation
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface IDProvider<I, T extends ID<I>> {
|
||||
/**
|
||||
* Creates the ID object for an <b>EXISTING</b> ID.
|
||||
*
|
||||
* @param id
|
||||
* the raw id value
|
||||
* @return the resolved {@link ID} object
|
||||
*/
|
||||
T resolveID(I id);
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.provider;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Module;
|
||||
import com.google.inject.Scopes;
|
||||
import com.google.inject.assistedinject.FactoryModuleBuilder;
|
||||
import com.l2jserver.model.id.object.allocator.BitSetIDAllocator;
|
||||
import com.l2jserver.model.id.object.allocator.IDAllocator;
|
||||
import com.l2jserver.model.id.object.provider.CharacterIDProvider;
|
||||
import com.l2jserver.model.id.object.provider.CharacterIDProvider.CharacterIDGuiceFactory;
|
||||
import com.l2jserver.model.id.object.provider.ClanIDProvider;
|
||||
import com.l2jserver.model.id.object.provider.ClanIDProvider.ClanIDGuiceFactory;
|
||||
import com.l2jserver.model.id.object.provider.ItemIDProvider;
|
||||
import com.l2jserver.model.id.object.provider.ItemIDProvider.ItemIDGuiceFactory;
|
||||
import com.l2jserver.model.id.object.provider.NPCIDProvider;
|
||||
import com.l2jserver.model.id.object.provider.NPCIDProvider.NPCIDGuiceFactory;
|
||||
import com.l2jserver.model.id.object.provider.ObjectIDResolver;
|
||||
import com.l2jserver.model.id.template.provider.CharacterTemplateIDProvider;
|
||||
import com.l2jserver.model.id.template.provider.ItemTemplateIDProvider;
|
||||
import com.l2jserver.model.id.template.provider.NPCTemplateIDProvider;
|
||||
import com.l2jserver.model.id.template.provider.SkillTemplateIDProvider;
|
||||
import com.l2jserver.model.id.template.provider.TeleportationTemplateIDProvider;
|
||||
|
||||
/**
|
||||
* Google Guice {@link IDProvider} {@link Module}
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class IDProviderModule extends AbstractModule {
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(IDAllocator.class).to(BitSetIDAllocator.class)
|
||||
.in(Scopes.SINGLETON);
|
||||
|
||||
// OBJECT IDS
|
||||
bind(ObjectIDResolver.class).in(Scopes.SINGLETON); // read-only!
|
||||
|
||||
bind(CharacterIDProvider.class).in(Scopes.SINGLETON);
|
||||
install(new FactoryModuleBuilder().build(CharacterIDGuiceFactory.class));
|
||||
|
||||
bind(NPCIDProvider.class).in(Scopes.SINGLETON);
|
||||
install(new FactoryModuleBuilder().build(NPCIDGuiceFactory.class));
|
||||
|
||||
bind(ItemIDProvider.class).in(Scopes.SINGLETON);
|
||||
install(new FactoryModuleBuilder().build(ItemIDGuiceFactory.class));
|
||||
|
||||
bind(ClanIDProvider.class).in(Scopes.SINGLETON);
|
||||
install(new FactoryModuleBuilder().build(ClanIDGuiceFactory.class));
|
||||
|
||||
// bind(PetIDFactory.class).in(Scopes.SINGLETON);
|
||||
// install(new FactoryModuleBuilder().build(PetIDGuiceFactory.class));
|
||||
|
||||
// MISC OBJECTS
|
||||
install(new FactoryModuleBuilder().build(AccountIDProvider.class));
|
||||
install(new FactoryModuleBuilder()
|
||||
.build(CharacterShortcutIDProvider.class));
|
||||
install(new FactoryModuleBuilder().build(FortIDProvider.class));
|
||||
install(new FactoryModuleBuilder().build(FriendIDProvider.class));
|
||||
install(new FactoryModuleBuilder().build(ChatMessageIDProvider.class));
|
||||
|
||||
// TEMPLATE IDS
|
||||
install(new FactoryModuleBuilder().build(ItemTemplateIDProvider.class));
|
||||
install(new FactoryModuleBuilder().build(SkillTemplateIDProvider.class));
|
||||
install(new FactoryModuleBuilder()
|
||||
.build(CharacterTemplateIDProvider.class));
|
||||
install(new FactoryModuleBuilder().build(NPCTemplateIDProvider.class));
|
||||
install(new FactoryModuleBuilder()
|
||||
.build(TeleportationTemplateIDProvider.class));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.template;
|
||||
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.model.id.TemplateID;
|
||||
import com.l2jserver.model.template.ActorTemplate;
|
||||
import com.l2jserver.service.game.template.TemplateService;
|
||||
|
||||
/**
|
||||
* An {@link TemplateID} instance representing an {@link ActorTemplate} object
|
||||
*
|
||||
* @param <T>
|
||||
* the type of {@link ActorTemplate} this {@link TemplateID}
|
||||
* represents
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class ActorTemplateID<T extends ActorTemplate> extends
|
||||
TemplateID<T, Integer> {
|
||||
/**
|
||||
* The template service
|
||||
*/
|
||||
private transient final TemplateService templateService;
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* the raw id
|
||||
* @param templateService
|
||||
* the template service
|
||||
*/
|
||||
@Inject
|
||||
protected ActorTemplateID(@Assisted int id, TemplateService templateService) {
|
||||
super(id);
|
||||
this.templateService = templateService;
|
||||
}
|
||||
|
||||
@Override
|
||||
@XmlTransient
|
||||
public T loadTemplate() {
|
||||
return templateService.getTemplate(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.template;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.model.id.TemplateID;
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.template.character.CharacterClass;
|
||||
import com.l2jserver.service.game.template.TemplateService;
|
||||
|
||||
/**
|
||||
* An {@link TemplateID} instance representing an {@link CharacterTemplate}
|
||||
* object
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterTemplateID extends ActorTemplateID<CharacterTemplate> {
|
||||
/**
|
||||
* @param id
|
||||
* the raw id
|
||||
* @param templateService
|
||||
* the template service
|
||||
*/
|
||||
@Inject
|
||||
public CharacterTemplateID(@Assisted int id, TemplateService templateService) {
|
||||
super(id, templateService);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the character class
|
||||
*/
|
||||
public CharacterClass getCharacterClass() {
|
||||
return CharacterClass.fromID(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.template;
|
||||
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.model.id.TemplateID;
|
||||
import com.l2jserver.model.template.ItemTemplate;
|
||||
import com.l2jserver.service.game.template.TemplateService;
|
||||
|
||||
/**
|
||||
* An {@link TemplateID} instance representing an {@link ItemTemplate} object
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
@XmlTransient
|
||||
public class ItemTemplateID extends TemplateID<ItemTemplate, Integer> {
|
||||
/**
|
||||
* The template service
|
||||
*/
|
||||
private final TemplateService templateService;
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* the raw id
|
||||
* @param templateService
|
||||
* the template service
|
||||
*/
|
||||
@Inject
|
||||
public ItemTemplateID(@Assisted int id, TemplateService templateService) {
|
||||
super(id);
|
||||
this.templateService = templateService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemTemplate loadTemplate() {
|
||||
return templateService.getTemplate(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.template;
|
||||
|
||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.model.id.TemplateID;
|
||||
import com.l2jserver.model.template.NPCTemplate;
|
||||
import com.l2jserver.service.game.template.TemplateService;
|
||||
import com.l2jserver.util.jaxb.NPCTemplateIDAdapter;
|
||||
|
||||
/**
|
||||
* An {@link TemplateID} instance representing an {@link NPCTemplate} object
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
@XmlJavaTypeAdapter(value = NPCTemplateIDAdapter.class)
|
||||
public class NPCTemplateID extends ActorTemplateID<NPCTemplate> {
|
||||
/**
|
||||
* @param id
|
||||
* the raw id
|
||||
* @param templateService
|
||||
* the template service
|
||||
*/
|
||||
@Inject
|
||||
public NPCTemplateID(@Assisted int id, TemplateService templateService) {
|
||||
super(id, templateService);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPCTemplate getTemplate() {
|
||||
return super.getTemplate();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.template;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.model.id.TemplateID;
|
||||
import com.l2jserver.model.template.SkillTemplate;
|
||||
import com.l2jserver.service.game.template.TemplateService;
|
||||
|
||||
/**
|
||||
* An {@link TemplateID} instance representing an {@link SkillTemplate} object
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class SkillTemplateID extends TemplateID<SkillTemplate, Integer> {
|
||||
/**
|
||||
* The template service
|
||||
*/
|
||||
private final TemplateService templateService;
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* the raw id
|
||||
* @param templateService
|
||||
* the template service
|
||||
*/
|
||||
@Inject
|
||||
public SkillTemplateID(@Assisted int id, TemplateService templateService) {
|
||||
super(id);
|
||||
this.templateService = templateService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SkillTemplate loadTemplate() {
|
||||
return templateService.getTemplate(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.template;
|
||||
|
||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.model.id.TemplateID;
|
||||
import com.l2jserver.model.template.SkillTemplate;
|
||||
import com.l2jserver.model.template.npc.TeleportationTemplate;
|
||||
import com.l2jserver.service.game.template.TemplateService;
|
||||
import com.l2jserver.util.jaxb.TeleportationTemplateIDAdapter;
|
||||
|
||||
/**
|
||||
* An {@link TemplateID} instance representing an {@link SkillTemplate} object
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
@XmlJavaTypeAdapter(TeleportationTemplateIDAdapter.class)
|
||||
public class TeleportationTemplateID extends
|
||||
TemplateID<TeleportationTemplate, Integer> {
|
||||
/**
|
||||
* The template service
|
||||
*/
|
||||
private final TemplateService templateService;
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* the raw id
|
||||
* @param templateService
|
||||
* the template service
|
||||
*/
|
||||
@Inject
|
||||
public TeleportationTemplateID(@Assisted int id,
|
||||
TemplateService templateService) {
|
||||
super(id);
|
||||
this.templateService = templateService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TeleportationTemplate loadTemplate() {
|
||||
return templateService.getTemplate(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.template.provider;
|
||||
|
||||
import com.l2jserver.model.id.template.CharacterTemplateID;
|
||||
|
||||
/**
|
||||
* Creates new {@link CharacterTemplateID} instances
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface CharacterTemplateIDProvider extends
|
||||
TemplateIDProvider<Integer, CharacterTemplateID> {
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.template.provider;
|
||||
|
||||
import com.l2jserver.model.id.template.ItemTemplateID;
|
||||
|
||||
/**
|
||||
* Creates new {@link ItemTemplateID} instances
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface ItemTemplateIDProvider extends
|
||||
TemplateIDProvider<Integer, ItemTemplateID> {
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.template.provider;
|
||||
|
||||
import com.l2jserver.model.id.template.NPCTemplateID;
|
||||
|
||||
/**
|
||||
* Creates new {@link NPCTemplateID} instances
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface NPCTemplateIDProvider extends
|
||||
TemplateIDProvider<Integer, NPCTemplateID> {
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.template.provider;
|
||||
|
||||
import com.l2jserver.model.id.template.SkillTemplateID;
|
||||
|
||||
/**
|
||||
* Creates new {@link SkillTemplateID} instances
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface SkillTemplateIDProvider extends
|
||||
TemplateIDProvider<Integer, SkillTemplateID> {
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.template.provider;
|
||||
|
||||
import com.l2jserver.model.id.template.SkillTemplateID;
|
||||
import com.l2jserver.model.id.template.TeleportationTemplateID;
|
||||
|
||||
/**
|
||||
* Creates new {@link SkillTemplateID} instances
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface TeleportationTemplateIDProvider extends
|
||||
TemplateIDProvider<Integer, TeleportationTemplateID> {
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.id.template.provider;
|
||||
|
||||
import com.l2jserver.model.id.TemplateID;
|
||||
import com.l2jserver.model.id.provider.IDProvider;
|
||||
|
||||
/**
|
||||
* Creates a new {@link TemplateID}
|
||||
*
|
||||
* @param <I>
|
||||
* the raw id type
|
||||
* @param <T>
|
||||
* the subclass of {@link TemplateID} that will be created
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface TemplateIDProvider<I, T extends TemplateID<?, I>> extends
|
||||
IDProvider<I, T> {
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.server;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jserver.model.world.Actor;
|
||||
import com.l2jserver.util.factory.CollectionFactory;
|
||||
|
||||
/**
|
||||
* This class represents an attack hit.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class AttackHit {
|
||||
/**
|
||||
* The actor attacking <tt>target</tt>
|
||||
*/
|
||||
private final Actor attacker;
|
||||
/**
|
||||
* The actor being attacked by <tt>attacker</tt>
|
||||
*/
|
||||
private final Actor target;
|
||||
/**
|
||||
* The damage dealt by this hit
|
||||
*/
|
||||
private double damage;
|
||||
/**
|
||||
* This hit flags (i.e. critical)
|
||||
*/
|
||||
private List<AttackHitFlag> flags = CollectionFactory.newList();
|
||||
|
||||
/**
|
||||
* An enumeration containing all possible attack flags
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public enum AttackHitFlag {
|
||||
/**
|
||||
* The hit used soulshot
|
||||
*/
|
||||
SOULSHOT((byte) 0x10),
|
||||
/**
|
||||
* The attack dealt critical damage
|
||||
*/
|
||||
CRITICAL((byte) 0x20),
|
||||
/**
|
||||
* The shield blocked this hit
|
||||
*/
|
||||
SHIELD_BLOCKED((byte) 0x40),
|
||||
/**
|
||||
* The <tt>attacker</tt> missed the hit
|
||||
*/
|
||||
MISS((byte) 0x80);
|
||||
|
||||
/**
|
||||
* The byte value of the flag
|
||||
*/
|
||||
public final byte flag;
|
||||
|
||||
/**
|
||||
* @param flag
|
||||
* the bitset flag
|
||||
*/
|
||||
AttackHitFlag(byte flag) {
|
||||
this.flag = flag;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param attacker
|
||||
* the actor attacking <tt>target</tt>
|
||||
* @param target
|
||||
* the actor being attacked by <tt>attacker</tt>
|
||||
* @param damage
|
||||
* the damage issued in this hit
|
||||
*/
|
||||
public AttackHit(Actor attacker, Actor target, double damage) {
|
||||
this.attacker = attacker;
|
||||
this.target = target;
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param attacker
|
||||
* the actor attacking <tt>target</tt>
|
||||
* @param target
|
||||
* the actor being attacked by <tt>attacker</tt>
|
||||
*/
|
||||
public AttackHit(Actor attacker, Actor target) {
|
||||
this.attacker = attacker;
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param attacker
|
||||
* the actor attacking <tt>target</tt>
|
||||
* @param target
|
||||
* the actor being attacked by <tt>attacker</tt>
|
||||
* @param flags
|
||||
* the hit flags
|
||||
*/
|
||||
public AttackHit(Actor attacker, Actor target, AttackHitFlag... flags) {
|
||||
this.attacker = attacker;
|
||||
this.target = target;
|
||||
Collections.addAll(this.flags, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the attacker
|
||||
*/
|
||||
public Actor getAttacker() {
|
||||
return attacker;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the target
|
||||
*/
|
||||
public Actor getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the damage
|
||||
*/
|
||||
public double getDamage() {
|
||||
return damage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the flags
|
||||
*/
|
||||
public List<AttackHitFlag> getFlags() {
|
||||
return flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the flags as a byte value
|
||||
*/
|
||||
public byte getFlagsByte() {
|
||||
byte flags = 0;
|
||||
for (final AttackHitFlag flag : this.flags) {
|
||||
if (flag == AttackHitFlag.MISS)
|
||||
return AttackHitFlag.MISS.flag;
|
||||
flags |= flag.flag;
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.server;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.l2jserver.model.AbstractModel;
|
||||
import com.l2jserver.model.Model;
|
||||
import com.l2jserver.model.id.ChatMessageID;
|
||||
import com.l2jserver.model.id.object.CharacterID;
|
||||
import com.l2jserver.service.game.chat.ChatMessageType;
|
||||
|
||||
/**
|
||||
* This is an chat message stored in the database for logging purposes. It can,
|
||||
* however, be used as a form of flood-checking.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class ChatMessage extends AbstractModel<ChatMessageID> implements
|
||||
Model<ChatMessageID> {
|
||||
/**
|
||||
* The chat message type.
|
||||
* <p>
|
||||
* If {@link ChatMessageType#SHOUT} <tt>target</tt> will be set and
|
||||
* <tt>channelID</tt> will be <tt>null</tt>.<br>
|
||||
* Otherwise, <tt>target</tt> is <tt>null</tt> and <tt>channelID</tt> will
|
||||
* be set.
|
||||
*/
|
||||
private ChatMessageType type;
|
||||
/**
|
||||
* The channel numeric ID
|
||||
*/
|
||||
private int channelID;
|
||||
/**
|
||||
* The message target ID, if any.
|
||||
*/
|
||||
private CharacterID target;
|
||||
|
||||
/**
|
||||
* The sender ID, if any.
|
||||
*/
|
||||
private CharacterID sender;
|
||||
/**
|
||||
* The message log date
|
||||
*/
|
||||
private Date date;
|
||||
/**
|
||||
* The message content
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* @return the type
|
||||
*/
|
||||
public ChatMessageType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type
|
||||
* the type to set
|
||||
*/
|
||||
public void setType(ChatMessageType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the channelID
|
||||
*/
|
||||
public int getChannelID() {
|
||||
return channelID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param channelID
|
||||
* the channelID to set
|
||||
*/
|
||||
public void setChannelID(int channelID) {
|
||||
this.channelID = channelID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the target
|
||||
*/
|
||||
public CharacterID getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param target
|
||||
* the target to set
|
||||
*/
|
||||
public void setTarget(CharacterID target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the sender
|
||||
*/
|
||||
public CharacterID getSender() {
|
||||
return sender;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param sender
|
||||
* the sender to set
|
||||
*/
|
||||
public void setSender(CharacterID sender) {
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the date
|
||||
*/
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param date
|
||||
* the date to set
|
||||
*/
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the message
|
||||
*/
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message
|
||||
* the message to set
|
||||
*/
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ChatMessage [" + sender + "@" + date + ": " + message + "]";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.server.attack;
|
||||
|
||||
import com.l2jserver.model.server.attack.AttackCalculator.AttackCalculatorType;
|
||||
import com.l2jserver.util.calculator.ComplexCalculator;
|
||||
|
||||
/**
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class AttackCalculator extends
|
||||
ComplexCalculator<AttackCalculatorContext, AttackCalculatorType> {
|
||||
/**
|
||||
* @param functions
|
||||
* the functions
|
||||
*/
|
||||
public AttackCalculator(AttackCalculatorFunction... functions) {
|
||||
super(AttackCalculatorType.class, functions);
|
||||
}
|
||||
|
||||
/**
|
||||
* The calculator attributes
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public enum AttackCalculatorType {
|
||||
/**
|
||||
* Calculates the damage dealt by the attack
|
||||
*/
|
||||
DAMAGE;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.server.attack;
|
||||
|
||||
import com.l2jserver.model.world.Actor;
|
||||
import com.l2jserver.util.calculator.CalculatorContext;
|
||||
|
||||
/**
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class AttackCalculatorContext extends CalculatorContext {
|
||||
/**
|
||||
* The attacker actor
|
||||
*/
|
||||
public final Actor attacker;
|
||||
/**
|
||||
* The target actor
|
||||
*/
|
||||
public final Actor target;
|
||||
|
||||
/**
|
||||
* @param attacker
|
||||
* the attacker
|
||||
* @param target
|
||||
* the target
|
||||
*/
|
||||
public AttackCalculatorContext(Actor attacker, Actor target) {
|
||||
this.attacker = attacker;
|
||||
this.target = target;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.server.attack;
|
||||
|
||||
import com.l2jserver.model.server.attack.AttackCalculator.AttackCalculatorType;
|
||||
import com.l2jserver.model.world.Actor;
|
||||
import com.l2jserver.util.calculator.AbstractDoubleFunction;
|
||||
|
||||
/**
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public abstract class AttackCalculatorFunction extends
|
||||
AbstractDoubleFunction<AttackCalculatorContext, AttackCalculatorType> {
|
||||
/**
|
||||
* @param order
|
||||
* the calculation order
|
||||
* @param type
|
||||
* the function attribute
|
||||
*/
|
||||
public AttackCalculatorFunction(int order, AttackCalculatorType type) {
|
||||
super(order, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double calculate(AttackCalculatorContext ctx, double value) {
|
||||
return calculate(ctx.attacker, ctx.target, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param attacker
|
||||
* the attacker
|
||||
* @param target
|
||||
* the target
|
||||
* @param value
|
||||
* the original value
|
||||
* @return the calculated value
|
||||
*/
|
||||
public abstract double calculate(Actor attacker, Actor target, double value);
|
||||
}
|
||||
@@ -0,0 +1,296 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.server.attack;
|
||||
|
||||
import com.l2jserver.model.world.Actor;
|
||||
|
||||
/**
|
||||
* Calculator used to calculate physical damage on each hit.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class PhysicalAttackCalculator extends AttackCalculator {
|
||||
/**
|
||||
* Creates a new instance
|
||||
*/
|
||||
public PhysicalAttackCalculator() {
|
||||
super(new AttackCalculatorFunction(0x000, AttackCalculatorType.DAMAGE) {
|
||||
@Override
|
||||
public double calculate(Actor attacker, Actor target, double value) {
|
||||
// // final boolean isPvP = (attacker instanceof L2Playable) &&
|
||||
// // (target instanceof L2Playable);
|
||||
// // TODO soulshot charge
|
||||
// boolean soulshot = false;
|
||||
//
|
||||
// double damage = attacker.getStats().getPhysicalAttack();
|
||||
// double defense = target.getStats().getPhysicalDefense();
|
||||
// // damage += calcValakasAttribute(attacker, target, skill);
|
||||
// // if (attacker instanceof NPC) {
|
||||
// // if (((NPC) attacker)._soulshotcharged) {
|
||||
// // ss = true;
|
||||
// // } else
|
||||
// // ss = false;
|
||||
// // ((L2Npc) attacker)._soulshotcharged = false;
|
||||
// // }
|
||||
// // TODO implement pvp
|
||||
// // Def bonusses in PvP fight
|
||||
// // if (isPvP) {
|
||||
// // if (skill == null)
|
||||
// // defence *= target.calcStat(Stats.PVP_PHYSICAL_DEF, 1,
|
||||
// // null, null);
|
||||
// // else
|
||||
// // defence *= target.calcStat(Stats.PVP_PHYS_SKILL_DEF, 1,
|
||||
// // null, null);
|
||||
// // }
|
||||
//
|
||||
// // TODO implement shield
|
||||
// // switch (shld) {
|
||||
// // case SHIELD_DEFENSE_SUCCEED:
|
||||
// // if (!Config.ALT_GAME_SHIELD_BLOCKS)
|
||||
// // defense += target.getShldDef();
|
||||
// // break;
|
||||
// // case SHIELD_DEFENSE_PERFECT_BLOCK: // perfect block
|
||||
// // return 1.;
|
||||
// // }
|
||||
//
|
||||
// if (soulshot)
|
||||
// damage *= 2;
|
||||
// // if (skill != null) {
|
||||
// // double skillpower = skill.getPower(attacker, target,
|
||||
// isPvP);
|
||||
// // float ssboost = skill.getSSBoost();
|
||||
// // if (ssboost <= 0)
|
||||
// // damage += skillpower;
|
||||
// // else if (ssboost > 0) {
|
||||
// // if (ss) {
|
||||
// // skillpower *= ssboost;
|
||||
// // damage += skillpower;
|
||||
// // } else
|
||||
// // damage += skillpower;
|
||||
// // }
|
||||
// // }
|
||||
//
|
||||
// // defense modifier depending of the attacker weapon
|
||||
// //ItemTemplate weapon = attacker.getActiveWeaponItem();
|
||||
// boolean isBow = false;
|
||||
// if (weapon != null/* && !attacker.isTransformed() */) {
|
||||
// switch (null) {
|
||||
// case BOW:
|
||||
// isBow = true;
|
||||
// stat = StatType.BOW_WPN_VULN;
|
||||
// break;
|
||||
// case CROSSBOW:
|
||||
// isBow = true;
|
||||
// stat = StatType.CROSSBOW_WPN_VULN;
|
||||
// break;
|
||||
// case BLUNT:
|
||||
// stat = StatType.BLUNT_WPN_VULN;
|
||||
// break;
|
||||
// case DAGGER:
|
||||
// stat = StatType.DAGGER_WPN_VULN;
|
||||
// break;
|
||||
// case DUAL:
|
||||
// stat = StatType.DUAL_WPN_VULN;
|
||||
// break;
|
||||
// case DUALFIST:
|
||||
// stat = StatType.DUALFIST_WPN_VULN;
|
||||
// break;
|
||||
// case ETC:
|
||||
// stat = StatType.ETC_WPN_VULN;
|
||||
// break;
|
||||
// case FIST:
|
||||
// stat = StatType.FIST_WPN_VULN;
|
||||
// break;
|
||||
// case POLE:
|
||||
// stat = StatType.POLE_WPN_VULN;
|
||||
// break;
|
||||
// case SWORD:
|
||||
// stat = StatType.SWORD_WPN_VULN;
|
||||
// break;
|
||||
// case BIGSWORD:
|
||||
// stat = StatType.BIGSWORD_WPN_VULN;
|
||||
// break;
|
||||
// case BIGBLUNT:
|
||||
// stat = StatType.BIGBLUNT_WPN_VULN;
|
||||
// break;
|
||||
// case DUALDAGGER:
|
||||
// stat = StatType.DUALDAGGER_WPN_VULN;
|
||||
// break;
|
||||
// case RAPIER:
|
||||
// stat = StatType.RAPIER_WPN_VULN;
|
||||
// break;
|
||||
// case ANCIENTSWORD:
|
||||
// stat = StatType.ANCIENT_WPN_VULN;
|
||||
// break;
|
||||
// /*
|
||||
// * case PET: stat = Stats.PET_WPN_VULN; break;
|
||||
// */
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // for summon use pet weapon vuln, since they cant hold
|
||||
// weapon
|
||||
// // if (attacker instanceof L2SummonInstance)
|
||||
// // stat = Stats.PET_WPN_VULN;
|
||||
//
|
||||
// // if (crit) {
|
||||
// // // Finally retail like formula
|
||||
// // damage = 2
|
||||
// // * attacker.calcStat(Stats.CRITICAL_DAMAGE, 1,
|
||||
// // target, skill)
|
||||
// // * target.calcStat(Stats.CRIT_VULN,
|
||||
// // target.getTemplate().baseCritVuln, target,
|
||||
// // null) * (70 * damage / defense);
|
||||
// // // Crit dmg add is almost useless in normal hits...
|
||||
// // damage += (attacker.calcStat(Stats.CRITICAL_DAMAGE_ADD, 0,
|
||||
// // target, skill) * 70 / defense);
|
||||
// // } else
|
||||
// // damage = 70 * damage / defense;
|
||||
//
|
||||
// if (stat != null) {
|
||||
// // get the vulnerability due to skills (buffs, passives,
|
||||
// // toggles, etc)
|
||||
// damage = target.calcStat(stat, damage, target, null);
|
||||
// /*
|
||||
// * if (target instanceof L2Npc) { // get the natural
|
||||
// * vulnerability for the template damage *= ((L2Npc)
|
||||
// * target).getTemplate().getVulnerability(stat); }
|
||||
// */
|
||||
// }
|
||||
//
|
||||
// // Weapon random damage
|
||||
// damage *= attacker.getRandomDamageMultiplier();
|
||||
//
|
||||
// // damage += Rnd.nextDouble() * damage / 10;
|
||||
// // damage += _rnd.nextDouble()*
|
||||
// // attacker.getRandomDamage(target);
|
||||
// // }
|
||||
// if (shld > 0 && Config.ALT_GAME_SHIELD_BLOCKS) {
|
||||
// damage -= target.getShldDef();
|
||||
// if (damage < 0)
|
||||
// damage = 0;
|
||||
// }
|
||||
//
|
||||
// if (target instanceof L2Npc) {
|
||||
// switch (((L2Npc) target).getTemplate().getRace()) {
|
||||
// case BEAST:
|
||||
// damage *= attacker.getPAtkMonsters(target);
|
||||
// break;
|
||||
// case ANIMAL:
|
||||
// damage *= attacker.getPAtkAnimals(target);
|
||||
// break;
|
||||
// case PLANT:
|
||||
// damage *= attacker.getPAtkPlants(target);
|
||||
// break;
|
||||
// case DRAGON:
|
||||
// damage *= attacker.getPAtkDragons(target);
|
||||
// break;
|
||||
// case BUG:
|
||||
// damage *= attacker.getPAtkInsects(target);
|
||||
// break;
|
||||
// case GIANT:
|
||||
// damage *= attacker.getPAtkGiants(target);
|
||||
// break;
|
||||
// case MAGICCREATURE:
|
||||
// damage *= attacker.getPAtkMagicCreatures(target);
|
||||
// break;
|
||||
// default:
|
||||
// // nothing
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (damage > 0 && damage < 1) {
|
||||
// damage = 1;
|
||||
// } else if (damage < 0) {
|
||||
// damage = 0;
|
||||
// }
|
||||
//
|
||||
// // Dmg bonusses in PvP fight
|
||||
// if (isPvP) {
|
||||
// if (skill == null)
|
||||
// damage *= attacker.calcStat(Stats.PVP_PHYSICAL_DMG, 1,
|
||||
// null, null);
|
||||
// else
|
||||
// damage *= attacker.calcStat(Stats.PVP_PHYS_SKILL_DMG,
|
||||
// 1, null, null);
|
||||
// }
|
||||
//
|
||||
// // Physical skill dmg boost
|
||||
// if (skill != null)
|
||||
// damage *= attacker.calcStat(Stats.PHYSICAL_SKILL_POWER, 1,
|
||||
// null, null);
|
||||
//
|
||||
// damage *= calcElemental(attacker, target, skill);
|
||||
// if (target instanceof L2Attackable) {
|
||||
// if (isBow) {
|
||||
// if (skill != null)
|
||||
// damage *= attacker.calcStat(
|
||||
// Stats.PVE_BOW_SKILL_DMG, 1, null, null);
|
||||
// else
|
||||
// damage *= attacker.calcStat(Stats.PVE_BOW_DMG, 1,
|
||||
// null, null);
|
||||
// } else
|
||||
// damage *= attacker.calcStat(Stats.PVE_PHYSICAL_DMG, 1,
|
||||
// null, null);
|
||||
// if (!target.isRaid()
|
||||
// && !target.isRaidMinion()
|
||||
// && target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY
|
||||
// && attacker.getActingPlayer() != null
|
||||
// && (target.getLevel() - attacker.getActingPlayer()
|
||||
// .getLevel()) >= 2) {
|
||||
// int lvlDiff = target.getLevel()
|
||||
// - attacker.getActingPlayer().getLevel() - 1;
|
||||
// if (skill != null) {
|
||||
// if (lvlDiff > Config.NPC_SKILL_DMG_PENALTY.size())
|
||||
// damage *= Config.NPC_SKILL_DMG_PENALTY
|
||||
// .get(Config.NPC_SKILL_DMG_PENALTY
|
||||
// .size());
|
||||
// else
|
||||
// damage *= Config.NPC_SKILL_DMG_PENALTY
|
||||
// .get(lvlDiff);
|
||||
// } else if (crit) {
|
||||
// if (lvlDiff > Config.NPC_CRIT_DMG_PENALTY.size())
|
||||
// damage *= Config.NPC_CRIT_DMG_PENALTY
|
||||
// .get(Config.NPC_CRIT_DMG_PENALTY.size());
|
||||
// else
|
||||
// damage *= Config.NPC_CRIT_DMG_PENALTY
|
||||
// .get(lvlDiff);
|
||||
// } else {
|
||||
// if (lvlDiff > Config.NPC_DMG_PENALTY.size())
|
||||
// damage *= Config.NPC_DMG_PENALTY
|
||||
// .get(Config.NPC_DMG_PENALTY.size());
|
||||
// else
|
||||
// damage *= Config.NPC_DMG_PENALTY.get(lvlDiff);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return damage;
|
||||
return 10;
|
||||
}
|
||||
}, new AttackCalculatorFunction(Integer.MAX_VALUE,
|
||||
AttackCalculatorType.DAMAGE) {
|
||||
@Override
|
||||
public double calculate(Actor attacker, Actor target, double value) {
|
||||
if (value <= 0)
|
||||
return 1;
|
||||
return value;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
|
||||
/**
|
||||
* Template for an Aumentation
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public abstract class AugmentTemplate extends AbstractTemplate {
|
||||
/**
|
||||
* Create a new {@link Object}
|
||||
*
|
||||
* @return the created object
|
||||
*/
|
||||
public Object create() {
|
||||
return null;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public ItemTemplateID getID() {
|
||||
// return (ItemTemplateID) super.getID();
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import com.l2jserver.model.id.TemplateID;
|
||||
import com.l2jserver.model.world.WorldObject;
|
||||
|
||||
/**
|
||||
* An template is like a base for an {@link WorldObject}. Normally, instead of
|
||||
* manually creating the object this can be done through templates, that easy
|
||||
* the need of setting the new objects parameters.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface Template {
|
||||
/**
|
||||
* Return this {@link TemplateID}
|
||||
*
|
||||
* @return the template id
|
||||
*/
|
||||
TemplateID<?, ?> getID();
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.l2jserver.model.template.actor;
|
||||
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
/**
|
||||
* Represent the sex of an actor.
|
||||
* <p>
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
@XmlType(name = "ActorSexType")
|
||||
public enum ActorSex {
|
||||
/**
|
||||
* Represents an male character
|
||||
*/
|
||||
MALE(0x00),
|
||||
/**
|
||||
* Represents an female character
|
||||
*/
|
||||
FEMALE(0x01);
|
||||
|
||||
/**
|
||||
* The numeric sex option
|
||||
*/
|
||||
public final int option;
|
||||
|
||||
/**
|
||||
* @param option
|
||||
* the numeric sex option
|
||||
*/
|
||||
ActorSex(int option) {
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param option
|
||||
* the numeric sex option
|
||||
* @return the resolved {@link ActorSex}
|
||||
*/
|
||||
public static ActorSex fromOption(int option) {
|
||||
for (ActorSex sex : values()) {
|
||||
if (sex.option == option)
|
||||
return sex;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,328 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.template.character;
|
||||
|
||||
import static com.l2jserver.model.template.character.CharacterClass.ClassType.FIGHTER;
|
||||
import static com.l2jserver.model.template.character.CharacterClass.ClassType.MYSTIC;
|
||||
import static com.l2jserver.model.template.character.CharacterClass.ClassType.PRIEST;
|
||||
import static com.l2jserver.model.template.character.CharacterRace.DARK_ELF;
|
||||
import static com.l2jserver.model.template.character.CharacterRace.DWARF;
|
||||
import static com.l2jserver.model.template.character.CharacterRace.ELF;
|
||||
import static com.l2jserver.model.template.character.CharacterRace.HUMAN;
|
||||
import static com.l2jserver.model.template.character.CharacterRace.KAMAEL;
|
||||
import static com.l2jserver.model.template.character.CharacterRace.ORC;
|
||||
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
/**
|
||||
* Defines all the possible classes for an character
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
@XmlType(name = "CharacterClassType")
|
||||
@SuppressWarnings("javadoc")
|
||||
public enum CharacterClass {
|
||||
/**
|
||||
* Human fighter
|
||||
*/
|
||||
HUMAN_FIGHTER(0x00, FIGHTER, HUMAN), WARRIOR(0x01, HUMAN_FIGHTER), GLADIATOR(
|
||||
0x02, WARRIOR), WARLORD(0x03, WARRIOR), KNIGHT(0x04, HUMAN_FIGHTER), PALADIN(
|
||||
0x05, KNIGHT), DARK_AVENGER(0x06, KNIGHT), ROGUE(0x07,
|
||||
HUMAN_FIGHTER), TREASURE_HUNTER(0x08, ROGUE), HAWKEYE(0x09, ROGUE), DUELIST(
|
||||
0x58, GLADIATOR), DREADNOUGHT(0x59, WARLORD), PHOENIX_KNIGHT(0x5a,
|
||||
PALADIN), HELL_KNIGHT(0x5b, DARK_AVENGER), SAGITTARIUS(0x5c,
|
||||
HAWKEYE), ADVENTURER(0x5d, TREASURE_HUNTER),
|
||||
|
||||
/**
|
||||
* Human mystic
|
||||
*/
|
||||
HUMAN_MYSTIC(0x0a, MYSTIC, HUMAN), WIZARD(0x0b, HUMAN_MYSTIC), SORCEROR(
|
||||
0x0c, WIZARD), NECROMANCER(0x0d, WIZARD), WARLOCK(0x0e, true,
|
||||
WIZARD), CLERIC(0x0f, PRIEST, HUMAN_MYSTIC), BISHOP(0x10, CLERIC), PROPHET(
|
||||
0x11, CLERIC), ARCHMAGE(0x5e, SORCEROR), SOULTAKER(0x5f,
|
||||
NECROMANCER), ARCANA_LORD(0x60, WARLOCK), CARDINAL(0x61, BISHOP), HIEROPHANT(
|
||||
0x62, PROPHET),
|
||||
|
||||
/**
|
||||
* Elven fighter
|
||||
*/
|
||||
ELVEN_FIGHTER(0x12, FIGHTER, ELF), ELVEN_KNIGHT(0x13, ELVEN_FIGHTER), TEMPLE_KNIGHT(
|
||||
0x14, ELVEN_KNIGHT), SWORD_SINGER(0x15, ELVEN_KNIGHT), ELVEN_SCOUT(
|
||||
0x16, ELVEN_FIGHTER), PLAINS_WALKER(0x17, ELVEN_SCOUT), SILVER_RANGER(
|
||||
0x18, ELVEN_SCOUT), EVA_TEMPLAR(0x63, TEMPLE_KNIGHT), SWORD_MUSE(
|
||||
0x64, SWORD_SINGER), WIND_RIDER(0x65, PLAINS_WALKER), MOONLIGHT_SENTINEL(
|
||||
0x66, SILVER_RANGER),
|
||||
/**
|
||||
* Elven mystic
|
||||
*/
|
||||
ELVEN_MYSTIC(0x19, MYSTIC, ELF), ELVEN_WIZARD(0x1a, ELVEN_MYSTIC), SPELLSINGER(
|
||||
0x1b, ELVEN_WIZARD), ELEMENTAL_SUMMONER(0x1c, true, ELVEN_WIZARD), ORACLE(
|
||||
0x1d, PRIEST, ELVEN_MYSTIC), ELDER(0x1e, ORACLE), MYSTIC_MUSE(0x67,
|
||||
SPELLSINGER), ELEMENTAL_MASTER(0x68, ELEMENTAL_SUMMONER), EVA_SAINT(
|
||||
0x69, ELDER),
|
||||
|
||||
/**
|
||||
* Dark elf fighter
|
||||
*/
|
||||
DARK_FIGHTER(0x1f, FIGHTER, DARK_ELF), PALUS_KNIGHT(0x20, DARK_FIGHTER), SHILLIEN_KNIGHT(
|
||||
0x21, PALUS_KNIGHT), BLADEDANCER(0x22, PALUS_KNIGHT), ASSASSIN(
|
||||
0x23, DARK_FIGHTER), ABYSS_WALKER(0x24, ASSASSIN), PHANTOM_RANGER(
|
||||
0x25, ASSASSIN), SHILLIEN_TEMPLAR(0x6a, SHILLIEN_KNIGHT), SPECTRAL_DANCER(
|
||||
0x6b, BLADEDANCER), GHOST_HUNTER(0x6c, ABYSS_WALKER), GHOST_SENTINEL(
|
||||
0x6d, PHANTOM_RANGER),
|
||||
|
||||
/**
|
||||
* Dark elf mystic
|
||||
*/
|
||||
DARK_MYSTIC(0x26, MYSTIC, DARK_ELF), DARK_WIZARD(0x27, DARK_MYSTIC), SPELLHOWLER(
|
||||
0x28, DARK_WIZARD), PHANTOM_SUMMONER(0x29, true, DARK_WIZARD), SHILLIEN_ORACLE(
|
||||
0x2a, PRIEST, DARK_MYSTIC), SHILLIEN_ELDER(0x2b, SHILLIEN_ORACLE), STORM_SCREAMER(
|
||||
0x6e, SPELLHOWLER), SPECTRAL_MASTER(0x6f, PHANTOM_SUMMONER), SHILLIEAN_SAINT(
|
||||
0x70, SHILLIEN_ELDER),
|
||||
|
||||
/**
|
||||
* Orc fighter
|
||||
*/
|
||||
ORC_FIGHTER(0x2c, FIGHTER, ORC), ORC_RAIDER(0x2d, ORC_FIGHTER), DESTROYER(
|
||||
0x2e, ORC_RAIDER), ORC_MONK(0x2f, ORC_FIGHTER), TYRANT(0x30,
|
||||
ORC_RAIDER), TITAN(0x71, DESTROYER), GRAND_KHAUATARI(0x72, TYRANT),
|
||||
|
||||
/**
|
||||
* Orc mystic
|
||||
*/
|
||||
ORC_MYSTIC(0x31, FIGHTER, ORC), ORC_SHAMAN(0x32, MYSTIC, ORC_MYSTIC), OVERLORD(
|
||||
0x33, ORC_SHAMAN), WARCRYER(0x34, ORC_SHAMAN), DOMINATOR(0x73,
|
||||
OVERLORD), DOOMCRYER(0x74, WARCRYER),
|
||||
|
||||
/**
|
||||
* Dwarf fighter
|
||||
*/
|
||||
DWARVEN_FIGHTER(0x35, FIGHTER, DWARF), SCAVENGER(0x36, DWARVEN_FIGHTER), BOUNTY_HUNTER(
|
||||
0x37, SCAVENGER), ARTISAN(0x38, DWARVEN_FIGHTER), WARSMITH(0x39,
|
||||
ARTISAN), FORTUNE_SEEKER(0x75, BOUNTY_HUNTER), MAESTRO(0x76,
|
||||
WARSMITH),
|
||||
|
||||
/**
|
||||
* Kamael male soldier
|
||||
*/
|
||||
MALE_SOLDIER(0x7b, FIGHTER, KAMAEL), TROOPER(0x7D, MALE_SOLDIER), BERSEKER(
|
||||
0x7F, TROOPER), MALE_SOULBREAKER(0x80, TROOPER), DOOMBRINGER(0x83,
|
||||
BERSEKER), MALE_SOULDHOUND(0x84, MALE_SOULBREAKER),
|
||||
|
||||
/**
|
||||
* Kamael female soldier
|
||||
*/
|
||||
FEMALE_SOLDIER(0x7C, FIGHTER, KAMAEL), WARDER(0x7E, FEMALE_SOLDIER), FEMALE_SOULBREAKER(
|
||||
0x81, WARDER), ARBALESTER(0x82, WARDER), FEMALE_SOULDHOUND(0x85,
|
||||
FEMALE_SOULBREAKER), TRICKSTER(0x86, ARBALESTER), INSPECTOR(0x87,
|
||||
WARDER), JUDICATOR(0x88, INSPECTOR),
|
||||
|
||||
// DUMMY ENTRIES a.k.a TRASH
|
||||
DUMMY_ENTRY_1(58, null, false, null, null), DUMMY_ENTRY_2(59, null, false,
|
||||
null, null), DUMMY_ENTRY_3(60, null, false, null, null), DUMMY_ENTRY_4(
|
||||
61, null, false, null, null), DUMMY_ENTRY_5(62, null, false, null,
|
||||
null), DUMMY_ENTRY_6(63, null, false, null, null), DUMMY_ENTRY_7(
|
||||
64, null, false, null, null), DUMMY_ENTRY_8(65, null, false, null,
|
||||
null), DUMMY_ENTRY_9(66, null, false, null, null), DUMMY_ENTRY_10(
|
||||
67, null, false, null, null), DUMMY_ENTRY_11(68, null, false, null,
|
||||
null), DUMMY_ENTRY_12(69, null, false, null, null), DUMMY_ENTRY_13(
|
||||
70, null, false, null, null), DUMMY_ENTRY_14(71, null, false, null,
|
||||
null), DUMMY_ENTRY_15(72, null, false, null, null), DUMMY_ENTRY_16(
|
||||
73, null, false, null, null), DUMMY_ENTRY_17(74, null, false, null,
|
||||
null), DUMMY_ENTRY_18(75, null, false, null, null), DUMMY_ENTRY_19(
|
||||
76, null, false, null, null), DUMMY_ENTRY_20(77, null, false, null,
|
||||
null), DUMMY_ENTRY_21(78, null, false, null, null), DUMMY_ENTRY_22(
|
||||
79, null, false, null, null), DUMMY_ENTRY_23(80, null, false, null,
|
||||
null), DUMMY_ENTRY_24(81, null, false, null, null), DUMMY_ENTRY_25(
|
||||
82, null, false, null, null), DUMMY_ENTRY_26(83, null, false, null,
|
||||
null), DUMMY_ENTRY_27(84, null, false, null, null), DUMMY_ENTRY_28(
|
||||
85, null, false, null, null), DUMMY_ENTRY_29(86, null, false, null,
|
||||
null), DUMMY_ENTRY_30(87, null, false, null, null), DUMMY_ENTRY_31(
|
||||
0x77, null, false, null, null), DUMMY_ENTRY_32(0x78, null, false,
|
||||
null, null), DUMMY_ENTRY_33(0x79, null, false, null, null), DUMMY_ENTRY_34(
|
||||
0x7a, null, false, null, null);
|
||||
|
||||
/**
|
||||
* The Class ID
|
||||
*/
|
||||
public final int id;
|
||||
/**
|
||||
* The class type
|
||||
*/
|
||||
public final ClassType type;
|
||||
/**
|
||||
* Is this class summoner?
|
||||
*/
|
||||
public final boolean summoner;
|
||||
/**
|
||||
* The class race
|
||||
*/
|
||||
public final CharacterRace race;
|
||||
/**
|
||||
* The parent class
|
||||
*/
|
||||
public final CharacterClass parent;
|
||||
|
||||
/**
|
||||
* Creates a new class
|
||||
*
|
||||
* @param id
|
||||
* the id
|
||||
* @param type
|
||||
* the type
|
||||
* @param summoner
|
||||
* is summoner
|
||||
* @param race
|
||||
* the race
|
||||
* @param parent
|
||||
* the parent
|
||||
*/
|
||||
private CharacterClass(int id, ClassType type, boolean summoner,
|
||||
CharacterRace race, CharacterClass parent) {
|
||||
this.id = id;
|
||||
this.type = type;
|
||||
this.summoner = summoner;
|
||||
this.race = race;
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance, will inherit <tt>type</tt>, <tt>summoner</tt> and
|
||||
* <tt>race</tt> from <tt>parent</tt>
|
||||
*
|
||||
* @param id
|
||||
* the id
|
||||
* @param parent
|
||||
* the parent
|
||||
*/
|
||||
private CharacterClass(int id, CharacterClass parent) {
|
||||
this(id, parent.type, parent.summoner, parent.race, parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance, will inherit <tt>type</tt> and <tt>race</tt> from
|
||||
* <tt>parent</tt>
|
||||
*
|
||||
* @param id
|
||||
* the class id
|
||||
* @param summoner
|
||||
* is summoner
|
||||
* @param parent
|
||||
* the parent
|
||||
*/
|
||||
private CharacterClass(int id, boolean summoner, CharacterClass parent) {
|
||||
this(id, parent.type, summoner, parent.race, parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance, will inherit <tt>type</tt> and <tt>summoner</tt>
|
||||
* from <tt>parent</tt>
|
||||
*
|
||||
* @param id
|
||||
* the class id
|
||||
* @param race
|
||||
* the race
|
||||
* @param parent
|
||||
* the parent class
|
||||
*/
|
||||
private CharacterClass(int id, CharacterRace race, CharacterClass parent) {
|
||||
this(id, parent.type, parent.summoner, race, parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance, will inherit <tt>summoner</tt> will be false and
|
||||
* <tt>parent</tt> null.
|
||||
*
|
||||
* @param id
|
||||
* the id
|
||||
* @param type
|
||||
* the class type
|
||||
* @param race
|
||||
* the class race
|
||||
*/
|
||||
private CharacterClass(int id, ClassType type, CharacterRace race) {
|
||||
this(id, type, false, race, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance will inherit <tt>race</tt> from <tt/>parent</tt>.
|
||||
* <tt>summoner</tt> will be false
|
||||
*
|
||||
* @param id
|
||||
* the class id
|
||||
* @param type
|
||||
* the class type
|
||||
* @param parent
|
||||
* the parent class
|
||||
*/
|
||||
private CharacterClass(int id, ClassType type, CharacterClass parent) {
|
||||
this(id, type, false, parent.race, parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance will inherit <tt>race</tt> from <tt/>parent</tt>
|
||||
*
|
||||
* @param id
|
||||
* the class id
|
||||
* @param type
|
||||
* the class type
|
||||
* @param summoner
|
||||
* is class summoner
|
||||
* @param parent
|
||||
* the parent class
|
||||
*/
|
||||
private CharacterClass(int id, ClassType type, boolean summoner,
|
||||
CharacterClass parent) {
|
||||
this(id, type, summoner, parent.race, parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to locate the class based on its ID. If not found, <tt>null</tt> is
|
||||
* returned.
|
||||
*
|
||||
* @param id
|
||||
* the class id
|
||||
* @return the {@link CharacterClass} instance found
|
||||
*/
|
||||
public static CharacterClass fromID(int id) {
|
||||
for (final CharacterClass c : values()) {
|
||||
if (c.id == id)
|
||||
return c;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the level of the class. Base class is zero.
|
||||
*
|
||||
* @return the class level
|
||||
*/
|
||||
public final int level() {
|
||||
if (parent == null)
|
||||
return 0;
|
||||
return 1 + parent.level();
|
||||
}
|
||||
|
||||
/**
|
||||
* The class type
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public enum ClassType {
|
||||
FIGHTER, MYSTIC, PRIEST;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.l2jserver.model.template.character;
|
||||
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
/**
|
||||
* Represents the character race.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
@XmlType(name = "CharacterRaceType")
|
||||
@SuppressWarnings("javadoc")
|
||||
public enum CharacterRace {
|
||||
HUMAN(0x00), ELF(0x01), DARK_ELF(0x02), ORC(0x03), DWARF(0x04), KAMAEL(0x05);
|
||||
|
||||
/**
|
||||
* The numeric ID representing this race
|
||||
*/
|
||||
public final int id;
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* the race numeric id
|
||||
*/
|
||||
CharacterRace(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the race based on the <tt>id</tt>
|
||||
*
|
||||
* @param id
|
||||
* the id
|
||||
* @return the race constant
|
||||
*/
|
||||
public static CharacterRace fromOption(int id) {
|
||||
for (final CharacterRace race : values()) {
|
||||
if (race.id == id)
|
||||
return race;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.template.item;
|
||||
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
/**
|
||||
* Enum of all available armor types
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
@XmlType(name = "ArmorType")
|
||||
public enum ArmorType {
|
||||
/**
|
||||
* No armor type
|
||||
*/
|
||||
NONE,
|
||||
/**
|
||||
* Light armor type
|
||||
*/
|
||||
LIGHT,
|
||||
/**
|
||||
* Heavy armor type
|
||||
*/
|
||||
HEAVY,
|
||||
/**
|
||||
* Magic armor type
|
||||
*/
|
||||
MAGIC,
|
||||
/**
|
||||
* Unknown
|
||||
*/
|
||||
SIGILO;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.template.item;
|
||||
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
/**
|
||||
* The material the item is made off
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
@SuppressWarnings("javadoc")
|
||||
@XmlType(name = "ItemMaterialType")
|
||||
public enum ItemMaterial {
|
||||
COTTON, WOOD, PAPER, FISH, ORIHARUKON, HORN, ADAMANTAITE, CHRYSOLITE, MITHRIL, COBWEB, RUNE_XP, CLOTH, SCALE_OF_DRAGON, BONE, GOLD, LEATHER, FINE_STEEL, SILVER, DYESTUFF, CRYSTAL, RUNE_REMOVE_PENALTY, STEEL, BRONZE, RUNE_SP, LIQUID, BLOOD_STEEL, DAMASCUS;
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.template.item;
|
||||
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
/**
|
||||
* Enum for all available item types
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
@XmlType(name = "ItemEnumType")
|
||||
public enum ItemType {
|
||||
/**
|
||||
* No specific item type
|
||||
*/
|
||||
NONE(1),
|
||||
/**
|
||||
* An arrow for bows
|
||||
*/
|
||||
ARROW(2),
|
||||
/**
|
||||
* An potion used to regen cp, hp, mp or cure something
|
||||
*/
|
||||
POTION(3),
|
||||
/**
|
||||
* Enchant scroll for weapons
|
||||
*/
|
||||
WEAPON_ENCHANT_SCROLL(4),
|
||||
/**
|
||||
* Enchant scroll for armors
|
||||
*/
|
||||
ARMOR_ENCHANT_SCROLL(5),
|
||||
/**
|
||||
* An all purpose scroll
|
||||
*/
|
||||
SCROLL(6),
|
||||
/**
|
||||
* An item recipe
|
||||
*/
|
||||
RECIPE(7),
|
||||
/**
|
||||
* An material used to craft another item
|
||||
*/
|
||||
MATERIAL(8),
|
||||
/**
|
||||
* Pet collar
|
||||
*/
|
||||
PET_COLLAR(9),
|
||||
/**
|
||||
* Castle guard?????
|
||||
*/
|
||||
CASTLE_GUARD(10),
|
||||
/**
|
||||
* An lottery ticket
|
||||
*/
|
||||
LOTTERY_TICKET(11),
|
||||
/**
|
||||
* An race ticket
|
||||
*/
|
||||
RACE_TICKET(12),
|
||||
/**
|
||||
* An dye
|
||||
*/
|
||||
DYE(13),
|
||||
/**
|
||||
* A seed
|
||||
*/
|
||||
SEED(14),
|
||||
/**
|
||||
* A crop
|
||||
*/
|
||||
CROP(15),
|
||||
/**
|
||||
* An mature crop
|
||||
*/
|
||||
MATURECROP(16),
|
||||
/**
|
||||
* An harvest
|
||||
*/
|
||||
HARVEST(17),
|
||||
/**
|
||||
* An seed
|
||||
*/
|
||||
SEED2(18),
|
||||
/**
|
||||
* An ticket of lord
|
||||
*/
|
||||
TICKET_OF_LORD(19),
|
||||
/**
|
||||
* An lure
|
||||
*/
|
||||
LURE(20),
|
||||
/**
|
||||
* An blessed weapon enchant scroll
|
||||
*/
|
||||
BLESSED_WEAPON_ENCHANT_SCROLL(21),
|
||||
/**
|
||||
* An blessed armor enchant scroll
|
||||
*/
|
||||
BLESSED_ARMOR_ENCHANT_SCROLL(22),
|
||||
/**
|
||||
* An coupon
|
||||
*/
|
||||
COUPON(23),
|
||||
/**
|
||||
* An elixir
|
||||
*/
|
||||
ELIXIR(24),
|
||||
/**
|
||||
* Scroll used for enchanting attributes
|
||||
*/
|
||||
ATTRIBUTE_ENCHANT_SCROLL(25),
|
||||
/**
|
||||
* Bolt? unk.
|
||||
*/
|
||||
BOLT(26),
|
||||
/**
|
||||
* Scoll
|
||||
*/
|
||||
SCRL_INC_ENCHANT_PROP_WP(27),
|
||||
/**
|
||||
* Scroll
|
||||
*/
|
||||
SCRL_INC_ENCHANT_PROP_AM(28),
|
||||
/**
|
||||
* Ancient crystal enchant weapon
|
||||
*/
|
||||
ANCIENT_CRYSTAL_ENCHANT_WP(29),
|
||||
/**
|
||||
* Ancient crystal enchant armor
|
||||
*/
|
||||
ANCIENT_CRYSTAL_ENCHANT_AM(30),
|
||||
/**
|
||||
* Rune select
|
||||
*/
|
||||
RUNE_SELECT(31),
|
||||
/**
|
||||
* Rune
|
||||
*/
|
||||
RUNE(32);
|
||||
|
||||
/**
|
||||
* The packet id for this item type
|
||||
*/
|
||||
public final int id;
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* the numeric id
|
||||
*/
|
||||
ItemType(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.l2jserver.model.template.item;
|
||||
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
import com.l2jserver.model.world.actor.stat.StatType;
|
||||
|
||||
/**
|
||||
* Enum of all available weapon types
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
@XmlType(name = "WeaponType")
|
||||
public enum WeaponType {
|
||||
/**
|
||||
* The Sword weapon type
|
||||
*/
|
||||
SWORD(StatType.SWORD_WPN_VULN),
|
||||
/**
|
||||
* The blunt weapon type
|
||||
*/
|
||||
BLUNT(StatType.BLUNT_WPN_VULN),
|
||||
/**
|
||||
* The dagger weapon type
|
||||
*/
|
||||
DAGGER(StatType.DAGGER_WPN_VULN),
|
||||
/**
|
||||
* The bow weapon type
|
||||
*/
|
||||
BOW(StatType.BOW_WPN_VULN),
|
||||
/**
|
||||
* The pole weapon type
|
||||
*/
|
||||
POLE(StatType.POLE_WPN_VULN),
|
||||
/**
|
||||
* An dummy entry for a none-weapon
|
||||
*/
|
||||
NONE(StatType.NONE_WPN_VULN),
|
||||
/**
|
||||
* The dual sword weapon type
|
||||
*/
|
||||
DUAL(StatType.DUAL_WPN_VULN),
|
||||
/**
|
||||
* An other type of weapon
|
||||
*/
|
||||
ETC(StatType.ETC_WPN_VULN),
|
||||
/**
|
||||
* The fist weapon type
|
||||
*/
|
||||
FIST(StatType.FIST_WPN_VULN),
|
||||
/**
|
||||
* The dual fist weapon type
|
||||
*/
|
||||
DUALFIST(StatType.DUALFIST_WPN_VULN),
|
||||
/**
|
||||
* The fishing tools
|
||||
*/
|
||||
FISHINGROD(null),
|
||||
/**
|
||||
* The rapier weapon type
|
||||
*/
|
||||
RAPIER(StatType.RAPIER_WPN_VULN),
|
||||
/**
|
||||
* The ancient sword type
|
||||
*/
|
||||
ANCIENTSWORD(StatType.ANCIENT_WPN_VULN),
|
||||
/**
|
||||
* The crossbow type
|
||||
*/
|
||||
CROSSBOW(StatType.CROSSBOW_WPN_VULN),
|
||||
/**
|
||||
* Unk
|
||||
*/
|
||||
FLAG(null),
|
||||
/**
|
||||
* Unk
|
||||
*/
|
||||
OWNTHING(null),
|
||||
/**
|
||||
* The dual dagger weapon type
|
||||
*/
|
||||
DUALDAGGER(StatType.DUALDAGGER_WPN_VULN);
|
||||
|
||||
/**
|
||||
* This weapon type of weaknesses
|
||||
*/
|
||||
public final StatType weaknessesStat;
|
||||
|
||||
/**
|
||||
* @param weaknessesStat
|
||||
* the weapon weaknesses
|
||||
*/
|
||||
WeaponType(StatType weaknessesStat) {
|
||||
this.weaknessesStat = weaknessesStat;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.template.npc;
|
||||
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
/**
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
@XmlType(name = "NPCRaceType")
|
||||
@SuppressWarnings("javadoc")
|
||||
public enum NPCRace {
|
||||
// character races
|
||||
HUMAN, ELVEN, DARKELVEN, ORC, DWARVEN, KAMAEL,
|
||||
|
||||
// npc exclusive
|
||||
UNDEAD, MAGIC_CREATURE, BEAST, ANIMAL, PLANT, HUMANOID, SPIRIT,
|
||||
|
||||
ANGEL, DEMON, DRAGON, GIANT, BUG, FAIRIE, OTHER, NON_LIVING,
|
||||
|
||||
SIEGE_WEAPON, DEFENDING_ARMY, MERCENARIE, UNKNOWN, NONE;
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.template.npc;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
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.model.template.AbstractTemplate;
|
||||
import com.l2jserver.util.geometry.Coordinate;
|
||||
import com.l2jserver.util.jaxb.CoordinateAdapter;
|
||||
import com.l2jserver.util.jaxb.ItemTemplateIDAdapter;
|
||||
import com.l2jserver.util.jaxb.TeleportationTemplateIDAdapter;
|
||||
|
||||
/**
|
||||
* Template for effects
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
@XmlRootElement(name = "teleport", namespace = "http://schemas.l2jserver2.com/teleport")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(namespace = "http://schemas.l2jserver2.com/teleport", name = "TeleportType")
|
||||
public class TeleportationTemplate extends AbstractTemplate {
|
||||
/**
|
||||
* The teleportation template ID
|
||||
*/
|
||||
@XmlAttribute(name = "id")
|
||||
@XmlJavaTypeAdapter(TeleportationTemplateIDAdapter.class)
|
||||
protected TeleportationTemplateID id;
|
||||
/**
|
||||
* The teleportation name
|
||||
*/
|
||||
@XmlAttribute(name = "name")
|
||||
protected String name;
|
||||
|
||||
/**
|
||||
* The teleportation cost item id
|
||||
*/
|
||||
@XmlAttribute(name = "item", required = false)
|
||||
@XmlJavaTypeAdapter(ItemTemplateIDAdapter.class)
|
||||
protected ItemTemplateID itemTemplateID;
|
||||
/**
|
||||
* The amount of items decreased
|
||||
*/
|
||||
@XmlAttribute(name = "price", required = true)
|
||||
protected int price;
|
||||
|
||||
/**
|
||||
* The teleportation point
|
||||
*/
|
||||
@XmlElement(name = "point", required = false)
|
||||
@XmlJavaTypeAdapter(CoordinateAdapter.class)
|
||||
protected Coordinate coordinate;
|
||||
|
||||
/**
|
||||
* The teleportation restrictions
|
||||
*/
|
||||
@XmlElementWrapper(name = "restrictions", required = false)
|
||||
@XmlElement(name = "restriction", required = true)
|
||||
protected List<TeleportRestriction> restrictions;
|
||||
|
||||
/**
|
||||
* Defines an teleport restriction
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
@XmlType(name = "TeleportRestrictionType")
|
||||
public enum TeleportRestriction {
|
||||
/**
|
||||
* Only nobles can use this teleport
|
||||
*/
|
||||
NOBLE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link Coordinate}
|
||||
*
|
||||
* @return the created object
|
||||
*/
|
||||
public Coordinate create() {
|
||||
return coordinate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
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
|
||||
*/
|
||||
public Coordinate getCoordinate() {
|
||||
return coordinate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TeleportationTemplateID getID() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user