Initial version of packet updates with Holocore compiling and running

This commit is contained in:
Obique
2020-04-30 16:21:07 -04:00
parent 2be1590042
commit e18a215344
5 changed files with 114 additions and 9 deletions

View File

@@ -190,11 +190,12 @@ class SWGList<T: Any>: AbstractMutableList<T>, 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<T: Any>: AbstractMutableList<T>, Encodable {
fun createLongList(page: Int, update: Int): SWGList<Long> = SWGList(page, update, NetBuffer::getLong, NetBuffer::addLong) {8}
fun createFloatList(page: Int, update: Int): SWGList<Float> = SWGList(page, update, NetBuffer::getFloat, NetBuffer::addFloat) {4}
fun createDoubleList(page: Int, update: Int): SWGList<Double> = SWGList(page, update, {buf -> buf.float.toDouble()}, {buf, d -> buf.addFloat(d.toFloat())}, {8})
fun <T: Encodable> createEncodableList(page: Int, update: Int, supplier: () -> T): SWGList<T> = SWGList(page, update, supplier, NetBuffer::addEncodable, Encodable::getLength)
fun <T: Encodable> createEncodableList(page: Int, update: Int, supplier: () -> T): SWGList<T> = SWGList(page, update, supplier, NetBuffer::addEncodable, Encodable::length)
fun createAsciiList(page: Int, update: Int): SWGList<String> = SWGList(page, update, NetBuffer::getAscii, NetBuffer::addAscii) {2+it.length}
fun createUnicodeList(page: Int, update: Int): SWGList<String> = SWGList(page, update, NetBuffer::getUnicode, NetBuffer::addUnicode) {4+it.length*2}

View File

@@ -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))

View File

@@ -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 <http://www.gnu.org/licenses/>. *
***********************************************************************************/
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)
}
}

View File

@@ -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 <http://www.gnu.org/licenses/>. *
***********************************************************************************/
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()