the list of event system handlers and filters for those handlers are set up differently

This commit is contained in:
Fate-JH 2026-03-30 11:43:49 -04:00
parent b39f95354a
commit d1cc964a4c
9 changed files with 220 additions and 219 deletions

View file

@ -107,21 +107,9 @@ class SessionActor(middlewareActor: typed.ActorRef[MiddlewareActor.Command], con
private[this] val data = new SessionData(middlewareActor, context) private[this] val data = new SessionData(middlewareActor, context)
private[this] var mode: PlayerMode = NormalMode private[this] var mode: PlayerMode = NormalMode
private[this] var logic: ModeLogic = _ private[this] var logic: ModeLogic = _
private[this] var listOfHandlers: Seq[CommonHandlerFunctions] = List.empty
private val commonHandlerLogic: CommonHandlerLogic = new CommonHandlerLogic(data, context) private val commonHandlerLogic: CommonHandlerLogic = new CommonHandlerLogic(data, context)
private def listOfHandlers: Seq[CommonHandlerFunctions] = {
if (logic == null) {
List.empty
} else {
List(
logic.avatarResponse,
logic.local,
logic.vehicleResponse,
logic.galaxy,
commonHandlerLogic
)
}
}
override def postStop(): Unit = { override def postStop(): Unit = {
clientKeepAlive.cancel() clientKeepAlive.cancel()
@ -177,6 +165,13 @@ class SessionActor(middlewareActor: typed.ActorRef[MiddlewareActor.Command], con
logic.switchFrom(data.session) logic.switchFrom(data.session)
mode = newMode mode = newMode
logic = newMode.setup(data) logic = newMode.setup(data)
listOfHandlers = List(
logic.avatarResponse,
logic.local,
logic.vehicleResponse,
logic.galaxy,
commonHandlerLogic
)
} }
logic.switchTo(data.session) logic.switchTo(data.session)
} }
@ -396,15 +391,16 @@ class SessionActor(middlewareActor: typed.ActorRef[MiddlewareActor.Command], con
CommonHandlerFunctions.HandleNothing CommonHandlerFunctions.HandleNothing
} }
//try the handler on the input message //try the handler on the input message
val filter = HandlerFilter(guid, data.player)
lazy val alwaysAllowFilter = HandlerFilter.Allow(guid) lazy val alwaysAllowFilter = HandlerFilter.Allow(guid)
if (primaryHandler.handleWith(guid).isDefinedAt(reply)) { if (primaryHandler.handleWith(filter).isDefinedAt(reply)) {
primaryHandler.receive.apply(reply) primaryHandler.receive.apply(reply)
} else if (!primaryHandler.handleWith(alwaysAllowFilter).isDefinedAt(reply)) { } else if (!primaryHandler.handleWith(alwaysAllowFilter).isDefinedAt(reply)) {
//check a list of all handlers for any potentially valid case //check a list of all handlers for any potentially valid case
val potentiallyValidHandlers = listOfHandlers.filter(_.handleWith(alwaysAllowFilter).isDefinedAt(reply)) val potentiallyValidHandlers = listOfHandlers.filter(_.handleWith(alwaysAllowFilter).isDefinedAt(reply))
if (potentiallyValidHandlers.nonEmpty) { if (potentiallyValidHandlers.nonEmpty) {
potentiallyValidHandlers potentiallyValidHandlers
.find(_.handleWith(guid).isDefinedAt(reply)) .find(_.handleWith(filter).isDefinedAt(reply))
.foreach(_.receive.apply(reply)) .foreach(_.receive.apply(reply))
//arrive here without processing input, the guard for a handler blocked a case; not gonna fault //arrive here without processing input, the guard for a handler blocked a case; not gonna fault
} else { } else {

View file

@ -80,9 +80,9 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
isCloaking, isCloaking,
isNotRendered, isNotRendered,
canSeeReallyFar canSeeReallyFar
) if filter.isNotSameTarget => ) if isNotSameTarget =>
val pstateToSave = pstate.copy(timestamp = 0) val pstateToSave = pstate.copy(timestamp = 0)
val (lastMsg, lastTime, lastPosition, wasVisible, wasShooting) = ops.lastSeenStreamMessage.get(filter.resolvedPlayerGuid.guid) match { val (lastMsg, lastTime, lastPosition, wasVisible, wasShooting) = ops.lastSeenStreamMessage.get(resolvedGuid.guid) match {
case Some(SessionAvatarHandlers.LastUpstream(Some(msg), visible, shooting, time)) => (Some(msg), time, msg.pos, visible, shooting) case Some(SessionAvatarHandlers.LastUpstream(Some(msg), visible, shooting, time)) => (Some(msg), time, msg.pos, visible, shooting)
case _ => (None, 0L, Vector3.Zero, false, None) case _ => (None, 0L, Vector3.Zero, false, None)
} }
@ -125,7 +125,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
//must draw //must draw
sendResponse( sendResponse(
PlayerStateMessage( PlayerStateMessage(
filter.resolvedPlayerGuid, resolvedGuid,
pos, pos,
vel, vel,
yaw, yaw,
@ -138,10 +138,10 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
isCloaking isCloaking
) )
) )
ops.lastSeenStreamMessage.put(filter.resolvedPlayerGuid.guid, SessionAvatarHandlers.LastUpstream(Some(pstateToSave), visible=true, wasShooting, now)) ops.lastSeenStreamMessage.put(resolvedGuid.guid, SessionAvatarHandlers.LastUpstream(Some(pstateToSave), visible=true, wasShooting, now))
} else { } else {
//is visible, but skip reinforcement //is visible, but skip reinforcement
ops.lastSeenStreamMessage.put(filter.resolvedPlayerGuid.guid, SessionAvatarHandlers.LastUpstream(Some(pstateToSave), visible=true, wasShooting, lastTime)) ops.lastSeenStreamMessage.put(resolvedGuid.guid, SessionAvatarHandlers.LastUpstream(Some(pstateToSave), visible=true, wasShooting, lastTime))
} }
} else { } else {
//conditions where the target is not currently visible //conditions where the target is not currently visible
@ -150,7 +150,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
val lat = (1 + ops.hidingPlayerRandomizer.nextInt(continent.map.scale.height.toInt)).toFloat val lat = (1 + ops.hidingPlayerRandomizer.nextInt(continent.map.scale.height.toInt)).toFloat
sendResponse( sendResponse(
PlayerStateMessage( PlayerStateMessage(
filter.resolvedPlayerGuid, resolvedGuid,
Vector3(1f, lat, 1f), Vector3(1f, lat, 1f),
vel=None, vel=None,
facingYaw=0f, facingYaw=0f,
@ -160,28 +160,28 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
is_cloaked = isCloaking is_cloaked = isCloaking
) )
) )
ops.lastSeenStreamMessage.put(filter.resolvedPlayerGuid.guid, SessionAvatarHandlers.LastUpstream(Some(pstateToSave), visible=false, wasShooting, now)) ops.lastSeenStreamMessage.put(resolvedGuid.guid, SessionAvatarHandlers.LastUpstream(Some(pstateToSave), visible=false, wasShooting, now))
} else { } else {
//skip drawing altogether //skip drawing altogether
ops.lastSeenStreamMessage.put(filter.resolvedPlayerGuid.guid, SessionAvatarHandlers.LastUpstream(Some(pstateToSave), visible=false, wasShooting, lastTime)) ops.lastSeenStreamMessage.put(resolvedGuid.guid, SessionAvatarHandlers.LastUpstream(Some(pstateToSave), visible=false, wasShooting, lastTime))
} }
} }
case AvatarAction.AvatarImplant(ImplantAction.Add, implant_slot, value) case AvatarAction.AvatarImplant(ImplantAction.Add, implant_slot, value)
if value == ImplantType.SecondWind.value => if value == ImplantType.SecondWind.value =>
sendResponse(AvatarImplantMessage(filter.resolvedPlayerGuid, ImplantAction.Add, implant_slot, 7)) sendResponse(AvatarImplantMessage(resolvedGuid, ImplantAction.Add, implant_slot, 7))
//second wind does not normally load its icon into the shortcut hotbar //second wind does not normally load its icon into the shortcut hotbar
avatar avatar
.shortcuts .shortcuts
.zipWithIndex .zipWithIndex
.find { case (s, _) => s.isEmpty} .find { case (s, _) => s.isEmpty}
.foreach { case (_, index) => .foreach { case (_, index) =>
sendResponse(CreateShortcutMessage(filter.resolvedPlayerGuid, index + 1, Some(ImplantType.SecondWind.shortcut))) sendResponse(CreateShortcutMessage(resolvedGuid, index + 1, Some(ImplantType.SecondWind.shortcut)))
} }
case AvatarAction.AvatarImplant(ImplantAction.Remove, implant_slot, value) case AvatarAction.AvatarImplant(ImplantAction.Remove, implant_slot, value)
if value == ImplantType.SecondWind.value => if value == ImplantType.SecondWind.value =>
sendResponse(AvatarImplantMessage(filter.resolvedPlayerGuid, ImplantAction.Remove, implant_slot, value)) sendResponse(AvatarImplantMessage(resolvedGuid, ImplantAction.Remove, implant_slot, value))
//second wind does not normally unload its icon from the shortcut hotbar //second wind does not normally unload its icon from the shortcut hotbar
val shortcut = { val shortcut = {
val imp = ImplantType.SecondWind.shortcut val imp = ImplantType.SecondWind.shortcut
@ -192,15 +192,15 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
.zipWithIndex .zipWithIndex
.find { case (s, _) => s.contains(shortcut) } .find { case (s, _) => s.contains(shortcut) }
.foreach { case (_, index) => .foreach { case (_, index) =>
sendResponse(CreateShortcutMessage(filter.resolvedPlayerGuid, index + 1, None)) sendResponse(CreateShortcutMessage(resolvedGuid, index + 1, None))
} }
case AvatarAction.AvatarImplant(action, implant_slot, value) => case AvatarAction.AvatarImplant(action, implant_slot, value) =>
sendResponse(AvatarImplantMessage(filter.resolvedPlayerGuid, action, implant_slot, value)) sendResponse(AvatarImplantMessage(resolvedGuid, action, implant_slot, value))
case AvatarAction.ObjectHeld(slot, _) case AvatarAction.ObjectHeld(slot, _)
if filter.isSameTarget && player.VisibleSlots.contains(slot) => if isSameTarget && player.VisibleSlots.contains(slot) =>
sendResponse(ObjectHeldMessage(filter.resolvedPlayerGuid, slot, unk1=true)) sendResponse(ObjectHeldMessage(resolvedGuid, slot, unk1=true))
//Stop using proximity terminals if player unholsters a weapon //Stop using proximity terminals if player unholsters a weapon
continent.GUID(sessionLogic.terminals.usingMedicalTerminal).collect { continent.GUID(sessionLogic.terminals.usingMedicalTerminal).collect {
case term: Terminal with ProximityUnit => sessionLogic.terminals.StopUsingProximityUnit(term) case term: Terminal with ProximityUnit => sessionLogic.terminals.StopUsingProximityUnit(term)
@ -210,31 +210,31 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
} }
case AvatarAction.ObjectHeld(slot, _) case AvatarAction.ObjectHeld(slot, _)
if filter.isSameTarget && slot > -1 => if isSameTarget && slot > -1 =>
sendResponse(ObjectHeldMessage(filter.resolvedPlayerGuid, slot, unk1=true)) sendResponse(ObjectHeldMessage(resolvedGuid, slot, unk1=true))
case AvatarAction.ObjectHeld(_, _) case AvatarAction.ObjectHeld(_, _)
if filter.isSameTarget => () if isSameTarget => ()
case AvatarAction.ObjectHeld(_, previousSlot) => case AvatarAction.ObjectHeld(_, previousSlot) =>
sendResponse(ObjectHeldMessage(filter.resolvedPlayerGuid, previousSlot, unk1=false)) sendResponse(ObjectHeldMessage(resolvedGuid, previousSlot, unk1=false))
case ChangeFireState_Start(weaponGuid) case ChangeFireState_Start(weaponGuid)
if filter.isNotSameTarget && ops.lastSeenStreamMessage.get(filter.resolvedPlayerGuid.guid).exists { _.visible } => if isNotSameTarget && ops.lastSeenStreamMessage.get(resolvedGuid.guid).exists { _.visible } =>
sendResponse(ChangeFireStateMessage_Start(weaponGuid)) sendResponse(ChangeFireStateMessage_Start(weaponGuid))
val entry = ops.lastSeenStreamMessage(filter.resolvedPlayerGuid.guid) val entry = ops.lastSeenStreamMessage(resolvedGuid.guid)
ops.lastSeenStreamMessage.put(filter.resolvedPlayerGuid.guid, entry.copy(shooting = Some(weaponGuid))) ops.lastSeenStreamMessage.put(resolvedGuid.guid, entry.copy(shooting = Some(weaponGuid)))
case ChangeFireState_Stop(weaponGuid) case ChangeFireState_Stop(weaponGuid)
if filter.isNotSameTarget && ops.lastSeenStreamMessage.get(filter.resolvedPlayerGuid.guid).exists { msg => msg.visible || msg.shooting.nonEmpty } => if isNotSameTarget && ops.lastSeenStreamMessage.get(resolvedGuid.guid).exists { msg => msg.visible || msg.shooting.nonEmpty } =>
sendResponse(ChangeFireStateMessage_Stop(weaponGuid)) sendResponse(ChangeFireStateMessage_Stop(weaponGuid))
val entry = ops.lastSeenStreamMessage(filter.resolvedPlayerGuid.guid) val entry = ops.lastSeenStreamMessage(resolvedGuid.guid)
ops.lastSeenStreamMessage.put(filter.resolvedPlayerGuid.guid, entry.copy(shooting = None)) ops.lastSeenStreamMessage.put(resolvedGuid.guid, entry.copy(shooting = None))
case AvatarAction.LoadCreatedPlayer(pkt) if filter.isNotSameTarget => case AvatarAction.LoadCreatedPlayer(pkt) if isNotSameTarget =>
sendResponse(pkt) sendResponse(pkt)
case AvatarAction.EquipmentCreatedInHand(pkt) if filter.isNotSameTarget => case AvatarAction.EquipmentCreatedInHand(pkt) if isNotSameTarget =>
sendResponse(pkt) sendResponse(pkt)
case AvatarAction.Destroy(victim, killer, weapon, pos) => case AvatarAction.Destroy(victim, killer, weapon, pos) =>
@ -267,7 +267,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
inventory, inventory,
drop, drop,
delete delete
) if filter.resolvedPlayerGuid == target => ) if resolvedGuid == target =>
sendResponse(ArmorChangedMessage(target, exosuit, subtype)) sendResponse(ArmorChangedMessage(target, exosuit, subtype))
sendResponse(PlanetsideAttributeMessage(target, attribute_type=4, armor)) sendResponse(PlanetsideAttributeMessage(target, attribute_type=4, armor))
//happening to this player //happening to this player
@ -349,7 +349,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
oldInventory, oldInventory,
inventory, inventory,
drops drops
) if filter.resolvedPlayerGuid == target => ) if resolvedGuid == target =>
sendResponse(ArmorChangedMessage(target, exosuit, subtype)) sendResponse(ArmorChangedMessage(target, exosuit, subtype))
sendResponse(PlanetsideAttributeMessage(target, attribute_type=4, armor)) sendResponse(PlanetsideAttributeMessage(target, attribute_type=4, armor))
//happening to this player //happening to this player
@ -386,9 +386,9 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
case AvatarAction.UseKit(kguid, kObjId) => case AvatarAction.UseKit(kguid, kObjId) =>
sendResponse( sendResponse(
UseItemMessage( UseItemMessage(
filter.resolvedPlayerGuid, resolvedGuid,
kguid, kguid,
filter.resolvedPlayerGuid, resolvedGuid,
unk2 = 4294967295L, unk2 = 4294967295L,
unk3 = false, unk3 = false,
unk4 = Vector3.Zero, unk4 = Vector3.Zero,
@ -411,7 +411,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
/* common messages (maybe once every respawn) */ /* common messages (maybe once every respawn) */
case ReloadTool(itemGuid) case ReloadTool(itemGuid)
if filter.isNotSameTarget && ops.lastSeenStreamMessage.get(filter.resolvedPlayerGuid.guid).exists { _.visible } => if isNotSameTarget && ops.lastSeenStreamMessage.get(resolvedGuid.guid).exists { _.visible } =>
sendResponse(ReloadMessage(itemGuid, ammo_clip=1, unk1=0)) sendResponse(ReloadMessage(itemGuid, ammo_clip=1, unk1=0))
case AvatarAction.Killed(_, mount) => case AvatarAction.Killed(_, mount) =>
@ -422,23 +422,23 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
sessionLogic.zoning.zoningStatus = Zoning.Status.None sessionLogic.zoning.zoningStatus = Zoning.Status.None
continent.GUID(mount).collect { continent.GUID(mount).collect {
case obj: Vehicle if obj.Destroyed => case obj: Vehicle if obj.Destroyed =>
ops.killedWhileMounted(obj, filter.resolvedPlayerGuid) ops.killedWhileMounted(obj, resolvedGuid)
sessionLogic.vehicles.ConditionalDriverVehicleControl(obj) sessionLogic.vehicles.ConditionalDriverVehicleControl(obj)
sessionLogic.general.unaccessContainer(obj) sessionLogic.general.unaccessContainer(obj)
case obj: Vehicle => case obj: Vehicle =>
ops.killedWhileMounted(obj, filter.resolvedPlayerGuid) ops.killedWhileMounted(obj, resolvedGuid)
sessionLogic.vehicles.ConditionalDriverVehicleControl(obj) sessionLogic.vehicles.ConditionalDriverVehicleControl(obj)
case obj: PlanetSideGameObject with Mountable with Container if obj.Destroyed => case obj: PlanetSideGameObject with Mountable with Container if obj.Destroyed =>
ops.killedWhileMounted(obj, filter.resolvedPlayerGuid) ops.killedWhileMounted(obj, resolvedGuid)
sessionLogic.general.unaccessContainer(obj) sessionLogic.general.unaccessContainer(obj)
case obj: PlanetSideGameObject with Mountable with Container => case obj: PlanetSideGameObject with Mountable with Container =>
ops.killedWhileMounted(obj, filter.resolvedPlayerGuid) ops.killedWhileMounted(obj, resolvedGuid)
case obj: PlanetSideGameObject with Mountable => case obj: PlanetSideGameObject with Mountable =>
ops.killedWhileMounted(obj, filter.resolvedPlayerGuid) ops.killedWhileMounted(obj, resolvedGuid)
} }
//player state changes //player state changes
sessionLogic.general.dropSpecialSlotItem() sessionLogic.general.dropSpecialSlotItem()
@ -451,11 +451,11 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
//render //render
CustomerServiceRepresentativeMode.renderPlayer(sessionLogic, continent, player) CustomerServiceRepresentativeMode.renderPlayer(sessionLogic, continent, player)
case AvatarAction.ReleasePlayer(tplayer) if filter.isNotSameTarget => case AvatarAction.ReleasePlayer(tplayer) if isNotSameTarget =>
sessionLogic.zoning.spawn.DepictPlayerAsCorpse(tplayer) sessionLogic.zoning.spawn.DepictPlayerAsCorpse(tplayer)
case AvatarAction.Revive(revivalTargetGuid) case AvatarAction.Revive(revivalTargetGuid)
if filter.resolvedPlayerGuid == revivalTargetGuid => if resolvedGuid == revivalTargetGuid =>
ops.revive() ops.revive()
player.Actor ! Player.Revive player.Actor ! Player.Revive
player.History player.History
@ -470,18 +470,18 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
/* uncommon messages (utility, or once in a while) */ /* uncommon messages (utility, or once in a while) */
case ChangeAmmo(weapon_guid, weapon_slot, previous_guid, ammo_id, ammo_guid, ammo_data) case ChangeAmmo(weapon_guid, weapon_slot, previous_guid, ammo_id, ammo_guid, ammo_data)
if filter.isNotSameTarget && ops.lastSeenStreamMessage.get(filter.resolvedPlayerGuid.guid).exists { _.visible } => if isNotSameTarget && ops.lastSeenStreamMessage.get(resolvedGuid.guid).exists { _.visible } =>
ops.changeAmmoProcedure(weapon_guid, previous_guid, ammo_id, ammo_guid, weapon_slot, ammo_data) ops.changeAmmoProcedure(weapon_guid, previous_guid, ammo_id, ammo_guid, weapon_slot, ammo_data)
sendResponse(ChangeAmmoMessage(weapon_guid, 1)) sendResponse(ChangeAmmoMessage(weapon_guid, 1))
case AvatarAction.ChangeFireMode(itemGuid, mode) if filter.isNotSameTarget => case AvatarAction.ChangeFireMode(itemGuid, mode) if isNotSameTarget =>
sendResponse(ChangeFireModeMessage(itemGuid, mode)) sendResponse(ChangeFireModeMessage(itemGuid, mode))
case AvatarAction.EnvironmentalDamage(_, _, _) => case AvatarAction.EnvironmentalDamage(_, _, _) =>
//TODO damage marker? //TODO damage marker?
sessionLogic.zoning.CancelZoningProcess() sessionLogic.zoning.CancelZoningProcess()
case AvatarAction.DropCreatedItem(pkt) if filter.isNotSameTarget => case AvatarAction.DropCreatedItem(pkt) if isNotSameTarget =>
sendResponse(pkt) sendResponse(pkt)
/* rare messages */ /* rare messages */
@ -494,10 +494,10 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
vehicle.flatMap { vinfo => Some(DrowningTarget(vinfo.guid, vinfo.progress, vinfo.state)) } vehicle.flatMap { vinfo => Some(DrowningTarget(vinfo.guid, vinfo.progress, vinfo.state)) }
)) ))
case AvatarAction.LoadCreatedProjectile(pkt) if filter.isNotSameTarget => case AvatarAction.LoadCreatedProjectile(pkt) if isNotSameTarget =>
sendResponse(pkt) sendResponse(pkt)
case AvatarAction.ProjectileState(projectileGuid, shotPos, shotVel, shotOrient, seq, end, targetGuid) if filter.isNotSameTarget => case AvatarAction.ProjectileState(projectileGuid, shotPos, shotVel, shotOrient, seq, end, targetGuid) if isNotSameTarget =>
sendResponse(ProjectileStateMessage(projectileGuid, shotPos, shotVel, shotOrient, seq, end, targetGuid)) sendResponse(ProjectileStateMessage(projectileGuid, shotPos, shotVel, shotOrient, seq, end, targetGuid))
case AvatarAction.ProjectileExplodes(projectileGuid, projectile) => case AvatarAction.ProjectileExplodes(projectileGuid, projectile) =>
@ -517,10 +517,10 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
case AvatarAction.ProjectileAutoLockAwareness(mode) => case AvatarAction.ProjectileAutoLockAwareness(mode) =>
sendResponse(GenericActionMessage(mode)) sendResponse(GenericActionMessage(mode))
case AvatarAction.PutDownFDU(target) if filter.isNotSameTarget => case AvatarAction.PutDownFDU(target) if isNotSameTarget =>
sendResponse(GenericObjectActionMessage(target, code=53)) sendResponse(GenericObjectActionMessage(target, code=53))
case AvatarAction.StowEquipment(target, slot, item) if filter.isNotSameTarget => case AvatarAction.StowEquipment(target, slot, item) if isNotSameTarget =>
val definition = item.Definition val definition = item.Definition
sendResponse( sendResponse(
ObjectCreateDetailedMessage( ObjectCreateDetailedMessage(
@ -532,7 +532,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
) )
case WeaponDryFire(weaponGuid) case WeaponDryFire(weaponGuid)
if filter.isNotSameTarget && ops.lastSeenStreamMessage.get(filter.resolvedPlayerGuid.guid).exists { _.visible } => if isNotSameTarget && ops.lastSeenStreamMessage.get(resolvedGuid.guid).exists { _.visible } =>
continent.GUID(weaponGuid).collect { continent.GUID(weaponGuid).collect {
case tool: Tool if tool.Magazine == 0 => case tool: Tool if tool.Magazine == 0 =>
// check that the magazine is still empty before sending WeaponDryFireMessage // check that the magazine is still empty before sending WeaponDryFireMessage

View file

@ -66,9 +66,9 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
isCloaking, isCloaking,
isNotRendered, isNotRendered,
canSeeReallyFar canSeeReallyFar
) if filter.isNotSameTarget => ) if isNotSameTarget =>
val pstateToSave = pstate.copy(timestamp = 0) val pstateToSave = pstate.copy(timestamp = 0)
val (lastMsg, lastTime, lastPosition, wasVisible, wasShooting) = ops.lastSeenStreamMessage.get(filter.resolvedPlayerGuid.guid) match { val (lastMsg, lastTime, lastPosition, wasVisible, wasShooting) = ops.lastSeenStreamMessage.get(resolvedGuid.guid) match {
case Some(SessionAvatarHandlers.LastUpstream(Some(msg), visible, shooting, time)) => (Some(msg), time, msg.pos, visible, shooting) case Some(SessionAvatarHandlers.LastUpstream(Some(msg), visible, shooting, time)) => (Some(msg), time, msg.pos, visible, shooting)
case _ => (None, 0L, Vector3.Zero, false, None) case _ => (None, 0L, Vector3.Zero, false, None)
} }
@ -111,7 +111,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
//must draw //must draw
sendResponse( sendResponse(
PlayerStateMessage( PlayerStateMessage(
filter.resolvedPlayerGuid, resolvedGuid,
pos, pos,
vel, vel,
yaw, yaw,
@ -124,10 +124,10 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
isCloaking isCloaking
) )
) )
ops.lastSeenStreamMessage.put(filter.resolvedPlayerGuid.guid, SessionAvatarHandlers.LastUpstream(Some(pstateToSave), visible=true, wasShooting, now)) ops.lastSeenStreamMessage.put(resolvedGuid.guid, SessionAvatarHandlers.LastUpstream(Some(pstateToSave), visible=true, wasShooting, now))
} else { } else {
//is visible, but skip reinforcement //is visible, but skip reinforcement
ops.lastSeenStreamMessage.put(filter.resolvedPlayerGuid.guid, SessionAvatarHandlers.LastUpstream(Some(pstateToSave), visible=true, wasShooting, lastTime)) ops.lastSeenStreamMessage.put(resolvedGuid.guid, SessionAvatarHandlers.LastUpstream(Some(pstateToSave), visible=true, wasShooting, lastTime))
} }
} else { } else {
//conditions where the target is not currently visible //conditions where the target is not currently visible
@ -136,7 +136,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
val lat = (1 + ops.hidingPlayerRandomizer.nextInt(continent.map.scale.height.toInt)).toFloat val lat = (1 + ops.hidingPlayerRandomizer.nextInt(continent.map.scale.height.toInt)).toFloat
sendResponse( sendResponse(
PlayerStateMessage( PlayerStateMessage(
filter.resolvedPlayerGuid, resolvedGuid,
Vector3(1f, lat, 1f), Vector3(1f, lat, 1f),
vel=None, vel=None,
facingYaw=0f, facingYaw=0f,
@ -146,28 +146,28 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
is_cloaked = isCloaking is_cloaked = isCloaking
) )
) )
ops.lastSeenStreamMessage.put(filter.resolvedPlayerGuid.guid, SessionAvatarHandlers.LastUpstream(Some(pstateToSave), visible=false, wasShooting, now)) ops.lastSeenStreamMessage.put(resolvedGuid.guid, SessionAvatarHandlers.LastUpstream(Some(pstateToSave), visible=false, wasShooting, now))
} else { } else {
//skip drawing altogether //skip drawing altogether
ops.lastSeenStreamMessage.put(filter.resolvedPlayerGuid.guid, SessionAvatarHandlers.LastUpstream(Some(pstateToSave), visible=false, wasShooting, lastTime)) ops.lastSeenStreamMessage.put(resolvedGuid.guid, SessionAvatarHandlers.LastUpstream(Some(pstateToSave), visible=false, wasShooting, lastTime))
} }
} }
case AvatarAction.AvatarImplant(ImplantAction.Add, implant_slot, value) case AvatarAction.AvatarImplant(ImplantAction.Add, implant_slot, value)
if value == ImplantType.SecondWind.value => if value == ImplantType.SecondWind.value =>
sendResponse(AvatarImplantMessage(filter.resolvedPlayerGuid, ImplantAction.Add, implant_slot, 7)) sendResponse(AvatarImplantMessage(resolvedGuid, ImplantAction.Add, implant_slot, 7))
//second wind does not normally load its icon into the shortcut hotbar //second wind does not normally load its icon into the shortcut hotbar
avatar avatar
.shortcuts .shortcuts
.zipWithIndex .zipWithIndex
.find { case (s, _) => s.isEmpty} .find { case (s, _) => s.isEmpty}
.foreach { case (_, index) => .foreach { case (_, index) =>
sendResponse(CreateShortcutMessage(filter.resolvedPlayerGuid, index + 1, Some(ImplantType.SecondWind.shortcut))) sendResponse(CreateShortcutMessage(resolvedGuid, index + 1, Some(ImplantType.SecondWind.shortcut)))
} }
case AvatarAction.AvatarImplant(ImplantAction.Remove, implant_slot, value) case AvatarAction.AvatarImplant(ImplantAction.Remove, implant_slot, value)
if value == ImplantType.SecondWind.value => if value == ImplantType.SecondWind.value =>
sendResponse(AvatarImplantMessage(filter.resolvedPlayerGuid, ImplantAction.Remove, implant_slot, value)) sendResponse(AvatarImplantMessage(resolvedGuid, ImplantAction.Remove, implant_slot, value))
//second wind does not normally unload its icon from the shortcut hotbar //second wind does not normally unload its icon from the shortcut hotbar
val shortcut = { val shortcut = {
val imp = ImplantType.SecondWind.shortcut val imp = ImplantType.SecondWind.shortcut
@ -178,15 +178,15 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
.zipWithIndex .zipWithIndex
.find { case (s, _) => s.contains(shortcut) } .find { case (s, _) => s.contains(shortcut) }
.foreach { case (_, index) => .foreach { case (_, index) =>
sendResponse(CreateShortcutMessage(filter.resolvedPlayerGuid, index + 1, None)) sendResponse(CreateShortcutMessage(resolvedGuid, index + 1, None))
} }
case AvatarAction.AvatarImplant(action, implant_slot, value) => case AvatarAction.AvatarImplant(action, implant_slot, value) =>
sendResponse(AvatarImplantMessage(filter.resolvedPlayerGuid, action, implant_slot, value)) sendResponse(AvatarImplantMessage(resolvedGuid, action, implant_slot, value))
case AvatarAction.ObjectHeld(slot, _) case AvatarAction.ObjectHeld(slot, _)
if filter.isSameTarget && player.VisibleSlots.contains(slot) => if isSameTarget && player.VisibleSlots.contains(slot) =>
sendResponse(ObjectHeldMessage(filter.resolvedPlayerGuid, slot, unk1=true)) sendResponse(ObjectHeldMessage(resolvedGuid, slot, unk1=true))
//Stop using proximity terminals if player unholsters a weapon //Stop using proximity terminals if player unholsters a weapon
continent.GUID(sessionLogic.terminals.usingMedicalTerminal).collect { continent.GUID(sessionLogic.terminals.usingMedicalTerminal).collect {
case term: Terminal with ProximityUnit => sessionLogic.terminals.StopUsingProximityUnit(term) case term: Terminal with ProximityUnit => sessionLogic.terminals.StopUsingProximityUnit(term)
@ -196,35 +196,35 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
} }
case AvatarAction.ObjectHeld(slot, _) case AvatarAction.ObjectHeld(slot, _)
if filter.isSameTarget && slot > -1 => if isSameTarget && slot > -1 =>
sendResponse(ObjectHeldMessage(filter.resolvedPlayerGuid, slot, unk1=true)) sendResponse(ObjectHeldMessage(resolvedGuid, slot, unk1=true))
case AvatarAction.ObjectHeld(_, _) case AvatarAction.ObjectHeld(_, _)
if filter.isSameTarget => () if isSameTarget => ()
case AvatarAction.ObjectHeld(_, previousSlot) => case AvatarAction.ObjectHeld(_, previousSlot) =>
sendResponse(ObjectHeldMessage(filter.resolvedPlayerGuid, previousSlot, unk1=false)) sendResponse(ObjectHeldMessage(resolvedGuid, previousSlot, unk1=false))
case ChangeFireState_Start(weaponGuid) case ChangeFireState_Start(weaponGuid)
if filter.isNotSameTarget && ops.lastSeenStreamMessage.get(filter.resolvedPlayerGuid.guid).exists { _.visible } => if isNotSameTarget && ops.lastSeenStreamMessage.get(resolvedGuid.guid).exists { _.visible } =>
sendResponse(ChangeFireStateMessage_Start(weaponGuid)) sendResponse(ChangeFireStateMessage_Start(weaponGuid))
val entry = ops.lastSeenStreamMessage(filter.resolvedPlayerGuid.guid) val entry = ops.lastSeenStreamMessage(resolvedGuid.guid)
ops.lastSeenStreamMessage.put(filter.resolvedPlayerGuid.guid, entry.copy(shooting = Some(weaponGuid))) ops.lastSeenStreamMessage.put(resolvedGuid.guid, entry.copy(shooting = Some(weaponGuid)))
case ChangeFireState_Stop(weaponGuid) case ChangeFireState_Stop(weaponGuid)
if filter.isNotSameTarget && ops.lastSeenStreamMessage.get(filter.resolvedPlayerGuid.guid).exists { msg => msg.visible || msg.shooting.nonEmpty } => if isNotSameTarget && ops.lastSeenStreamMessage.get(resolvedGuid.guid).exists { msg => msg.visible || msg.shooting.nonEmpty } =>
sendResponse(ChangeFireStateMessage_Stop(weaponGuid)) sendResponse(ChangeFireStateMessage_Stop(weaponGuid))
val entry = ops.lastSeenStreamMessage(filter.resolvedPlayerGuid.guid) val entry = ops.lastSeenStreamMessage(resolvedGuid.guid)
ops.lastSeenStreamMessage.put(filter.resolvedPlayerGuid.guid, entry.copy(shooting = None)) ops.lastSeenStreamMessage.put(resolvedGuid.guid, entry.copy(shooting = None))
case AvatarAction.LoadCreatedPlayer(pkt) if filter.isNotSameTarget => case AvatarAction.LoadCreatedPlayer(pkt) if isNotSameTarget =>
sendResponse(pkt) sendResponse(pkt)
case AvatarAction.EquipmentCreatedInHand(pkt) if filter.isNotSameTarget => case AvatarAction.EquipmentCreatedInHand(pkt) if isNotSameTarget =>
sendResponse(pkt) sendResponse(pkt)
case AvatarAction.PlanetsideStringAttribute(attributeType, attributeValue) => case AvatarAction.PlanetsideStringAttribute(attributeType, attributeValue) =>
sendResponse(PlanetsideStringAttributeMessage(filter.resolvedPlayerGuid, attributeType, attributeValue)) sendResponse(PlanetsideStringAttributeMessage(resolvedGuid, attributeType, attributeValue))
case AvatarAction.Destroy(victim, killer, weapon, pos) => case AvatarAction.Destroy(victim, killer, weapon, pos) =>
// guid = victim // killer = killer // guid = victim // killer = killer
@ -260,7 +260,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
inventory, inventory,
drop, drop,
delete delete
) if filter.resolvedPlayerGuid == target => ) if resolvedGuid == target =>
sendResponse(ArmorChangedMessage(target, exosuit, subtype)) sendResponse(ArmorChangedMessage(target, exosuit, subtype))
sendResponse(PlanetsideAttributeMessage(target, attribute_type=4, armor)) sendResponse(PlanetsideAttributeMessage(target, attribute_type=4, armor))
//happening to this player //happening to this player
@ -360,7 +360,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
oldInventory, oldInventory,
inventory, inventory,
drops drops
) if filter.resolvedPlayerGuid == target => ) if resolvedGuid == target =>
sendResponse(ArmorChangedMessage(target, exosuit, subtype)) sendResponse(ArmorChangedMessage(target, exosuit, subtype))
sendResponse(PlanetsideAttributeMessage(target, attribute_type=4, armor)) sendResponse(PlanetsideAttributeMessage(target, attribute_type=4, armor))
//happening to this player //happening to this player
@ -400,9 +400,9 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
case AvatarAction.UseKit(kguid, kObjId) => case AvatarAction.UseKit(kguid, kObjId) =>
sendResponse( sendResponse(
UseItemMessage( UseItemMessage(
filter.resolvedPlayerGuid, resolvedGuid,
kguid, kguid,
filter.resolvedPlayerGuid, resolvedGuid,
unk2 = 4294967295L, unk2 = 4294967295L,
unk3 = false, unk3 = false,
unk4 = Vector3.Zero, unk4 = Vector3.Zero,
@ -451,7 +451,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
/* common messages (maybe once every respawn) */ /* common messages (maybe once every respawn) */
case ReloadTool(itemGuid) case ReloadTool(itemGuid)
if filter.isNotSameTarget && ops.lastSeenStreamMessage.get(filter.resolvedPlayerGuid.guid).exists { _.visible } => if isNotSameTarget && ops.lastSeenStreamMessage.get(resolvedGuid.guid).exists { _.visible } =>
sendResponse(ReloadMessage(itemGuid, ammo_clip=1, unk1=0)) sendResponse(ReloadMessage(itemGuid, ammo_clip=1, unk1=0))
case AvatarAction.Killed(cause, mount) => case AvatarAction.Killed(cause, mount) =>
@ -517,16 +517,16 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
sessionLogic.zoning.spawn.deadState = DeadState.Dead sessionLogic.zoning.spawn.deadState = DeadState.Dead
continent.GUID(mount).collect { continent.GUID(mount).collect {
case obj: Vehicle => case obj: Vehicle =>
killedWhileMounted(obj, filter.resolvedPlayerGuid) killedWhileMounted(obj, resolvedGuid)
sessionLogic.vehicles.ConditionalDriverVehicleControl(obj) sessionLogic.vehicles.ConditionalDriverVehicleControl(obj)
sessionLogic.general.unaccessContainer(obj) sessionLogic.general.unaccessContainer(obj)
case obj: PlanetSideGameObject with Mountable with Container => case obj: PlanetSideGameObject with Mountable with Container =>
killedWhileMounted(obj, filter.resolvedPlayerGuid) killedWhileMounted(obj, resolvedGuid)
sessionLogic.general.unaccessContainer(obj) sessionLogic.general.unaccessContainer(obj)
case obj: PlanetSideGameObject with Mountable => case obj: PlanetSideGameObject with Mountable =>
killedWhileMounted(obj, filter.resolvedPlayerGuid) killedWhileMounted(obj, resolvedGuid)
} }
sessionLogic.actionsToCancel() sessionLogic.actionsToCancel()
sessionLogic.terminals.CancelAllProximityUnits() sessionLogic.terminals.CancelAllProximityUnits()
@ -544,11 +544,11 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
sessionLogic.zoning.spawn.HandleReleaseAvatar(player, continent) sessionLogic.zoning.spawn.HandleReleaseAvatar(player, continent)
} }
case AvatarAction.ReleasePlayer(tplayer) if filter.isNotSameTarget => case AvatarAction.ReleasePlayer(tplayer) if isNotSameTarget =>
sessionLogic.zoning.spawn.DepictPlayerAsCorpse(tplayer) sessionLogic.zoning.spawn.DepictPlayerAsCorpse(tplayer)
case AvatarAction.Revive(revivalTargetGuid) case AvatarAction.Revive(revivalTargetGuid)
if filter.resolvedPlayerGuid == revivalTargetGuid => if resolvedGuid == revivalTargetGuid =>
log.info(s"No time for rest, ${player.Name}. Back on your feet!") log.info(s"No time for rest, ${player.Name}. Back on your feet!")
ops.revive() ops.revive()
player.Actor ! Player.Revive player.Actor ! Player.Revive
@ -564,18 +564,18 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
/* uncommon messages (utility, or once in a while) */ /* uncommon messages (utility, or once in a while) */
case ChangeAmmo(weapon_guid, weapon_slot, previous_guid, ammo_id, ammo_guid, ammo_data) case ChangeAmmo(weapon_guid, weapon_slot, previous_guid, ammo_id, ammo_guid, ammo_data)
if filter.isNotSameTarget && ops.lastSeenStreamMessage.get(filter.resolvedPlayerGuid.guid).exists { _.visible } => if isNotSameTarget && ops.lastSeenStreamMessage.get(resolvedGuid.guid).exists { _.visible } =>
ops.changeAmmoProcedure(weapon_guid, previous_guid, ammo_id, ammo_guid, weapon_slot, ammo_data) ops.changeAmmoProcedure(weapon_guid, previous_guid, ammo_id, ammo_guid, weapon_slot, ammo_data)
sendResponse(ChangeAmmoMessage(weapon_guid, 1)) sendResponse(ChangeAmmoMessage(weapon_guid, 1))
case AvatarAction.ChangeFireMode(itemGuid, mode) if filter.isNotSameTarget => case AvatarAction.ChangeFireMode(itemGuid, mode) if isNotSameTarget =>
sendResponse(ChangeFireModeMessage(itemGuid, mode)) sendResponse(ChangeFireModeMessage(itemGuid, mode))
case AvatarAction.EnvironmentalDamage(_, _, _) => case AvatarAction.EnvironmentalDamage(_, _, _) =>
//TODO damage marker? //TODO damage marker?
sessionLogic.zoning.CancelZoningProcessWithDescriptiveReason("cancel_dmg") sessionLogic.zoning.CancelZoningProcessWithDescriptiveReason("cancel_dmg")
case AvatarAction.DropCreatedItem(pkt) if filter.isNotSameTarget => case AvatarAction.DropCreatedItem(pkt) if isNotSameTarget =>
sendResponse(pkt) sendResponse(pkt)
/* rare messages */ /* rare messages */
@ -588,10 +588,10 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
vehicle.flatMap { vinfo => Some(DrowningTarget(vinfo.guid, vinfo.progress, vinfo.state)) } vehicle.flatMap { vinfo => Some(DrowningTarget(vinfo.guid, vinfo.progress, vinfo.state)) }
)) ))
case AvatarAction.LoadCreatedProjectile(pkt) if filter.isNotSameTarget => case AvatarAction.LoadCreatedProjectile(pkt) if isNotSameTarget =>
sendResponse(pkt) sendResponse(pkt)
case AvatarAction.ProjectileState(projectileGuid, shotPos, shotVel, shotOrient, seq, end, targetGuid) if filter.isNotSameTarget => case AvatarAction.ProjectileState(projectileGuid, shotPos, shotVel, shotOrient, seq, end, targetGuid) if isNotSameTarget =>
sendResponse(ProjectileStateMessage(projectileGuid, shotPos, shotVel, shotOrient, seq, end, targetGuid)) sendResponse(ProjectileStateMessage(projectileGuid, shotPos, shotVel, shotOrient, seq, end, targetGuid))
case AvatarAction.ProjectileExplodes(projectileGuid, projectile) => case AvatarAction.ProjectileExplodes(projectileGuid, projectile) =>
@ -611,10 +611,10 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
case AvatarAction.ProjectileAutoLockAwareness(mode) => case AvatarAction.ProjectileAutoLockAwareness(mode) =>
sendResponse(GenericActionMessage(mode)) sendResponse(GenericActionMessage(mode))
case AvatarAction.PutDownFDU(target) if filter.isNotSameTarget => case AvatarAction.PutDownFDU(target) if isNotSameTarget =>
sendResponse(GenericObjectActionMessage(target, code=53)) sendResponse(GenericObjectActionMessage(target, code=53))
case AvatarAction.StowEquipment(target, slot, item) if filter.isNotSameTarget => case AvatarAction.StowEquipment(target, slot, item) if isNotSameTarget =>
val definition = item.Definition val definition = item.Definition
sendResponse( sendResponse(
ObjectCreateDetailedMessage( ObjectCreateDetailedMessage(
@ -626,7 +626,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
) )
case WeaponDryFire(weaponGuid) case WeaponDryFire(weaponGuid)
if filter.isNotSameTarget && ops.lastSeenStreamMessage.get(filter.resolvedPlayerGuid.guid).exists { _.visible } => if isNotSameTarget && ops.lastSeenStreamMessage.get(resolvedGuid.guid).exists { _.visible } =>
continent.GUID(weaponGuid).collect { continent.GUID(weaponGuid).collect {
case tool: Tool if tool.Magazine == 0 => case tool: Tool if tool.Magazine == 0 =>
// check that the magazine is still empty before sending WeaponDryFireMessage // check that the magazine is still empty before sending WeaponDryFireMessage

View file

@ -49,7 +49,7 @@ class LocalHandlerLogic(val ops: SessionLocalHandlers, implicit val context: Act
sendResponse(msg) sendResponse(msg)
} }
case LocalAction.DeployableMapIcon(behavior, deployInfo) if filter.isNotSameTarget => case LocalAction.DeployableMapIcon(behavior, deployInfo) if isNotSameTarget =>
sendResponse(DeployableObjectsInfoMessage(behavior, deployInfo)) sendResponse(DeployableObjectsInfoMessage(behavior, deployInfo))
case LocalAction.DeployableUIFor(item) => case LocalAction.DeployableUIFor(item) =>
@ -68,7 +68,7 @@ class LocalHandlerLogic(val ops: SessionLocalHandlers, implicit val context: Act
case LocalAction.Detonate(_, obj) => case LocalAction.Detonate(_, obj) =>
log.warn(s"LocalAction.Detonate: ${obj.Definition.Name} not configured to explode correctly") log.warn(s"LocalAction.Detonate: ${obj.Definition.Name} not configured to explode correctly")
case LocalAction.DoorOpens(_, door) if filter.isNotSameTarget => case LocalAction.DoorOpens(_, door) if isNotSameTarget =>
val doorGuid = door.GUID val doorGuid = door.GUID
val pos = player.Position.xy val pos = player.Position.xy
val range = ops.doorLoadRange() val range = ops.doorLoadRange()
@ -139,7 +139,7 @@ class LocalHandlerLogic(val ops: SessionLocalHandlers, implicit val context: Act
ops.DeconstructDeployable(obj, dguid, pos, obj.Orientation, effect) ops.DeconstructDeployable(obj, dguid, pos, obj.Orientation, effect)
case LocalAction.HackClear(targetGuid, unk1, unk2) => case LocalAction.HackClear(targetGuid, unk1, unk2) =>
sendResponse(HackMessage(HackState1.Unk0, targetGuid, filter.resolvedPlayerGuid, progress=0, unk1.toFloat, HackState.HackCleared, unk2)) sendResponse(HackMessage(HackState1.Unk0, targetGuid, resolvedGuid, progress=0, unk1.toFloat, HackState.HackCleared, unk2))
case LocalAction.HackObject(targetGuid, unk1, unk2) => case LocalAction.HackObject(targetGuid, unk1, unk2) =>
sessionLogic.general.hackObject(targetGuid, unk1, unk2) sessionLogic.general.hackObject(targetGuid, unk1, unk2)
@ -216,7 +216,7 @@ class LocalHandlerLogic(val ops: SessionLocalHandlers, implicit val context: Act
case LocalAction.UpdateForceDomeStatus(buildingGuid, false) => case LocalAction.UpdateForceDomeStatus(buildingGuid, false) =>
sendResponse(GenericObjectActionMessage(buildingGuid, 12)) sendResponse(GenericObjectActionMessage(buildingGuid, 12))
case LocalAction.RechargeVehicleWeapon(vehicleGuid, weaponGuid) if filter.isSameTarget /*resolvedPlayerGuid == guid*/ => case LocalAction.RechargeVehicleWeapon(vehicleGuid, weaponGuid) if isSameTarget /*resolvedPlayerGuid == guid*/ =>
continent.GUID(vehicleGuid) continent.GUID(vehicleGuid)
.collect { case vehicle: MountableWeapons => (vehicle, vehicle.PassengerInSeat(player)) } .collect { case vehicle: MountableWeapons => (vehicle, vehicle.PassengerInSeat(player)) }
.collect { case (vehicle, Some(seat_num)) => vehicle.WeaponControlledFromSeat(seat_num) } .collect { case (vehicle, Some(seat_num)) => vehicle.WeaponControlledFromSeat(seat_num) }

View file

@ -47,7 +47,7 @@ class VehicleHandlerLogic(val ops: SessionVehicleHandlers, implicit val context:
wheelDirection, wheelDirection,
unk5, unk5,
unk6 unk6
) if filter.isNotSameTarget && player.VehicleSeated.contains(vehicleGuid) => ) if isNotSameTarget && player.VehicleSeated.contains(vehicleGuid) =>
//player who is also in the vehicle (not driver) //player who is also in the vehicle (not driver)
sendResponse(VehicleStateMessage(vehicleGuid, unk1, pos, orient, vel, unk2, unk3, unk4, wheelDirection, unk5, unk6)) sendResponse(VehicleStateMessage(vehicleGuid, unk1, pos, orient, vel, unk2, unk3, unk4, wheelDirection, unk5, unk6))
player.Position = pos player.Position = pos
@ -75,30 +75,30 @@ class VehicleHandlerLogic(val ops: SessionVehicleHandlers, implicit val context:
wheelDirection, wheelDirection,
unk5, unk5,
unk6 unk6
) if filter.isNotSameTarget => ) if isNotSameTarget =>
//player who is watching the vehicle from the outside //player who is watching the vehicle from the outside
sendResponse(VehicleStateMessage(vehicleGuid, unk1, pos, ang, vel, unk2, unk3, unk4, wheelDirection, unk5, unk6)) sendResponse(VehicleStateMessage(vehicleGuid, unk1, pos, ang, vel, unk2, unk3, unk4, wheelDirection, unk5, unk6))
case VehicleAction.ChildObjectState(objectGuid, pitch, yaw) if filter.isNotSameTarget => case VehicleAction.ChildObjectState(objectGuid, pitch, yaw) if isNotSameTarget =>
sendResponse(ChildObjectStateMessage(objectGuid, pitch, yaw)) sendResponse(ChildObjectStateMessage(objectGuid, pitch, yaw))
case VehicleAction.FrameVehicleState(vguid, u1, pos, oient, vel, u2, u3, u4, is_crouched, u6, u7, u8, u9, uA) case VehicleAction.FrameVehicleState(vguid, u1, pos, oient, vel, u2, u3, u4, is_crouched, u6, u7, u8, u9, uA)
if filter.isNotSameTarget => if isNotSameTarget =>
sendResponse(FrameVehicleStateMessage(vguid, u1, pos, oient, vel, u2, u3, u4, is_crouched, u6, u7, u8, u9, uA)) sendResponse(FrameVehicleStateMessage(vguid, u1, pos, oient, vel, u2, u3, u4, is_crouched, u6, u7, u8, u9, uA))
case VehicleAction.DismountVehicle(bailType, wasKickedByDriver) if filter.isNotSameTarget => case VehicleAction.DismountVehicle(bailType, wasKickedByDriver) if isNotSameTarget =>
sendResponse(DismountVehicleMsg(filter.resolvedPlayerGuid, bailType, wasKickedByDriver)) sendResponse(DismountVehicleMsg(resolvedGuid, bailType, wasKickedByDriver))
case VehicleAction.MountVehicle(vehicleGuid, seat) if filter.isNotSameTarget => case VehicleAction.MountVehicle(vehicleGuid, seat) if isNotSameTarget =>
sendResponse(ObjectAttachMessage(vehicleGuid, filter.resolvedPlayerGuid, seat)) sendResponse(ObjectAttachMessage(vehicleGuid, resolvedGuid, seat))
case VehicleAction.DeployRequest(objectGuid, state, unk1, unk2, pos) if filter.isNotSameTarget => case VehicleAction.DeployRequest(objectGuid, state, unk1, unk2, pos) if isNotSameTarget =>
sendResponse(DeployRequestMessage(filter.resolvedPlayerGuid, objectGuid, state, unk1, unk2, pos)) sendResponse(DeployRequestMessage(resolvedGuid, objectGuid, state, unk1, unk2, pos))
case VehicleAction.EquipmentCreatedInSlot(pkt) if filter.isNotSameTarget => case VehicleAction.EquipmentCreatedInSlot(pkt) if isNotSameTarget =>
sendResponse(pkt) sendResponse(pkt)
case VehicleAction.InventoryState(obj, parentGuid, start, conData) if filter.isNotSameTarget => case VehicleAction.InventoryState(obj, parentGuid, start, conData) if isNotSameTarget =>
//TODO prefer ObjectDetachMessage, but how to force ammo pools to update properly? //TODO prefer ObjectDetachMessage, but how to force ammo pools to update properly?
val objGuid = obj.GUID val objGuid = obj.GUID
sendResponse(ObjectDeleteMessage(objGuid, unk1=0)) sendResponse(ObjectDeleteMessage(objGuid, unk1=0))
@ -109,10 +109,10 @@ class VehicleHandlerLogic(val ops: SessionVehicleHandlers, implicit val context:
conData conData
)) ))
case VehicleAction.KickPassenger(_, wasKickedByDriver, vehicleGuid) if filter.isSameTarget /*resolvedPlayerGuid == guid*/ => case VehicleAction.KickPassenger(_, wasKickedByDriver, vehicleGuid) if isSameTarget /*resolvedPlayerGuid == guid*/ =>
//seat number (first field) seems to be correct if passenger is kicked manually by driver //seat number (first field) seems to be correct if passenger is kicked manually by driver
//but always seems to return 4 if user is kicked by mount permissions changing //but always seems to return 4 if user is kicked by mount permissions changing
sendResponse(DismountVehicleMsg(filter.resolvedPlayerGuid, BailType.Kicked, wasKickedByDriver)) sendResponse(DismountVehicleMsg(resolvedGuid, BailType.Kicked, wasKickedByDriver))
val typeOfRide = continent.GUID(vehicleGuid) match { val typeOfRide = continent.GUID(vehicleGuid) match {
case Some(obj: Vehicle) => case Some(obj: Vehicle) =>
sessionLogic.general.unaccessContainer(obj) sessionLogic.general.unaccessContainer(obj)
@ -126,28 +126,28 @@ class VehicleHandlerLogic(val ops: SessionVehicleHandlers, implicit val context:
case VehicleAction.KickPassenger(_, wasKickedByDriver, _) => case VehicleAction.KickPassenger(_, wasKickedByDriver, _) =>
//seat number (first field) seems to be correct if passenger is kicked manually by driver //seat number (first field) seems to be correct if passenger is kicked manually by driver
//but always seems to return 4 if user is kicked by mount permissions changing //but always seems to return 4 if user is kicked by mount permissions changing
sendResponse(DismountVehicleMsg(filter.resolvedPlayerGuid, BailType.Kicked, wasKickedByDriver)) sendResponse(DismountVehicleMsg(resolvedGuid, BailType.Kicked, wasKickedByDriver))
case VehicleAction.InventoryState2(objGuid, parentGuid, value) if filter.isNotSameTarget => case VehicleAction.InventoryState2(objGuid, parentGuid, value) if isNotSameTarget =>
sendResponse(InventoryStateMessage(objGuid, unk=0, parentGuid, value)) sendResponse(InventoryStateMessage(objGuid, unk=0, parentGuid, value))
case VehicleAction.LoadVehicle(vehicle, vtype, vguid, vdata) if filter.isNotSameTarget => case VehicleAction.LoadVehicle(vehicle, vtype, vguid, vdata) if isNotSameTarget =>
//this is not be suitable for vehicles with people who are seated in it before it spawns (if that is possible) //this is not be suitable for vehicles with people who are seated in it before it spawns (if that is possible)
sendResponse(ObjectCreateMessage(vtype, vguid, vdata)) sendResponse(ObjectCreateMessage(vtype, vguid, vdata))
Vehicles.ReloadAccessPermissions(vehicle, player.Name) Vehicles.ReloadAccessPermissions(vehicle, player.Name)
case VehicleAction.Ownership(vehicleGuid) if filter.isSameTarget /*resolvedPlayerGuid == guid*/ => case VehicleAction.Ownership(vehicleGuid) if isSameTarget /*resolvedPlayerGuid == guid*/ =>
//Only the player that owns this vehicle needs the ownership packet //Only the player that owns this vehicle needs the ownership packet
avatarActor ! AvatarActor.SetVehicle(Some(vehicleGuid)) avatarActor ! AvatarActor.SetVehicle(Some(vehicleGuid))
sendResponse(PlanetsideAttributeMessage(filter.resolvedPlayerGuid, attribute_type=21, vehicleGuid)) sendResponse(PlanetsideAttributeMessage(resolvedGuid, attribute_type=21, vehicleGuid))
case VehicleAction.LoseOwnership(_, vehicleGuid) => case VehicleAction.LoseOwnership(_, vehicleGuid) =>
ops.announceAmsDecay(vehicleGuid,msg = "@ams_decaystarted") ops.announceAmsDecay(vehicleGuid,msg = "@ams_decaystarted")
case VehicleAction.SeatPermissions(vehicleGuid, seatGroup, permission) if filter.isNotSameTarget => case VehicleAction.SeatPermissions(vehicleGuid, seatGroup, permission) if isNotSameTarget =>
sendResponse(PlanetsideAttributeMessage(vehicleGuid, seatGroup, permission)) sendResponse(PlanetsideAttributeMessage(vehicleGuid, seatGroup, permission))
case VehicleAction.StowCreatedEquipment(vehicleGuid, slot, itemType, itemGuid, itemData) if filter.isNotSameTarget => case VehicleAction.StowCreatedEquipment(vehicleGuid, slot, itemType, itemGuid, itemData) if isNotSameTarget =>
//TODO prefer ObjectAttachMessage, but how to force ammo pools to update properly? //TODO prefer ObjectAttachMessage, but how to force ammo pools to update properly?
sendResponse(ObjectCreateDetailedMessage(itemType, itemGuid, ObjectCreateMessageParent(vehicleGuid, slot), itemData)) sendResponse(ObjectCreateDetailedMessage(itemType, itemGuid, ObjectCreateMessageParent(vehicleGuid, slot), itemData))
@ -164,7 +164,7 @@ class VehicleHandlerLogic(val ops: SessionVehicleHandlers, implicit val context:
sendResponse(ChatMsg(ChatMessageType.UNK_229, "@ams_decayed")) sendResponse(ChatMsg(ChatMessageType.UNK_229, "@ams_decayed"))
} }
case VehicleAction.UnstowEquipment(itemGuid) if filter.isNotSameTarget => case VehicleAction.UnstowEquipment(itemGuid) if isNotSameTarget =>
//TODO prefer ObjectDetachMessage, but how to force ammo pools to update properly? //TODO prefer ObjectDetachMessage, but how to force ammo pools to update properly?
sendResponse(ObjectDeleteMessage(itemGuid, unk1=0)) sendResponse(ObjectDeleteMessage(itemGuid, unk1=0))
@ -172,7 +172,7 @@ class VehicleHandlerLogic(val ops: SessionVehicleHandlers, implicit val context:
sessionLogic.zoning.spawn.amsSpawnPoints = list.filter(tube => tube.Faction == player.Faction) sessionLogic.zoning.spawn.amsSpawnPoints = list.filter(tube => tube.Faction == player.Faction)
sessionLogic.zoning.spawn.DrawCurrentAmsSpawnPoint() sessionLogic.zoning.spawn.DrawCurrentAmsSpawnPoint()
case VehicleAction.TransferPassengerChannel(oldChannel, tempChannel, vehicle, vehicleToDelete) if filter.isNotSameTarget => case VehicleAction.TransferPassengerChannel(oldChannel, tempChannel, vehicle, vehicleToDelete) if isNotSameTarget =>
sessionLogic.zoning.interstellarFerry = Some(vehicle) sessionLogic.zoning.interstellarFerry = Some(vehicle)
sessionLogic.zoning.interstellarFerryTopLevelGUID = Some(vehicleToDelete) sessionLogic.zoning.interstellarFerryTopLevelGUID = Some(vehicleToDelete)
continent.VehicleEvents ! Service.Leave(oldChannel) //old vehicle-specific channel (was s"${vehicle.Actor}") continent.VehicleEvents ! Service.Leave(oldChannel) //old vehicle-specific channel (was s"${vehicle.Actor}")

View file

@ -61,9 +61,9 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
isCloaking, isCloaking,
isNotRendered, isNotRendered,
canSeeReallyFar canSeeReallyFar
) if filter.isNotSameTarget => ) if isNotSameTarget =>
val pstateToSave = pstate.copy(timestamp = 0) val pstateToSave = pstate.copy(timestamp = 0)
val (lastMsg, lastTime, lastPosition, wasVisible, wasShooting) = ops.lastSeenStreamMessage.get(filter.resolvedPlayerGuid.guid) match { val (lastMsg, lastTime, lastPosition, wasVisible, wasShooting) = ops.lastSeenStreamMessage.get(resolvedGuid.guid) match {
case Some(SessionAvatarHandlers.LastUpstream(Some(msg), visible, shooting, time)) => (Some(msg), time, msg.pos, visible, shooting) case Some(SessionAvatarHandlers.LastUpstream(Some(msg), visible, shooting, time)) => (Some(msg), time, msg.pos, visible, shooting)
case _ => (None, 0L, Vector3.Zero, false, None) case _ => (None, 0L, Vector3.Zero, false, None)
} }
@ -106,7 +106,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
//must draw //must draw
sendResponse( sendResponse(
PlayerStateMessage( PlayerStateMessage(
filter.resolvedPlayerGuid, resolvedGuid,
pos, pos,
vel, vel,
yaw, yaw,
@ -119,10 +119,10 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
isCloaking isCloaking
) )
) )
ops.lastSeenStreamMessage.put(filter.resolvedPlayerGuid.guid, SessionAvatarHandlers.LastUpstream(Some(pstateToSave), visible=true, wasShooting, now)) ops.lastSeenStreamMessage.put(resolvedGuid.guid, SessionAvatarHandlers.LastUpstream(Some(pstateToSave), visible=true, wasShooting, now))
} else { } else {
//is visible, but skip reinforcement //is visible, but skip reinforcement
ops.lastSeenStreamMessage.put(filter.resolvedPlayerGuid.guid, SessionAvatarHandlers.LastUpstream(Some(pstateToSave), visible=true, wasShooting, lastTime)) ops.lastSeenStreamMessage.put(resolvedGuid.guid, SessionAvatarHandlers.LastUpstream(Some(pstateToSave), visible=true, wasShooting, lastTime))
} }
} else { } else {
//conditions where the target is not currently visible //conditions where the target is not currently visible
@ -131,7 +131,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
val lat = (1 + ops.hidingPlayerRandomizer.nextInt(continent.map.scale.height.toInt)).toFloat val lat = (1 + ops.hidingPlayerRandomizer.nextInt(continent.map.scale.height.toInt)).toFloat
sendResponse( sendResponse(
PlayerStateMessage( PlayerStateMessage(
filter.resolvedPlayerGuid, resolvedGuid,
Vector3(1f, lat, 1f), Vector3(1f, lat, 1f),
vel=None, vel=None,
facingYaw=0f, facingYaw=0f,
@ -141,16 +141,16 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
is_cloaked = isCloaking is_cloaked = isCloaking
) )
) )
ops.lastSeenStreamMessage.put(filter.resolvedPlayerGuid.guid, SessionAvatarHandlers.LastUpstream(Some(pstateToSave), visible=false, wasShooting, now)) ops.lastSeenStreamMessage.put(resolvedGuid.guid, SessionAvatarHandlers.LastUpstream(Some(pstateToSave), visible=false, wasShooting, now))
} else { } else {
//skip drawing altogether //skip drawing altogether
ops.lastSeenStreamMessage.put(filter.resolvedPlayerGuid.guid, SessionAvatarHandlers.LastUpstream(Some(pstateToSave), visible=false, wasShooting, lastTime)) ops.lastSeenStreamMessage.put(resolvedGuid.guid, SessionAvatarHandlers.LastUpstream(Some(pstateToSave), visible=false, wasShooting, lastTime))
} }
} }
case AvatarAction.ObjectHeld(slot, _) case AvatarAction.ObjectHeld(slot, _)
if filter.isSameTarget && player.VisibleSlots.contains(slot) => if isSameTarget && player.VisibleSlots.contains(slot) =>
sendResponse(ObjectHeldMessage(filter.resolvedPlayerGuid, slot, unk1=true)) sendResponse(ObjectHeldMessage(resolvedGuid, slot, unk1=true))
//Stop using proximity terminals if player unholsters a weapon //Stop using proximity terminals if player unholsters a weapon
continent.GUID(sessionLogic.terminals.usingMedicalTerminal).collect { continent.GUID(sessionLogic.terminals.usingMedicalTerminal).collect {
case term: Terminal with ProximityUnit => sessionLogic.terminals.StopUsingProximityUnit(term) case term: Terminal with ProximityUnit => sessionLogic.terminals.StopUsingProximityUnit(term)
@ -160,31 +160,31 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
} }
case AvatarAction.ObjectHeld(slot, _) case AvatarAction.ObjectHeld(slot, _)
if filter.isSameTarget && slot > -1 => if isSameTarget && slot > -1 =>
sendResponse(ObjectHeldMessage(filter.resolvedPlayerGuid, slot, unk1=true)) sendResponse(ObjectHeldMessage(resolvedGuid, slot, unk1=true))
case AvatarAction.ObjectHeld(_, _) case AvatarAction.ObjectHeld(_, _)
if filter.isSameTarget => () if isSameTarget => ()
case AvatarAction.ObjectHeld(_, previousSlot) => case AvatarAction.ObjectHeld(_, previousSlot) =>
sendResponse(ObjectHeldMessage(filter.resolvedPlayerGuid, previousSlot, unk1=false)) sendResponse(ObjectHeldMessage(resolvedGuid, previousSlot, unk1=false))
case ChangeFireState_Start(weaponGuid) case ChangeFireState_Start(weaponGuid)
if filter.isNotSameTarget && ops.lastSeenStreamMessage.get(filter.resolvedPlayerGuid.guid).exists { _.visible } => if isNotSameTarget && ops.lastSeenStreamMessage.get(resolvedGuid.guid).exists { _.visible } =>
sendResponse(ChangeFireStateMessage_Start(weaponGuid)) sendResponse(ChangeFireStateMessage_Start(weaponGuid))
val entry = ops.lastSeenStreamMessage(filter.resolvedPlayerGuid.guid) val entry = ops.lastSeenStreamMessage(resolvedGuid.guid)
ops.lastSeenStreamMessage.put(filter.resolvedPlayerGuid.guid, entry.copy(shooting = Some(weaponGuid))) ops.lastSeenStreamMessage.put(resolvedGuid.guid, entry.copy(shooting = Some(weaponGuid)))
case ChangeFireState_Stop(weaponGuid) case ChangeFireState_Stop(weaponGuid)
if filter.isNotSameTarget && ops.lastSeenStreamMessage.get(filter.resolvedPlayerGuid.guid).exists { msg => msg.visible || msg.shooting.nonEmpty } => if isNotSameTarget && ops.lastSeenStreamMessage.get(resolvedGuid.guid).exists { msg => msg.visible || msg.shooting.nonEmpty } =>
sendResponse(ChangeFireStateMessage_Stop(weaponGuid)) sendResponse(ChangeFireStateMessage_Stop(weaponGuid))
val entry = ops.lastSeenStreamMessage(filter.resolvedPlayerGuid.guid) val entry = ops.lastSeenStreamMessage(resolvedGuid.guid)
ops.lastSeenStreamMessage.put(filter.resolvedPlayerGuid.guid, entry.copy(shooting = None)) ops.lastSeenStreamMessage.put(resolvedGuid.guid, entry.copy(shooting = None))
case AvatarAction.LoadCreatedPlayer(pkt) if filter.isNotSameTarget => case AvatarAction.LoadCreatedPlayer(pkt) if isNotSameTarget =>
sendResponse(pkt) sendResponse(pkt)
case AvatarAction.EquipmentCreatedInHand(pkt) if filter.isNotSameTarget => case AvatarAction.EquipmentCreatedInHand(pkt) if isNotSameTarget =>
sendResponse(pkt) sendResponse(pkt)
case AvatarAction.Destroy(victim, killer, weapon, pos) => case AvatarAction.Destroy(victim, killer, weapon, pos) =>
@ -217,7 +217,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
inventory, inventory,
drop, drop,
delete delete
) if filter.resolvedPlayerGuid == target => ) if resolvedGuid == target =>
sendResponse(ArmorChangedMessage(target, exosuit, subtype)) sendResponse(ArmorChangedMessage(target, exosuit, subtype))
sendResponse(PlanetsideAttributeMessage(target, attribute_type=4, armor)) sendResponse(PlanetsideAttributeMessage(target, attribute_type=4, armor))
//happening to this player //happening to this player
@ -295,7 +295,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
oldInventory, oldInventory,
inventory, inventory,
drops drops
) if filter.resolvedPlayerGuid == target => ) if resolvedGuid == target =>
sendResponse(ArmorChangedMessage(target, exosuit, subtype)) sendResponse(ArmorChangedMessage(target, exosuit, subtype))
sendResponse(PlanetsideAttributeMessage(target, attribute_type = 4, armor)) sendResponse(PlanetsideAttributeMessage(target, attribute_type = 4, armor))
//happening to this player //happening to this player
@ -329,9 +329,9 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
case AvatarAction.UseKit(kguid, kObjId) => case AvatarAction.UseKit(kguid, kObjId) =>
sendResponse( sendResponse(
UseItemMessage( UseItemMessage(
filter.resolvedPlayerGuid, resolvedGuid,
kguid, kguid,
filter.resolvedPlayerGuid, resolvedGuid,
unk2 = 4294967295L, unk2 = 4294967295L,
unk3 = false, unk3 = false,
unk4 = Vector3.Zero, unk4 = Vector3.Zero,
@ -386,7 +386,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
/* common messages (maybe once every respawn) */ /* common messages (maybe once every respawn) */
case ReloadTool(itemGuid) case ReloadTool(itemGuid)
if filter.isNotSameTarget && ops.lastSeenStreamMessage.get(filter.resolvedPlayerGuid.guid).exists { _.visible } => if isNotSameTarget && ops.lastSeenStreamMessage.get(resolvedGuid.guid).exists { _.visible } =>
sendResponse(ReloadMessage(itemGuid, ammo_clip=1, unk1=0)) sendResponse(ReloadMessage(itemGuid, ammo_clip=1, unk1=0))
case AvatarAction.Killed(_, mount) => case AvatarAction.Killed(_, mount) =>
@ -440,10 +440,10 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
sessionLogic.zoning.spawn.HandleReleaseAvatar(player, continent) sessionLogic.zoning.spawn.HandleReleaseAvatar(player, continent)
} }
case AvatarAction.ReleasePlayer(tplayer) if filter.isNotSameTarget => case AvatarAction.ReleasePlayer(tplayer) if isNotSameTarget =>
sessionLogic.zoning.spawn.DepictPlayerAsCorpse(tplayer) sessionLogic.zoning.spawn.DepictPlayerAsCorpse(tplayer)
case AvatarAction.Revive(revivalTargetGuid) if filter.resolvedPlayerGuid == revivalTargetGuid => case AvatarAction.Revive(revivalTargetGuid) if resolvedGuid == revivalTargetGuid =>
log.info(s"No time for rest, ${player.Name}. Back on your feet!") log.info(s"No time for rest, ${player.Name}. Back on your feet!")
sessionLogic.zoning.spawn.reviveTimer.cancel() sessionLogic.zoning.spawn.reviveTimer.cancel()
sessionLogic.zoning.spawn.deadState = DeadState.Alive sessionLogic.zoning.spawn.deadState = DeadState.Alive
@ -458,18 +458,18 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
/* uncommon messages (utility, or once in a while) */ /* uncommon messages (utility, or once in a while) */
case ChangeAmmo(weapon_guid, weapon_slot, previous_guid, ammo_id, ammo_guid, ammo_data) case ChangeAmmo(weapon_guid, weapon_slot, previous_guid, ammo_id, ammo_guid, ammo_data)
if filter.isNotSameTarget && ops.lastSeenStreamMessage.get(filter.resolvedPlayerGuid.guid).exists { _.visible } => if isNotSameTarget && ops.lastSeenStreamMessage.get(resolvedGuid.guid).exists { _.visible } =>
ops.changeAmmoProcedure(weapon_guid, previous_guid, ammo_id, ammo_guid, weapon_slot, ammo_data) ops.changeAmmoProcedure(weapon_guid, previous_guid, ammo_id, ammo_guid, weapon_slot, ammo_data)
sendResponse(ChangeAmmoMessage(weapon_guid, 1)) sendResponse(ChangeAmmoMessage(weapon_guid, 1))
case AvatarAction.ChangeFireMode(itemGuid, mode) if filter.isNotSameTarget => case AvatarAction.ChangeFireMode(itemGuid, mode) if isNotSameTarget =>
sendResponse(ChangeFireModeMessage(itemGuid, mode)) sendResponse(ChangeFireModeMessage(itemGuid, mode))
case AvatarAction.EnvironmentalDamage(_, _, _) => case AvatarAction.EnvironmentalDamage(_, _, _) =>
//TODO damage marker? //TODO damage marker?
sessionLogic.zoning.CancelZoningProcess() sessionLogic.zoning.CancelZoningProcess()
case AvatarAction.DropCreatedItem(pkt) if filter.isNotSameTarget => case AvatarAction.DropCreatedItem(pkt) if isNotSameTarget =>
sendResponse(pkt) sendResponse(pkt)
/* rare messages */ /* rare messages */
@ -482,10 +482,10 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
vehicle.flatMap { vinfo => Some(DrowningTarget(vinfo.guid, vinfo.progress, vinfo.state)) } vehicle.flatMap { vinfo => Some(DrowningTarget(vinfo.guid, vinfo.progress, vinfo.state)) }
)) ))
case AvatarAction.LoadCreatedProjectile(pkt) if filter.isNotSameTarget => case AvatarAction.LoadCreatedProjectile(pkt) if isNotSameTarget =>
sendResponse(pkt) sendResponse(pkt)
case AvatarAction.ProjectileState(projectileGuid, shotPos, shotVel, shotOrient, seq, end, targetGuid) if filter.isNotSameTarget => case AvatarAction.ProjectileState(projectileGuid, shotPos, shotVel, shotOrient, seq, end, targetGuid) if isNotSameTarget =>
sendResponse(ProjectileStateMessage(projectileGuid, shotPos, shotVel, shotOrient, seq, end, targetGuid)) sendResponse(ProjectileStateMessage(projectileGuid, shotPos, shotVel, shotOrient, seq, end, targetGuid))
case AvatarAction.ProjectileExplodes(projectileGuid, projectile) => case AvatarAction.ProjectileExplodes(projectileGuid, projectile) =>
@ -505,10 +505,10 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
case AvatarAction.ProjectileAutoLockAwareness(mode) => case AvatarAction.ProjectileAutoLockAwareness(mode) =>
sendResponse(GenericActionMessage(mode)) sendResponse(GenericActionMessage(mode))
case AvatarAction.PutDownFDU(target) if filter.isNotSameTarget => case AvatarAction.PutDownFDU(target) if isNotSameTarget =>
sendResponse(GenericObjectActionMessage(target, code=53)) sendResponse(GenericObjectActionMessage(target, code=53))
case AvatarAction.StowEquipment(target, slot, item) if filter.isNotSameTarget => case AvatarAction.StowEquipment(target, slot, item) if isNotSameTarget =>
val definition = item.Definition val definition = item.Definition
sendResponse( sendResponse(
ObjectCreateDetailedMessage( ObjectCreateDetailedMessage(
@ -520,7 +520,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
) )
case WeaponDryFire(weaponGuid) case WeaponDryFire(weaponGuid)
if filter.isNotSameTarget && ops.lastSeenStreamMessage.get(filter.resolvedPlayerGuid.guid).exists { _.visible } => if isNotSameTarget && ops.lastSeenStreamMessage.get(resolvedGuid.guid).exists { _.visible } =>
continent.GUID(weaponGuid).collect { continent.GUID(weaponGuid).collect {
case tool: Tool if tool.Magazine == 0 => case tool: Tool if tool.Magazine == 0 =>
// check that the magazine is still empty before sending WeaponDryFireMessage // check that the magazine is still empty before sending WeaponDryFireMessage

View file

@ -40,7 +40,7 @@ class VehicleHandlerLogic(val ops: SessionVehicleHandlers, implicit val context:
wheelDirection, wheelDirection,
unk5, unk5,
unk6 unk6
) if filter.isNotSameTarget && player.VehicleSeated.contains(vehicleGuid) => ) if isNotSameTarget && player.VehicleSeated.contains(vehicleGuid) =>
//player who is also in the vehicle (not driver) //player who is also in the vehicle (not driver)
sendResponse(VehicleStateMessage(vehicleGuid, unk1, pos, orient, vel, unk2, unk3, unk4, wheelDirection, unk5, unk6)) sendResponse(VehicleStateMessage(vehicleGuid, unk1, pos, orient, vel, unk2, unk3, unk4, wheelDirection, unk5, unk6))
player.Position = pos player.Position = pos
@ -60,30 +60,30 @@ class VehicleHandlerLogic(val ops: SessionVehicleHandlers, implicit val context:
wheelDirection, wheelDirection,
unk5, unk5,
unk6 unk6
) if filter.isNotSameTarget => ) if isNotSameTarget =>
//player who is watching the vehicle from the outside //player who is watching the vehicle from the outside
sendResponse(VehicleStateMessage(vehicleGuid, unk1, pos, ang, vel, unk2, unk3, unk4, wheelDirection, unk5, unk6)) sendResponse(VehicleStateMessage(vehicleGuid, unk1, pos, ang, vel, unk2, unk3, unk4, wheelDirection, unk5, unk6))
case VehicleAction.ChildObjectState(objectGuid, pitch, yaw) if filter.isNotSameTarget => case VehicleAction.ChildObjectState(objectGuid, pitch, yaw) if isNotSameTarget =>
sendResponse(ChildObjectStateMessage(objectGuid, pitch, yaw)) sendResponse(ChildObjectStateMessage(objectGuid, pitch, yaw))
case VehicleAction.FrameVehicleState(vguid, u1, pos, oient, vel, u2, u3, u4, is_crouched, u6, u7, u8, u9, uA) case VehicleAction.FrameVehicleState(vguid, u1, pos, oient, vel, u2, u3, u4, is_crouched, u6, u7, u8, u9, uA)
if filter.isNotSameTarget => if isNotSameTarget =>
sendResponse(FrameVehicleStateMessage(vguid, u1, pos, oient, vel, u2, u3, u4, is_crouched, u6, u7, u8, u9, uA)) sendResponse(FrameVehicleStateMessage(vguid, u1, pos, oient, vel, u2, u3, u4, is_crouched, u6, u7, u8, u9, uA))
case VehicleAction.DismountVehicle(bailType, wasKickedByDriver) if filter.isNotSameTarget => case VehicleAction.DismountVehicle(bailType, wasKickedByDriver) if isNotSameTarget =>
sendResponse(DismountVehicleMsg(filter.resolvedPlayerGuid, bailType, wasKickedByDriver)) sendResponse(DismountVehicleMsg(resolvedGuid, bailType, wasKickedByDriver))
case VehicleAction.MountVehicle(vehicleGuid, seat) if filter.isNotSameTarget => case VehicleAction.MountVehicle(vehicleGuid, seat) if isNotSameTarget =>
sendResponse(ObjectAttachMessage(vehicleGuid, filter.resolvedPlayerGuid, seat)) sendResponse(ObjectAttachMessage(vehicleGuid, resolvedGuid, seat))
case VehicleAction.DeployRequest(objectGuid, state, unk1, unk2, pos) if filter.isNotSameTarget => case VehicleAction.DeployRequest(objectGuid, state, unk1, unk2, pos) if isNotSameTarget =>
sendResponse(DeployRequestMessage(filter.resolvedPlayerGuid, objectGuid, state, unk1, unk2, pos)) sendResponse(DeployRequestMessage(resolvedGuid, objectGuid, state, unk1, unk2, pos))
case VehicleAction.EquipmentCreatedInSlot(pkt) if filter.isNotSameTarget => case VehicleAction.EquipmentCreatedInSlot(pkt) if isNotSameTarget =>
sendResponse(pkt) sendResponse(pkt)
case VehicleAction.InventoryState(obj, parentGuid, start, conData) if filter.isNotSameTarget => case VehicleAction.InventoryState(obj, parentGuid, start, conData) if isNotSameTarget =>
//TODO prefer ObjectDetachMessage, but how to force ammo pools to update properly? //TODO prefer ObjectDetachMessage, but how to force ammo pools to update properly?
val objGuid = obj.GUID val objGuid = obj.GUID
sendResponse(ObjectDeleteMessage(objGuid, unk1=0)) sendResponse(ObjectDeleteMessage(objGuid, unk1=0))
@ -94,10 +94,10 @@ class VehicleHandlerLogic(val ops: SessionVehicleHandlers, implicit val context:
conData conData
)) ))
case VehicleAction.KickPassenger(_, wasKickedByDriver, vehicleGuid) if filter.isSameTarget => case VehicleAction.KickPassenger(_, wasKickedByDriver, vehicleGuid) if isSameTarget =>
//seat number (first field) seems to be correct if passenger is kicked manually by driver //seat number (first field) seems to be correct if passenger is kicked manually by driver
//but always seems to return 4 if user is kicked by mount permissions changing //but always seems to return 4 if user is kicked by mount permissions changing
sendResponse(DismountVehicleMsg(filter.resolvedPlayerGuid, BailType.Kicked, wasKickedByDriver)) sendResponse(DismountVehicleMsg(resolvedGuid, BailType.Kicked, wasKickedByDriver))
continent.GUID(vehicleGuid) match { continent.GUID(vehicleGuid) match {
case Some(obj: Vehicle) => case Some(obj: Vehicle) =>
sessionLogic.general.unaccessContainer(obj) sessionLogic.general.unaccessContainer(obj)
@ -107,23 +107,23 @@ class VehicleHandlerLogic(val ops: SessionVehicleHandlers, implicit val context:
case VehicleAction.KickPassenger(_, wasKickedByDriver, _) => case VehicleAction.KickPassenger(_, wasKickedByDriver, _) =>
//seat number (first field) seems to be correct if passenger is kicked manually by driver //seat number (first field) seems to be correct if passenger is kicked manually by driver
//but always seems to return 4 if user is kicked by mount permissions changing //but always seems to return 4 if user is kicked by mount permissions changing
sendResponse(DismountVehicleMsg(filter.resolvedPlayerGuid, BailType.Kicked, wasKickedByDriver)) sendResponse(DismountVehicleMsg(resolvedGuid, BailType.Kicked, wasKickedByDriver))
case VehicleAction.InventoryState2(objGuid, parentGuid, value) if filter.isNotSameTarget => case VehicleAction.InventoryState2(objGuid, parentGuid, value) if isNotSameTarget =>
sendResponse(InventoryStateMessage(objGuid, unk=0, parentGuid, value)) sendResponse(InventoryStateMessage(objGuid, unk=0, parentGuid, value))
case VehicleAction.LoadVehicle(vehicle, vtype, vguid, vdata) if filter.isNotSameTarget => case VehicleAction.LoadVehicle(vehicle, vtype, vguid, vdata) if isNotSameTarget =>
//this is not be suitable for vehicles with people who are seated in it before it spawns (if that is possible) //this is not be suitable for vehicles with people who are seated in it before it spawns (if that is possible)
sendResponse(ObjectCreateMessage(vtype, vguid, vdata)) sendResponse(ObjectCreateMessage(vtype, vguid, vdata))
Vehicles.ReloadAccessPermissions(vehicle, player.Name) Vehicles.ReloadAccessPermissions(vehicle, player.Name)
case VehicleAction.SeatPermissions(vehicleGuid, seatGroup, permission) if filter.isNotSameTarget => case VehicleAction.SeatPermissions(vehicleGuid, seatGroup, permission) if isNotSameTarget =>
sendResponse(PlanetsideAttributeMessage(vehicleGuid, seatGroup, permission)) sendResponse(PlanetsideAttributeMessage(vehicleGuid, seatGroup, permission))
case VehicleAction.UnloadVehicle(_, vehicleGuid) => case VehicleAction.UnloadVehicle(_, vehicleGuid) =>
sendResponse(ObjectDeleteMessage(vehicleGuid, unk1=1)) sendResponse(ObjectDeleteMessage(vehicleGuid, unk1=1))
case VehicleAction.UnstowEquipment(itemGuid) if filter.isNotSameTarget => case VehicleAction.UnstowEquipment(itemGuid) if isNotSameTarget =>
//TODO prefer ObjectDetachMessage, but how to force ammo pools to update properly? //TODO prefer ObjectDetachMessage, but how to force ammo pools to update properly?
sendResponse(ObjectDeleteMessage(itemGuid, unk1=0)) sendResponse(ObjectDeleteMessage(itemGuid, unk1=0))

View file

@ -10,17 +10,24 @@ import net.psforever.types.PlanetSideGUID
trait HandlerFilter { trait HandlerFilter {
def resolvedPlayerGuid: PlanetSideGUID def resolvedPlayerGuid: PlanetSideGUID
def isNotSameTarget: Boolean def isNotSameTarget: Boolean
def isSameTarget: Boolean = !isNotSameTarget def isSameTarget: Boolean
} }
class HandlerFilterClass(guid1: PlanetSideGUID, guid2: PlanetSideGUID) extends HandlerFilter { case class HandlerFilterRules(
val resolvedPlayerGuid: PlanetSideGUID = guid2 resolvedPlayerGuid: PlanetSideGUID,
val isNotSameTarget: Boolean = resolvedPlayerGuid != guid1 isNotSameTarget: Boolean,
} isSameTarget: Boolean
) extends HandlerFilter
object HandlerFilter { object HandlerFilter {
def apply(guid: PlanetSideGUID, isNotSameTarget: Boolean): HandlerFilter = {
HandlerFilterRules(guid, isNotSameTarget, !isNotSameTarget)
}
def apply(guid1: PlanetSideGUID, guid2: PlanetSideGUID): HandlerFilter = { def apply(guid1: PlanetSideGUID, guid2: PlanetSideGUID): HandlerFilter = {
new HandlerFilterClass(guid1, guid2) val resolvedPlayerGuid: PlanetSideGUID = guid2
val isNotSameTarget: Boolean = resolvedPlayerGuid != guid1
this(guid2, isNotSameTarget)
} }
def apply(guid: PlanetSideGUID, player: Player): HandlerFilter = { def apply(guid: PlanetSideGUID, player: Player): HandlerFilter = {
@ -31,17 +38,9 @@ object HandlerFilter {
}) })
} }
final val NeverAllow: HandlerFilter = new HandlerFilter { final val NeverAllow: HandlerFilter = HandlerFilterRules(PlanetSideGUID(-1), isNotSameTarget = false, isSameTarget = false)
def resolvedPlayerGuid: PlanetSideGUID = PlanetSideGUID(-1)
def isNotSameTarget: Boolean = false
override def isSameTarget: Boolean = false
}
final def Allow(guid: PlanetSideGUID): HandlerFilter = new HandlerFilter { final def Allow(guid: PlanetSideGUID): HandlerFilter = HandlerFilterRules(guid, isNotSameTarget = true, isSameTarget = true)
def resolvedPlayerGuid: PlanetSideGUID = guid
def isNotSameTarget: Boolean = true
override def isSameTarget: Boolean = true
}
} }
trait CommonHandlerFunctionsBase { trait CommonHandlerFunctionsBase {
@ -62,7 +61,13 @@ trait CommonHandlerFunctionsBase {
trait CommonHandlerFunctions extends CommonHandlerFunctionsBase { trait CommonHandlerFunctions extends CommonHandlerFunctionsBase {
_: CommonSessionInterfacingFunctionality => _: CommonSessionInterfacingFunctionality =>
protected var filter: HandlerFilter = HandlerFilter.NeverAllow private var filter: HandlerFilter = HandlerFilter.NeverAllow
def resolvedGuid: PlanetSideGUID = filter.resolvedPlayerGuid
def isNotSameTarget: Boolean = filter.isNotSameTarget
def isSameTarget: Boolean = filter.isSameTarget
/** /**
* na * na

View file

@ -12,36 +12,36 @@ class CommonHandlerLogic(val sessionLogic: SessionData, implicit val context: Ac
def receive: Receive = { def receive: Receive = {
case PlanetsideAttribute(target_guid, attributeType, attributeValue) case PlanetsideAttribute(target_guid, attributeType, attributeValue)
if filter.isNotSameTarget => if isNotSameTarget =>
sendResponse(PlanetsideAttributeMessage(target_guid, attributeType, attributeValue)) sendResponse(PlanetsideAttributeMessage(target_guid, attributeType, attributeValue))
case GenericObjectAction(objectGuid, actionCode) case GenericObjectAction(objectGuid, actionCode)
if filter.isNotSameTarget => if isNotSameTarget =>
sendResponse(GenericObjectActionMessage(objectGuid, actionCode)) sendResponse(GenericObjectActionMessage(objectGuid, actionCode))
case ObjectDelete(itemGuid, unk) case ObjectDelete(itemGuid, unk)
if filter.isNotSameTarget => if isNotSameTarget =>
sendResponse(ObjectDeleteMessage(itemGuid, unk)) sendResponse(ObjectDeleteMessage(itemGuid, unk))
case ChangeFireState_Start(weaponGuid) case ChangeFireState_Start(weaponGuid)
if filter.isNotSameTarget => if isNotSameTarget =>
sendResponse(ChangeFireStateMessage_Start(weaponGuid)) sendResponse(ChangeFireStateMessage_Start(weaponGuid))
case ChangeFireState_Stop(weaponGuid) case ChangeFireState_Stop(weaponGuid)
if filter.isNotSameTarget => if isNotSameTarget =>
sendResponse(ChangeFireStateMessage_Stop(weaponGuid)) sendResponse(ChangeFireStateMessage_Stop(weaponGuid))
case ReloadTool(itemGuid) case ReloadTool(itemGuid)
if filter.isNotSameTarget => if isNotSameTarget =>
sendResponse(ReloadMessage(itemGuid, ammo_clip=1, unk1=0)) sendResponse(ReloadMessage(itemGuid, ammo_clip=1, unk1=0))
case ChangeAmmo(weapon_guid, weapon_slot, previous_guid, ammo_id, ammo_guid, ammo_data) case ChangeAmmo(weapon_guid, weapon_slot, previous_guid, ammo_id, ammo_guid, ammo_data)
if filter.isNotSameTarget => if isNotSameTarget =>
sessionLogic.avatarResponse.changeAmmoProcedure(weapon_guid, previous_guid, ammo_id, ammo_guid, weapon_slot, ammo_data) sessionLogic.avatarResponse.changeAmmoProcedure(weapon_guid, previous_guid, ammo_id, ammo_guid, weapon_slot, ammo_data)
sendResponse(ChangeAmmoMessage(weapon_guid, 1)) sendResponse(ChangeAmmoMessage(weapon_guid, 1))
case WeaponDryFire(weaponGuid) case WeaponDryFire(weaponGuid)
if filter.isNotSameTarget => if isNotSameTarget =>
continent.GUID(weaponGuid).collect { continent.GUID(weaponGuid).collect {
case tool: Tool if tool.Magazine == 0 => case tool: Tool if tool.Magazine == 0 =>
// check that the magazine is still empty before sending WeaponDryFireMessage // check that the magazine is still empty before sending WeaponDryFireMessage
@ -51,15 +51,15 @@ class CommonHandlerLogic(val sessionLogic: SessionData, implicit val context: Ac
case HintsAtAttacker(sourceGuid) case HintsAtAttacker(sourceGuid)
if player.isAlive => if player.isAlive =>
sendResponse(HitHint(sourceGuid, filter.resolvedPlayerGuid)) sendResponse(HitHint(sourceGuid, resolvedGuid))
sessionLogic.zoning.CancelZoningProcessWithDescriptiveReason("cancel_dmg") sessionLogic.zoning.CancelZoningProcessWithDescriptiveReason("cancel_dmg")
case SetEmpire(objectGuid, faction) case SetEmpire(objectGuid, faction)
if filter.isNotSameTarget => if isNotSameTarget =>
sendResponse(SetEmpireMessage(objectGuid, faction)) sendResponse(SetEmpireMessage(objectGuid, faction))
case ConcealPlayer(_) => case ConcealPlayer(_) =>
sendResponse(GenericObjectActionMessage(filter.resolvedPlayerGuid, code=9)) sendResponse(GenericObjectActionMessage(resolvedGuid, code=9))
case SendResponse(msgs) => case SendResponse(msgs) =>
msgs.foreach(sendResponse) msgs.foreach(sendResponse)