mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-07-13 15:34:42 +00:00
false-hope
This commit is contained in:
parent
8f04b634c5
commit
53429ea71f
1 changed files with 16 additions and 23 deletions
|
|
@ -1,7 +1,6 @@
|
||||||
// Copyright (c) 2022 PSForever
|
// Copyright (c) 2022 PSForever
|
||||||
package net.psforever.objects.zones.exp
|
package net.psforever.objects.zones.exp
|
||||||
|
|
||||||
import scala.concurrent.ExecutionContext.Implicits.global
|
|
||||||
import net.psforever.objects.avatar.scoring.EquipmentStat
|
import net.psforever.objects.avatar.scoring.EquipmentStat
|
||||||
import net.psforever.objects.serverobject.hackable.Hackable.HackInfo
|
import net.psforever.objects.serverobject.hackable.Hackable.HackInfo
|
||||||
import net.psforever.objects.sourcing.VehicleSource
|
import net.psforever.objects.sourcing.VehicleSource
|
||||||
|
|
@ -10,7 +9,6 @@ import net.psforever.types.Vector3
|
||||||
import net.psforever.util.Database.ctx
|
import net.psforever.util.Database.ctx
|
||||||
import net.psforever.util.Database.ctx._
|
import net.psforever.util.Database.ctx._
|
||||||
|
|
||||||
import scala.concurrent.Future
|
|
||||||
|
|
||||||
object ToDatabase {
|
object ToDatabase {
|
||||||
/**
|
/**
|
||||||
|
|
@ -103,27 +101,22 @@ object ToDatabase {
|
||||||
* insert a new entry into the table.
|
* insert a new entry into the table.
|
||||||
* Shots fired.
|
* Shots fired.
|
||||||
*/
|
*/
|
||||||
def reportToolDischarge(avatarId: Long, stats: EquipmentStat): Future[Unit] = {
|
def reportToolDischarge(avatarId: Long, stats: EquipmentStat): Unit = {
|
||||||
import ctx._
|
ctx.run(query[persistence.Weaponstatsession]
|
||||||
import scala.concurrent.ExecutionContext.Implicits.global
|
.insert(
|
||||||
ctx.transaction { implicit ec =>
|
_.avatarId -> lift(avatarId),
|
||||||
ctx.run(
|
_.weaponId -> lift(stats.objectId),
|
||||||
query[persistence.Weaponstatsession]
|
_.shotsFired -> lift(stats.shotsFired),
|
||||||
.insert(
|
_.shotsLanded -> lift(stats.shotsLanded),
|
||||||
_.avatarId -> lift(avatarId),
|
_.kills -> lift(0),
|
||||||
_.weaponId -> lift(stats.objectId),
|
_.assists -> lift(0),
|
||||||
_.shotsFired -> lift(stats.shotsFired),
|
_.sessionId -> lift(-1L)
|
||||||
_.shotsLanded -> lift(stats.shotsLanded),
|
)
|
||||||
_.kills -> lift(0),
|
.onConflictUpdate(_.avatarId, _.weaponId, _.sessionId)(
|
||||||
_.assists -> lift(0),
|
(t, e) => t.shotsFired -> (t.shotsFired + e.shotsFired),
|
||||||
_.sessionId -> lift(-1L)
|
(t, e) => t.shotsLanded -> (t.shotsLanded + e.shotsLanded)
|
||||||
)
|
)
|
||||||
.onConflictUpdate(_.avatarId, _.weaponId, _.sessionId)(
|
)
|
||||||
(t, e) => t.shotsFired -> (t.shotsFired + e.shotsFired),
|
|
||||||
(t, e) => t.shotsLanded -> (t.shotsLanded + e.shotsLanded)
|
|
||||||
)
|
|
||||||
).map(_ => ())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue