mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-07-16 08:55:16 +00:00
even more concise
This commit is contained in:
parent
f11bf70af7
commit
7e2d7a2089
1 changed files with 15 additions and 14 deletions
|
|
@ -721,13 +721,14 @@ class AvatarActor(
|
||||||
Behaviors.same
|
Behaviors.same
|
||||||
|
|
||||||
case UpdatePurchaseTime(definition, time) =>
|
case UpdatePurchaseTime(definition, time) =>
|
||||||
if (!Avatar.purchaseCooldowns.contains(definition)) {
|
//only send for items with cooldowns
|
||||||
// TODO 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")
|
//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
|
Behaviors.same
|
||||||
|
|
||||||
|
|
@ -1360,14 +1361,7 @@ class AvatarActor(
|
||||||
case _ =>
|
case _ =>
|
||||||
obj.Name
|
obj.Name
|
||||||
}
|
}
|
||||||
sessionActor ! SessionActor.SendResponse(
|
updatePurchaseTimer(name, cooldown.toSeconds - secondsSincePurchase, unk1 = true)
|
||||||
AvatarVehicleTimerMessage(
|
|
||||||
session.get.player.GUID,
|
|
||||||
name,
|
|
||||||
cooldown.toSeconds - secondsSincePurchase,
|
|
||||||
unk1 = true //TODO? vehicles = true, everything else = false
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
case _ =>
|
case _ =>
|
||||||
keysToDrop = keysToDrop :+ key //key has timed-out
|
keysToDrop = keysToDrop :+ key //key has timed-out
|
||||||
|
|
@ -1379,4 +1373,11 @@ class AvatarActor(
|
||||||
avatar.copy(purchaseTimes = avatar.purchaseTimes.removedAll(keysToDrop))
|
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…
Add table
Add a link
Reference in a new issue