From 0b8567e6628472e040730fc2f3274fa3da593e40 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment Date: Tue, 20 Aug 2024 00:16:40 +0300 Subject: [PATCH] Remove invalid icon tags from player titles. --- .../gameserver/model/actor/Creature.java | 19 ++++++++++++++++++- .../gameserver/model/actor/Creature.java | 19 ++++++++++++++++++- .../gameserver/model/actor/Creature.java | 19 ++++++++++++++++++- .../gameserver/model/actor/Creature.java | 19 ++++++++++++++++++- 4 files changed, 72 insertions(+), 4 deletions(-) diff --git a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/model/actor/Creature.java index ec056d9695..ef3d06788a 100644 --- a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -2575,7 +2575,24 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe } else { - _title = isPlayer() && (value.length() > 21) ? value.substring(0, 20) : value; + if (isPlayer()) + { + // Remove all {i} where the number is not in the range 0-34. + final String title = value.replaceAll("\\{i-(\\d+)|\\{i(3[5-9]|[4-9]\\d*)\\}", ""); + + if (title.length() > 21) + { + _title = title.substring(0, 20); + } + else + { + _title = title; + } + } + else + { + _title = value; + } } } diff --git a/L2J_Mobius_Essence_7.1_Assassin/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Essence_7.1_Assassin/java/org/l2jmobius/gameserver/model/actor/Creature.java index 2b061c8547..464587a562 100644 --- a/L2J_Mobius_Essence_7.1_Assassin/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Essence_7.1_Assassin/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -2586,7 +2586,24 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe } else { - _title = isPlayer() && (value.length() > 21) ? value.substring(0, 20) : value; + if (isPlayer()) + { + // Remove all {i} where the number is not in the range 0-34. + final String title = value.replaceAll("\\{i-(\\d+)|\\{i(3[5-9]|[4-9]\\d*)\\}", ""); + + if (title.length() > 21) + { + _title = title.substring(0, 20); + } + else + { + _title = title; + } + } + else + { + _title = value; + } } } diff --git a/L2J_Mobius_Essence_7.2_AztacansTemple/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Essence_7.2_AztacansTemple/java/org/l2jmobius/gameserver/model/actor/Creature.java index 31984a656e..51a5f1f30f 100644 --- a/L2J_Mobius_Essence_7.2_AztacansTemple/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Essence_7.2_AztacansTemple/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -2586,7 +2586,24 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe } else { - _title = isPlayer() && (value.length() > 21) ? value.substring(0, 20) : value; + if (isPlayer()) + { + // Remove all {i} where the number is not in the range 0-34. + final String title = value.replaceAll("\\{i-(\\d+)|\\{i(3[5-9]|[4-9]\\d*)\\}", ""); + + if (title.length() > 21) + { + _title = title.substring(0, 20); + } + else + { + _title = title; + } + } + else + { + _title = value; + } } } diff --git a/L2J_Mobius_Essence_7.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Essence_7.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java index 31984a656e..51a5f1f30f 100644 --- a/L2J_Mobius_Essence_7.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Essence_7.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -2586,7 +2586,24 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe } else { - _title = isPlayer() && (value.length() > 21) ? value.substring(0, 20) : value; + if (isPlayer()) + { + // Remove all {i} where the number is not in the range 0-34. + final String title = value.replaceAll("\\{i-(\\d+)|\\{i(3[5-9]|[4-9]\\d*)\\}", ""); + + if (title.length() > 21) + { + _title = title.substring(0, 20); + } + else + { + _title = title; + } + } + else + { + _title = value; + } } }