working AvatarService based on GenericEventService(withSupport); manually corrected almost every message to AvatarService to ensure channel and filters are preserved

This commit is contained in:
Fate-JH 2026-01-24 10:28:18 -05:00
parent be803f0d03
commit d62dbfdd81
63 changed files with 958 additions and 1441 deletions

View file

@ -68,9 +68,11 @@ ignore:
- "src/main/scala/net/psforever/types/PlanetSideEmpire.scala"
- "src/main/scala/net/psforever/types/TransactionType.scala"
- "src/main/scala/net/psforever/services/avatar/AvatarAction.scala"
- "src/main/scala/net/psforever/services/avatar/AvatarResponse.scala"
- "src/main/scala/net/psforever/services/galaxy/AvatarServiceMessage.scala"
- "src/main/scala/net/psforever/services/galaxy/AvatarServiceResponse.scala"
- "src/main/scala/net/psforever/services/galaxy/GalaxyAction.scala"
- "src/main/scala/net/psforever/services/galaxy/GalaxyResponse.scala"
- "src/main/scala/net/psforever/services/galaxy/GalaxyServiceMessage.scala"
- "src/main/scala/net/psforever/services/galaxy/GalaxyServiceResponse.scala"
- "src/main/scala/net/psforever/services/hart/HartEvent.scala"
- "src/main/scala/net/psforever/services/hart/HartTimerActions.scala"
- "src/main/scala/net/psforever/services/local/LocalAction.scala"

View file

