mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-01-19 18:44:45 +00:00
we both got in each others's ways; still respect the ignored players list (#1051)
This commit is contained in:
parent
082d58108f
commit
fdcce870d9
|
|
@ -539,7 +539,8 @@ object AvatarActor {
|
|||
* `false`, otherwise
|
||||
*/
|
||||
def onlineIfNotIgnored(onlinePlayerName: String, observerName: String): Boolean = {
|
||||
LivePlayerList.WorldPopulation({ case (_, a) => a.name.equals(onlinePlayerName) }).headOption match {
|
||||
val onlinePlayerNameLower = onlinePlayerName.toLowerCase()
|
||||
LivePlayerList.WorldPopulation({ case (_, a) => a.name.toLowerCase().equals(onlinePlayerNameLower) }).headOption match {
|
||||
case Some(onlinePlayer) => onlineIfNotIgnored(onlinePlayer, observerName)
|
||||
case _ => false
|
||||
}
|
||||
|
|
@ -582,7 +583,8 @@ object AvatarActor {
|
|||
* `false`, otherwise
|
||||
*/
|
||||
def onlineIfNotIgnored(onlinePlayer: Avatar, observedName: String): Boolean = {
|
||||
!onlinePlayer.people.ignored.exists { f => f.name.equals(observedName) }
|
||||
val observedNameLower = observedName.toLowerCase()
|
||||
!onlinePlayer.people.ignored.exists { f => f.name.toLowerCase().equals(observedNameLower) }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -72,25 +72,40 @@ class ChatService(context: ActorContext[ChatService.Command]) extends AbstractBe
|
|||
}
|
||||
val subs = subscriptions.filter(_.channel == channel)
|
||||
message.messageType match {
|
||||
case CMT_TELL | CMT_GMTELL =>
|
||||
subs.find(_.session.player.Name == session.player.Name).foreach {
|
||||
case JoinChannel(sender, _, _) =>
|
||||
case mtype @ (CMT_TELL | CMT_GMTELL) =>
|
||||
val playerName = session.player.Name
|
||||
val playerNameLower = playerName.toLowerCase()
|
||||
val recipientName = message.recipient
|
||||
val recipientNameLower = recipientName.toLowerCase()
|
||||
(
|
||||
subs.find(_.session.player.Name.toLowerCase().equals(playerNameLower)),
|
||||
subs.find(_.session.player.Name.toLowerCase().equals(recipientNameLower))
|
||||
) match {
|
||||
case (Some(JoinChannel(sender, _, _)), Some(JoinChannel(receiver, _, _))) =>
|
||||
val replyType = if (mtype == CMT_TELL) { U_CMT_TELLFROM } else { U_CMT_GMTELLFROM }
|
||||
sender ! MessageResponse(
|
||||
session,
|
||||
message.copy(messageType = if (message.messageType == CMT_TELL) U_CMT_TELLFROM else U_CMT_GMTELLFROM),
|
||||
message.copy(messageType = replyType),
|
||||
channel
|
||||
)
|
||||
subs.find(_.session.player.Name.toLowerCase() == message.recipient.toLowerCase()) match {
|
||||
case Some(JoinChannel(receiver, _, _)) =>
|
||||
receiver ! MessageResponse(session, message.copy(recipient = session.player.Name), channel)
|
||||
case None =>
|
||||
sender ! MessageResponse(
|
||||
session,
|
||||
ChatMsg(ChatMessageType.UNK_45, wideContents = false, "", "@NoTell_Target", None),
|
||||
channel
|
||||
)
|
||||
}
|
||||
|
||||
receiver ! MessageResponse(session, message.copy(recipient = playerName), channel)
|
||||
case (None, Some(JoinChannel(receiver, _, _))) =>
|
||||
log.warn(s"ChatMsg->$mtype: can not find subscription object for: sender=$playerName")
|
||||
receiver ! MessageResponse(session, message.copy(recipient = playerName), channel)
|
||||
case (Some(JoinChannel(sender, _, _)), None) =>
|
||||
val replyType = if (mtype == CMT_TELL) { U_CMT_TELLFROM } else { U_CMT_GMTELLFROM }
|
||||
sender ! MessageResponse(
|
||||
session,
|
||||
message.copy(messageType = replyType),
|
||||
channel
|
||||
)
|
||||
sender ! MessageResponse(
|
||||
session,
|
||||
ChatMsg(ChatMessageType.UNK_45, wideContents = false, "", "@NoTell_Target", None),
|
||||
channel
|
||||
)
|
||||
case (None, None) =>
|
||||
log.error(s"ChatMsg->$mtype: can not find subscription object for: sender=$playerName")
|
||||
}
|
||||
|
||||
case CMT_SILENCE =>
|
||||
|
|
@ -117,13 +132,13 @@ class ChatService(context: ActorContext[ChatService.Command]) extends AbstractBe
|
|||
if (recipient.session.player.silenced) {
|
||||
sender.actor ! MessageResponse(
|
||||
session,
|
||||
ChatMsg(UNK_229, true, "", "@silence_disabled_ack", None),
|
||||
ChatMsg(UNK_229, wideContents = true, "", "@silence_disabled_ack", None),
|
||||
channel
|
||||
)
|
||||
} else {
|
||||
sender.actor ! MessageResponse(
|
||||
session,
|
||||
ChatMsg(UNK_229, true, "", "@silence_enabled_ack", None),
|
||||
ChatMsg(UNK_229, wideContents = true, "", "@silence_enabled_ack", None),
|
||||
channel
|
||||
)
|
||||
}
|
||||
|
|
@ -131,14 +146,14 @@ class ChatService(context: ActorContext[ChatService.Command]) extends AbstractBe
|
|||
case None =>
|
||||
sender.actor ! MessageResponse(
|
||||
session,
|
||||
ChatMsg(UNK_229, true, "", s"unknown player '$name'", None),
|
||||
ChatMsg(UNK_229, wideContents = true, "", s"unknown player '$name'", None),
|
||||
channel
|
||||
)
|
||||
}
|
||||
case (Some(sender), _, _, error) =>
|
||||
sender.actor ! MessageResponse(
|
||||
session,
|
||||
ChatMsg(UNK_229, false, "", error.getOrElse("usage: /silence <name> [<time>]"), None),
|
||||
ChatMsg(UNK_229, wideContents = false, "", error.getOrElse("usage: /silence <name> [<time>]"), None),
|
||||
channel
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue