1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2025-12-05 23:22:47 +00:00

Fixes an issue when loading the server using a zipped data folder

This commit is contained in:
2012-01-21 00:24:46 -02:00
parent beea690568
commit e1ff987278
21 changed files with 110 additions and 159 deletions

View File

@@ -5,21 +5,21 @@
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: 2011.12.31 at 03:24:00 AM BRST
Generated on: 2012.01.19 at 03:37:11 PM BRST
-->
<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::tns" xmlns:tns="http://schemas.l2jserver2.com/skill">
<jaxb:schemaBindings map="false"/>
<jaxb:bindings scd="tns:skill">
<jaxb:class ref="com.l2jserver.model.template.SkillTemplate"/>
</jaxb:bindings>
</jaxb:bindings>
<jaxb:bindings scd="x-schema::tns" xmlns:tns="http://schemas.l2jserver2.com/character">
<jaxb:schemaBindings map="false"/>
<jaxb:bindings scd="tns:character">
<jaxb:class ref="com.l2jserver.model.template.CharacterTemplate"/>
</jaxb:bindings>
</jaxb:bindings>
<jaxb:bindings scd="x-schema::">
<jaxb:schemaBindings map="false"/>
<jaxb:bindings scd="~CalculatorFunction">
@@ -38,6 +38,24 @@ Generated on: 2011.12.31 at 03:24:00 AM 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/teleport">
<jaxb:schemaBindings map="false"/>
<jaxb:bindings scd="tns:teleports">
<jaxb:class ref="com.l2jserver.model.template.Teleports"/>
</jaxb:bindings>
</jaxb:bindings>
<jaxb:bindings scd="x-schema::tns" xmlns:tns="http://schemas.l2jserver2.com/item">
<jaxb:schemaBindings map="false"/>
<jaxb:bindings scd="tns:item">
<jaxb:class ref="com.l2jserver.model.template.ItemTemplate"/>
</jaxb:bindings>
</jaxb:bindings>
<jaxb:bindings scd="x-schema::tns" xmlns:tns="http://schemas.l2jserver2.com/npc">
<jaxb:schemaBindings map="false"/>
<jaxb:bindings scd="tns:npc">
<jaxb:class ref="com.l2jserver.model.template.NPCTemplate"/>
</jaxb:bindings>
</jaxb:bindings>
<jaxb:bindings scd="x-schema::tns" xmlns:tns="zones">
<jaxb:schemaBindings map="false"/>
<jaxb:bindings scd="tns:zones">
@@ -47,23 +65,5 @@ Generated on: 2011.12.31 at 03:24:00 AM 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/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/teleport">
<jaxb:schemaBindings map="false"/>
<jaxb:bindings scd="tns:teleports">
<jaxb:class ref="com.l2jserver.model.template.Teleports"/>
</jaxb:bindings>
</jaxb:bindings>
<jaxb:bindings scd="x-schema::tns" xmlns:tns="http://schemas.l2jserver2.com/npc">
<jaxb:schemaBindings map="false"/>
<jaxb:bindings scd="tns:npc">
<jaxb:class ref="com.l2jserver.model.template.NPCTemplate"/>
</jaxb:bindings>
</jaxb:bindings>
</jaxb:bindings>

View File

@@ -2,7 +2,7 @@
// 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: 2011.12.31 at 03:24:00 AM BRST
// Generated on: 2012.01.19 at 03:37:11 PM BRST
//

View File

@@ -2,7 +2,7 @@
// 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: 2011.12.31 at 03:24:00 AM BRST
// Generated on: 2012.01.19 at 03:37:11 PM BRST
//

View File

@@ -2,7 +2,7 @@
// 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: 2011.12.31 at 03:24:00 AM BRST
// Generated on: 2012.01.19 at 03:37:11 PM BRST
//

View File

@@ -2,7 +2,7 @@
// 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: 2011.12.31 at 03:24:00 AM BRST
// Generated on: 2012.01.19 at 03:37:11 PM BRST
//

View File

@@ -2,7 +2,7 @@
// 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: 2011.12.31 at 03:24:00 AM BRST
// Generated on: 2012.01.19 at 03:37:11 PM BRST
//

View File

@@ -2,7 +2,7 @@
// 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: 2011.12.31 at 03:24:00 AM BRST
// Generated on: 2012.01.19 at 03:37:11 PM BRST
//

View File

@@ -2,7 +2,7 @@
// 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: 2011.12.31 at 03:24:00 AM BRST
// Generated on: 2012.01.19 at 03:37:11 PM BRST
//

View File

@@ -2,7 +2,7 @@
// 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: 2011.12.31 at 03:24:00 AM BRST
// Generated on: 2012.01.19 at 03:37:11 PM BRST
//

View File

@@ -2,7 +2,7 @@
// 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: 2011.12.31 at 03:24:00 AM BRST
// Generated on: 2012.01.19 at 03:37:11 PM BRST
//

View File

@@ -2,7 +2,7 @@
// 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: 2011.12.31 at 03:24:00 AM BRST
// Generated on: 2012.01.19 at 03:37:11 PM BRST
//

View File

@@ -2,7 +2,7 @@
// 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: 2011.12.31 at 03:24:00 AM BRST
// Generated on: 2012.01.19 at 03:37:11 PM BRST
//

View File

@@ -2,7 +2,7 @@
// 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: 2011.12.31 at 03:24:00 AM BRST
// Generated on: 2012.01.19 at 03:37:11 PM BRST
//

View File

@@ -2,7 +2,7 @@
// 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: 2011.12.31 at 03:24:00 AM BRST
// Generated on: 2012.01.19 at 03:37:11 PM BRST
//

View File