@ -3,8 +3,8 @@ package actor.service
import akka.actor.Props
import akka.testkit.TestProbe
import scala.concurrent.duration._
import scala.concurrent.duration._
import actor.base.{ActorTest, FreedContextActorTest}
import net.psforever.objects._
import net.psforever.objects.avatar.Avatar
@ -80,12 +80,12 @@ class ArmorChangedTest extends ActorTest {
ServiceManager.boot(system)
val service = system.actorOf(Props(classOf[AvatarService], Zone.Nowhere), AvatarServiceTest.TestName)
service ! Service.Join("test")
service ! AvatarServiceMessage("test", AvatarAction.ArmorChanged(PlanetSideGUID(10), ExoSuitType.Reinforced, 0))
service ! AvatarServiceMessage("test", PlanetSideGUID(10), AvatarAction.ArmorChanged(ExoSuitType.Reinforced, 0))
expectMsg(
AvatarServiceResponse(
"/test/Avatar",
PlanetSideGUID(10),
AvatarResponse.ArmorChanged(ExoSuitType.Reinforced, 0)
AvatarAction.ArmorChanged(ExoSuitType.Reinforced, 0)
)
)
}
@ -99,7 +99,7 @@ class ConcealPlayerTest extends ActorTest {
val service = system.actorOf(Props(classOf[AvatarService], Zone.Nowhere), AvatarServiceTest.TestName)
service ! Service.Join("test")
service ! AvatarServiceMessage("test", AvatarAction.ConcealPlayer(PlanetSideGUID(10)))
expectMsg(AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), AvatarResponse.ConcealPlayer()))
expectMsg(AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), AvatarAction.ConcealPlayer(PlanetSideGUID(10))))
}
}
}
@ -123,9 +123,10 @@ class EquipmentInHandTest extends ActorTest {
service ! Service.Join("test")
service ! AvatarServiceMessage(
"test",
AvatarAction.EquipmentInHand(PlanetSideGUID(10), PlanetSideGUID(11), 2, tool)
PlanetSideGUID(10),
AvatarAction.EquipmentInHand(PlanetSideGUID(11), 2, tool)
)
expectMsg(AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), AvatarResponse.EquipmentInHand(pkt)))
expectMsg(AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), AvatarAction.EquipmentCreatedInHand(pkt)))
}
}
}
@ -151,8 +152,8 @@ class DroptItemTest extends ActorTest {
"AvatarService" should {
"pass DropItem" in {
service ! Service.Join("test")
service ! AvatarServiceMessage("test", AvatarAction.DropItem(PlanetSideGUID(10), tool))
expectMsg(AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), AvatarResponse.DropItem(pkt)))
service ! DropItemMessage("test", PlanetSideGUID(10), AvatarAction.DropItem(tool), Zone.Nowhere)
expectMsg(AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), AvatarAction.DropCreatedItem(pkt)))
}
}
}
@ -176,15 +177,17 @@ class LoadPlayerTest extends ActorTest {
//no parent data
service ! AvatarServiceMessage(
"test",
AvatarAction.LoadPlayer(PlanetSideGUID(20), ObjectClass.avatar, PlanetSideGUID(10), c1data, None)
PlanetSideGUID(20),
AvatarAction.LoadPlayer(ObjectClass.avatar, PlanetSideGUID(10), c1data, None)
)
expectMsg(AvatarServiceResponse("/test/Avatar", PlanetSideGUID(20), AvatarResponse.LoadPlayer(pkt1)))
expectMsg(AvatarServiceResponse("/test/Avatar", PlanetSideGUID(20), AvatarAction.LoadCreatedPlayer(pkt1)))
//parent data
service ! AvatarServiceMessage(
"test",
AvatarAction.LoadPlayer(PlanetSideGUID(20), ObjectClass.avatar, PlanetSideGUID(10), c2data, Some(parent))
PlanetSideGUID(20),
AvatarAction.LoadPlayer(ObjectClass.avatar, PlanetSideGUID(10), c2data, Some(parent))
)
expectMsg(AvatarServiceResponse("/test/Avatar", PlanetSideGUID(20), AvatarResponse.LoadPlayer(pkt2)))
expectMsg(AvatarServiceResponse("/test/Avatar", PlanetSideGUID(20), AvatarAction.LoadCreatedPlayer(pkt2)))
}
}
}
@ -195,14 +198,14 @@ class ObjectDeleteTest extends ActorTest {
ServiceManager.boot(system)
val service = system.actorOf(Props(classOf[AvatarService], Zone.Nowhere), AvatarServiceTest.TestName)
service ! Service.Join("test")
service ! AvatarServiceMessage("test", AvatarAction.ObjectDelete(PlanetSideGUID(10), PlanetSideGUID(11)))
service ! AvatarServiceMessage("test", PlanetSideGUID(10), AvatarAction.ObjectDelete(PlanetSideGUID(11)))
expectMsg(
AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), AvatarResponse.ObjectDelete(PlanetSideGUID(11), 0))
AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), AvatarAction.ObjectDelete(PlanetSideGUID(11), 0))
)
service ! AvatarServiceMessage("test", AvatarAction.ObjectDelete(PlanetSideGUID(10), PlanetSideGUID(11), 55))
service ! AvatarServiceMessage("test", PlanetSideGUID(10), AvatarAction.ObjectDelete(PlanetSideGUID(11), 55))
expectMsg(
AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), AvatarResponse.ObjectDelete(PlanetSideGUID(11), 55))
AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), AvatarAction.ObjectDelete(PlanetSideGUID(11), 55))
)
}
}
@ -214,8 +217,8 @@ class ObjectHeldTest extends ActorTest {
ServiceManager.boot(system)
val service = system.actorOf(Props(classOf[AvatarService], Zone.Nowhere), AvatarServiceTest.TestName)
service ! Service.Join("test")
service ! AvatarServiceMessage("test", AvatarAction.ObjectHeld(PlanetSideGUID(10), 1, 2))
expectMsg(AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), AvatarResponse.ObjectHeld(1, 2)))
service ! AvatarServiceMessage("test", PlanetSideGUID(10), AvatarAction.ObjectHeld(1, 2))
expectMsg(AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), AvatarAction.ObjectHeld(1, 2)))
}
}
}
@ -228,7 +231,7 @@ class PutDownFDUTest extends ActorTest {
service ! Service.Join("test")
service ! AvatarServiceMessage("test", AvatarAction.PutDownFDU(PlanetSideGUID(10)))
expectMsg(
AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), AvatarResponse.PutDownFDU(PlanetSideGUID(10)))
AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), AvatarAction.PutDownFDU(PlanetSideGUID(10)))
)
}
}
@ -240,8 +243,8 @@ class PlanetsideAttributeTest extends ActorTest {
ServiceManager.boot(system)
val service = system.actorOf(Props(classOf[AvatarService], Zone.Nowhere), AvatarServiceTest.TestName)
service ! Service.Join("test")
service ! AvatarServiceMessage("test", AvatarAction.PlanetsideAttribute(PlanetSideGUID(10), 5, 1200L))
expectMsg(AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), AvatarResponse.PlanetsideAttribute(5, 1200L)))
service ! AvatarServiceMessage("test", PlanetSideGUID(10), AvatarAction.PlanetsideAttribute(5, 1200L))
expectMsg(AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), AvatarAction.PlanetsideAttribute(5, 1200L)))
}
}
}
@ -271,8 +274,8 @@ class PlayerStateTest extends ActorTest {
service ! Service.Join("test")
service ! AvatarServiceMessage(
"test",
PlanetSideGUID(10),
AvatarAction.PlayerState(
PlanetSideGUID(10),
Vector3(3694.1094f, 2735.4531f, 90.84375f),
Some(Vector3(4.375f, 2.59375f, 0.0f)),
61.875f,
@ -291,7 +294,7 @@ class PlayerStateTest extends ActorTest {
AvatarServiceResponse(
"/test/Avatar",
PlanetSideGUID(10),
AvatarResponse.PlayerState(
AvatarAction.PlayerState(
Vector3(3694.1094f, 2735.4531f, 90.84375f),
Some(Vector3(4.375f, 2.59375f, 0.0f)),
61.875f,
@ -320,8 +323,8 @@ class PickupItemTest extends ActorTest {
ServiceManager.boot(system)
val service = system.actorOf(Props(classOf[AvatarService], Zone.Nowhere), AvatarServiceTest.TestName)
service ! Service.Join("test")
service ! AvatarServiceMessage("test", AvatarAction.PickupItem(PlanetSideGUID(10), tool))
expectMsg(AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), AvatarResponse.ObjectDelete(tool.GUID, 0)))
service ! PickupItemMessage("test", AvatarAction.PickupItem(tool), Zone.Nowhere)
expectMsg(AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), AvatarAction.ObjectDelete(tool.GUID, 0)))
}
}
@ -331,8 +334,8 @@ class ReloadTest extends ActorTest {
ServiceManager.boot(system)
val service = system.actorOf(Props(classOf[AvatarService], Zone.Nowhere), AvatarServiceTest.TestName)
service ! Service.Join("test")
service ! AvatarServiceMessage("test", AvatarAction.Reload(PlanetSideGUID(10), PlanetSideGUID(40)))
expectMsg(AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), AvatarResponse.Reload(PlanetSideGUID(40))))
service ! AvatarServiceMessage("test", PlanetSideGUID(10), AvatarAction.Reload(PlanetSideGUID(40)))
expectMsg(AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), AvatarAction.Reload(PlanetSideGUID(40))))
}
}
}
@ -348,8 +351,8 @@ class ChangeAmmoTest extends ActorTest {
service ! Service.Join("test")
service ! AvatarServiceMessage(
"test",
PlanetSideGUID(10),
AvatarAction.ChangeAmmo(
PlanetSideGUID(10),
PlanetSideGUID(40),
0,
PlanetSideGUID(40),
@ -362,7 +365,7 @@ class ChangeAmmoTest extends ActorTest {
AvatarServiceResponse(
"/test/Avatar",
PlanetSideGUID(10),
AvatarResponse.ChangeAmmo(
AvatarAction.ChangeAmmo(
PlanetSideGUID(40),
0,
PlanetSideGUID(40),
@ -385,9 +388,9 @@ class ChangeFireModeTest extends ActorTest {
ServiceManager.boot(system)
val service = system.actorOf(Props(classOf[AvatarService], Zone.Nowhere), AvatarServiceTest.TestName)
service ! Service.Join("test")
service ! AvatarServiceMessage("test", AvatarAction.ChangeFireMode(PlanetSideGUID(10), PlanetSideGUID(40), 0))
service ! AvatarServiceMessage("test", PlanetSideGUID(10), AvatarAction.ChangeFireMode(PlanetSideGUID(40), 0))
expectMsg(
AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), AvatarResponse.ChangeFireMode(PlanetSideGUID(40), 0))
AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), AvatarAction.ChangeFireMode(PlanetSideGUID(40), 0))
)
}
}
@ -399,12 +402,12 @@ class ChangeFireStateStartTest extends ActorTest {
ServiceManager.boot(system)
val service = system.actorOf(Props(classOf[AvatarService], Zone.Nowhere), AvatarServiceTest.TestName)
service ! Service.Join("test")
service ! AvatarServiceMessage("test", AvatarAction.ChangeFireState_Start(PlanetSideGUID(10), PlanetSideGUID(40)))
service ! AvatarServiceMessage("test", PlanetSideGUID(10), AvatarAction.ChangeFireState_Start(PlanetSideGUID(40)))
expectMsg(
AvatarServiceResponse(
"/test/Avatar",
PlanetSideGUID(10),
AvatarResponse.ChangeFireState_Start(PlanetSideGUID(40))
AvatarAction.ChangeFireState_Start(PlanetSideGUID(40))
)
)
}
@ -417,12 +420,12 @@ class ChangeFireStateStopTest extends ActorTest {
ServiceManager.boot(system)
val service = system.actorOf(Props(classOf[AvatarService], Zone.Nowhere), AvatarServiceTest.TestName)
service ! Service.Join("test")
service ! AvatarServiceMessage("test", AvatarAction.ChangeFireState_Stop(PlanetSideGUID(10), PlanetSideGUID(40)))
service ! AvatarServiceMessage("test", PlanetSideGUID(10), AvatarAction.ChangeFireState_Stop(PlanetSideGUID(40)))
expectMsg(
AvatarServiceResponse(
"/test/Avatar",
PlanetSideGUID(10),
AvatarResponse.ChangeFireState_Stop(PlanetSideGUID(40))
AvatarAction.ChangeFireState_Stop(PlanetSideGUID(40))
)
)
}
@ -435,9 +438,9 @@ class WeaponDryFireTest extends ActorTest {
ServiceManager.boot(system)
val service = system.actorOf(Props(classOf[AvatarService], Zone.Nowhere), AvatarServiceTest.TestName)
service ! Service.Join("test")
service ! AvatarServiceMessage("test", AvatarAction.WeaponDryFire(PlanetSideGUID(10), PlanetSideGUID(40)))
service ! AvatarServiceMessage("test", PlanetSideGUID(10), AvatarAction.WeaponDryFire(PlanetSideGUID(40)))
expectMsg(
AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), AvatarResponse.WeaponDryFire(PlanetSideGUID(40)))
AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), AvatarAction.WeaponDryFire(PlanetSideGUID(40)))
)
}
}
@ -453,13 +456,14 @@ class AvatarStowEquipmentTest extends ActorTest {
service ! Service.Join("test")
service ! AvatarServiceMessage(
"test",
AvatarAction.StowEquipment(PlanetSideGUID(10), PlanetSideGUID(11), 2, tool)
PlanetSideGUID(10),
AvatarAction.StowEquipment(PlanetSideGUID(11), 2, tool)
)
expectMsg(
AvatarServiceResponse(
"/test/Avatar",
PlanetSideGUID(10),
AvatarResponse.StowEquipment(PlanetSideGUID(11), 2, tool)
AvatarAction.StowEquipment(PlanetSideGUID(11), 2, tool)
)
)
}
@ -504,23 +508,23 @@ class AvatarReleaseTest extends FreedContextActorTest {
assert(zone.Corpses.size == 1)
assert(obj.HasGUID)
val guid = obj.GUID
zone.AvatarEvents ! AvatarServiceMessage("test", AvatarAction.Release(obj, zone, Some(1 second))) //alive for one second
zone.AvatarEvents ! ReleaseMessage("test", AvatarAction.Release(obj, zone, Some(1 second))) //alive for one second
val reply1 = subscriber.receiveOne(200 milliseconds)
assert(reply1.isInstanceOf[AvatarServiceResponse])
val reply1msg = reply1.asInstanceOf[AvatarServiceResponse]
assert(reply1msg.channel == "/test/Avatar")
assert(reply1msg.avatar_guid == guid)
assert(reply1msg.replyMessage.isInstanceOf[AvatarResponse.Release])
assert(reply1msg.replyMessage.asInstanceOf[AvatarResponse.Release].player == obj)
assert(reply1msg.filter == guid)
assert(reply1msg.reply.isInstanceOf[AvatarAction.Release])
assert(reply1msg.reply.asInstanceOf[AvatarAction.Release].player == obj)
val reply2 = subscriber.receiveOne(2 seconds)
assert(reply2.isInstanceOf[AvatarServiceResponse])
val reply2msg = reply2.asInstanceOf[AvatarServiceResponse]
assert(reply2msg.channel.equals("/test/Avatar"))
assert(reply2msg.avatar_guid == Service.defaultPlayerGUID)
assert(reply2msg.replyMessage.isInstanceOf[AvatarResponse.ObjectDelete])
assert(reply2msg.replyMessage.asInstanceOf[AvatarResponse.ObjectDelete].item_guid == guid)
assert(reply2msg.filter == Service.defaultPlayerGUID)
assert(reply2msg.reply.isInstanceOf[AvatarAction.ObjectDelete])
assert(reply2msg.reply.asInstanceOf[AvatarAction.ObjectDelete].item_guid == guid)
subscriber.expectNoMessage(1 seconds)
assert(zone.Corpses.isEmpty)
@ -555,24 +559,24 @@ class AvatarReleaseEarly1Test extends FreedContextActorTest {
assert(zone.Corpses.size == 1)
assert(obj.HasGUID)
val guid = obj.GUID
zone.AvatarEvents ! AvatarServiceMessage("test", AvatarAction.Release(obj, zone)) //3+ minutes!
zone.AvatarEvents ! ReleaseMessage("test", AvatarAction.Release(obj, zone)) //3+ minutes!
val reply1 = subscriber.receiveOne(200 milliseconds)
assert(reply1.isInstanceOf[AvatarServiceResponse])
val reply1msg = reply1.asInstanceOf[AvatarServiceResponse]
assert(reply1msg.channel == "/test/Avatar")
assert(reply1msg.avatar_guid == guid)
assert(reply1msg.replyMessage.isInstanceOf[AvatarResponse.Release])
assert(reply1msg.replyMessage.asInstanceOf[AvatarResponse.Release].player == obj)
assert(reply1msg.filter == guid)
assert(reply1msg.reply.isInstanceOf[AvatarAction.Release])
assert(reply1msg.reply.asInstanceOf[AvatarAction.Release].player == obj)
zone.AvatarEvents ! AvatarServiceMessage.Corpse(RemoverActor.HurrySpecific(List(obj), zone)) //IMPORTANT: ONE ENTRY
zone.AvatarEvents ! CorpseEnvelope(RemoverActor.HurrySpecific(List(obj), zone)) //IMPORTANT: ONE ENTRY
val reply2 = subscriber.receiveOne(200 milliseconds)
assert(reply2.isInstanceOf[AvatarServiceResponse])
val reply2msg = reply2.asInstanceOf[AvatarServiceResponse]
assert(reply2msg.channel.equals("/test/Avatar"))
assert(reply2msg.avatar_guid == Service.defaultPlayerGUID)
assert(reply2msg.replyMessage.isInstanceOf[AvatarResponse.ObjectDelete])
assert(reply2msg.replyMessage.asInstanceOf[AvatarResponse.ObjectDelete].item_guid == guid)
assert(reply2msg.filter == Service.defaultPlayerGUID)
assert(reply2msg.reply.isInstanceOf[AvatarAction.ObjectDelete])
assert(reply2msg.reply.asInstanceOf[AvatarAction.ObjectDelete].item_guid == guid)
subscriber.expectNoMessage(1 seconds)
assert(zone.Corpses.isEmpty)
@ -613,26 +617,26 @@ class AvatarReleaseEarly2Test extends FreedContextActorTest {
assert(zone.Corpses.size == 1)
assert(obj.HasGUID)
val guid = obj.GUID
zone.AvatarEvents ! AvatarServiceMessage("test", AvatarAction.Release(obj, zone)) //3+ minutes!
zone.AvatarEvents ! ReleaseMessage("test", AvatarAction.Release(obj, zone)) //3+ minutes!
val reply1 = subscriber.receiveOne(200 milliseconds)
assert(reply1.isInstanceOf[AvatarServiceResponse])
val reply1msg = reply1.asInstanceOf[AvatarServiceResponse]
assert(reply1msg.channel == "/test/Avatar")
assert(reply1msg.avatar_guid == guid)
assert(reply1msg.replyMessage.isInstanceOf[AvatarResponse.Release])
assert(reply1msg.replyMessage.asInstanceOf[AvatarResponse.Release].player == obj)
assert(reply1msg.filter == guid)
assert(reply1msg.reply.isInstanceOf[AvatarAction.Release])
assert(reply1msg.reply.asInstanceOf[AvatarAction.Release].player == obj)
zone.AvatarEvents ! AvatarServiceMessage.Corpse(
zone.AvatarEvents ! CorpseEnvelope(
RemoverActor.HurrySpecific(List(objAlt, obj), zone)
) //IMPORTANT: TWO ENTRIES
val reply2 = subscriber.receiveOne(100 milliseconds)
assert(reply2.isInstanceOf[AvatarServiceResponse])
val reply2msg = reply2.asInstanceOf[AvatarServiceResponse]
assert(reply2msg.channel.equals("/test/Avatar"))
assert(reply2msg.avatar_guid == Service.defaultPlayerGUID)
assert(reply2msg.replyMessage.isInstanceOf[AvatarResponse.ObjectDelete])
assert(reply2msg.replyMessage.asInstanceOf[AvatarResponse.ObjectDelete].item_guid == guid)
assert(reply2msg.filter == Service.defaultPlayerGUID)
assert(reply2msg.reply.isInstanceOf[AvatarAction.ObjectDelete])
assert(reply2msg.reply.asInstanceOf[AvatarAction.ObjectDelete].item_guid == guid)
subscriber.expectNoMessage(1 seconds)
assert(zone.Corpses.isEmpty)

View file

@ -587,7 +587,8 @@ object AvatarActor {
val player = session.player
session.zone.AvatarEvents ! AvatarServiceMessage(
player.Faction.toString,
AvatarAction.PlanetsideAttribute(player.GUID, 53, state)
player.GUID,
AvatarAction.PlanetsideAttribute(53, state)
)
}
@ -1385,7 +1386,8 @@ class AvatarActor(
sessionActor ! SessionActor.SendResponse(PlanetsideAttributeMessage(session.get.player.GUID, 53, 0))
session.get.zone.AvatarEvents ! AvatarServiceMessage(
avatar.faction.toString,
AvatarAction.PlanetsideAttribute(session.get.player.GUID, 53, if (lfs) 1 else 0)
session.get.player.GUID,
AvatarAction.PlanetsideAttribute(53, if (lfs) 1 else 0)
)
Behaviors.same
@ -1796,7 +1798,7 @@ class AvatarActor(
val zone = player.Zone
zone.AvatarEvents ! AvatarServiceMessage(
zone.id,
AvatarAction.SendResponse(Service.defaultPlayerGUID, DisplayedAwardMessage(player.GUID, ribbon, bar))
AvatarAction.SendResponse(DisplayedAwardMessage(player.GUID, ribbon, bar))
)
Behaviors.same
@ -2075,8 +2077,8 @@ class AvatarActor(
avatarCopy(avatar.copy(decoration = avatar.decoration.copy(cosmetics = Some(cosmetics))))
zone.AvatarEvents ! AvatarServiceMessage(
zone.id,
session.get.player.GUID,
AvatarAction.PlanetsideAttributeToAll(
session.get.player.GUID,
106,
Cosmetic.valuesToAttributeValue(cosmetics)
)
@ -3000,13 +3002,13 @@ class AvatarActor(
val next = BattleRank.withExperience(newBep).value
val br24 = BattleRank.BR24.value
sessionActor ! SessionActor.SendResponse(BattleExperienceMessage(pguid, newBep, localModifier))
events ! AvatarServiceMessage(zoneId, AvatarAction.PlanetsideAttributeToAll(pguid, 17, newBep))
events ! AvatarServiceMessage(zoneId, pguid, AvatarAction.PlanetsideAttributeToAll(17, newBep))
if (current < br24 && next >= br24 || current >= br24 && next < br24) {
setCosmetics(Set()).onComplete { _ =>
val evts = events
val name = player.Name
val guid = pguid
evts ! AvatarServiceMessage(name, AvatarAction.PlanetsideAttributeToAll(guid, 106, 1)) //set to no helmet
evts ! AvatarServiceMessage(name, guid, AvatarAction.PlanetsideAttributeToAll(106, 1)) //set to no helmet
}
}
// when the level is reduced, take away any implants over the implant slot limit
@ -3051,10 +3053,7 @@ class AvatarActor(
val sess = session.get
val zone = sess.zone
avatar = avatar.copy(cep = cep)
zone.AvatarEvents ! AvatarServiceMessage(
zone.id,
AvatarAction.PlanetsideAttributeToAll(sess.player.GUID, 18, cep)
)
zone.AvatarEvents ! AvatarServiceMessage(zone.id, sess.player.GUID, AvatarAction.PlanetsideAttributeToAll(18, cep))
case Failure(exception) =>
log.error(exception)("db failure")
}
@ -3165,10 +3164,7 @@ class AvatarActor(
val player = _session.player
zone.AvatarEvents ! AvatarServiceMessage(
player.Name,
AvatarAction.SendResponse(
Service.defaultPlayerGUID,
AvatarStatisticsMessage(DeathStatistic(ScoreCard.deathCount(avatar.scorecard)))
)
AvatarAction.SendResponse(AvatarStatisticsMessage(DeathStatistic(ScoreCard.deathCount(avatar.scorecard))))
)
}
@ -3494,8 +3490,7 @@ class AvatarActor(
value: Int
): Unit = {
import akka.actor.typed.scaladsl.adapter.TypedActorRefOps
import net.psforever.services.avatar.{AvatarResponse => RESP}
sessionActor.toClassic ! AvatarServiceResponse("", guid, RESP.AvatarImplant(action, index, value))
sessionActor.toClassic ! AvatarServiceResponse("", guid, AvatarAction.AvatarImplant(action, index, value))
}
private def buyImplantAction(
@ -3656,7 +3651,7 @@ class AvatarActor(
// What is normally a 60s timer that is set to 120s on the server will still visually update as if 60s
session.get.zone.AvatarEvents ! AvatarServiceMessage(
avatar.name,
AvatarAction.SendResponse(Service.defaultPlayerGUID, ActionProgressMessage(slot + 6, actionProgress))
AvatarAction.SendResponse(ActionProgressMessage(slot + 6, actionProgress))
)
implant.copy(initialized = false, active = false, timer = futureDelay)
} else {
@ -3705,7 +3700,7 @@ class AvatarActor(
//can not formally stop the initialization time on the character information window; set it to 100 to make it look blank
session.get.zone.AvatarEvents ! AvatarServiceMessage(
avatar.name,
AvatarAction.SendResponse(Service.defaultPlayerGUID, ActionProgressMessage(slot + 6, 100))
AvatarAction.SendResponse(ActionProgressMessage(slot + 6, 100))
)
implant.copy(initialized = false, active = false, timer = 0L)
}
@ -3775,7 +3770,8 @@ class AvatarActor(
// Deactivation sound / effect
session.get.zone.AvatarEvents ! AvatarServiceMessage(
session.get.zone.id,
AvatarAction.PlanetsideAttribute(session.get.player.GUID, 28, implant.definition.implantType.value * 2)
session.get.player.GUID,
AvatarAction.PlanetsideAttribute(28, implant.definition.implantType.value * 2)
)
sendAvatarImplantMessageToSelf(session.get.player.GUID, ImplantAction.Activation, slot, value = 0)
implant.copy(active = false)
@ -3852,10 +3848,7 @@ class AvatarActor(
val newHealth = player.Health = originalHealth + 1
val events = zone.AvatarEvents
player.LogActivity(HealFromImplant(implant.definition.implantType, 1))
events ! AvatarServiceMessage(
zone.id,
AvatarAction.PlanetsideAttributeToAll(guid, 0, newHealth)
)
events ! AvatarServiceMessage(zone.id, guid, AvatarAction.PlanetsideAttributeToAll(0, newHealth))
false
} else {
!aliveAndWounded
@ -3869,8 +3862,8 @@ class AvatarActor(
val zone = sess.zone
zone.AvatarEvents ! AvatarServiceMessage(
zone.id,
sess.player.GUID,
AvatarAction.PlanetsideAttribute(
sess.player.GUID,
28,
implant.definition.implantType.value * 2 + 1
)
@ -3894,7 +3887,7 @@ class AvatarActor(
val actionProgress = calculateImplantTimerStats(implant, AvatarActor.initializationTime(implant))._3
session.get.zone.AvatarEvents ! AvatarServiceMessage(
avatar.name,
AvatarAction.SendResponse(Service.defaultPlayerGUID, ActionProgressMessage(slot + 6, actionProgress))
AvatarAction.SendResponse(ActionProgressMessage(slot + 6, actionProgress))
)
implantOpt
case (None, _) =>

View file

@ -12,7 +12,8 @@ import net.psforever.objects.serverobject.containable.ContainableBehavior
import net.psforever.objects.serverobject.mount.Mountable
import net.psforever.objects.vital.RevivingActivity
import net.psforever.packet.game.{AvatarImplantMessage, CreateShortcutMessage, ImplantAction}
import net.psforever.services.avatar.AvatarServiceResponse
import net.psforever.services.avatar.{AvatarAction, AvatarServiceResponse}
import net.psforever.services.base.EventResponse
import net.psforever.types.ImplantType
//
@ -26,7 +27,6 @@ import net.psforever.objects.serverobject.terminals.{ProximityUnit, Terminal}
import net.psforever.objects.zones.Zoning
import net.psforever.packet.game.objectcreate.ObjectCreateMessageParent
import net.psforever.packet.game.{ArmorChangedMessage, ChangeAmmoMessage, ChangeFireModeMessage, ChangeFireStateMessage_Start, ChangeFireStateMessage_Stop, ChatMsg, DestroyMessage, DrowningTarget, GenericActionMessage, GenericObjectActionMessage, HitHint, ItemTransactionResultMessage, ObjectCreateDetailedMessage, ObjectCreateMessage, ObjectDeleteMessage, ObjectHeldMessage, OxygenStateMessage, PlanetsideAttributeMessage, PlayerStateMessage, ProjectileStateMessage, ReloadMessage, SetEmpireMessage, UseItemMessage, WeaponDryFireMessage}
import net.psforever.services.avatar.AvatarResponse
import net.psforever.services.Service
import net.psforever.types.{ChatMessageType, PlanetSideGUID, TransactionType, Vector3}
import net.psforever.util.Config
@ -48,7 +48,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
* @param guid na
* @param reply na
*/
def handle(toChannel: String, guid: PlanetSideGUID, reply: AvatarResponse.Response): Unit = {
def handle(toChannel: String, guid: PlanetSideGUID, reply: EventResponse): Unit = {
val resolvedPlayerGuid = if (player != null && player.HasGUID) {
player.GUID
} else {
@ -58,16 +58,16 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
val isSameTarget = !isNotSameTarget
reply match {
/* special messages */
case AvatarResponse.TeardownConnection() if player.spectator =>
case AvatarAction.TeardownConnection() if player.spectator =>
context.self ! SessionActor.SetMode(CustomerServiceRepresentativeMode)
context.self.forward(AvatarServiceResponse(toChannel, guid, reply))
case AvatarResponse.TeardownConnection() =>
case AvatarAction.TeardownConnection() =>
context.self ! SessionActor.SetMode(NormalMode)
context.self.forward(AvatarServiceResponse(toChannel, guid, reply))
/* really common messages (very frequently, every life) */
case pstate @ AvatarResponse.PlayerState(
case pstate @ AvatarAction.PlayerState(
pos,
vel,
yaw,
@ -167,7 +167,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
}
}
case AvatarResponse.AvatarImplant(ImplantAction.Add, implant_slot, value)
case AvatarAction.AvatarImplant(ImplantAction.Add, implant_slot, value)
if value == ImplantType.SecondWind.value =>
sendResponse(AvatarImplantMessage(resolvedPlayerGuid, ImplantAction.Add, implant_slot, 7))
//second wind does not normally load its icon into the shortcut hotbar
@ -179,7 +179,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
sendResponse(CreateShortcutMessage(resolvedPlayerGuid, index + 1, Some(ImplantType.SecondWind.shortcut)))
}
case AvatarResponse.AvatarImplant(ImplantAction.Remove, implant_slot, value)
case AvatarAction.AvatarImplant(ImplantAction.Remove, implant_slot, value)
if value == ImplantType.SecondWind.value =>
sendResponse(AvatarImplantMessage(resolvedPlayerGuid, ImplantAction.Remove, implant_slot, value))
//second wind does not normally unload its icon from the shortcut hotbar
@ -195,10 +195,10 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
sendResponse(CreateShortcutMessage(resolvedPlayerGuid, index + 1, None))
}
case AvatarResponse.AvatarImplant(action, implant_slot, value) =>
case AvatarAction.AvatarImplant(action, implant_slot, value) =>
sendResponse(AvatarImplantMessage(resolvedPlayerGuid, action, implant_slot, value))
case AvatarResponse.ObjectHeld(slot, _)
case AvatarAction.ObjectHeld(slot, _)
if isSameTarget && player.VisibleSlots.contains(slot) =>
sendResponse(ObjectHeldMessage(guid, slot, unk1=true))
//Stop using proximity terminals if player unholsters a weapon
@ -209,76 +209,76 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
sessionLogic.zoning.spawn.stopDeconstructing()
}
case AvatarResponse.ObjectHeld(slot, _)
case AvatarAction.ObjectHeld(slot, _)
if isSameTarget && slot > -1 =>
sendResponse(ObjectHeldMessage(guid, slot, unk1=true))
case AvatarResponse.ObjectHeld(_, _)
case AvatarAction.ObjectHeld(_, _)
if isSameTarget => ()
case AvatarResponse.ObjectHeld(_, previousSlot) =>
case AvatarAction.ObjectHeld(_, previousSlot) =>
sendResponse(ObjectHeldMessage(guid, previousSlot, unk1=false))
case AvatarResponse.ChangeFireState_Start(weaponGuid)
case AvatarAction.ChangeFireState_Start(weaponGuid)
if isNotSameTarget && ops.lastSeenStreamMessage.get(guid.guid).exists { _.visible } =>
sendResponse(ChangeFireStateMessage_Start(weaponGuid))
val entry = ops.lastSeenStreamMessage(guid.guid)
ops.lastSeenStreamMessage.put(guid.guid, entry.copy(shooting = Some(weaponGuid)))
case AvatarResponse.ChangeFireState_Start(weaponGuid)
case AvatarAction.ChangeFireState_Start(weaponGuid)
if isNotSameTarget =>
sendResponse(ChangeFireStateMessage_Start(weaponGuid))
case AvatarResponse.ChangeFireState_Stop(weaponGuid)
case AvatarAction.ChangeFireState_Stop(weaponGuid)
if isNotSameTarget && ops.lastSeenStreamMessage.get(guid.guid).exists { msg => msg.visible || msg.shooting.nonEmpty } =>
sendResponse(ChangeFireStateMessage_Stop(weaponGuid))
val entry = ops.lastSeenStreamMessage(guid.guid)
ops.lastSeenStreamMessage.put(guid.guid, entry.copy(shooting = None))
case AvatarResponse.ChangeFireState_Stop(weaponGuid)
case AvatarAction.ChangeFireState_Stop(weaponGuid)
if isNotSameTarget =>
sendResponse(ChangeFireStateMessage_Stop(weaponGuid))
case AvatarResponse.LoadPlayer(pkt) if isNotSameTarget =>
case AvatarAction.LoadCreatedPlayer(pkt) if isNotSameTarget =>
sendResponse(pkt)
case AvatarResponse.EquipmentInHand(pkt) if isNotSameTarget =>
case AvatarAction.EquipmentCreatedInHand(pkt) if isNotSameTarget =>
sendResponse(pkt)
case AvatarResponse.PlanetsideAttribute(attributeType, attributeValue) if isNotSameTarget =>
case AvatarAction.PlanetsideAttribute(attributeType, attributeValue) if isNotSameTarget =>
sendResponse(PlanetsideAttributeMessage(guid, attributeType, attributeValue))
case AvatarResponse.PlanetsideAttributeToAll(attributeType, attributeValue) =>
case AvatarAction.PlanetsideAttributeToAll(attributeType, attributeValue) =>
sendResponse(PlanetsideAttributeMessage(guid, attributeType, attributeValue))
case AvatarResponse.PlanetsideAttributeSelf(attributeType, attributeValue) if isSameTarget =>
case AvatarAction.PlanetsideAttributeSelf(attributeType, attributeValue) if isSameTarget =>
sendResponse(PlanetsideAttributeMessage(guid, attributeType, attributeValue))
case AvatarResponse.GenericObjectAction(objectGuid, actionCode) if isNotSameTarget =>
case AvatarAction.GenericObjectAction(objectGuid, actionCode) if isNotSameTarget =>
sendResponse(GenericObjectActionMessage(objectGuid, actionCode))
case AvatarResponse.HitHint(sourceGuid) if player.isAlive =>
case AvatarAction.HitHint(sourceGuid) if player.isAlive =>
sendResponse(HitHint(sourceGuid, guid))
sessionLogic.zoning.CancelZoningProcess()
case AvatarResponse.Destroy(victim, killer, weapon, pos) =>
case AvatarAction.Destroy(victim, killer, weapon, pos) =>
// guid = victim // killer = killer
sendResponse(DestroyMessage(victim, killer, weapon, pos))
case AvatarResponse.DestroyDisplay(killer, victim, method, unk) =>
case AvatarAction.DestroyDisplay(killer, victim, method, unk) =>
sendResponse(ops.destroyDisplayMessage(killer, victim, method, unk))
case AvatarResponse.TerminalOrderResult(terminalGuid, action, result)
case AvatarAction.TerminalOrderResult(terminalGuid, action, result)
if result && (action == TransactionType.Buy || action == TransactionType.Loadout) =>
sendResponse(ItemTransactionResultMessage(terminalGuid, action, result))
sessionLogic.terminals.lastTerminalOrderFulfillment = true
AvatarActor.savePlayerData(player)
case AvatarResponse.TerminalOrderResult(terminalGuid, action, result) =>
case AvatarAction.TerminalOrderResult(terminalGuid, action, result) =>
sendResponse(ItemTransactionResultMessage(terminalGuid, action, result))
sessionLogic.terminals.lastTerminalOrderFulfillment = true
case AvatarResponse.ChangeExosuit(
case AvatarAction.ChangeExosuit(
target,
armor,
exosuit,
@ -336,7 +336,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
}
DropLeftovers(player)(drop)
case AvatarResponse.ChangeExosuit(target, armor, exosuit, subtype, slot, _, oldHolsters, holsters, _, _, drop, delete) =>
case AvatarAction.ChangeExosuit(target, armor, exosuit, subtype, slot, _, oldHolsters, holsters, _, _, drop, delete) =>
sendResponse(ArmorChangedMessage(target, exosuit, subtype))
sendResponse(PlanetsideAttributeMessage(target, attribute_type=4, armor))
//happening to some other player
@ -361,7 +361,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
)
}
case AvatarResponse.ChangeLoadout(
case AvatarAction.ChangeLoadout(
target,
armor,
exosuit,
@ -398,7 +398,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
}
DropLeftovers(player)(drops)
case AvatarResponse.ChangeLoadout(target, armor, exosuit, subtype, slot, _, oldHolsters, _, _, _, _) =>
case AvatarAction.ChangeLoadout(target, armor, exosuit, subtype, slot, _, oldHolsters, _, _, _, _) =>
//redraw handled by callbacks
sendResponse(ArmorChangedMessage(target, exosuit, subtype))
sendResponse(PlanetsideAttributeMessage(target, attribute_type=4, armor))
@ -407,7 +407,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
//cleanup
oldHolsters.foreach { case (_, guid) => sendResponse(ObjectDeleteMessage(guid, unk1=0)) }
case AvatarResponse.UseKit(kguid, kObjId) =>
case AvatarAction.UseKit(kguid, kObjId) =>
sendResponse(
UseItemMessage(
resolvedPlayerGuid,
@ -425,25 +425,25 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
)
sendResponse(ObjectDeleteMessage(kguid, unk1=0))
case AvatarResponse.KitNotUsed(_, "") =>
case AvatarAction.KitNotUsed(_, "") =>
sessionLogic.general.kitToBeUsed = None
case AvatarResponse.KitNotUsed(_, msg) =>
case AvatarAction.KitNotUsed(_, msg) =>
sessionLogic.general.kitToBeUsed = None
sendResponse(ChatMsg(ChatMessageType.UNK_225, msg))
case AvatarResponse.SendResponse(msg) =>
case AvatarAction.SendResponse(msg) =>
sendResponse(msg)
case AvatarResponse.SendResponseTargeted(targetGuid, msg) if resolvedPlayerGuid == targetGuid =>
case AvatarAction.SendResponseTargeted(targetGuid, msg) if resolvedPlayerGuid == targetGuid =>
sendResponse(msg)
/* common messages (maybe once every respawn) */
case AvatarResponse.Reload(itemGuid)
case AvatarAction.Reload(itemGuid)
if isNotSameTarget && ops.lastSeenStreamMessage.get(guid.guid).exists { _.visible } =>
sendResponse(ReloadMessage(itemGuid, ammo_clip=1, unk1=0))
case AvatarResponse.Killed(_, mount) =>
case AvatarAction.Killed(_, mount) =>
//pure logic
sessionLogic.shooting.shotsWhileDead = 0
sessionLogic.zoning.CancelZoningProcess()
@ -480,10 +480,10 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
//render
CustomerServiceRepresentativeMode.renderPlayer(sessionLogic, continent, player)
case AvatarResponse.Release(tplayer) if isNotSameTarget =>
case AvatarAction.ReleasePlayer(tplayer) if isNotSameTarget =>
sessionLogic.zoning.spawn.DepictPlayerAsCorpse(tplayer)
case AvatarResponse.Revive(revivalTargetGuid)
case AvatarAction.Revive(revivalTargetGuid)
if resolvedPlayerGuid == revivalTargetGuid =>
ops.revive()
player.Actor ! Player.Revive
@ -498,51 +498,51 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
}
/* uncommon messages (utility, or once in a while) */
case AvatarResponse.ChangeAmmo(weapon_guid, weapon_slot, previous_guid, ammo_id, ammo_guid, ammo_data)
case AvatarAction.ChangeAmmo(weapon_guid, weapon_slot, previous_guid, ammo_id, ammo_guid, ammo_data)
if isNotSameTarget && ops.lastSeenStreamMessage.get(guid.guid).exists { _.visible } =>
ops.changeAmmoProcedures(weapon_guid, previous_guid, ammo_id, ammo_guid, weapon_slot, ammo_data)
sendResponse(ChangeAmmoMessage(weapon_guid, 1))
case AvatarResponse.ChangeAmmo(weapon_guid, weapon_slot, previous_guid, ammo_id, ammo_guid, ammo_data)
case AvatarAction.ChangeAmmo(weapon_guid, weapon_slot, previous_guid, ammo_id, ammo_guid, ammo_data)
if isNotSameTarget =>
ops.changeAmmoProcedures(weapon_guid, previous_guid, ammo_id, ammo_guid, weapon_slot, ammo_data)
case AvatarResponse.ChangeFireMode(itemGuid, mode) if isNotSameTarget =>
case AvatarAction.ChangeFireMode(itemGuid, mode) if isNotSameTarget =>
sendResponse(ChangeFireModeMessage(itemGuid, mode))
case AvatarResponse.ConcealPlayer() =>
case AvatarAction.ConcealPlayer(_) =>
sendResponse(GenericObjectActionMessage(guid, code=9))
case AvatarResponse.EnvironmentalDamage(_, _, _) =>
case AvatarAction.EnvironmentalDamage(_, _, _) =>
//TODO damage marker?
sessionLogic.zoning.CancelZoningProcess()
case AvatarResponse.DropItem(pkt) if isNotSameTarget =>
case AvatarAction.DropCreatedItem(pkt) if isNotSameTarget =>
sendResponse(pkt)
case AvatarResponse.ObjectDelete(itemGuid, unk) if isNotSameTarget =>
case AvatarAction.ObjectDelete(itemGuid, unk) if isNotSameTarget =>
sendResponse(ObjectDeleteMessage(itemGuid, unk))
/* rare messages */
case AvatarResponse.SetEmpire(objectGuid, faction) if isNotSameTarget =>
case AvatarAction.SetEmpire(objectGuid, faction) if isNotSameTarget =>
sendResponse(SetEmpireMessage(objectGuid, faction))
case AvatarResponse.DropSpecialItem() =>
case AvatarAction.DropSpecialItem() =>
sessionLogic.general.dropSpecialSlotItem()
case AvatarResponse.OxygenState(player, vehicle) =>
case AvatarAction.OxygenState(player, vehicle) =>
sendResponse(OxygenStateMessage(
DrowningTarget(player.guid, player.progress, player.state),
vehicle.flatMap { vinfo => Some(DrowningTarget(vinfo.guid, vinfo.progress, vinfo.state)) }
))
case AvatarResponse.LoadProjectile(pkt) if isNotSameTarget =>
case AvatarAction.LoadCreatedProjectile(pkt) if isNotSameTarget =>
sendResponse(pkt)
case AvatarResponse.ProjectileState(projectileGuid, shotPos, shotVel, shotOrient, seq, end, targetGuid) if isNotSameTarget =>
case AvatarAction.ProjectileState(projectileGuid, shotPos, shotVel, shotOrient, seq, end, targetGuid) if isNotSameTarget =>
sendResponse(ProjectileStateMessage(projectileGuid, shotPos, shotVel, shotOrient, seq, end, targetGuid))
case AvatarResponse.ProjectileExplodes(projectileGuid, projectile) =>
case AvatarAction.ProjectileExplodes(projectileGuid, projectile) =>
sendResponse(
ProjectileStateMessage(
projectileGuid,
@ -556,13 +556,13 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
)
sendResponse(ObjectDeleteMessage(projectileGuid, unk1=2))
case AvatarResponse.ProjectileAutoLockAwareness(mode) =>
case AvatarAction.ProjectileAutoLockAwareness(mode) =>
sendResponse(GenericActionMessage(mode))
case AvatarResponse.PutDownFDU(target) if isNotSameTarget =>
case AvatarAction.PutDownFDU(target) if isNotSameTarget =>
sendResponse(GenericObjectActionMessage(target, code=53))
case AvatarResponse.StowEquipment(target, slot, item) if isNotSameTarget =>
case AvatarAction.StowEquipment(target, slot, item) if isNotSameTarget =>
val definition = item.Definition
sendResponse(
ObjectCreateDetailedMessage(
@ -573,7 +573,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
)
)
case AvatarResponse.WeaponDryFire(weaponGuid)
case AvatarAction.WeaponDryFire(weaponGuid)
if isNotSameTarget && ops.lastSeenStreamMessage.get(guid.guid).exists { _.visible } =>
continent.GUID(weaponGuid).collect {
case tool: Tool if tool.Magazine == 0 =>

View file

@ -320,7 +320,8 @@ class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) ext
val definition = spectator.Definition
events ! AvatarServiceMessage(
channel,
AvatarAction.LoadPlayer(guid, definition.ObjectId, guid, definition.Packet.ConstructorData(spectator).get, None)
guid,
AvatarAction.LoadPlayer(definition.ObjectId, guid, definition.Packet.ConstructorData(spectator).get, None)
)
}
true
@ -336,10 +337,7 @@ class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) ext
.filter(_.spectator)
.foreach { spectator =>
val guid = spectator.GUID
events ! AvatarServiceMessage(
channel,
AvatarAction.ObjectDelete(guid, guid)
)
events ! AvatarServiceMessage(channel, guid, AvatarAction.ObjectDelete(guid))
}
true
}
@ -394,7 +392,7 @@ class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) ext
o.Faction = foundFaction
continent.AvatarEvents ! AvatarServiceMessage(
continent.id,
AvatarAction.SetEmpire(Service.defaultPlayerGUID, o.GUID, foundFaction)
AvatarAction.SetEmpire(o.GUID, foundFaction)
)
true
case o: Building =>
@ -407,7 +405,7 @@ class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) ext
o.Faction = foundFaction
continent.AvatarEvents ! AvatarServiceMessage(
continent.id,
AvatarAction.SetEmpire(Service.defaultPlayerGUID, o.GUID, foundFaction)
AvatarAction.SetEmpire(o.GUID, foundFaction)
)
true
}

View file

@ -120,6 +120,10 @@ class CustomerServiceRepresentativeMode(data: SessionData) extends ModeLogic {
.GUID(player.VehicleSeated)
.collect { case obj: PlanetSideGameObject with Vitality =>
CustomerServiceRepresentativeMode.topOffHealth(data, obj)
obj
}
.getOrElse {
data.updateBlockMap(player, player.Position)
}
data.squad.updateSquad()
} else {
@ -144,13 +148,16 @@ case object CustomerServiceRepresentativeMode extends PlayerMode {
packet.DetailedConstructorData(player).get
))
data.zoning.spawn.HandleSetCurrentAvatar(player)
zone.AvatarEvents ! AvatarServiceMessage(zone.id, AvatarAction.LoadPlayer(
zone.AvatarEvents ! AvatarServiceMessage(
zone.id,
pguid,
objectClass,
pguid,
packet.ConstructorData(player).get,
None
))
AvatarAction.LoadPlayer(
objectClass,
pguid,
packet.ConstructorData(player).get,
None
)
)
}
def topOffHealth(data: SessionData, obj: PlanetSideGameObject with Vitality): Unit = {
@ -174,14 +181,14 @@ case object CustomerServiceRepresentativeMode extends PlayerMode {
player.Health = maxHealthOfPlayer.toInt
player.LogActivity(player.ClearHistory().head)
data.sendResponse(PlanetsideAttributeMessage(guid, 0, maxHealthOfPlayer))
data.continent.AvatarEvents ! AvatarServiceMessage(zoneid, AvatarAction.PlanetsideAttribute(guid, 0, maxHealthOfPlayer))
data.continent.AvatarEvents ! AvatarServiceMessage(zoneid, guid, AvatarAction.PlanetsideAttribute(0, maxHealthOfPlayer))
}
//below half armor, full armor
val maxArmor = player.MaxArmor.toLong
if (player.Armor < maxArmor) {
player.Armor = maxArmor.toInt
data.sendResponse(PlanetsideAttributeMessage(guid, 4, maxArmor))
data.continent.AvatarEvents ! AvatarServiceMessage(zoneid, AvatarAction.PlanetsideAttribute(guid, 4, maxArmor))
data.continent.AvatarEvents ! AvatarServiceMessage(zoneid, guid, AvatarAction.PlanetsideAttribute(4, maxArmor))
}
}

View file

@ -34,7 +34,7 @@ import net.psforever.packet.PlanetSideGamePacket
import net.psforever.packet.game.OutfitEventAction.{Initial, OutfitInfo, OutfitRankNames, Unk1}
import net.psforever.packet.game.{ActionCancelMessage, AvatarFirstTimeEventMessage, AvatarImplantMessage, AvatarJumpMessage, BattleplanMessage, BindPlayerMessage, BugReportMessage, ChangeFireModeMessage, ChangeShortcutBankMessage, CharacterCreateRequestMessage, CharacterRequestMessage, ChatMsg, CollisionIs, ConnectToWorldRequestMessage, CreateShortcutMessage, DeadState, DeployObjectMessage, DisplayedAwardMessage, DropItemMessage, EmoteMsg, FacilityBenefitShieldChargeRequestMessage, FriendsRequest, GenericAction, GenericActionMessage, GenericCollisionMsg, GenericObjectActionAtPositionMessage, GenericObjectActionMessage, GenericObjectStateMsg, HitHint, InvalidTerrainMessage, LootItemMessage, MoveItemMessage, ObjectDetectedMessage, ObjectHeldMessage, OutfitEvent, OutfitMemberEvent, OutfitMembershipRequest, OutfitMembershipResponse, OutfitRequest, OutfitRequestAction, PickupItemMessage, PlanetsideAttributeMessage, PlayerStateMessageUpstream, RequestDestroyMessage, TargetingImplantRequest, TerrainCondition, TradeMessage, UnuseItemMessage, UseItemMessage, VoiceHostInfo, VoiceHostRequest, ZipLineMessage}
import net.psforever.services.RemoverActor
import net.psforever.services.avatar.{AvatarAction, AvatarServiceMessage}
import net.psforever.services.avatar.{AvatarAction, AvatarServiceMessage, CorpseEnvelope}
import net.psforever.services.local.{LocalAction, LocalServiceMessage}
import net.psforever.types.{CapacitorStateType, ChatMessageType, Cosmetic, ExoSuitType, PlanetSideEmpire, PlanetSideGUID, Vector3}
@ -134,8 +134,8 @@ class GeneralLogic(val ops: GeneralOperations, implicit val context: ActorContex
(player.isAlive && sessionLogic.zoning.spawn.deadState == DeadState.RespawnTime)
continent.AvatarEvents ! AvatarServiceMessage(
channel,
avatarGuid,
AvatarAction.PlayerState(
avatarGuid,
player.Position,
player.Velocity,
yaw,
@ -239,7 +239,7 @@ class GeneralLogic(val ops: GeneralOperations, implicit val context: ActorContex
case Some(obj: Player) if obj.isBackpack =>
obj.Position = Vector3.Zero
continent.AvatarEvents ! AvatarServiceMessage.Corpse(RemoverActor.ClearSpecific(List(obj), continent))
continent.AvatarEvents ! CorpseEnvelope(RemoverActor.ClearSpecific(List(obj), continent))
case Some(obj: Player) =>
sessionLogic.general.suicide(obj)
@ -441,7 +441,8 @@ class GeneralLogic(val ops: GeneralOperations, implicit val context: ActorContex
player.UsingSpecial = SpecialExoSuitDefinition.Mode.Anchored
continent.AvatarEvents ! AvatarServiceMessage(
continent.id,
AvatarAction.PlanetsideAttribute(player.GUID, 19, 1)
player.GUID,
AvatarAction.PlanetsideAttribute(19, 1)
)
definition match {
case GlobalDefinitions.trhev_dualcycler | GlobalDefinitions.trhev_burster =>
@ -461,7 +462,8 @@ class GeneralLogic(val ops: GeneralOperations, implicit val context: ActorContex
player.UsingSpecial = SpecialExoSuitDefinition.Mode.Normal
continent.AvatarEvents ! AvatarServiceMessage(
continent.id,
AvatarAction.PlanetsideAttribute(player.GUID, 19, 0)
player.GUID,
AvatarAction.PlanetsideAttribute(19, 0)
)
definition match {
case GlobalDefinitions.trhev_dualcycler | GlobalDefinitions.trhev_burster =>

View file

@ -45,7 +45,7 @@ class SpectatorCSRModeLogic(data: SessionData) extends ModeLogic {
//
player.spectator = true
data.chat.JoinChannel(SpectatorChannel)
continent.AvatarEvents ! AvatarServiceMessage(continent.id, AvatarAction.ObjectDelete(pguid, pguid))
continent.AvatarEvents ! AvatarServiceMessage(continent.id, pguid, AvatarAction.ObjectDelete(pguid))
sendResponse(ChatMsg(ChatMessageType.CMT_TOGGLESPECTATORMODE, "on"))
sendResponse(ChatMsg(ChatMessageType.UNK_225, "CSR SPECTATOR MODE ON"))
}
@ -61,7 +61,8 @@ class SpectatorCSRModeLogic(data: SessionData) extends ModeLogic {
data.chat.LeaveChannel(SpectatorChannel)
continent.AvatarEvents ! AvatarServiceMessage(
continent.id,
AvatarAction.LoadPlayer(pguid, avatarId, pguid, player.Definition.Packet.ConstructorData(player).get, None)
pguid,
AvatarAction.LoadPlayer(avatarId, pguid, player.Definition.Packet.ConstructorData(player).get, None)
)
sendResponse(ChatMsg(ChatMessageType.CMT_TOGGLESPECTATORMODE, "off"))
}

View file

@ -13,6 +13,7 @@ import net.psforever.objects.vital.RevivingActivity
import net.psforever.objects.vital.interaction.Adversarial
import net.psforever.packet.game.{AvatarImplantMessage, CreateShortcutMessage, ImplantAction, PlanetsideStringAttributeMessage}
import net.psforever.services.avatar.{AvatarAction, AvatarServiceMessage}
import net.psforever.services.base.EventResponse
import net.psforever.types.ImplantType
import scala.concurrent.duration._
@ -29,7 +30,6 @@ import net.psforever.objects.vital.etc.ExplodingEntityReason
import net.psforever.objects.zones.Zoning
import net.psforever.packet.game.objectcreate.ObjectCreateMessageParent
import net.psforever.packet.game.{ArmorChangedMessage, AvatarDeadStateMessage, ChangeAmmoMessage, ChangeFireModeMessage, ChangeFireStateMessage_Start, ChangeFireStateMessage_Stop, ChatMsg, DeadState, DestroyMessage, DrowningTarget, GenericActionMessage, GenericObjectActionMessage, HitHint, ItemTransactionResultMessage, ObjectCreateDetailedMessage, ObjectCreateMessage, ObjectDeleteMessage, ObjectHeldMessage, OxygenStateMessage, PlanetsideAttributeMessage, PlayerStateMessage, ProjectileStateMessage, ReloadMessage, SetEmpireMessage, UseItemMessage, WeaponDryFireMessage}
import net.psforever.services.avatar.AvatarResponse
import net.psforever.services.Service
import net.psforever.types.{ChatMessageType, PlanetSideGUID, TransactionType, Vector3}
import net.psforever.util.Config
@ -51,7 +51,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
* @param guid na
* @param reply na
*/
def handle(toChannel: String, guid: PlanetSideGUID, reply: AvatarResponse.Response): Unit = {
def handle(toChannel: String, guid: PlanetSideGUID, reply: EventResponse): Unit = {
val resolvedPlayerGuid = if (player != null && player.HasGUID) {
player.GUID
} else {
@ -61,12 +61,12 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
val isSameTarget = !isNotSameTarget
reply match {
/* special messages */
case AvatarResponse.TeardownConnection() =>
case AvatarAction.TeardownConnection() =>
log.trace(s"ending ${player.Name}'s old session by event system request (relog)")
context.stop(context.self)
/* really common messages (very frequently, every life) */
case pstate @ AvatarResponse.PlayerState(
case pstate @ AvatarAction.PlayerState(
pos,
vel,
yaw,
@ -166,7 +166,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
}
}
case AvatarResponse.AvatarImplant(ImplantAction.Add, implant_slot, value)
case AvatarAction.AvatarImplant(ImplantAction.Add, implant_slot, value)
if value == ImplantType.SecondWind.value =>
sendResponse(AvatarImplantMessage(resolvedPlayerGuid, ImplantAction.Add, implant_slot, 7))
//second wind does not normally load its icon into the shortcut hotbar
@ -178,7 +178,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
sendResponse(CreateShortcutMessage(resolvedPlayerGuid, index + 1, Some(ImplantType.SecondWind.shortcut)))
}
case AvatarResponse.AvatarImplant(ImplantAction.Remove, implant_slot, value)
case AvatarAction.AvatarImplant(ImplantAction.Remove, implant_slot, value)
if value == ImplantType.SecondWind.value =>
sendResponse(AvatarImplantMessage(resolvedPlayerGuid, ImplantAction.Remove, implant_slot, value))
//second wind does not normally unload its icon from the shortcut hotbar
@ -194,10 +194,10 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
sendResponse(CreateShortcutMessage(resolvedPlayerGuid, index + 1, None))
}
case AvatarResponse.AvatarImplant(action, implant_slot, value) =>
case AvatarAction.AvatarImplant(action, implant_slot, value) =>
sendResponse(AvatarImplantMessage(resolvedPlayerGuid, action, implant_slot, value))
case AvatarResponse.ObjectHeld(slot, _)
case AvatarAction.ObjectHeld(slot, _)
if isSameTarget && player.VisibleSlots.contains(slot) =>
sendResponse(ObjectHeldMessage(guid, slot, unk1=true))
//Stop using proximity terminals if player unholsters a weapon
@ -208,69 +208,69 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
sessionLogic.zoning.spawn.stopDeconstructing()
}
case AvatarResponse.ObjectHeld(slot, _)
case AvatarAction.ObjectHeld(slot, _)
if isSameTarget && slot > -1 =>
sendResponse(ObjectHeldMessage(guid, slot, unk1=true))
case AvatarResponse.ObjectHeld(_, _)
case AvatarAction.ObjectHeld(_, _)
if isSameTarget => ()
case AvatarResponse.ObjectHeld(_, previousSlot) =>
case AvatarAction.ObjectHeld(_, previousSlot) =>
sendResponse(ObjectHeldMessage(guid, previousSlot, unk1=false))
case AvatarResponse.ChangeFireState_Start(weaponGuid)
case AvatarAction.ChangeFireState_Start(weaponGuid)
if isNotSameTarget && ops.lastSeenStreamMessage.get(guid.guid).exists { _.visible } =>
sendResponse(ChangeFireStateMessage_Start(weaponGuid))
val entry = ops.lastSeenStreamMessage(guid.guid)
ops.lastSeenStreamMessage.put(guid.guid, entry.copy(shooting = Some(weaponGuid)))
case AvatarResponse.ChangeFireState_Start(weaponGuid)
case AvatarAction.ChangeFireState_Start(weaponGuid)
if isNotSameTarget =>
sendResponse(ChangeFireStateMessage_Start(weaponGuid))
case AvatarResponse.ChangeFireState_Stop(weaponGuid)
case AvatarAction.ChangeFireState_Stop(weaponGuid)
if isNotSameTarget && ops.lastSeenStreamMessage.get(guid.guid).exists { msg => msg.visible || msg.shooting.nonEmpty } =>
sendResponse(ChangeFireStateMessage_Stop(weaponGuid))
val entry = ops.lastSeenStreamMessage(guid.guid)
ops.lastSeenStreamMessage.put(guid.guid, entry.copy(shooting = None))
case AvatarResponse.ChangeFireState_Stop(weaponGuid)
case AvatarAction.ChangeFireState_Stop(weaponGuid)
if isNotSameTarget =>
sendResponse(ChangeFireStateMessage_Stop(weaponGuid))
case AvatarResponse.LoadPlayer(pkt) if isNotSameTarget =>
case AvatarAction.LoadCreatedPlayer(pkt) if isNotSameTarget =>
sendResponse(pkt)
case AvatarResponse.EquipmentInHand(pkt) if isNotSameTarget =>
case AvatarAction.EquipmentCreatedInHand(pkt) if isNotSameTarget =>
sendResponse(pkt)
case AvatarResponse.PlanetsideAttribute(attributeType, attributeValue) if isNotSameTarget =>
case AvatarAction.PlanetsideAttribute(attributeType, attributeValue) if isNotSameTarget =>
sendResponse(PlanetsideAttributeMessage(guid, attributeType, attributeValue))
case AvatarResponse.PlanetsideAttributeToAll(attributeType, attributeValue) =>
case AvatarAction.PlanetsideAttributeToAll(attributeType, attributeValue) =>
sendResponse(PlanetsideAttributeMessage(guid, attributeType, attributeValue))
case AvatarResponse.PlanetsideAttributeSelf(attributeType, attributeValue) if isSameTarget =>
case AvatarAction.PlanetsideAttributeSelf(attributeType, attributeValue) if isSameTarget =>
sendResponse(PlanetsideAttributeMessage(guid, attributeType, attributeValue))
case AvatarResponse.PlanetsideStringAttribute(attributeType, attributeValue) =>
case AvatarAction.PlanetsideStringAttribute(attributeType, attributeValue) =>
sendResponse(PlanetsideStringAttributeMessage(guid, attributeType, attributeValue))
case AvatarResponse.GenericObjectAction(objectGuid, actionCode) if isNotSameTarget =>
case AvatarAction.GenericObjectAction(objectGuid, actionCode) if isNotSameTarget =>
sendResponse(GenericObjectActionMessage(objectGuid, actionCode))
case AvatarResponse.HitHint(sourceGuid) if player.isAlive =>
case AvatarAction.HitHint(sourceGuid) if player.isAlive =>
sendResponse(HitHint(sourceGuid, guid))
sessionLogic.zoning.CancelZoningProcessWithDescriptiveReason("cancel_dmg")
case AvatarResponse.Destroy(victim, killer, weapon, pos) =>
case AvatarAction.Destroy(victim, killer, weapon, pos) =>
// guid = victim // killer = killer
sendResponse(DestroyMessage(victim, killer, weapon, pos))
case AvatarResponse.DestroyDisplay(killer, victim, method, unk) =>
case AvatarAction.DestroyDisplay(killer, victim, method, unk) =>
sendResponse(ops.destroyDisplayMessage(killer, victim, method, unk))
case AvatarResponse.TerminalOrderResult(terminalGuid, action, result)
case AvatarAction.TerminalOrderResult(terminalGuid, action, result)
if result && (action == TransactionType.Buy || action == TransactionType.Loadout) =>
sendResponse(ItemTransactionResultMessage(terminalGuid, action, result))
sessionLogic.terminals.lastTerminalOrderFulfillment = true
@ -280,11 +280,11 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
Config.app.game.savedMsg.interruptedByAction.variable
)
case AvatarResponse.TerminalOrderResult(terminalGuid, action, result) =>
case AvatarAction.TerminalOrderResult(terminalGuid, action, result) =>
sendResponse(ItemTransactionResultMessage(terminalGuid, action, result))
sessionLogic.terminals.lastTerminalOrderFulfillment = true
case AvatarResponse.ChangeExosuit(
case AvatarAction.ChangeExosuit(
target,
armor,
exosuit,
@ -360,7 +360,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
//deactivate non-passive implants
avatarActor ! AvatarActor.DeactivateActiveImplants
case AvatarResponse.ChangeExosuit(target, armor, exosuit, subtype, slot, _, oldHolsters, holsters, _, _, drop, delete) =>
case AvatarAction.ChangeExosuit(target, armor, exosuit, subtype, slot, _, oldHolsters, holsters, _, _, drop, delete) =>
sendResponse(ArmorChangedMessage(target, exosuit, subtype))
sendResponse(PlanetsideAttributeMessage(target, attribute_type=4, armor))
//happening to some other player
@ -385,7 +385,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
)
}
case AvatarResponse.ChangeLoadout(
case AvatarAction.ChangeLoadout(
target,
armor,
exosuit,
@ -425,7 +425,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
//deactivate non-passive implants
avatarActor ! AvatarActor.DeactivateActiveImplants
case AvatarResponse.ChangeLoadout(target, armor, exosuit, subtype, slot, _, oldHolsters, _, _, _, _) =>
case AvatarAction.ChangeLoadout(target, armor, exosuit, subtype, slot, _, oldHolsters, _, _, _, _) =>
//redraw handled by callbacks
sendResponse(ArmorChangedMessage(target, exosuit, subtype))
sendResponse(PlanetsideAttributeMessage(target, attribute_type=4, armor))
@ -434,7 +434,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
//cleanup
oldHolsters.foreach { case (_, guid) => sendResponse(ObjectDeleteMessage(guid, unk1=0)) }
case AvatarResponse.UseKit(kguid, kObjId) =>
case AvatarAction.UseKit(kguid, kObjId) =>
sendResponse(
UseItemMessage(
resolvedPlayerGuid,
@ -452,52 +452,52 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
)
sendResponse(ObjectDeleteMessage(kguid, unk1=0))
case AvatarResponse.KitNotUsed(_, "") =>
case AvatarAction.KitNotUsed(_, "") =>
sessionLogic.general.kitToBeUsed = None
case AvatarResponse.KitNotUsed(_, msg) =>
case AvatarAction.KitNotUsed(_, msg) =>
sessionLogic.general.kitToBeUsed = None
sendResponse(ChatMsg(ChatMessageType.UNK_225, msg))
case AvatarResponse.UpdateKillsDeathsAssists(_, kda) =>
case AvatarAction.UpdateKillsDeathsAssists(_, kda) =>
avatarActor ! AvatarActor.UpdateKillsDeathsAssists(kda)
case AvatarResponse.AwardBep(charId, bep, expType) =>
case AvatarAction.AwardBep(charId, bep, expType) =>
//if the target player, always award (some) BEP
if (charId == player.CharId) {
avatarActor ! AvatarActor.AwardBep(bep, expType)
}
case AvatarResponse.AwardCep(charId, cep) =>
case AvatarAction.AwardCep(charId, cep) =>
//if the target player, always award (some) CEP
if (charId == player.CharId) {
avatarActor ! AvatarActor.AwardCep(cep)
}
case AvatarResponse.FacilityCaptureRewards(buildingId, zoneNumber, cep) =>
case AvatarAction.FacilityCaptureRewards(buildingId, zoneNumber, cep) =>
ops.facilityCaptureRewards(buildingId, zoneNumber, cep)
case AvatarResponse.ShareKillExperienceWithSquad(killer, exp) =>
case AvatarAction.ShareKillExperienceWithSquad(killer, exp) =>
ops.shareKillExperienceWithSquad(killer, exp)
case AvatarResponse.ShareAntExperienceWithSquad(owner, exp, vehicle) =>
case AvatarAction.ShareAntExperienceWithSquad(owner, exp, vehicle) =>
ops.shareAntExperienceWithSquad(owner, exp, vehicle)
case AvatarResponse.RemoveFromOutfitChat(outfit_id) =>
case AvatarAction.RemoveFromOutfitChat(outfit_id) =>
ops.removeFromOutfitChat(outfit_id)
case AvatarResponse.SendResponse(msg) =>
case AvatarAction.SendResponse(msg) =>
sendResponse(msg)
case AvatarResponse.SendResponseTargeted(targetGuid, msg) if resolvedPlayerGuid == targetGuid =>
case AvatarAction.SendResponseTargeted(targetGuid, msg) if resolvedPlayerGuid == targetGuid =>
sendResponse(msg)
/* common messages (maybe once every respawn) */
case AvatarResponse.Reload(itemGuid)
case AvatarAction.Reload(itemGuid)
if isNotSameTarget && ops.lastSeenStreamMessage.get(guid.guid).exists { _.visible } =>
sendResponse(ReloadMessage(itemGuid, ammo_clip=1, unk1=0))
case AvatarResponse.Killed(cause, mount) =>
case AvatarAction.Killed(cause, mount) =>
//log and chat messages
//destroy display
val zoneChannel = continent.id
@ -587,10 +587,10 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
sessionLogic.zoning.spawn.HandleReleaseAvatar(player, continent)
}
case AvatarResponse.Release(tplayer) if isNotSameTarget =>
case AvatarAction.ReleasePlayer(tplayer) if isNotSameTarget =>
sessionLogic.zoning.spawn.DepictPlayerAsCorpse(tplayer)
case AvatarResponse.Revive(revivalTargetGuid)
case AvatarAction.Revive(revivalTargetGuid)
if resolvedPlayerGuid == revivalTargetGuid =>
log.info(s"No time for rest, ${player.Name}. Back on your feet!")
ops.revive()
@ -606,51 +606,51 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
}
/* uncommon messages (utility, or once in a while) */
case AvatarResponse.ChangeAmmo(weapon_guid, weapon_slot, previous_guid, ammo_id, ammo_guid, ammo_data)
case AvatarAction.ChangeAmmo(weapon_guid, weapon_slot, previous_guid, ammo_id, ammo_guid, ammo_data)
if isNotSameTarget && ops.lastSeenStreamMessage.get(guid.guid).exists { _.visible } =>
ops.changeAmmoProcedures(weapon_guid, previous_guid, ammo_id, ammo_guid, weapon_slot, ammo_data)
sendResponse(ChangeAmmoMessage(weapon_guid, 1))
case AvatarResponse.ChangeAmmo(weapon_guid, weapon_slot, previous_guid, ammo_id, ammo_guid, ammo_data)
case AvatarAction.ChangeAmmo(weapon_guid, weapon_slot, previous_guid, ammo_id, ammo_guid, ammo_data)
if isNotSameTarget =>
ops.changeAmmoProcedures(weapon_guid, previous_guid, ammo_id, ammo_guid, weapon_slot, ammo_data)
case AvatarResponse.ChangeFireMode(itemGuid, mode) if isNotSameTarget =>
case AvatarAction.ChangeFireMode(itemGuid, mode) if isNotSameTarget =>
sendResponse(ChangeFireModeMessage(itemGuid, mode))
case AvatarResponse.ConcealPlayer() =>
case AvatarAction.ConcealPlayer(_) =>
sendResponse(GenericObjectActionMessage(guid, code=9))
case AvatarResponse.EnvironmentalDamage(_, _, _) =>
case AvatarAction.EnvironmentalDamage(_, _, _) =>
//TODO damage marker?
sessionLogic.zoning.CancelZoningProcessWithDescriptiveReason("cancel_dmg")
case AvatarResponse.DropItem(pkt) if isNotSameTarget =>
case AvatarAction.DropCreatedItem(pkt) if isNotSameTarget =>
sendResponse(pkt)
case AvatarResponse.ObjectDelete(itemGuid, unk) if isNotSameTarget =>
case AvatarAction.ObjectDelete(itemGuid, unk) if isNotSameTarget =>
sendResponse(ObjectDeleteMessage(itemGuid, unk))
/* rare messages */
case AvatarResponse.SetEmpire(objectGuid, faction) if isNotSameTarget =>
case AvatarAction.SetEmpire(objectGuid, faction) if isNotSameTarget =>
sendResponse(SetEmpireMessage(objectGuid, faction))
case AvatarResponse.DropSpecialItem() =>
case AvatarAction.DropSpecialItem() =>
sessionLogic.general.dropSpecialSlotItem()
case AvatarResponse.OxygenState(player, vehicle) =>
case AvatarAction.OxygenState(player, vehicle) =>
sendResponse(OxygenStateMessage(
DrowningTarget(player.guid, player.progress, player.state),
vehicle.flatMap { vinfo => Some(DrowningTarget(vinfo.guid, vinfo.progress, vinfo.state)) }
))
case AvatarResponse.LoadProjectile(pkt) if isNotSameTarget =>
case AvatarAction.LoadCreatedProjectile(pkt) if isNotSameTarget =>
sendResponse(pkt)
case AvatarResponse.ProjectileState(projectileGuid, shotPos, shotVel, shotOrient, seq, end, targetGuid) if isNotSameTarget =>
case AvatarAction.ProjectileState(projectileGuid, shotPos, shotVel, shotOrient, seq, end, targetGuid) if isNotSameTarget =>
sendResponse(ProjectileStateMessage(projectileGuid, shotPos, shotVel, shotOrient, seq, end, targetGuid))
case AvatarResponse.ProjectileExplodes(projectileGuid, projectile) =>
case AvatarAction.ProjectileExplodes(projectileGuid, projectile) =>
sendResponse(
ProjectileStateMessage(
projectileGuid,
@ -664,13 +664,13 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
)
sendResponse(ObjectDeleteMessage(projectileGuid, unk1=2))
case AvatarResponse.ProjectileAutoLockAwareness(mode) =>
case AvatarAction.ProjectileAutoLockAwareness(mode) =>
sendResponse(GenericActionMessage(mode))
case AvatarResponse.PutDownFDU(target) if isNotSameTarget =>
case AvatarAction.PutDownFDU(target) if isNotSameTarget =>
sendResponse(GenericObjectActionMessage(target, code=53))
case AvatarResponse.StowEquipment(target, slot, item) if isNotSameTarget =>
case AvatarAction.StowEquipment(target, slot, item) if isNotSameTarget =>
val definition = item.Definition
sendResponse(
ObjectCreateDetailedMessage(
@ -681,7 +681,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
)
)
case AvatarResponse.WeaponDryFire(weaponGuid)
case AvatarAction.WeaponDryFire(weaponGuid)
if isNotSameTarget && ops.lastSeenStreamMessage.get(guid.guid).exists { _.visible } =>
continent.GUID(weaponGuid).collect {
case tool: Tool if tool.Magazine == 0 =>
@ -698,8 +698,8 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
val events = continent.AvatarEvents
ops.killedWhileMounted(obj, playerGuid)
//make player invisible on client
events ! AvatarServiceMessage(player.Name, AvatarAction.PlanetsideAttributeToAll(playerGuid, 29, 1))
events ! AvatarServiceMessage(player.Name, playerGuid, AvatarAction.PlanetsideAttributeToAll(29, 1))
//only the dead player should "see" their own body, so that the death camera has something to focus on
events ! AvatarServiceMessage(continent.id, AvatarAction.ObjectDelete(playerGuid, playerGuid))
events ! AvatarServiceMessage(continent.id, playerGuid, AvatarAction.ObjectDelete(playerGuid))
}
}

View file

@ -181,8 +181,8 @@ class GeneralLogic(val ops: GeneralOperations, implicit val context: ActorContex
})
continent.AvatarEvents ! AvatarServiceMessage(
continent.id,
avatarGuid,
AvatarAction.PlayerState(
avatarGuid,
player.Position,
player.Velocity,
yaw,
@ -527,7 +527,8 @@ class GeneralLogic(val ops: GeneralOperations, implicit val context: ActorContex
player.UsingSpecial = SpecialExoSuitDefinition.Mode.Anchored
continent.AvatarEvents ! AvatarServiceMessage(
continent.id,
AvatarAction.PlanetsideAttribute(player.GUID, 19, 1)
player.GUID,
AvatarAction.PlanetsideAttribute(19, 1)
)
definition match {
case GlobalDefinitions.trhev_dualcycler | GlobalDefinitions.trhev_burster =>
@ -548,7 +549,8 @@ class GeneralLogic(val ops: GeneralOperations, implicit val context: ActorContex
player.UsingSpecial = SpecialExoSuitDefinition.Mode.Normal
continent.AvatarEvents ! AvatarServiceMessage(
continent.id,
AvatarAction.PlanetsideAttribute(player.GUID, 19, 0)
player.GUID,
AvatarAction.PlanetsideAttribute(19, 0)
)
definition match {
case GlobalDefinitions.trhev_dualcycler | GlobalDefinitions.trhev_burster =>

View file

@ -8,6 +8,7 @@ import net.psforever.objects.Players
import net.psforever.objects.avatar.scoring.Kill
import net.psforever.objects.sourcing.PlayerSource
import net.psforever.packet.game.{AvatarImplantMessage, ImplantAction}
import net.psforever.services.base.EventResponse
import scala.concurrent.duration._
//
@ -23,7 +24,7 @@ import net.psforever.objects.vital.etc.ExplodingEntityReason
import net.psforever.objects.zones.Zoning
import net.psforever.packet.game.objectcreate.ObjectCreateMessageParent
import net.psforever.packet.game.{ArmorChangedMessage, AvatarDeadStateMessage, ChangeAmmoMessage, ChangeFireModeMessage, ChangeFireStateMessage_Start, ChangeFireStateMessage_Stop, ChatMsg, DeadState, DestroyMessage, DrowningTarget, GenericActionMessage, GenericObjectActionMessage, HitHint, ItemTransactionResultMessage, ObjectCreateDetailedMessage, ObjectCreateMessage, ObjectDeleteMessage, ObjectHeldMessage, OxygenStateMessage, PlanetsideAttributeMessage, PlayerStateMessage, ProjectileStateMessage, ReloadMessage, SetEmpireMessage, UseItemMessage, WeaponDryFireMessage}
import net.psforever.services.avatar.{AvatarAction, AvatarResponse, AvatarServiceMessage}
import net.psforever.services.avatar.{AvatarAction, AvatarServiceMessage}
import net.psforever.services.Service
import net.psforever.types.{ChatMessageType, PlanetSideGUID, TransactionType, Vector3}
import net.psforever.util.Config
@ -45,7 +46,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
* @param guid na
* @param reply na
*/
def handle(toChannel: String, guid: PlanetSideGUID, reply: AvatarResponse.Response): Unit = {
def handle(toChannel: String, guid: PlanetSideGUID, reply: EventResponse): Unit = {
val resolvedPlayerGuid = if (player != null && player.HasGUID) {
player.GUID
} else {
@ -55,12 +56,12 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
val isSameTarget = !isNotSameTarget
reply match {
/* special messages */
case AvatarResponse.TeardownConnection() =>
case AvatarAction.TeardownConnection() =>
log.trace(s"ending ${player.Name}'s old session by event system request (relog)")
context.stop(context.self)
/* really common messages (very frequently, every life) */
case pstate @ AvatarResponse.PlayerState(
case pstate @ AvatarAction.PlayerState(
pos,
vel,
yaw,
@ -160,7 +161,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
}
}
case AvatarResponse.ObjectHeld(slot, _)
case AvatarAction.ObjectHeld(slot, _)
if isSameTarget && player.VisibleSlots.contains(slot) =>
sendResponse(ObjectHeldMessage(guid, slot, unk1=true))
//Stop using proximity terminals if player unholsters a weapon
@ -171,76 +172,76 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
sessionLogic.zoning.spawn.stopDeconstructing()
}
case AvatarResponse.ObjectHeld(slot, _)
case AvatarAction.ObjectHeld(slot, _)
if isSameTarget && slot > -1 =>
sendResponse(ObjectHeldMessage(guid, slot, unk1=true))
case AvatarResponse.ObjectHeld(_, _)
case AvatarAction.ObjectHeld(_, _)
if isSameTarget => ()
case AvatarResponse.ObjectHeld(_, previousSlot) =>
case AvatarAction.ObjectHeld(_, previousSlot) =>
sendResponse(ObjectHeldMessage(guid, previousSlot, unk1=false))
case AvatarResponse.ChangeFireState_Start(weaponGuid)
case AvatarAction.ChangeFireState_Start(weaponGuid)
if isNotSameTarget && ops.lastSeenStreamMessage.get(guid.guid).exists { _.visible } =>
sendResponse(ChangeFireStateMessage_Start(weaponGuid))
val entry = ops.lastSeenStreamMessage(guid.guid)
ops.lastSeenStreamMessage.put(guid.guid, entry.copy(shooting = Some(weaponGuid)))
case AvatarResponse.ChangeFireState_Start(weaponGuid)
case AvatarAction.ChangeFireState_Start(weaponGuid)
if isNotSameTarget =>
sendResponse(ChangeFireStateMessage_Start(weaponGuid))
case AvatarResponse.ChangeFireState_Stop(weaponGuid)
case AvatarAction.ChangeFireState_Stop(weaponGuid)
if isNotSameTarget && ops.lastSeenStreamMessage.get(guid.guid).exists { msg => msg.visible || msg.shooting.nonEmpty } =>
sendResponse(ChangeFireStateMessage_Stop(weaponGuid))
val entry = ops.lastSeenStreamMessage(guid.guid)
ops.lastSeenStreamMessage.put(guid.guid, entry.copy(shooting = None))
case AvatarResponse.ChangeFireState_Stop(weaponGuid)
case AvatarAction.ChangeFireState_Stop(weaponGuid)
if isNotSameTarget =>
sendResponse(ChangeFireStateMessage_Stop(weaponGuid))
case AvatarResponse.LoadPlayer(pkt) if isNotSameTarget =>
case AvatarAction.LoadCreatedPlayer(pkt) if isNotSameTarget =>
sendResponse(pkt)
case AvatarResponse.EquipmentInHand(pkt) if isNotSameTarget =>
case AvatarAction.EquipmentCreatedInHand(pkt) if isNotSameTarget =>
sendResponse(pkt)
case AvatarResponse.PlanetsideAttribute(attributeType, attributeValue) if isNotSameTarget =>
case AvatarAction.PlanetsideAttribute(attributeType, attributeValue) if isNotSameTarget =>
sendResponse(PlanetsideAttributeMessage(guid, attributeType, attributeValue))
case AvatarResponse.PlanetsideAttributeToAll(attributeType, attributeValue) =>
case AvatarAction.PlanetsideAttributeToAll(attributeType, attributeValue) =>
sendResponse(PlanetsideAttributeMessage(guid, attributeType, attributeValue))
case AvatarResponse.PlanetsideAttributeSelf(attributeType, attributeValue) if isSameTarget =>
case AvatarAction.PlanetsideAttributeSelf(attributeType, attributeValue) if isSameTarget =>
sendResponse(PlanetsideAttributeMessage(guid, attributeType, attributeValue))
case AvatarResponse.GenericObjectAction(objectGuid, actionCode) if isNotSameTarget =>
case AvatarAction.GenericObjectAction(objectGuid, actionCode) if isNotSameTarget =>
sendResponse(GenericObjectActionMessage(objectGuid, actionCode))
case AvatarResponse.HitHint(sourceGuid) if player.isAlive =>
case AvatarAction.HitHint(sourceGuid) if player.isAlive =>
sendResponse(HitHint(sourceGuid, guid))
sessionLogic.zoning.CancelZoningProcess()
case AvatarResponse.Destroy(victim, killer, weapon, pos) =>
case AvatarAction.Destroy(victim, killer, weapon, pos) =>
// guid = victim // killer = killer
sendResponse(DestroyMessage(victim, killer, weapon, pos))
case AvatarResponse.DestroyDisplay(killer, victim, method, unk) =>
case AvatarAction.DestroyDisplay(killer, victim, method, unk) =>
sendResponse(ops.destroyDisplayMessage(killer, victim, method, unk))
case AvatarResponse.TerminalOrderResult(terminalGuid, action, result)
case AvatarAction.TerminalOrderResult(terminalGuid, action, result)
if result && (action == TransactionType.Buy || action == TransactionType.Loadout) =>
sendResponse(ItemTransactionResultMessage(terminalGuid, action, result))
sessionLogic.terminals.lastTerminalOrderFulfillment = true
AvatarActor.savePlayerData(player)
case AvatarResponse.TerminalOrderResult(terminalGuid, action, result) =>
case AvatarAction.TerminalOrderResult(terminalGuid, action, result) =>
sendResponse(ItemTransactionResultMessage(terminalGuid, action, result))
sessionLogic.terminals.lastTerminalOrderFulfillment = true
case AvatarResponse.ChangeExosuit(
case AvatarAction.ChangeExosuit(
target,
armor,
exosuit,
@ -298,7 +299,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
}
DropLeftovers(player)(drop)
case AvatarResponse.ChangeExosuit(target, armor, exosuit, subtype, slot, _, oldHolsters, holsters, _, _, _, delete) =>
case AvatarAction.ChangeExosuit(target, armor, exosuit, subtype, slot, _, oldHolsters, holsters, _, _, _, delete) =>
sendResponse(ArmorChangedMessage(target, exosuit, subtype))
sendResponse(PlanetsideAttributeMessage(target, attribute_type=4, armor))
//happening to some other player
@ -319,7 +320,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
)
}
case AvatarResponse.ChangeLoadout(
case AvatarAction.ChangeLoadout(
target,
armor,
exosuit,
@ -353,7 +354,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
sessionLogic.general.applyPurchaseTimersBeforePackingLoadout(player, player, holsters ++ inventory)
DropLeftovers(player)(drops)
case AvatarResponse.ChangeLoadout(target, armor, exosuit, subtype, slot, _, oldHolsters, _, _, _, _) =>
case AvatarAction.ChangeLoadout(target, armor, exosuit, subtype, slot, _, oldHolsters, _, _, _, _) =>
//redraw handled by callbacks
sendResponse(ArmorChangedMessage(target, exosuit, subtype))
sendResponse(PlanetsideAttributeMessage(target, attribute_type=4, armor))
@ -362,7 +363,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
//cleanup
oldHolsters.foreach { case (_, guid) => sendResponse(ObjectDeleteMessage(guid, unk1=0)) }
case AvatarResponse.UseKit(kguid, kObjId) =>
case AvatarAction.UseKit(kguid, kObjId) =>
sendResponse(
UseItemMessage(
resolvedPlayerGuid,
@ -380,14 +381,14 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
)
sendResponse(ObjectDeleteMessage(kguid, unk1=0))
case AvatarResponse.KitNotUsed(_, "") =>
case AvatarAction.KitNotUsed(_, "") =>
sessionLogic.general.kitToBeUsed = None
case AvatarResponse.KitNotUsed(_, msg) =>
case AvatarAction.KitNotUsed(_, msg) =>
sessionLogic.general.kitToBeUsed = None
sendResponse(ChatMsg(ChatMessageType.UNK_225, msg))
case AvatarResponse.UpdateKillsDeathsAssists(_, kda: Kill) if kda.experienceEarned > 0 =>
case AvatarAction.UpdateKillsDeathsAssists(_, kda: Kill) if kda.experienceEarned > 0 =>
continent.actor ! ZoneActor.RewardOurSupporters(
PlayerSource(player),
Players.produceContributionTranscriptFromKill(continent, player, kda),
@ -395,38 +396,38 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
kda.experienceEarned
)
case AvatarResponse.AwardBep(charId, bep, expType) =>
case AvatarAction.AwardBep(charId, bep, expType) =>
//if the target player, always award (some) BEP
if (charId == player.CharId) {
avatarActor ! AvatarActor.AwardBep(bep, expType)
}
case AvatarResponse.AwardCep(charId, cep) =>
case AvatarAction.AwardCep(charId, cep) =>
//if the target player, always award (some) CEP
if (charId == player.CharId) {
avatarActor ! AvatarActor.AwardCep(cep)
}
case AvatarResponse.FacilityCaptureRewards(buildingId, zoneNumber, cep) =>
case AvatarAction.FacilityCaptureRewards(buildingId, zoneNumber, cep) =>
ops.facilityCaptureRewards(buildingId, zoneNumber, cep)
case AvatarResponse.SendResponse(pkt: AvatarImplantMessage)
case AvatarAction.SendResponse(pkt: AvatarImplantMessage)
if pkt.player_guid == player.GUID && pkt.action == ImplantAction.Initialization =>
//special spectator implants stay initialized and do not deinitialize
()
case AvatarResponse.SendResponse(msg) =>
case AvatarAction.SendResponse(msg) =>
sendResponse(msg)
case AvatarResponse.SendResponseTargeted(targetGuid, msg) if resolvedPlayerGuid == targetGuid =>
case AvatarAction.SendResponseTargeted(targetGuid, msg) if resolvedPlayerGuid == targetGuid =>
sendResponse(msg)
/* common messages (maybe once every respawn) */
case AvatarResponse.Reload(itemGuid)
case AvatarAction.Reload(itemGuid)
if isNotSameTarget && ops.lastSeenStreamMessage.get(guid.guid).exists { _.visible } =>
sendResponse(ReloadMessage(itemGuid, ammo_clip=1, unk1=0))
case AvatarResponse.Killed(_, mount) =>
case AvatarAction.Killed(_, mount) =>
//log and chat messages
val cause = player.LastDamage.flatMap { damage =>
val interaction = damage.interaction
@ -477,10 +478,10 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
sessionLogic.zoning.spawn.HandleReleaseAvatar(player, continent)
}
case AvatarResponse.Release(tplayer) if isNotSameTarget =>
case AvatarAction.ReleasePlayer(tplayer) if isNotSameTarget =>
sessionLogic.zoning.spawn.DepictPlayerAsCorpse(tplayer)
case AvatarResponse.Revive(revivalTargetGuid) if resolvedPlayerGuid == revivalTargetGuid =>
case AvatarAction.Revive(revivalTargetGuid) if resolvedPlayerGuid == revivalTargetGuid =>
log.info(s"No time for rest, ${player.Name}. Back on your feet!")
sessionLogic.zoning.spawn.reviveTimer.cancel()
sessionLogic.zoning.spawn.deadState = DeadState.Alive
@ -490,55 +491,56 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
sendResponse(AvatarDeadStateMessage(DeadState.Alive, timer_max=0, timer=0, player.Position, player.Faction, unk5=true))
continent.AvatarEvents ! AvatarServiceMessage(
continent.id,
AvatarAction.PlanetsideAttributeToAll(revivalTargetGuid, attribute_type=0, health)
revivalTargetGuid,
AvatarAction.PlanetsideAttributeToAll(attribute_type=0, health)
)
/* uncommon messages (utility, or once in a while) */
case AvatarResponse.ChangeAmmo(weapon_guid, weapon_slot, previous_guid, ammo_id, ammo_guid, ammo_data)
case AvatarAction.ChangeAmmo(weapon_guid, weapon_slot, previous_guid, ammo_id, ammo_guid, ammo_data)
if isNotSameTarget && ops.lastSeenStreamMessage.get(guid.guid).exists { _.visible } =>
ops.changeAmmoProcedures(weapon_guid, previous_guid, ammo_id, ammo_guid, weapon_slot, ammo_data)
sendResponse(ChangeAmmoMessage(weapon_guid, 1))
case AvatarResponse.ChangeAmmo(weapon_guid, weapon_slot, previous_guid, ammo_id, ammo_guid, ammo_data)
case AvatarAction.ChangeAmmo(weapon_guid, weapon_slot, previous_guid, ammo_id, ammo_guid, ammo_data)
if isNotSameTarget =>
ops.changeAmmoProcedures(weapon_guid, previous_guid, ammo_id, ammo_guid, weapon_slot, ammo_data)
case AvatarResponse.ChangeFireMode(itemGuid, mode) if isNotSameTarget =>
case AvatarAction.ChangeFireMode(itemGuid, mode) if isNotSameTarget =>
sendResponse(ChangeFireModeMessage(itemGuid, mode))
case AvatarResponse.ConcealPlayer() =>
case AvatarAction.ConcealPlayer(_) =>
sendResponse(GenericObjectActionMessage(guid, code=9))
case AvatarResponse.EnvironmentalDamage(_, _, _) =>
case AvatarAction.EnvironmentalDamage(_, _, _) =>
//TODO damage marker?
sessionLogic.zoning.CancelZoningProcess()
case AvatarResponse.DropItem(pkt) if isNotSameTarget =>
case AvatarAction.DropCreatedItem(pkt) if isNotSameTarget =>
sendResponse(pkt)
case AvatarResponse.ObjectDelete(itemGuid, unk) if isNotSameTarget =>
case AvatarAction.ObjectDelete(itemGuid, unk) if isNotSameTarget =>
sendResponse(ObjectDeleteMessage(itemGuid, unk))
/* rare messages */
case AvatarResponse.SetEmpire(objectGuid, faction) if isNotSameTarget =>
case AvatarAction.SetEmpire(objectGuid, faction) if isNotSameTarget =>
sendResponse(SetEmpireMessage(objectGuid, faction))
case AvatarResponse.DropSpecialItem() =>
case AvatarAction.DropSpecialItem() =>
sessionLogic.general.dropSpecialSlotItem()
case AvatarResponse.OxygenState(player, vehicle) =>
case AvatarAction.OxygenState(player, vehicle) =>
sendResponse(OxygenStateMessage(
DrowningTarget(player.guid, player.progress, player.state),
vehicle.flatMap { vinfo => Some(DrowningTarget(vinfo.guid, vinfo.progress, vinfo.state)) }
))
case AvatarResponse.LoadProjectile(pkt) if isNotSameTarget =>
case AvatarAction.LoadCreatedProjectile(pkt) if isNotSameTarget =>
sendResponse(pkt)
case AvatarResponse.ProjectileState(projectileGuid, shotPos, shotVel, shotOrient, seq, end, targetGuid) if isNotSameTarget =>
case AvatarAction.ProjectileState(projectileGuid, shotPos, shotVel, shotOrient, seq, end, targetGuid) if isNotSameTarget =>
sendResponse(ProjectileStateMessage(projectileGuid, shotPos, shotVel, shotOrient, seq, end, targetGuid))
case AvatarResponse.ProjectileExplodes(projectileGuid, projectile) =>
case AvatarAction.ProjectileExplodes(projectileGuid, projectile) =>
sendResponse(
ProjectileStateMessage(
projectileGuid,
@ -552,13 +554,13 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
)
sendResponse(ObjectDeleteMessage(projectileGuid, unk1=2))
case AvatarResponse.ProjectileAutoLockAwareness(mode) =>
case AvatarAction.ProjectileAutoLockAwareness(mode) =>
sendResponse(GenericActionMessage(mode))
case AvatarResponse.PutDownFDU(target) if isNotSameTarget =>
case AvatarAction.PutDownFDU(target) if isNotSameTarget =>
sendResponse(GenericObjectActionMessage(target, code=53))
case AvatarResponse.StowEquipment(target, slot, item) if isNotSameTarget =>
case AvatarAction.StowEquipment(target, slot, item) if isNotSameTarget =>
val definition = item.Definition
sendResponse(
ObjectCreateDetailedMessage(
@ -569,7 +571,7 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
)
)
case AvatarResponse.WeaponDryFire(weaponGuid)
case AvatarAction.WeaponDryFire(weaponGuid)
if isNotSameTarget && ops.lastSeenStreamMessage.get(guid.guid).exists { _.visible } =>
continent.GUID(weaponGuid).collect {
case tool: Tool if tool.Magazine == 0 =>

View file

@ -76,8 +76,8 @@ class GeneralLogic(val ops: GeneralOperations, implicit val context: ActorContex
player.Cloaked = player.ExoSuit == ExoSuitType.Infiltration && isCloaking
continent.AvatarEvents ! AvatarServiceMessage(
"spectator",
avatarGuid,
AvatarAction.PlayerState(
avatarGuid,
player.Position,
player.Velocity,
yaw,
@ -230,7 +230,8 @@ class GeneralLogic(val ops: GeneralOperations, implicit val context: ActorContex
player.UsingSpecial = SpecialExoSuitDefinition.Mode.Anchored
continent.AvatarEvents ! AvatarServiceMessage(
continent.id,
AvatarAction.PlanetsideAttribute(player.GUID, 19, 1)
player.GUID,
AvatarAction.PlanetsideAttribute(19, 1)
)
definition match {
case GlobalDefinitions.trhev_dualcycler | GlobalDefinitions.trhev_burster =>
@ -251,7 +252,8 @@ class GeneralLogic(val ops: GeneralOperations, implicit val context: ActorContex
player.UsingSpecial = SpecialExoSuitDefinition.Mode.Normal
continent.AvatarEvents ! AvatarServiceMessage(
continent.id,
AvatarAction.PlanetsideAttribute(player.GUID, 19, 0)
player.GUID,
AvatarAction.PlanetsideAttribute(19, 0)
)
definition match {
case GlobalDefinitions.trhev_dualcycler | GlobalDefinitions.trhev_burster =>

View file

@ -68,7 +68,7 @@ class SpectatorModeLogic(data: SessionData) extends ModeLogic {
player.Inventory.Items
.foreach { entry => sendResponse(ObjectDeleteMessage(entry.GUID, 0)) }
sendResponse(ObjectDeleteMessage(player.avatar.locker.GUID, 0))
continent.AvatarEvents ! AvatarServiceMessage(continent.id, AvatarAction.ObjectDelete(pguid, pguid))
continent.AvatarEvents ! AvatarServiceMessage(continent.id, pguid, AvatarAction.ObjectDelete(pguid))
player.Holsters()
.collect { case slot if slot.Equipment.nonEmpty => sendResponse(ObjectDeleteMessage(slot.Equipment.get.GUID, 0)) }
val vehicleAndSeat = data.vehicles.GetMountableAndSeat(None, player, continent) match {

View file

@ -18,6 +18,7 @@ import net.psforever.objects.vehicles.Utility.InternalTelepad
import net.psforever.objects.zones.blockmap.BlockMapEntity
import net.psforever.objects.zones.exp.ToDatabase
import net.psforever.services.RemoverActor
import net.psforever.services.avatar.GroundEnvelope
import net.psforever.services.local.{LocalAction, LocalServiceMessage}
import scala.collection.mutable
@ -851,7 +852,7 @@ class GeneralOperations(
case _ if continent.EquipmentOnGround.contains(obj) =>
obj.Position = Vector3.Zero
continent.Ground ! Zone.Ground.RemoveItem(objectGuid)
continent.AvatarEvents ! AvatarServiceMessage.Ground(RemoverActor.ClearSpecific(List(obj), continent))
continent.AvatarEvents ! GroundEnvelope(RemoverActor.ClearSpecific(List(obj), continent))
true
case _ =>
Zone.EquipmentIs.Where(obj, objectGuid, continent) match {
@ -988,7 +989,8 @@ class GeneralOperations(
player.UsingSpecial = SpecialExoSuitDefinition.Mode.Normal
continent.AvatarEvents ! AvatarServiceMessage(
continent.id,
AvatarAction.PlanetsideAttributeToAll(player.GUID, 8, 0)
player.GUID,
AvatarAction.PlanetsideAttributeToAll(8, 0)
)
}
}
@ -997,7 +999,8 @@ class GeneralOperations(
private def activateMaxSpecialStateMessage(): Unit = {
continent.AvatarEvents ! AvatarServiceMessage(
continent.id,
AvatarAction.PlanetsideAttributeToAll(player.GUID, 8, 1)
player.GUID,
AvatarAction.PlanetsideAttributeToAll(8, 1)
)
}

View file

@ -9,6 +9,7 @@ import net.psforever.packet.game.objectcreate.ConstructorData
import net.psforever.objects.zones.exp
import net.psforever.services.Service
import net.psforever.services.avatar.{AvatarAction, AvatarServiceMessage, AvatarServiceResponse}
import net.psforever.services.base.EventResponse
import net.psforever.services.chat.OutfitChannel
import scala.collection.mutable
@ -16,14 +17,13 @@ import scala.collection.mutable
import net.psforever.actors.session.AvatarActor
import net.psforever.packet.game.objectcreate.ObjectCreateMessageParent
import net.psforever.packet.game._
import net.psforever.services.avatar.AvatarResponse
import net.psforever.types._
import net.psforever.util.Config
trait AvatarHandlerFunctions extends CommonSessionInterfacingFunctionality {
val ops: SessionAvatarHandlers
def handle(toChannel: String, guid: PlanetSideGUID, reply: AvatarResponse.Response): Unit
def handle(toChannel: String, guid: PlanetSideGUID, reply: EventResponse): Unit
}
class SessionAvatarHandlers(
@ -215,7 +215,7 @@ class SessionAvatarHandlers(
context.self ! AvatarServiceResponse(
playerName,
Service.defaultPlayerGUID,
AvatarResponse.SendResponse(
AvatarAction.SendResponse(
ObjectDetachMessage(obj.GUID, playerGuid, player.Position, Vector3.Zero)
)
)
@ -239,7 +239,7 @@ class SessionAvatarHandlers(
object SessionAvatarHandlers {
private[session] case class LastUpstream(
msg: Option[AvatarResponse.PlayerState],
msg: Option[AvatarAction.PlayerState],
visible: Boolean,
shooting: Option[PlanetSideGUID],
time: Long

View file

@ -83,11 +83,17 @@ object SessionOutfitHandlers {
player.outfit_id = outfit.id
player.outfit_name = outfit.name
player.Zone.AvatarEvents ! AvatarServiceMessage(player.Zone.id,
AvatarAction.PlanetsideAttributeToAll(player.GUID, 39, outfit.id))
player.Zone.AvatarEvents ! AvatarServiceMessage(
player.Zone.id,
player.GUID,
AvatarAction.PlanetsideAttributeToAll(39, outfit.id)
)
player.Zone.AvatarEvents ! AvatarServiceMessage(player.Zone.id,
AvatarAction.PlanetsideStringAttribute(player.GUID, 0, outfit.name))
player.Zone.AvatarEvents ! AvatarServiceMessage(
player.Zone.id,
player.GUID,
AvatarAction.PlanetsideStringAttribute(0, outfit.name)
)
session.chat.JoinChannel(OutfitChannel(player.outfit_id))
}
@ -168,11 +174,17 @@ object SessionOutfitHandlers {
invited.outfit_id = outfit.id
invited.outfit_name = outfit.name
invited.Zone.AvatarEvents ! AvatarServiceMessage(invited.Zone.id,
AvatarAction.PlanetsideAttributeToAll(invited.GUID, 39, outfit.id))
invited.Zone.AvatarEvents ! AvatarServiceMessage(
invited.Zone.id,
invited.GUID,
AvatarAction.PlanetsideAttributeToAll(39, outfit.id)
)
invited.Zone.AvatarEvents ! AvatarServiceMessage(invited.Zone.id,
AvatarAction.PlanetsideStringAttribute(invited.GUID, 0, outfit.name))
invited.Zone.AvatarEvents ! AvatarServiceMessage(
invited.Zone.id,
invited.GUID,
AvatarAction.PlanetsideStringAttribute(0, outfit.name)
)
case (None, _, _) =>
PlayerControl.sendResponse(invited.Zone, invited.Name,
@ -230,11 +242,17 @@ object SessionOutfitHandlers {
OutfitMemberEvent(outfit_id, kickedId, OutfitMemberEventAction.Kicked()))
)
kickedBy.Zone.AvatarEvents ! AvatarServiceMessage(kickedBy.Zone.id,
AvatarAction.PlanetsideAttributeToAll(kickedBy.GUID, 39, 0))
kickedBy.Zone.AvatarEvents ! AvatarServiceMessage(
kickedBy.Zone.id,
kickedBy.GUID,
AvatarAction.PlanetsideAttributeToAll(39, 0)
)
kickedBy.Zone.AvatarEvents ! AvatarServiceMessage(kickedBy.Zone.id,
AvatarAction.PlanetsideStringAttribute(kickedBy.GUID, 0, ""))
kickedBy.Zone.AvatarEvents ! AvatarServiceMessage(
kickedBy.Zone.id,
kickedBy.GUID,
AvatarAction.PlanetsideStringAttribute(0, "")
)
}
}.recover { case e =>
e.printStackTrace()
@ -254,11 +272,17 @@ object SessionOutfitHandlers {
OutfitMembershipResponse(OutfitMembershipResponse.PacketType.YouGotKicked, 0, 1,
kickedBy.CharId, kicked.CharId, kickedBy.Name, kicked.Name, flag = false))
kicked.Zone.AvatarEvents ! AvatarServiceMessage(kicked.Zone.id,
AvatarAction.PlanetsideAttributeToAll(kicked.GUID, 39, 0))
kicked.Zone.AvatarEvents ! AvatarServiceMessage(
kicked.Zone.id,
kicked.GUID,
AvatarAction.PlanetsideAttributeToAll(39, 0)
)
kicked.Zone.AvatarEvents ! AvatarServiceMessage(kicked.Zone.id,
AvatarAction.PlanetsideStringAttribute(kicked.GUID, 0, ""))
kicked.Zone.AvatarEvents ! AvatarServiceMessage(
kicked.Zone.id,
kicked.GUID,
AvatarAction.PlanetsideStringAttribute(0, "")
)
kicked.Zone.AvatarEvents ! AvatarServiceMessage(
kicked.Name, AvatarAction.RemoveFromOutfitChat(kickedBy.outfit_id))
@ -613,11 +637,17 @@ object SessionOutfitHandlers {
player.outfit_id = outfit.id
player.outfit_name = outfit.name
player.Zone.AvatarEvents ! AvatarServiceMessage(player.Zone.id,
AvatarAction.PlanetsideAttributeToAll(player.GUID, 39, outfit.id))
player.Zone.AvatarEvents ! AvatarServiceMessage(
player.Zone.id,
player.GUID,
AvatarAction.PlanetsideAttributeToAll(39, outfit.id)
)
player.Zone.AvatarEvents ! AvatarServiceMessage(player.Zone.id,
AvatarAction.PlanetsideStringAttribute(player.GUID, 0, outfit.name))
player.Zone.AvatarEvents ! AvatarServiceMessage(
player.Zone.id,
player.GUID,
AvatarAction.PlanetsideStringAttribute(0, outfit.name)
)
case (None, _, _) =>
PlayerControl.sendResponse(player.Zone, player.Name,

View file

@ -107,7 +107,8 @@ class SessionSquadHandlers(
sendResponse(PlanetsideAttributeMessage(player.GUID, 31, squad_supplement_id))
continent.AvatarEvents ! AvatarServiceMessage(
s"${player.Faction}",
AvatarAction.PlanetsideAttribute(player.GUID, 31, squad_supplement_id)
player.GUID,
AvatarAction.PlanetsideAttribute(31, squad_supplement_id)
)
sendResponse(PlanetsideAttributeMessage(player.GUID, 32, elem.index))
case _ =>
@ -286,7 +287,7 @@ class SessionSquadHandlers(
* @param value value to associate the player
*/
def GiveSquadColorsForOthers(guid: PlanetSideGUID, factionChannel: String, value: Long): Unit = {
continent.AvatarEvents ! AvatarServiceMessage(factionChannel, AvatarAction.PlanetsideAttribute(guid, 31, value))
continent.AvatarEvents ! AvatarServiceMessage(factionChannel, guid, AvatarAction.PlanetsideAttribute(31, value))
}
/**

View file

@ -281,10 +281,7 @@ class WeaponAndProjectileOperations(
.orElse { continent.GUID(weapon_guid) }
.collect {
case _: Equipment if containerOpt.exists(_.isInstanceOf[Player]) =>
continent.AvatarEvents ! AvatarServiceMessage(
continent.id,
AvatarAction.WeaponDryFire(player.GUID, weapon_guid)
)
continent.AvatarEvents ! AvatarServiceMessage(continent.id, player.GUID, AvatarAction.WeaponDryFire(weapon_guid))
case _: Equipment =>
continent.VehicleEvents ! VehicleServiceMessage(
continent.id,
@ -459,7 +456,8 @@ class WeaponAndProjectileOperations(
sendResponse(ChangeFireModeMessage(item_guid, modeIndex))
continent.AvatarEvents ! AvatarServiceMessage(
sessionLogic.zoning.zoneChannel,
AvatarAction.ChangeFireMode(player.GUID, item_guid, modeIndex)
player.GUID,
AvatarAction.ChangeFireMode(item_guid, modeIndex)
)
}
case Some(_) =>
@ -480,8 +478,8 @@ class WeaponAndProjectileOperations(
projectile.Velocity = shot_vel
continent.AvatarEvents ! AvatarServiceMessage(
continent.id,
player.GUID,
AvatarAction.ProjectileState(
player.GUID,
projectileGlobalUID,
shot_pos,
shot_vel,
@ -744,10 +742,7 @@ class WeaponAndProjectileOperations(
//chain lash effect
continent.AvatarEvents ! AvatarServiceMessage(
continent.id,
AvatarAction.SendResponse(
PlanetSideGUID(0),
ChainLashMessage(hitPos, projectile.profile.ObjectId, guidRefs.toList)
)
AvatarAction.SendResponse(ChainLashMessage(hitPos, projectile.profile.ObjectId, guidRefs.toList))
)
//chain lash target output
outputRefs.toList
@ -931,12 +926,9 @@ class WeaponAndProjectileOperations(
tool.Magazine = 0
sendResponse(InventoryStateMessage(tool.AmmoSlot.Box.GUID, weapon_guid, 0))
sendResponse(ChangeFireStateMessage_Stop(weapon_guid))
continent.AvatarEvents ! AvatarServiceMessage(
continent.id,
AvatarAction.ChangeFireState_Stop(player.GUID, weapon_guid)
)
continent.AvatarEvents ! AvatarServiceMessage(continent.id, player.GUID, AvatarAction.ChangeFireState_Stop(weapon_guid))
sendResponse(WeaponDryFireMessage(weapon_guid))
continent.AvatarEvents ! AvatarServiceMessage(continent.id, AvatarAction.WeaponDryFire(player.GUID, weapon_guid))
continent.AvatarEvents ! AvatarServiceMessage(continent.id, player.GUID, AvatarAction.WeaponDryFire(weapon_guid))
}
/**
@ -1079,7 +1071,8 @@ class WeaponAndProjectileOperations(
def fireStateStartPlayerMessages(itemGuid: PlanetSideGUID): Unit = {
continent.AvatarEvents ! AvatarServiceMessage(
sessionLogic.zoning.zoneChannel,
AvatarAction.ChangeFireState_Start(player.GUID, itemGuid)
player.GUID,
AvatarAction.ChangeFireState_Start(itemGuid)
)
}
@ -1118,7 +1111,8 @@ class WeaponAndProjectileOperations(
def fireStateStopPlayerMessages(itemGuid: PlanetSideGUID): Unit = {
continent.AvatarEvents ! AvatarServiceMessage(
sessionLogic.zoning.zoneChannel,
AvatarAction.ChangeFireState_Stop(player.GUID, itemGuid)
player.GUID,
AvatarAction.ChangeFireState_Stop(itemGuid)
)
}
@ -1186,10 +1180,7 @@ class WeaponAndProjectileOperations(
used by ReloadMessage handling
*/
def reloadPlayerMessages(itemGuid: PlanetSideGUID): Unit = {
continent.AvatarEvents ! AvatarServiceMessage(
sessionLogic.zoning.zoneChannel,
AvatarAction.Reload(player.GUID, itemGuid)
)
continent.AvatarEvents ! AvatarServiceMessage(sessionLogic.zoning.zoneChannel, player.GUID, AvatarAction.Reload(itemGuid))
}
def reloadVehicleMessages(itemGuid: PlanetSideGUID): Unit = {
@ -1371,8 +1362,8 @@ class WeaponAndProjectileOperations(
sendResponse(ChangeAmmoMessage(tool_guid, box.Capacity))
continent.AvatarEvents ! AvatarServiceMessage(
sessionLogic.zoning.zoneChannel,
player.GUID,
AvatarAction.ChangeAmmo(
player.GUID,
tool_guid,
ammoSlotIndex,
previous_box_guid,
@ -1582,10 +1573,7 @@ class WeaponAndProjectileOperations(
shootingStop.clear()
(prefire ++ shooting).foreach { guid =>
sendResponse(ChangeFireStateMessage_Stop(guid))
continent.AvatarEvents ! AvatarServiceMessage(
continent.id,
AvatarAction.ChangeFireState_Stop(player.GUID, guid)
)
continent.AvatarEvents ! AvatarServiceMessage(continent.id, player.GUID, AvatarAction.ChangeFireState_Stop(guid))
}
prefire.clear()
shooting.clear()

View file

@ -22,6 +22,7 @@ import net.psforever.objects.vital.{InGameHistory, IncarnationActivity, Reconstr
import net.psforever.objects.zones.blockmap.BlockMapEntity
import net.psforever.packet.game.GenericAction.FirstPersonViewWithEffect
import net.psforever.packet.game.{CampaignStatistic, ChangeFireStateMessage_Start, CloudInfo, GenericActionMessage, GenericObjectActionEnum, HackState7, MailMessage, ObjectDetectedMessage, SessionStatistic, StormInfo, TriggeredSound, TrainingZoneMessage, WeatherMessage}
import net.psforever.services.avatar.{CorpseEnvelope, ReleaseMessage}
import net.psforever.services.chat.DefaultChannel
import scala.concurrent.duration._
@ -2637,7 +2638,8 @@ class ZoningOperations(
sendResponse(OCM.detailed(player))
continent.AvatarEvents ! AvatarServiceMessage(
s"spectator",
AvatarAction.LoadPlayer(guid, definition.ObjectId, guid, definition.Packet.ConstructorData(player).get, None)
guid,
AvatarAction.LoadPlayer(definition.ObjectId, guid, definition.Packet.ConstructorData(player).get, None)
)
case _ =>
@ -2648,7 +2650,8 @@ class ZoningOperations(
sendResponse(OCM.detailed(player))
continent.AvatarEvents ! AvatarServiceMessage(
zoneid,
AvatarAction.LoadPlayer(guid, definition.ObjectId, guid, definition.Packet.ConstructorData(player).get, None)
guid,
AvatarAction.LoadPlayer(definition.ObjectId, guid, definition.Packet.ConstructorData(player).get, None)
)
}
continent.Population ! Zone.Population.Spawn(avatar, player, avatarActor)
@ -2720,8 +2723,8 @@ class ZoningOperations(
}
continent.AvatarEvents ! AvatarServiceMessage(
continent.id,
pguid,
AvatarAction.LoadPlayer(
pguid,
pdef.ObjectId,
pguid,
pdef.Packet.ConstructorData(tplayer).get,
@ -2879,7 +2882,7 @@ class ZoningOperations(
if (player.VisibleSlots.contains(index)) {
events ! AvatarServiceMessage(
zoneId,
AvatarAction.ObjectDelete(Service.defaultPlayerGUID, obj.GUID)
AvatarAction.ObjectDelete(obj.GUID)
)
} else {
sendResponse(ObjectDeleteMessage(obj.GUID, 0))
@ -2913,7 +2916,7 @@ class ZoningOperations(
val pguid = tplayer.GUID
zone.Population ! Zone.Population.Release(avatar)
sendResponse(ObjectDeleteMessage(pguid, 0))
zone.AvatarEvents ! AvatarServiceMessage(zone.id, AvatarAction.ObjectDelete(pguid, pguid))
zone.AvatarEvents ! AvatarServiceMessage(zone.id, pguid, AvatarAction.ObjectDelete(pguid))
TaskWorkflow.execute(GUIDTask.unregisterPlayer(zone.GUID, tplayer))
}
}
@ -2936,7 +2939,7 @@ class ZoningOperations(
tplayer.Release
DepictPlayerAsCorpse(tplayer)
zone.Population ! Zone.Corpse.Add(tplayer)
zone.AvatarEvents ! AvatarServiceMessage(zone.id, AvatarAction.Release(tplayer, zone))
zone.AvatarEvents ! ReleaseMessage(zone.id, AvatarAction.Release(tplayer, zone))
}
/**
@ -2975,7 +2978,7 @@ class ZoningOperations(
*/
def TryDisposeOfLootedCorpse(obj: Player): Boolean = {
if (obj.isBackpack && WellLootedDeadBody(obj)) {
obj.Zone.AvatarEvents ! AvatarServiceMessage.Corpse(RemoverActor.HurrySpecific(List(obj), obj.Zone))
obj.Zone.AvatarEvents ! CorpseEnvelope(RemoverActor.HurrySpecific(List(obj), obj.Zone))
true
} else {
false
@ -3171,7 +3174,8 @@ class ZoningOperations(
sendResponse(ObjectDeleteMessage(player_guid, unk1=effect))
continent.AvatarEvents ! AvatarServiceMessage(
continent.id,
AvatarAction.ObjectDelete(player_guid, player_guid, unk=effect)
player_guid,
AvatarAction.ObjectDelete(player_guid, unk=effect)
)
InGameHistory.SpawnReconstructionActivity(player, toZoneNumber, betterSpawnPoint)
LoadZoneAsPlayerUsing(player, pos, ori, toSide, zoneId)
@ -3335,7 +3339,7 @@ class ZoningOperations(
//looking for squad (members)
if (tplayer.avatar.lookingForSquad) {
sendResponse(PlanetsideAttributeMessage(guid, 53, 1))
continent.AvatarEvents ! AvatarServiceMessage(continent.id, AvatarAction.PlanetsideAttribute(guid, 53, 1))
continent.AvatarEvents ! AvatarServiceMessage(continent.id, guid, AvatarAction.PlanetsideAttribute(53, 1))
}
sendResponse(AvatarSearchCriteriaMessage(guid, List(0, 0, 0, 0, 0, 0)))
//these are facilities and towers and bunkers in the zone, but not necessarily all of them for some reason
@ -3361,7 +3365,7 @@ class ZoningOperations(
if (tplayer.ExoSuit == ExoSuitType.MAX) {
sendResponse(PlanetsideAttributeMessage(guid, 7, tplayer.Capacitor.toLong))
sendResponse(PlanetsideAttributeMessage(guid, 4, tplayer.Armor))
continent.AvatarEvents ! AvatarServiceMessage(continent.id, AvatarAction.PlanetsideAttributeToAll(guid, 4, tplayer.Armor))
continent.AvatarEvents ! AvatarServiceMessage(continent.id, guid, AvatarAction.PlanetsideAttributeToAll(4, tplayer.Armor))
}
// for issue #1269
continent.AllPlayers.filter(_.ExoSuit == ExoSuitType.MAX).foreach(max => sendResponse(PlanetsideAttributeMessage(max.GUID, 4, max.Armor)))
@ -3484,14 +3488,8 @@ class ZoningOperations(
case Some(b: Building) if b.hasCavernLockBenefit =>
tplayer.MaxHealth = 120
tplayer.Health = 120
tplayer.Zone.AvatarEvents ! AvatarServiceMessage(
tplayer.Zone.id,
AvatarAction.PlanetsideAttributeToAll(tplayer.GUID, 0, 120)
)
tplayer.Zone.AvatarEvents ! AvatarServiceMessage(
tplayer.Zone.id,
AvatarAction.PlanetsideAttributeToAll(tplayer.GUID, 1, 120)
)
tplayer.Zone.AvatarEvents ! AvatarServiceMessage(tplayer.Zone.id, tplayer.GUID, AvatarAction.PlanetsideAttributeToAll(0, 120))
tplayer.Zone.AvatarEvents ! AvatarServiceMessage(tplayer.Zone.id, tplayer.GUID, AvatarAction.PlanetsideAttributeToAll(1, 120))
case _ => ()
}
doorsThatShouldBeOpenInRange(pos, range = 100f)

View file

@ -205,7 +205,7 @@ case object MajorFacilityLogic
case Some(GeneratorControl.Event.UnderAttack) =>
val events = zone.AvatarEvents
val guid = building.GUID
val msg = AvatarAction.GenericObjectAction(Service.defaultPlayerGUID, guid, 15)
val msg = AvatarAction.GenericObjectAction(guid, 15)
building.PlayersInSOI.foreach { player =>
events ! AvatarServiceMessage(player.Name, msg)
}
@ -213,15 +213,15 @@ case object MajorFacilityLogic
case Some(GeneratorControl.Event.Critical) =>
val events = zone.AvatarEvents
val guid = building.GUID
val msg = AvatarAction.PlanetsideAttributeToAll(guid, 46, 1)
val msg = AvatarAction.PlanetsideAttributeToAll(46, 1)
building.PlayersInSOI.foreach { player =>
events ! AvatarServiceMessage(player.Name, msg)
events ! AvatarServiceMessage(player.Name, guid, msg)
}
true
case Some(GeneratorControl.Event.Destabilized) =>
val events = zone.AvatarEvents
val guid = building.GUID
val msg = AvatarAction.GenericObjectAction(Service.defaultPlayerGUID, guid, 16)
val msg = AvatarAction.GenericObjectAction(guid, 16)
building.PlayersInSOI.foreach { player =>
events ! AvatarServiceMessage(player.Name, msg)
}
@ -237,9 +237,9 @@ case object MajorFacilityLogic
case Some(GeneratorControl.Event.Offline) =>
powerLost(details)
val zone = building.Zone
val msg = AvatarAction.PlanetsideAttributeToAll(building.GUID, 46, 2)
val msg = AvatarAction.PlanetsideAttributeToAll(46, 2)
building.PlayersInSOI.foreach { player =>
zone.AvatarEvents ! AvatarServiceMessage(player.Name, msg)
zone.AvatarEvents ! AvatarServiceMessage(player.Name, building.GUID, msg)
} //???
true
case Some(GeneratorControl.Event.Normal) =>
@ -249,11 +249,11 @@ case object MajorFacilityLogic
powerRestored(details)
val events = zone.AvatarEvents
val guid = building.GUID
val msg1 = AvatarAction.PlanetsideAttributeToAll(guid, 46, 0)
val msg2 = AvatarAction.GenericObjectAction(Service.defaultPlayerGUID, guid, 17)
val msg1 = AvatarAction.PlanetsideAttributeToAll(46, 0)
val msg2 = AvatarAction.GenericObjectAction(guid, 17)
building.PlayersInSOI.foreach { player =>
val name = player.Name
events ! AvatarServiceMessage(name, msg1) //reset ???; might be global?
events ! AvatarServiceMessage(name, guid, msg1) //reset ???; might be global?
events ! AvatarServiceMessage(name, msg2) //This facility's generator is back on line
}
true
@ -306,9 +306,9 @@ case object MajorFacilityLogic
amenity.Actor ! powerMsg
}
//amenities disabled; red warning lights
events ! AvatarServiceMessage(zoneId, AvatarAction.PlanetsideAttributeToAll(guid, 48, 1))
events ! AvatarServiceMessage(zoneId, guid, AvatarAction.PlanetsideAttributeToAll(48, 1))
//disable spawn target on deployment map
events ! AvatarServiceMessage(zoneId, AvatarAction.PlanetsideAttributeToAll(guid, 38, 0))
events ! AvatarServiceMessage(zoneId, guid, AvatarAction.PlanetsideAttributeToAll(38, 0))
Behaviors.same
}
@ -329,9 +329,9 @@ case object MajorFacilityLogic
amenity.Actor ! powerMsg
}
//amenities enabled; normal lights
events ! AvatarServiceMessage(zoneId, AvatarAction.PlanetsideAttributeToAll(guid, 48, 0))
events ! AvatarServiceMessage(zoneId, guid, AvatarAction.PlanetsideAttributeToAll(48, 0))
//enable spawn target on deployment map
events ! AvatarServiceMessage(zoneId, AvatarAction.PlanetsideAttributeToAll(guid, 38, 1))
events ! AvatarServiceMessage(zoneId, guid, AvatarAction.PlanetsideAttributeToAll(38, 1))
Behaviors.same
}

View file

@ -326,10 +326,7 @@ object WorldSession {
case _ =>
forcedTolowerRaisedArm(localPlayer, localPlayer.GUID, localZone)
localPlayer.DrawnSlot = localSlot
localZone.AvatarEvents ! AvatarServiceMessage(
localZone.id,
AvatarAction.ObjectHeld(localGUID, localSlot, localSlot)
)
localZone.AvatarEvents ! AvatarServiceMessage(localZone.id, localGUID, AvatarAction.ObjectHeld(localSlot, localSlot))
}
Future(this)
}
@ -370,10 +367,7 @@ object WorldSession {
localZone.GUID(item_guid) match {
case Some(_) => ()
case None => //acting on old data?
localZone.AvatarEvents ! AvatarServiceMessage(
localZone.id,
AvatarAction.ObjectDelete(Service.defaultPlayerGUID, item_guid)
)
localZone.AvatarEvents ! AvatarServiceMessage(localZone.id, AvatarAction.ObjectDelete(item_guid))
}
case _ => ()
}
@ -597,10 +591,7 @@ object WorldSession {
localGUID match {
case Some(guid) =>
//see LockerContainerControl.RemoveItemFromSlotCallback
localSource.Zone.AvatarEvents ! AvatarServiceMessage(
localChannel,
AvatarAction.ObjectDelete(Service.defaultPlayerGUID, guid)
)
localSource.Zone.AvatarEvents ! AvatarServiceMessage(localChannel, AvatarAction.ObjectDelete(guid))
case None => ()
}
val moveResult = ask(localDestination.Actor, Containable.PutItemInSlotOrAway(localItem, Some(localDestSlot)))
@ -702,10 +693,7 @@ object WorldSession {
localGUID match {
case Some(guid) =>
//see LockerContainerControl.RemoveItemFromSlotCallback
localSource.Zone.AvatarEvents ! AvatarServiceMessage(
localChannel,
AvatarAction.ObjectDelete(Service.defaultPlayerGUID, guid)
)
localSource.Zone.AvatarEvents ! AvatarServiceMessage(localChannel, AvatarAction.ObjectDelete(guid))
case None => ()
}
val moveResult = ask(localDestination.Actor, Containable.PutItemInSlotOrAway(localItem, Some(localDestSlot)))
@ -795,10 +783,7 @@ object WorldSession {
}
//put up hand with grenade in it
tplayer.DrawnSlot = slotNum
zone.AvatarEvents ! AvatarServiceMessage(
zone.id,
AvatarAction.ObjectHeld(guid, slotNum, slotNum)
)
zone.AvatarEvents ! AvatarServiceMessage(zone.id, guid, AvatarAction.ObjectHeld(slotNum, slotNum))
log.info(s"${tplayer.Name} has quickly drawn a ${grenade.Definition.Name}")
None
case None =>
@ -885,10 +870,7 @@ object WorldSession {
val slot = tplayer.DrawnSlot
if (slot != Player.HandsDownSlot) {
tplayer.DrawnSlot = Player.HandsDownSlot
zone.AvatarEvents ! AvatarServiceMessage(
zone.id,
AvatarAction.ObjectHeld(guid, Player.HandsDownSlot, slot)
)
zone.AvatarEvents ! AvatarServiceMessage(zone.id, guid, AvatarAction.ObjectHeld(Player.HandsDownSlot, slot))
true
} else {
false

View file

@ -109,7 +109,7 @@ class BoomerDeployableControl(mine: BoomerDeployable)
}
zone.AvatarEvents! AvatarServiceMessage(
zone.id,
AvatarAction.ObjectDelete(Service.defaultPlayerGUID, guid)
AvatarAction.ObjectDelete(guid)
)
TaskWorkflow.execute(GUIDTask.unregisterObject(zone.GUID, trigger))
case None => ()

View file

@ -50,7 +50,7 @@ object Players {
val uname = user.Name
events ! AvatarServiceMessage(
uname,
AvatarAction.SendResponse(Service.defaultPlayerGUID, RepairMessage(target.GUID, progress.toInt))
AvatarAction.SendResponse(RepairMessage(target.GUID, progress.toInt))
)
true
} else {
@ -61,7 +61,7 @@ object Players {
/**
* na
* @see `AvatarAction.Revive`
* @see `AvatarResponse.Revive`
* @see `AvatarAction.Revive`
* @param target the player being revived
* @param medic the name of the player doing the reviving
* @param item the tool being used to revive the target player
@ -76,12 +76,12 @@ object Players {
PlayerControl.sendResponse(
target.Zone,
medicName,
Service.defaultPlayerGUID,
AvatarAction.SendResponse(
Service.defaultPlayerGUID,
InventoryStateMessage(item.AmmoSlot.Box.GUID, item.GUID, magazine)
)
)
PlayerControl.sendResponse(target.Zone, name, AvatarAction.Revive(target.GUID))
PlayerControl.sendResponse(target.Zone, name, Service.defaultPlayerGUID, AvatarAction.Revive(target.GUID))
}
/**
@ -347,10 +347,7 @@ object Players {
*/
def buildCooldownReset(zone: Zone, channel: String, guid: PlanetSideGUID): Unit = {
//sent to avatar event bus to preempt additional tool management
zone.AvatarEvents ! AvatarServiceMessage(
channel,
AvatarAction.SendResponse(Service.defaultPlayerGUID, GenericObjectActionMessage(guid, 21))
)
zone.AvatarEvents ! AvatarServiceMessage(channel, AvatarAction.SendResponse(GenericObjectActionMessage(guid, 21)))
}
/**
@ -406,10 +403,7 @@ object Players {
}
}) {
val zone = player.Zone
zone.AvatarEvents ! AvatarServiceMessage(
zone.id,
AvatarAction.ObjectDelete(Service.defaultPlayerGUID, tool.GUID)
)
zone.AvatarEvents ! AvatarServiceMessage(zone.id, AvatarAction.ObjectDelete(tool.GUID))
true
} else {
false
@ -449,21 +443,18 @@ object Players {
//TODO any penalty for being handed an OCM version of the tool?
events ! AvatarServiceMessage(
zone.id,
AvatarAction.EquipmentInHand(Service.defaultPlayerGUID, pguid, index, obj)
AvatarAction.EquipmentInHand(pguid, index, obj)
)
if (obj.AmmoTypeIndex != ammoType) {
obj.AmmoTypeIndex = ammoType
events ! AvatarServiceMessage(
name,
AvatarAction.SendResponse(Service.defaultPlayerGUID, ChangeAmmoMessage(obj.GUID, ammoType))
AvatarAction.SendResponse(ChangeAmmoMessage(obj.GUID, ammoType))
)
}
if (player.DrawnSlot == Player.HandsDownSlot) {
player.DrawnSlot = index
events ! AvatarServiceMessage(
zone.id,
AvatarAction.ObjectHeld(pguid, index, index)
)
events ! AvatarServiceMessage(zone.id, pguid, AvatarAction.ObjectHeld(index, index))
}
}
case Nil => ; //no replacements found

View file

@ -24,10 +24,7 @@ object Tools {
val magazine = tool.Magazine -= mode.RoundsPerInterval
player.Zone.AvatarEvents ! AvatarServiceMessage(
player.Name,
AvatarAction.SendResponse(
Service.defaultPlayerGUID,
QuantityUpdateMessage(tool.AmmoSlot.Box.GUID, magazine)
)
AvatarAction.SendResponse(QuantityUpdateMessage(tool.AmmoSlot.Box.GUID, magazine))
)
player.isAlive
case _ =>

View file

@ -10,7 +10,7 @@ import net.psforever.objects.serverobject.transfer.TransferContainer
import net.psforever.objects.serverobject.structures.WarpGate
import net.psforever.objects.vehicles._
import net.psforever.objects.zones.Zone
import net.psforever.packet.game.{ChatMsg, FrameVehicleStateMessage, GenericObjectActionEnum, GenericObjectActionMessage, HackMessage, HackState, HackState1, HackState7, TriggeredSound, VehicleStateMessage}
import net.psforever.packet.game.{ChatMsg, FrameVehicleStateMessage, GenericObjectActionEnum, HackMessage, HackState, HackState1, HackState7, TriggeredSound, VehicleStateMessage}
import net.psforever.types.{ChatMessageType, DriveState, PlanetSideEmpire, PlanetSideGUID, Vector3}
import net.psforever.services.Service
import net.psforever.services.avatar.{AvatarAction, AvatarServiceMessage}
@ -169,7 +169,8 @@ object Vehicles {
(0 to 3).foreach(group => {
vehicle.Zone.AvatarEvents ! AvatarServiceMessage(
toChannel,
AvatarAction.PlanetsideAttributeToAll(vehicle_guid, group + 10, vehicle.PermissionGroup(group).get.id)
vehicle_guid,
AvatarAction.PlanetsideAttributeToAll(group + 10, vehicle.PermissionGroup(group).get.id)
)
})
}
@ -313,7 +314,7 @@ object Vehicles {
// And broadcast the faction change to other clients
zone.AvatarEvents ! AvatarServiceMessage(
zoneid,
AvatarAction.SetEmpire(Service.defaultPlayerGUID, tGuid, hFaction)
AvatarAction.SetEmpire(tGuid, hFaction)
)
}
localEvents ! LocalServiceMessage(

View file

@ -27,7 +27,7 @@ class CorpseControl(player: Player) extends Actor with ContainableBehavior {
case Some(slot) =>
obj.Zone.AvatarEvents ! AvatarServiceMessage(
player.Zone.id,
AvatarAction.SendResponse(Service.defaultPlayerGUID, ObjectAttachMessage(obj.GUID, item.GUID, slot))
AvatarAction.SendResponse(ObjectAttachMessage(obj.GUID, item.GUID, slot))
)
case None => ;
}
@ -40,7 +40,7 @@ class CorpseControl(player: Player) extends Actor with ContainableBehavior {
val zone = obj.Zone
val events = zone.AvatarEvents
item.Faction = PlanetSideEmpire.NEUTRAL
events ! AvatarServiceMessage(zone.id, AvatarAction.ObjectDelete(Service.defaultPlayerGUID, item.GUID))
events ! AvatarServiceMessage(zone.id, AvatarAction.ObjectDelete(item.GUID))
}
def PutItemInSlotCallback(item: Equipment, slot: Int): Unit = {
@ -51,7 +51,6 @@ class CorpseControl(player: Player) extends Actor with ContainableBehavior {
events ! AvatarServiceMessage(
zone.id,
AvatarAction.SendResponse(
Service.defaultPlayerGUID,
ObjectCreateDetailedMessage(
definition.ObjectId,
item.GUID,
@ -67,10 +66,7 @@ class CorpseControl(player: Player) extends Actor with ContainableBehavior {
val zone = obj.Zone
zone.AvatarEvents ! AvatarServiceMessage(
zone.id,
AvatarAction.SendResponse(
Service.defaultPlayerGUID,
ObjectDetachMessage(obj.GUID, item.GUID, Vector3.Zero, 0f)
)
AvatarAction.SendResponse(ObjectDetachMessage(obj.GUID, item.GUID, Vector3.Zero, 0f))
)
}
}

View file

@ -36,6 +36,7 @@ import net.psforever.objects.vital.collision.CollisionReason
import net.psforever.objects.vital.etc.{PainboxReason, SuicideReason}
import net.psforever.objects.vital.interaction.{DamageInteraction, DamageResult}
import net.psforever.packet.PlanetSideGamePacket
import net.psforever.services.base.EventMessage
import org.joda.time.{LocalDateTime, Seconds}
import scala.concurrent.duration._
@ -125,7 +126,7 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
val zoneId = zone.id
sendResponse(zone, zoneId, PlanetsideAttributeMessage(revivalTargetGuid, attribute_type=0, health))
sendResponse(zone, zoneId, AvatarDeadStateMessage(DeadState.Alive, timer_max=0, timer=0, player.Position, player.Faction, unk5=true))
sendResponse(zone, zoneId, AvatarAction.PlanetsideAttributeToAll(revivalTargetGuid, attribute_type=0, health))
sendResponse(zone, zoneId, revivalTargetGuid, AvatarAction.PlanetsideAttributeToAll(attribute_type=0, health))
avatarActor ! AvatarActor.InitializeImplants
avatarActor ! AvatarActor.SuspendStaminaRegeneration(Duration(1, "second"))
@ -149,12 +150,9 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
val magazine = item.Discharge()
events ! AvatarServiceMessage(
uname,
AvatarAction.SendResponse(
Service.defaultPlayerGUID,
InventoryStateMessage(item.AmmoSlot.Box.GUID, item.GUID, magazine.toLong)
)
AvatarAction.SendResponse(InventoryStateMessage(item.AmmoSlot.Box.GUID, item.GUID, magazine.toLong))
)
events ! AvatarServiceMessage(zone.id, AvatarAction.PlanetsideAttributeToAll(guid, 0, newHealth))
events ! AvatarServiceMessage(zone.id, guid, AvatarAction.PlanetsideAttributeToAll(0, newHealth))
player.LogActivity(
HealFromEquipment(
PlayerSource(user),
@ -174,14 +172,11 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
}
if (player != user) {
//"Someone is trying to heal you"
events ! AvatarServiceMessage(player.Name, AvatarAction.PlanetsideAttributeToAll(guid, 55, 1))
events ! AvatarServiceMessage(player.Name, guid, AvatarAction.PlanetsideAttributeToAll(55, 1))
//progress bar remains visible for all heal attempts
events ! AvatarServiceMessage(
uname,
AvatarAction.SendResponse(
Service.defaultPlayerGUID,
RepairMessage(guid, player.Health * 100 / definition.MaxHealth)
)
AvatarAction.SendResponse(RepairMessage(guid, player.Health * 100 / definition.MaxHealth))
)
}
}
@ -221,12 +216,9 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
val magazine = item.Discharge()
events ! AvatarServiceMessage(
uname,
AvatarAction.SendResponse(
Service.defaultPlayerGUID,
InventoryStateMessage(item.AmmoSlot.Box.GUID, item.GUID, magazine.toLong)
)
AvatarAction.SendResponse(InventoryStateMessage(item.AmmoSlot.Box.GUID, item.GUID, magazine.toLong))
)
events ! AvatarServiceMessage(zone.id, AvatarAction.PlanetsideAttributeToAll(guid, 4, player.Armor))
events ! AvatarServiceMessage(zone.id, guid, AvatarAction.PlanetsideAttributeToAll(4, player.Armor))
player.LogActivity(
RepairFromEquipment(
PlayerSource(user),
@ -247,7 +239,7 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
if (player != user) {
if (player.isAlive) {
//"Someone is trying to repair you" gets strobed twice for visibility
val msg = AvatarServiceMessage(player.Name, AvatarAction.PlanetsideAttributeToAll(guid, 56, 1))
val msg = AvatarServiceMessage(player.Name, guid, AvatarAction.PlanetsideAttributeToAll(56, 1))
events ! msg
import scala.concurrent.ExecutionContext.Implicits.global
context.system.scheduler.scheduleOnce(250 milliseconds, events, msg)
@ -255,8 +247,7 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
//progress bar remains visible for all repair attempts
events ! AvatarServiceMessage(
uname,
AvatarAction
.SendResponse(Service.defaultPlayerGUID, RepairMessage(guid, player.Armor * 100 / player.MaxArmor))
AvatarAction.SendResponse(RepairMessage(guid, player.Armor * 100 / player.MaxArmor))
)
}
}
@ -323,7 +314,8 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
TaskWorkflow.execute(GUIDTask.unregisterEquipment(zone.GUID, kit))
zone.AvatarEvents ! AvatarServiceMessage(
zone.id,
AvatarAction.PlanetsideAttributeToAll(player.GUID, attribute, value)
player.GUID,
AvatarAction.PlanetsideAttributeToAll(attribute, value)
)
zone.AvatarEvents ! AvatarServiceMessage(
player.Name,
@ -346,13 +338,15 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
if (resistance && !updateMyHolsterArm) {
events ! AvatarServiceMessage(
player.Name,
AvatarAction.ObjectHeld(player.GUID, before, -1)
player.GUID,
AvatarAction.ObjectHeld(before, -1)
)
} else if ((!resistance && before != slot && (player.DrawnSlot = slot) != before) && ItemSwapSlot != before) {
val mySlot = if (updateMyHolsterArm) slot else -1 //use as a short-circuit
events ! AvatarServiceMessage(
Players.ZoneChannelIfSpectating(player),
AvatarAction.ObjectHeld(player.GUID, mySlot, player.LastDrawnSlot)
player.GUID,
AvatarAction.ObjectHeld(mySlot, player.LastDrawnSlot)
)
val isHolsters = player.VisibleSlots.contains(slot)
val equipment = player.Slot(slot).Equipment.orElse { player.Slot(before).Equipment }
@ -364,7 +358,8 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
//rek beam/icon colour must match the player's correct hack level
events ! AvatarServiceMessage(
Players.ZoneChannelIfSpectating(player),
AvatarAction.PlanetsideAttribute(unholsteredItem.GUID, 116, player.avatar.hackingSkillLevel())
unholsteredItem.GUID,
AvatarAction.PlanetsideAttribute(116, player.avatar.hackingSkillLevel())
)
}
case None => ()
@ -579,7 +574,7 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
if (reason.startsWith("@")) {
player.Zone.AvatarEvents ! AvatarServiceMessage(
player.Name,
AvatarAction.SendResponse(Service.defaultPlayerGUID, ChatMsg(ChatMessageType.UNK_227, reason))
AvatarAction.SendResponse(ChatMsg(ChatMessageType.UNK_227, reason))
)
}
@ -597,7 +592,7 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
val trigger = new BoomerTrigger
trigger.Companion = obj.GUID
obj.Trigger = trigger
zone.AvatarEvents ! AvatarServiceMessage(zone.id, AvatarAction.ObjectDelete(Service.defaultPlayerGUID, tool.GUID))
zone.AvatarEvents ! AvatarServiceMessage(zone.id, AvatarAction.ObjectDelete(tool.GUID))
TaskWorkflow.execute(GUIDTask.unregisterEquipment(zone.GUID, tool))
player.Find(tool) match {
case Some(index) if player.VisibleSlots.contains(index) =>
@ -885,7 +880,8 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
val zone = target.Zone
zone.AvatarEvents ! AvatarServiceMessage(
zone.id,
AvatarAction.PlanetsideAttributeToAll(target.GUID, 4, target.Armor)
target.GUID,
AvatarAction.PlanetsideAttributeToAll(4, target.Armor)
)
}
//choose
@ -941,10 +937,7 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
target.LogActivity(cause)
//stat changes
if (damageToCapacitor > 0) {
events ! AvatarServiceMessage(
target.Name,
AvatarAction.PlanetsideAttributeSelf(targetGUID, 7, target.Capacitor.toLong)
)
events ! AvatarServiceMessage(target.Name, targetGUID, AvatarAction.PlanetsideAttributeSelf(7, target.Capacitor.toLong))
announceConfrontation = true //TODO should we?
}
if (damageToStamina > 0) {
@ -952,7 +945,7 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
announceConfrontation = true //TODO should we?
}
if (damageToHealth > 0) {
events ! AvatarServiceMessage(zoneId, AvatarAction.PlanetsideAttributeToAll(targetGUID, 0, health))
events ! AvatarServiceMessage(zoneId, targetGUID, AvatarAction.PlanetsideAttributeToAll(0, health))
announceConfrontation = true
}
val countableDamage = damageToHealth + damageToArmor
@ -960,7 +953,7 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
if (aggravated) {
events ! AvatarServiceMessage(
zoneId,
AvatarAction.SendResponse(Service.defaultPlayerGUID, AggravatedDamageMessage(targetGUID, countableDamage))
AvatarAction.SendResponse(AggravatedDamageMessage(targetGUID, countableDamage))
)
} else {
//activity on map
@ -975,24 +968,19 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
case Some(tplayer) =>
zone.AvatarEvents ! AvatarServiceMessage(
target.Name,
AvatarAction.HitHint(tplayer.GUID, target.GUID)
target.GUID,
AvatarAction.HitHint(tplayer.GUID)
)
case None =>
zone.AvatarEvents ! AvatarServiceMessage(
target.Name,
AvatarAction.SendResponse(
Service.defaultPlayerGUID,
DamageWithPositionMessage(countableDamage, pSource.Position)
)
AvatarAction.SendResponse(DamageWithPositionMessage(countableDamage, pSource.Position))
)
}
case source =>
zone.AvatarEvents ! AvatarServiceMessage(
target.Name,
AvatarAction.SendResponse(
Service.defaultPlayerGUID,
DamageWithPositionMessage(countableDamage, source.Position)
)
AvatarAction.SendResponse(DamageWithPositionMessage(countableDamage, source.Position))
)
}
case None =>
@ -1005,7 +993,7 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
case _: CollisionReason =>
events ! AvatarServiceMessage(
zoneId,
AvatarAction.SendResponse(Service.defaultPlayerGUID, AggravatedDamageMessage(targetGUID, countableDamage))
AvatarAction.SendResponse(AggravatedDamageMessage(targetGUID, countableDamage))
)
case _ =>
zone.AvatarEvents ! AvatarServiceMessage(
@ -1064,19 +1052,16 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
damageLog.info(s"${player.Name} killed ${player.Sex.pronounObject}self")
}
events ! AvatarServiceMessage(nameChannel, AvatarAction.Killed(player_guid, cause, target.VehicleSeated)) //align client interface fields with state
events ! AvatarServiceMessage(zoneChannel, AvatarAction.PlanetsideAttributeToAll(player_guid, 0, 0)) //health
events ! AvatarServiceMessage(nameChannel, player_guid, AvatarAction.Killed(cause, target.VehicleSeated)) //align client interface fields with state
events ! AvatarServiceMessage(zoneChannel, player_guid, AvatarAction.PlanetsideAttributeToAll(0, 0)) //health
if (target.Capacitor > 0) {
target.Capacitor = 0
events ! AvatarServiceMessage(nameChannel, AvatarAction.PlanetsideAttributeToAll(player_guid, 7, 0)) // capacitor
events ! AvatarServiceMessage(nameChannel, player_guid, AvatarAction.PlanetsideAttributeToAll(7, 0)) // capacitor
}
val attribute = DamageableEntity.attributionTo(cause, target.Zone, player_guid)
events ! AvatarServiceMessage(
nameChannel,
AvatarAction.SendResponse(
Service.defaultPlayerGUID,
DestroyMessage(player_guid, attribute, Service.defaultPlayerGUID, pos)
) //how many players get this message?
AvatarAction.SendResponse(DestroyMessage(player_guid, attribute, Service.defaultPlayerGUID, pos)) //how many players get this message?
)
}
@ -1107,10 +1092,11 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
case obj: Player if !jammedSound =>
obj.Zone.AvatarEvents ! AvatarServiceMessage(
obj.Zone.id,
AvatarAction.PlanetsideAttributeToAll(obj.GUID, 27, 1)
obj.GUID,
AvatarAction.PlanetsideAttributeToAll(27, 1)
)
super.StartJammeredSound(obj, 3000)
case _ => ;
case _ => ()
}
/**
@ -1143,10 +1129,11 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
case obj: Player if jammedSound =>
obj.Zone.AvatarEvents ! AvatarServiceMessage(
obj.Zone.id,
AvatarAction.PlanetsideAttributeToAll(obj.GUID, 27, 0)
obj.GUID,
AvatarAction.PlanetsideAttributeToAll(27, 0)
)
super.CancelJammeredSound(obj)
case _ => ;
case _ => ()
}
def RepairToolValue(item: Tool): Float = {
@ -1167,9 +1154,9 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
obj.Find(item) match {
case Some(slot) =>
PutItemInSlotCallback(item, slot)
case None => ;
case None => ()
}
case _ => ;
case _ => ()
}
}
@ -1188,7 +1175,7 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
if (slot == obj.DrawnSlot) {
obj.DrawnSlot = Player.HandsDownSlot
}
events ! AvatarServiceMessage(toChannel, AvatarAction.ObjectDelete(Service.defaultPlayerGUID, item.GUID))
events ! AvatarServiceMessage(toChannel, AvatarAction.ObjectDelete(item.GUID))
}
def PutItemInSlotCallback(item: Equipment, slot: Int): Unit = {
@ -1209,10 +1196,10 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
case Some(obj: BoomerDeployable) =>
val deployables = player.avatar.deployables
if (!deployables.Contains(obj) && deployables.Valid(obj)) {
events ! AvatarServiceMessage(toChannel, AvatarAction.SendResponse(
Service.defaultPlayerGUID,
GenericObjectAction2Message(1, player.GUID, trigger.GUID)
))
events ! AvatarServiceMessage(
toChannel,
AvatarAction.SendResponse(GenericObjectAction2Message(1, player.GUID, trigger.GUID))
)
Players.gainDeployableOwnership(player, obj, deployables.AddOverLimit)
}
case _ => ()
@ -1230,13 +1217,10 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
}
events ! AvatarServiceMessage(
toChannel,
AvatarAction.SendResponse(
Service.defaultPlayerGUID,
OCM.detailed(item, ObjectCreateMessageParent(guid, slot))
)
AvatarAction.SendResponse(OCM.detailed(item, ObjectCreateMessageParent(guid, slot)))
)
if (!player.isBackpack && willBeVisible) {
events ! AvatarServiceMessage(zone.id, AvatarAction.EquipmentInHand(guid, guid, slot, item))
events ! AvatarServiceMessage(zone.id, guid, AvatarAction.EquipmentInHand(guid, slot, item))
}
}
@ -1252,7 +1236,7 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
}
zone.AvatarEvents ! AvatarServiceMessage(
toChannel,
AvatarAction.ObjectDelete(Service.defaultPlayerGUID, item.GUID)
AvatarAction.ObjectDelete(item.GUID)
)
}
@ -1260,7 +1244,7 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
import net.psforever.services.avatar.{AvatarAction, AvatarServiceMessage}
val zone = target.Zone
val value = target.Aura.foldLeft(0)(_ + PlayerControl.auraEffectToAttributeValue(_))
zone.AvatarEvents ! AvatarServiceMessage(zone.id, AvatarAction.PlanetsideAttributeToAll(target.GUID, 54, value))
zone.AvatarEvents ! AvatarServiceMessage(zone.id, target.GUID, AvatarAction.PlanetsideAttributeToAll(54, value))
}
}
@ -1290,11 +1274,11 @@ object PlayerControl {
}
def sendResponse(zone: Zone, channel: String, msg: PlanetSideGamePacket): Unit = {
zone.AvatarEvents ! AvatarServiceMessage(channel, AvatarAction.SendResponse(Service.defaultPlayerGUID, msg))
zone.AvatarEvents ! AvatarServiceMessage(channel, AvatarAction.SendResponse(msg))
}
def sendResponse(zone: Zone, channel: String, msg: AvatarAction.Action): Unit = {
zone.AvatarEvents ! AvatarServiceMessage(channel, msg)
def sendResponse(zone: Zone, channel: String, filter: PlanetSideGUID, msg: EventMessage): Unit = {
zone.AvatarEvents ! AvatarServiceMessage(channel, filter, msg)
}
def maxRestriction(player: Player, slot: Int): Boolean = {

View file

@ -100,7 +100,7 @@ class WithEntrance()
if (door.Outwards == Vector3.Zero) {
obj.Zone.AvatarEvents ! AvatarServiceMessage(
channel,
AvatarAction.SendResponse(PlanetSideGUID(0), ChatMsg(ChatMessageType.UNK_229, "Door not configured."))
AvatarAction.SendResponse(ChatMsg(ChatMessageType.UNK_229, "Door not configured."))
)
WhichSide
} else {
@ -109,14 +109,14 @@ class WithEntrance()
//outside
obj.Zone.AvatarEvents ! AvatarServiceMessage(
channel,
AvatarAction.SendResponse(PlanetSideGUID(0), ChatMsg(ChatMessageType.UNK_229, "You are now outside"))
AvatarAction.SendResponse(ChatMsg(ChatMessageType.UNK_229, "You are now outside"))
)
Sidedness.OutsideOf
} else if (!result && WhichSide != Sidedness.InsideOf) {
//inside
obj.Zone.AvatarEvents ! AvatarServiceMessage(
channel,
AvatarAction.SendResponse(PlanetSideGUID(0), ChatMsg(ChatMessageType.UNK_229, "You are now inside"))
AvatarAction.SendResponse(ChatMsg(ChatMessageType.UNK_229, "You are now inside"))
)
Sidedness.InsideOf
} else {

View file

@ -37,16 +37,10 @@ class WithGantry(val channel: String)
val events = shuttle.Zone.AvatarEvents
events ! AvatarServiceMessage(
channel,
AvatarAction.SendResponse(
Service.defaultPlayerGUID,
PlayerStateShiftMessage(ShiftState(0, pos, ang, None)))
)
AvatarAction.SendResponse(PlayerStateShiftMessage(ShiftState(0, pos, ang, None))))
events ! AvatarServiceMessage(
channel,
AvatarAction.SendResponse(
Service.defaultPlayerGUID,
ChatMsg(ChatMessageType.UNK_227, "@Vehicle_OS_PlacedOutsideHallway")
)
AvatarAction.SendResponse(ChatMsg(ChatMessageType.UNK_227, "@Vehicle_OS_PlacedOutsideHallway"))
)
case (Some(_: Vehicle) , _)=>
obj.Actor ! RespondsToZoneEnvironment.Timer(

View file

@ -288,7 +288,7 @@ object DeployableBehavior {
//visual tells in regards to ownership by faction
zone.AvatarEvents ! AvatarServiceMessage(
zone.id,
AvatarAction.SetEmpire(Service.defaultPlayerGUID, dGuid, toFaction)
AvatarAction.SetEmpire(dGuid, toFaction)
)
//remove knowledge by the previous owner's faction
localEvents ! LocalServiceMessage(

View file

@ -36,7 +36,7 @@ class LockerContainerControl(locker: LockerContainer, toChannel: String)
case Some(slot) =>
obj.Zone.AvatarEvents ! AvatarServiceMessage(
toChannel,
AvatarAction.SendResponse(Service.defaultPlayerGUID, ObjectAttachMessage(obj.GUID, item.GUID, slot))
AvatarAction.SendResponse(ObjectAttachMessage(obj.GUID, item.GUID, slot))
)
case None => ;
}
@ -46,7 +46,7 @@ class LockerContainerControl(locker: LockerContainer, toChannel: String)
def RemoveItemFromSlotCallback(item: Equipment, slot: Int): Unit = {
val zone = locker.Zone
zone.AvatarEvents ! AvatarServiceMessage(toChannel, AvatarAction.ObjectDelete(Service.defaultPlayerGUID, item.GUID))
zone.AvatarEvents ! AvatarServiceMessage(toChannel, AvatarAction.ObjectDelete(item.GUID))
}
def PutItemInSlotCallback(item: Equipment, slot: Int): Unit = {
@ -56,7 +56,6 @@ class LockerContainerControl(locker: LockerContainer, toChannel: String)
zone.AvatarEvents ! AvatarServiceMessage(
toChannel,
AvatarAction.SendResponse(
Service.defaultPlayerGUID,
ObjectCreateDetailedMessage(
definition.ObjectId,
item.GUID,
@ -71,10 +70,7 @@ class LockerContainerControl(locker: LockerContainer, toChannel: String)
val zone = locker.Zone
zone.AvatarEvents ! AvatarServiceMessage(
toChannel,
AvatarAction.SendResponse(
Service.defaultPlayerGUID,
ObjectDetachMessage(locker.GUID, item.GUID, Vector3.Zero, 0f)
)
AvatarAction.SendResponse(ObjectDetachMessage(locker.GUID, item.GUID, Vector3.Zero, 0f))
)
}
}

View file

@ -36,7 +36,7 @@ object DamageableAmenity {
val zoneId = zone.id
val events = zone.AvatarEvents
val targetGUID = target.GUID
events ! AvatarServiceMessage(zoneId, AvatarAction.PlanetsideAttributeToAll(targetGUID, 50, 1))
events ! AvatarServiceMessage(zoneId, AvatarAction.PlanetsideAttributeToAll(targetGUID, 51, 1))
events ! AvatarServiceMessage(zoneId, targetGUID, AvatarAction.PlanetsideAttributeToAll(50, 1))
events ! AvatarServiceMessage(zoneId, targetGUID, AvatarAction.PlanetsideAttributeToAll(51, 1))
}
}

View file

@ -167,7 +167,8 @@ object DamageableEntity {
val zone = target.Zone
zone.AvatarEvents ! AvatarServiceMessage(
zone.id,
AvatarAction.PlanetsideAttributeToAll(target.GUID, 0, target.Health)
target.GUID,
AvatarAction.PlanetsideAttributeToAll(0, target.Health)
)
true
}
@ -199,7 +200,7 @@ object DamageableEntity {
val zoneId = zone.id
val tguid = target.GUID
val attribution = attributionTo(cause, target.Zone)
zone.AvatarEvents ! AvatarServiceMessage(zoneId, AvatarAction.PlanetsideAttributeToAll(tguid, 0, target.Health))
zone.AvatarEvents ! AvatarServiceMessage(zoneId, tguid, AvatarAction.PlanetsideAttributeToAll(0, target.Health))
if (target.isInstanceOf[SpawnTube]) {}//do nothing to prevent issue #1057
else {
zone.AvatarEvents ! AvatarServiceMessage(

View file

@ -45,23 +45,23 @@ object DamageableMountable {
val name = pSource.Name
(zone.LivePlayers.find(_.Name == name).orElse(zone.Corpses.find(_.Name == name)) match {
case Some(player) =>
AvatarAction.HitHint(player.GUID, player.GUID)
AvatarAction.HitHint(player.GUID)
case None =>
AvatarAction.SendResponse(Service.defaultPlayerGUID, DamageWithPositionMessage(countableDamage, pSource.Position))
AvatarAction.SendResponse(DamageWithPositionMessage(countableDamage, pSource.Position))
}) match {
case AvatarAction.HitHint(_, guid) =>
occupants.map { tplayer => (tplayer.Name, AvatarAction.HitHint(guid, tplayer.GUID)) }
case AvatarAction.HitHint(guid) =>
occupants.map { tplayer => (tplayer.Name, guid, AvatarAction.HitHint(tplayer.GUID)) }
case msg =>
occupants.map { tplayer => (tplayer.Name, msg) }
occupants.map { tplayer => (tplayer.Name, Service.defaultPlayerGUID, msg) }
}
case Some(source) => //object damage
val msg = AvatarAction.SendResponse(Service.defaultPlayerGUID, DamageWithPositionMessage(countableDamage, source.Position))
occupants.map { tplayer => (tplayer.Name, msg) }
val msg = AvatarAction.SendResponse(DamageWithPositionMessage(countableDamage, source.Position))
occupants.map { tplayer => (tplayer.Name, Service.defaultPlayerGUID, msg) }
case None =>
List.empty
}).foreach {
case (channel, msg) =>
events ! AvatarServiceMessage(channel, msg)
case (channel, filter, msg) =>
events ! AvatarServiceMessage(channel, filter, msg)
}
}

View file

@ -131,7 +131,7 @@ object DamageableWeaponTurret {
}
.foreach(slot => {
val wep = slot.Equipment.get
avatarEvents ! AvatarServiceMessage(zoneId, AvatarAction.ObjectDelete(Service.defaultPlayerGUID, wep.GUID))
avatarEvents ! AvatarServiceMessage(zoneId, AvatarAction.ObjectDelete(wep.GUID))
})
target match {
case turret: WeaponTurret =>

View file

@ -113,10 +113,7 @@ class GeneratorControl(gen: Generator)
//kaboom
zone.AvatarEvents ! AvatarServiceMessage(
zone.id,
AvatarAction.SendResponse(
Service.defaultPlayerGUID,
TriggerEffectMessage(gen.GUID, "explosion_generator", None, None)
)
AvatarAction.SendResponse(TriggerEffectMessage(gen.GUID, "explosion_generator", None, None))
)
queuedExplosion.cancel()
queuedExplosion = Default.Cancellable

View file

@ -91,7 +91,6 @@ object GenericHackables {
target.Zone.AvatarEvents ! AvatarServiceMessage(
hacker.Name,
AvatarAction.SendResponse(
Service.defaultPlayerGUID,
HackMessage(progressType, target.GUID, hacker.GUID, progressGrade, 0L, progressState, HackState7.Unk8)
)
)

View file

@ -37,8 +37,8 @@ object RepairableAmenity {
val zoneId = zone.id
val events = zone.AvatarEvents
val targetGUID = target.GUID
events ! AvatarServiceMessage(zoneId, AvatarAction.PlanetsideAttributeToAll(targetGUID, 50, 0))
events ! AvatarServiceMessage(zoneId, AvatarAction.PlanetsideAttributeToAll(targetGUID, 51, 0))
events ! AvatarServiceMessage(zoneId, targetGUID, AvatarAction.PlanetsideAttributeToAll(50, 0))
events ! AvatarServiceMessage(zoneId, targetGUID, AvatarAction.PlanetsideAttributeToAll(51, 0))
RestorationOfHistory(target)
}

View file

@ -91,10 +91,7 @@ trait RepairableEntity extends Repairable {
val magazine = item.Discharge()
events ! AvatarServiceMessage(
player.Name,
AvatarAction.SendResponse(
Service.defaultPlayerGUID,
InventoryStateMessage(item.AmmoSlot.Box.GUID, item.GUID, magazine.toLong)
)
AvatarAction.SendResponse(InventoryStateMessage(item.AmmoSlot.Box.GUID, item.GUID, magazine.toLong))
)
target.LogActivity(
RepairFromEquipment(
@ -110,10 +107,7 @@ trait RepairableEntity extends Repairable {
//progress bar remains visible
events ! AvatarServiceMessage(
name,
AvatarAction.SendResponse(
Service.defaultPlayerGUID,
RepairMessage(target.GUID, updatedHealth * 100 / definition.MaxHealth)
)
AvatarAction.SendResponse(RepairMessage(target.GUID, updatedHealth * 100 / definition.MaxHealth))
)
//if vehicle and vehicle is owned by another player, send repair chat message to the vehicle's owner
if (target.Zone.Vehicles.exists(_.GUID == target.GUID)) {
@ -146,11 +140,11 @@ trait RepairableEntity extends Repairable {
val newHealth = target.Health = target.Health + amount
if (target.Destroyed) {
if (newHealth >= target.Definition.RepairRestoresAt) {
events ! AvatarServiceMessage(zoneId, AvatarAction.PlanetsideAttributeToAll(tguid, 0, newHealth))
events ! AvatarServiceMessage(zoneId, tguid, AvatarAction.PlanetsideAttributeToAll(0, newHealth))
Restoration(target)
}
} else {
events ! AvatarServiceMessage(zoneId, AvatarAction.PlanetsideAttributeToAll(tguid, 0, newHealth))
events ! AvatarServiceMessage(zoneId, tguid, AvatarAction.PlanetsideAttributeToAll(0, newHealth))
}
newHealth
}

View file

@ -108,7 +108,8 @@ class ResourceSiloControl(resourceSilo: ResourceSilo)
val zone = building.Zone
building.Zone.AvatarEvents ! AvatarServiceMessage(
zone.id,
AvatarAction.PlanetsideAttribute(building.GUID, 47, if (resourceSilo.LowNtuWarningOn) 1 else 0)
building.GUID,
AvatarAction.PlanetsideAttribute(47, if (resourceSilo.LowNtuWarningOn) 1 else 0)
)
}
@ -131,7 +132,8 @@ class ResourceSiloControl(resourceSilo: ResourceSilo)
)
zone.AvatarEvents ! AvatarServiceMessage(
zone.id,
AvatarAction.PlanetsideAttribute(resourceSilo.GUID, 45, resourceSilo.CapacitorDisplay)
resourceSilo.GUID,
AvatarAction.PlanetsideAttribute(45, resourceSilo.CapacitorDisplay)
)
building.Actor ! BuildingActor.MapUpdate()
}

View file

@ -193,7 +193,6 @@ object OrbitalShuttlePadControl {
zone.AvatarEvents ! AvatarServiceMessage(
p.Name,
AvatarAction.SendResponse(
Service.defaultPlayerGUID,
ChatMsg(ChatMessageType.UNK_225, wideContents=false, "", "@DoorWillOpenWhenShuttleReturns", None)
)
)

View file

@ -109,8 +109,8 @@ trait FacilityHackParticipation extends ParticipationLogic {
import net.psforever.services.Service
import net.psforever.services.avatar.{AvatarAction, AvatarServiceMessage}
val mainTerm = building.Amenities.filter(x => x.isInstanceOf[Terminal] && x.Definition == GlobalDefinitions.main_terminal).head.GUID
val msg1 = AvatarAction.GenericObjectAction(Service.defaultPlayerGUID, mainTerm, 61)
val msg2 = AvatarAction.GenericObjectAction(Service.defaultPlayerGUID, mainTerm, 58)
val msg1 = AvatarAction.GenericObjectAction(mainTerm, 61)
val msg2 = AvatarAction.GenericObjectAction(mainTerm, 58)
val events = building.Zone.AvatarEvents
list.foreach { p =>
events ! AvatarServiceMessage(p.Name, msg1)

View file

@ -349,7 +349,8 @@ object ProximityTerminalControl {
target.MaxHealth = newMax
zone.AvatarEvents ! AvatarServiceMessage(
zone.id,
AvatarAction.PlanetsideAttributeToAll(target.GUID, 1, newMax)
target.GUID,
AvatarAction.PlanetsideAttributeToAll(1, newMax)
)
}
if (target.Health < newMax) {
@ -364,7 +365,8 @@ object ProximityTerminalControl {
val zone = target.Zone
zone.AvatarEvents ! AvatarServiceMessage(
zone.id,
AvatarAction.PlanetsideAttributeToAll(target.GUID, 0, target.Health)
target.GUID,
AvatarAction.PlanetsideAttributeToAll(0, target.Health)
)
}
@ -403,7 +405,8 @@ object ProximityTerminalControl {
val zone = target.Zone
zone.AvatarEvents ! AvatarServiceMessage(
zone.id,
AvatarAction.PlanetsideAttributeToAll(target.GUID, 4, target.Armor)
target.GUID,
AvatarAction.PlanetsideAttributeToAll(4, target.Armor)
)
target.Armor == maxArmor
} else {
@ -432,7 +435,7 @@ object ProximityTerminalControl {
slots.foreach { slot =>
events ! AvatarServiceMessage(
channel,
AvatarAction.SendResponse(Service.defaultPlayerGUID, InventoryStateMessage(slot.Box.GUID, weapon.GUID, slot.Box.Capacity))
AvatarAction.SendResponse(InventoryStateMessage(slot.Box.GUID, weapon.GUID, slot.Box.Capacity))
)
}
}

View file

@ -39,8 +39,8 @@ trait TurretControl
val zoneId = zone.id
val events = zone.AvatarEvents
val tguid = TurretObject.GUID
events ! AvatarServiceMessage(zoneId, AvatarAction.PlanetsideAttributeToAll(tguid, 50, 0))
events ! AvatarServiceMessage(zoneId, AvatarAction.PlanetsideAttributeToAll(tguid, 51, 0))
events ! AvatarServiceMessage(zoneId, tguid, AvatarAction.PlanetsideAttributeToAll(50, 0))
events ! AvatarServiceMessage(zoneId, tguid, AvatarAction.PlanetsideAttributeToAll(51, 0))
}
/**
@ -56,7 +56,7 @@ trait TurretControl
val tguid = target.GUID
CancelJammeredSound(target)
CancelJammeredStatus(target)
events ! AvatarServiceMessage(zoneId, AvatarAction.PlanetsideAttributeToAll(tguid, 50, 1))
events ! AvatarServiceMessage(zoneId, AvatarAction.PlanetsideAttributeToAll(tguid, 51, 1))
events ! AvatarServiceMessage(zoneId, tguid, AvatarAction.PlanetsideAttributeToAll(50, 1))
events ! AvatarServiceMessage(zoneId, tguid, AvatarAction.PlanetsideAttributeToAll(51, 1))
}
}

View file

@ -33,7 +33,7 @@ object WeaponTurrets {
tool.Magazine = 0
target.Zone.AvatarEvents ! AvatarServiceMessage(
user.Name,
AvatarAction.SendResponse(Service.defaultPlayerGUID, InventoryStateMessage(tool.AmmoSlot.Box.GUID, tool.GUID, 0))
AvatarAction.SendResponse(InventoryStateMessage(tool.AmmoSlot.Box.GUID, tool.GUID, 0))
)
FinishUpgradingMannedTurret(target, upgrade)
}
@ -88,7 +88,6 @@ object WeaponTurrets {
turret.Zone.AvatarEvents ! AvatarServiceMessage(
tplayer.Name,
AvatarAction.SendResponse(
Service.defaultPlayerGUID,
HackMessage(progressType, turret.GUID, tplayer.GUID, progressGrade, -1f, progressState, HackState7.Unk8)
)
)
@ -118,7 +117,7 @@ object WeaponTurrets {
//convert faction
zone.AvatarEvents ! AvatarServiceMessage(
zone.id,
AvatarAction.SetEmpire(Service.defaultPlayerGUID, target.GUID, hacker.Faction)
AvatarAction.SetEmpire(target.GUID, hacker.Faction)
)
zone.LocalEvents ! LocalServiceMessage(
zone.id,

View file

@ -61,7 +61,6 @@ trait CarrierBehavior {
obj.Zone.AvatarEvents ! AvatarServiceMessage(
obj.Zone.id,
AvatarAction.SendResponse(
Service.defaultPlayerGUID,
CargoMountPointStatusMessage(
obj.GUID,
PlanetSideGUID(0),

View file

@ -523,7 +523,7 @@ class VehicleControl(vehicle: Vehicle)
case Some(slot) =>
obj.Zone.AvatarEvents ! AvatarServiceMessage(
self.toString,
AvatarAction.SendResponse(Service.defaultPlayerGUID, ObjectAttachMessage(obj.GUID, item.GUID, slot))
AvatarAction.SendResponse(ObjectAttachMessage(obj.GUID, item.GUID, slot))
)
case None => ()
}

View file

@ -44,7 +44,7 @@ class WithEntranceInVehicle
import net.psforever.types.ChatMessageType
obj.Zone.AvatarEvents ! AvatarServiceMessage(
obj.Actor.toString(),
AvatarAction.SendResponse(Service.defaultPlayerGUID, ChatMsg(ChatMessageType.UNK_227, msg))
AvatarAction.SendResponse(ChatMsg(ChatMessageType.UNK_227, msg))
)
}
}

View file

@ -6,7 +6,7 @@ import net.psforever.actors.zone.ZoneActor
import net.psforever.objects.equipment.Equipment
import net.psforever.types.PlanetSideGUID
import net.psforever.services.Service
import net.psforever.services.avatar.{AvatarAction, AvatarServiceMessage}
import net.psforever.services.avatar.{AvatarAction, AvatarServiceMessage, DropItemMessage, PickupItemMessage}
import scala.annotation.tailrec
import scala.collection.mutable.ListBuffer
@ -31,10 +31,7 @@ class ZoneGroundActor(zone: Zone, equipmentOnGround: ListBuffer[Equipment]) exte
equipmentOnGround += item
item.Position = pos
item.Orientation = orient
zone.AvatarEvents ! AvatarServiceMessage(
zone.id,
AvatarAction.DropItem(Service.defaultPlayerGUID, item)
)
zone.AvatarEvents ! DropItemMessage(zone.id, AvatarAction.DropItem(item), zone)
zone.actor ! ZoneActor.AddToBlockMap(item, pos)
Zone.Ground.ItemOnGround(item, pos, orient)
})
@ -42,7 +39,7 @@ class ZoneGroundActor(zone: Zone, equipmentOnGround: ListBuffer[Equipment]) exte
case Zone.Ground.PickupItem(item_guid) =>
sender() ! (FindItemOnGround(item_guid) match {
case Some(item) =>
zone.AvatarEvents ! AvatarServiceMessage(zone.id, AvatarAction.PickupItem(Service.defaultPlayerGUID, item, 0))
zone.AvatarEvents ! PickupItemMessage(zone.id, AvatarAction.PickupItem(item, 0), zone)
zone.actor ! ZoneActor.RemoveFromBlockMap(item)
Zone.Ground.ItemInHand(item)
case None =>
@ -54,7 +51,7 @@ class ZoneGroundActor(zone: Zone, equipmentOnGround: ListBuffer[Equipment]) exte
FindItemOnGround(item_guid) match {
case Some(item) =>
zone.actor ! ZoneActor.RemoveFromBlockMap(item)
zone.AvatarEvents ! AvatarServiceMessage(zone.id, AvatarAction.PickupItem(Service.defaultPlayerGUID, item, 0))
zone.AvatarEvents ! PickupItemMessage(zone.id, AvatarAction.PickupItem(item, 0), zone)
case None => ;
}

View file

@ -158,8 +158,8 @@ class ZoneProjectileActor(
)
zone.AvatarEvents ! AvatarServiceMessage(
zone.id,
clarifiedFilterGuid,
AvatarAction.LoadProjectile(
clarifiedFilterGuid,
definition.ObjectId,
projectileGuid,
definition.Packet.ConstructorData(projectile).get
@ -190,17 +190,17 @@ class ZoneProjectileActor(
zone.blockMap.removeFrom(projectile)
zone.AvatarEvents ! AvatarServiceMessage(
zone.id,
AvatarAction.ObjectDelete(PlanetSideGUID(0), projectile_guid, 2)
AvatarAction.ObjectDelete(projectile_guid, 2)
)
} else if (projectile.Definition.RemoteClientData == (0,0)) {
zone.AvatarEvents ! AvatarServiceMessage(
zone.id,
AvatarAction.ObjectDelete(PlanetSideGUID(0), projectile_guid, 2)
AvatarAction.ObjectDelete(projectile_guid, 2)
)
} else {
zone.AvatarEvents ! AvatarServiceMessage(
zone.id,
AvatarAction.ProjectileExplodes(PlanetSideGUID(0), projectile_guid, projectile)
AvatarAction.ProjectileExplodes(projectile_guid, projectile)
)
}
}

View file

@ -434,7 +434,7 @@ class PersistenceMonitor(
case _ => ;
}
inZone.Population.tell(Zone.Population.Release(avatar), parent)
inZone.AvatarEvents.tell(AvatarServiceMessage(inZone.id, AvatarAction.ObjectDelete(pguid, pguid)), parent)
inZone.AvatarEvents.tell(AvatarServiceMessage(inZone.id, pguid, AvatarAction.ObjectDelete(pguid)), parent)
TaskWorkflow.execute(GUIDTask.unregisterPlayer(inZone.GUID, player))
//inZone.tasks.tell(GUIDTask.UnregisterPlayer(player)(inZone.GUID), parent)
AvatarLogout(avatar)

View file

@ -0,0 +1,249 @@
// Copyright (c) 2017-2026 PSForever
package net.psforever.services.avatar
import net.psforever.objects.{Player, Vehicle}
import net.psforever.objects.avatar.scoring.KDAStat
import net.psforever.objects.ballistics.Projectile
import net.psforever.objects.equipment.Equipment
import net.psforever.objects.inventory.InventoryItem
import net.psforever.objects.serverobject.environment.interaction.common.Watery.OxygenStateTarget
import net.psforever.objects.sourcing.{SourceEntry, UniquePlayer}
import net.psforever.objects.vital.interaction.DamageResult
import net.psforever.objects.zones.Zone
import net.psforever.packet.PlanetSideGamePacket
import net.psforever.packet.game.{ImplantAction, ObjectCreateMessage}
import net.psforever.packet.game.objectcreate.{ConstructorData, DroppedItemData, ObjectCreateMessageParent, PlacementData}
import net.psforever.services.base.{EventMessage, EventResponse, SelfResponseMessage}
import net.psforever.types.{ExoSuitType, ExperienceType, PlanetSideEmpire, PlanetSideGUID, TransactionType, Vector3}
import scala.concurrent.duration.FiniteDuration
object AvatarAction {
final case class ArmorChanged(suit: ExoSuitType.Value, subtype: Int) extends SelfResponseMessage
final case class AvatarImplant(action: ImplantAction.Value, implantSlot: Int, status: Int) extends SelfResponseMessage
final case class ChangeAmmo(
weapon_guid: PlanetSideGUID,
weapon_slot: Int,
old_ammo_guid: PlanetSideGUID,
ammo_id: Int,
ammo_guid: PlanetSideGUID,
ammo_data: ConstructorData
) extends SelfResponseMessage
final case class ChangeFireMode(item_guid: PlanetSideGUID, mode: Int) extends SelfResponseMessage
final case class ChangeFireState_Start(weapon_guid: PlanetSideGUID) extends SelfResponseMessage
final case class ChangeFireState_Stop(weapon_guid: PlanetSideGUID) extends SelfResponseMessage
final case class ConcealPlayer(player_guid: PlanetSideGUID) extends SelfResponseMessage
final case class EnvironmentalDamage(player_guid: PlanetSideGUID, source_guid: PlanetSideGUID, amount: Int) extends SelfResponseMessage
final case class DeactivateImplantSlot(player_guid: PlanetSideGUID, slot: Int) extends SelfResponseMessage
final case class ActivateImplantSlot(player_guid: PlanetSideGUID, slot: Int) extends SelfResponseMessage
final case class Destroy(victim: PlanetSideGUID, killer: PlanetSideGUID, weapon: PlanetSideGUID, pos: Vector3) extends SelfResponseMessage
final case class DestroyDisplay(killer: SourceEntry, victim: SourceEntry, method: Int, unk: Int = 121) extends SelfResponseMessage
final case class DropCreatedItem(packet: ObjectCreateMessage) extends EventResponse
final case class DropItem(item: Equipment) extends EventMessage {
def response(): EventResponse = {
val definition = item.Definition
val objectData = DroppedItemData(
PlacementData(item.Position, item.Orientation),
definition.Packet.ConstructorData(item).get
)
AvatarAction.DropCreatedItem(ObjectCreateMessage(definition.ObjectId, item.GUID, objectData))
}
}
final case class EquipmentCreatedInHand(packet: ObjectCreateMessage) extends EventResponse
final case class EquipmentInHand(target_guid: PlanetSideGUID, slot: Int, item: Equipment) extends EventMessage {
def response(): EventResponse = {
val definition = item.Definition
val containerData = ObjectCreateMessageParent(target_guid, slot)
val objectData = definition.Packet.ConstructorData(item).get
AvatarAction.EquipmentCreatedInHand(
ObjectCreateMessage(definition.ObjectId, item.GUID, containerData, objectData)
)
AvatarAction.DropCreatedItem(
ObjectCreateMessage(definition.ObjectId, item.GUID, containerData, objectData)
)
}
}
final case class GenericObjectAction(object_guid: PlanetSideGUID, action_code: Int) extends SelfResponseMessage
final case class HitHint(source_guid: PlanetSideGUID) extends SelfResponseMessage
final case class Killed(cause: DamageResult, mount_guid: Option[PlanetSideGUID]) extends SelfResponseMessage
final case class LoadCreatedPlayer(pkt: ObjectCreateMessage) extends EventResponse
final case class LoadPlayer(
object_id: Int,
target_guid: PlanetSideGUID,
cdata: ConstructorData,
pdata: Option[ObjectCreateMessageParent]
) extends EventMessage {
def response(): EventResponse = {
val pkt = pdata match {
case Some(data) =>
ObjectCreateMessage(object_id, target_guid, data, cdata)
case None =>
ObjectCreateMessage(object_id, target_guid, cdata)
}
LoadCreatedPlayer(pkt)
}
}
final case class LoadCreatedProjectile(pkt: ObjectCreateMessage) extends EventResponse
final case class LoadProjectile(
object_id: Int,
projectile_guid: PlanetSideGUID,
cdata: ConstructorData
) extends EventMessage {
def response(): EventResponse = {
LoadCreatedProjectile(ObjectCreateMessage(object_id, projectile_guid, cdata))
}
}
final case class ObjectDelete(item_guid: PlanetSideGUID, unk: Int = 0) extends SelfResponseMessage
final case class ObjectHeld(slot: Int, previousSLot: Int) extends SelfResponseMessage
final case class OxygenState(player: OxygenStateTarget, vehicle: Option[OxygenStateTarget]) extends SelfResponseMessage
final case class PlanetsideAttribute(attribute_type: Int, attribute_value: Long) extends SelfResponseMessage
final case class PlanetsideAttributeToAll(attribute_type: Int, attribute_value: Long) extends SelfResponseMessage
final case class PlanetsideAttributeSelf(attribute_type: Int, attribute_value: Long) extends SelfResponseMessage
final case class PlanetsideStringAttribute(attribute_type: Int, attribute_value: String) extends SelfResponseMessage
final case class PlayerState(
pos: Vector3,
vel: Option[Vector3],
facingYaw: Float,
facingPitch: Float,
facingYawUpper: Float,
timestamp: Int,
is_crouching: Boolean,
is_jumping: Boolean,
jump_thrust: Boolean,
is_cloaked: Boolean,
spectator: Boolean,
weaponInHand: Boolean
) extends SelfResponseMessage
final case class PickupItem(item: Equipment, unk: Int = 0) extends EventMessage {
def response(): EventResponse = {
ObjectDelete(item.GUID, unk)
}
}
final case class ProjectileAutoLockAwareness(mode: Int) extends SelfResponseMessage
final case class ProjectileExplodes(projectile_guid: PlanetSideGUID, projectile: Projectile) extends SelfResponseMessage
final case class ProjectileState(
projectile_guid: PlanetSideGUID,
shot_pos: Vector3,
shot_vel: Vector3,
shot_orient: Vector3,
sequence: Int,
end: Boolean,
hit_target: PlanetSideGUID
) extends SelfResponseMessage
final case class PutDownFDU(player_guid: PlanetSideGUID) extends SelfResponseMessage
final case class ReleasePlayer(player: Player) extends EventResponse
final case class Release(player: Player, zone: Zone, time: Option[FiniteDuration] = None) extends EventMessage {
def response(): EventResponse = {
ReleasePlayer(player)
}
}
final case class Reload(weapon_guid: PlanetSideGUID) extends SelfResponseMessage
final case class Revive(target_guid: PlanetSideGUID) extends SelfResponseMessage
final case class SetEmpire(object_guid: PlanetSideGUID, faction: PlanetSideEmpire.Value)
extends SelfResponseMessage
final case class StowEquipment(target_guid: PlanetSideGUID, slot: Int, item: Equipment)
extends SelfResponseMessage
final case class WeaponDryFire(weapon_guid: PlanetSideGUID) extends SelfResponseMessage
final case class SendResponse(msg: PlanetSideGamePacket) extends SelfResponseMessage
final case class SendResponseTargeted(target_guid: PlanetSideGUID, msg: PlanetSideGamePacket) extends SelfResponseMessage
final case class TerminalOrderResult(terminal_guid: PlanetSideGUID, action: TransactionType.Value, result: Boolean)
extends SelfResponseMessage
final case class ChangeExosuit(
target_guid: PlanetSideGUID,
armor: Int,
exosuit: ExoSuitType.Value,
subtype: Int,
last_drawn_slot: Int,
new_max_hand: Boolean,
old_holsters: List[(Equipment, PlanetSideGUID)],
holsters: List[InventoryItem],
old_inventory: List[(Equipment, PlanetSideGUID)],
inventory: List[InventoryItem],
drop: List[InventoryItem],
delete: List[(Equipment, PlanetSideGUID)]
) extends SelfResponseMessage
final case class ChangeLoadout(
target_guid: PlanetSideGUID,
armor: Int,
exosuit: ExoSuitType.Value,
subtype: Int,
last_drawn_slot: Int,
new_max_hand: Boolean,
old_holsters: List[(Equipment, PlanetSideGUID)],
holsters: List[InventoryItem],
old_inventory: List[(Equipment, PlanetSideGUID)],
inventory: List[InventoryItem],
drop: List[InventoryItem]
) extends SelfResponseMessage
final case class DropSpecialItem() extends SelfResponseMessage
final case class UseKit(kit_guid: PlanetSideGUID, kit_objid: Int) extends SelfResponseMessage
final case class KitNotUsed(kit_guid: PlanetSideGUID, msg: String) extends SelfResponseMessage
final case class UpdateKillsDeathsAssists(charId: Long, kda: KDAStat) extends SelfResponseMessage
final case class AwardBep(charId: Long, bep: Long, expType: ExperienceType) extends SelfResponseMessage
final case class AwardCep(charId: Long, bep: Long) extends SelfResponseMessage
final case class FacilityCaptureRewards(building_id: Int, zone_number: Int, exp: Long) extends SelfResponseMessage
final case class ShareKillExperienceWithSquad(killer: Player, exp: Long) extends SelfResponseMessage
final case class ShareAntExperienceWithSquad(owner: UniquePlayer, exp: Long, vehicle: Vehicle) extends SelfResponseMessage
final case class RemoveFromOutfitChat(outfit_id: Long) extends SelfResponseMessage
final case class TeardownConnection() extends SelfResponseMessage
}

View file

@ -1,522 +1,33 @@
// Copyright (c) 2017 PSForever
package net.psforever.services.avatar
import akka.actor.{Actor, ActorRef, Props}
import akka.actor.{ActorContext, ActorRef, Props}
import net.psforever.objects.zones.Zone
import net.psforever.packet.game.ObjectCreateMessage
import net.psforever.packet.game.objectcreate.{DroppedItemData, ObjectCreateMessageParent, PlacementData}
import net.psforever.types.PlanetSideGUID
import net.psforever.services.avatar.support.{CorpseRemovalActor, DroppedItemRemover}
import net.psforever.services.base.GenericEventBus
import net.psforever.services.{RemoverActor, Service}
import net.psforever.services.base.{EventServiceSupport, GenericEventServiceWithSupport, GenericMessageEnvelope}
class AvatarService(zone: Zone) extends Actor {
private val undertaker: ActorRef = context.actorOf(Props[CorpseRemovalActor](), s"${zone.id}-corpse-removal-agent")
private val janitor = context.actorOf(Props[DroppedItemRemover](), s"${zone.id}-item-remover-agent")
private[this] val log = org.log4s.getLogger
val AvatarEvents = new GenericEventBus[AvatarServiceResponse] //AvatarEventBus
def receive: Receive = {
case Service.Join(channel) =>
val path = s"/$channel/Avatar"
val who = sender()
AvatarEvents.subscribe(who, path)
case Service.Leave(None) =>
AvatarEvents.unsubscribe(sender())
case Service.Leave(Some(channel)) =>
val path = s"/$channel/Avatar"
AvatarEvents.unsubscribe(sender(), path)
case Service.LeaveAll() =>
AvatarEvents.unsubscribe(sender())
case AvatarServiceMessage(forChannel, action) =>
action match {
case AvatarAction.ArmorChanged(player_guid, suit, subtype) =>
AvatarEvents.publish(
AvatarServiceResponse(s"/$forChannel/Avatar", player_guid, AvatarResponse.ArmorChanged(suit, subtype))
)
case AvatarAction.AvatarImplant(player_guid, action, implantSlot, status) =>
AvatarEvents.publish(
AvatarServiceResponse(s"/$forChannel/Avatar", player_guid, AvatarResponse.AvatarImplant(action, implantSlot, status))
)
case AvatarAction.ChangeAmmo(
player_guid,
weapon_guid,
weapon_slot,
old_ammo_guid,
ammo_id,
ammo_guid,
ammo_data
) =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
player_guid,
AvatarResponse.ChangeAmmo(weapon_guid, weapon_slot, old_ammo_guid, ammo_id, ammo_guid, ammo_data)
)
)
case AvatarAction.ChangeFireMode(player_guid, item_guid, mode) =>
AvatarEvents.publish(
AvatarServiceResponse(s"/$forChannel/Avatar", player_guid, AvatarResponse.ChangeFireMode(item_guid, mode))
)
case AvatarAction.ChangeFireState_Start(player_guid, weapon_guid) =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
player_guid,
AvatarResponse.ChangeFireState_Start(weapon_guid)
)
)
case AvatarAction.ChangeFireState_Stop(player_guid, weapon_guid) =>
AvatarEvents.publish(
AvatarServiceResponse(s"/$forChannel/Avatar", player_guid, AvatarResponse.ChangeFireState_Stop(weapon_guid))
)
case AvatarAction.ConcealPlayer(player_guid) =>
AvatarEvents.publish(
AvatarServiceResponse(s"/$forChannel/Avatar", player_guid, AvatarResponse.ConcealPlayer())
)
case AvatarAction.EnvironmentalDamage(player_guid, source_guid, amount) =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
player_guid,
AvatarResponse.EnvironmentalDamage(player_guid, source_guid, amount)
)
)
case AvatarAction.Destroy(victim, killer, weapon, pos) =>
AvatarEvents.publish(
AvatarServiceResponse(s"/$forChannel/Avatar", victim, AvatarResponse.Destroy(victim, killer, weapon, pos))
)
case AvatarAction.DestroyDisplay(killer, victim, method, unk) =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
Service.defaultPlayerGUID,
AvatarResponse.DestroyDisplay(killer, victim, method, unk)
)
)
case AvatarAction.DropItem(player_guid, item) =>
val definition = item.Definition
val objectData = DroppedItemData(
PlacementData(item.Position, item.Orientation),
definition.Packet.ConstructorData(item).get
)
janitor forward RemoverActor.AddTask(item, zone)
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
player_guid,
AvatarResponse.DropItem(ObjectCreateMessage(definition.ObjectId, item.GUID, objectData))
)
)
case AvatarAction.EquipmentInHand(player_guid, target_guid, slot, item) =>
val definition = item.Definition
val containerData = ObjectCreateMessageParent(target_guid, slot)
val objectData = definition.Packet.ConstructorData(item).get
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
player_guid,
AvatarResponse.EquipmentInHand(
ObjectCreateMessage(definition.ObjectId, item.GUID, containerData, objectData)
)
)
)
case AvatarAction.GenericObjectAction(player_guid, object_guid, action_code) =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
player_guid,
AvatarResponse.GenericObjectAction(object_guid, action_code)
)
)
case AvatarAction.HitHint(source_guid, player_guid) =>
AvatarEvents.publish(
AvatarServiceResponse(s"/$forChannel/Avatar", player_guid, AvatarResponse.HitHint(source_guid))
)
case AvatarAction.Killed(player_guid, cause, mount_guid) =>
AvatarEvents.publish(
AvatarServiceResponse(s"/$forChannel/Avatar", player_guid, AvatarResponse.Killed(cause, mount_guid))
)
case AvatarAction.LoadPlayer(player_guid, object_id, target_guid, cdata, pdata) =>
val pkt = pdata match {
case Some(data) =>
ObjectCreateMessage(object_id, target_guid, data, cdata)
case None =>
ObjectCreateMessage(object_id, target_guid, cdata)
}
AvatarEvents.publish(
AvatarServiceResponse(s"/$forChannel/Avatar", player_guid, AvatarResponse.LoadPlayer(pkt))
)
case AvatarAction.LoadProjectile(player_guid, object_id, object_guid, cdata) =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
player_guid,
AvatarResponse.LoadProjectile(
ObjectCreateMessage(object_id, object_guid, cdata)
)
)
)
case AvatarAction.ObjectDelete(player_guid, item_guid, unk) =>
AvatarEvents.publish(
AvatarServiceResponse(s"/$forChannel/Avatar", player_guid, AvatarResponse.ObjectDelete(item_guid, unk))
)
case AvatarAction.ObjectHeld(player_guid, slot, previousSlot) =>
AvatarEvents.publish(
AvatarServiceResponse(s"/$forChannel/Avatar", player_guid, AvatarResponse.ObjectHeld(slot, previousSlot))
)
case AvatarAction.OxygenState(player, vehicle) =>
AvatarEvents.publish(
AvatarServiceResponse(s"/$forChannel/Avatar", player.guid, AvatarResponse.OxygenState(player, vehicle))
)
case AvatarAction.PlanetsideAttribute(guid, attribute_type, attribute_value) =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
guid,
AvatarResponse.PlanetsideAttribute(attribute_type, attribute_value)
)
)
case AvatarAction.PlanetsideAttributeToAll(guid, attribute_type, attribute_value) =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
guid,
AvatarResponse.PlanetsideAttributeToAll(attribute_type, attribute_value)
)
)
case AvatarAction.PlanetsideAttributeSelf(guid, attribute_type, attribute_value) =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
guid,
AvatarResponse.PlanetsideAttributeSelf(attribute_type, attribute_value)
)
)
case AvatarAction.PlanetsideStringAttribute(guid, attribute_type, attribute_value) =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
guid,
AvatarResponse.PlanetsideStringAttribute(attribute_type, attribute_value)
)
)
case AvatarAction.PlayerState(
guid,
pos,
vel,
yaw,
pitch,
yaw_upper,
seq_time,
is_crouching,
is_jumping,
jump_thrust,
is_cloaking,
spectating,
weaponInHand
) =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
guid,
AvatarResponse.PlayerState(
pos,
vel,
yaw,
pitch,
yaw_upper,
seq_time,
is_crouching,
is_jumping,
jump_thrust,
is_cloaking,
spectating,
weaponInHand
)
)
)
case AvatarAction.ProjectileAutoLockAwareness(mode) =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
PlanetSideGUID(0),
AvatarResponse.ProjectileAutoLockAwareness(mode)
)
)
case AvatarAction.ProjectileExplodes(player_guid, projectile_guid, projectile) =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
player_guid,
AvatarResponse.ProjectileExplodes(projectile_guid, projectile)
)
)
case AvatarAction.ProjectileState(
player_guid,
projectile_guid,
shot_pos,
shot_vel,
shot_orient,
sequence,
end,
target
) =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
player_guid,
AvatarResponse.ProjectileState(projectile_guid, shot_pos, shot_vel, shot_orient, sequence, end, target)
)
)
case AvatarAction.PickupItem(player_guid, item, unk) =>
janitor forward RemoverActor.ClearSpecific(List(item), zone)
AvatarEvents.publish(
AvatarServiceResponse(s"/$forChannel/Avatar", player_guid, AvatarResponse.ObjectDelete(item.GUID, unk))
)
case AvatarAction.PutDownFDU(player_guid) =>
AvatarEvents.publish(
AvatarServiceResponse(s"/$forChannel/Avatar", Service.defaultPlayerGUID, AvatarResponse.PutDownFDU(player_guid))
)
case AvatarAction.Release(player, _, time) =>
undertaker forward RemoverActor.AddTask(player, zone, time)
AvatarEvents.publish(
AvatarServiceResponse(s"/$forChannel/Avatar", player.GUID, AvatarResponse.Release(player))
)
case AvatarAction.Reload(player_guid, weapon_guid) =>
AvatarEvents.publish(
AvatarServiceResponse(s"/$forChannel/Avatar", player_guid, AvatarResponse.Reload(weapon_guid))
)
case AvatarAction.SetEmpire(player_guid, target_guid, faction) =>
AvatarEvents.publish(
AvatarServiceResponse(s"/$forChannel/Avatar", player_guid, AvatarResponse.SetEmpire(target_guid, faction))
)
case AvatarAction.StowEquipment(player_guid, target_guid, slot, obj) =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
player_guid,
AvatarResponse.StowEquipment(target_guid, slot, obj)
)
)
case AvatarAction.WeaponDryFire(player_guid, weapon_guid) =>
AvatarEvents.publish(
AvatarServiceResponse(s"/$forChannel/Avatar", player_guid, AvatarResponse.WeaponDryFire(weapon_guid))
)
case AvatarAction.SendResponse(player_guid, msg) =>
AvatarEvents.publish(
AvatarServiceResponse(s"/$forChannel/Avatar", player_guid, AvatarResponse.SendResponse(msg))
)
case AvatarAction.SendResponseTargeted(target_guid, msg) =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
target_guid,
AvatarResponse.SendResponseTargeted(target_guid, msg)
)
)
case AvatarAction.Revive(target_guid) =>
AvatarEvents.publish(
AvatarServiceResponse(s"/$forChannel/Avatar", target_guid, AvatarResponse.Revive(target_guid))
)
case AvatarAction.TeardownConnection() =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
Service.defaultPlayerGUID,
AvatarResponse.TeardownConnection()
)
)
case AvatarAction.TerminalOrderResult(terminal, term_action, result) =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
Service.defaultPlayerGUID,
AvatarResponse.TerminalOrderResult(terminal, term_action, result)
)
)
case AvatarAction.ChangeExosuit(
target,
armor,
exosuit,
subtype,
slot,
maxhand,
old_holsters,
holsters,
old_inventory,
inventory,
drop,
delete
) =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
Service.defaultPlayerGUID,
AvatarResponse.ChangeExosuit(
target,
armor,
exosuit,
subtype,
slot,
maxhand,
old_holsters,
holsters,
old_inventory,
inventory,
drop,
delete
)
)
)
case AvatarAction.ChangeLoadout(
target,
armor,
exosuit,
subtype,
slot,
maxhand,
old_holsters,
holsters,
old_inventory,
inventory,
drop
) =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
Service.defaultPlayerGUID,
AvatarResponse.ChangeLoadout(
target,
armor,
exosuit,
subtype,
slot,
maxhand,
old_holsters,
holsters,
old_inventory,
inventory,
drop
)
)
)
case AvatarAction.DropSpecialItem() =>
AvatarEvents.publish(AvatarServiceResponse(s"/$forChannel/Avatar", Service.defaultPlayerGUID, AvatarResponse.DropSpecialItem()))
case AvatarAction.UseKit(kit_guid, kit_objid) =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
Service.defaultPlayerGUID,
AvatarResponse.UseKit(kit_guid, kit_objid)
)
)
case AvatarAction.KitNotUsed(kit_guid, msg) =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
Service.defaultPlayerGUID,
AvatarResponse.KitNotUsed(kit_guid, msg)
)
)
case AvatarAction.UpdateKillsDeathsAssists(charId, stat) =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
Service.defaultPlayerGUID,
AvatarResponse.UpdateKillsDeathsAssists(charId, stat)
)
)
case AvatarAction.AwardBep(charId, bep, expType) =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
Service.defaultPlayerGUID,
AvatarResponse.AwardBep(charId, bep, expType)
)
)
case AvatarAction.AwardCep(charId, bep) =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
Service.defaultPlayerGUID,
AvatarResponse.AwardCep(charId, bep)
)
)
case AvatarAction.FacilityCaptureRewards(building_id, zone_number, exp) =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
Service.defaultPlayerGUID,
AvatarResponse.FacilityCaptureRewards(building_id, zone_number, exp)
)
)
case AvatarAction.ShareKillExperienceWithSquad(killer, exp) =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
Service.defaultPlayerGUID,
AvatarResponse.ShareKillExperienceWithSquad(killer, exp)
)
)
case AvatarAction.ShareAntExperienceWithSquad(owner, exp, vehicle) =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
Service.defaultPlayerGUID,
AvatarResponse.ShareAntExperienceWithSquad(owner, exp, vehicle)
)
)
case AvatarAction.RemoveFromOutfitChat(outfit_id) =>
AvatarEvents.publish(
AvatarServiceResponse(
s"/$forChannel/Avatar",
Service.defaultPlayerGUID,
AvatarResponse.RemoveFromOutfitChat(outfit_id)
)
)
case _ => ()
}
//message to Undertaker
case AvatarServiceMessage.Corpse(msg) =>
undertaker forward msg
//message to Janitor
case AvatarServiceMessage.Ground(msg) =>
janitor forward msg
/*
case AvatarService.PlayerStateShift(killer, guid) =>
val playerOpt: Option[PlayerAvatar] = PlayerMasterList.getPlayer(guid)
if (playerOpt.isDefined) {
val player: PlayerAvatar = playerOpt.get
AvatarEvents.publish(AvatarMessage("/Avatar/" + player.continent, guid,
AvatarServiceReply.PlayerStateShift(killer)
))
}
*/
case msg =>
log.warn(s"Unhandled message $msg from ${sender()}")
case object CorpseRemovalSupport
extends EventServiceSupport {
def label: String = "undertaker"
def constructor(context: ActorContext): ActorRef = {
context.actorOf(Props[CorpseRemovalActor](), name = "CorpseRemoval")
}
}
case object ItemRemoverSupport
extends EventServiceSupport {
def label: String = "janitor"
def constructor(context: ActorContext): ActorRef = {
context.actorOf(Props[DroppedItemRemover](), name = "ItemRemover")
}
}
class AvatarService(zone: Zone)
extends GenericEventServiceWithSupport[AvatarServiceResponse](
busName = "Avatar",
eventSupportServices = List(CorpseRemovalSupport, ItemRemoverSupport)
) {
protected def compose(msg: GenericMessageEnvelope): AvatarServiceResponse = {
AvatarServiceResponse(formatChannelOnBusName(msg.channel), msg.filter, msg.msg.response())
}
}

View file

@ -1,175 +1,82 @@
// Copyright (c) 2017 PSForever
// Copyright (c) 2017-2026 PSForever
package net.psforever.services.avatar
import net.psforever.objects.{Player, Vehicle}
import net.psforever.objects.avatar.scoring.KDAStat
import net.psforever.objects.ballistics.Projectile
import net.psforever.objects.equipment.Equipment
import net.psforever.objects.inventory.InventoryItem
import net.psforever.objects.serverobject.environment.interaction.common.Watery.OxygenStateTarget
import net.psforever.objects.sourcing.{SourceEntry, UniquePlayer}
import net.psforever.objects.vital.interaction.DamageResult
import net.psforever.objects.zones.Zone
import net.psforever.packet.PlanetSideGamePacket
import net.psforever.packet.game.ImplantAction
import net.psforever.packet.game.objectcreate.{ConstructorData, ObjectCreateMessageParent}
import net.psforever.services.base.{EventMessage, EventResponse}
import net.psforever.types.{ExoSuitType, ExperienceType, PlanetSideEmpire, PlanetSideGUID, TransactionType, Vector3}
import net.psforever.services.{RemoverActor, Service}
import net.psforever.services.avatar.AvatarAction.{DropItem, PickupItem, Release}
import net.psforever.services.base.{EventMessage, GenericMessageEnvelope, GenericMessageToSupportEnvelope, GenericMessageToSupportEnvelopeOnly}
import net.psforever.types.PlanetSideGUID
import scala.concurrent.duration.FiniteDuration
final case class AvatarServiceMessage(forChannel: String, actionMessage: AvatarAction.Action)
final case class AvatarServiceMessage(channel: String, filter: PlanetSideGUID, msg: EventMessage)
extends GenericMessageEnvelope
object AvatarServiceMessage {
final case class Corpse(msg: Any)
final case class Ground(msg: Any)
def apply(channel: String, actionMessage: EventMessage): AvatarServiceMessage =
AvatarServiceMessage(channel, Service.defaultPlayerGUID, actionMessage)
}
object AvatarAction {
sealed trait Action extends EventMessage {
def response(): EventResponse = null
final case class ReleaseMessage(
channel: String,
filter: PlanetSideGUID,
msg: Release
)
extends GenericMessageToSupportEnvelope {
def supportLabel: String = "undertaker"
def supportMessage: Any = {
val Release(player, zone, time) = msg
RemoverActor.AddTask(player, zone, time)
}
final case class ArmorChanged(player_guid: PlanetSideGUID, suit: ExoSuitType.Value, subtype: Int) extends Action
final case class AvatarImplant(player_guid: PlanetSideGUID, action: ImplantAction.Value, implantSlot: Int, status: Int) extends Action
final case class ChangeAmmo(
player_guid: PlanetSideGUID,
weapon_guid: PlanetSideGUID,
weapon_slot: Int,
old_ammo_guid: PlanetSideGUID,
ammo_id: Int,
ammo_guid: PlanetSideGUID,
ammo_data: ConstructorData
) extends Action
final case class ChangeFireMode(player_guid: PlanetSideGUID, item_guid: PlanetSideGUID, mode: Int) extends Action
final case class ChangeFireState_Start(player_guid: PlanetSideGUID, weapon_guid: PlanetSideGUID) extends Action
final case class ChangeFireState_Stop(player_guid: PlanetSideGUID, weapon_guid: PlanetSideGUID) extends Action
final case class ConcealPlayer(player_guid: PlanetSideGUID) extends Action
final case class EnvironmentalDamage(player_guid: PlanetSideGUID, source_guid: PlanetSideGUID, amount: Int)
extends Action
final case class DeactivateImplantSlot(player_guid: PlanetSideGUID, slot: Int) extends Action
final case class ActivateImplantSlot(player_guid: PlanetSideGUID, slot: Int) extends Action
final case class Destroy(victim: PlanetSideGUID, killer: PlanetSideGUID, weapon: PlanetSideGUID, pos: Vector3)
extends Action
final case class DestroyDisplay(killer: SourceEntry, victim: SourceEntry, method: Int, unk: Int = 121) extends Action
final case class DropItem(player_guid: PlanetSideGUID, item: Equipment) extends Action
final case class EquipmentInHand(player_guid: PlanetSideGUID, target_guid: PlanetSideGUID, slot: Int, item: Equipment)
extends Action
final case class GenericObjectAction(player_guid: PlanetSideGUID, object_guid: PlanetSideGUID, action_code: Int)
extends Action
final case class HitHint(source_guid: PlanetSideGUID, player_guid: PlanetSideGUID) extends Action
final case class Killed(player_guid: PlanetSideGUID, cause: DamageResult, mount_guid: Option[PlanetSideGUID]) extends Action
final case class LoadPlayer(
player_guid: PlanetSideGUID,
object_id: Int,
target_guid: PlanetSideGUID,
cdata: ConstructorData,
pdata: Option[ObjectCreateMessageParent]
) extends Action
final case class LoadProjectile(
player_guid: PlanetSideGUID,
object_id: Int,
projectile_guid: PlanetSideGUID,
cdata: ConstructorData
) extends Action
final case class ObjectDelete(player_guid: PlanetSideGUID, item_guid: PlanetSideGUID, unk: Int = 0) extends Action
final case class ObjectHeld(player_guid: PlanetSideGUID, slot: Int, previousSLot: Int) extends Action
final case class OxygenState(player: OxygenStateTarget, vehicle: Option[OxygenStateTarget]) extends Action
final case class PlanetsideAttribute(player_guid: PlanetSideGUID, attribute_type: Int, attribute_value: Long)
extends Action
final case class PlanetsideAttributeToAll(player_guid: PlanetSideGUID, attribute_type: Int, attribute_value: Long)
extends Action
final case class PlanetsideAttributeSelf(player_guid: PlanetSideGUID, attribute_type: Int, attribute_value: Long)
extends Action
final case class PlanetsideStringAttribute(player_guid: PlanetSideGUID, attribute_type: Int, attribute_value: String)
extends Action
final case class PlayerState(
player_guid: PlanetSideGUID,
pos: Vector3,
vel: Option[Vector3],
facingYaw: Float,
facingPitch: Float,
facingYawUpper: Float,
timestamp: Int,
is_crouching: Boolean,
is_jumping: Boolean,
jump_thrust: Boolean,
is_cloaked: Boolean,
spectator: Boolean,
weaponInHand: Boolean
) extends Action
final case class PickupItem(player_guid: PlanetSideGUID, item: Equipment, unk: Int = 0) extends Action
final case class ProjectileAutoLockAwareness(mode: Int) extends Action
final case class ProjectileExplodes(
player_guid: PlanetSideGUID,
projectile_guid: PlanetSideGUID,
projectile: Projectile
) extends Action
final case class ProjectileState(
player_guid: PlanetSideGUID,
projectile_guid: PlanetSideGUID,
shot_pos: Vector3,
shot_vel: Vector3,
shot_orient: Vector3,
sequence: Int,
end: Boolean,
hit_target: PlanetSideGUID
) extends Action
final case class PutDownFDU(player_guid: PlanetSideGUID) extends Action
final case class Release(player: Player, zone: Zone, time: Option[FiniteDuration] = None) extends Action
final case class Revive(target_guid: PlanetSideGUID) extends Action
final case class Reload(player_guid: PlanetSideGUID, weapon_guid: PlanetSideGUID) extends Action
final case class SetEmpire(player_guid: PlanetSideGUID, object_guid: PlanetSideGUID, faction: PlanetSideEmpire.Value)
extends Action
final case class StowEquipment(player_guid: PlanetSideGUID, target_guid: PlanetSideGUID, slot: Int, item: Equipment)
extends Action
final case class WeaponDryFire(player_guid: PlanetSideGUID, weapon_guid: PlanetSideGUID) extends Action
final case class SendResponse(player_guid: PlanetSideGUID, msg: PlanetSideGamePacket) extends Action
final case class SendResponseTargeted(target_guid: PlanetSideGUID, msg: PlanetSideGamePacket) extends Action
final case class TerminalOrderResult(terminal_guid: PlanetSideGUID, action: TransactionType.Value, result: Boolean)
extends Action
final case class ChangeExosuit(
target_guid: PlanetSideGUID,
armor: Int,
exosuit: ExoSuitType.Value,
subtype: Int,
last_drawn_slot: Int,
new_max_hand: Boolean,
old_holsters: List[(Equipment, PlanetSideGUID)],
holsters: List[InventoryItem],
old_inventory: List[(Equipment, PlanetSideGUID)],
inventory: List[InventoryItem],
drop: List[InventoryItem],
delete: List[(Equipment, PlanetSideGUID)]
) extends Action
final case class ChangeLoadout(
target_guid: PlanetSideGUID,
armor: Int,
exosuit: ExoSuitType.Value,
subtype: Int,
last_drawn_slot: Int,
new_max_hand: Boolean,
old_holsters: List[(Equipment, PlanetSideGUID)],
holsters: List[InventoryItem],
old_inventory: List[(Equipment, PlanetSideGUID)],
inventory: List[InventoryItem],
drop: List[InventoryItem]
) extends Action
final case class DropSpecialItem() extends Action
final case class UseKit(kit_guid: PlanetSideGUID, kit_objid: Int) extends Action
final case class KitNotUsed(kit_guid: PlanetSideGUID, msg: String) extends Action
final case class UpdateKillsDeathsAssists(charId: Long, kda: KDAStat) extends Action
final case class AwardBep(charId: Long, bep: Long, expType: ExperienceType) extends Action
final case class AwardCep(charId: Long, bep: Long) extends Action
final case class FacilityCaptureRewards(building_id: Int, zone_number: Int, exp: Long) extends Action
final case class ShareKillExperienceWithSquad(killer: Player, exp: Long) extends Action
final case class ShareAntExperienceWithSquad(owner: UniquePlayer, exp: Long, vehicle: Vehicle) extends Action
final case class RemoveFromOutfitChat(outfit_id: Long) extends Action
final case class TeardownConnection() extends Action
// final case class PlayerStateShift(killer : PlanetSideGUID, victim : PlanetSideGUID) extends Action
// final case class DestroyDisplay(killer : PlanetSideGUID, victim : PlanetSideGUID) extends Action
}
object ReleaseMessage {
def apply(channel: String, actionMessage: Release): ReleaseMessage =
ReleaseMessage(channel, Service.defaultPlayerGUID, actionMessage)
}
final case class PickupItemMessage(
channel: String,
filter: PlanetSideGUID,
msg: PickupItem,
zone: Zone
)
extends GenericMessageToSupportEnvelope {
def supportLabel: String = "janitor"
def supportMessage: Any = {
val PickupItem(item, _) = msg
RemoverActor.ClearSpecific(List(item), zone)
}
}
object PickupItemMessage {
def apply(channel: String, actionMessage: PickupItem, zone: Zone): PickupItemMessage =
PickupItemMessage(channel, Service.defaultPlayerGUID, actionMessage, zone)
}
final case class DropItemMessage(
channel: String,
filter: PlanetSideGUID,
msg: DropItem,
zone: Zone
)
extends GenericMessageToSupportEnvelope {
def supportLabel: String = "janitor"
def supportMessage: Any = {
val DropItem(item) = msg
RemoverActor.AddTask(item, zone)
}
}
object DropItemMessage {
def apply(channel: String, actionMessage: DropItem, zone: Zone): DropItemMessage =
DropItemMessage(channel, Service.defaultPlayerGUID, actionMessage, zone)
}
final case class CorpseEnvelope(supportMessage: Any)
extends GenericMessageToSupportEnvelopeOnly {
def supportLabel: String = "undertaker"
}
final case class GroundEnvelope(supportMessage: Any)
extends GenericMessageToSupportEnvelopeOnly {
def supportLabel: String = "janitor"
}

View file

@ -1,139 +1,11 @@
// Copyright (c) 2017 PSForever
package net.psforever.services.avatar
import net.psforever.objects.{Player, Vehicle}
import net.psforever.objects.avatar.scoring.KDAStat
import net.psforever.objects.ballistics.Projectile
import net.psforever.objects.equipment.Equipment
import net.psforever.objects.inventory.InventoryItem
import net.psforever.objects.serverobject.environment.interaction.common.Watery.OxygenStateTarget
import net.psforever.objects.sourcing.{SourceEntry, UniquePlayer}
import net.psforever.objects.vital.interaction.DamageResult
import net.psforever.packet.PlanetSideGamePacket
import net.psforever.packet.game.objectcreate.ConstructorData
import net.psforever.packet.game.{ImplantAction, ObjectCreateMessage}
import net.psforever.types.{ExoSuitType, ExperienceType, PlanetSideEmpire, PlanetSideGUID, TransactionType, Vector3}
import net.psforever.services.base.{EventResponse, GenericEventBusMsg}
import net.psforever.types.PlanetSideGUID
import net.psforever.services.base.{EventResponse, GenericResponseEnvelope}
final case class AvatarServiceResponse(
channel: String,
avatar_guid: PlanetSideGUID,
replyMessage: AvatarResponse.Response
) extends GenericEventBusMsg
object AvatarResponse {
sealed trait Response extends EventResponse
final case class ArmorChanged(suit: ExoSuitType.Value, subtype: Int) extends Response
final case class AvatarImplant(action: ImplantAction.Value, implantSlot: Int, status: Int) extends Response
final case class ChangeAmmo(
weapon_guid: PlanetSideGUID,
weapon_slot: Int,
old_ammo_guid: PlanetSideGUID,
ammo_id: Int,
ammo_guid: PlanetSideGUID,
ammo_data: ConstructorData
) extends Response
final case class ChangeFireMode(item_guid: PlanetSideGUID, mode: Int) extends Response
final case class ChangeFireState_Start(weapon_guid: PlanetSideGUID) extends Response
final case class ChangeFireState_Stop(weapon_guid: PlanetSideGUID) extends Response
final case class ConcealPlayer() extends Response
final case class EnvironmentalDamage(target: PlanetSideGUID, source_guid: PlanetSideGUID, amount: Int)
extends Response
final case class Destroy(victim: PlanetSideGUID, killer: PlanetSideGUID, weapon: PlanetSideGUID, pos: Vector3)
extends Response
final case class DestroyDisplay(killer: SourceEntry, victim: SourceEntry, method: Int, unk: Int) extends Response
final case class DropItem(pkt: ObjectCreateMessage) extends Response
final case class EquipmentInHand(pkt: ObjectCreateMessage) extends Response
final case class GenericObjectAction(object_guid: PlanetSideGUID, action_code: Int) extends Response
final case class HitHint(source_guid: PlanetSideGUID) extends Response
final case class Killed(cause: DamageResult, mount_guid: Option[PlanetSideGUID]) extends Response
final case class LoadPlayer(pkt: ObjectCreateMessage) extends Response
final case class LoadProjectile(pkt: ObjectCreateMessage) extends Response
final case class ObjectDelete(item_guid: PlanetSideGUID, unk: Int) extends Response
final case class ObjectHeld(slot: Int, previousSLot: Int) extends Response
final case class OxygenState(player: OxygenStateTarget, vehicle: Option[OxygenStateTarget]) extends Response
final case class PlanetsideAttribute(attribute_type: Int, attribute_value: Long) extends Response
final case class PlanetsideAttributeToAll(attribute_type: Int, attribute_value: Long) extends Response
final case class PlanetsideAttributeSelf(attribute_type: Int, attribute_value: Long) extends Response
final case class PlanetsideStringAttribute(attribute_type: Int, attribute_value: String) extends Response
final case class PlayerState(
pos: Vector3,
vel: Option[Vector3],
facingYaw: Float,
facingPitch: Float,
facingYawUpper: Float,
timestamp: Int,
is_crouching: Boolean,
is_jumping: Boolean,
jump_thrust: Boolean,
is_cloaked: Boolean,
spectator: Boolean,
weaponInHand: Boolean
) extends Response
final case class ProjectileAutoLockAwareness(mode: Int) extends Response
final case class ProjectileExplodes(projectile_guid: PlanetSideGUID, projectile: Projectile) extends Response
final case class ProjectileState(
projectile_guid: PlanetSideGUID,
shot_pos: Vector3,
shot_vel: Vector3,
shot_orient: Vector3,
sequence: Int,
end: Boolean,
hit_target: PlanetSideGUID
) extends Response
final case class PutDownFDU(target_guid: PlanetSideGUID) extends Response
final case class Release(player: Player) extends Response
final case class Reload(weapon_guid: PlanetSideGUID) extends Response
final case class Revive(target_guid: PlanetSideGUID) extends Response
final case class SetEmpire(object_guid: PlanetSideGUID, faction: PlanetSideEmpire.Value) extends Response
final case class StowEquipment(target_guid: PlanetSideGUID, slot: Int, item: Equipment) extends Response
final case class WeaponDryFire(weapon_guid: PlanetSideGUID) extends Response
final case class SendResponse(msg: PlanetSideGamePacket) extends Response
final case class SendResponseTargeted(target_guid: PlanetSideGUID, msg: PlanetSideGamePacket) extends Response
final case class TerminalOrderResult(terminal_guid: PlanetSideGUID, action: TransactionType.Value, result: Boolean)
extends Response
final case class ChangeExosuit(
target_guid: PlanetSideGUID,
armor: Int,
exosuit: ExoSuitType.Value,
subtype: Int,
last_drawn_slot: Int,
new_max_hand: Boolean,
old_holsters: List[(Equipment, PlanetSideGUID)],
holsters: List[InventoryItem],
old_inventory: List[(Equipment, PlanetSideGUID)],
inventory: List[InventoryItem],
drop: List[InventoryItem],
delete: List[(Equipment, PlanetSideGUID)]
) extends Response
final case class ChangeLoadout(
target_guid: PlanetSideGUID,
armor: Int,
exosuit: ExoSuitType.Value,
subtype: Int,
last_drawn_slot: Int,
new_max_hand: Boolean,
old_holsters: List[(Equipment, PlanetSideGUID)],
holsters: List[InventoryItem],
old_inventory: List[(Equipment, PlanetSideGUID)],
inventory: List[InventoryItem],
drop: List[InventoryItem]
) extends Response
final case class DropSpecialItem() extends Response
final case class TeardownConnection() extends Response
// final case class PlayerStateShift(itemID : PlanetSideGUID) extends Response
final case class UseKit(kit_guid: PlanetSideGUID, kit_objid: Int) extends Response
final case class KitNotUsed(kit_guid: PlanetSideGUID, msg: String) extends Response
final case class UpdateKillsDeathsAssists(charId: Long, kda: KDAStat) extends Response
final case class AwardBep(charId: Long, bep: Long, expType: ExperienceType) extends Response
final case class AwardCep(charId: Long, bep: Long) extends Response
final case class FacilityCaptureRewards(building_id: Int, zone_number: Int, exp: Long) extends Response
final case class ShareKillExperienceWithSquad(killer: Player, exp: Long) extends Response
final case class ShareAntExperienceWithSquad(owner: UniquePlayer, exp: Long, vehicle: Vehicle) extends Response
final case class RemoveFromOutfitChat(outfit_id: Long) extends Response
}
channel: String,
filter: PlanetSideGUID,
reply: EventResponse
) extends GenericResponseEnvelope

View file

@ -25,7 +25,7 @@ class CorpseRemovalActor extends RemoverActor() {
entry.zone.Population ! Zone.Corpse.Remove(entry.obj.asInstanceOf[Player])
context.parent ! AvatarServiceMessage(
entry.zone.id,
AvatarAction.ObjectDelete(Service.defaultPlayerGUID, entry.obj.GUID, unk=1)
AvatarAction.ObjectDelete(entry.obj.GUID, unk=1)
)
}

View file

@ -24,7 +24,7 @@ class DroppedItemRemover extends RemoverActor() {
entry.zone.Ground ! Zone.Ground.RemoveItem(entry.obj.GUID)
context.parent ! AvatarServiceMessage(
entry.zone.id,
AvatarAction.ObjectDelete(Service.defaultPlayerGUID, entry.obj.GUID)
AvatarAction.ObjectDelete(entry.obj.GUID)
)
}

View file

@ -6,28 +6,31 @@ import net.psforever.services.Service
import net.psforever.types.PlanetSideGUID
import org.log4s.Logger
import scala.annotation.unused
trait GenericResponseEnvelope
extends GenericEventBusMsg {
def exclude: PlanetSideGUID
def filter: PlanetSideGUID
def reply: EventResponse
}
trait GenericMessageEnvelope {
def channel: String
def exclude: PlanetSideGUID
def filter: PlanetSideGUID
def msg: EventMessage
def response(outChannel: String): GenericResponseEnvelope
}
abstract class GenericEventService[IN <: GenericMessageEnvelope, OUT <: GenericResponseEnvelope](busName: String)
abstract class GenericEventService[OUT <: GenericResponseEnvelope](busName: String)
extends Actor {
protected lazy val log: Logger = org.log4s.getLogger(getClass.getSimpleName)
protected val eventBus = new GenericEventBus[OUT]
def BusName: String = busName
def commonJoinBehavior: Receive = {
case Service.Join(channel) =>
val path = formatChannelOnBusName(channel, busName)
val path = formatChannelOnBusName(channel)
val who = sender()
eventBus.subscribe(who, path)
}
@ -37,7 +40,7 @@ abstract class GenericEventService[IN <: GenericMessageEnvelope, OUT <: GenericR
eventBus.unsubscribe(sender())
case Service.Leave(Some(channel)) =>
val path = formatChannelOnBusName(channel, busName)
val path = formatChannelOnBusName(channel)
eventBus.unsubscribe(sender(), path)
case Service.LeaveAll() =>
@ -47,22 +50,24 @@ abstract class GenericEventService[IN <: GenericMessageEnvelope, OUT <: GenericR
def receive: Receive =
commonJoinBehavior.orElse(commonLeaveBehavior)
.orElse {
case msg: IN =>
compose(msg)
case msg: GenericMessageEnvelope =>
handleMessage(msg)
case msg => ()
log.warn(s"Unhandled message $msg from ${sender()}")
}
protected def compose(msg: GenericMessageEnvelope): Unit = {
eventBus.publish(msg.response(formatChannelOnBusName(msg.channel, busName)).asInstanceOf[OUT])
protected def handleMessage(msg: GenericMessageEnvelope): Unit = {
eventBus.publish(compose(msg))
}
def formatChannelOnBusName: (String, String) => String = GenericEventService.BusOnChannelFormat
protected def compose(@unused msg: GenericMessageEnvelope): OUT
def formatChannelOnBusName(channel: String): String = GenericEventService.BusOnChannelFormat(busName)(channel)
}
object GenericEventService {
final def BusOnChannelFormat(channel: String, busName: String): String = {
final def BusOnChannelFormat(busName: String)(channel: String): String = {
if (channel.trim.isEmpty) {
s"/$busName"
} else {

View file

@ -2,6 +2,8 @@
package net.psforever.services.base
import akka.actor.{ActorContext, ActorRef}
import net.psforever.services.Service
import net.psforever.types.PlanetSideGUID
import scala.annotation.unused
@ -12,15 +14,22 @@ trait EventServiceSupport {
trait GenericMessageToSupportEnvelope
extends GenericMessageEnvelope {
def toSupport: String
def response(outChannel: String): GenericResponseEnvelope = null
def supportLabel: String
def supportMessage: Any
}
abstract class GenericEventServiceWithSupport[IN <: GenericMessageEnvelope, OUT <: GenericResponseEnvelope]
trait GenericMessageToSupportEnvelopeOnly
extends GenericMessageToSupportEnvelope {
def channel: String = ""
def filter: PlanetSideGUID = Service.defaultPlayerGUID
def msg: EventMessage = null
}
abstract class GenericEventServiceWithSupport[OUT <: GenericResponseEnvelope]
(
busName: String,
eventSupportServices: List[EventServiceSupport]
) extends GenericEventService[IN, OUT](busName) {
) extends GenericEventService[OUT](busName) {
private val supportServices: Map[String, ActorRef] =
eventSupportServices
@ -28,24 +37,24 @@ abstract class GenericEventServiceWithSupport[IN <: GenericMessageEnvelope, OUT
.toMap[String, ActorRef]
private def supportReceive: Receive = {
case msg: GenericMessageToSupportEnvelopeOnly =>
forwardToSupport(msg)
case msg: GenericMessageToSupportEnvelope =>
forwardToSupport(msg)
handleMessage(msg)
}
override def receive: Receive = supportReceive.orElse(super.receive)
private def forwardToSupport(msg: GenericMessageToSupportEnvelope): Unit = {
supportServices
.get(msg.toSupport)
.get(msg.supportLabel)
.map { support =>
support.forward(msg)
support.forward(msg.supportMessage)
msg
}
.getOrElse {
log.error(s"support service ${msg.toSupport} was not found - check message routing or service params")
log.error(s"support service ${msg.supportLabel} was not found - check message routing or service params")
}
if (msg.response(outChannel = "") != null) {
compose(msg)
}
}
}

View file

@ -1,7 +1,11 @@
// Copyright (c) 2017-2026 PSForever
package net.psforever.services.galaxy
import net.psforever.services.base.GenericEventService
import net.psforever.services.base.{GenericEventService, GenericMessageEnvelope}
class GalaxyService
extends GenericEventService[GalaxyServiceMessage, GalaxyServiceResponse](busName = "Galaxy")
extends GenericEventService[GalaxyServiceResponse](busName = "Galaxy") {
protected def compose(msg: GenericMessageEnvelope): GalaxyServiceResponse = {
GalaxyServiceResponse(formatChannelOnBusName(msg.channel), msg.msg.response())
}
}

View file

@ -7,11 +7,7 @@ import net.psforever.types.PlanetSideGUID
final case class GalaxyServiceMessage(channel: String, msg: EventMessage)
extends GenericMessageEnvelope {
def exclude: PlanetSideGUID = Service.defaultPlayerGUID
def response(outChannel: String): GalaxyServiceResponse = {
GalaxyServiceResponse(outChannel, msg.response())
}
def filter: PlanetSideGUID = Service.defaultPlayerGUID
}
object GalaxyServiceMessage {

View file

@ -7,5 +7,5 @@ import net.psforever.services.base.{EventResponse, GenericResponseEnvelope}
final case class GalaxyServiceResponse(channel: String, reply: EventResponse)
extends GenericResponseEnvelope {
def exclude: PlanetSideGUID = Service.defaultPlayerGUID
def filter: PlanetSideGUID = Service.defaultPlayerGUID
}

View file

@ -115,7 +115,7 @@ class HackClearActor() extends Actor {
val building = target.asInstanceOf[Terminal].Owner.asInstanceOf[Building]
building.virusId = 8
building.virusInstalledBy = None
val msg = AvatarAction.GenericObjectAction(Service.defaultPlayerGUID, target.GUID, 60)
val msg = AvatarAction.GenericObjectAction(target.GUID, 60)
val events = building.Zone.AvatarEvents
building.PlayersInSOI.foreach { player =>
events ! AvatarServiceMessage(player.Name, msg)