diff --git a/common/src/main/scala/net/psforever/objects/teamwork/SquadFeatures.scala b/common/src/main/scala/net/psforever/objects/teamwork/SquadFeatures.scala
index a374f0ab..29b3ad78 100644
--- a/common/src/main/scala/net/psforever/objects/teamwork/SquadFeatures.scala
+++ b/common/src/main/scala/net/psforever/objects/teamwork/SquadFeatures.scala
@@ -15,7 +15,7 @@ class SquadFeatures(val Squad : Squad) {
* Dispatched only once when a squad is first listed
* or when the squad leader searches for recruits by proximity or for certain roles or by invite
* or when a spontaneous squad forms,
- * whichever happens first.
+ * whatever happens first.
* Additionally, the packets are also sent when the check is made when the continent is changed (or set).
*/
private var initialAssociation : Boolean = true
@@ -151,4 +151,4 @@ class SquadFeatures(val Squad : Squad) {
}
Prompt
}
-}
\ No newline at end of file
+}
diff --git a/common/src/main/scala/net/psforever/packet/game/PlanetsideAttributeMessage.scala b/common/src/main/scala/net/psforever/packet/game/PlanetsideAttributeMessage.scala
index ac4b49ff..4c33eab1 100644
--- a/common/src/main/scala/net/psforever/packet/game/PlanetsideAttributeMessage.scala
+++ b/common/src/main/scala/net/psforever/packet/game/PlanetsideAttributeMessage.scala
@@ -122,7 +122,8 @@ import scodec.codecs._
* ` - 0 is LFS`
* ` - 1 is LFSM (Looking for Squad Members)`
* ` - n is the supplemental squad identifier number; same as "LFS;" for the leader, sets "LFSM" after the first manual flagging`
- * `32 - Info under avatar name : 0 = Looking For Squad Members, 1 = LFS`
+ * `32 - Maintain the squad role index, when a member of a squad;
+ * - OLD: "Info under avatar name : 0 = Looking For Squad Members, 1 = LFS`"
* `35 - BR. Value is the BR`
* `36 - CR. Value is the CR`
* `43 - Info on avatar name : 0 = Nothing, 1 = "(LD)" message`
diff --git a/common/src/main/scala/services/teamwork/SquadResponse.scala b/common/src/main/scala/services/teamwork/SquadResponse.scala
index 3ad55b6c..1b3ae6fb 100644
--- a/common/src/main/scala/services/teamwork/SquadResponse.scala
+++ b/common/src/main/scala/services/teamwork/SquadResponse.scala
@@ -18,7 +18,6 @@ object SquadResponse {
final case class SetListSquad(squad_guid : PlanetSideGUID) extends Response
final case class Membership(request_type : SquadResponseType.Value, unk1 : Int, unk2 : Int, unk3 : Long, unk4 : Option[Long], player_name : String, unk5 : Boolean, unk6 : Option[Option[String]]) extends Response //see SquadMembershipResponse
- final case class Invite(from_char_id : Long, to_char_id : Long, name : String) extends Response
final case class WantsSquadPosition(leader_char_id : Long, bid_name : String) extends Response
final case class Join(squad : Squad, positionsToUpdate : List[Int], channel : String) extends Response
final case class Leave(squad : Squad, positionsToUpdate : List[(Long, Int)]) extends Response
diff --git a/common/src/main/scala/services/teamwork/SquadService.scala b/common/src/main/scala/services/teamwork/SquadService.scala
index 11f4eaa5..a678742d 100644
--- a/common/src/main/scala/services/teamwork/SquadService.scala
+++ b/common/src/main/scala/services/teamwork/SquadService.scala
@@ -2240,7 +2240,13 @@ class SquadService extends Actor {
val toChannel = s"/${features.ToChannel}/Squad"
memberCharIds.foreach { charId =>
SquadEvents.subscribe(UserEvents(charId), toChannel)
- Publish(charId, SquadResponse.Join(squad, indices, toChannel))
+ Publish(charId,
+ SquadResponse.Join(
+ squad,
+ indices.filterNot(_ == position) :+ position,
+ toChannel
+ )
+ )
InitWaypoints(charId, squad.GUID)
}
//fully update for all users
@@ -2255,7 +2261,11 @@ class SquadService extends Actor {
charId,
SquadResponse.Join(
squad,
- squad.Membership.zipWithIndex.collect({ case (member, index) if member.CharId > 0 => index }).toList,
+ squad.Membership
+ .zipWithIndex
+ .collect({ case (member, index) if member.CharId > 0 => index })
+ .filterNot(_== position)
+ .toList :+ position,
toChannel
)
)
@@ -2580,10 +2590,20 @@ class SquadService extends Actor {
}
}
+ /**
+ * na
+ * @param charId the player's unique character identifier number
+ * @param sender the `ActorRef` associated with this character
+ */
def LeaveService(charId : String, sender : ActorRef) : Unit = {
LeaveService(charId.toLong, sender)
}
+ /**
+ * na
+ * @param charId the player's unique character identifier number
+ * @param sender the `ActorRef` associated with this character
+ */
def LeaveService(charId : Long, sender : ActorRef) : Unit = {
refused.remove(charId)
continueToMonitorDetails.remove(charId)
@@ -2690,6 +2710,7 @@ class SquadService extends Actor {
//remove squad from listing
factionListings.remove(index)
//Publish(faction, SquadResponse.RemoveFromList(Seq(index)))
+ squadFeatures(squad.GUID).Refuse
Publish(faction, SquadResponse.InitList(PublishedLists(factionListings)))
}
case None =>
diff --git a/common/src/test/scala/game/objectcreatedetailed/DetailedCharacterDataTest.scala b/common/src/test/scala/game/objectcreatedetailed/DetailedCharacterDataTest.scala
index 34175c27..2843386d 100644
--- a/common/src/test/scala/game/objectcreatedetailed/DetailedCharacterDataTest.scala
+++ b/common/src/test/scala/game/objectcreatedetailed/DetailedCharacterDataTest.scala
@@ -1315,7 +1315,7 @@ class DetailedCharacterDataTest extends Specification {
a.data.v5.isEmpty mustEqual true
a.exosuit mustEqual ExoSuitType.Standard
a.unk5 mustEqual 0
- a.unk6 mustEqual 1267466L
+ a.char_id mustEqual 1267466L
a.unk7 mustEqual 3
a.unk8 mustEqual 3
a.unk9 mustEqual 0
diff --git a/pslogin/src/main/scala/WorldSessionActor.scala b/pslogin/src/main/scala/WorldSessionActor.scala
index b19f72bd..ce21779b 100644
--- a/pslogin/src/main/scala/WorldSessionActor.scala
+++ b/pslogin/src/main/scala/WorldSessionActor.scala
@@ -411,9 +411,6 @@ class WorldSessionActor extends Actor with MDCContextAware {
}
sendResponse(SquadMembershipResponse(request_type, unk1, unk2, char_id, opt_char_id, name, unk5, unk6))
- case SquadResponse.Invite(from_char_id, to_char_id, name) =>
- sendResponse(SquadMembershipResponse(SquadResponseType.Invite, 0, 0, from_char_id, Some(to_char_id), s"$name", false, Some(None)))
-
case SquadResponse.WantsSquadPosition(_, name) =>
sendResponse(
ChatMsg(
@@ -425,9 +422,7 @@ class WorldSessionActor extends Actor with MDCContextAware {
case SquadResponse.Join(squad, positionsToUpdate, toChannel) =>
val leader = squad.Leader
- val membershipPositions = squad.Membership
- .zipWithIndex
- .filter { case (_, index ) => positionsToUpdate.contains(index) }
+ val membershipPositions = positionsToUpdate map squad.Membership.zipWithIndex
StartBundlingPackets()
membershipPositions.find({ case(member, _) => member.CharId == avatar.CharId }) match {
case Some((ourMember, ourIndex)) =>
@@ -6592,7 +6587,7 @@ class WorldSessionActor extends Actor with MDCContextAware {
sendResponse(ObjectDetachMessage(tool.GUID, previousBox.GUID, Vector3.Zero, 0f))
sendResponse(ObjectDetachMessage(player.GUID, box.GUID, Vector3.Zero, 0f))
obj.Inventory -= x.start //remove replacement ammo from inventory
- val ammoSlotIndex = tool.FireMode.AmmoSlotIndex
+ val ammoSlotIndex = tool.FireMode.AmmoSlotIndex
tool.AmmoSlots(ammoSlotIndex).Box = box //put replacement ammo in tool
sendResponse(ObjectAttachMessage(tool.GUID, box.GUID, ammoSlotIndex))