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

Commit 6c3a2db

Browse files
authored
Merge pull request #16 from jacobtread/dev
Merge for bugfix
2 parents e5e2bba + a70f673 commit 6c3a2db

File tree

7 files changed

+51
-69
lines changed

7 files changed

+51
-69
lines changed

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ kotlin.code.style=official
55
ksp.incremental=false
66

77
# The version of this software. This is compiled into the constants
8-
serverVersion=1.0.5
8+
serverVersion=1.0.6
99

1010
# This is the name of the jar file that will be produced when app:shadowJar is
1111
# run. Note: If you are planning on using this in a docker image you will need
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,14 @@
11
package com.jacobtread.relay.blaze
22

3-
@Suppress("unused")
43
object Components {
54
const val AUTHENTICATION = 0x1
6-
const val EXAMPLE = 0x3
75
const val GAME_MANAGER = 0x4
86
const val REDIRECTOR = 0x5
9-
const val PLAY_GROUPS = 0x6
107
const val STATS = 0x7
118
const val UTIL = 0x9
12-
const val CENSUS_DATA = 0xA
13-
const val CLUBS = 0xB
14-
const val GAME_REPORT_LEGACY = 0xC
15-
const val LEAGUE = 0xD
16-
const val MAIL = 0xE
179
const val MESSAGING = 0xF
18-
const val LOCKER = 0x14
19-
const val ROOMS = 0x15
20-
const val TOURNAMENTS = 0x17
21-
const val COMMERCE_INFO = 0x18
2210
const val ASSOCIATION_LISTS = 0x19
23-
const val GPS_CONTENT_CONTROLLER = 0x1B
2411
const val GAME_REPORTING = 0x1C
2512
const val DYNAMIC_FILTER = 0x7D0
26-
const val RSP = 0x801
2713
const val USER_SESSIONS = 0x7802
28-
2914
}

src/main/kotlin/com/jacobtread/relay/data/Constants.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ package com.jacobtread.relay.data
88
* @constructor Create empty Constants
99
*/
1010
object Constants {
11-
const val RELAY_VERSION = "1.0.5"
11+
const val RELAY_VERSION = "1.0.6"
1212
const val MYSQL_VERSION = "8.0.30"
1313
const val SQLITE_VERSION = "3.36.0.3"
1414
}

src/main/kotlin/com/jacobtread/relay/database/models/Player.kt

+36-31
Original file line numberDiff line numberDiff line change
@@ -118,38 +118,43 @@ data class Player(
118118
}
119119
}
120120

121+
class SettingsMapLoader(private val player: Player) {
122+
private val out = LinkedHashMap<String, String>()
123+
124+
fun load(): Future<Map<String, String>> {
125+
val classesFuture = PlayerClassesTable.getByPlayer(player)
126+
.thenApply { classes -> classes.forEach { out[it.getKey()] = it.toEncoded() } }
127+
val charactersFuture = PlayerCharactersTable.getByPlayer(player)
128+
.thenApply { characters -> characters.forEach { out[it.getKey()] = it.toEncoded() } }
129+
val settingsBase = StringBuilder("20;4;")
130+
.append(player.credits).append(";-1;0;")
131+
.append(player.creditsSpent).append(";0;")
132+
.append(player.gamesPlayed).append(';')
133+
.append(player.secondsPlayed).append(";0;")
134+
.append(player.inventory)
135+
.toString()
136+
return Future.allOf(classesFuture, charactersFuture)
137+
.thenApply {
138+
player.faceCodes?.apply { out["FaceCodes"] = this }
139+
player.newItem?.apply { out["NewItem"] = this }
140+
out["csreward"] = player.csReward.toString()
141+
142+
player.completion?.apply { out["Completion"] = this }
143+
player.progress?.apply { out["Progress"] = this }
144+
player.cscompletion?.apply { out["cscompletion"] = this }
145+
player.cstimestamps1?.apply { out["cstimestamps"] = this }
146+
player.cstimestamps2?.apply { out["cstimestamps2"] = this }
147+
player.cstimestamps3?.apply { out["cstimestamps3"] = this }
148+
out["Base"] = settingsBase
149+
out
150+
}
151+
}
152+
153+
}
154+
121155
fun createSettingsMap(): Future<Map<String, String>> {
122-
val out = LinkedHashMap<String, String>()
123-
val classesFuture = PlayerClassesTable.getByPlayer(this)
124-
.thenApply { classes ->
125-
classes.forEach { out[it.getKey()] = it.toEncoded() }
126-
}
127-
val charactersFuture = PlayerCharactersTable.getByPlayer(this)
128-
.thenApply { characters ->
129-
characters.forEach { out[it.getKey()] = it.toEncoded() }
130-
}
131-
val settingsBase = StringBuilder("20;4;")
132-
.append(credits).append(";-1;0;")
133-
.append(creditsSpent).append(";0;")
134-
.append(gamesPlayed).append(';')
135-
.append(secondsPlayed).append(";0;")
136-
.append(inventory)
137-
.toString()
138-
return Future.allOf(classesFuture, charactersFuture)
139-
.thenApply {
140-
faceCodes?.apply { out["FaceCodes"] = this }
141-
newItem?.apply { out["NewItem"] = this }
142-
out["csreward"] = csReward.toString()
143-
144-
completion?.apply { out["Completion"] = this }
145-
progress?.apply { out["Progress"] = this }
146-
cscompletion?.apply { out["cscompletion"] = this }
147-
cstimestamps1?.apply { out["cstimestamps"] = this }
148-
cstimestamps2?.apply { out["cstimestamps2"] = this }
149-
cstimestamps3?.apply { out["cstimestamps3"] = this }
150-
out["Base"] = settingsBase
151-
out
152-
}
156+
val loader = SettingsMapLoader(this)
157+
return loader.load()
153158
}
154159

155160
fun setPlayerDataBulk(map: Map<String, String>) {

src/main/kotlin/com/jacobtread/relay/database/tables/PlayersTable.kt

+11-5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import com.jacobtread.relay.database.Database
55
import com.jacobtread.relay.database.Table
66
import com.jacobtread.relay.database.asList
77
import com.jacobtread.relay.database.models.Player
8+
import com.jacobtread.relay.utils.logging.Logger
89
import org.intellij.lang.annotations.Language
910
import java.sql.ResultSet
1011
import java.util.concurrent.CompletableFuture as Future
@@ -301,12 +302,15 @@ object PlayersTable : Table {
301302
setString(4, "") // Inventory
302303
setBoolean(5, origin)
303304
}
304-
.thenCompose { keys ->
305+
.thenApply {
306+
if (!it.next()) null
307+
else it.getInt(1)
308+
}
309+
.thenCompose { id ->
305310
val future = Future<Player>()
306-
if (!keys.next()) {
311+
if (id == null) {
307312
future.completeExceptionally(null)
308313
} else {
309-
val id = keys.getInt(1)
310314
future.complete(Player(id, email, displayName, hashedPassword))
311315
}
312316
future
@@ -329,14 +333,15 @@ object PlayersTable : Table {
329333
setString(1, details.email)
330334
setBoolean(2, true)
331335
}
332-
.thenCompose {
333-
val player = it.asPlayer()
336+
.thenApply { it.asPlayer() }
337+
.thenCompose { player ->
334338
if (player == null) {
335339
createOrigin(details)
336340
} else {
337341
Future.completedFuture(player)
338342
}
339343
}
344+
340345
}
341346

342347
/**
@@ -359,6 +364,7 @@ object PlayersTable : Table {
359364
).thenApplyAsync { player ->
360365
val dataMap = details.dataMap
361366
if (dataMap.isNotEmpty()) {
367+
Logger.logIfDebug { "Storing player origin details" }
362368
player.setPlayerDataBulk(dataMap)
363369
}
364370
player

src/main/kotlin/com/jacobtread/relay/http/routes/QOSRoutes.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ fun RoutingGroup.routeQOS() {
99
textNode("numprobes", 0)
1010
textNode("qosport", 17499) // This is a port
1111
textNode("probesize", 0)
12-
textNode("qosip", 2733913518) // This is a encoded ip address
12+
// 162.244.53.174
13+
textNode("qosip", 2733913518)
1314
textNode("requestid", 1)
1415
textNode("reqsecret", 0)
1516
}

src/main/kotlin/com/jacobtread/relay/sessions/handlers/UtilHandlers.kt

-15
Original file line numberDiff line numberDiff line change
@@ -202,21 +202,6 @@ fun Session.handlePostAuth(packet: Packet) {
202202
// telemetryAddress = "reports.tools.gos.ea.com:9988"
203203
// tickerAddress = "waleu2.tools.gos.ea.com:8999"
204204

205-
+group("TELE") {
206-
text("ADRS", "127.0.0.1") // Server Address
207-
number("ANON", 0)
208-
text("DISA", "**")
209-
text("FILT", "-UION/****") // Telemetry filter?
210-
number("LOC", 1701725253)
211-
text("NOOK", "US,CA,MX")
212-
number("PORT", 9988)
213-
number("SDLY", 15000)
214-
text("SESS", "JMhnT9dXSED")
215-
text("SKEY", "")
216-
number("SPCT", 0x4B)
217-
text("STIM", "")
218-
}
219-
220205
+group("TICK") {
221206
text("ADRS", "127.0.0.1")
222207
number("port", 9988)

0 commit comments

Comments
 (0)