@@ -54,7 +54,7 @@ public class SM_NPC_INFO extends AbstractServerPacket {
buffer.writeInt(npc.getID().getID());
buffer.writeInt(template.getID().getID() + 1000000); // npctype
// id
// id
// buffer.writeInt((template.isAttackable() ? 0x01 : 0x00)); //
// attackable
// FIXME unhard code it
@@ -78,20 +78,32 @@ public class SM_NPC_INFO extends AbstractServerPacket {
buffer.writeDouble(0x01);// TODO
buffer.writeDouble(template.getInfo().getCollision().getRadius());
buffer.writeDouble(template.getInfo().getCollision().getHeigth());
buffer.writeInt((template.getInfo().getItem().getRightHand() != null ? template
.getInfo().getItem().getRightHand().getID()
: 0x00));
if (template.getInfo().getItem() != null) {
buffer.writeInt((template.getInfo().getItem().getRightHand() != null ? template
.getInfo().getItem().getRightHand().getID()
: 0x00));
} else {
buffer.writeInt(0x00);
}
buffer.writeInt(0x00); // chest
buffer.writeInt((template.getInfo().getItem().getLeftHand() != null ? template
.getInfo().getItem().getLeftHand().getID()
: 0x00));
if (template.getInfo().getItem() != null) {
buffer.writeInt((template.getInfo().getItem().getLeftHand() != null ? template
.getInfo().getItem().getLeftHand().getID()
: 0x00));
} else {
buffer.writeInt(0x00);
}
buffer.writeByte(1); // name above char 1=true ... ??
buffer.writeByte(0x00); // is running
buffer.writeByte((npc.isAttacking() ? 0x01 : 0x00)); // is in combat
buffer.writeByte((npc.isDead() ? 0x01 : 0x00)); // is like dead (faking)
buffer.writeByte(0x00); // 0=teleported 1=default 2=summoned
BufferUtils.writeString(buffer, template.getInfo().getName().getValue());
BufferUtils.writeString(buffer, template.getInfo().getTitle().getValue());
BufferUtils.writeString(buffer,
(template.getInfo().getName() != null ? template.getInfo()
.getName().getValue() : null));
BufferUtils.writeString(buffer,
(template.getInfo().getTitle() != null ? template.getInfo()
.getTitle().getValue() : null));
buffer.writeInt(0x00); // Title color 0=client default
buffer.writeInt(0x00); // pvp flag
buffer.writeInt(0x00); // karma
@@ -110,11 +122,13 @@ public class SM_NPC_INFO extends AbstractServerPacket {
buffer.writeInt(0x00); // C6 -- is flying
buffer.writeInt(0x00); // unk
buffer.writeInt(0x00);// CT1.5 Pet form and skills, Color effect
buffer.writeByte((template.getInfo().getName().isDisplay() ? 0x01 : 0x00)); // hide
// name
buffer.writeByte((template.getInfo().getName().isDisplay() ? 0x01 : 0x00)); // hide
// name,
// again
buffer.writeByte((template.getInfo().getName() != null
&& template.getInfo().getName().isDisplay() ? 0x01 : 0x00)); // hide
// name
buffer.writeByte((template.getInfo().getName() != null
&& template.getInfo().getName().isDisplay() ? 0x01 : 0x00)); // hide
// name,
// again
buffer.writeInt(0x00); // special effects
buffer.writeInt(0x00); // display effect

View File

@@ -16,12 +16,14 @@
*/
package com.l2jserver.service.game.template;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.StandardOpenOption;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.List;
@@ -181,6 +183,22 @@ public class XMLTemplateService extends
log.info("Scanning {} for XML templates", templatePath);
final List<Source> schemas = CollectionFactory.newList();
schemas.add(new StreamSource(new ByteArrayInputStream(Files
.readAllBytes(templatePath.resolve("l2jserver2.xsd")))));
schemas.add(new StreamSource(new ByteArrayInputStream(Files
.readAllBytes(templatePath.resolve("item.xsd")))));
schemas.add(new StreamSource(new ByteArrayInputStream(Files
.readAllBytes(templatePath.resolve("skill.xsd")))));
schemas.add(new StreamSource(new ByteArrayInputStream(Files
.readAllBytes(templatePath.resolve("character.xsd")))));
schemas.add(new StreamSource(new ByteArrayInputStream(Files
.readAllBytes(templatePath.resolve("npc.xsd")))));
schemas.add(new StreamSource(new ByteArrayInputStream(Files
.readAllBytes(templatePath.resolve("teleport.xsd")))));
schemas.add(new StreamSource(new ByteArrayInputStream(Files
.readAllBytes(templatePath.resolve("zones.xsd")))));
final List<Path> templateList = CollectionFactory.newList();
final boolean includeSchemas = config.isSchemaValidationEnabled();
Files.walkFileTree(templatePath, new SimpleFileVisitor<Path>() {
@@ -188,9 +206,7 @@ public class XMLTemplateService extends
public FileVisitResult visitFile(Path file,
BasicFileAttributes attrs) throws IOException {
final String name = file.getFileName().toString();
if (name.endsWith(".xsd") && includeSchemas) {
schemas.add(new StreamSource(file.toFile()));
} else if (name.endsWith(".xml")) {
if (name.endsWith(".xml")) {
if (name.endsWith("zones.xml"))
return FileVisitResult.CONTINUE;
templateList.add(file);
@@ -245,7 +261,8 @@ public class XMLTemplateService extends
public void loadTemplate(Path path) throws JAXBException, IOException {
Preconditions.checkNotNull(path, "path");
log.debug("Loading template {}", path);
final InputStream in = Files.newInputStream(path);
final InputStream in = Files.newInputStream(path,
StandardOpenOption.READ);
try {
Object obj = unmarshaller.unmarshal(in);
if (obj instanceof Template) {