mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-01-20 02:24:45 +00:00
even more concise
This commit is contained in:
parent
f11bf70af7
commit
7e2d7a2089
|
|
@ -721,13 +721,14 @@ class AvatarActor(
|
|||
Behaviors.same
|
||||
|
||||
case UpdatePurchaseTime(definition, time) =>
|
||||
if (!Avatar.purchaseCooldowns.contains(definition)) {
|
||||
// TODO only send for items with cooldowns
|
||||
//only send for items with cooldowns
|
||||
Avatar.purchaseCooldowns.get(definition) match {
|
||||
case Some(cooldown) =>
|
||||
// TODO save to db
|
||||
avatar = avatar.copy(purchaseTimes = avatar.purchaseTimes.updated(definition.Name, time))
|
||||
updatePurchaseTimer(definition.Name, cooldown.toSeconds, unk1 = true)
|
||||
case None => ;
|
||||
//log.warn(s"UpdatePurchaseTime message for item '${definition.Name}' without cooldown")
|
||||
} else {
|
||||
// TODO save to db
|
||||
avatar = avatar.copy(purchaseTimes = avatar.purchaseTimes.updated(definition.Name, time))
|
||||
refreshPurchaseTimes(Set(definition.Name))
|
||||
}
|
||||
Behaviors.same
|
||||
|
||||
|
|
@ -1360,14 +1361,7 @@ class AvatarActor(
|
|||
case _ =>
|
||||
obj.Name
|
||||
}
|
||||
sessionActor ! SessionActor.SendResponse(
|
||||
AvatarVehicleTimerMessage(
|
||||
session.get.player.GUID,
|
||||
name,
|
||||
cooldown.toSeconds - secondsSincePurchase,
|
||||
unk1 = true //TODO? vehicles = true, everything else = false
|
||||
)
|
||||
)
|
||||
updatePurchaseTimer(name, cooldown.toSeconds - secondsSincePurchase, unk1 = true)
|
||||
|
||||
case _ =>
|
||||
keysToDrop = keysToDrop :+ key //key has timed-out
|
||||
|
|
@ -1379,4 +1373,11 @@ class AvatarActor(
|
|||
avatar.copy(purchaseTimes = avatar.purchaseTimes.removedAll(keysToDrop))
|
||||
}
|
||||
}
|
||||
|
||||
def updatePurchaseTimer(name: String, time: Long, unk1: Boolean): Unit = {
|
||||
//TODO? unk1 is: vehicles = true, everything else = false
|
||||
sessionActor ! SessionActor.SendResponse(
|
||||
AvatarVehicleTimerMessage(session.get.player.GUID, name, time, unk1 = true)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue