1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2026-03-12 21:58:28 +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:
2012-03-24 19:14:53 -03:00
parent 64368df8b3
commit ef39f3c67e
604 changed files with 17445 additions and 8677 deletions

View File

@@ -1,38 +0,0 @@
<component
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/component/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/component/1.1.2 http://maven.apache.org/xsd/component-1.1.2.xsd">
<fileSets>
<fileSet>
<directory>${project.basedir}/distribution</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
<source>${project.build.directory}/${project.artifactId}-${project.version}.jar</source>
<outputDirectory>/</outputDirectory>
<destName>l2jserver2.jar</destName>
<fileMode>0755</fileMode>
</file>
<file>
<source>${project.build.directory}/${project.artifactId}-${project.version}-data.zip</source>
<outputDirectory>/</outputDirectory>
<destName>data.zip</destName>
</file>
</files>
<dependencySets>
<dependencySet>
<outputDirectory>/libs</outputDirectory>
<useProjectArtifact>false</useProjectArtifact>
<unpack>false</unpack>
<scope>runtime</scope>
<excludes>
<exclude>mysql:*</exclude>
<exclude>com.orientechnologies:*</exclude>
<exclude>com.h2database:*</exclude>
<exclude>org.apache.derby:*</exclude>
</excludes>
</dependencySet>
</dependencySets>
</component>

View File

@@ -1,24 +0,0 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>derby-bin</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
<componentDescriptors>
<componentDescriptor>src/main/assembly/distribution-bin.xml</componentDescriptor>
</componentDescriptors>
<dependencySets>
<dependencySet>
<outputDirectory>/libs</outputDirectory>
<useProjectArtifact>false</useProjectArtifact>
<unpack>false</unpack>
<scope>runtime</scope>
<includes>
<include>org.apache.derby:*</include>
</includes>
</dependencySet>
</dependencySets>
</assembly>

View File

@@ -1,24 +0,0 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>h2-bin</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
<componentDescriptors>
<componentDescriptor>src/main/assembly/distribution-bin.xml</componentDescriptor>
</componentDescriptors>
<dependencySets>
<dependencySet>
<outputDirectory>/libs</outputDirectory>
<useProjectArtifact>false</useProjectArtifact>
<unpack>false</unpack>
<scope>runtime</scope>
<includes>
<include>com.h2database:*</include>
</includes>
</dependencySet>
</dependencySets>
</assembly>

View File

@@ -1,24 +0,0 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>mysql5-bin</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
<componentDescriptors>
<componentDescriptor>src/main/assembly/distribution-bin.xml</componentDescriptor>
</componentDescriptors>
<dependencySets>
<dependencySet>
<outputDirectory>/libs</outputDirectory>
<useProjectArtifact>false</useProjectArtifact>
<unpack>false</unpack>
<scope>runtime</scope>
<includes>
<include>mysql:*</include>
</includes>
</dependencySet>
</dependencySets>
</assembly>

View File

@@ -1,24 +0,0 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>orientdb-bin</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
<componentDescriptors>
<componentDescriptor>src/main/assembly/distribution-bin.xml</componentDescriptor>
</componentDescriptors>
<dependencySets>
<dependencySet>
<outputDirectory>/libs</outputDirectory>
<useProjectArtifact>false</useProjectArtifact>
<unpack>false</unpack>
<scope>runtime</scope>
<includes>
<include>com.orientechnologies:*</include>
</includes>
</dependencySet>
</dependencySets>
</assembly>

View File

@@ -1,32 +0,0 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>src</id>
<formats>
<format>zip</format>
</formats>
<baseDirectory></baseDirectory>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>data/**</include>
<include>src/**</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}/dist</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<outputDirectory>/libs</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<unpack>false</unpack>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
</assembly>

View File

@@ -2,26 +2,16 @@
<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
This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-b10
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
Generated on: 2012.03.24 at 06:20:02 PM BRT
-->
<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:schemaBindings map="false">
<jaxb:package name="com.l2jserver.model.template"/>
</jaxb:schemaBindings>
<jaxb:bindings scd="~CalculatorFunction">
<jaxb:class ref="com.l2jserver.model.template.CalculatorFunction"/>
</jaxb:bindings>
@@ -38,26 +28,26 @@ Generated on: 2012.01.19 at 03:37:11 PM BRST
<jaxb:class ref="com.l2jserver.model.template.CalculatorFunctionOperation"/>
</jaxb:bindings>
</jaxb:bindings>
<jaxb:bindings scd="x-schema::tns" xmlns:tns="http://schemas.l2jserver2.com/character">
<jaxb:schemaBindings map="false">
<jaxb:package name="com.l2jserver.model.template"/>
</jaxb:schemaBindings>
<jaxb:bindings scd="tns:character">
<jaxb:class ref="com.l2jserver.model.template.CharacterTemplate"/>
</jaxb:bindings>
</jaxb:bindings>
<jaxb:bindings scd="x-schema::tns" xmlns:tns="http://schemas.l2jserver2.com/teleport">
<jaxb:schemaBindings map="false"/>
<jaxb:schemaBindings map="false">
<jaxb:package name="com.l2jserver.model.template"/>
</jaxb:schemaBindings>
<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:schemaBindings map="false">
<jaxb:package name="com.l2jserver.model.template"/>
</jaxb:schemaBindings>
<jaxb:bindings scd="tns:zones">
<jaxb:class ref="com.l2jserver.model.template.Zones"/>
</jaxb:bindings>
@@ -65,5 +55,29 @@ Generated on: 2012.01.19 at 03:37:11 PM BRST
<jaxb:class ref="com.l2jserver.model.template.ZoneType"/>
</jaxb:bindings>
</jaxb:bindings>
<jaxb:bindings scd="x-schema::tns" xmlns:tns="http://schemas.l2jserver2.com/skill">
<jaxb:schemaBindings map="false">
<jaxb:package name="com.l2jserver.model.template"/>
</jaxb:schemaBindings>
<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/npc">
<jaxb:schemaBindings map="false">
<jaxb:package name="com.l2jserver.model.template"/>
</jaxb:schemaBindings>
<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="http://schemas.l2jserver2.com/item">
<jaxb:schemaBindings map="false">
<jaxb:package name="com.l2jserver.model.template"/>
</jaxb:schemaBindings>
<jaxb:bindings scd="tns:item">
<jaxb:class ref="com.l2jserver.model.template.ItemTemplate"/>
</jaxb:bindings>
</jaxb:bindings>
</jaxb:bindings>

View File

@@ -1,48 +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>
* &lt;complexType name="AbstractTemplate">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/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
{
}
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-b10
// 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.03.24 at 06:20:02 PM BRT
//
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>
* &lt;complexType name="AbstractTemplate">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/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
{
}

View File

@@ -1,44 +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>
* &lt;complexType name="ActorTemplate">
* &lt;complexContent>
* &lt;extension base="{}AbstractTemplate">
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ActorTemplate")
@XmlSeeAlso({
CharacterTemplate.class,
NPCTemplate.class
})
public abstract class ActorTemplate
extends AbstractTemplate
{
}
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-b10
// 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.03.24 at 06:20:02 PM BRT
//
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>
* &lt;complexType name="ActorTemplate">
* &lt;complexContent>
* &lt;extension base="{}AbstractTemplate">
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ActorTemplate")
@XmlSeeAlso({
CharacterTemplate.class,
NPCTemplate.class
})
public abstract class ActorTemplate
extends AbstractTemplate
{
}

View File

@@ -1,148 +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>
* &lt;complexType name="CalculatorFunction">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="set" type="{}CalculatorFunctionOperation" minOccurs="0"/>
* &lt;element name="add" type="{}CalculatorFunctionOperation" minOccurs="0"/>
* &lt;element name="subtract" type="{}CalculatorFunctionOperation" minOccurs="0"/>
* &lt;element name="random" type="{}CalculatorFunctionOperation" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/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;
}
}
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-b10
// 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.03.24 at 06:20:02 PM BRT
//
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>
* &lt;complexType name="CalculatorFunction">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="set" type="{}CalculatorFunctionOperation" minOccurs="0"/>
* &lt;element name="add" type="{}CalculatorFunctionOperation" minOccurs="0"/>
* &lt;element name="subtract" type="{}CalculatorFunctionOperation" minOccurs="0"/>
* &lt;element name="random" type="{}CalculatorFunctionOperation" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/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;
}
}

View File

@@ -1,85 +1,85 @@
//
// 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>
* &lt;complexType name="CalculatorFunctionOperation">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="order" use="required" type="{http://www.w3.org/2001/XMLSchema}integer" />
* &lt;attribute name="value" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/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;
}
}
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-b10
// 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.03.24 at 06:20:02 PM BRT
//
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>
* &lt;complexType name="CalculatorFunctionOperation">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="order" use="required" type="{http://www.w3.org/2001/XMLSchema}integer" />
* &lt;attribute name="value" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/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;
}
}

View File

@@ -1,97 +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>
* &lt;complexType name="Coordinate">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;/sequence>
* &lt;attribute name="x" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="y" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="z" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/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;
}
}
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-b10
// 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.03.24 at 06:20:02 PM BRT
//
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>
* &lt;complexType name="Coordinate">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;/sequence>
* &lt;attribute name="x" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="y" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="z" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/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;
}
}

View File

@@ -1,162 +1,162 @@
//
// 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>
* &lt;element name="skill">
* &lt;complexType>
* &lt;complexContent>
* &lt;extension base="{}AbstractTemplate">
* &lt;sequence>
* &lt;element name="maximumLevel" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;/sequence>
* &lt;attribute name="id" use="required" type="{http://schemas.l2jserver2.com/skill}SkillTemplateID" />
* &lt;attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;attribute name="delay" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="cooldown" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/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;
}
}
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-b10
// 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.03.24 at 06:20:02 PM BRT
//
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>
* &lt;element name="skill">
* &lt;complexType>
* &lt;complexContent>
* &lt;extension base="{}AbstractTemplate">
* &lt;sequence>
* &lt;element name="maximumLevel" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;/sequence>
* &lt;attribute name="id" use="required" type="{http://schemas.l2jserver2.com/skill}SkillTemplateID" />
* &lt;attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;attribute name="delay" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="cooldown" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/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;
}
}

View File

@@ -1,379 +1,379 @@
//
// 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>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="teleport" maxOccurs="unbounded">
* &lt;complexType>
* &lt;complexContent>
* &lt;extension base="{}AbstractTemplate">
* &lt;sequence>
* &lt;element name="point" type="{}Coordinate" minOccurs="0"/>
* &lt;element name="restrictions" minOccurs="0">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="restriction" maxOccurs="unbounded">
* &lt;simpleType>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
* &lt;enumeration value="NOBLE"/>
* &lt;/restriction>
* &lt;/simpleType>
* &lt;/element>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;/sequence>
* &lt;attribute name="id" use="required" type="{http://schemas.l2jserver2.com/teleport}TeleportationTemplateID" />
* &lt;attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;attribute name="item" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="price" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/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>
* &lt;complexType>
* &lt;complexContent>
* &lt;extension base="{}AbstractTemplate">
* &lt;sequence>
* &lt;element name="point" type="{}Coordinate" minOccurs="0"/>
* &lt;element name="restrictions" minOccurs="0">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="restriction" maxOccurs="unbounded">
* &lt;simpleType>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
* &lt;enumeration value="NOBLE"/>
* &lt;/restriction>
* &lt;/simpleType>
* &lt;/element>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;/sequence>
* &lt;attribute name="id" use="required" type="{http://schemas.l2jserver2.com/teleport}TeleportationTemplateID" />
* &lt;attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;attribute name="item" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="price" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;/extension>
* &lt;/complexContent>
* &lt;/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>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="restriction" maxOccurs="unbounded">
* &lt;simpleType>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
* &lt;enumeration value="NOBLE"/>
* &lt;/restriction>
* &lt;/simpleType>
* &lt;/element>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/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;
}
}
}
}
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-b10
// 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.03.24 at 06:20:02 PM BRT
//
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>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="teleport" maxOccurs="unbounded">
* &lt;complexType>
* &lt;complexContent>
* &lt;extension base="{}AbstractTemplate">
* &lt;sequence>
* &lt;element name="point" type="{}Coordinate" minOccurs="0"/>
* &lt;element name="restrictions" minOccurs="0">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="restriction" maxOccurs="unbounded">
* &lt;simpleType>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
* &lt;enumeration value="NOBLE"/>
* &lt;/restriction>
* &lt;/simpleType>
* &lt;/element>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;/sequence>
* &lt;attribute name="id" use="required" type="{http://schemas.l2jserver2.com/teleport}TeleportationTemplateID" />
* &lt;attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;attribute name="item" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="price" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/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>
* &lt;complexType>
* &lt;complexContent>
* &lt;extension base="{}AbstractTemplate">
* &lt;sequence>
* &lt;element name="point" type="{}Coordinate" minOccurs="0"/>
* &lt;element name="restrictions" minOccurs="0">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="restriction" maxOccurs="unbounded">
* &lt;simpleType>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
* &lt;enumeration value="NOBLE"/>
* &lt;/restriction>
* &lt;/simpleType>
* &lt;/element>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;/sequence>
* &lt;attribute name="id" use="required" type="{http://schemas.l2jserver2.com/teleport}TeleportationTemplateID" />
* &lt;attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;attribute name="item" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="price" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;/extension>
* &lt;/complexContent>
* &lt;/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>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="restriction" maxOccurs="unbounded">
* &lt;simpleType>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
* &lt;enumeration value="NOBLE"/>
* &lt;/restriction>
* &lt;/simpleType>
* &lt;/element>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/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;
}
}
}
}

View File

@@ -1,179 +1,179 @@
//
// 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>
* &lt;complexType name="ZoneType">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="point" maxOccurs="unbounded">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;/sequence>
* &lt;attribute name="x" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="y" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;/sequence>
* &lt;attribute name="id" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/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>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;/sequence>
* &lt;attribute name="x" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="y" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/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;
}
}
}
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-b10
// 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.03.24 at 06:20:02 PM BRT
//
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>
* &lt;complexType name="ZoneType">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="point" maxOccurs="unbounded">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;/sequence>
* &lt;attribute name="x" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="y" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;/sequence>
* &lt;attribute name="id" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/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>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;/sequence>
* &lt;attribute name="x" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="y" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/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;
}
}
}

View File

@@ -1,211 +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>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="castle">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="siege">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="zone" type="{zones}ZoneType"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/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>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="siege">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="zone" type="{zones}ZoneType"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/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>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="zone" type="{zones}ZoneType"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/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;
}
}
}
}
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-b10
// 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.03.24 at 06:20:02 PM BRT
//
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>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="castle">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="siege">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="zone" type="{zones}ZoneType"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/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>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="siege">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="zone" type="{zones}ZoneType"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/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>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="zone" type="{zones}ZoneType"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/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;
}
}
}
}

View File

@@ -1,27 +0,0 @@
/*
* 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 {
}

View File

@@ -1,33 +0,0 @@
/*
* 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.game.net.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;
}

View File

@@ -1,136 +0,0 @@
/*
* 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);
}
}
}

View File

@@ -1,72 +0,0 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.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);
}

View File

@@ -1,73 +0,0 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.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;
}
}

View File

@@ -1,70 +0,0 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.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;
}
}

View File

@@ -1,80 +0,0 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.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);
}

View File

@@ -1,46 +0,0 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.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);
}

View File

@@ -1,56 +0,0 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.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);
}

View File

@@ -1,214 +0,0 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.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();
}
}

View File

@@ -1,71 +0,0 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.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;
}
}

View File

@@ -1,414 +0,0 @@
/*
* 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.game.net;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelFuture;
import com.l2jserver.game.net.codec.Lineage2Decrypter;
import com.l2jserver.game.net.codec.Lineage2Encrypter;
import com.l2jserver.game.net.codec.Lineage2PacketReader;
import com.l2jserver.game.net.codec.Lineage2PacketWriter;
import com.l2jserver.game.net.packet.ServerPacket;
import com.l2jserver.game.net.packet.server.SM_ACTION_FAILED;
import com.l2jserver.game.net.packet.server.SM_CHAR_INVENTORY;
import com.l2jserver.game.net.packet.server.SM_CHAR_INVENTORY_UPDATE;
import com.l2jserver.game.net.packet.server.SM_CHAR_INVENTORY_UPDATE.InventoryUpdateType;
import com.l2jserver.game.net.packet.server.SM_COMMUNITY_HTML;
import com.l2jserver.game.net.packet.server.SM_HTML;
import com.l2jserver.game.net.packet.server.SM_SYSTEM_MESSAGE;
import com.l2jserver.model.game.Fort;
import com.l2jserver.model.game.Skill;
import com.l2jserver.model.id.object.CharacterID;
import com.l2jserver.model.template.ItemTemplate;
import com.l2jserver.model.world.Item;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.util.html.markup.HtmlTemplate;
/**
* This object connects the model (structure objects normally stored in the
* database) to the controller (protocol stuff).
* <p>
* This class also provides handy methods for {@link #write(ServerPacket)
* writing} packets.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class Lineage2Client {
/**
* The connection channel
*/
private final Channel channel;
/**
* The character object
*/
private CharacterID characterID;
/**
* The Lineage 2 session
*/
private Lineage2Session session;
/**
* The client supported protocol version
*/
private ProtocolVersion version;
/**
* Creates a new instance
*
* @param channel
* the channel
*/
public Lineage2Client(Channel channel) {
this.channel = channel;
}
/**
* @return the character
*/
public boolean hasCharacter() {
return characterID != null;
}
/**
* @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 session
*/
public Lineage2Session getSession() {
return session;
}
/**
* @param session
* the session to set
*/
public void setSession(Lineage2Session session) {
if (this.session != null)
throw new IllegalStateException("Session is already set!");
this.session = session;
}
/**
* @return the version
*/
public ProtocolVersion getVersion() {
return version;
}
/**
* @param version
* the version to set
*/
public void setVersion(ProtocolVersion version) {
this.version = version;
}
/**
* Check if the client supports an given version of the protocol. Note that
* if the protocol is not known false will always be returned.
*
* @param version
* the protocol version to test for support
* @return true if version is supported by the client
* @see com.l2jserver.game.net.ProtocolVersion#supports(com.l2jserver.game.net.ProtocolVersion)
*/
public boolean supports(ProtocolVersion version) {
if (version == null)
return false;
return this.version.supports(version);
}
/**
* Get the channel
*
* @return the channel
*/
public Channel getChannel() {
return channel;
}
/**
* Test if the client is still open.
* <p>
* Please note that the channel can be open but disconnected!
*
* @return true if the client is still open
* @see Channel#isOpen()
*/
public boolean isOpen() {
return channel.isOpen();
}
/**
* Test if the client is still connected
* <p>
* Please note that the channel can be open but disconnected!
*
* @return true if the client is still connected
* @see Channel#isConnected()
*/
public boolean isConnected() {
return channel.isConnected();
}
/**
* Writes an packet to this client
* <p>
* Please note that this method will <b>not</b> block for the packets to be
* sent. It is possible to check if the packet was sent successfully using
* the {@link ChannelFuture}.
*
* @param packet
* the packet
* @return the {@link ChannelFuture} that will be notified once the packet
* has been written.
*/
public ChannelFuture write(ServerPacket packet) {
return channel.write(packet);
}
/**
* Sends a string message to this client
*
* @param message
* the message
* @return the {@link ChannelFuture} that will be notified once the packet
* has been written.
*/
public ChannelFuture sendMessage(String message) {
return write(new SM_SYSTEM_MESSAGE(SystemMessage.S1).addString(message));
}
/**
* Sends a {@link SystemMessage} to this client
*
* @param message
* the {@link SystemMessage}
* @return the {@link ChannelFuture} that will be notified once the packet
* has been written.
*/
public ChannelFuture sendSystemMessage(SystemMessage message) {
return write(message.packet);
}
/**
* Sends a {@link SystemMessage} to this client
*
* @param message
* the {@link SystemMessage}
* @param args
* the arguments of the message, they will be automatically
* detected and inserted. See {@link SM_SYSTEM_MESSAGE} for more
* about supported formats.
* @return the {@link ChannelFuture} that will be notified once the packet
* has been written.
* @see SM_SYSTEM_MESSAGE
*/
public ChannelFuture sendSystemMessage(SystemMessage message,
Object... args) {
final SM_SYSTEM_MESSAGE packet = new SM_SYSTEM_MESSAGE(message);
for (final Object obj : args) {
if (obj instanceof String)
packet.addString((String) obj);
else if (obj instanceof ItemTemplate)
packet.addItem((ItemTemplate) obj);
else if (obj instanceof Item)
packet.addItem((Item) obj);
else if (obj instanceof Number)
packet.addNumber((Integer) obj);
else if (obj instanceof Skill)
packet.addSkill((Skill) obj);
else if (obj instanceof Fort)
packet.addFort((Fort) obj);
}
return write(packet);
}
/**
* Sends a {@link SM_ACTION_FAILED} to the client.
* <p>
* This is an convenience method for <blockquote><code>
* conn.write(ActionFailedPacket.SHARED_INSTANCE);</code></blockquote>
*
* @return the {@link ChannelFuture} that will be notified once the packet
* has been written.
*/
public ChannelFuture sendActionFailed() {
return write(SM_ACTION_FAILED.SHARED_INSTANCE);
}
/**
* Sends a {@link SM_HTML} packet to the client. In the packet, the NPC will
* be null. If you wish to send the HTML with an NPC, you should send the
* packet directly.
* <p>
* This is an convenience method for <blockquote><code>
* conn.write(new SM_HTML(null, template));</code></blockquote>
*
* @param template
* the HTML template to be sent
* @return the {@link ChannelFuture} that will be notified once the packet
* has been written.
*/
public ChannelFuture sendHTML(HtmlTemplate template) {
return write(new SM_HTML(null, template));
}
/**
* Sends a {@link SM_COMMUNITY_HTML} packet to the client. HTML code is not
* displayed in the regular chat window, they will appear in a large one.
* <p>
* This is an convenience method for <blockquote><code>
* conn.write(new SM_COMMUNITY_HTML(template));</code></blockquote>
*
* @param template
* the HTML template to be sent
* @return the {@link ChannelFuture} that will be notified once the packet
* has been written.
*/
public ChannelFuture sendCommunityHTML(HtmlTemplate template) {
return write(new SM_COMMUNITY_HTML(template));
}
/**
* Sends the whole user inventory to the client. This is a very bandwidth
* consuming process and should be avoided.
*
* @return the {@link ChannelFuture} that will be notified once the packet
* has been written.
*/
public ChannelFuture updateEntireInventoryItems() {
return write(new SM_CHAR_INVENTORY(characterID.getObject()
.getInventory()));
}
/**
* Removes <code>items</code> from the game client UI.
*
* @param items
* the list of items to be removed
* @return the {@link ChannelFuture} that will be notified once the packet
* has been written.
*/
public ChannelFuture removeInventoryItems(Item... items) {
return write(new SM_CHAR_INVENTORY_UPDATE(InventoryUpdateType.REMOVE,
items));
}
/**
* Updates <code>items</code> in the game client UI.
*
* @param items
* the list of items to be updated
* @return the {@link ChannelFuture} that will be notified once the packet
* has been written.
*/
public ChannelFuture updateInventoryItems(Item... items) {
return write(new SM_CHAR_INVENTORY_UPDATE(InventoryUpdateType.UPDATE,
items));
}
/**
* Adds <code>items</code> in the game client UI.
*
* @param items
* the list of items to be added
* @return the {@link ChannelFuture} that will be notified once the packet
* has been written.
*/
public ChannelFuture addInventoryItems(Item... items) {
return write(new SM_CHAR_INVENTORY_UPDATE(InventoryUpdateType.ADD,
items));
}
/**
* Disconnects this client, without closing the channel.
*
* @return the {@link ChannelFuture}
*/
public ChannelFuture disconnect() {
return channel.disconnect();
}
/**
* Closes the channel of this client.
*
* @return the {@link ChannelFuture}
*/
public ChannelFuture close() {
return channel.close();
}
/**
* @return the client {@link Lineage2Decrypter}
*/
public Lineage2Decrypter getDecrypter() {
return (Lineage2Decrypter) channel.getPipeline().get(
Lineage2Decrypter.HANDLER_NAME);
}
/**
* @return the client {@link Lineage2Encrypter}
*/
public Lineage2Encrypter getEncrypter() {
return (Lineage2Encrypter) channel.getPipeline().get(
Lineage2Encrypter.HANDLER_NAME);
}
/**
* @return the client {@link Lineage2PacketReader}
*/
public Lineage2PacketReader getPacketReader() {
return (Lineage2PacketReader) channel.getPipeline().get(
Lineage2PacketReader.HANDLER_NAME);
}
/**
* @return the client {@link Lineage2PacketWriter}
*/
public Lineage2PacketWriter getPacketWriter() {
return (Lineage2PacketWriter) channel.getPipeline().get(
Lineage2PacketWriter.HANDLER_NAME);
}
@Override
public String toString() {
return "Lineage2Client [channel=" + channel + ", characterID="
+ characterID + ", session=" + session + ", version=" + version
+ "]";
}
}

View File

@@ -1,89 +0,0 @@
/*
* 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.game.net;
import java.util.Arrays;
/**
* Manages the cryptography key used to write/read packets. This class also
* updates the key once data has been sent/received.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class Lineage2CryptographyKey {
/**
* The raw key
*/
public final byte[] key;
/**
* Creates a new instance
*
* @param key
* the raw key
*/
public Lineage2CryptographyKey(byte[] key) {
this.key = key;
}
/**
* @return the key
*/
public byte[] getKey() {
return key;
}
/**
* Get the key value for byte index <tt>i</tt>
*
* @param i
* the index i
* @return the key byte
*/
public byte get(int i) {
return key[i & 15];
}
/**
* Updates this key once data has been sent/received.
*
* @param size
* the data size
*/
public void update(int size) {
int old = key[8] & 0xff;
old |= key[9] << 8 & 0xff00;
old |= key[10] << 0x10 & 0xff0000;
old |= key[11] << 0x18 & 0xff000000;
old += size;
key[8] = (byte) (old & 0xff);
key[9] = (byte) (old >> 0x08 & 0xff);
key[10] = (byte) (old >> 0x10 & 0xff);
key[11] = (byte) (old >> 0x18 & 0xff);
}
/**
* Creates a copy of this key
*
* @return the copied key
*/
public Lineage2CryptographyKey copy() {
return new Lineage2CryptographyKey(Arrays.copyOf(key, key.length));
}
}

View File

@@ -1,101 +0,0 @@
/*
* 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.game.net;
import static org.jboss.netty.channel.Channels.pipeline;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.ChannelPipelineFactory;
import org.jboss.netty.handler.logging.LoggingHandler;
import org.jboss.netty.logging.InternalLogLevel;
import com.google.inject.Guice;
import com.google.inject.Inject;
import com.google.inject.Injector;
import com.l2jserver.game.net.codec.Lineage2Decrypter;
import com.l2jserver.game.net.codec.Lineage2Encrypter;
import com.l2jserver.game.net.codec.Lineage2FrameDecoder;
import com.l2jserver.game.net.codec.Lineage2FrameEncoder;
import com.l2jserver.game.net.codec.Lineage2PacketReader;
import com.l2jserver.game.net.codec.Lineage2PacketWriter;
import com.l2jserver.game.net.handler.Lineage2PacketHandler;
import com.l2jserver.game.net.handler.Lineage2TimeoutHandler;
import com.l2jserver.service.network.NettyNetworkService;
import com.l2jserver.service.network.NetworkService;
/**
* This class creates a new instance of {@link ChannelPipeline} and attaches all
* handlers and codecs.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class Lineage2PipelineFactory implements ChannelPipelineFactory {
/**
* The Google Guice {@link Injector}.
*/
private final Injector injector;
/**
* The {@link NettyNetworkService}
*/
private final NettyNetworkService nettyNetworkService;
/**
* Creates a new instance of this pipeline
*
* @param injector
* the {@link Guice} {@link Injector}
* @param networkService
* the network service
*/
@Inject
public Lineage2PipelineFactory(Injector injector,
NetworkService networkService) {
this.injector = injector;
this.nettyNetworkService = (NettyNetworkService) networkService;
}
@Override
public ChannelPipeline getPipeline() throws Exception {
final ChannelPipeline pipeline = pipeline();
// pipeline.addLast("timeout.tiner", new IdleStateHandler(
// new HashedWheelTimer(), 30, 30, 0));
pipeline.addLast("frame.encoder", new Lineage2FrameEncoder());
pipeline.addLast("frame.decoder", new Lineage2FrameDecoder());
pipeline.addLast(Lineage2Encrypter.HANDLER_NAME,
new Lineage2Encrypter());
pipeline.addLast(Lineage2Decrypter.HANDLER_NAME,
new Lineage2Decrypter());
pipeline.addLast(Lineage2PacketWriter.HANDLER_NAME,
new Lineage2PacketWriter());
pipeline.addLast(Lineage2PacketReader.HANDLER_NAME,
new Lineage2PacketReader(injector));
pipeline.addLast("logger", new LoggingHandler(InternalLogLevel.DEBUG,
true));
final Lineage2TimeoutHandler timeoutHandler = new Lineage2TimeoutHandler();
pipeline.addLast("packet.handler", new Lineage2PacketHandler(
nettyNetworkService, timeoutHandler));
// pipeline.addLast("timeout.handler", timeoutHandler);
return pipeline;
}
}

View File

@@ -1,114 +0,0 @@
/*
* 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.game.net;
import com.l2jserver.model.id.AccountID;
/**
* Lineage 2 session with the username and loginserver keys
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class Lineage2Session {
/**
* The account ID
*/
private final AccountID accountID;
/**
* The play key, part 1
*/
private final int playKey1;
/**
* The play key, part 2
*/
private final int playKey2;
/**
* The login key, part 1
*/
private final int loginKey1;
/**
* The login key, part 2
*/
private final int loginKey2;
/**
* Creates a new instance
*
* @param accountID
* the account ID
* @param playOK1
* the play key, part 1
* @param playOK2
* the play key, part 2
* @param loginOK1
* the login key, part 1
* @param loginOK2
* the login key, part 2
*/
public Lineage2Session(AccountID accountID, int playOK1, int playOK2,
int loginOK1, int loginOK2) {
this.accountID = accountID;
this.playKey1 = playOK1;
this.playKey2 = playOK2;
this.loginKey1 = loginOK1;
this.loginKey2 = loginOK2;
}
/**
* @return the account ID
*/
public AccountID getAccountID() {
return accountID;
}
/**
* @return the playKey1
*/
public int getPlayKey1() {
return playKey1;
}
/**
* @return the playKey2
*/
public int getPlayKey2() {
return playKey2;
}
/**
* @return the loginKey1
*/
public int getLoginKey1() {
return loginKey1;
}
/**
* @return the loginKey2
*/
public int getLoginKey2() {
return loginKey2;
}
@Override
public String toString() {
return "Lineage2Session [accountID=" + accountID + ", playKey1="
+ playKey1 + ", playKey2=" + playKey2 + ", loginKey1="
+ loginKey1 + ", loginKey2=" + loginKey2 + "]";
}
}

View File

@@ -1,102 +0,0 @@
/*
* 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.game.net;
/**
* Represents the protocol version used by the client
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public enum ProtocolVersion {
/**
* The Release version, this is acctually a pseudo version. It never really
* existed.
*/
RELEASE(0),
/**
* The Interlude(200) version
*/
INTERLUDE(200, RELEASE),
/**
* The Freya(216) version
*/
FREYA(216, RELEASE),
/**
* The High5(268) version
*/
HIGH5(268, FREYA);
/**
* The parent version
*/
public final ProtocolVersion parent;
/**
* This version numeric ID
*/
public final int version;
/**
* Creates a new instance
*
* @param version
* the version integer id
*/
ProtocolVersion(int version) {
this(version, null);
}
/**
* Creates a new instance with a parent version
*
* @param version
* the version integer id
* @param parent
* the parent version
*/
ProtocolVersion(int version, ProtocolVersion parent) {
this.version = version;
this.parent = parent;
}
/**
* Checks if an given version is compatible with this
*
* @param version
* the target version to be tested
* @return true if version is compatible
*/
public boolean supports(ProtocolVersion version) {
if (this == version)
return true;
if (this.parent == null)
return false;
return this.parent.supports(version);
}
/**
* @param version
* the version integer id
* @return the detected version from the numeric id. Can be <tt>null</tt>
*/
public static ProtocolVersion fromVersion(int version) {
for (ProtocolVersion v : values()) {
if (v.version == version)
return v;
}
return null;
}
}

View File

@@ -1,109 +0,0 @@
/*
* 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.game.net.codec;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.oneone.OneToOneDecoder;
import com.l2jserver.game.net.Lineage2CryptographyKey;
/**
* Decrypts encrypted Lineage II packets
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class Lineage2Decrypter extends OneToOneDecoder {
/**
* The handler name
*/
public static final String HANDLER_NAME = "crypto.decoder";
/**
* Enabled state
*/
private boolean enabled = false;
/**
* Crypto key
*/
private Lineage2CryptographyKey key;
@Override
protected Object decode(ChannelHandlerContext ctx, Channel channel,
Object msg) throws Exception {
if (!(msg instanceof ChannelBuffer))
return msg;
if (!enabled)
return msg;
final ChannelBuffer buffer = (ChannelBuffer) msg;
final int offset = buffer.readerIndex();
final int size = buffer.readableBytes();
int temp = 0;
synchronized (key) {
for (int i = 0; i < size; i++) {
int temp2 = buffer.getByte(offset + i) & 0xFF;
buffer.setByte(offset + i, (temp2 ^ key.get(i) ^ temp));
temp = temp2;
}
key.update(size);
}
return buffer;
}
/**
* Creates a random key and enables descrypting
*
* @param key
* the key
*/
public void enable(Lineage2CryptographyKey key) {
this.setKey(key);
this.setEnabled(true);
}
/**
* Set this decrypter key. The key can only be set once.
*
* @param key
* the key
*/
public void setKey(Lineage2CryptographyKey key) {
if (this.key != null)
throw new IllegalStateException("Key is already set");
this.key = key;
}
/**
* @return true if decrypter is enabled
*/
public boolean isEnabled() {
return enabled;
}
/**
* Sets the state of this decrypter
*
* @param enabled
* the new state
*/
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
}

View File

@@ -1,109 +0,0 @@
/*
* 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.game.net.codec;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
import com.l2jserver.game.net.Lineage2CryptographyKey;
/**
* Encrypts Lineage II packets
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class Lineage2Encrypter extends OneToOneEncoder {
/**
* The handler name
*/
public static final String HANDLER_NAME = "crypto.encoder";
/**
* Enabled state
*/
private boolean enabled = false;
/**
* Crypto key
*/
private Lineage2CryptographyKey key;
@Override
protected Object encode(ChannelHandlerContext ctx, Channel channel,
Object msg) throws Exception {
if (!(msg instanceof ChannelBuffer))
return msg;
if (!enabled)
return msg;
final ChannelBuffer buffer = (ChannelBuffer) msg;
final int offset = buffer.readerIndex() + 2; // skip header
final int size = buffer.readableBytes() - 2;
int temp = 0, temp2 = 0;
synchronized (key) {
for (int i = 0; i < size; i++) {
temp2 = buffer.getByte(offset + i) & 0xFF;
temp = temp2 ^ key.get(i) ^ temp;
buffer.setByte(offset + i, (byte) temp);
}
key.update(size);
}
return msg;
}
/**
* Enables this encrypter with the given <tt>key</tt>
*
* @param key
* the key
*/
public void enable(Lineage2CryptographyKey key) {
this.setKey(key);
this.setEnabled(true);
}
/**
* Set this decrypter key. The key can only be set once.
*
* @param key
* the key
*/
public void setKey(Lineage2CryptographyKey key) {
if (this.key != null)
throw new IllegalStateException("Key is already set");
this.key = key;
}
/**
* @return true if this encrypter is enabled
*/
public boolean isEnabled() {
return enabled;
}
/**
* Sets the state of this encrypter
*
* @param enabled
* the new state
*/
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
}

View File

@@ -1,61 +0,0 @@
/*
* 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.game.net.codec;
import java.nio.ByteOrder;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.frame.FrameDecoder;
/**
* This decoder parses Lineage II frames. Each frame is has a header of 2 bytes
* unsigned short.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class Lineage2FrameDecoder extends FrameDecoder {
/**
* The message header size (in bytes)
*/
private static final int HEADER_SIZE = 2;
@Override
protected Object decode(ChannelHandlerContext ctx, Channel channel,
ChannelBuffer oldBuffer) throws Exception {
if (oldBuffer.readableBytes() < 2)
return null;
ChannelBuffer buffer = ChannelBuffers.wrappedBuffer(oldBuffer
.toByteBuffer().order(ByteOrder.LITTLE_ENDIAN));
buffer.markReaderIndex();
final int pending = buffer.readUnsignedShort() - HEADER_SIZE;
if (pending == 0)
return null;
if (buffer.readableBytes() < pending) {
buffer.resetReaderIndex();
return null;
}
final ChannelBuffer b = buffer.copy(buffer.readerIndex(), pending);
oldBuffer.skipBytes(pending + HEADER_SIZE);
return ChannelBuffers.wrappedBuffer(b.toByteBuffer().order(
ByteOrder.LITTLE_ENDIAN));
}
}

View File

@@ -1,41 +0,0 @@
/*
* 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.game.net.codec;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
/**
* This encoder creates Lineage II frames. Each frame is has a header of 2 bytes
* unsigned short.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class Lineage2FrameEncoder extends OneToOneEncoder {
@Override
protected Object encode(ChannelHandlerContext ctx, Channel channel,
Object msg) throws Exception {
if (!(msg instanceof ChannelBuffer))
return msg;
final ChannelBuffer buffer = (ChannelBuffer) msg;
buffer.setShort(0, buffer.readableBytes());
return buffer;
}
}

View File

@@ -1,226 +0,0 @@
/*
* 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.game.net.codec;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.oneone.OneToOneDecoder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.inject.Inject;
import com.google.inject.Injector;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.ClientPacket;
import com.l2jserver.game.net.packet.client.CM_ACTION_USE;
import com.l2jserver.game.net.packet.client.CM_ADMIN_COMMAND;
import com.l2jserver.game.net.packet.client.CM_AUTH_LOGIN;
import com.l2jserver.game.net.packet.client.CM_BYPASS;
import com.l2jserver.game.net.packet.client.CM_CHAR_ACTION;
import com.l2jserver.game.net.packet.client.CM_CHAR_APPEARING;
import com.l2jserver.game.net.packet.client.CM_CHAR_ATTACK;
import com.l2jserver.game.net.packet.client.CM_CHAR_CHAT;
import com.l2jserver.game.net.packet.client.CM_CHAR_CREATE;
import com.l2jserver.game.net.packet.client.CM_CHAR_MOVE;
import com.l2jserver.game.net.packet.client.CM_CHAR_OPEN_MAP;
import com.l2jserver.game.net.packet.client.CM_CHAR_POSITION;
import com.l2jserver.game.net.packet.client.CM_CHAR_REQ_INVENTORY;
import com.l2jserver.game.net.packet.client.CM_CHAR_SELECT;
import com.l2jserver.game.net.packet.client.CM_CHAR_SHORTCUT_CREATE;
import com.l2jserver.game.net.packet.client.CM_CHAR_SHORTCUT_REMOVE;
import com.l2jserver.game.net.packet.client.CM_CHAR_TARGET_UNSELECT;
import com.l2jserver.game.net.packet.client.CM_ENTER_WORLD;
import com.l2jserver.game.net.packet.client.CM_EXT_REQ_ALL_FORTRESS_INFO;
import com.l2jserver.game.net.packet.client.CM_EXT_REQ_KEY_MAPPING;
import com.l2jserver.game.net.packet.client.CM_EXT_REQ_MANOR_LIST;
import com.l2jserver.game.net.packet.client.CM_GG_KEY;
import com.l2jserver.game.net.packet.client.CM_GOTO_LOBBY;
import com.l2jserver.game.net.packet.client.CM_ITEM_DESTROY;
import com.l2jserver.game.net.packet.client.CM_ITEM_DROP;
import com.l2jserver.game.net.packet.client.CM_LOGOUT;
import com.l2jserver.game.net.packet.client.CM_PROTOCOL_VERSION;
import com.l2jserver.game.net.packet.client.CM_REQUEST_CHAR_TEMPLATE;
import com.l2jserver.game.net.packet.client.CM_RESTART;
/**
* This decoder reads an frame and decodes the packet in it. Each packet has an
* fixed single opcode byte. Once the packet has been identified, reading is
* done by the {@link ClientPacket} class.
* <p>
* Note that some packets have an additional opcode. This class also handle
* those cases.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class Lineage2PacketReader extends OneToOneDecoder {
/**
* The handler name
*/
public static final String HANDLER_NAME = "packet.reader";
/**
* The Google Guice {@link Injector}
*/
private final Injector injector;
/**
* The logger
*/
private final Logger logger = LoggerFactory
.getLogger(Lineage2PacketReader.class);
/**
* The active Lineage 2 connection
*/
private Lineage2Client connection;
/**
* Creates a new instance
*
* @param injector
* the injector
*/
@Inject
public Lineage2PacketReader(Injector injector) {
this.injector = injector;
}
@Override
protected Object decode(ChannelHandlerContext ctx, Channel channel,
Object msg) throws Exception {
if (!(msg instanceof ChannelBuffer))
return msg;
final ChannelBuffer buffer = (ChannelBuffer) msg;
final ClientPacket packet = createPacket(getPacketClass(buffer));
if (packet == null)
return null;
packet.read(connection, buffer);
return packet;
}
/**
* Crates a new instance of the packet <tt>type</tt>
*
* @param type
* the packet type
* @return the created packet
*/
private ClientPacket createPacket(Class<? extends ClientPacket> type) {
if (type == null)
return null;
return injector.getInstance(type);
}
/**
* Discovers the packet type
*
* @param buffer
* the buffer
* @return the packet class
*/
private Class<? extends ClientPacket> getPacketClass(ChannelBuffer buffer) {
final short opcode = buffer.readUnsignedByte();
switch (opcode) {
case CM_LOGOUT.OPCODE:
return CM_LOGOUT.class;
case CM_PROTOCOL_VERSION.OPCODE:
return CM_PROTOCOL_VERSION.class;
case CM_AUTH_LOGIN.OPCODE:
return CM_AUTH_LOGIN.class;
case CM_CHAR_CREATE.OPCODE:
return CM_CHAR_CREATE.class;
case CM_REQUEST_CHAR_TEMPLATE.OPCODE:
return CM_REQUEST_CHAR_TEMPLATE.class;
case 0xd0: // CM_REQ_**************
final int opcode2 = buffer.readUnsignedShort();
switch (opcode2) {
case CM_GOTO_LOBBY.OPCODE2:
return CM_GOTO_LOBBY.class;
case CM_EXT_REQ_KEY_MAPPING.OPCODE2:
return CM_EXT_REQ_KEY_MAPPING.class;
case CM_EXT_REQ_MANOR_LIST.OPCODE2:
return CM_EXT_REQ_MANOR_LIST.class;
case CM_EXT_REQ_ALL_FORTRESS_INFO.OPCODE2:
return CM_EXT_REQ_ALL_FORTRESS_INFO.class;
default:
logger.warn("Unknown packet for 0xd0{}",
Integer.toHexString(opcode2));
break;
}
break;
case CM_CHAR_SELECT.OPCODE:
return CM_CHAR_SELECT.class;
case CM_GG_KEY.OPCODE:
return CM_GG_KEY.class;
case CM_CHAR_MOVE.OPCODE:
return CM_CHAR_MOVE.class;
case CM_RESTART.OPCODE:
return CM_RESTART.class;
case CM_CHAR_CHAT.OPCODE:
return CM_CHAR_CHAT.class;
case CM_CHAR_POSITION.OPCODE:
return CM_CHAR_POSITION.class;
case CM_ENTER_WORLD.OPCODE:
return CM_ENTER_WORLD.class;
case CM_CHAR_ACTION.OPCODE:
return CM_CHAR_ACTION.class;
case CM_CHAR_REQ_INVENTORY.OPCODE:
return CM_CHAR_REQ_INVENTORY.class;
case CM_ADMIN_COMMAND.OPCODE:
return CM_ADMIN_COMMAND.class;
case CM_BYPASS.OPCODE:
return CM_BYPASS.class;
case CM_CHAR_APPEARING.OPCODE:
return CM_CHAR_APPEARING.class;
case CM_ACTION_USE.OPCODE:
return CM_ACTION_USE.class;
case CM_CHAR_OPEN_MAP.OPCODE:
return CM_CHAR_OPEN_MAP.class;
case CM_CHAR_ATTACK.OPCODE:
return CM_CHAR_ATTACK.class;
case CM_ITEM_DROP.OPCODE:
return CM_ITEM_DROP.class;
case CM_ITEM_DESTROY.OPCODE:
return CM_ITEM_DESTROY.class;
case CM_CHAR_TARGET_UNSELECT.OPCODE:
return CM_CHAR_TARGET_UNSELECT.class;
case CM_CHAR_SHORTCUT_CREATE.OPCODE:
return CM_CHAR_SHORTCUT_CREATE.class;
case CM_CHAR_SHORTCUT_REMOVE.OPCODE:
return CM_CHAR_SHORTCUT_REMOVE.class;
default:
logger.warn("Unknown packet for 0x{}", Integer.toHexString(opcode));
break;
}
return null;
}
/**
* @return the connection
*/
public Lineage2Client getConnection() {
return connection;
}
/**
* @param connection
* the connection to set
*/
public void setConnection(Lineage2Client connection) {
this.connection = connection;
}
}

View File

@@ -1,77 +0,0 @@
/*
* 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.game.net.codec;
import java.nio.ByteOrder;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.ServerPacket;
/**
* This encoder writes the frame content and encodes the packet in it. Each
* packet has an fixed single opcode byte. Once the packet opcode has been
* written, packet data is written by the {@link ServerPacket} class.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class Lineage2PacketWriter extends OneToOneEncoder {
/**
* The handler name
*/
public static final String HANDLER_NAME = "packet.writer";
/**
* The active Lineage 2 connection
*/
private Lineage2Client connection;
@Override
protected Object encode(ChannelHandlerContext ctx, Channel channel,
Object msg) throws Exception {
if (!(msg instanceof ServerPacket))
return msg;
final ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(
ByteOrder.LITTLE_ENDIAN, 10);
final ServerPacket packet = (ServerPacket) msg;
buffer.writeShort(0); // wrap 2 bytes for packet length
buffer.writeByte(packet.getOpcode()); // packet opcode
packet.write(connection, buffer);
return buffer;
}
/**
* @return the connection
*/
public Lineage2Client getConnection() {
return connection;
}
/**
* @param connection
* the connection to set
*/
public void setConnection(Lineage2Client connection) {
this.connection = connection;
}
}

View File

@@ -1,139 +0,0 @@
/*
* 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.game.net.handler;
import java.io.IOException;
import org.jboss.netty.channel.ChannelException;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelStateEvent;
import org.jboss.netty.channel.ExceptionEvent;
import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.channel.SimpleChannelHandler;
import com.google.common.base.Throwables;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.ClientPacket;
import com.l2jserver.service.network.NettyNetworkService;
import com.l2jserver.util.html.markup.HtmlTemplate;
import com.l2jserver.util.html.markup.MarkupTag;
/**
* This handler dispatches the {@link ClientPacket#process(Lineage2Client)}
* method and creates a new {@link Lineage2Client} once a new channel is open.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class Lineage2PacketHandler extends SimpleChannelHandler {
/**
* The {@link NettyNetworkService}
*/
private final NettyNetworkService nettyNetworkService;
/**
* The timeout handler is responsible for disconnecting idle clients.
*/
private final Lineage2TimeoutHandler timeoutHandler;
/**
* The Lineage 2 connection
*/
private Lineage2Client connection;
/**
* Creates a new instance of the packet handler
*
* @param nettyNetworkService
* the netty network service
* @param timeoutHandler
* the timeout handler
*/
public Lineage2PacketHandler(NettyNetworkService nettyNetworkService,
Lineage2TimeoutHandler timeoutHandler) {
this.nettyNetworkService = nettyNetworkService;
this.timeoutHandler = timeoutHandler;
}
@Override
public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e)
throws Exception {
connection = new Lineage2Client(e.getChannel());
connection.getPacketWriter().setConnection(connection);
timeoutHandler.setConnection(connection);
nettyNetworkService.register(connection);
super.channelOpen(ctx, e);
}
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
throws Exception {
final Object msg = e.getMessage();
if (!(msg instanceof ClientPacket))
return;
final ClientPacket packet = (ClientPacket) msg;
packet.process(connection);
super.messageReceived(ctx, e);
}
@Override
public void writeRequested(ChannelHandlerContext ctx, MessageEvent e)
throws Exception {
super.writeRequested(ctx, e);
}
@Override
public void channelDisconnected(ChannelHandlerContext ctx,
ChannelStateEvent e) throws Exception {
nettyNetworkService.unregister(connection);
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent event)
throws Exception {
final Throwable e = event.getCause();
try {
if (e instanceof ChannelException)
return;
if (e instanceof IOException)
return;
if (!connection.isConnected())
// no point sending error messages if the client is disconnected
return;
// TODO only send exception stack trace in development mode!
final String exception = Throwables.getStackTraceAsString(e)
.replaceAll("\n", "<br>").replace(" ", "");
final HtmlTemplate template = new HtmlTemplate("Java Exception") {
@Override
public void build(MarkupTag body) {
body.text(exception);
}
};
connection.sendHTML(template);
// order client not to wait any packet
connection.sendActionFailed();
final String[] lines = Throwables.getStackTraceAsString(e).split(
"\n");
for (final String line : lines) {
connection.sendMessage(line);
}
} finally {
e.printStackTrace();
}
}
}

View File

@@ -1,58 +0,0 @@
/*
* 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.game.net.handler;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.timeout.IdleStateAwareChannelHandler;
import org.jboss.netty.handler.timeout.IdleStateEvent;
import com.l2jserver.game.net.Lineage2Client;
/**
* @author <a href="http://www.rogiel.com">Rogiel</a>
*
*/
public class Lineage2TimeoutHandler extends IdleStateAwareChannelHandler {
/**
* The Lineage 2 connection
*/
private Lineage2Client connection;
@Override
public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e)
throws Exception {
if (connection != null) {
connection.close();
}
super.channelIdle(ctx, e);
}
/**
* @return the connection
*/
protected Lineage2Client getConnection() {
return connection;
}
/**
* @param connection
* the connection to set
*/
protected void setConnection(Lineage2Client connection) {
this.connection = connection;
}
}

View File

@@ -1,33 +0,0 @@
/*
* 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.game.net.packet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* An abstract {@link ClientPacket}
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
* @see ClientPacket
*/
public abstract class AbstractClientPacket implements ClientPacket {
/**
* The packet {@link Logger} instance
*/
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
}

View File

@@ -1,53 +0,0 @@
/*
* 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.game.net.packet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* An abstract {@link ServerPacket}
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
* @see ServerPacket
*/
public abstract class AbstractServerPacket implements ServerPacket {
/**
* The packet {@link Logger} instance
*/
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
/**
* The packet OPCODE
*/
private final int opcode;
/**
* Creates a new instance of the packet
*
* @param opcode
* the packet opcode
*/
public AbstractServerPacket(int opcode) {
this.opcode = opcode;
}
@Override
public int getOpcode() {
return opcode;
}
}

View File

@@ -1,49 +0,0 @@
/*
* 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.game.net.packet;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Client;
/**
* Each implementation is an packet sent by the game client.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface ClientPacket extends Packet {
/**
* Read binary data in the {@link ChannelBuffer}.
* <p>
* Please do not write packets from this method. If you need to close the
* connection or write packets do it in {@link #process(Lineage2Client)}.
*
* @param client
* the active connection
* @param buffer
* the buffer
*/
void read(Lineage2Client client, ChannelBuffer buffer);
/**
* Process the packet. Executes all needed operations.
*
* @param conn
* The active Lineage2Connection
*/
void process(Lineage2Client conn);
}

View File

@@ -1,26 +0,0 @@
/*
* 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.game.net.packet;
/**
* An simple packet. This must not be used directly, use {@link ClientPacket} or
* {@link ServerPacket} instead.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface Packet {
}

View File

@@ -1,48 +0,0 @@
/*
* 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.game.net.packet;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Client;
/**
* Each implementation is an packet sent by the game server.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface ServerPacket extends Packet {
/**
* Writes this packet binary data.
* <p>
* Please do not write packets from this method! This is only used to test
* compatibility of protocols.
*
* @param client
* the connection
* @param buffer
* the buffer
*/
void write(Lineage2Client client, ChannelBuffer buffer);
/**
* Get the opcode id of this packet
*
* @return the opcode id
*/
int getOpcode();
}

View File

@@ -1,205 +0,0 @@
/*
* 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.game.net.packet.client;
import org.jboss.netty.buffer.ChannelBuffer;
import com.google.inject.Inject;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.model.world.L2Character.CharacterMoveType;
import com.l2jserver.service.game.character.CharacterAlreadyRunningServiceException;
import com.l2jserver.service.game.character.CharacterAlreadyWalkingServiceException;
import com.l2jserver.service.game.character.CharacterService;
/**
* This packet notifies the server which character the player has chosen to use.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_ACTION_USE extends AbstractClientPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x56;
/**
* The {@link CharacterService}
*/
private final CharacterService charService;
/**
* The action to be performed
*/
private Action action;
/**
* The enumeration of all possible actions
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public enum Action {
/**
* Toggles the character in SIT or STAND mode
*/
SIT_STAND(0),
/**
* Toggles the character in WALK or RUN mode
*/
WALK_RUN(1),
/**
* Stats a new private store sell
*/
PRIVATE_STORE_SELL(10),
/**
* Stats a new private store buy
*/
PRIVATE_STORE_BUY(11),
/**
* Sets the pet in follow mode
*/
PET_FOLLOW_MOVE(15),
/**
* Sets the pet in follow mode 2
*/
PET_FOLLOW_MOVE2(21),
/**
* Orders the pet to attack
*/
PET_ATTACK(16),
/**
* Orders the pet to attack (second type)
*/
PET_ATTACK2(22),
/**
* Orders the pet to stop
*/
PET_STOP(17),
/**
* Orders the pet to stop (second type)
*/
PET_STOP2(23),
/**
* Unsummons the pet
*/
PET_UNSUMMON(19),
/**
* Mounts or dismount from pet
*/
MOUNT_DISMOUNT(38),
/**
* Switch Wild Hog Cannon mode
*/
WILD_HOG_CANNON_SWITCH_MODE(32),
/**
* Stops Wild Hog Cannon
*/
WILD_HOG_CANNON_STOP(41),
/**
* Souless toxic smoke
*/
SOULESS_TOXIC_SMOKE(36),
/**
* Souless parasite burst
*/
SOULESS_PARASITE_BURST(39),
/**
* Creates a new darwven manufacture
*/
DWARVEN_MANUFACTURE(37);
/**
* The numeric action id
*/
public final int id;
/**
* @param id
* the numeric action id
*/
Action(int id) {
this.id = id;
}
/**
* Resolves the numeric id into an Java type action
*
* @param id
* the numeric id
* @return the resolved action
*/
public static Action fromID(int id) {
for (final Action action : values())
if (action.id == id)
return action;
return null;
}
}
/**
* If CTRL key was pressed for this action
*/
@SuppressWarnings("unused")
private boolean ctrlPressed;
/**
* If SHIFT key was pressed for this action
*/
@SuppressWarnings("unused")
private boolean shiftPressed;
/**
* @param charService
* the character service
*/
@Inject
public CM_ACTION_USE(CharacterService charService) {
this.charService = charService;
}
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
action = Action.fromID(buffer.readInt());
ctrlPressed = (buffer.readByte() == 1 ? true : false);
shiftPressed = (buffer.readByte() == 1 ? true : false);
}
@Override
public void process(final Lineage2Client conn) {
final L2Character character = conn.getCharacter();
switch (action) {
case SIT_STAND:
// TODO
break;
case WALK_RUN:
try {
if (character.getMoveType() == CharacterMoveType.WALK) {
charService.run(character);
} else {
charService.walk(character);
}
} catch (CharacterAlreadyWalkingServiceException e) {
conn.sendActionFailed();
} catch (CharacterAlreadyRunningServiceException e) {
conn.sendActionFailed();
}
break;
}
}
}

View File

@@ -1,92 +0,0 @@
/*
* 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.game.net.packet.client;
import org.jboss.netty.buffer.ChannelBuffer;
import com.google.inject.Inject;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.service.ServiceException;
import com.l2jserver.service.game.admin.AdministratorService;
import com.l2jserver.util.BufferUtils;
/**
* Executes an administrator action
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_ADMIN_COMMAND extends AbstractClientPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x74;
/**
* The admin service
*/
private final AdministratorService adminService;
/**
* The command
*/
@SuppressWarnings("unused")
private String command;
/**
* @param adminService
* the administrator service
*/
@Inject
public CM_ADMIN_COMMAND(AdministratorService adminService) {
this.adminService = adminService;
}
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
command = BufferUtils.readString(buffer).trim();
}
@Override
public void process(final Lineage2Client conn) {
// final StringTokenizer tokenizer = new StringTokenizer(command, " ");
// final String cmd = tokenizer.nextToken();
// if (cmd.equals("tele")) {
// Coordinate coord = Coordinate.fromXYZ(
// Integer.parseInt(tokenizer.nextToken()),
// Integer.parseInt(tokenizer.nextToken()),
// Integer.parseInt(tokenizer.nextToken()));
// try {
// spawnService.teleport(conn.getCharacter(), coord);
// } catch (NotSpawnedServiceException e) {
// conn.sendActionFailed();
// } catch (CharacterAlreadyTeleportingServiceException e) {
// conn.sendActionFailed();
// }
// }
try {
adminService
.command(conn, conn.getCharacter(), "", new String[] {});
} catch (ServiceException e) {
conn.sendMessage("Invalid administrator command or syntax");
} finally {
conn.sendActionFailed();
}
// TODO implement admin commands
}
}

View File

@@ -1,145 +0,0 @@
/*
* 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.game.net.packet.client;
import java.util.List;
import org.jboss.netty.buffer.ChannelBuffer;
import com.google.inject.Inject;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.Lineage2Session;
import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.game.net.packet.server.SM_CHAR_LIST;
import com.l2jserver.model.dao.CharacterDAO;
import com.l2jserver.model.id.AccountID;
import com.l2jserver.model.id.provider.AccountIDProvider;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.util.BufferUtils;
/**
* This packet is sent by the client once the login server has authorized
* authentication into this server. A new {@link Lineage2Session} object will be
* set to the current connection and the character list is sent to the client.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_AUTH_LOGIN extends AbstractClientPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x2b;
/**
* The {@link CharacterDAO} implementation
*/
private final CharacterDAO characterDao;
/**
* The {@link AccountID} factory
*/
private final AccountIDProvider accountIdFactory;
// packet
/**
* User account name
*/
private String loginName;
/**
* The play key 1
*/
private int playKey1;
/**
* The play key 2
*/
private int playKey2;
/**
* The login key 1
*/
private int loginKey1;
/**
* The login key 2
*/
private int loginKey2;
/**
* @param characterDao
* the character DAO
* @param accountIdFactory
* the account id factory
*/
@Inject
public CM_AUTH_LOGIN(CharacterDAO characterDao,
AccountIDProvider accountIdFactory) {
this.characterDao = characterDao;
this.accountIdFactory = accountIdFactory;
}
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
this.loginName = BufferUtils.readString(buffer).toLowerCase();
this.playKey1 = buffer.readInt();
this.playKey2 = buffer.readInt();
this.loginKey1 = buffer.readInt();
this.loginKey2 = buffer.readInt();
}
@Override
public void process(final Lineage2Client conn) {
final AccountID accountId = accountIdFactory.resolveID(loginName);
conn.setSession(new Lineage2Session(accountId, playKey1, playKey2,
loginKey1, loginKey2));
final List<L2Character> chars = characterDao.selectByAccount(accountId);
conn.write(SM_CHAR_LIST.fromL2Session(conn.getSession(),
chars.toArray(new L2Character[chars.size()])));
}
/**
* @return the loginName
*/
public String getLoginName() {
return loginName;
}
/**
* @return the playKey1
*/
public int getPlayKey1() {
return playKey1;
}
/**
* @return the playKey2
*/
public int getPlayKey2() {
return playKey2;
}
/**
* @return the loginKey1
*/
public int getLoginKey1() {
return loginKey1;
}
/**
* @return the loginKey2
*/
public int getLoginKey2() {
return loginKey2;
}
}

View File

@@ -1,135 +0,0 @@
/*
* 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.game.net.packet.client;
import java.util.StringTokenizer;
import org.jboss.netty.buffer.ChannelBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.inject.Inject;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.model.id.ObjectID;
import com.l2jserver.model.id.object.NPCID;
import com.l2jserver.model.id.object.provider.ObjectIDResolver;
import com.l2jserver.model.world.NPC;
import com.l2jserver.model.world.npc.NPCController.NPCControllerException;
import com.l2jserver.service.game.character.CannotSetTargetServiceException;
import com.l2jserver.service.game.npc.ActionServiceException;
import com.l2jserver.service.game.npc.NPCService;
import com.l2jserver.util.BufferUtils;
/**
* Executes an bypass command
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_BYPASS extends AbstractClientPacket {
/**
* The logger
*/
private final Logger log = LoggerFactory.getLogger(this.getClass());
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x23;
/**
* The {@link ObjectID} resolver
*/
private final ObjectIDResolver idResolver;
/**
* The {@link NPC} service
*/
private final NPCService npcService;
/**
* The bypass command
*/
private String command;
/**
* @param idResolver
* the object id resolver
* @param npcService
* the {@link NPC} service
*/
@Inject
public CM_BYPASS(ObjectIDResolver idResolver, NPCService npcService) {
this.idResolver = idResolver;
this.npcService = npcService;
}
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
this.command = BufferUtils.readString(buffer);
}
@Override
public void process(final Lineage2Client conn) {
// parse command
final StringTokenizer tokenizer = new StringTokenizer(command, "_ ");
final String type = tokenizer.nextToken();
switch (type) {
case "npc":
final int objectId = Integer.parseInt(tokenizer.nextToken());
final ObjectID<NPC> id = idResolver.resolve(objectId);
if (!(id instanceof NPCID)) {
conn.sendActionFailed();
return;
}
final NPC npc = id.getObject();
try {
npcService.action(npc, conn.getCharacter(),
createArgumentArray(tokenizer));
} catch (ActionServiceException e) {
conn.sendActionFailed();
} catch (CannotSetTargetServiceException e) {
conn.sendActionFailed();
} catch (NPCControllerException e) {
if (e.getSystemMessage() != null)
conn.sendSystemMessage(e.getSystemMessage());
conn.sendActionFailed();
}
return;
default:
log.warn(
"Client {} requested an bypass not supported by server: {}",
conn, type);
return;
}
}
/**
* @param tokenizer
* the tokenizer
* @return an array of strings with each parameter
*/
private String[] createArgumentArray(StringTokenizer tokenizer) {
if (!tokenizer.hasMoreTokens())
return new String[0];
final String[] args = new String[tokenizer.countTokens()];
int i = 0;
while (tokenizer.hasMoreTokens()) {
args[i++] = tokenizer.nextToken();
}
return args;
}
}

View File

@@ -1,179 +0,0 @@
/*
* 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.game.net.packet.client;
import org.jboss.netty.buffer.ChannelBuffer;
import com.google.inject.Inject;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.SystemMessage;
import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.model.id.ObjectID;
import com.l2jserver.model.id.object.ItemID;
import com.l2jserver.model.id.object.NPCID;
import com.l2jserver.model.id.object.provider.ObjectIDResolver;
import com.l2jserver.model.world.Item;
import com.l2jserver.model.world.NPC;
import com.l2jserver.model.world.npc.NPCController.NPCControllerException;
import com.l2jserver.service.game.character.CannotSetTargetServiceException;
import com.l2jserver.service.game.item.ItemNotOnGroundServiceException;
import com.l2jserver.service.game.item.ItemService;
import com.l2jserver.service.game.npc.ActionServiceException;
import com.l2jserver.service.game.npc.NPCService;
import com.l2jserver.service.game.spawn.NotSpawnedServiceException;
import com.l2jserver.util.geometry.Coordinate;
/**
* Executes an action from an character to an NPC
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_CHAR_ACTION extends AbstractClientPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x1f;
/**
* The {@link ObjectID} resolver
*/
private final ObjectIDResolver idResolver;
/**
* The {@link NPC} Service
*/
private final NPCService npcService;
/**
* The {@link Item} Service
*/
private final ItemService itemService;
/**
* The object id
*/
private int objectId;
/**
* The action origin
*/
@SuppressWarnings("unused")
private Coordinate origin;
/**
* The character action type (aka mouse button)
*/
private CharacterAction action;
/**
* The character action type
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public enum CharacterAction {
/**
* If the player has clicked with the left mouse button.
*/
CLICK(0),
/**
* If the player has clicked with the right mouse button.
*/
RIGHT_CLICK(1);
/**
* The action id
*/
public final int id;
/**
* @param id
* the action id
*/
CharacterAction(int id) {
this.id = id;
}
/**
* @param id
* the action id
* @return the {@link CharacterAction} represented by <code>id</code>
*/
public static CharacterAction fromID(int id) {
for (final CharacterAction action : values())
if (action.id == id)
return action;
return null;
}
}
/**
* @param idResolver the id resolver
* @param npcService the npc service
* @param itemService the item service
*/
@Inject
public CM_CHAR_ACTION(ObjectIDResolver idResolver, NPCService npcService,
ItemService itemService) {
this.idResolver = idResolver;
this.npcService = npcService;
this.itemService = itemService;
}
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
this.objectId = buffer.readInt();
this.origin = Coordinate.fromXYZ(buffer.readInt(), buffer.readInt(),
buffer.readInt());
this.action = CharacterAction.fromID(buffer.readByte());
}
@Override
public void process(final Lineage2Client conn) {
final ObjectID<?> id = idResolver.resolve(objectId);
if (id instanceof NPCID) {
final NPC npc = ((NPCID) id).getObject();
try {
npcService.action(npc, conn.getCharacter(), action);
} catch (NPCControllerException e) {
if (e.getSystemMessage() != null)
conn.sendSystemMessage(e.getSystemMessage());
conn.sendActionFailed();
} catch (ActionServiceException | CannotSetTargetServiceException e) {
conn.sendActionFailed();
}
} else if (id instanceof ItemID) {
final Item item = ((ItemID) id).getObject();
try {
final Item stackItem = itemService.action(item,
conn.getCharacter(), action);
if (stackItem.equals(item)) { // adds
conn.addInventoryItems(stackItem);
} else { // update only
conn.updateInventoryItems(stackItem);
}
conn.sendSystemMessage(SystemMessage.YOU_PICKED_UP_S2_S1, Long
.toString(item.getCount()), item.getTemplate()
.getName());
conn.sendActionFailed();
} catch (ItemNotOnGroundServiceException
| NotSpawnedServiceException e) {
conn.sendSystemMessage(SystemMessage.FAILED_TO_PICKUP_S1, item
.getTemplate().getName());
conn.sendActionFailed();
}
} else {
conn.sendActionFailed();
return;
}
}
}

View File

@@ -1,64 +0,0 @@
/*
* 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.game.net.packet.client;
import org.jboss.netty.buffer.ChannelBuffer;
import com.google.inject.Inject;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.service.game.spawn.CharacterNotTeleportingServiceException;
import com.l2jserver.service.game.spawn.SpawnService;
/**
* Completes the creation of an character. Creates the object, inserts into the
* database and notifies the client about the status of the operation.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_CHAR_APPEARING extends AbstractClientPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x3a;
/**
* The {@link SpawnService}
*/
private final SpawnService spawnService;
/**
* @param spawnService the spawn service
*/
@Inject
public CM_CHAR_APPEARING(SpawnService spawnService) {
this.spawnService = spawnService;
}
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
}
@Override
public void process(final Lineage2Client conn) {
try {
spawnService.finishTeleport(conn.getCharacter());
} catch (CharacterNotTeleportingServiceException e) {
conn.sendActionFailed();
}
}
}

View File

@@ -1,165 +0,0 @@
/*
* 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.game.net.packet.client;
import org.jboss.netty.buffer.ChannelBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.inject.Inject;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.game.net.packet.server.SM_ACTION_FAILED;
import com.l2jserver.model.id.ObjectID;
import com.l2jserver.model.id.object.ActorID;
import com.l2jserver.model.id.object.provider.ObjectIDResolver;
import com.l2jserver.model.world.Actor;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.service.game.character.ActorIsNotAttackableServiceException;
import com.l2jserver.service.game.character.CannotSetTargetServiceException;
import com.l2jserver.service.game.character.CharacterService;
import com.l2jserver.service.game.npc.NotAttackableNPCServiceException;
import com.l2jserver.util.geometry.Coordinate;
/**
* Completes the creation of an character. Creates the object, inserts into the
* database and notifies the client about the status of the operation.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_CHAR_ATTACK extends AbstractClientPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x01;
/**
* The Logger
*/
private final Logger log = LoggerFactory.getLogger(this.getClass());
/**
* The {@link CharacterService}
*/
private final CharacterService charService;
/**
* The {@link ObjectID} resolver
*/
private final ObjectIDResolver idResolver;
/**
* The {@link ObjectID} being attacked
*/
private int objectId;
/**
* The position of the target
*/
@SuppressWarnings("unused")
private Coordinate origin;
/**
* The attack action type
*/
@SuppressWarnings("unused")
private CharacterAttackAction action;
/**
* Enumeration of all possible attack actions
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public enum CharacterAttackAction {
/**
* Normal click
*/
CLICK(0),
/**
* Clicked with shift-click
*/
SHIFT_CLICK(1);
/**
* The attack action numeric id
*/
public final int id;
/**
* @param id
* the action numeric id
*/
CharacterAttackAction(int id) {
this.id = id;
}
/**
* Resolves the numeric action id to an {@link CharacterAttackAction}
* type
*
* @param id
* the numeric id
* @return the resolved action
*/
public static CharacterAttackAction fromID(int id) {
for (final CharacterAttackAction action : values())
if (action.id == id)
return action;
return null;
}
}
/**
* @param charService
* the character service
* @param idResolver
* the object id resolver
*/
@Inject
public CM_CHAR_ATTACK(CharacterService charService, ObjectIDResolver idResolver) {
this.charService = charService;
this.idResolver = idResolver;
}
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
this.objectId = buffer.readInt();
this.origin = Coordinate.fromXYZ(buffer.readInt(), buffer.readInt(),
buffer.readInt());
this.action = CharacterAttackAction.fromID(buffer.readByte());
}
@Override
public void process(final Lineage2Client conn) {
final L2Character character = conn.getCharacter();
// since this is an erasure type, this is safe.
final ObjectID<Actor> id = idResolver.resolve(objectId);
if (!(id instanceof ActorID)) {
conn.write(SM_ACTION_FAILED.SHARED_INSTANCE);
log.warn("Player {} is trying to attack {}, which is not an actor",
character, id);
return;
}
final Actor actor = id.getObject();
try {
charService.attack(character, actor);
} catch (CannotSetTargetServiceException e) {
conn.sendActionFailed();
} catch (ActorIsNotAttackableServiceException e) {
conn.sendActionFailed();
} catch (NotAttackableNPCServiceException e) {
conn.sendActionFailed();
}
}
}

View File

@@ -1,104 +0,0 @@
/*
* 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.game.net.packet.client;
import org.jboss.netty.buffer.ChannelBuffer;
import com.google.inject.Inject;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.SystemMessage;
import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.game.net.packet.server.SM_ACTION_FAILED;
import com.l2jserver.service.game.chat.CannotChatToSelfChatServiceException;
import com.l2jserver.service.game.chat.ChatBanActiveChatServiceException;
import com.l2jserver.service.game.chat.ChatMessageType;
import com.l2jserver.service.game.chat.ChatService;
import com.l2jserver.service.game.chat.ChatTargetOfflineServiceException;
import com.l2jserver.service.game.chat.TargetNotFoundChatServiceException;
import com.l2jserver.util.BufferUtils;
/**
* Completes the creation of an character. Creates the object, inserts into the
* database and notifies the client about the status of the operation.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_CHAR_CHAT extends AbstractClientPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x49;
// services and daos
/**
* The {@link ChatService} implementation
*/
private final ChatService chatService;
/**
* The message
*/
private String message;
/**
* The message destination
*/
private ChatMessageType destination;
/**
* The message target
*/
private String target;
/**
* @param chatService the chat service
*/
@Inject
public CM_CHAR_CHAT(ChatService chatService) {
this.chatService = chatService;
}
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
this.message = BufferUtils.readString(buffer);
this.destination = ChatMessageType.fromID(buffer.readInt());
if (this.destination == ChatMessageType.TELL) { // private
// message
this.target = BufferUtils.readString(buffer);
}
}
@Override
public void process(final Lineage2Client conn) {
if (message.length() == 0 || destination == null) {
conn.write(SM_ACTION_FAILED.SHARED_INSTANCE);
conn.close();
}
try {
chatService.send(conn.getCharacterID(), destination, message,
target);
} catch (TargetNotFoundChatServiceException e) {
conn.sendSystemMessage(SystemMessage.TARGET_CANT_FOUND);
} catch (CannotChatToSelfChatServiceException e) {
conn.sendSystemMessage(SystemMessage.CANNOT_USE_ON_YOURSELF);
} catch (ChatBanActiveChatServiceException e) {
conn.sendSystemMessage(SystemMessage.CHATTING_IS_CURRENTLY_PROHIBITED);
} catch (ChatTargetOfflineServiceException e) {
conn.sendSystemMessage(SystemMessage.S1_IS_NOT_ONLINE, target);
}
}
}

View File

@@ -1,190 +0,0 @@
/*
* 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.game.net.packet.client;
import static com.l2jserver.game.net.packet.server.SM_CHAR_CREATE_FAIL.Reason.REASON_16_ENG_CHARS;
import static com.l2jserver.game.net.packet.server.SM_CHAR_CREATE_FAIL.Reason.REASON_CHOOSE_ANOTHER_SVR;
import static com.l2jserver.game.net.packet.server.SM_CHAR_CREATE_FAIL.Reason.REASON_CREATION_FAILED;
import static com.l2jserver.game.net.packet.server.SM_CHAR_CREATE_FAIL.Reason.REASON_NAME_ALREADY_EXISTS;
import static com.l2jserver.game.net.packet.server.SM_CHAR_CREATE_FAIL.Reason.REASON_TOO_MANY_CHARACTERS;
import org.jboss.netty.buffer.ChannelBuffer;
import com.google.inject.Inject;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.game.net.packet.server.SM_CHAR_CREATE_OK;
import com.l2jserver.model.template.actor.ActorSex;
import com.l2jserver.model.template.character.CharacterClass;
import com.l2jserver.model.template.character.CharacterRace;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.model.world.character.CharacterAppearance.CharacterFace;
import com.l2jserver.model.world.character.CharacterAppearance.CharacterHairColor;
import com.l2jserver.model.world.character.CharacterAppearance.CharacterHairStyle;
import com.l2jserver.service.game.character.CharacteCreationNotAllowedException;
import com.l2jserver.service.game.character.CharacterInvalidAppearanceException;
import com.l2jserver.service.game.character.CharacterInvalidNameException;
import com.l2jserver.service.game.character.CharacterInvalidRaceException;
import com.l2jserver.service.game.character.CharacterInvalidSexException;
import com.l2jserver.service.game.character.CharacterNameAlreadyExistsException;
import com.l2jserver.service.game.character.CharacterService;
import com.l2jserver.service.game.character.TooManyCharactersException;
import com.l2jserver.util.BufferUtils;
/**
* Completes the creation of an character. Creates the object, inserts into the
* database and notifies the client about the status of the operation.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_CHAR_CREATE extends AbstractClientPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x0c;
// services and daos
/**
* The {@link CharacterService} implementation
*/
private final CharacterService characterService;
// packet
/**
* The name of the new character
*/
private String name;
/**
* The race of the new character. Note that this is ignored and the template
* value is used.
*/
@SuppressWarnings("unused")
private CharacterRace race;
/**
* The sex of the new character. Note that this is ignored and the template
* value is used.
*/
private ActorSex sex;
/**
* The class of the new character
*/
private CharacterClass characterClass;
/**
* The new character intelligence. Note that this is ignored and the
* template value is used.
*/
@SuppressWarnings("unused")
private int intelligence;
/**
* The new character intelligence. Note that this is ignored and the
* template value is used.
*/
@SuppressWarnings("unused")
private int strength;
/**
* The new character strength. Note that this is ignored and the template
* value is used.
*/
@SuppressWarnings("unused")
private int concentration;
/**
* The new character concentration. Note that this is ignored and the
* template value is used.
*/
@SuppressWarnings("unused")
private int mentality;
/**
* The new character mentality. Note that this is ignored and the template
* value is used.
*/
@SuppressWarnings("unused")
private int dexterity;
/**
* The new character dexterity. Note that this is ignored and the template
* value is used.
*/
@SuppressWarnings("unused")
private int witness;
/**
* The new character hair style
*/
private CharacterHairStyle hairStyle;
/**
* The new character hair color
*/
private CharacterHairColor hairColor;
/**
* The new character face
*/
private CharacterFace face;
/**
* @param characterService
* the character service
*/
@Inject
public CM_CHAR_CREATE(CharacterService characterService) {
this.characterService = characterService;
}
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
name = BufferUtils.readString(buffer);
race = CharacterRace.fromOption(buffer.readInt());
sex = ActorSex.fromOption(buffer.readInt());
characterClass = CharacterClass.fromID(buffer.readInt());
intelligence = buffer.readInt();
strength = buffer.readInt();
concentration = buffer.readInt();
mentality = buffer.readInt();
dexterity = buffer.readInt();
witness = buffer.readInt();
hairStyle = CharacterHairStyle.fromOption(buffer.readInt());
hairColor = CharacterHairColor.fromOption(buffer.readInt());
face = CharacterFace.fromOption(buffer.readInt());
}
@Override
public void process(final Lineage2Client conn) {
try {
final L2Character character = characterService.create(name, conn
.getSession().getAccountID(), sex, characterClass,
hairStyle, hairColor, face);
if (character != null)
conn.write(SM_CHAR_CREATE_OK.INSTANCE);
else
conn.write(REASON_CREATION_FAILED.newInstance());
} catch (CharacterInvalidNameException e) {
conn.write(REASON_16_ENG_CHARS.newInstance());
} catch (CharacterInvalidAppearanceException e) {
conn.write(REASON_CREATION_FAILED.newInstance());
} catch (CharacterNameAlreadyExistsException e) {
conn.write(REASON_NAME_ALREADY_EXISTS.newInstance());
} catch (CharacteCreationNotAllowedException e) {
conn.write(REASON_CREATION_FAILED.newInstance());
} catch (CharacterInvalidRaceException | CharacterInvalidSexException e) {
conn.write(REASON_CHOOSE_ANOTHER_SVR.newInstance());
} catch (TooManyCharactersException e) {
conn.write(REASON_TOO_MANY_CHARACTERS.newInstance());
}
}
}

View File

@@ -1,146 +0,0 @@
/*
* 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.game.net.packet.client;
import org.jboss.netty.buffer.ChannelBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.inject.Inject;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.game.net.packet.server.SM_CHAR_STOP;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.service.game.character.CharacterService;
import com.l2jserver.util.geometry.Coordinate;
/**
* This packet notifies the server which character the player has chosen to use.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_CHAR_MOVE extends AbstractClientPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x0f;
/**
* The logger
*/
private final Logger log = LoggerFactory.getLogger(this.getClass());
/**
* The {@link CharacterService}
*/
private final CharacterService charService;
// packet
/**
* The movement target
*/
private Coordinate target;
/**
* The movement origin
*/
private Coordinate origin;
/**
* The movement type
*/
@SuppressWarnings("unused")
private MovementType type;
/**
* Defines the movement action type
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public enum MovementType {
/**
* The move action was issued by the mouse
*/
MOUSE(0x01),
/**
* The move action was issued by the keyboard
*/
KEYBOARD(0x00);
/**
* The type id
*/
public final int id;
/**
* @param id the type id
*/
MovementType(int id) {
this.id = id;
}
/**
* @param id the type id
* @return the {@link MovementType} represented by <code>id</code>
*/
public static MovementType fromID(int id) {
for (final MovementType type : values()) {
if (type.id == id)
return type;
}
return null;
}
}
/**
* @param charService the character service
*/
@Inject
public CM_CHAR_MOVE(CharacterService charService) {
this.charService = charService;
}
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
this.target = Coordinate.fromXYZ(buffer.readInt(), buffer.readInt(),
buffer.readInt());
this.origin = Coordinate.fromXYZ(buffer.readInt(), buffer.readInt(),
buffer.readInt());
// seems that L2Walker does not send this
if (buffer.readableBytes() >= 4) {
// 0 keyboard, 1 mouse
this.type = MovementType.fromID(buffer.readInt());
}
}
@Override
public void process(final Lineage2Client conn) {
if (target.equals(origin)) {
log.debug("Target is same as origin. Stopping character.");
conn.write(new SM_CHAR_STOP(conn.getCharacter()));
return;
}
if (target.getDistance(origin) >= 98010000) {
log.warn(
"Character {} is trying to move a really big distance: {}",
conn.getCharacter(), target.getDistance(origin));
// TODO send action failed message!
return;
}
final L2Character character = conn.getCharacter();
log.debug("Character {} is moving from {} to {}", new Object[] {
character, origin, target });
charService.move(character, target);
}
}

View File

@@ -1,44 +0,0 @@
/*
* 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.game.net.packet.client;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.game.net.packet.server.SM_CHAR_OPEN_MAP;
/**
* Executes an bypass command
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_CHAR_OPEN_MAP extends AbstractClientPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x6c;
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
}
@Override
public void process(final Lineage2Client conn) {
conn.write(new SM_CHAR_OPEN_MAP(1665));
}
}

View File

@@ -1,72 +0,0 @@
/*
* 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.game.net.packet.client;
import org.jboss.netty.buffer.ChannelBuffer;
import com.google.inject.Inject;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.service.game.character.CharacterService;
import com.l2jserver.util.geometry.Point3D;
/**
* This packet notifies the server which character the player has chosen to use.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_CHAR_POSITION extends AbstractClientPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x59;
/**
* The {@link CharacterService}
*/
private final CharacterService charService;
/**
* The current position point
*/
private Point3D point;
/**
* Extra data -> vehicle id
*/
@SuppressWarnings("unused")
private int extra; // vehicle id
/**
* @param charService the character service
*/
@Inject
public CM_CHAR_POSITION(CharacterService charService) {
this.charService = charService;
}
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
point = Point3D.fromXYZA(buffer.readInt(), buffer.readInt(),
buffer.readInt(), buffer.readInt());
extra = buffer.readInt();
}
@Override
public void process(final Lineage2Client conn) {
charService.receivedValidation(conn.getCharacter(), point);
}
}

View File

