Library for reading/modifying Lineage 2 unrealscript objects.
UnrealSerializerFactory
uses Thread.stackSize
, which is not available on certain JVMs.
In that case you should disable it with -DL2unreal.loadThreadStackSize=0
and set stack size via -Xss
or -XX:ThreadStackSize
parameter (at least 8MB).
import acmi.l2.clientmod.io.UnrealPackage;
import acmi.l2.clientmod.unreal.Environment;
import acmi.l2.clientmod.unreal.UnrealSerializerFactory;
import acmi.l2.clientmod.unreal.core.TextBuffer;
String l2SystemFolder = "C:\\Lineage 2\\system";
Environment environment = Environment.fromIni(new File(l2SystemFolder, "l2.ini"));
UnrealSerializerFactory serializerFactory = new UnrealSerializerFactory(environment);
String fileName = "Engine.u";
String entryName = "Actor.ScriptText";
try (UnrealPackage up = new UnrealPackage(new File(l2SystemFolder, fileName), true)) {
TextBuffer textBuffer = up.getExportTable()
.parallelStream()
.filter(e -> e.getObjectInnerFullName().equals(entryName))
.findAny()
.map(serializerFactory::getOrCreateObject)
.map(o -> (TextBuffer) o)
.orElseThrow(() -> new IllegalArgumentException(entryName + " not found"));
System.out.println(textBuffer.text);
}
gradlew build
Append -x test
to skip tests.
gradlew install
<repository>
<id>L2unreal-github</id>
<url>https://raw.githubusercontent.com/acmi/L2unreal/mvn-repo</url>
</repository>
<dependency>
<groupId>acmi.l2.clientmod</groupId>
<artifactId>l2unreal</artifactId>
<version>1.3.1</version>
</dependency>
repositories {
maven { url "https://raw.githubusercontent.com/acmi/L2unreal/mvn-repo" }
}
dependencies {
compile group:'acmi.l2.clientmod', name:'l2unreal', version: '1.3.1'
}