mirror of
https://github.com/ProjectSWGCore/Holocore.git
synced 2026-10-13 03:13:09 -04:00
Merge branch 'ProjectSWGCore:cu_quality_assurance' into cu_quality_assurance
This commit is contained in:
+18
-5
@@ -9,6 +9,7 @@ plugins {
|
||||
val javaVersion = "18.0.2"
|
||||
val javaMajorVersion = "18"
|
||||
val kotlinTargetJdk = "18"
|
||||
val holocoreLogLevel: String? by project
|
||||
|
||||
subprojects {
|
||||
ext {
|
||||
@@ -18,10 +19,6 @@ subprojects {
|
||||
}
|
||||
}
|
||||
|
||||
application {
|
||||
mainClass.set("com.projectswg.holocore.ProjectSWG")
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven("https://dev.joshlarson.me/maven2")
|
||||
mavenCentral()
|
||||
@@ -89,10 +86,26 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class).configure
|
||||
destinationDirectory.set(File(destinationDirectory.get().asFile.path.replace("kotlin", "java")))
|
||||
}
|
||||
|
||||
tasks.create<JavaExec>("runDebug") {
|
||||
tasks.getByName("run") {
|
||||
this as JavaExec
|
||||
dependsOn(tasks.getByName("test"))
|
||||
|
||||
enableAssertions = true
|
||||
classpath = sourceSets.main.get().runtimeClasspath
|
||||
mainClass.set("com.projectswg.holocore.ProjectSWG")
|
||||
|
||||
if (holocoreLogLevel != null)
|
||||
args = listOf("--log-level", holocoreLogLevel!!)
|
||||
}
|
||||
|
||||
tasks.create<JavaExec>("runProduction") {
|
||||
this as JavaExec
|
||||
|
||||
classpath = sourceSets.main.get().runtimeClasspath
|
||||
mainClass.set("com.projectswg.holocore.ProjectSWG")
|
||||
|
||||
if (holocoreLogLevel != null)
|
||||
args = listOf("--log-level", holocoreLogLevel!!)
|
||||
}
|
||||
|
||||
tasks.create<JavaExec>("runClientdataConversion") {
|
||||
|
||||
+1
-1
Submodule pswgcommon updated: 2757628832...0bff580dac
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -29,6 +29,7 @@ package com.projectswg.holocore;
|
||||
import com.projectswg.common.data.encodables.chat.ChatAvatar;
|
||||
import com.projectswg.common.data.encodables.galaxy.Galaxy;
|
||||
import com.projectswg.common.data.encodables.galaxy.Galaxy.GalaxyStatus;
|
||||
import com.projectswg.common.data.swgiff.parsers.SWGParser;
|
||||
import com.projectswg.holocore.intents.support.data.control.ServerStatusIntent;
|
||||
import com.projectswg.holocore.resources.support.data.client_info.ServerFactory;
|
||||
import com.projectswg.holocore.resources.support.data.control.ServerStatus;
|
||||
@@ -95,15 +96,7 @@ public class ProjectSWG {
|
||||
return 0;
|
||||
}
|
||||
|
||||
File logDirectory = new File("log");
|
||||
if (!logDirectory.isDirectory() && !logDirectory.mkdir())
|
||||
Log.w("Failed to make log directory!");
|
||||
if (arguments.containsKey("print-colors"))
|
||||
Log.addWrapper(new AnsiColorLogWrapper());
|
||||
else
|
||||
Log.addWrapper(new ConsoleLogWrapper());
|
||||
Log.addWrapper(new FileLogWrapper(new File(logDirectory, "log.txt")));
|
||||
|
||||
setupLogging(arguments);
|
||||
if (ProjectSWG.class.getResourceAsStream("/marker.txt") == null) {
|
||||
Log.a("Failed to read Holocore resources - aborting");
|
||||
return -1;
|
||||
@@ -134,6 +127,7 @@ public class ProjectSWG {
|
||||
|
||||
// TODO: Replace all iffs with sdbs
|
||||
private static void initializeServerFactory() {
|
||||
SWGParser.setBasePath("serverdata");
|
||||
try {
|
||||
ServerFactory.getInstance().updateServerIffs();
|
||||
} catch (IOException e) {
|
||||
@@ -200,10 +194,35 @@ public class ProjectSWG {
|
||||
PswgDatabase.INSTANCE.initialize(dbStr, db);
|
||||
}
|
||||
|
||||
private static void setupLogging(Map<String, Object> arguments) {
|
||||
Log.LogLevel logLevel = Log.LogLevel.TRACE;
|
||||
if (arguments.containsKey("log-level")) {
|
||||
try {
|
||||
logLevel = Log.LogLevel.valueOf((String) arguments.get("log-level"));
|
||||
} catch (IllegalArgumentException | ClassCastException e) {
|
||||
System.err.println("Invalid log level: " + arguments.get("log-level"));
|
||||
}
|
||||
}
|
||||
|
||||
if (arguments.containsKey("print-colors"))
|
||||
Log.addWrapper(new AnsiColorLogWrapper(logLevel));
|
||||
else
|
||||
Log.addWrapper(new ConsoleLogWrapper(logLevel));
|
||||
|
||||
if (arguments.containsKey("log-file")) {
|
||||
File logDirectory = new File("log");
|
||||
if (!logDirectory.isDirectory() && !logDirectory.mkdir())
|
||||
Log.w("Failed to make log directory!");
|
||||
Log.addWrapper(new FileLogWrapper(new File(logDirectory, "log.txt")));
|
||||
}
|
||||
}
|
||||
|
||||
private static ArgumentParser createArgumentOptions() {
|
||||
ArgumentParser parser = new ArgumentParser();
|
||||
parser.addArgument(Argument.builder("help").shortName('h').longName("help").isOptional(true).description("print this message").build());
|
||||
parser.addArgument(Argument.builder("print-colors").shortName('C').longName("print-colors").isOptional(true).description("print colors to signify various log levels").build());
|
||||
parser.addArgument(Argument.builder("log-file").shortName('f').longName("log-file").isOptional(true).description("enable logging to file").build());
|
||||
parser.addArgument(Argument.builder("log-level").shortName('l').longName("log-level").argCount('1').isOptional(true).description("specify log level [TRACE, DATA, INFO, WARN, ERROR, ASSERT]").build());
|
||||
parser.addArgument(Argument.builder("database").shortName('c').longName("database").argCount('1').isOptional(true).description("sets the connection string for mongodb (default: mongodb://localhost)").build());
|
||||
parser.addArgument(Argument.builder("database-name").shortName('d').longName("dbName").argCount('1').isOptional(true).description("sets the mongodb database (default: cu)").build());
|
||||
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
/***********************************************************************************
|
||||
* Copyright (c) 2022 /// Project SWG /// www.projectswg.com *
|
||||
* *
|
||||
* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
|
||||
* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
|
||||
* Our goal is to create an emulator which will provide a server for players to *
|
||||
* continue playing a game similar to the one they used to play. We are basing *
|
||||
* it on the final publish of the game prior to end-game events. *
|
||||
* *
|
||||
* This file is part of Holocore. *
|
||||
* *
|
||||
* --------------------------------------------------------------------------------*
|
||||
* *
|
||||
* Holocore is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* Holocore 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 Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with Holocore. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************************/
|
||||
|
||||
package com.projectswg.utility.clientdata
|
||||
|
||||
import com.projectswg.common.data.location.Terrain
|
||||
import com.projectswg.common.data.swgiff.IffForm
|
||||
import com.projectswg.common.data.swgiff.parsers.SWGParser
|
||||
import com.projectswg.common.data.swgiff.parsers.terrain.TerrainTemplate
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.io.RandomAccessFile
|
||||
|
||||
|
||||
internal class ConvertTerrain : Converter {
|
||||
|
||||
override fun convert() {
|
||||
println("Converting terrain...")
|
||||
try {
|
||||
var beforeSize = 0L
|
||||
var afterSize = 0L
|
||||
for (terrain in TERRAIN_LIST) {
|
||||
val inputFile = File("clientdata", terrain.file)
|
||||
val terrainTemplate = SWGParser.parse<TerrainTemplate>(inputFile) ?: continue
|
||||
val output = IffForm.write(terrainTemplate.write())
|
||||
val outputFile = File("serverdata", terrain.file)
|
||||
if (!outputFile.exists())
|
||||
outputFile.createNewFile()
|
||||
RandomAccessFile(outputFile, "rw").channel.use {
|
||||
it.truncate(output.remaining().toLong())
|
||||
while (output.hasRemaining()) {
|
||||
it.write(output)
|
||||
}
|
||||
}
|
||||
SWGParser.parse<TerrainTemplate>(outputFile)
|
||||
println("%-25s [%2.2f%%] ${inputFile.length()} -> ${outputFile.length()}".format("$terrain:", 100 - outputFile.length().toFloat() / inputFile.length() * 100))
|
||||
beforeSize += inputFile.length()
|
||||
afterSize += outputFile.length()
|
||||
|
||||
for (bitmap in terrainTemplate.bitmapGroup.bitmaps.values) {
|
||||
val bitmapFile = bitmap.file ?: continue
|
||||
if (terrainTemplate.isBitmapReferenced(bitmap.familyId))
|
||||
File("clientdata", bitmapFile).copyTo(File("serverdata", bitmapFile))
|
||||
}
|
||||
}
|
||||
println("$beforeSize -> $afterSize")
|
||||
} catch (e: IOException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
private val TERRAIN_LIST = listOf(
|
||||
Terrain.CORELLIA,
|
||||
Terrain.DANTOOINE,
|
||||
Terrain.DATHOMIR,
|
||||
Terrain.ENDOR,
|
||||
Terrain.KASHYYYK_DEAD_FOREST,
|
||||
Terrain.KASHYYYK_HUNTING,
|
||||
Terrain.KASHYYYK_MAIN,
|
||||
Terrain.KASHYYYK_NORTH_DUNGEONS,
|
||||
Terrain.KASHYYYK_POB_DUNGEONS,
|
||||
Terrain.KASHYYYK_RRYATT_TRAIL,
|
||||
Terrain.KASHYYYK_SOUTH_DUNGEONS,
|
||||
Terrain.KASHYYYK,
|
||||
Terrain.LOK,
|
||||
Terrain.MUSTAFAR,
|
||||
Terrain.NABOO,
|
||||
Terrain.RORI,
|
||||
Terrain.TAANAB,
|
||||
Terrain.TALUS,
|
||||
Terrain.TATOOINE,
|
||||
Terrain.UMBRA,
|
||||
Terrain.YAVIN4,
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,7 +18,8 @@ public enum Converters {
|
||||
BUFFS (() -> new ConvertDatatable("datatables/buff/buff.iff", "serverdata/buff/buff.sdb", true)),
|
||||
SKILLS (() -> new ConvertDatatable("datatables/skill/skills.iff", "serverdata/skill/skills.sdb", true)),
|
||||
PROFESSION_TEMPLATES (ConvertProfessionTemplates::new),
|
||||
APPEARANCE_TABLE (() -> new ConvertDatatable("datatables/appearance/appearance_table.iff", "serverdata/appearance/appearance_table.sdb", true));
|
||||
APPEARANCE_TABLE (() -> new ConvertDatatable("datatables/appearance/appearance_table.iff", "serverdata/appearance/appearance_table.sdb", true)),
|
||||
TERRAINS (ConvertTerrain::new);
|
||||
|
||||
private final Supplier<Converter> converter;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user