@@ -1,47 +0,0 @@
/*
* 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.game.net.packet.client;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.game.net.packet.server.SM_CHAR_INVENTORY;
import com.l2jserver.model.world.L2Character;
/**
* Completes the creation of an character. Creates the object, inserts into the
* database and notifies the client about the status of the operation.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_CHAR_REQ_INVENTORY extends AbstractClientPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x14;
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
}
@Override
public void process(final Lineage2Client conn) {
final L2Character character = conn.getCharacter();
conn.write(new SM_CHAR_INVENTORY(character.getInventory()));
}
}

View File

@@ -1,77 +0,0 @@
/*
* 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.game.net.packet.client;
import java.util.List;
import org.jboss.netty.buffer.ChannelBuffer;
import com.google.inject.Inject;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.game.net.packet.server.SM_CHAR_SELECTED;
import com.l2jserver.model.dao.CharacterDAO;
import com.l2jserver.model.world.L2Character;
/**
* This packet notifies the server which character the player has chosen to use.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_CHAR_SELECT extends AbstractClientPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x12;
// services and daos
/**
* The {@link CharacterDAO} implementation
*/
private final CharacterDAO characterDao;
// packet
/**
* The character slot
*/
private int slot;
/**
* @param characterDao the character dao
*/
@Inject
public CM_CHAR_SELECT(CharacterDAO characterDao) {
this.characterDao = characterDao;
}
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
slot = buffer.readInt();
}
@Override
public void process(final Lineage2Client conn) {
final List<L2Character> chars = characterDao.selectByAccount(conn
.getSession().getAccountID());
// FIXME better handling! this will throw an exception sooner or later
final L2Character character = chars.get(slot);
conn.setCharacterID(character.getID());
conn.write(new SM_CHAR_SELECTED(chars.get(slot)));
}
}

View File

@@ -1,125 +0,0 @@
/*
* 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.game.net.packet.client;
import org.jboss.netty.buffer.ChannelBuffer;
import com.google.inject.Inject;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.model.game.CharacterShortcut.ShortcutActorType;
import com.l2jserver.model.game.CharacterShortcut.ShortcutType;
import com.l2jserver.model.id.object.ItemID;
import com.l2jserver.model.id.object.provider.ItemIDProvider;
import com.l2jserver.model.world.Item;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.service.game.character.ShortcutService;
import com.l2jserver.service.game.character.ShortcutSlotNotFreeServiceException;
/**
* Completes the creation of an character. Creates the object, inserts into the
* database and notifies the client about the status of the operation.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_CHAR_SHORTCUT_CREATE extends AbstractClientPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x3d;
/**
* The {@link ShortcutService}
*/
private final ShortcutService shortcutService;
/**
* The {@link ItemID} provider
*/
private final ItemIDProvider itemIdProvider;
/**
* The shortcut type
*/
private ShortcutType type;
/**
* The shortcut object ID (depends on type)
*/
private int objectId;
/**
* The slot
*/
private int slot;
/**
* The page
*/
private int page;
/**
* The skill level
*/
@SuppressWarnings("unused")
private int level;
/**
* Whether the shortcut is an for an character(1) or a pet(2)
*/
@SuppressWarnings("unused")
private ShortcutActorType actorType;
/**
* @param shortcutService
* the shortcut service
* @param itemIdProvider
* the item id provider
*/
@Inject
private CM_CHAR_SHORTCUT_CREATE(ShortcutService shortcutService,
ItemIDProvider itemIdProvider) {
this.shortcutService = shortcutService;
this.itemIdProvider = itemIdProvider;
}
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
type = ShortcutType.fromID(buffer.readInt());
int slot = buffer.readInt();
objectId = buffer.readInt();
level = buffer.readInt();
actorType = ShortcutActorType.fromID(buffer.readInt());
this.slot = slot % 12;
this.page = slot / 12;
}
@Override
public void process(final Lineage2Client conn) {
final L2Character character = conn.getCharacter();
try {
switch (type) {
case ITEM:
final ItemID itemID = itemIdProvider.resolveID(objectId);
final Item item = itemID.getObject();
if (item == null) {
conn.sendActionFailed();
return;
}
shortcutService.create(character, item, page, slot);
break;
}
} catch (ShortcutSlotNotFreeServiceException e) {
conn.sendActionFailed();
}
}
}

View File

@@ -1,77 +0,0 @@
/*
* 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.game.net.packet.client;
import org.jboss.netty.buffer.ChannelBuffer;
import com.google.inject.Inject;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.service.game.character.ShortcutService;
import com.l2jserver.service.game.character.ShortcutSlotEmptyServiceException;
/**
* Completes the creation of an character. Creates the object, inserts into the
* database and notifies the client about the status of the operation.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_CHAR_SHORTCUT_REMOVE extends AbstractClientPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x3f;
/**
* The {@link ShortcutService}
*/
private final ShortcutService shortcutService;
/**
* The slot
*/
private int slot;
/**
* The page
*/
private int page;
/**
* @param shortcutService
* the shortcut service
*/
@Inject
private CM_CHAR_SHORTCUT_REMOVE(ShortcutService shortcutService) {
this.shortcutService = shortcutService;
}
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
int slot = buffer.readInt();
this.slot = slot % 12;
this.page = slot / 12;
}
@Override
public void process(final Lineage2Client conn) {
try {
shortcutService.remove(conn.getCharacter(), page, slot);
} catch (ShortcutSlotEmptyServiceException e) {
conn.sendActionFailed();
}
}
}

View File

@@ -1,72 +0,0 @@
/*
* 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.game.net.packet.client;
import org.jboss.netty.buffer.ChannelBuffer;
import com.google.inject.Inject;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.SystemMessage;
import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.service.game.character.CannotSetTargetServiceException;
import com.l2jserver.service.game.character.CharacterService;
/**
* This packet cancels the target selection
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_CHAR_TARGET_UNSELECT extends AbstractClientPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x48;
/**
* The {@link CharacterService}
*/
private final CharacterService charService;
/**
* Now known for sure
*/
@SuppressWarnings("unused")
private boolean unselect;
/**
* @param charService
* the character service
*/
@Inject
public CM_CHAR_TARGET_UNSELECT(CharacterService charService) {
this.charService = charService;
}
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
this.unselect = (buffer.readByte() == 1 ? true : false);
}
@Override
public void process(final Lineage2Client conn) {
try {
charService.target(conn.getCharacter(), null);
} catch (CannotSetTargetServiceException e) {
conn.sendSystemMessage(SystemMessage.FAILED_DISABLE_TARGET);
}
}
}

View File

@@ -1,95 +0,0 @@
/*
* 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.game.net.packet.client;
import org.jboss.netty.buffer.ChannelBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.inject.Inject;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.model.id.object.CharacterID;
import com.l2jserver.service.game.character.CharacterService;
import com.l2jserver.service.game.spawn.AlreadySpawnedServiceException;
import com.l2jserver.service.game.spawn.SpawnPointNotFoundServiceException;
/**
* The client is requesting a logout. Currently, when this packet is received
* the connection is immediately closed.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_ENTER_WORLD extends AbstractClientPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x11;
/**
* The logger
*/
private final Logger log = LoggerFactory.getLogger(CM_ENTER_WORLD.class);
/**
* The {@link CharacterService}
*/
private final CharacterService characterService;
/**
* @param characterService the character service
*/
@Inject
public CM_ENTER_WORLD(CharacterService characterService) {
this.characterService = characterService;
}
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
buffer.readBytes(new byte[32]); // Unknown Byte Array
buffer.readInt(); // Unknown Value
buffer.readInt(); // Unknown Value
buffer.readInt(); // Unknown Value
buffer.readInt(); // Unknown Value
buffer.readBytes(new byte[32]); // Unknown Byte Array
buffer.readInt(); // Unknown Value
// TODO parse tracert
// for (int i = 0; i < 5; i++)
// for (int o = 0; o < 4; o++)
// tracert[i][o] = readC();
}
@Override
public void process(final Lineage2Client conn) {
final CharacterID id = conn.getCharacterID();
if (id == null) {
log.warn(
"Client {} is trying to enter world without select a character",
conn);
conn.close();
return;
}
// TODO send fail message
try {
characterService.enterWorld(id.getObject());
} catch (SpawnPointNotFoundServiceException e) {
conn.sendActionFailed();
} catch (AlreadySpawnedServiceException e) {
// TODO send an error message here
}
}
}

View File

@@ -1,48 +0,0 @@
/*
* 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.game.net.packet.client;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.game.net.packet.server.SM_FORT_INFO;
/**
* The client is requesting the manor list.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_EXT_REQ_ALL_FORTRESS_INFO extends AbstractClientPacket {
/**
* The packet OPCODE1
*/
public static final int OPCODE1 = 0xd0;
/**
* The packet OPCODE2
*/
public static final int OPCODE2 = 0x3d;
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
}
@Override
public void process(final Lineage2Client conn) {
conn.write(new SM_FORT_INFO());
}
}

View File

@@ -1,47 +0,0 @@
/*
* 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.game.net.packet.client;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractClientPacket;
/**
* The client is requesting a the key mappings.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_EXT_REQ_KEY_MAPPING extends AbstractClientPacket {
/**
* The packet OPCODE1
*/
public static final int OPCODE1 = 0xd0;
/**
* The packet OPCODE2
*/
public static final int OPCODE2 = 0x21;
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
}
@Override
public void process(final Lineage2Client conn) {
// TODO
}
}

View File

@@ -1,49 +0,0 @@
/*
* 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.game.net.packet.client;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.game.net.packet.server.SM_MANOR_LIST;
/**
* The client is requesting the manor list.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_EXT_REQ_MANOR_LIST extends AbstractClientPacket {
/**
* The packet OPCODE1
*/
public static final int OPCODE1 = 0xd0;
/**
* The packet OPCODE2
*/
public static final int OPCODE2 = 0x01;
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
}
@Override
public void process(final Lineage2Client conn) {
conn.write(new SM_MANOR_LIST("gludio", "dion", "giran", "oren", "aden",
"innadril", "goddard", "rune", "schuttgart"));
}
}

View File

@@ -1,85 +0,0 @@
/*
* 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.game.net.packet.client;
import org.jboss.netty.buffer.ChannelBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.inject.Inject;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.service.network.gameguard.GameGuardService;
/**
* The client is requesting a logout. Currently, when this packet is received
* the connection is immediately closed.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_GG_KEY extends AbstractClientPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0xcb;
/**
* The logger
*/
private static final Logger log = LoggerFactory.getLogger(CM_GG_KEY.class);
/**
* The {@link GameGuardService}
*/
private final GameGuardService ggService;
/**
* The Game guard authentication key
*/
private byte[] key = new byte[8];
/**
* @param ggService the gameguard service
*/
@Inject
public CM_GG_KEY(GameGuardService ggService) {
this.ggService = ggService;
}
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
byte[] part1 = buffer.readBytes(4).array();
buffer.readInt();
byte[] part2 = buffer.readBytes(4).array();
// create a single key array
System.arraycopy(part1, 0, key, 0, 4);
System.arraycopy(part2, 0, key, 4, 4);
}
@Override
public void process(final Lineage2Client conn) {
log.debug("Received GG key");
switch (ggService.key(conn, key)) {
case INVALID:
log.warn("Client {} sent an invalid GG key", conn);
// if key is invalid, disconnect client
conn.close();
return;
}
}
}

View File

@@ -1,70 +0,0 @@
/*
* 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.game.net.packet.client;
import java.util.List;
import org.jboss.netty.buffer.ChannelBuffer;
import com.google.inject.Inject;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.game.net.packet.server.SM_CHAR_LIST;
import com.l2jserver.model.dao.CharacterDAO;
import com.l2jserver.model.world.L2Character;
/**
* Requests the list of characters to be displayed in the lobby. The list of
* characters is sent to the client.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_GOTO_LOBBY extends AbstractClientPacket {
/**
* The packet OPCODE1
*/
public static final int OPCODE1 = 0xd0;
/**
* The packet OPCODE2
*/
public static final int OPCODE2 = 0x36;
/**
* The {@link CharacterDAO} implementation
*/
private final CharacterDAO characterDao;
/**
* @param characterDao the character dao
*/
@Inject
public CM_GOTO_LOBBY(CharacterDAO characterDao) {
this.characterDao = characterDao;
}
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
}
@Override
public void process(final Lineage2Client conn) {
final List<L2Character> chars = characterDao.selectByAccount(conn
.getSession().getAccountID());
conn.write(SM_CHAR_LIST.fromL2Session(conn.getSession(),
chars.toArray(new L2Character[chars.size()])));
}
}

View File

@@ -1,104 +0,0 @@
/*
* 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.game.net.packet.client;
import org.jboss.netty.buffer.ChannelBuffer;
import com.google.inject.Inject;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.SystemMessage;
import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.model.id.object.ItemID;
import com.l2jserver.model.id.object.provider.ItemIDProvider;
import com.l2jserver.model.world.Item;
import com.l2jserver.service.game.item.ItemService;
import com.l2jserver.service.game.item.NonStackableItemsServiceException;
import com.l2jserver.service.game.item.NotEnoughItemsServiceException;
/**
* This packet drops items on the ground.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_ITEM_DESTROY extends AbstractClientPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x60;
/**
* The {@link ItemService}
*/
private final ItemService itemService;
/**
* The {@link ItemID} provider
*/
private final ItemIDProvider itemIdProvider;
/**
* The item ID
*/
private int objectId;
/**
* The number of items to be dropped
*/
private long count;
/**
* @param itemService
* the item service
* @param itemIdProvider
* the item id provider
*/
@Inject
public CM_ITEM_DESTROY(ItemService itemService,
ItemIDProvider itemIdProvider) {
this.itemService = itemService;
this.itemIdProvider = itemIdProvider;
}
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
objectId = buffer.readInt();
count = buffer.readLong();
}
@Override
public void process(final Lineage2Client conn) {
final ItemID id = itemIdProvider.resolveID(objectId);
final Item item = id.getObject();
if (item == null) {
conn.sendActionFailed();
return;
}
if (!conn.getCharacterID().equals(item.getOwnerID())) {
conn.sendActionFailed();
return;
}
try {
if (itemService.destroy(item, count)) {
conn.removeInventoryItems(item);
} else {
conn.updateInventoryItems(item);
}
} catch (NotEnoughItemsServiceException | NonStackableItemsServiceException e) {
conn.sendSystemMessage(SystemMessage.CANNOT_DISCARD_THIS_ITEM);
}
}
}

View File

@@ -1,126 +0,0 @@
/*
* 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.game.net.packet.client;
import org.jboss.netty.buffer.ChannelBuffer;
import com.google.inject.Inject;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.SystemMessage;
import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.model.id.object.ItemID;
import com.l2jserver.model.id.object.provider.ItemIDProvider;
import com.l2jserver.model.world.Item;
import com.l2jserver.service.game.item.ItemAlreadyOnGroundServiceException;
import com.l2jserver.service.game.item.ItemService;
import com.l2jserver.service.game.item.NonStackableItemsServiceException;
import com.l2jserver.service.game.item.NotEnoughItemsServiceException;
import com.l2jserver.service.game.spawn.AlreadySpawnedServiceException;
import com.l2jserver.service.game.spawn.SpawnPointNotFoundServiceException;
import com.l2jserver.util.geometry.Point3D;
/**
* This packet drops items on the ground.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_ITEM_DROP extends AbstractClientPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x17;
/**
* The {@link ItemService}
*/
private final ItemService itemService;
/**
* The {@link ItemID} provider
*/
private final ItemIDProvider itemIdProvider;
/**
* The item ID
*/
private int objectId;
/**
* The number of items to be dropped
*/
private long count;
/**
* The location to be dropped
*/
private Point3D point;
/**
* @param itemService
* the item service
* @param itemIdProvider
* the item id provider
*/
@Inject
public CM_ITEM_DROP(ItemService itemService, ItemIDProvider itemIdProvider) {
this.itemService = itemService;
this.itemIdProvider = itemIdProvider;
}
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
objectId = buffer.readInt();
count = buffer.readLong();
point = Point3D.fromXYZ(buffer.readInt(), buffer.readInt(),
buffer.readInt());
}
@Override
public void process(final Lineage2Client conn) {
final ItemID id = itemIdProvider.resolveID(objectId);
final Item item = id.getObject();
if (item == null) {
conn.sendActionFailed();
return;
}
if (!conn.getCharacterID().equals(item.getOwnerID())) {
conn.sendActionFailed();
return;
}
try {
final Item dropped = itemService.drop(item, count, point,
conn.getCharacter());
if (dropped.equals(item)) {
conn.removeInventoryItems(dropped);
} else {
conn.updateInventoryItems(item);
}
if (dropped.getCount() == 1) {
conn.sendSystemMessage(SystemMessage.YOU_DROPPED_S1, item
.getTemplate().getName());
} else {
conn.sendSystemMessage(SystemMessage.DROPPED_S1_S2, item
.getTemplate().getName(), Long.toString(dropped
.getCount()));
}
} catch (ItemAlreadyOnGroundServiceException
| AlreadySpawnedServiceException
| SpawnPointNotFoundServiceException
| NotEnoughItemsServiceException | NonStackableItemsServiceException e) {
conn.sendActionFailed();
}
}
}

View File

@@ -1,52 +0,0 @@
/*
* 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.game.net.packet.client;
import org.jboss.netty.buffer.ChannelBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractClientPacket;
/**
* The client is requesting a logout. Currently, when this packet is received
* the connection is immediately closed.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_LOGOUT extends AbstractClientPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x00;
/**
* The logger
*/
private static final Logger log = LoggerFactory.getLogger(CM_LOGOUT.class);
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
}
@Override
public void process(final Lineage2Client conn) {
log.debug("Logging out client {}", conn);
conn.close();
}
}

View File

@@ -1,121 +0,0 @@
/*
* 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.game.net.packet.client;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.ChannelFuture;
import org.jboss.netty.channel.ChannelFutureListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.inject.Inject;
import com.l2jserver.L2JConstant;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.Lineage2CryptographyKey;
import com.l2jserver.game.net.ProtocolVersion;
import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.game.net.packet.server.SM_KEY;
import com.l2jserver.service.network.keygen.BlowfishKeygenService;
/**
* In this packet the client is informing its protocol version. It is possible
* to do an test and refuse invalid protocol versions. After this packet, the
* messages received and sent are all encrypted, except for the encryptation key
* which is sent here.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_PROTOCOL_VERSION extends AbstractClientPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x0e;
/**
* The logger
*/
private final Logger log = LoggerFactory
.getLogger(CM_PROTOCOL_VERSION.class);
// services
/**
* The {@link BlowfishKeygenService} implementation. Use to generate
* cryptography keys.
*/
private final BlowfishKeygenService keygen;
// packet
/**
* The client version of the protocol
*/
private ProtocolVersion version;
/**
* @param keygen the keygen service
*/
@Inject
public CM_PROTOCOL_VERSION(BlowfishKeygenService keygen) {
this.keygen = keygen;
}
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
this.version = ProtocolVersion.fromVersion((int) buffer
.readUnsignedInt());
}
@Override
public void process(final Lineage2Client conn) {
// generate a new key
final Lineage2CryptographyKey inKey = new Lineage2CryptographyKey(
keygen.generate());
conn.getDecrypter().enable(inKey);
final Lineage2CryptographyKey outKey = inKey.copy();
log.debug("Decrypter has been enabled");
log.debug("Client protocol version: {}", version);
conn.setVersion(version);
if (L2JConstant.SUPPORTED_PROTOCOL != version) {
log.warn("Incorrect protocol version: {}. Only {} is supported.",
version, L2JConstant.SUPPORTED_PROTOCOL);
// notify wrong protocol and close connection
conn.write(new SM_KEY(inKey, false)).addListener(
new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future)
throws Exception {
// close connection
conn.close();
}
});
return;
}
// activate encrypter once packet has been sent.
conn.write(new SM_KEY(inKey, true)).addListener(
new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future)
throws Exception {
log.debug("Encrypter has been enabled");
// enable encrypter
conn.getEncrypter().setKey(outKey);
conn.getEncrypter().setEnabled(true);
}
});
}
}

View File

@@ -1,91 +0,0 @@
/*
* 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.game.net.packet.client;
import org.jboss.netty.buffer.ChannelBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.inject.Inject;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.game.net.packet.server.SM_CHAR_TEMPLATE;
import com.l2jserver.model.id.template.CharacterTemplateID;
import com.l2jserver.model.id.template.provider.CharacterTemplateIDProvider;
import com.l2jserver.model.template.CharacterTemplate;
import com.l2jserver.model.template.character.CharacterClass;
/**
* Requests the creation of a new Character. The list of character templates is
* sent to the client, meaning that the client is authorized to create
* characters.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_REQUEST_CHAR_TEMPLATE extends AbstractClientPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x13;
/**
* List of {@link CharacterClass} templates sent to the client
*/
private static final CharacterClass[] TEMPLATE_CLASSES = {
CharacterClass.HUMAN_FIGHTER, CharacterClass.HUMAN_MYSTIC,
CharacterClass.ELVEN_FIGHTER, CharacterClass.ELVEN_MYSTIC,
CharacterClass.DARK_FIGHTER, CharacterClass.DARK_MYSTIC,
CharacterClass.ORC_FIGHTER, CharacterClass.ORC_MYSTIC,
CharacterClass.DWARVEN_FIGHTER, CharacterClass.MALE_SOLDIER,
CharacterClass.FEMALE_SOLDIER };
/**
* The logger
*/
private static final Logger log = LoggerFactory
.getLogger(CM_REQUEST_CHAR_TEMPLATE.class);
/**
* The {@link CharacterTemplateID} factory
*/
private final CharacterTemplateIDProvider idFactory;
/**
* @param idFactory the character template id provider
*/
@Inject
public CM_REQUEST_CHAR_TEMPLATE(CharacterTemplateIDProvider idFactory) {
this.idFactory = idFactory;
}
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
}
@Override
public void process(final Lineage2Client conn) {
log.debug("Requested character templates");
final CharacterTemplate[] templates = new CharacterTemplate[TEMPLATE_CLASSES.length];
int i = 0;
for (final CharacterClass charClass : TEMPLATE_CLASSES) {
final CharacterTemplateID id = idFactory.resolveID(charClass.id);
templates[i++] = id.getTemplate();
}
conn.write(new SM_CHAR_TEMPLATE(templates));
}
}

View File

@@ -1,78 +0,0 @@
/*
* 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.game.net.packet.client;
import org.jboss.netty.buffer.ChannelBuffer;
import com.google.inject.Inject;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractClientPacket;
import com.l2jserver.game.net.packet.server.SM_CHAR_LIST;
import com.l2jserver.game.net.packet.server.SM_CHAR_RESTART;
import com.l2jserver.model.dao.CharacterDAO;
import com.l2jserver.service.game.character.CharacterService;
import com.l2jserver.service.game.spawn.NotSpawnedServiceException;
/**
* Requests the list of characters to be displayed in the lobby. The list of
* characters is sent to the client.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_RESTART extends AbstractClientPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x57;
/**
* The {@link CharacterService}
*/
private final CharacterService charService;
/**
* The {@link CharacterDAO}
*/
private final CharacterDAO charDao;
/**
* @param charService the character service
* @param charDao the character dao
*/
@Inject
public CM_RESTART(CharacterService charService, CharacterDAO charDao) {
this.charService = charService;
this.charDao = charDao;
}
@Override
public void read(Lineage2Client conn, ChannelBuffer buffer) {
}
@Override
public void process(final Lineage2Client conn) {
try {
charService.leaveWorld(conn.getCharacter());
} catch (NotSpawnedServiceException e) {
conn.sendActionFailed();
return;
}
conn.setCharacterID(null);
conn.write(SM_CHAR_RESTART.ok());
conn.write(SM_CHAR_LIST.fromL2Session(conn.getSession(),
charDao.selectByAccount(conn.getSession().getAccountID())));
}
}

View File

@@ -1,50 +0,0 @@
/*
* 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.game.net.packet.server;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractServerPacket;
/**
* This packet responds to the Restart request
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class SM_ACTION_FAILED extends AbstractServerPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x1f;
/**
* The {@link SM_ACTION_FAILED} shared instance
*/
public static final SM_ACTION_FAILED SHARED_INSTANCE = new SM_ACTION_FAILED();
/**
* Creates a new instance
*/
public SM_ACTION_FAILED() {
super(OPCODE);
}
@Override
public void write(Lineage2Client conn, ChannelBuffer buffer) {
}
}

View File

@@ -1,114 +0,0 @@
/*
* 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.game.net.packet.server;
import java.util.Collections;
import java.util.List;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractServerPacket;
import com.l2jserver.model.server.AttackHit;
import com.l2jserver.model.world.Actor;
import com.l2jserver.util.factory.CollectionFactory;
/**
* This packet informs the client of an attack issued
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
* @see AttackHit
*/
public class SM_ACTOR_ATTACK extends AbstractServerPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x33;
/**
* The attacker actor
*/
private final Actor attacker;
/**
* List of hits to be sent
*/
private final List<AttackHit> hits = CollectionFactory.newList();
/**
* @param attacker
* the attacked
* @param hits
* the hits
*/
public SM_ACTOR_ATTACK(Actor attacker, AttackHit... hits) {
super(OPCODE);
this.attacker = attacker;
Collections.addAll(this.hits, hits);
}
/**
* @param hits
* the hits
*/
public SM_ACTOR_ATTACK(AttackHit... hits) {
this(hits[0].getAttacker(), hits);
}
@Override
public void write(Lineage2Client conn, ChannelBuffer buffer) {
buffer.writeInt(attacker.getID().getID());
final AttackHit first = hits.get(0);
buffer.writeInt(first.getTarget().getID().getID());
buffer.writeInt((int) first.getDamage());
buffer.writeByte(first.getFlagsByte());
buffer.writeInt(attacker.getPoint().getX());
buffer.writeInt(attacker.getPoint().getY());
buffer.writeInt(attacker.getPoint().getZ());
buffer.writeShort(hits.size() - 1);
if (hits.size() > 1) {
boolean skipFirst = false;
for (final AttackHit hit : hits) {
if (!skipFirst) {
skipFirst = true;
continue;
}
buffer.writeInt(hit.getTarget().getID().getID());
buffer.writeInt((int) hit.getDamage());
buffer.writeByte(hit.getFlagsByte());
}
}
buffer.writeInt(first.getTarget().getPoint().getX());
buffer.writeInt(first.getTarget().getPoint().getY());
buffer.writeInt(first.getTarget().getPoint().getZ());
}
/**
* Adds a new hit
*
* @param hit
* the hit
* @return this instance
*/
public SM_ACTOR_ATTACK add(AttackHit hit) {
hits.add(hit);
return this;
}
}

View File

@@ -1,96 +0,0 @@
/*
* 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.game.net.packet.server;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractServerPacket;
import com.l2jserver.model.world.Actor;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.service.game.chat.ChatMessageType;
import com.l2jserver.util.BufferUtils;
/**
* This packet notifies the client that the chosen character has been
* successfully selected.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class SM_ACTOR_CHAT extends AbstractServerPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x4a;
/**
* The sending actor
*/
private final Actor actor;
/**
* The message destination
*/
private ChatMessageType destination;
/**
* The message
*/
private String message = null;
/**
* The message ID
*/
private int messageID = 0;
/**
* @param character the actor
* @param destination the destination
* @param message the message
*/
public SM_ACTOR_CHAT(Actor character, ChatMessageType destination, String message) {
super(OPCODE);
this.actor = character;
this.destination = destination;
this.message = message;
}
/**
* @param actor the actor
* @param destination the destination
* @param messageID the message id
*/
public SM_ACTOR_CHAT(Actor actor, ChatMessageType destination, int messageID) {
super(OPCODE);
this.actor = actor;
this.destination = destination;
this.messageID = messageID;
}
@Override
public void write(Lineage2Client conn, ChannelBuffer buffer) {
buffer.writeInt(actor.getID().getID());
buffer.writeInt(destination.id);
if (actor instanceof L2Character) {
BufferUtils.writeString(buffer, ((L2Character) actor).getName());
} else {
buffer.writeInt(actor.getID().getID());
}
if (message != null) {
BufferUtils.writeString(buffer, message);
} else {
buffer.writeInt(messageID);
}
}
}

View File

@@ -1,62 +0,0 @@
/*
* 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.game.net.packet.server;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractServerPacket;
import com.l2jserver.model.server.AttackHit;
import com.l2jserver.model.world.Actor;
/**
* This packet informs the client of an attack issued
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
* @see AttackHit
*/
public class SM_ACTOR_DIE extends AbstractServerPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x00;
/**
* The attacker actor
*/
private final Actor actor;
/**
* @param actor
* the actor
*/
public SM_ACTOR_DIE(Actor actor) {
super(OPCODE);
this.actor = actor;
}
@Override
public void write(Lineage2Client conn, ChannelBuffer buffer) {
buffer.writeInt(actor.getID().getID());
buffer.writeInt(0x00); // to hide away
buffer.writeInt(0x00); // to castle
buffer.writeInt(0x00); // to siege HQ
buffer.writeInt(0x00); // sweepable (blue glow)
buffer.writeInt(0x00); // to FIXED
buffer.writeInt(0x00); // to fortress
}
}

View File

@@ -1,72 +0,0 @@
/*
* 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.game.net.packet.server;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractServerPacket;
import com.l2jserver.model.world.Actor;
import com.l2jserver.util.geometry.Coordinate;
/**
* This packet notifies the client that the character is moving to an certain
* point. If the {@link Actor} moving is the same as the client connected, the
* client will send position validations at specific time intervals.
*
* @author <a href="http://www.rogiel.com">Rogiel</a> O
*/
public class SM_ACTOR_MOVE extends AbstractServerPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x2f;
/**
* The selected character
*/
private final Actor actor;
/**
* The destination coordinate
*/
private Coordinate target;
/**
* @param actor the actor
* @param target the target
*/
public SM_ACTOR_MOVE(Actor actor, Coordinate target) {
super(OPCODE);
this.actor = actor;
this.target = target;
}
@Override
public void write(Lineage2Client conn, ChannelBuffer buffer) {
buffer.writeInt(actor.getID().getID());
// target
buffer.writeInt(target.getX());
buffer.writeInt(target.getY());
buffer.writeInt(target.getZ());
// source
buffer.writeInt(actor.getPoint().getX());
buffer.writeInt(actor.getPoint().getY());
buffer.writeInt(actor.getPoint().getZ());
}
}

View File

@@ -1,58 +0,0 @@
/*
* 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.game.net.packet.server;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractServerPacket;
import com.l2jserver.model.world.Actor;
/**
* This packet notifies the client that the chosen character has been
* successfully selected.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class SM_ACTOR_POSITION extends AbstractServerPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x79;
/**
* The selected character
*/
private final Actor actor;
/**
* @param actor the actor
*/
public SM_ACTOR_POSITION(Actor actor) {
super(OPCODE);
this.actor = actor;
}
@Override
public void write(Lineage2Client conn, ChannelBuffer buffer) {
buffer.writeInt(actor.getID().getID());
buffer.writeInt(actor.getPoint().getX());
buffer.writeInt(actor.getPoint().getY());
buffer.writeInt(actor.getPoint().getZ());
buffer.writeInt((int) actor.getPoint().getAngle());
}
}

View File

@@ -1,219 +0,0 @@
/*
* 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.game.net.packet.server;
import java.util.Map;
import java.util.Map.Entry;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractServerPacket;
import com.l2jserver.model.world.Actor;
import com.l2jserver.util.factory.CollectionFactory;
/**
* This packet notifies the client that the chosen character has been
* successfully selected.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class SM_ACTOR_STATUS_UPDATE extends AbstractServerPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x18;
/**
* The stats the can be updated with the packet
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public enum Stat {
/**
* Updates the character level
*/
LEVEL(0x01),
/**
* Updates the character experience
*/
EXPERIENCE(0x02),
/**
* Updates the character strength
*/
STR(0x03),
/**
* Updates the character dexterity
*/
DEX(0x04),
/**
* Updates the character concentration
*/
CON(0x05),
/**
* Updates the character intelligence
*/
INT(0x06),
/**
* Updates the character witness
*/
WIT(0x07),
/**
* Updates the character mentality
*/
MEN(0x08),
/**
* Updates the character hp
*/
HP(0x09),
/**
* Updates the character maximum hp
*/
MAX_HP(0x0a),
/**
* Updates the character hp
*/
MP(0x0b),
/**
* Updates the character maximum mp
*/
MAX_MP(0x0c),
/**
* Updates the character sp
*/
SP(0x0d),
/**
* Updates the character load
*/
LOAD(0x0e),
/**
* Updates the character maximum load
*/
MAX_LOAD(0x0f),
/**
* Updates the character physical attack
*/
PHYSICAL_ATK(0x11),
/**
* Updates the character attack speed
*/
ATTACK_SPEED(0x12),
/**
* Updates the character physical defense
*/
PHYSICAL_DEFENSE(0x13),
/**
* Updates the character evasion
*/
EVASION(0x14),
/**
* Updates the character accuracy
*/
ACCURACY(0x15),
/**
* Updates the character critical
*/
CRITICAL(0x16),
/**
* Updates the character magical attack
*/
MAGICAL_ATTACK(0x17),
/**
* Updates the character cast speed
*/
CAST_SPEED(0x18),
/**
* Updates the character magical defense
*/
MAGICAL_DEFENSE(0x19),
/**
* Updates the character pvp flag
*/
PVP_FLAG(0x1a),
/**
* Updates the character karma
*/
KARMA(0x1b),
/**
* Updates the character cp
*/
CP(0x21),
/**
* Updates the character max cp
*/
MAX_CP(0x22);
/**
* The stat id
*/
public final int id;
/**
* @param id
* the stat id
*/
Stat(int id) {
this.id = id;
}
}
/**
* The set of updates to be sent
*/
private final Map<Stat, Integer> update = CollectionFactory.newMap();
/**
* The actor to be updated
*/
private final Actor actor;
/**
* @param actor
* the actor
*/
public SM_ACTOR_STATUS_UPDATE(Actor actor) {
super(OPCODE);
this.actor = actor;
}
@Override
public void write(Lineage2Client conn, ChannelBuffer buffer) {
buffer.writeInt(actor.getID().getID());
buffer.writeInt(update.size());
for (Entry<Stat, Integer> entry : update.entrySet()) {
buffer.writeInt(entry.getKey().id);
buffer.writeInt(entry.getValue());
}
}
/**
* @param stat
* the stat
* @param value
* the stat value
* @return this instances
*/
public SM_ACTOR_STATUS_UPDATE add(Stat stat, int value) {
update.put(stat, value);
return this;
}
}

View File

@@ -1,116 +0,0 @@
/*
* 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.game.net.packet.server;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractServerPacket;
/**
* An packet informing that the character could not be created.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
* @see Reason
*/
public class SM_CHAR_CREATE_FAIL extends AbstractServerPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x10;
/**
* The character creation failure reason
*/
private Reason reason;
/**
* The character creation error reason
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public enum Reason {
/**
* "Your character creation has failed."
*/
REASON_CREATION_FAILED(0x00),
/**
* "You cannot create another character. Please delete the existing
* character and try again." Removes all settings that were selected
* (race, class, etc)"
*/
REASON_TOO_MANY_CHARACTERS(0x01),
/**
* "This name already exists."
*/
REASON_NAME_ALREADY_EXISTS(0x02),
/**
* "Your title cannot exceed 16 characters in length. Please try again."
*/
REASON_16_ENG_CHARS(0x03),
/**
* "Incorrect name. Please try again."
*/
REASON_INCORRECT_NAME(0x04),
/**
* "Characters cannot be created from this server."
*/
REASON_CREATE_NOT_ALLOWED(0x05),
/**
* "Unable to create character. You are unable to create a new character
* on the selected server. A restriction is in place which restricts
* users from creating characters on different servers where no previous
* character exists. Please choose another server."
*/
REASON_CHOOSE_ANOTHER_SVR(0x06);
/**
* The error code id
*/
public final int id;
/**
* @param id
* the reason id
*/
Reason(int id) {
this.id = id;
}
/**
* @return an {@link SM_CHAR_CREATE_FAIL} instance for this enum
* constant
*/
public SM_CHAR_CREATE_FAIL newInstance() {
return new SM_CHAR_CREATE_FAIL(this);
}
}
/**
* @param reason
* the reason
*/
public SM_CHAR_CREATE_FAIL(Reason reason) {
super(OPCODE);
this.reason = reason;
}
@Override
public void write(Lineage2Client conn, ChannelBuffer buffer) {
buffer.writeInt(reason.id);
}
}

View File

@@ -1,51 +0,0 @@
/*
* 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.game.net.packet.server;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractServerPacket;
/**
* An packet informing that the character was created with success.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class SM_CHAR_CREATE_OK extends AbstractServerPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x0f;
/**
* The packet shared instance
*/
public static final SM_CHAR_CREATE_OK INSTANCE = new SM_CHAR_CREATE_OK();
/**
* Creates a new instance
*/
public SM_CHAR_CREATE_OK() {
super(OPCODE);
}
@Override
public void write(Lineage2Client conn, ChannelBuffer buffer) {
buffer.writeInt(0x01);
}
}

View File

@@ -1,104 +0,0 @@
/*
* 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.game.net.packet.server;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractServerPacket;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.model.world.actor.ActorExperience;
import com.l2jserver.util.BufferUtils;
/**
* An packet informing that the character was created with success.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class SM_CHAR_ENTER_WORLD extends AbstractServerPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x0b;
/**
* The entering character
*/
private final L2Character character;
/**
* The session ID
*/
private final int sessionId;
/**
* Creates a new instance
*
* @param character
* the character
* @param sessionId
* the session id
*/
public SM_CHAR_ENTER_WORLD(L2Character character, int sessionId) {
super(OPCODE);
this.character = character;
this.sessionId = sessionId;
}
@Override
public void write(Lineage2Client conn, ChannelBuffer buffer) {
BufferUtils.writeString(buffer, character.getName());
buffer.writeInt(character.getID().getID());
BufferUtils.writeString(buffer, "Hello world!");
buffer.writeInt(sessionId);
buffer.writeInt(0x00); // clan id
buffer.writeInt(0x00); // ??
buffer.writeInt(character.getSex().option);
buffer.writeInt(character.getRace().id);
buffer.writeInt(character.getCharacterClass().id);
buffer.writeInt(0x01); // active ??
buffer.writeInt(character.getPosition().getX());
buffer.writeInt(character.getPosition().getY());
buffer.writeInt(character.getPosition().getZ());
buffer.writeDouble(100);
buffer.writeDouble(100);
buffer.writeInt(0x00);
buffer.writeLong(ActorExperience.LEVEL_1.experience);
buffer.writeInt(ActorExperience.LEVEL_1.level);
buffer.writeInt(0x00); // karma
buffer.writeInt(0x00); // pk
buffer.writeInt(character.getStats().getIntelligence()); // INT
buffer.writeInt(character.getStats().getStrength()); // STR
buffer.writeInt(character.getStats().getConcentration()); // CON
buffer.writeInt(character.getStats().getMentality()); // MEN
buffer.writeInt(character.getStats().getDexterity()); // DEX
buffer.writeInt(character.getStats().getWitness()); // WIT
buffer.writeInt(250); // game time
buffer.writeInt(0x00);
buffer.writeInt(character.getCharacterClass().id);
buffer.writeInt(0x00);
buffer.writeInt(0x00);
buffer.writeInt(0x00);
buffer.writeInt(0x00);
buffer.writeBytes(new byte[64]);
buffer.writeInt(0x00);
}
}

View File

@@ -1,398 +0,0 @@
/*
* 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.game.net.packet.server;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.BELT;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.CHEST;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.CLOAK;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.DECORATION_1;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.DECORATION_2;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.DECORATION_3;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.DECORATION_4;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.DECORATION_5;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.DECORATION_6;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.FEET;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.GLOVES;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.HAIR1;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.HAIR2;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.HEAD;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.LEFT_BRACELET;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.LEFT_EAR;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.LEFT_FINGER;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.LEFT_HAND;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.LEGS;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.NECK;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.RIGHT_BRACELET;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.RIGHT_EAR;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.RIGHT_FINGER;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.RIGHT_HAND;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.UNDERWEAR;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractServerPacket;
import com.l2jserver.model.template.actor.ActorSex;
import com.l2jserver.model.world.Item;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.model.world.actor.ActorExperience;
import com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll;
import com.l2jserver.util.BufferUtils;
/**
* This is an message informing the client of an given player
*
* <pre>
* (c) dddddSddddQdddddddddddddddddddddddddddddddddddddddddddddddddd
* ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
* fdfdfdfddddSdddddcccddh[h]cdcdhhdhddddccdcccddddcdddddhhhhhhhdddd
* d
* </pre>
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class SM_CHAR_INFO extends AbstractServerPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x32;
/**
* The character
*/
private L2Character character;
/**
* @param character the character
*/
public SM_CHAR_INFO(L2Character character) {
super(OPCODE);
this.character = character;
}
@Override
public void write(Lineage2Client conn, ChannelBuffer buffer) {
buffer.writeInt(character.getPoint().getX());
buffer.writeInt(character.getPoint().getY());
buffer.writeInt(character.getPoint().getZ());
buffer.writeInt(0); // vehicle
buffer.writeInt(character.getID().getID());
BufferUtils.writeString(buffer, character.getName());
buffer.writeInt(character.getRace().id);
buffer.writeInt(character.getSex().option);
buffer.writeInt(character.getCharacterClass().id);
buffer.writeInt(character.getLevel());
buffer.writeLong(ActorExperience.LEVEL_1.experience);
buffer.writeInt(character.getStats().getStrength());
buffer.writeInt(character.getStats().getDexterity());
buffer.writeInt(character.getStats().getConcentration());
buffer.writeInt(character.getStats().getIntelligence());
buffer.writeInt(character.getStats().getWitness());
buffer.writeInt(character.getStats().getMentality());
buffer.writeInt(character.getStats().getMaxHP()); // max hp
buffer.writeInt((int) character.getHP()); // cur hp
buffer.writeInt(character.getStats().getMaxMP()); // max mp
buffer.writeInt((int) character.getMP()); // cur mp
buffer.writeInt(character.getSP()); // sp
buffer.writeInt(0); // load
buffer.writeInt(character.getStats().getMaximumLoad()); // max load
// 20 no weapon, 40 weapon equippe
buffer.writeInt(20);
writePaperdollObjectID(buffer, character, UNDERWEAR);
writePaperdollObjectID(buffer, character, RIGHT_EAR);
writePaperdollObjectID(buffer, character, LEFT_EAR);
writePaperdollObjectID(buffer, character, NECK);
writePaperdollObjectID(buffer, character, RIGHT_FINGER);
writePaperdollObjectID(buffer, character, LEFT_FINGER);
writePaperdollObjectID(buffer, character, HEAD);
writePaperdollObjectID(buffer, character, RIGHT_HAND);
writePaperdollObjectID(buffer, character, LEFT_HAND);
writePaperdollObjectID(buffer, character, GLOVES);
writePaperdollObjectID(buffer, character, CHEST);
writePaperdollObjectID(buffer, character, LEGS);
writePaperdollObjectID(buffer, character, FEET);
writePaperdollObjectID(buffer, character, CLOAK);
writePaperdollObjectID(buffer, character, RIGHT_HAND);
writePaperdollObjectID(buffer, character, HAIR1);
writePaperdollObjectID(buffer, character, HAIR2);
writePaperdollObjectID(buffer, character, RIGHT_BRACELET);
writePaperdollObjectID(buffer, character, LEFT_BRACELET);
writePaperdollObjectID(buffer, character, DECORATION_1);
writePaperdollObjectID(buffer, character, DECORATION_2);
writePaperdollObjectID(buffer, character, DECORATION_3);
writePaperdollObjectID(buffer, character, DECORATION_4);
writePaperdollObjectID(buffer, character, DECORATION_5);
writePaperdollObjectID(buffer, character, DECORATION_6);
writePaperdollObjectID(buffer, character, BELT);
writePaperdollItemID(buffer, character, UNDERWEAR);
writePaperdollItemID(buffer, character, RIGHT_EAR);
writePaperdollItemID(buffer, character, LEFT_EAR);
writePaperdollItemID(buffer, character, NECK);
writePaperdollItemID(buffer, character, RIGHT_FINGER);
writePaperdollItemID(buffer, character, LEFT_FINGER);
writePaperdollItemID(buffer, character, HEAD);
writePaperdollItemID(buffer, character, RIGHT_HAND);
writePaperdollItemID(buffer, character, LEFT_HAND);
writePaperdollItemID(buffer, character, GLOVES);
writePaperdollItemID(buffer, character, CHEST);
writePaperdollItemID(buffer, character, LEGS);
writePaperdollItemID(buffer, character, FEET);
writePaperdollItemID(buffer, character, CLOAK);
writePaperdollItemID(buffer, character, RIGHT_HAND);
writePaperdollItemID(buffer, character, HAIR1);
writePaperdollItemID(buffer, character, HAIR2);
writePaperdollItemID(buffer, character, RIGHT_BRACELET);
writePaperdollItemID(buffer, character, LEFT_BRACELET);
writePaperdollItemID(buffer, character, DECORATION_1);
writePaperdollItemID(buffer, character, DECORATION_2);
writePaperdollItemID(buffer, character, DECORATION_3);
writePaperdollItemID(buffer, character, DECORATION_4);
writePaperdollItemID(buffer, character, DECORATION_5);
writePaperdollItemID(buffer, character, DECORATION_6);
writePaperdollItemID(buffer, character, BELT);
writePaperdollAugumentID(buffer, character, UNDERWEAR);
writePaperdollAugumentID(buffer, character, RIGHT_EAR);
writePaperdollAugumentID(buffer, character, LEFT_EAR);
writePaperdollAugumentID(buffer, character, NECK);
writePaperdollAugumentID(buffer, character, RIGHT_FINGER);
writePaperdollAugumentID(buffer, character, LEFT_FINGER);
writePaperdollAugumentID(buffer, character, HEAD);
writePaperdollAugumentID(buffer, character, RIGHT_HAND);
writePaperdollAugumentID(buffer, character, LEFT_HAND);
writePaperdollAugumentID(buffer, character, GLOVES);
writePaperdollAugumentID(buffer, character, CHEST);
writePaperdollAugumentID(buffer, character, LEGS);
writePaperdollAugumentID(buffer, character, FEET);
writePaperdollAugumentID(buffer, character, CLOAK);
writePaperdollAugumentID(buffer, character, RIGHT_HAND);
writePaperdollAugumentID(buffer, character, HAIR1);
writePaperdollAugumentID(buffer, character, HAIR2);
writePaperdollAugumentID(buffer, character, RIGHT_BRACELET);
writePaperdollAugumentID(buffer, character, LEFT_BRACELET);
writePaperdollAugumentID(buffer, character, DECORATION_1);
writePaperdollAugumentID(buffer, character, DECORATION_2);
writePaperdollAugumentID(buffer, character, DECORATION_3);
writePaperdollAugumentID(buffer, character, DECORATION_4);
writePaperdollAugumentID(buffer, character, DECORATION_5);
writePaperdollAugumentID(buffer, character, DECORATION_6);
writePaperdollAugumentID(buffer, character, BELT);
buffer.writeInt(0x00); // (max?) talismans count
buffer.writeInt(0x00); // cloak sratus
buffer.writeInt(character.getStats().getPhysicalAttack());
buffer.writeInt(character.getStats().getPhysicalAttackSpeed());
buffer.writeInt(character.getStats().getPhysicalDefense());
buffer.writeInt(character.getStats().getEvasionRate()); // evasion
buffer.writeInt(character.getStats().getAccuracy());
buffer.writeInt(character.getStats().getPhysicalCriticalRate());
buffer.writeInt(character.getStats().getMagicalAttack());
buffer.writeInt(character.getStats().getMagicalAttackSpeed());
buffer.writeInt(character.getStats().getPhysicalAttackSpeed());
buffer.writeInt(character.getStats().getMagicalDefense());
buffer.writeInt(0x00); // 0-non-pvp 1-pvp = violett name
buffer.writeInt(character.getKarma()); // karma
buffer.writeInt(character.getStats().getRunSpeed());
buffer.writeInt(character.getStats().getWalkSpeed());
buffer.writeInt(character.getStats().getRunSpeed());
buffer.writeInt(character.getStats().getWalkSpeed());
buffer.writeInt(0); // unk
buffer.writeInt(0); // unk
buffer.writeInt(0); // fly speed -only if flying
buffer.writeInt(0); // fly speed -only if flying
buffer.writeDouble(0x01); // move speed multiplier
buffer.writeDouble(0x01); // attack speed multiplier
// L2Summon pet = _activeChar.getPet();
// L2Transformation trans;
// if (_activeChar.getMountType() != 0 && pet != null) {
// writeF(pet.getTemplate().fCollisionRadius);
// writeF(pet.getTemplate().fCollisionHeight);
// } else if ((trans = _activeChar.getTransformation()) != null) {
// writeF(trans.getCollisionRadius());
// writeF(trans.getCollisionHeight());
// } else {
// writeF(_activeChar.getCollisionRadius());
// writeF(_activeChar.getCollisionHeight());
// }
if (character.getSex() == ActorSex.MALE) {
buffer.writeDouble(character.getTemplate().getCollision().getMale()
.getRadius());
buffer.writeDouble(character.getTemplate().getCollision().getMale()
.getHeigth());
} else {
buffer.writeDouble(character.getTemplate().getCollision()
.getFemale().getRadius());
buffer.writeDouble(character.getTemplate().getCollision()
.getFemale().getHeigth());
}
buffer.writeInt(character.getAppearance().getHairStyle().option);
buffer.writeInt(character.getAppearance().getHairColor().option);
buffer.writeInt(character.getAppearance().getFace().option);
buffer.writeInt(0x01); // is gm
BufferUtils.writeString(buffer, character.getTitle());
buffer.writeInt((character.getClanID() != null ? character.getClanID()
.getID() : 0x00)); // clanid
buffer.writeInt(0x00); // clan crest id
buffer.writeInt(0x00); // ally id
buffer.writeInt(0x00); // ally crest id
// 0x40 leader rights
// siege flags: attacker - 0x180 sword over name, defender - 0x80
// shield, 0xC0 crown (|leader), 0x1C0 flag (|leader)
buffer.writeInt(0x40);
buffer.writeByte(0x00); // mount type
buffer.writeByte(0x00); // private store type
buffer.writeByte(0x00); // dwarven craft
buffer.writeInt(character.getPkKills()); // pk kills
buffer.writeInt(character.getPvpKills()); // pvp kills
buffer.writeShort(0x00); // cubics size
// short:cubicsid[cubicssize]
// buffer.writeShort(cubicid);
buffer.writeByte(0); // is party match room
buffer.writeInt(0x00); // abnormal effect
buffer.writeByte(0x0); // flying mounted = 2; otherwise: 0
buffer.writeInt(0x00); // clan privileges
buffer.writeShort(2); // c2 recommendations remaining
buffer.writeShort(1); // c2 recommendations received
buffer.writeInt(0); // mount npc id
buffer.writeShort(500); // inventory limit
buffer.writeInt(character.getCharacterClass().id);
buffer.writeInt(0x00); // special effects? circles around player...
buffer.writeInt(character.getStats().getMaxCP());
buffer.writeInt((int) character.getCP()); // cur cp
buffer.writeByte(0x00); // is mount or is airshilhelp = 0; otherwise
// enchant effect (minimum 127)
buffer.writeByte(0x00);// team, 1=blue,2 red,0 is unknown
buffer.writeInt(0x00); // clan crest large id
// 0x01: symbol on char menu ctrl+I
buffer.writeByte(0x00); // is noble
buffer.writeByte(0x00); // 0x01: Hero Aura
buffer.writeByte(0x00); // Fishing Mode
buffer.writeInt(0x00); // fishing x
buffer.writeInt(0x00); // fishing y
buffer.writeInt(0x00); // fishing z
buffer.writeInt(character.getAppearance().getNameColor().toInteger());
// new c5
// is running
buffer.writeByte(character.getMoveType().id);
// pledge class
buffer.writeInt(0x00); // changes the text above
// CP on Status Window
buffer.writeInt(0x00); // pledge type
buffer.writeInt(character.getAppearance().getTitleColor().toInteger());
// cursed weapon ID equipped
buffer.writeInt(0x00);
// T1 Starts
buffer.writeInt(0x00); // transformation id
buffer.writeShort(0x00); // attack element
buffer.writeShort(0x10); // attack element value
buffer.writeShort(0x10); // fire defense value
buffer.writeShort(0x10); // water def value
buffer.writeShort(0x10); // wind def value
buffer.writeShort(0x10); // earth def value
buffer.writeShort(0x10); // holy def value
buffer.writeShort(0x10); // dark def value
buffer.writeInt(0x00); // getAgathionId
// T2 Starts
buffer.writeInt(0x00); // Fame
buffer.writeInt(0x01); // Minimap on Hellbound
buffer.writeInt(1); // Vitality Points
buffer.writeInt(0x00); // special effects
}
/**
* Writes the paperdoll object id
*
* @param buffer
* the buffer
* @param character
* the character
* @param paperdoll
* the slot
*/
private void writePaperdollObjectID(ChannelBuffer buffer,
L2Character character, InventoryPaperdoll paperdoll) {
final Item item = character.getInventory().getItem(paperdoll);
int id = 0;
if (item != null)
id = item.getID().getID();
buffer.writeInt(id);
}
/**
* Writes the paperdoll item id
*
* @param buffer
* the buffer
* @param character
* the character
* @param paperdoll
* the slot
*/
private void writePaperdollItemID(ChannelBuffer buffer,
L2Character character, InventoryPaperdoll paperdoll) {
final Item item = character.getInventory().getItem(paperdoll);
int id = 0;
if (item != null)
id = item.getTemplateID().getID();
buffer.writeInt(id);
}
/**
* Writes the paperdoll augument id
*
* @param buffer
* the buffer
* @param character
* the character
* @param paperdoll
* the slot
*/
private void writePaperdollAugumentID(ChannelBuffer buffer,
L2Character character, InventoryPaperdoll paperdoll) {
buffer.writeInt(0x00);
}
}

View File

@@ -1,293 +0,0 @@
/*
* 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.game.net.packet.server;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.BELT;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.CHEST;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.CLOAK;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.DECORATION_1;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.DECORATION_2;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.DECORATION_3;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.DECORATION_4;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.DECORATION_5;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.DECORATION_6;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.FEET;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.GLOVES;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.HAIR1;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.HAIR2;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.HEAD;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.LEFT_BRACELET;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.LEFT_HAND;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.LEGS;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.RIGHT_BRACELET;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.RIGHT_HAND;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.UNDERWEAR;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractServerPacket;
import com.l2jserver.model.template.actor.ActorSex;
import com.l2jserver.model.world.Item;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.model.world.L2Character.CharacterMoveType;
import com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll;
import com.l2jserver.util.BufferUtils;
/**
* This packet sends to the client an actor information about an actor
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class SM_CHAR_INFO_BROADCAST extends AbstractServerPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x31;
/**
* The character
*/
private final L2Character character;
/**
* @param character
* the character
*/
public SM_CHAR_INFO_BROADCAST(L2Character character) {
super(OPCODE);
this.character = character;
}
@Override
public void write(Lineage2Client conn, ChannelBuffer buffer) {
buffer.writeInt(character.getPoint().getX());
buffer.writeInt(character.getPoint().getY());
buffer.writeInt(character.getPoint().getZ());
buffer.writeInt(0x00); // unk
buffer.writeInt(character.getID().getID());
BufferUtils.writeString(buffer, character.getName());
buffer.writeInt(character.getRace().id);
buffer.writeInt(character.getSex().option);
buffer.writeInt(character.getCharacterClass().id);
writePaperdollItemID(buffer, character, UNDERWEAR);
// writePaperdollItemID(buffer, character, RIGHT_EAR);
// writePaperdollItemID(buffer, character, LEFT_EAR);
// writePaperdollItemID(buffer, character, NECK);
// writePaperdollItemID(buffer, character, RIGHT_FINGER);
// writePaperdollItemID(buffer, character, LEFT_FINGER);
writePaperdollItemID(buffer, character, HEAD);
writePaperdollItemID(buffer, character, RIGHT_HAND);
writePaperdollItemID(buffer, character, LEFT_HAND);
writePaperdollItemID(buffer, character, GLOVES);
writePaperdollItemID(buffer, character, CHEST);
writePaperdollItemID(buffer, character, LEGS);
writePaperdollItemID(buffer, character, FEET);
writePaperdollItemID(buffer, character, CLOAK);
writePaperdollItemID(buffer, character, RIGHT_HAND);
writePaperdollItemID(buffer, character, HAIR1);
writePaperdollItemID(buffer, character, HAIR2);
writePaperdollItemID(buffer, character, RIGHT_BRACELET);
writePaperdollItemID(buffer, character, LEFT_BRACELET);
writePaperdollItemID(buffer, character, DECORATION_1);
writePaperdollItemID(buffer, character, DECORATION_2);
writePaperdollItemID(buffer, character, DECORATION_3);
writePaperdollItemID(buffer, character, DECORATION_4);
writePaperdollItemID(buffer, character, DECORATION_5);
writePaperdollItemID(buffer, character, DECORATION_6);
writePaperdollItemID(buffer, character, BELT);
writePaperdollAugumentID(buffer, character, UNDERWEAR);
// writePaperdollAugumentID(buffer, character, RIGHT_EAR);
// writePaperdollAugumentID(buffer, character, LEFT_EAR);
// writePaperdollAugumentID(buffer, character, NECK);
// writePaperdollAugumentID(buffer, character, RIGHT_FINGER);
// writePaperdollAugumentID(buffer, character, LEFT_FINGER);
writePaperdollAugumentID(buffer, character, HEAD);
writePaperdollAugumentID(buffer, character, RIGHT_HAND);
writePaperdollAugumentID(buffer, character, LEFT_HAND);
writePaperdollAugumentID(buffer, character, GLOVES);
writePaperdollAugumentID(buffer, character, CHEST);
writePaperdollAugumentID(buffer, character, LEGS);
writePaperdollAugumentID(buffer, character, FEET);
writePaperdollAugumentID(buffer, character, CLOAK);
writePaperdollAugumentID(buffer, character, RIGHT_HAND);
writePaperdollAugumentID(buffer, character, HAIR1);
writePaperdollAugumentID(buffer, character, HAIR2);
writePaperdollAugumentID(buffer, character, RIGHT_BRACELET);
writePaperdollAugumentID(buffer, character, LEFT_BRACELET);
writePaperdollAugumentID(buffer, character, DECORATION_1);
writePaperdollAugumentID(buffer, character, DECORATION_2);
writePaperdollAugumentID(buffer, character, DECORATION_3);
writePaperdollAugumentID(buffer, character, DECORATION_4);
writePaperdollAugumentID(buffer, character, DECORATION_5);
writePaperdollAugumentID(buffer, character, DECORATION_6);
writePaperdollAugumentID(buffer, character, BELT);
buffer.writeInt(0x00); // unk
buffer.writeInt(0x01); // unk
// end of t1 new h's
buffer.writeInt(0x00); // pvp flag
buffer.writeInt(character.getKarma()); // karma
buffer.writeInt(character.getStats().getMagicalAttackSpeed());
buffer.writeInt(character.getStats().getPhysicalAttackSpeed());
buffer.writeInt(0x00); // unk
// FIXME half of those are walk speed
buffer.writeInt(character.getStats().getRunSpeed());
buffer.writeInt(character.getStats().getRunSpeed());
buffer.writeInt(character.getStats().getRunSpeed());
buffer.writeInt(character.getStats().getRunSpeed());
buffer.writeInt(character.getStats().getRunSpeed());
buffer.writeInt(character.getStats().getRunSpeed());
buffer.writeInt(character.getStats().getRunSpeed());
buffer.writeInt(character.getStats().getRunSpeed());
buffer.writeDouble(0x01); // move speed multiplier
buffer.writeDouble(0x01); // attack speed multiplier
if (character.getSex() == ActorSex.MALE) {
buffer.writeDouble(character.getTemplate().getCollision().getMale()
.getRadius());
buffer.writeDouble(character.getTemplate().getCollision().getMale()
.getHeigth());
} else {
buffer.writeDouble(character.getTemplate().getCollision()
.getFemale().getRadius());
buffer.writeDouble(character.getTemplate().getCollision()
.getFemale().getHeigth());
}
buffer.writeInt(character.getAppearance().getHairStyle().option);
buffer.writeInt(character.getAppearance().getHairColor().option);
buffer.writeInt(character.getAppearance().getFace().option);
BufferUtils.writeString(buffer, character.getTitle());
// dont send those 4 if using cursed weapon
buffer.writeInt(0); // clan id
buffer.writeInt(0); // crest id
buffer.writeInt(0); // ally id
buffer.writeInt(0); // ally crest id
buffer.writeByte(0x01); // sitting
buffer.writeByte((character.getMoveType() == CharacterMoveType.RUN ? 0x01
: 0x00));
buffer.writeByte((character.isAttacking() ? 0x01 : 0x00)); // is in
// combat
buffer.writeByte(0x00); // alike dead
buffer.writeByte((character.getAppearance().isVisible() ? 0x00 : 0x01));
// 1-on Strider, 2-on Wyvern,
// 3-on Great Wolf, 0-no mount
buffer.writeByte(0x00);
buffer.writeByte(0x00); // 1 - sellshop
// writeH(_activeChar.getCubics().size());
// for (int id : _activeChar.getCubics().keySet())
// writeH(id);
buffer.writeShort(0x00); // cubics size
buffer.writeByte(0x00); // in party match room
buffer.writeInt(0x00); // abnormal
buffer.writeByte(0x00); // flying mounted
// recom have
buffer.writeShort(0x00); // Blue value for name (0 =
// white, 255 = pure blue)
buffer.writeInt(1000000); // mount npc
buffer.writeInt(character.getCharacterClass().id);
buffer.writeInt(0x00); // ?
buffer.writeByte(0x00); // enchant effect
buffer.writeByte(0x00); // team circle around feet 1= Blue, 2 = red
buffer.writeInt(0x00); // clan crest large id
buffer.writeByte(0x00); // is noble - Symbol on char menu
// ctrl+I
buffer.writeByte(0x00); // Hero Aura
// (Cant be undone by setting back to 0)
buffer.writeByte(0x00); // 0x01: Fishing Mode
buffer.writeInt(0x00); // fish x
buffer.writeInt(0x00);// fish y
buffer.writeInt(0x00); // fish z
buffer.writeInt(character.getAppearance().getNameColor().toInteger());
buffer.writeInt((int) character.getPoint().getAngle());
buffer.writeInt(0x00); // pledge class
buffer.writeInt(0x00); // pledge type
buffer.writeInt(character.getAppearance().getTitleColor().toInteger());
buffer.writeInt(0x00); // cursed weapon id
buffer.writeInt(0x00); // clan reputation
// T1
buffer.writeInt(0x00); // transformation id
buffer.writeInt(0x00); // agathion id
// T2
buffer.writeInt(0x01); // unk
// T2.3
buffer.writeInt(0x00); // special effect
}
/**
* Writes the paperdoll item id
*
* @param buffer
* the buffer
* @param character
* the character
* @param paperdoll
* the slot
*/
private void writePaperdollItemID(ChannelBuffer buffer,
L2Character character, InventoryPaperdoll paperdoll) {
final Item item = character.getInventory().getItem(paperdoll);
int id = 0;
if (item != null)
id = item.getTemplateID().getID();
buffer.writeInt(id);
}
/**
* Writes the paperdoll augument id
*
* @param buffer
* the buffer
* @param character
* the character
* @param paperdoll
* the slot
*/
private void writePaperdollAugumentID(ChannelBuffer buffer,
L2Character character, InventoryPaperdoll paperdoll) {
buffer.writeInt(0x00);
}
}

View File

@@ -1,55 +0,0 @@
/*
* 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.game.net.packet.server;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractServerPacket;
import com.l2jserver.model.world.L2Character;
/**
* This is an message informing the client of extra informations from a player
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class SM_CHAR_INFO_EXTRA extends AbstractServerPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0xfe;
/**
* The character
*/
private L2Character character;
/**
* @param character the character
*/
public SM_CHAR_INFO_EXTRA(L2Character character) {
super(OPCODE);
this.character = character;
}
@Override
public void write(Lineage2Client conn, ChannelBuffer buffer) {
buffer.writeShort(0xcf); // opcode2
buffer.writeInt(character.getID().getID()); // object ID of Player
buffer.writeInt(0x00); // event effect id
}
}

View File

@@ -1,99 +0,0 @@
/*
* 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.game.net.packet.server;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractServerPacket;
import com.l2jserver.model.world.Item;
import com.l2jserver.model.world.character.CharacterInventory;
import com.l2jserver.model.world.character.CharacterInventory.ItemLocation;
/**
* This packet send the inventory to the client
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class SM_CHAR_INVENTORY extends AbstractServerPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x11;
/**
* The character inventory
*/
private CharacterInventory inventory;
/**
* Whether or not to open the inventory window
*/
private boolean showWindow = false;
/**
* @param inventory the inventory
*/
public SM_CHAR_INVENTORY(CharacterInventory inventory) {
super(OPCODE);
this.inventory = inventory;
}
@Override
public void write(Lineage2Client conn, ChannelBuffer buffer) {
buffer.writeShort((showWindow ? 0x01 : 0x00));
// TODO warehouse items will have an issue here!
buffer.writeShort(inventory.getItemCount()); // item count
// TODO implement real item slot
int slot = 0;
for (Item item : inventory) {
buffer.writeInt(item.getID().getID()); // obj id
buffer.writeInt(item.getTemplateID().getID()); // item id
buffer.writeInt(slot); // loc slot
buffer.writeLong(item.getCount()); // count
buffer.writeShort(0x00); // item type2
buffer.writeShort(0x00); // item type3
buffer.writeShort((item.getLocation() == ItemLocation.PAPERDOLL ? 0x01
: 0x00)); // equiped?
buffer.writeInt((item.getPaperdoll() != null ? item.getPaperdoll().id
: 0)); // body part
buffer.writeShort(127); // enchant level
// race tickets
buffer.writeShort(0x00); // item type4 (custom type 2)
buffer.writeInt(0x00); // augument
buffer.writeInt(0x00); // mana
buffer.writeInt(-9999); // time
buffer.writeShort(0x00); // attack element type
buffer.writeShort(0x00); // attack element power
for (byte i = 0; i < 6; i++) {
buffer.writeShort(0x00); // element def attrib
}
// Enchant Effects
buffer.writeShort(0x00);
buffer.writeShort(0x00);
buffer.writeShort(0x00);
slot++;
}
// TODO inventory block
// buffer.writeShort(_inventory.getBlockItems().length);
// writeC(_inventory.getBlockMode());
// for (int i : _inventory.getBlockItems())
// buffer.writeInt(i);
buffer.writeShort(0x00);
}
}

View File

@@ -1,226 +0,0 @@
/*
* 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.game.net.packet.server;
import java.util.Map;
import java.util.Map.Entry;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractServerPacket;
import com.l2jserver.model.world.Item;
import com.l2jserver.model.world.character.CharacterInventory.ItemLocation;
import com.l2jserver.util.factory.CollectionFactory;
/**
* This packet send the inventory to the client
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class SM_CHAR_INVENTORY_UPDATE extends AbstractServerPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x21;
/**
* List of items to be updated in the client
*/
private final Map<Item, InventoryUpdateType> items = CollectionFactory
.newMap();
/**
* The type of operation to be performed.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public enum InventoryUpdateType {
/**
* Flags the item to be added to the inventory list
*/
ADD(1),
/**
* Flags the item to be updated in the inventory list
*/
UPDATE(2),
/**
* Flags the item to be removed in the inventory list
*/
REMOVE(3);
/**
* The operation ID
*/
public final int id;
/**
* @param id
* the operation ID
*/
private InventoryUpdateType(int id) {
this.id = id;
}
}
/**
* Creates an empty instance. Items can be added, removed or update using
* {@link #add(Item)}, {@link #remove(Item)} and {@link #update(Item)}.
*/
public SM_CHAR_INVENTORY_UPDATE() {
super(OPCODE);
}
/**
* Creates a new instance with several items performing
* {@link InventoryUpdateType} <code>type</code> operation.
*
* @param type
* the operation type
* @param items
* the items
*/
public SM_CHAR_INVENTORY_UPDATE(InventoryUpdateType type, Item... items) {
super(OPCODE);
switch (type) {
case ADD:
add(items);
break;
case REMOVE:
remove(items);
break;
case UPDATE:
update(items);
break;
}
}
@Override
public void write(Lineage2Client conn, ChannelBuffer buffer) {
buffer.writeShort(items.size()); // item count
for (Entry<Item, InventoryUpdateType> e : items.entrySet()) {
final Item item = e.getKey();
final InventoryUpdateType type = e.getValue();
buffer.writeShort(type.id); // change type
buffer.writeInt(item.getID().getID()); // obj id
buffer.writeInt(item.getTemplateID().getID()); // item id
buffer.writeInt(0x00); // loc slot
buffer.writeLong(item.getCount()); // count
buffer.writeShort(0x00); // item type2
buffer.writeShort(0x00); // item type3
buffer.writeShort((item.getLocation() == ItemLocation.PAPERDOLL ? 0x01
: 0x00)); // equiped?
buffer.writeInt((item.getPaperdoll() != null ? item.getPaperdoll().id
: 0)); // body part
buffer.writeShort(127); // enchant level
// race tickets
buffer.writeShort(0x00); // item type4 (custom type 2)
buffer.writeInt(0x00); // augument
buffer.writeInt(0x00); // mana
buffer.writeInt(-9999); // time
buffer.writeShort(0x00); // attack element type
buffer.writeShort(0x00); // attack element power
for (byte i = 0; i < 6; i++) {
buffer.writeShort(0x00); // element def attrib
}
// Enchant Effects
buffer.writeShort(0x00);
buffer.writeShort(0x00);
buffer.writeShort(0x00);
}
}
/**
* Removes a single item
*
* @param item
* the item to be removed
* @return this instance
*/
public SM_CHAR_INVENTORY_UPDATE remove(Item item) {
items.put(item, InventoryUpdateType.REMOVE);
return this;
}
/**
* Removes several items
*
* @param items
* the items to be removed
* @return this instance
*/
public SM_CHAR_INVENTORY_UPDATE remove(Item... items) {
for (final Item item : items) {
remove(item);
}
return this;
}
/**
* Adds a single item
*
* @param item
* the item to be added
* @return this instance
*/
public SM_CHAR_INVENTORY_UPDATE add(Item item) {
items.put(item, InventoryUpdateType.ADD);
return this;
}
/**
* Adds several items
*
* @param items
* the item to be added
* @return this instance
*/
public SM_CHAR_INVENTORY_UPDATE add(Item... items) {
for (final Item item : items) {
add(item);
}
return this;
}
/**
* Updates a single item
*
* @param item
* the item to be updated
* @return this instance
*/
public SM_CHAR_INVENTORY_UPDATE update(Item item) {
items.put(item, InventoryUpdateType.UPDATE);
return this;
}
/**
* Updates several items
*
* @param items
* the item to be updated
* @return this instance
*/
public SM_CHAR_INVENTORY_UPDATE update(Item... items) {
for (final Item item : items) {
update(item);
}
return this;
}
}

View File

@@ -1,265 +0,0 @@
/*
* 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.game.net.packet.server;
import static com.l2jserver.game.net.ProtocolVersion.FREYA;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.BELT;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.CHEST;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.CLOAK;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.DECORATION_1;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.DECORATION_2;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.DECORATION_3;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.DECORATION_4;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.DECORATION_5;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.DECORATION_6;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.FEET;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.GLOVES;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.HAIR1;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.HAIR2;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.HEAD;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.LEFT_BRACELET;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.LEFT_EAR;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.LEFT_FINGER;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.LEFT_HAND;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.LEGS;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.NECK;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.RIGHT_BRACELET;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.RIGHT_EAR;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.RIGHT_FINGER;
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.RIGHT_HAND;
import java.util.Collection;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.Lineage2Session;
import com.l2jserver.game.net.packet.AbstractServerPacket;
import com.l2jserver.model.world.Item;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll;
import com.l2jserver.util.BufferUtils;
/**
* The list of characters sent to the client.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class SM_CHAR_LIST extends AbstractServerPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x09;
/**
* The account username
*/
private final String loginName;
/**
* The session ID
*/
private final int sessionId;
// private int lastCharacterId;
/**
* The list of character to be displayed
*/
private final L2Character[] characters;
/**
* @param loginName
* the account id
* @param sessionId
* the session id
* @param lastCharacterId
* the last character used
* @param characters
* the characters
*/
public SM_CHAR_LIST(String loginName, int sessionId, int lastCharacterId,
L2Character... characters) {
super(OPCODE);
this.loginName = loginName;
this.sessionId = sessionId;
// this.lastCharacterId = lastCharacterId;
this.characters = characters;
}
/**
* @param session
* the session
* @param characters
* the characters
* @return an {@link SM_CHAR_LIST} instance
*/
public static SM_CHAR_LIST fromL2Session(Lineage2Session session,
L2Character... characters) {
return new SM_CHAR_LIST(session.getAccountID().getID(),
session.getPlayKey2(), -1, characters);
}
/**
* @param session
* the session
* @param characters
* the characters
* @return an {@link SM_CHAR_LIST} instance
*/
public static SM_CHAR_LIST fromL2Session(Lineage2Session session,
Collection<L2Character> characters) {
return fromL2Session(session,
characters.toArray(new L2Character[characters.size()]));
}
@Override
public void write(Lineage2Client conn, ChannelBuffer buffer) {
// buffer.writeByte(0x09);
buffer.writeInt(characters.length);
// Can prevent players from creating new characters (if 0);
// if 1 the client will ask if chars may be created
// (RequestCharacterTemplatesPacket) Response: (CharacterTemplatePacket)
buffer.writeInt(7); // max chars
buffer.writeByte(0x00);
// int i = 0;
for (final L2Character character : characters) {
BufferUtils.writeString(buffer, character.getName());
buffer.writeInt(character.getID().getID());
BufferUtils.writeString(buffer, loginName);
buffer.writeInt(sessionId);
buffer.writeInt((character.getClanID() != null ? character
.getClanID().getID() : 0x00)); // clan id
buffer.writeInt(0x00); // ??
buffer.writeInt(character.getSex().option); // sex
buffer.writeInt(character.getRace().id); // race
// if (character.getClassId() == character.getBaseClassId())
buffer.writeInt(character.getCharacterClass().id); // base class id
// or class id
// else
// buffer.writeInt(character.getBaseClassId());
buffer.writeInt(1); // active ??
buffer.writeInt(character.getPoint().getX()); // x
buffer.writeInt(character.getPoint().getY()); // y
buffer.writeInt(character.getPoint().getZ()); // z
buffer.writeDouble(character.getHP()); // hp cur
buffer.writeDouble(character.getMP()); // mp cur
buffer.writeInt(character.getSP()); // sp
buffer.writeLong(character.getExperience()); // exp
buffer.writeInt(character.getLevel()); // level
buffer.writeInt(character.getKarma()); // karma
buffer.writeInt(character.getPkKills()); // pk
buffer.writeInt(character.getPvpKills()); // pvp
for (int n = 0; n < 7; n++) {
buffer.writeInt(0x00); // unk
}
// buffer.writeInt(0x00); // unk 1
// buffer.writeInt(0x00); // unk 2
// buffer.writeInt(0x00); // unk 3
// buffer.writeInt(0x00); // unk 4
// buffer.writeInt(0x00); // unk 5
// buffer.writeInt(0x00); // unk 6
// buffer.writeInt(0x00); // unk 7
writePaperdollItemID(buffer, character, HAIR1);
writePaperdollItemID(buffer, character, RIGHT_EAR);
writePaperdollItemID(buffer, character, LEFT_EAR);
writePaperdollItemID(buffer, character, NECK);
writePaperdollItemID(buffer, character, RIGHT_FINGER);
writePaperdollItemID(buffer, character, LEFT_FINGER);
writePaperdollItemID(buffer, character, HEAD);
writePaperdollItemID(buffer, character, RIGHT_HAND);
writePaperdollItemID(buffer, character, LEFT_HAND);
writePaperdollItemID(buffer, character, GLOVES);
writePaperdollItemID(buffer, character, CHEST);
writePaperdollItemID(buffer, character, LEGS);
writePaperdollItemID(buffer, character, FEET);
writePaperdollItemID(buffer, character, CLOAK);
writePaperdollItemID(buffer, character, RIGHT_HAND);
writePaperdollItemID(buffer, character, HAIR1);
writePaperdollItemID(buffer, character, HAIR2);
writePaperdollItemID(buffer, character, RIGHT_BRACELET);
writePaperdollItemID(buffer, character, LEFT_BRACELET);
writePaperdollItemID(buffer, character, DECORATION_1);
writePaperdollItemID(buffer, character, DECORATION_2);
writePaperdollItemID(buffer, character, DECORATION_3);
writePaperdollItemID(buffer, character, DECORATION_4);
writePaperdollItemID(buffer, character, DECORATION_5);
writePaperdollItemID(buffer, character, DECORATION_6);
writePaperdollItemID(buffer, character, BELT);
// hair style
buffer.writeInt(character.getAppearance().getHairStyle().option);
// hair color
buffer.writeInt(character.getAppearance().getHairColor().option);
// face
buffer.writeInt(character.getAppearance().getFace().option);
buffer.writeDouble(character.getStats().getMaxHP()); // hp max
buffer.writeDouble(character.getStats().getMaxMP()); // mp max
buffer.writeInt(0x0); // seconds left before delete
buffer.writeInt(character.getCharacterClass().id); // class
buffer.writeInt(1); // c3 auto-select char
buffer.writeByte(0x00); // enchant effect
buffer.writeInt(0x00); // augmentation id
// Currently on retail when you are on character select you don't
// see your transformation.
buffer.writeInt(0x00);
// Freya by Vistall:
if (conn.supports(FREYA)) {
// npdid - 16024 Tame Tiny Baby Kookaburra
buffer.writeInt(16024); // A9E89C
buffer.writeInt(0); // level
buffer.writeInt(0); // ?
buffer.writeInt(0); // food? - 1200
buffer.writeDouble(0); // max Hp
buffer.writeDouble(0); // cur Hp
}
}
}
/**
* Writes the paperdoll item id
*
* @param buffer
* the buffer
* @param character
* the character
* @param paperdoll
* the slot
*/
private void writePaperdollItemID(ChannelBuffer buffer,
L2Character character, InventoryPaperdoll paperdoll) {
final Item item = character.getInventory().getItem(paperdoll);
int id = 0;
if (item != null)
id = item.getTemplateID().getID();
buffer.writeInt(id);
}
}

View File

@@ -1,55 +0,0 @@
/*
* 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.game.net.packet.server;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractServerPacket;
import com.l2jserver.model.world.L2Character;
/**
* This packet updates the movement type
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class SM_CHAR_MOVE_TYPE extends AbstractServerPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x28;
/**
* The character
*/
private final L2Character character;
/**
* @param character the character
*/
public SM_CHAR_MOVE_TYPE(L2Character character) {
super(OPCODE);
this.character = character;
}
@Override
public void write(Lineage2Client conn, ChannelBuffer buffer) {
buffer.writeInt(character.getID().getID());
buffer.writeInt(character.getMoveType().id);
buffer.writeInt(0x00); // unk
}
}

View File

@@ -1,53 +0,0 @@
/*
* 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.game.net.packet.server;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractServerPacket;
/**
* An packet authorizing the client to open the map
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class SM_CHAR_OPEN_MAP extends AbstractServerPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0xa3;
/**
* The map ID
*/
private final int mapID;
/**
* @param mapID the map id
*/
public SM_CHAR_OPEN_MAP(int mapID) {
super(OPCODE);
this.mapID = mapID;
}
@Override
public void write(Lineage2Client conn, ChannelBuffer buffer) {
buffer.writeInt(mapID);
buffer.writeByte(0x00); // seven signs period
}
}

View File

@@ -1,67 +0,0 @@
/*
* 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.game.net.packet.server;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractServerPacket;
/**
* This packet responds to the Restart request
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class SM_CHAR_RESTART extends AbstractServerPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x71;
/**
* The restart state
*/
private boolean state;
/**
* @param state
* the state
*/
public SM_CHAR_RESTART(boolean state) {
super(OPCODE);
this.state = state;
}
/**
* @return an OK instance of this packet
*/
public static SM_CHAR_RESTART ok() {
return new SM_CHAR_RESTART(true);
}
/**
* @return an FAILED instance of this packet
*/
public static SM_CHAR_RESTART denied() {
return new SM_CHAR_RESTART(false);
}
@Override
public void write(Lineage2Client conn, ChannelBuffer buffer) {
buffer.writeByte((state ? 0x01 : 0x00));
}
}

View File

@@ -1,96 +0,0 @@
/*
* 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.game.net.packet.server;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractServerPacket;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.model.world.actor.ActorExperience;
import com.l2jserver.util.BufferUtils;
/**
* This packet notifies the client that the chosen character has been
* successfully selected.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class SM_CHAR_SELECTED extends AbstractServerPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x0b;
/**
* The selected character
*/
private final L2Character character;
/**
* @param character the character
*/
public SM_CHAR_SELECTED(L2Character character) {
super(OPCODE);
this.character = character;
}
@Override
public void write(Lineage2Client conn, ChannelBuffer buffer) {
BufferUtils.writeString(buffer, character.getName());
buffer.writeInt(character.getID().getID());
BufferUtils.writeString(buffer, "It works!"); // title
buffer.writeInt(conn.getSession().getPlayKey1());
buffer.writeInt((character.getClanID() != null ? character.getClanID()
.getID() : 0));
buffer.writeInt(0x00); // ??
buffer.writeInt(character.getSex().option);
buffer.writeInt(character.getRace().id);
buffer.writeInt(character.getCharacterClass().id);
buffer.writeInt(0x01); // active ??
buffer.writeInt(character.getPoint().getX());
buffer.writeInt(character.getPoint().getY());
buffer.writeInt(character.getPoint().getZ());
buffer.writeDouble(20); // cur hp
buffer.writeDouble(20); // cur mp
buffer.writeInt(0); // sp
buffer.writeLong(ActorExperience.LEVEL_1.experience);
buffer.writeInt(ActorExperience.LEVEL_1.level);
buffer.writeInt(0); // karma
buffer.writeInt(0); // pk
buffer.writeInt(character.getStats().getIntelligence());
buffer.writeInt(character.getStats().getStrength());
buffer.writeInt(character.getStats().getConcentration());
buffer.writeInt(character.getStats().getMentality());
buffer.writeInt(character.getStats().getDexterity());
buffer.writeInt(character.getStats().getWitness());
buffer.writeInt(0); // game time
buffer.writeInt(0x00); // unk
buffer.writeInt(character.getCharacterClass().id);
buffer.writeInt(0x00);// unk
buffer.writeInt(0x00);// unk
buffer.writeInt(0x00);// unk
buffer.writeInt(0x00);// unk
buffer.writeBytes(new byte[64]); // unk
buffer.writeInt(0x00);// unk
}
}

View File

@@ -1,70 +0,0 @@
/*
* 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.game.net.packet.server;
import org.jboss.netty.buffer.ChannelBuffer;
import com.l2jserver.game.net.Lineage2Client;
import com.l2jserver.game.net.packet.AbstractServerPacket;
import com.l2jserver.model.game.CharacterShortcut;
import com.l2jserver.model.world.character.CharacterShortcutContainer;
/**
* This packet sends to the client his shortcut list
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class SM_CHAR_SHORTCUT_LIST extends AbstractServerPacket {
/**
* The packet OPCODE
*/
public static final int OPCODE = 0x45;
/**
* The shortcut list
*/
private final CharacterShortcutContainer shortcuts;
/**
* @param shortcuts
* the shortcuts container
*/
public SM_CHAR_SHORTCUT_LIST(CharacterShortcutContainer shortcuts) {
super(OPCODE);
this.shortcuts = shortcuts;
}
@Override
public void write(Lineage2Client conn, ChannelBuffer buffer) {
buffer.writeInt(shortcuts.getShortcutCount());
for (final CharacterShortcut shortcut : shortcuts) {
buffer.writeInt(shortcut.getType().id);
buffer.writeInt(shortcut.getPage() * 12 + shortcut.getSlot());
switch (shortcut.getType()) {
case ITEM:
buffer.writeInt(shortcut.getItemID().getID());
buffer.writeInt(0x01); // unk1f
buffer.writeInt(-1); // reuse group
buffer.writeInt(0x00); // unk2
buffer.writeInt(0x00); // unk3
buffer.writeShort(0x00); // unk4
buffer.writeShort(0x00); // unk5
break;
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More