Skip to content

Commit

Permalink
Use new mention line prefix instead of asterisks around mention when …
Browse files Browse the repository at this point in the history
…textcolor is overridden
  • Loading branch information
ZarothYe committed May 26, 2022
1 parent 2b539e8 commit 139b571
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Scripts/Python/ki/xKIChat.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ def AddChatLine(self, player, message, cFlags, forceKI=True):
contextPrefix = PtGetLocalizedString("KI.Chat.SubtitleContextPrefix")
if player is not None:
# add subtitle speaker's name if it was provided
# add leading space to match indent for broadcast player messages
# add any leading pretext to match broadcast player messages
pretext = f"{PtGetLocalizedString('KI.Chat.BroadcastMsgRecvd')}{player}"
player = None

Expand Down Expand Up @@ -509,6 +509,7 @@ def AddChatLine(self, player, message, cFlags, forceKI=True):
# Are we mentioned in the message?
elif self._chatMentionRegex.search(message) is not None:
hasMention = True
contextPrefix = PtGetLocalizedString("KI.Chat.MentionContextPrefix")
PtFlashWindow()

# Is it a ccr broadcast?
Expand Down Expand Up @@ -555,6 +556,7 @@ def AddChatLine(self, player, message, cFlags, forceKI=True):
# Are we mentioned in the message?
if self._chatMentionRegex.search(message) is not None:
hasMention = True
contextPrefix = PtGetLocalizedString("KI.Chat.MentionContextPrefix")
forceKI = True
PtFlashWindow()

Expand Down Expand Up @@ -588,7 +590,7 @@ def AddChatLine(self, player, message, cFlags, forceKI=True):
contextPrefix = PtGetLocalizedString("KI.Chat.SubtitleContextPrefix")
if player is not None:
# add subtitle speaker's name if it was provided
# add leading space to match indent for broadcast player messages
# add any leading pretext to match broadcast player messages
pretext = f"{PtGetLocalizedString('KI.Chat.BroadcastMsgRecvd')}{player}"
player = None
else:
Expand Down Expand Up @@ -643,7 +645,7 @@ def AddChatLine(self, player, message, cFlags, forceKI=True):
lastInsert = end

chatArea.insertColor(mentionColor)
chatArea.insertStringW(f"{'*' if self.chatTextColor else ''}{mention}{'*' if self.chatTextColor else ''}", censorLevel=censorLevel, urlDetection=False)
chatArea.insertStringW(mention, censorLevel=censorLevel, urlDetection=False)
chatArea.insertColor(bodyColor)

# If there is remaining text to display after last mention, write it
Expand Down

0 comments on commit 139b571

Please sign in to comment.