mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-07-16 08:55:18 +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
4 changed files with 92 additions and 36 deletions
|
|
@ -16,6 +16,7 @@ import net.psforever.packet.game.{ChatMsg, SetChatFilterMessage}
|
||||||
import net.psforever.services.Service
|
import net.psforever.services.Service
|
||||||
import net.psforever.services.avatar.{AvatarAction, AvatarServiceMessage}
|
import net.psforever.services.avatar.{AvatarAction, AvatarServiceMessage}
|
||||||
import net.psforever.services.chat.{ChatChannel, DefaultChannel, SpectatorChannel}
|
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 net.psforever.types.{ChatMessageType, PlanetSideEmpire}
|
||||||
|
|
||||||
import scala.util.Success
|
import scala.util.Success
|
||||||
|
|
@ -27,6 +28,15 @@ object ChatLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) extends ChatFunctions {
|
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
|
def sessionLogic: SessionData = ops.sessionLogic
|
||||||
|
|
||||||
ops.CurrentSpectatorMode = SpectateAsCustomerServiceRepresentativeMode
|
ops.CurrentSpectatorMode = SpectateAsCustomerServiceRepresentativeMode
|
||||||
|
|
@ -246,17 +256,29 @@ class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) ext
|
||||||
private def customCommandModerator(contents: String): Boolean = {
|
private def customCommandModerator(contents: String): Boolean = {
|
||||||
if (sessionLogic.zoning.maintainInitialGmState) {
|
if (sessionLogic.zoning.maintainInitialGmState) {
|
||||||
sessionLogic.zoning.maintainInitialGmState = false
|
sessionLogic.zoning.maintainInitialGmState = false
|
||||||
|
true
|
||||||
} else {
|
} else {
|
||||||
contents.toLowerCase() match {
|
ops.transitoryCommandEntered
|
||||||
case "off" | "of" if player.spectator =>
|
.collect {
|
||||||
context.self ! SessionActor.SetMode(CustomerServiceRepresentativeMode)
|
case CMT_TOGGLE_GM => true
|
||||||
context.self ! SessionActor.SetMode(NormalMode)
|
case CMT_TOGGLESPECTATORMODE => false
|
||||||
case "off" | "of" =>
|
}
|
||||||
context.self ! SessionActor.SetMode(NormalMode)
|
.getOrElse {
|
||||||
case _ => ()
|
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 = {
|
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.packet.game.{ChatMsg, ServerType, SetChatFilterMessage}
|
||||||
import net.psforever.services.chat.DefaultChannel
|
import net.psforever.services.chat.DefaultChannel
|
||||||
import net.psforever.types.ChatMessageType
|
import net.psforever.types.ChatMessageType
|
||||||
|
import net.psforever.types.ChatMessageType.{CMT_TOGGLESPECTATORMODE, CMT_TOGGLE_GM}
|
||||||
import net.psforever.util.Config
|
import net.psforever.util.Config
|
||||||
|
|
||||||
object ChatLogic {
|
object ChatLogic {
|
||||||
|
|
@ -21,6 +22,7 @@ class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) ext
|
||||||
def sessionLogic: SessionData = ops.sessionLogic
|
def sessionLogic: SessionData = ops.sessionLogic
|
||||||
|
|
||||||
ops.CurrentSpectatorMode = SpectatorMode
|
ops.CurrentSpectatorMode = SpectatorMode
|
||||||
|
ops.transitoryCommandEntered = None
|
||||||
|
|
||||||
def handleChatMsg(message: ChatMsg): Unit = {
|
def handleChatMsg(message: ChatMsg): Unit = {
|
||||||
import net.psforever.types.ChatMessageType._
|
import net.psforever.types.ChatMessageType._
|
||||||
|
|
@ -154,16 +156,26 @@ class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) ext
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def commandToggleSpectatorMode(contents: String): Unit = {
|
def commandToggleSpectatorMode(contents: String): Boolean = {
|
||||||
val currentSpectatorActivation =
|
ops.transitoryCommandEntered
|
||||||
avatar.permissions.canSpectate ||
|
.collect {
|
||||||
avatar.permissions.canGM ||
|
case CMT_TOGGLESPECTATORMODE => true
|
||||||
Config.app.world.serverType == ServerType.Development
|
case CMT_TOGGLE_GM => false
|
||||||
contents.toLowerCase() match {
|
}
|
||||||
case "on" | "o" | "" if currentSpectatorActivation && !player.spectator =>
|
.getOrElse {
|
||||||
context.self ! SessionActor.SetMode(ops.CurrentSpectatorMode)
|
val currentSpectatorActivation =
|
||||||
case _ => ()
|
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 = {
|
def customCommandModerator(contents: String): Boolean = {
|
||||||
|
|
@ -171,17 +183,25 @@ class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) ext
|
||||||
sessionLogic.zoning.maintainInitialGmState = false
|
sessionLogic.zoning.maintainInitialGmState = false
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
val currentCsrActivation =
|
ops.transitoryCommandEntered
|
||||||
avatar.permissions.canGM ||
|
.collect {
|
||||||
Config.app.world.serverType == ServerType.Development
|
case CMT_TOGGLE_GM => true
|
||||||
contents.toLowerCase() match {
|
case CMT_TOGGLESPECTATORMODE => false
|
||||||
case "on" | "o" | "" if currentCsrActivation =>
|
}
|
||||||
import net.psforever.actors.session.csr.CustomerServiceRepresentativeMode
|
.getOrElse {
|
||||||
context.self ! SessionActor.SetMode(CustomerServiceRepresentativeMode)
|
val currentCsrActivation =
|
||||||
true
|
avatar.permissions.canGM ||
|
||||||
case _ =>
|
Config.app.world.serverType == ServerType.Development
|
||||||
false
|
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.packet.game.{ChatMsg, SetChatFilterMessage}
|
||||||
import net.psforever.services.chat.SpectatorChannel
|
import net.psforever.services.chat.SpectatorChannel
|
||||||
import net.psforever.types.ChatMessageType
|
import net.psforever.types.ChatMessageType
|
||||||
|
import net.psforever.types.ChatMessageType.{CMT_TOGGLESPECTATORMODE, CMT_TOGGLE_GM}
|
||||||
import net.psforever.zones.Zones
|
import net.psforever.zones.Zones
|
||||||
|
|
||||||
import scala.collection.Seq
|
import scala.collection.Seq
|
||||||
|
|
@ -20,6 +21,8 @@ object ChatLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) extends ChatFunctions {
|
class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) extends ChatFunctions {
|
||||||
|
ops.transitoryCommandEntered = None
|
||||||
|
|
||||||
def sessionLogic: SessionData = ops.sessionLogic
|
def sessionLogic: SessionData = ops.sessionLogic
|
||||||
|
|
||||||
def handleChatMsg(message: ChatMsg): Unit = {
|
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 = {
|
private def commandToggleSpectatorMode(contents: String): Boolean = {
|
||||||
contents.toLowerCase() match {
|
ops.transitoryCommandEntered
|
||||||
case "off" | "of" =>
|
.collect {
|
||||||
context.self ! SessionActor.SetMode(NormalMode)
|
case CMT_TOGGLESPECTATORMODE => true
|
||||||
case _ => ()
|
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 {
|
) extends CommonSessionInterfacingFunctionality {
|
||||||
private var channels: List[ChatChannel] = List()
|
private var channels: List[ChatChannel] = List()
|
||||||
private var silenceTimer: Cancellable = Default.Cancellable
|
private var silenceTimer: Cancellable = Default.Cancellable
|
||||||
|
private[session] var transitoryCommandEntered: Option[ChatMessageType] = None
|
||||||
/**
|
/**
|
||||||
* when another player is listed as one of our ignored players,
|
* when another player is listed as one of our ignored players,
|
||||||
* and that other player sends an emote,
|
* and that other player sends an emote,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue