From 474993a4e29b9e6de9af99ad912f052d8f769edd Mon Sep 17 00:00:00 2001 From: Resaec Date: Sun, 31 Aug 2025 23:38:52 +0200 Subject: [PATCH] keep outfit title colorization when receiving Rank action from client --- .../support/SessionOutfitHandlers.scala | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/main/scala/net/psforever/actors/session/support/SessionOutfitHandlers.scala b/src/main/scala/net/psforever/actors/session/support/SessionOutfitHandlers.scala index be3530ae9..d382da0be 100644 --- a/src/main/scala/net/psforever/actors/session/support/SessionOutfitHandlers.scala +++ b/src/main/scala/net/psforever/actors/session/support/SessionOutfitHandlers.scala @@ -818,17 +818,23 @@ object SessionOutfitHandlers { case _ => None } + // Colorize: prepend \ in front of # if it is the fist character + val colorized = normalized.map { + case Some(s) if s.startsWith("#") => Some("\\" + s) + case other => other + } + query[Outfit] .filter(_.id == lift(outfit_id)) .update( - _.rank0 -> lift(normalized(0)), - _.rank1 -> lift(normalized(1)), - _.rank2 -> lift(normalized(2)), - _.rank3 -> lift(normalized(3)), - _.rank4 -> lift(normalized(4)), - _.rank5 -> lift(normalized(5)), - _.rank6 -> lift(normalized(6)), - _.rank7 -> lift(normalized(7)) + _.rank0 -> lift(colorized(0)), + _.rank1 -> lift(colorized(1)), + _.rank2 -> lift(colorized(2)), + _.rank3 -> lift(colorized(3)), + _.rank4 -> lift(colorized(4)), + _.rank5 -> lift(colorized(5)), + _.rank6 -> lift(colorized(6)), + _.rank7 -> lift(colorized(7)) ) }