mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-07-13 15:34:42 +00:00
stop player from inviting himself to own squad; periodic squad updates; fixed squad listing hangup; fixed damage calculation tests
This commit is contained in:
parent
0c105f3826
commit
aa2e0089a4
3 changed files with 26 additions and 11 deletions
|
|
@ -426,7 +426,7 @@ class SquadService extends Actor {
|
||||||
case None => None
|
case None => None
|
||||||
}
|
}
|
||||||
}) match {
|
}) match {
|
||||||
case Some(invitedPlayer) =>
|
case Some(invitedPlayer) if invitingPlayer != invitedPlayer =>
|
||||||
(memberToSquad.get(invitingPlayer), memberToSquad.get(invitedPlayer)) match {
|
(memberToSquad.get(invitingPlayer), memberToSquad.get(invitedPlayer)) match {
|
||||||
case (Some(squad1), Some(squad2)) if squad1.GUID == squad2.GUID =>
|
case (Some(squad1), Some(squad2)) if squad1.GUID == squad2.GUID =>
|
||||||
//both players are in the same squad; no need to do anything
|
//both players are in the same squad; no need to do anything
|
||||||
|
|
@ -519,7 +519,7 @@ class SquadService extends Actor {
|
||||||
|
|
||||||
case _ => ;
|
case _ => ;
|
||||||
}
|
}
|
||||||
case None => ;
|
case _ => ;
|
||||||
}
|
}
|
||||||
|
|
||||||
case SquadAction.Membership(SquadRequestType.ProximityInvite, invitingPlayer, _, _, _) =>
|
case SquadAction.Membership(SquadRequestType.ProximityInvite, invitingPlayer, _, _, _) =>
|
||||||
|
|
@ -760,7 +760,6 @@ class SquadService extends Actor {
|
||||||
}
|
}
|
||||||
}) match {
|
}) match {
|
||||||
case out @ Some(leavingPlayer) if GetParticipatingSquad(leavingPlayer).contains(squad) => //kicked player must be in the same squad
|
case out @ Some(leavingPlayer) if GetParticipatingSquad(leavingPlayer).contains(squad) => //kicked player must be in the same squad
|
||||||
log.info(s"leader=$leader, acting=$actingPlayer, leaving=$leavingPlayer")
|
|
||||||
if(actingPlayer == leader) {
|
if(actingPlayer == leader) {
|
||||||
if(leavingPlayer == leader || squad.Size == 2) {
|
if(leavingPlayer == leader || squad.Size == 2) {
|
||||||
//squad leader is leaving his own squad, so it will be disbanded
|
//squad leader is leaving his own squad, so it will be disbanded
|
||||||
|
|
@ -1254,11 +1253,15 @@ class SquadService extends Actor {
|
||||||
val features = squadFeatures(squad.GUID)
|
val features = squadFeatures(squad.GUID)
|
||||||
features.LocationFollowsSquadLead = true
|
features.LocationFollowsSquadLead = true
|
||||||
features.AutoApproveInvitationRequests = true
|
features.AutoApproveInvitationRequests = true
|
||||||
UpdateSquadListWhenListed(features, SquadInfo().Task("").ZoneId(None).Capacity(squad.Capacity))
|
if(features.Listed) {
|
||||||
|
//unlist the squad
|
||||||
|
features.Listed = false
|
||||||
|
Publish(features.ToChannel, SquadResponse.SetListSquad(PlanetSideGUID(0)))
|
||||||
|
UpdateSquadList(squad, None)
|
||||||
|
}
|
||||||
UpdateSquadDetail(squad)
|
UpdateSquadDetail(squad)
|
||||||
InitialAssociation(squad)
|
InitialAssociation(squad)
|
||||||
squadFeatures(guid).InitialAssociation = true
|
squadFeatures(guid).InitialAssociation = true
|
||||||
//do not unlist an already listed squad
|
|
||||||
case Some(squad) =>
|
case Some(squad) =>
|
||||||
//underutilized squad; just close it out
|
//underutilized squad; just close it out
|
||||||
CloseSquad(squad)
|
CloseSquad(squad)
|
||||||
|
|
@ -2159,7 +2162,7 @@ class SquadService extends Actor {
|
||||||
* The initial formation of a squad of two players is the most common expected situation.
|
* The initial formation of a squad of two players is the most common expected situation.
|
||||||
* While the underlying flag is normally only set once, its state can be reset and triggered anew if necessary.
|
* While the underlying flag is normally only set once, its state can be reset and triggered anew if necessary.
|
||||||
* @see `Publish`
|
* @see `Publish`
|
||||||
* @see `ResetAll`
|
* @see ``ResetAll
|
||||||
* @see `SquadResponse.AssociateWithSquad`
|
* @see `SquadResponse.AssociateWithSquad`
|
||||||
* @see `SquadResponse.Detail`
|
* @see `SquadResponse.Detail`
|
||||||
* @see `SquadService.Detail.Publish`
|
* @see `SquadService.Detail.Publish`
|
||||||
|
|
@ -2425,7 +2428,11 @@ class SquadService extends Actor {
|
||||||
.unzip
|
.unzip
|
||||||
val updateIndicesList = updateIndices.toList
|
val updateIndicesList = updateIndices.toList
|
||||||
val completelyBlankSquadDetail = SquadDetail().Complete
|
val completelyBlankSquadDetail = SquadDetail().Complete
|
||||||
val channel = s"/${squadFeatures(squad.GUID).ToChannel}/Squad"
|
val features = squadFeatures(guid)
|
||||||
|
val channel = s"/${features.ToChannel}/Squad"
|
||||||
|
if(features.Listed) {
|
||||||
|
Publish(squad.Leader.CharId, SquadResponse.SetListSquad(PlanetSideGUID(0)))
|
||||||
|
}
|
||||||
updateMembers
|
updateMembers
|
||||||
.foreach {
|
.foreach {
|
||||||
case (member, charId, _, None) =>
|
case (member, charId, _, None) =>
|
||||||
|
|
|
||||||
|
|
@ -70,11 +70,11 @@ class DamageCalculationsTests extends Specification {
|
||||||
}
|
}
|
||||||
|
|
||||||
"calculate distance between target and source" in {
|
"calculate distance between target and source" in {
|
||||||
DistanceBetweenTargetandSource(resprojectile) mustEqual 10
|
DistanceBetweenTargetandSource(resprojectile) mustEqual 67.38225f
|
||||||
}
|
}
|
||||||
|
|
||||||
"calculate distance between target and explosion (splash)" in {
|
"calculate distance between target and explosion (splash)" in {
|
||||||
DistanceFromExplosionToTarget(resprojectile) mustEqual 64.03124f
|
DistanceFromExplosionToTarget(resprojectile) mustEqual 63.031242f
|
||||||
}
|
}
|
||||||
|
|
||||||
"calculate no damage from components" in {
|
"calculate no damage from components" in {
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,8 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
var lfs : Boolean = false
|
var lfs : Boolean = false
|
||||||
var squadChannel : Option[String] = None
|
var squadChannel : Option[String] = None
|
||||||
var squadSetup : () => Unit = FirstTimeSquadSetup
|
var squadSetup : () => Unit = FirstTimeSquadSetup
|
||||||
|
var squadUpdateCounter : Int = 0
|
||||||
|
val queuedSquadActions : Seq[() => Unit] = Seq(SquadUpdates, NoSquadUpdates, NoSquadUpdates, NoSquadUpdates)
|
||||||
|
|
||||||
var amsSpawnPoints : List[SpawnPoint] = Nil
|
var amsSpawnPoints : List[SpawnPoint] = Nil
|
||||||
var clientKeepAlive : Cancellable = DefaultCancellable.obj
|
var clientKeepAlive : Cancellable = DefaultCancellable.obj
|
||||||
|
|
@ -450,7 +452,7 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
sendResponse(PlanetsideAttributeMessage(playerGuid, 32, ourIndex))
|
sendResponse(PlanetsideAttributeMessage(playerGuid, 32, ourIndex))
|
||||||
//a finalization? what does this do?
|
//a finalization? what does this do?
|
||||||
sendResponse(SquadDefinitionActionMessage(squad.GUID, 0, SquadAction.Unknown(18)))
|
sendResponse(SquadDefinitionActionMessage(squad.GUID, 0, SquadAction.Unknown(18)))
|
||||||
updateSquad = UpdatesWhenEnrolledInSquad
|
updateSquad = PeriodicUpdatesWhenEnrolledInSquad
|
||||||
squadChannel = Some(toChannel)
|
squadChannel = Some(toChannel)
|
||||||
case _ =>
|
case _ =>
|
||||||
//other player is joining our squad
|
//other player is joining our squad
|
||||||
|
|
@ -494,6 +496,7 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
//a finalization? what does this do?
|
//a finalization? what does this do?
|
||||||
sendResponse(SquadDefinitionActionMessage(PlanetSideGUID(0), 0, SquadAction.Unknown(18)))
|
sendResponse(SquadDefinitionActionMessage(PlanetSideGUID(0), 0, SquadAction.Unknown(18)))
|
||||||
squad_supplement_id = 0
|
squad_supplement_id = 0
|
||||||
|
squadUpdateCounter = 0
|
||||||
updateSquad = NoSquadUpdates
|
updateSquad = NoSquadUpdates
|
||||||
squadChannel = None
|
squadChannel = None
|
||||||
case _ =>
|
case _ =>
|
||||||
|
|
@ -9326,7 +9329,7 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
|
|
||||||
def NoSquadUpdates() : Unit = { }
|
def NoSquadUpdates() : Unit = { }
|
||||||
|
|
||||||
def UpdatesWhenEnrolledInSquad() : Unit = {
|
def SquadUpdates() : Unit = {
|
||||||
squadService ! SquadServiceMessage(
|
squadService ! SquadServiceMessage(
|
||||||
player,
|
player,
|
||||||
continent,
|
continent,
|
||||||
|
|
@ -9341,6 +9344,11 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def PeriodicUpdatesWhenEnrolledInSquad() : Unit = {
|
||||||
|
queuedSquadActions(squadUpdateCounter)()
|
||||||
|
squadUpdateCounter = (squadUpdateCounter + 1) % queuedSquadActions.length
|
||||||
|
}
|
||||||
|
|
||||||
def failWithError(error : String) = {
|
def failWithError(error : String) = {
|
||||||
log.error(error)
|
log.error(error)
|
||||||
sendResponse(ConnectionClose())
|
sendResponse(ConnectionClose())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue