Skip to content
This repository was archived by the owner on Dec 1, 2022. It is now read-only.

Merge for bugfix #16

Merged
merged 8 commits into from
Aug 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kotlin.code.style=official
ksp.incremental=false

# The version of this software. This is compiled into the constants
serverVersion=1.0.5
serverVersion=1.0.6

# This is the name of the jar file that will be produced when app:shadowJar is
# run. Note: If you are planning on using this in a docker image you will need
Expand Down
15 changes: 0 additions & 15 deletions src/main/kotlin/com/jacobtread/relay/blaze/Components.kt
Original file line number Diff line number Diff line change
@@ -1,29 +1,14 @@
package com.jacobtread.relay.blaze

@Suppress("unused")
object Components {
const val AUTHENTICATION = 0x1
const val EXAMPLE = 0x3
const val GAME_MANAGER = 0x4
const val REDIRECTOR = 0x5
const val PLAY_GROUPS = 0x6
const val STATS = 0x7
const val UTIL = 0x9
const val CENSUS_DATA = 0xA
const val CLUBS = 0xB
const val GAME_REPORT_LEGACY = 0xC
const val LEAGUE = 0xD
const val MAIL = 0xE
const val MESSAGING = 0xF
const val LOCKER = 0x14
const val ROOMS = 0x15
const val TOURNAMENTS = 0x17
const val COMMERCE_INFO = 0x18
const val ASSOCIATION_LISTS = 0x19
const val GPS_CONTENT_CONTROLLER = 0x1B
const val GAME_REPORTING = 0x1C
const val DYNAMIC_FILTER = 0x7D0
const val RSP = 0x801
const val USER_SESSIONS = 0x7802

}
2 changes: 1 addition & 1 deletion src/main/kotlin/com/jacobtread/relay/data/Constants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package com.jacobtread.relay.data
* @constructor Create empty Constants
*/
object Constants {
const val RELAY_VERSION = "1.0.5"
const val RELAY_VERSION = "1.0.6"
const val MYSQL_VERSION = "8.0.30"
const val SQLITE_VERSION = "3.36.0.3"
}
67 changes: 36 additions & 31 deletions src/main/kotlin/com/jacobtread/relay/database/models/Player.kt
Original file line number Diff line number Diff line change
Expand Up @@ -118,38 +118,43 @@ data class Player(
}
}

class SettingsMapLoader(private val player: Player) {
private val out = LinkedHashMap<String, String>()

fun load(): Future<Map<String, String>> {
val classesFuture = PlayerClassesTable.getByPlayer(player)
.thenApply { classes -> classes.forEach { out[it.getKey()] = it.toEncoded() } }
val charactersFuture = PlayerCharactersTable.getByPlayer(player)
.thenApply { characters -> characters.forEach { out[it.getKey()] = it.toEncoded() } }
val settingsBase = StringBuilder("20;4;")
.append(player.credits).append(";-1;0;")
.append(player.creditsSpent).append(";0;")
.append(player.gamesPlayed).append(';')
.append(player.secondsPlayed).append(";0;")
.append(player.inventory)
.toString()
return Future.allOf(classesFuture, charactersFuture)
.thenApply {
player.faceCodes?.apply { out["FaceCodes"] = this }
player.newItem?.apply { out["NewItem"] = this }
out["csreward"] = player.csReward.toString()

player.completion?.apply { out["Completion"] = this }
player.progress?.apply { out["Progress"] = this }
player.cscompletion?.apply { out["cscompletion"] = this }
player.cstimestamps1?.apply { out["cstimestamps"] = this }
player.cstimestamps2?.apply { out["cstimestamps2"] = this }
player.cstimestamps3?.apply { out["cstimestamps3"] = this }
out["Base"] = settingsBase
out
}
}

}

fun createSettingsMap(): Future<Map<String, String>> {
val out = LinkedHashMap<String, String>()
val classesFuture = PlayerClassesTable.getByPlayer(this)
.thenApply { classes ->
classes.forEach { out[it.getKey()] = it.toEncoded() }
}
val charactersFuture = PlayerCharactersTable.getByPlayer(this)
.thenApply { characters ->
characters.forEach { out[it.getKey()] = it.toEncoded() }
}
val settingsBase = StringBuilder("20;4;")
.append(credits).append(";-1;0;")
.append(creditsSpent).append(";0;")
.append(gamesPlayed).append(';')
.append(secondsPlayed).append(";0;")
.append(inventory)
.toString()
return Future.allOf(classesFuture, charactersFuture)
.thenApply {
faceCodes?.apply { out["FaceCodes"] = this }
newItem?.apply { out["NewItem"] = this }
out["csreward"] = csReward.toString()

completion?.apply { out["Completion"] = this }
progress?.apply { out["Progress"] = this }
cscompletion?.apply { out["cscompletion"] = this }
cstimestamps1?.apply { out["cstimestamps"] = this }
cstimestamps2?.apply { out["cstimestamps2"] = this }
cstimestamps3?.apply { out["cstimestamps3"] = this }
out["Base"] = settingsBase
out
}
val loader = SettingsMapLoader(this)
return loader.load()
}

fun setPlayerDataBulk(map: Map<String, String>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.jacobtread.relay.database.Database
import com.jacobtread.relay.database.Table
import com.jacobtread.relay.database.asList
import com.jacobtread.relay.database.models.Player
import com.jacobtread.relay.utils.logging.Logger
import org.intellij.lang.annotations.Language
import java.sql.ResultSet
import java.util.concurrent.CompletableFuture as Future
Expand Down Expand Up @@ -301,12 +302,15 @@ object PlayersTable : Table {
setString(4, "") // Inventory
setBoolean(5, origin)
}
.thenCompose { keys ->
.thenApply {
if (!it.next()) null
else it.getInt(1)
}
.thenCompose { id ->
val future = Future<Player>()
if (!keys.next()) {
if (id == null) {
future.completeExceptionally(null)
} else {
val id = keys.getInt(1)
future.complete(Player(id, email, displayName, hashedPassword))
}
future
Expand All @@ -329,14 +333,15 @@ object PlayersTable : Table {
setString(1, details.email)
setBoolean(2, true)
}
.thenCompose {
val player = it.asPlayer()
.thenApply { it.asPlayer() }
.thenCompose { player ->
if (player == null) {
createOrigin(details)
} else {
Future.completedFuture(player)
}
}

}

/**
Expand All @@ -359,6 +364,7 @@ object PlayersTable : Table {
).thenApplyAsync { player ->
val dataMap = details.dataMap
if (dataMap.isNotEmpty()) {
Logger.logIfDebug { "Storing player origin details" }
player.setPlayerDataBulk(dataMap)
}
player
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ fun RoutingGroup.routeQOS() {
textNode("numprobes", 0)
textNode("qosport", 17499) // This is a port
textNode("probesize", 0)
textNode("qosip", 2733913518) // This is a encoded ip address
// 162.244.53.174
textNode("qosip", 2733913518)
textNode("requestid", 1)
textNode("reqsecret", 0)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,21 +202,6 @@ fun Session.handlePostAuth(packet: Packet) {
// telemetryAddress = "reports.tools.gos.ea.com:9988"
// tickerAddress = "waleu2.tools.gos.ea.com:8999"

+group("TELE") {
text("ADRS", "127.0.0.1") // Server Address
number("ANON", 0)
text("DISA", "**")
text("FILT", "-UION/****") // Telemetry filter?
number("LOC", 1701725253)
text("NOOK", "US,CA,MX")
number("PORT", 9988)
number("SDLY", 15000)
text("SESS", "JMhnT9dXSED")
text("SKEY", "")
number("SPCT", 0x4B)
text("STIM", "")
}

+group("TICK") {
text("ADRS", "127.0.0.1")
number("port", 9988)
Expand Down