Fix for nameplates sometimes disappearing when changing a player's title color when they have no title

This commit is contained in:
r00telement
2021-12-23 04:35:13 +00:00
parent 19720ae30d
commit 6f203ee81d
4 changed files with 26 additions and 10 deletions

View File

@@ -235,7 +235,9 @@ namespace PlayerTags.Features
{
if (customTag.TextColor.InheritedValue != null)
{
if (customTag.IsTextColorAppliedToChatName.InheritedValue != null && customTag.IsTextColorAppliedToChatName.InheritedValue.Value)
if (message.Payloads.Any(payload => payload is TextPayload)
&& customTag.IsTextColorAppliedToChatName.InheritedValue != null
&& customTag.IsTextColorAppliedToChatName.InheritedValue.Value)
{
int payloadIndex = message.Payloads.IndexOf(stringMatch.PreferredPayload);
message.Payloads.Insert(payloadIndex + 1, new UIForegroundPayload(0));
@@ -254,7 +256,9 @@ namespace PlayerTags.Features
{
if (jobTag.TextColor.InheritedValue != null)
{
if (jobTag.IsTextColorAppliedToChatName.InheritedValue != null && jobTag.IsTextColorAppliedToChatName.InheritedValue.Value)
if (message.Payloads.Any(payload => payload is TextPayload)
&& jobTag.IsTextColorAppliedToChatName.InheritedValue != null
&& jobTag.IsTextColorAppliedToChatName.InheritedValue.Value)
{
int payloadIndex = message.Payloads.IndexOf(stringMatch.PreferredPayload);
message.Payloads.Insert(payloadIndex + 1, new UIForegroundPayload(0));

View File

@@ -256,21 +256,27 @@ namespace PlayerTags.Features
{
if (customTag.TextColor.InheritedValue != null)
{
if (customTag.IsTextColorAppliedToNameplateName.InheritedValue != null && customTag.IsTextColorAppliedToNameplateName.InheritedValue.Value)
if (name.Payloads.Any(payload => payload is TextPayload)
&& customTag.IsTextColorAppliedToNameplateName.InheritedValue != null
&& customTag.IsTextColorAppliedToNameplateName.InheritedValue.Value)
{
name.Payloads.Insert(0, (new UIForegroundPayload(customTag.TextColor.InheritedValue.Value)));
name.Payloads.Add(new UIForegroundPayload(0));
isNameChanged = true;
}
if (customTag.IsTextColorAppliedToNameplateTitle.InheritedValue != null && customTag.IsTextColorAppliedToNameplateTitle.InheritedValue.Value)
if (title.Payloads.Any(payload => payload is TextPayload)
&& customTag.IsTextColorAppliedToNameplateTitle.InheritedValue != null
&& customTag.IsTextColorAppliedToNameplateTitle.InheritedValue.Value)
{
title.Payloads.Insert(0, (new UIForegroundPayload(customTag.TextColor.InheritedValue.Value)));
title.Payloads.Add(new UIForegroundPayload(0));
isTitleChanged = true;
}
if (customTag.IsTextColorAppliedToNameplateFreeCompany.InheritedValue != null && customTag.IsTextColorAppliedToNameplateFreeCompany.InheritedValue.Value)
if (freeCompany.Payloads.Any(payload => payload is TextPayload)
&& customTag.IsTextColorAppliedToNameplateFreeCompany.InheritedValue != null
&& customTag.IsTextColorAppliedToNameplateFreeCompany.InheritedValue.Value)
{
freeCompany.Payloads.Insert(0, (new UIForegroundPayload(customTag.TextColor.InheritedValue.Value)));
freeCompany.Payloads.Add(new UIForegroundPayload(0));
@@ -289,21 +295,27 @@ namespace PlayerTags.Features
{
if (jobTag.TextColor.InheritedValue != null)
{
if (jobTag.IsTextColorAppliedToNameplateName.InheritedValue != null && jobTag.IsTextColorAppliedToNameplateName.InheritedValue.Value)
if (name.Payloads.Any(payload => payload is TextPayload)
&& jobTag.IsTextColorAppliedToNameplateName.InheritedValue != null
&& jobTag.IsTextColorAppliedToNameplateName.InheritedValue.Value)
{
name.Payloads.Insert(0, (new UIForegroundPayload(jobTag.TextColor.InheritedValue.Value)));
name.Payloads.Add(new UIForegroundPayload(0));
isNameChanged = true;
}
if (jobTag.IsTextColorAppliedToNameplateTitle.InheritedValue != null && jobTag.IsTextColorAppliedToNameplateTitle.InheritedValue.Value)
if (title.Payloads.Any(payload => payload is TextPayload)
&& jobTag.IsTextColorAppliedToNameplateTitle.InheritedValue != null
&& jobTag.IsTextColorAppliedToNameplateTitle.InheritedValue.Value)
{
title.Payloads.Insert(0, (new UIForegroundPayload(jobTag.TextColor.InheritedValue.Value)));
title.Payloads.Add(new UIForegroundPayload(0));
isTitleChanged = true;
}
if (jobTag.IsTextColorAppliedToNameplateFreeCompany.InheritedValue != null && jobTag.IsTextColorAppliedToNameplateFreeCompany.InheritedValue.Value)
if (freeCompany.Payloads.Any(payload => payload is TextPayload)
&& jobTag.IsTextColorAppliedToNameplateFreeCompany.InheritedValue != null
&& jobTag.IsTextColorAppliedToNameplateFreeCompany.InheritedValue.Value)
{
freeCompany.Payloads.Insert(0, (new UIForegroundPayload(jobTag.TextColor.InheritedValue.Value)));
freeCompany.Payloads.Add(new UIForegroundPayload(0));

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Authors>r00telement</Authors>
<Version>1.1.5.0</Version>
<Version>1.1.5.1</Version>
</PropertyGroup>
<PropertyGroup>

View File

@@ -10,5 +10,5 @@
"https://github.com/r00telement/PlayerTags/raw/main/PlayerTags/Resources/Promo/Nameplates_1.png",
"https://github.com/r00telement/PlayerTags/raw/main/PlayerTags/Resources/Promo/Chat_1.png"
],
"Changelog": "- Added experimental option to apply tags to self in chat.\n- Added separate melee and ranged inheritance under dps.\n- Added separate magical and physical inheritance under ranged dps.\n- Added separate land and hand inheritance under land/land.\n- Added option to reset a selected item to its defaults."
"Changelog": "- Fix for nameplates sometimes disappearing when changing a player's title color when they have no title."
}