Remove invalid icon tags from player titles.

This commit is contained in:
MobiusDevelopment 2024-08-20 00:16:40 +03:00
parent fe8ef3edff
commit 0b8567e662
4 changed files with 72 additions and 4 deletions

View File

@ -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<number>} 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;
}
}
}

View File

@ -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<number>} 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;
}
}
}

View File

@ -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<number>} 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;
}
}
}

View File

@ -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<number>} 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;
}
}
}