mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-04-27 23:05:21 +00:00
Playtest crash fixes (#265)
* Fix BIUM getting hack time in nanoseconds instead of milliseconds * Remove blocking call to calculate remaining hack time on CC * Fix HackClearActor crash when trying to schedule next check when no hacked objects are left * Potential fix for client disconnect when looting a corpse that gets removed
This commit is contained in:
parent
ef65c91740
commit
0730c0deb6
6 changed files with 40 additions and 39 deletions
|
|
@ -1284,23 +1284,27 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
|||
value = 17039360L
|
||||
}
|
||||
else {
|
||||
import scala.concurrent.ExecutionContext.Implicits.global
|
||||
val future = ask(localService, HackCaptureActor.GetHackTimeRemainingNanos(target_guid))(1 second)
|
||||
val time = Await.result(future, 1 second).asInstanceOf[Long]
|
||||
// todo: blocking call. Not good.
|
||||
val hack_time_remaining_ms = TimeUnit.MILLISECONDS.convert(time, TimeUnit.NANOSECONDS)
|
||||
val deciseconds_remaining = (hack_time_remaining_ms / 100)
|
||||
val hacking_faction = continent.GUID(target_guid).get.asInstanceOf[Hackable].HackedBy.get.hackerFaction
|
||||
// See PlanetSideAttributeMessage #20 documentation for an explanation of how the timer is calculated
|
||||
val start_num = hacking_faction match {
|
||||
case PlanetSideEmpire.TR => 65536L
|
||||
case PlanetSideEmpire.NC => 131072L
|
||||
case PlanetSideEmpire.VS => 196608L
|
||||
}
|
||||
value = start_num + deciseconds_remaining
|
||||
}
|
||||
sendResponse(PlanetsideAttributeMessage(target_guid, 20, value))
|
||||
continent.GUID(target_guid) match {
|
||||
case Some(capture_terminal: Hackable) =>
|
||||
capture_terminal.HackedBy match {
|
||||
case Some(Hackable.HackInfo(_, _, hfaction, _, start, length)) =>
|
||||
val hack_time_remaining_ms = TimeUnit.MILLISECONDS.convert(math.max(0, start + length - System.nanoTime), TimeUnit.NANOSECONDS)
|
||||
val deciseconds_remaining = (hack_time_remaining_ms / 100)
|
||||
|
||||
// See PlanetSideAttributeMessage #20 documentation for an explanation of how the timer is calculated
|
||||
val start_num = hfaction match {
|
||||
case PlanetSideEmpire.TR => 65536L
|
||||
case PlanetSideEmpire.NC => 131072L
|
||||
case PlanetSideEmpire.VS => 196608L
|
||||
}
|
||||
value = start_num + deciseconds_remaining
|
||||
|
||||
sendResponse(PlanetsideAttributeMessage(target_guid, 20, value))
|
||||
case _ => log.warn("LocalResponse.HackCaptureTerminal: HackedBy not defined")
|
||||
}
|
||||
case _ => log.warn(s"LocalResponse.HackCaptureTerminal: Couldn't find capture terminal with GUID ${target_guid} in zone ${continent.Id}")
|
||||
}
|
||||
}
|
||||
case LocalResponse.ObjectDelete(object_guid, unk) =>
|
||||
if(tplayer_guid != guid) {
|
||||
sendResponse(ObjectDeleteMessage(object_guid, unk))
|
||||
|
|
@ -3211,7 +3215,10 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
|||
case Some(container) => //just in case
|
||||
if(vel.isDefined) {
|
||||
val guid = player.GUID
|
||||
sendResponse(UnuseItemMessage(guid, container.GUID))
|
||||
// If the container is a corpse and gets removed just as this runs it can cause a client disconnect, so we'll check the container has a GUID first.
|
||||
if(container.HasGUID) {
|
||||
sendResponse(UnuseItemMessage(guid, container.GUID))
|
||||
}
|
||||
sendResponse(UnuseItemMessage(guid, guid))
|
||||
accessedContainer = None
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue