mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-01-20 02:54:46 +00:00
when transitioning between player modes, do not parse new messages about transitioning between player modes, until fully transitioned between player modes
This commit is contained in:
parent
9302c1beae
commit
ca6314fdba
|
|
@ -16,6 +16,7 @@ import net.psforever.packet.game.{ChatMsg, SetChatFilterMessage}
|
|||
import net.psforever.services.Service
|
||||
import net.psforever.services.avatar.{AvatarAction, AvatarServiceMessage}
|
||||
import net.psforever.services.chat.{ChatChannel, DefaultChannel, SpectatorChannel}
|
||||
import net.psforever.types.ChatMessageType.{CMT_TOGGLESPECTATORMODE, CMT_TOGGLE_GM}
|
||||
import net.psforever.types.{ChatMessageType, PlanetSideEmpire}
|
||||
|
||||
import scala.util.Success
|
||||
|
|
@ -27,6 +28,15 @@ object ChatLogic {
|
|||
}
|
||||
|
||||
class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) extends ChatFunctions {
|
||||
ops.transitoryCommandEntered match {
|
||||
case Some(CMT_TOGGLESPECTATORMODE) =>
|
||||
//we are transitioning down from csr spectator mode to normal mode, continue to block transitory messages
|
||||
()
|
||||
case _ =>
|
||||
//correct player mode
|
||||
ops.transitoryCommandEntered = None
|
||||
}
|
||||
|
||||
def sessionLogic: SessionData = ops.sessionLogic
|
||||
|
||||
ops.CurrentSpectatorMode = SpectateAsCustomerServiceRepresentativeMode
|
||||
|
|
@ -246,17 +256,29 @@ class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) ext
|
|||
private def customCommandModerator(contents: String): Boolean = {
|
||||
if (sessionLogic.zoning.maintainInitialGmState) {
|
||||
sessionLogic.zoning.maintainInitialGmState = false
|
||||
true
|
||||
} else {
|
||||
contents.toLowerCase() match {
|
||||
case "off" | "of" if player.spectator =>
|
||||
context.self ! SessionActor.SetMode(CustomerServiceRepresentativeMode)
|
||||
context.self ! SessionActor.SetMode(NormalMode)
|
||||
case "off" | "of" =>
|
||||
context.self ! SessionActor.SetMode(NormalMode)
|
||||
case _ => ()
|
||||
}
|
||||
ops.transitoryCommandEntered
|
||||
.collect {
|
||||
case CMT_TOGGLE_GM => true
|
||||
case CMT_TOGGLESPECTATORMODE => false
|
||||
}
|
||||
.getOrElse {
|
||||
contents.toLowerCase() match {
|
||||
case "off" | "of" if player.spectator =>
|
||||
ops.transitoryCommandEntered = Some(CMT_TOGGLESPECTATORMODE)
|
||||
context.self ! SessionActor.SetMode(CustomerServiceRepresentativeMode)
|
||||
context.self ! SessionActor.SetMode(NormalMode)
|
||||
true
|
||||
case "off" | "of" =>
|
||||
ops.transitoryCommandEntered = Some(CMT_TOGGLE_GM)
|
||||
context.self ! SessionActor.SetMode(NormalMode)
|
||||
true
|
||||
case _ =>
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
private def customCommandToggleSpectators(contents: Seq[String]): Boolean = {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import net.psforever.objects.Session
|
|||
import net.psforever.packet.game.{ChatMsg, ServerType, SetChatFilterMessage}
|
||||
import net.psforever.services.chat.DefaultChannel
|
||||
import net.psforever.types.ChatMessageType
|
||||
import net.psforever.types.ChatMessageType.{CMT_TOGGLESPECTATORMODE, CMT_TOGGLE_GM}
|
||||
import net.psforever.util.Config
|
||||
|
||||
object ChatLogic {
|
||||
|
|
@ -21,6 +22,7 @@ class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) ext
|
|||
def sessionLogic: SessionData = ops.sessionLogic
|
||||
|
||||
ops.CurrentSpectatorMode = SpectatorMode
|
||||
ops.transitoryCommandEntered = None
|
||||
|
||||
def handleChatMsg(message: ChatMsg): Unit = {
|
||||
import net.psforever.types.ChatMessageType._
|
||||
|
|
@ -154,16 +156,26 @@ class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) ext
|
|||
}
|
||||
}
|
||||
|
||||
def commandToggleSpectatorMode(contents: String): Unit = {
|
||||
val currentSpectatorActivation =
|
||||
avatar.permissions.canSpectate ||
|
||||
avatar.permissions.canGM ||
|
||||
Config.app.world.serverType == ServerType.Development
|
||||
contents.toLowerCase() match {
|
||||
case "on" | "o" | "" if currentSpectatorActivation && !player.spectator =>
|
||||
context.self ! SessionActor.SetMode(ops.CurrentSpectatorMode)
|
||||
case _ => ()
|
||||
}
|
||||
def commandToggleSpectatorMode(contents: String): Boolean = {
|
||||
ops.transitoryCommandEntered
|
||||
.collect {
|
||||
case CMT_TOGGLESPECTATORMODE => true
|
||||
case CMT_TOGGLE_GM => false
|
||||
}
|
||||
.getOrElse {
|
||||
val currentSpectatorActivation =
|
||||
avatar.permissions.canSpectate ||
|
||||
avatar.permissions.canGM ||
|
||||
Config.app.world.serverType == ServerType.Development
|
||||
contents.toLowerCase() match {
|
||||
case "on" | "o" | "" if currentSpectatorActivation && !player.spectator =>
|
||||
ops.transitoryCommandEntered = Some(CMT_TOGGLESPECTATORMODE)
|
||||
context.self ! SessionActor.SetMode(ops.CurrentSpectatorMode)
|
||||
true
|
||||
case _ =>
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def customCommandModerator(contents: String): Boolean = {
|
||||
|
|
@ -171,17 +183,25 @@ class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) ext
|
|||
sessionLogic.zoning.maintainInitialGmState = false
|
||||
true
|
||||
} else {
|
||||
val currentCsrActivation =
|
||||
avatar.permissions.canGM ||
|
||||
Config.app.world.serverType == ServerType.Development
|
||||
contents.toLowerCase() match {
|
||||
case "on" | "o" | "" if currentCsrActivation =>
|
||||
import net.psforever.actors.session.csr.CustomerServiceRepresentativeMode
|
||||
context.self ! SessionActor.SetMode(CustomerServiceRepresentativeMode)
|
||||
true
|
||||
case _ =>
|
||||
false
|
||||
}
|
||||
ops.transitoryCommandEntered
|
||||
.collect {
|
||||
case CMT_TOGGLE_GM => true
|
||||
case CMT_TOGGLESPECTATORMODE => false
|
||||
}
|
||||
.getOrElse {
|
||||
val currentCsrActivation =
|
||||
avatar.permissions.canGM ||
|
||||
Config.app.world.serverType == ServerType.Development
|
||||
contents.toLowerCase() match {
|
||||
case "on" | "o" | "" if currentCsrActivation =>
|
||||
import net.psforever.actors.session.csr.CustomerServiceRepresentativeMode
|
||||
ops.transitoryCommandEntered = Some(CMT_TOGGLE_GM)
|
||||
context.self ! SessionActor.SetMode(CustomerServiceRepresentativeMode)
|
||||
true
|
||||
case _ =>
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import net.psforever.objects.Session
|
|||
import net.psforever.packet.game.{ChatMsg, SetChatFilterMessage}
|
||||
import net.psforever.services.chat.SpectatorChannel
|
||||
import net.psforever.types.ChatMessageType
|
||||
import net.psforever.types.ChatMessageType.{CMT_TOGGLESPECTATORMODE, CMT_TOGGLE_GM}
|
||||
import net.psforever.zones.Zones
|
||||
|
||||
import scala.collection.Seq
|
||||
|
|
@ -20,6 +21,8 @@ object ChatLogic {
|
|||
}
|
||||
|
||||
class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) extends ChatFunctions {
|
||||
ops.transitoryCommandEntered = None
|
||||
|
||||
def sessionLogic: SessionData = ops.sessionLogic
|
||||
|
||||
def handleChatMsg(message: ChatMsg): Unit = {
|
||||
|
|
@ -147,11 +150,21 @@ class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) ext
|
|||
}
|
||||
}
|
||||
|
||||
private def commandToggleSpectatorMode(contents: String): Unit = {
|
||||
contents.toLowerCase() match {
|
||||
case "off" | "of" =>
|
||||
context.self ! SessionActor.SetMode(NormalMode)
|
||||
case _ => ()
|
||||
}
|
||||
private def commandToggleSpectatorMode(contents: String): Boolean = {
|
||||
ops.transitoryCommandEntered
|
||||
.collect {
|
||||
case CMT_TOGGLESPECTATORMODE => true
|
||||
case CMT_TOGGLE_GM => false
|
||||
}
|
||||
.getOrElse {
|
||||
contents.toLowerCase() match {
|
||||
case "off" | "of" =>
|
||||
ops.transitoryCommandEntered = Some(CMT_TOGGLESPECTATORMODE)
|
||||
context.self ! SessionActor.SetMode(NormalMode)
|
||||
true
|
||||
case _ =>
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ class ChatOperations(
|
|||
) extends CommonSessionInterfacingFunctionality {
|
||||
private var channels: List[ChatChannel] = List()
|
||||
private var silenceTimer: Cancellable = Default.Cancellable
|
||||
private[session] var transitoryCommandEntered: Option[ChatMessageType] = None
|
||||
/**
|
||||
* when another player is listed as one of our ignored players,
|
||||
* and that other player sends an emote,
|
||||
|
|
|
|||
Loading…
Reference in a new issue