diff --git a/app/components/MissionTimer.tsx b/app/components/MissionTimer.tsx
index 31efd52..78a1f3c 100644
--- a/app/components/MissionTimer.tsx
+++ b/app/components/MissionTimer.tsx
@@ -21,6 +21,7 @@ export function MissionTimer({ start, end }: { start: number; end: number }) {
return (
- {msToClockString(end - dateNow)}
+
+ {msToClockString(end - dateNow)}
+
)
diff --git a/app/data/gameplaySessions.server.ts b/app/data/gameplaySessions.server.ts
new file mode 100644
index 0000000..ef26b0b
--- /dev/null
+++ b/app/data/gameplaySessions.server.ts
@@ -0,0 +1,8 @@
+import type { GameplaySession } from "@prisma/client"
+import { prisma } from "~/data/db.server"
+
+export async function saveGameplaySession(
+ session: Omit,
+) {
+ return await prisma.gameplaySession.create({ data: session })
+}
diff --git a/app/root.tsx b/app/root.tsx
index 68dbdb8..144c2a3 100644
--- a/app/root.tsx
+++ b/app/root.tsx
@@ -46,7 +46,7 @@ export default function App() {
useRevalidateOnFocus()
return (
-
+
diff --git a/app/routes/api.gameplay_session.ts b/app/routes/api.gameplay_session.ts
new file mode 100644
index 0000000..12eb09a
--- /dev/null
+++ b/app/routes/api.gameplay_session.ts
@@ -0,0 +1,31 @@
+import type { ActionArgs } from "@remix-run/server-runtime"
+import { json } from "@remix-run/server-runtime"
+import { z } from "zod"
+import { saveGameplaySession } from "~/data/gameplaySessions.server"
+
+let GameplaySessionSchema = z.object({
+ account_id: z.string(),
+ character_id: z.string(),
+ session_id: z.string(),
+})
+
+export async function action({ request }: ActionArgs) {
+ let body = await request.json()
+ let { account_id, character_id, session_id } =
+ GameplaySessionSchema.parse(body)
+
+ await saveGameplaySession({
+ accountId: account_id,
+ sessionId: session_id,
+ characterId: character_id,
+ })
+
+ return json({ ok: true })
+}
+
+export async function loader() {
+ throw new Response(null, {
+ status: 404,
+ statusText: "Not Found",
+ })
+}
diff --git a/mods/DTAuth/scripts/mods/DTAuth/DTAuth.lua b/mods/DTAuth/scripts/mods/DTAuth/DTAuth.lua
index 6d4eee8..df6aea3 100644
--- a/mods/DTAuth/scripts/mods/DTAuth/DTAuth.lua
+++ b/mods/DTAuth/scripts/mods/DTAuth/DTAuth.lua
@@ -62,3 +62,18 @@ function mod.authenticate_steam()
end
end)
end
+
+mod:hook_safe("GameplaySession", "poll_for_end_of_round", function(_self, session_id, participant)
+ local url = domain .. "/api/gameplay_session"
+ local parts = string.split(participant, "|")
+ Managers.backend:url_request(url, {
+ method = "POST",
+ body = {
+ session_id = session_id,
+ account_id = parts[1],
+ character_id = parts[2]
+ }
+ })
+end)
+
+mod.start_authentication()
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index ec0dcb3..21f2191 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -44,3 +44,10 @@ model MissionInstance {
expiry DateTime
sideMission String?
}
+
+model GameplaySession {
+ createdAt DateTime @default(now())
+ accountId String
+ characterId String
+ sessionId String @unique
+}