diff --git a/pswgcommon b/pswgcommon index 1c2b23490..7caab88e7 160000 --- a/pswgcommon +++ b/pswgcommon @@ -1 +1 @@ -Subproject commit 1c2b234908c1c3445b76cbf2712236ab8ef377bc +Subproject commit 7caab88e7ad9359c32f3e2572200e3f41e79acf7 diff --git a/src/main/java/com/projectswg/holocore/resources/support/data/collections/SWGList.kt b/src/main/java/com/projectswg/holocore/resources/support/data/collections/SWGList.kt index 7c30aa801..d3e2af83e 100644 --- a/src/main/java/com/projectswg/holocore/resources/support/data/collections/SWGList.kt +++ b/src/main/java/com/projectswg/holocore/resources/support/data/collections/SWGList.kt @@ -190,11 +190,12 @@ class SWGList: AbstractMutableList, Encodable { } } - override fun getLength(): Int { - lock.withLock { - return 8 + list.sumBy(encodedLength) + override val length: Int + get() { + lock.withLock { + return 8 + list.sumBy(encodedLength) + } } - } private fun addRemoveDelta(index: Int) { deltaQueue.add(0) @@ -334,7 +335,7 @@ class SWGList: AbstractMutableList, Encodable { fun createLongList(page: Int, update: Int): SWGList = SWGList(page, update, NetBuffer::getLong, NetBuffer::addLong) {8} fun createFloatList(page: Int, update: Int): SWGList = SWGList(page, update, NetBuffer::getFloat, NetBuffer::addFloat) {4} fun createDoubleList(page: Int, update: Int): SWGList = SWGList(page, update, {buf -> buf.float.toDouble()}, {buf, d -> buf.addFloat(d.toFloat())}, {8}) - fun createEncodableList(page: Int, update: Int, supplier: () -> T): SWGList = SWGList(page, update, supplier, NetBuffer::addEncodable, Encodable::getLength) + fun createEncodableList(page: Int, update: Int, supplier: () -> T): SWGList = SWGList(page, update, supplier, NetBuffer::addEncodable, Encodable::length) fun createAsciiList(page: Int, update: Int): SWGList = SWGList(page, update, NetBuffer::getAscii, NetBuffer::addAscii) {2+it.length} fun createUnicodeList(page: Int, update: Int): SWGList = SWGList(page, update, NetBuffer::getUnicode, NetBuffer::addUnicode) {4+it.length*2} diff --git a/src/main/java/com/projectswg/holocore/resources/support/objects/swg/creature/attributes/AttributesMutable.kt b/src/main/java/com/projectswg/holocore/resources/support/objects/swg/creature/attributes/AttributesMutable.kt index c3854508b..bf4f18a84 100644 --- a/src/main/java/com/projectswg/holocore/resources/support/objects/swg/creature/attributes/AttributesMutable.kt +++ b/src/main/java/com/projectswg/holocore/resources/support/objects/swg/creature/attributes/AttributesMutable.kt @@ -142,9 +142,10 @@ class AttributesMutable(obj: SWGObject, type: Int, update: Int) : Attributes, En ham.decode(data) } - override fun getLength(): Int { - return ham.length - } + override val length: Int + get() { + return ham.length + } private fun Int.addUntilMax(num: Int, max: Int): Int = Math.max(0, Math.min(max, this + num)) diff --git a/src/main/java/com/projectswg/holocore/services/support/admin/AdminSpawnerService.kt b/src/main/java/com/projectswg/holocore/services/support/admin/AdminSpawnerService.kt new file mode 100644 index 000000000..04ddee181 --- /dev/null +++ b/src/main/java/com/projectswg/holocore/services/support/admin/AdminSpawnerService.kt @@ -0,0 +1,59 @@ +/*********************************************************************************** + * Copyright (c) 2020 /// 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 . * + ***********************************************************************************/ + +package com.projectswg.holocore.services.support.admin + +import com.projectswg.holocore.intents.support.global.command.ExecuteCommandIntent +import me.joshlarson.jlcommon.control.IntentHandler +import me.joshlarson.jlcommon.control.Service +import me.joshlarson.jlcommon.log.Log +import java.io.File +import java.io.OutputStreamWriter +import java.nio.charset.StandardCharsets + +class AdminSpawnerService : Service() { + + private val outputFile = File("log/spawners.txt") + private var outputStream: OutputStreamWriter? = null + + override fun start(): Boolean { + outputStream = outputFile.writer(StandardCharsets.UTF_8) + return true + } + + override fun stop(): Boolean { + outputStream?.close() + outputStream = null + return true + } + + @IntentHandler + private fun handleChatCommandIntent(eci: ExecuteCommandIntent) { + Log.d("Command: %s", eci.command.name) + } + +} diff --git a/src/main/java/com/projectswg/holocore/services/support/admin/AdministrationManager.kt b/src/main/java/com/projectswg/holocore/services/support/admin/AdministrationManager.kt new file mode 100644 index 000000000..1c06228b6 --- /dev/null +++ b/src/main/java/com/projectswg/holocore/services/support/admin/AdministrationManager.kt @@ -0,0 +1,44 @@ +/*********************************************************************************** + * Copyright (c) 2020 /// 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 . * + ***********************************************************************************/ + +package com.projectswg.holocore.services.support.admin + +import com.projectswg.holocore.services.gameplay.combat.CombatManager +import com.projectswg.holocore.services.gameplay.crafting.CraftingManager +import com.projectswg.holocore.services.gameplay.entertainment.EntertainmentManager +import com.projectswg.holocore.services.gameplay.faction.FactionManager +import com.projectswg.holocore.services.gameplay.gcw.GalacticCivilWarManager +import com.projectswg.holocore.services.gameplay.player.PlayerManager +import com.projectswg.holocore.services.gameplay.structures.StructuresManager +import com.projectswg.holocore.services.gameplay.world.WorldManager +import me.joshlarson.jlcommon.control.Manager +import me.joshlarson.jlcommon.control.ManagerStructure + +@ManagerStructure(children = [ + CombatManager::class, CraftingManager::class, EntertainmentManager::class, FactionManager::class, GalacticCivilWarManager::class, PlayerManager::class, StructuresManager::class, WorldManager::class +]) +class AdministrationManager : Manager()