mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-01-19 18:44:45 +00:00
squad kill experience
This commit is contained in:
parent
a758911a26
commit
6597e8be32
|
|
@ -3039,6 +3039,8 @@ class AvatarActor(
|
|||
if (exp > 0L) {
|
||||
setBep(avatar.bep + exp, msg)
|
||||
zone.actor ! ZoneActor.RewardOurSupporters(playerSource, historyTranscript, killStat, exp)
|
||||
zone.AvatarEvents ! AvatarServiceMessage(
|
||||
player.Name, AvatarAction.ShareKillExperienceWithSquad(player, exp))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -473,6 +473,9 @@ class AvatarHandlerLogic(val ops: SessionAvatarHandlers, implicit val context: A
|
|||
case AvatarResponse.FacilityCaptureRewards(buildingId, zoneNumber, cep) =>
|
||||
ops.facilityCaptureRewards(buildingId, zoneNumber, cep)
|
||||
|
||||
case AvatarResponse.ShareKillExperienceWithSquad(killer, exp) =>
|
||||
ops.shareKillExperienceWithSquad(killer, exp)
|
||||
|
||||
case AvatarResponse.SendResponse(msg) =>
|
||||
sendResponse(msg)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package net.psforever.actors.session.support
|
|||
|
||||
import akka.actor.{ActorContext, typed}
|
||||
import net.psforever.objects.serverobject.mount.Mountable
|
||||
import net.psforever.objects.{Default, PlanetSideGameObject}
|
||||
import net.psforever.objects.{Default, PlanetSideGameObject, Player}
|
||||
import net.psforever.objects.sourcing.{PlayerSource, SourceEntry}
|
||||
import net.psforever.packet.game.objectcreate.ConstructorData
|
||||
import net.psforever.objects.zones.exp
|
||||
|
|
@ -123,6 +123,31 @@ class SessionAvatarHandlers(
|
|||
avatarActor ! AvatarActor.AwardFacilityCaptureBep(cep)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param killer the player who got the kill
|
||||
* @param exp the amount of bep they received for the kill
|
||||
* Squad members of a "killer" will receive a split of the experience if they are both alive
|
||||
* and in the same zone as the killer. The amount received is
|
||||
* based on the size of the squad. Each squad member that meets the criteria will receive a fractional split.
|
||||
*/
|
||||
def shareKillExperienceWithSquad(killer: Player, exp: Long): Unit = {
|
||||
//TODO consider squad experience waypoint in exp calculation
|
||||
val squadUI = sessionLogic.squad.squadUI
|
||||
val squadSize = squadUI.size
|
||||
if (squadSize > 1) {
|
||||
val expSplit = exp / squadSize
|
||||
val squadMembers = squadUI.filterNot(_._1 == killer.CharId).map { case (_, member) => member }.toList.map(_.name)
|
||||
val playersInZone = killer.Zone.Players.map { avatar => (avatar.id, avatar.basic.name) }
|
||||
val squadMembersHere = playersInZone.filter(member => squadMembers.contains(member._2))
|
||||
squadMembersHere.foreach { member =>
|
||||
killer.Zone.AvatarEvents ! AvatarServiceMessage(
|
||||
member._2,
|
||||
AvatarAction.AwardBep(member._1, expSplit, ExperienceType.Normal))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Properly format a `DestroyDisplayMessage` packet
|
||||
* given sufficient information about a target (victim) and an actor (killer).
|
||||
|
|
|
|||
|
|
@ -458,6 +458,15 @@ class AvatarService(zone: Zone) extends Actor {
|
|||
)
|
||||
)
|
||||
|
||||
case AvatarAction.ShareKillExperienceWithSquad(killer, exp) =>
|
||||
AvatarEvents.publish(
|
||||
AvatarServiceResponse(
|
||||
s"/$forChannel/Avatar",
|
||||
Service.defaultPlayerGUID,
|
||||
AvatarResponse.ShareKillExperienceWithSquad(killer, exp)
|
||||
)
|
||||
)
|
||||
|
||||
case _ => ()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -160,6 +160,7 @@ object AvatarAction {
|
|||
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 TeardownConnection() extends Action
|
||||
// final case class PlayerStateShift(killer : PlanetSideGUID, victim : PlanetSideGUID) extends Action
|
||||
|
|
|
|||
|
|
@ -132,4 +132,5 @@ object AvatarResponse {
|
|||
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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue