mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-03-03 12:10:22 +00:00
Correctly set active=false when deinitializing implants
Plus a minor logging improvement in MA
This commit is contained in:
parent
25bb2cc5ac
commit
490e6244e7
2 changed files with 8 additions and 9 deletions
|
|
@ -297,7 +297,7 @@ class MiddlewareActor(
|
|||
log.warn(s"Unexpected packet type $packet in start (before crypto)")
|
||||
Behaviors.same
|
||||
}
|
||||
case Failure(_) =>
|
||||
case Failure(unmarshalError) =>
|
||||
// There is a special case where no crypto is being used.
|
||||
// The only packet coming through looks like PingMsg. This is a hardcoded
|
||||
// feature of the client @ 0x005FD618
|
||||
|
|
@ -318,8 +318,8 @@ class MiddlewareActor(
|
|||
log.error(s"Unexpected non-crypto packet type $packet in start")
|
||||
Behaviors.same
|
||||
}
|
||||
case Failure(e) =>
|
||||
log.error(s"Could not decode packet in start: $e")
|
||||
case Failure(decodeError) =>
|
||||
log.error(s"Could not decode packet in start: '$unmarshalError' / '$decodeError'")
|
||||
Behaviors.same
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -784,7 +784,7 @@ class AvatarActor(
|
|||
} match {
|
||||
case Some((implant, slot)) =>
|
||||
if (!implant.initialized) {
|
||||
log.error(s"requested activation of uninitialized implant $implant")
|
||||
log.warn(s"requested activation of uninitialized implant $implantType")
|
||||
} else if (
|
||||
!consumeStamina(implant.definition.ActivationStaminaCost) ||
|
||||
avatar.stamina < implant.definition.StaminaCost
|
||||
|
|
@ -877,7 +877,7 @@ class AvatarActor(
|
|||
val totalStamina = math.min(avatar.maxStamina, avatar.stamina + stamina)
|
||||
val fatigued = if (avatar.fatigued && totalStamina >= 20) {
|
||||
avatar.implants.zipWithIndex.foreach {
|
||||
case (Some(implant), slot) =>
|
||||
case (Some(_), slot) =>
|
||||
sessionActor ! SessionActor.SendResponse(
|
||||
AvatarImplantMessage(session.get.player.GUID, ImplantAction.OutOfStamina, slot, 0)
|
||||
)
|
||||
|
|
@ -1103,16 +1103,15 @@ class AvatarActor(
|
|||
AvatarImplantMessage(session.get.player.GUID, ImplantAction.Initialization, slot, 0)
|
||||
)
|
||||
)
|
||||
Some(implant.copy(initialized = false))
|
||||
Some(implant.copy(initialized = false, active = false))
|
||||
case (None, _) => None
|
||||
})
|
||||
}
|
||||
|
||||
def deactivateImplant(implantType: ImplantType): Unit = {
|
||||
val res = avatar.implants.zipWithIndex.collectFirst {
|
||||
avatar.implants.zipWithIndex.collectFirst {
|
||||
case (Some(implant), index) if implant.definition.implantType == implantType => (implant, index)
|
||||
}
|
||||
res match {
|
||||
} match {
|
||||
case Some((implant, slot)) =>
|
||||
implantTimers(slot).cancel()
|
||||
avatar = avatar.copy(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue