feat: add more text colour options

This commit is contained in:
Anna 2024-07-25 16:01:02 -04:00
parent 3c2bb14f1c
commit 7a27c5c117
Signed by: anna
GPG Key ID: D0943384CD9F87D1
3 changed files with 75 additions and 5 deletions

View File

@ -17,7 +17,13 @@ public class Configuration : IPluginConfiguration {
public bool Alternate = true;
public bool ManaModeAlternateOnlyManaUsers = true;
public float AlternateSeconds = 3.0f;
public uint DpsColour = 0xEDFFEC;
public uint TextColour = 0xEDFFEC;
public int TextAddRed;
public int TextAddGreen;
public int TextAddBlue;
public int TextMulRed = 100;
public int TextMulGreen = 100;
public int TextMulBlue = 100;
}
public enum MeterMode {

View File

@ -187,6 +187,19 @@ public class Plugin : IDalamudPlugin {
left->SetText(manaString[..^2]);
right->SetText(manaString[^2..]);
left->AddRed = 0;
left->AddGreen = 0;
left->AddBlue = 0;
left->MultiplyRed = 100;
left->MultiplyGreen = 100;
left->MultiplyBlue = 100;
right->AddRed = left->AddRed;
right->AddGreen = left->AddGreen;
right->AddBlue = left->AddBlue;
right->MultiplyRed = left->MultiplyRed;
right->MultiplyGreen = left->MultiplyGreen;
right->MultiplyBlue = left->MultiplyBlue;
// fixme: need to figure out a way to get the game to repop
var defaultName = new StringBuilder("\ue06a");
foreach (var digit in member.Object->Level.ToString(CultureInfo.InvariantCulture)) {
@ -201,6 +214,13 @@ public class Plugin : IDalamudPlugin {
unit.Name->TextColor = new ByteColor {
RGBA = 0xFFFFFFFF,
};
unit.Name->AddRed = 0;
unit.Name->AddGreen = 0;
unit.Name->AddBlue = 0;
unit.Name->MultiplyRed = 100;
unit.Name->MultiplyGreen = 100;
unit.Name->MultiplyBlue = 100;
}
}
@ -238,6 +258,19 @@ public class Plugin : IDalamudPlugin {
};
right->TextColor = left->TextColor;
left->AddRed = 0;
left->AddGreen = 0;
left->AddBlue = 0;
left->MultiplyRed = 100;
left->MultiplyGreen = 100;
left->MultiplyBlue = 100;
right->AddRed = left->AddRed;
right->AddGreen = left->AddGreen;
right->AddBlue = left->AddBlue;
right->MultiplyRed = left->MultiplyRed;
right->MultiplyGreen = left->MultiplyGreen;
right->MultiplyBlue = left->MultiplyBlue;
var manaString = chara->Mana.ToString(CultureInfo.InvariantCulture);
left->SetText(manaString[..^2]);
right->SetText(manaString[^2..]);
@ -247,10 +280,23 @@ public class Plugin : IDalamudPlugin {
}
left->TextColor = new ByteColor {
RGBA = this.Config.DpsColour,
RGBA = this.Config.TextColour,
};
right->TextColor = left->TextColor;
left->AddRed = (byte) Math.Clamp(this.Config.TextAddRed, 0, 255);
left->AddGreen = (byte) Math.Clamp(this.Config.TextAddGreen, 0, 255);
left->AddBlue = (byte) Math.Clamp(this.Config.TextAddBlue, 0, 255);
left->MultiplyRed = (byte) Math.Clamp(this.Config.TextMulRed, 0, 100);
left->MultiplyGreen = (byte) Math.Clamp(this.Config.TextMulGreen, 0, 100);
left->MultiplyBlue = (byte) Math.Clamp(this.Config.TextMulBlue, 0, 100);
right->AddRed = left->AddRed;
right->AddGreen = left->AddGreen;
right->AddBlue = left->AddBlue;
right->MultiplyRed = left->MultiplyRed;
right->MultiplyGreen = left->MultiplyGreen;
right->MultiplyBlue = left->MultiplyBlue;
if (combatant.EncDps == 0 || float.IsInfinity(combatant.EncDps) || float.IsNaN(combatant.EncDps)) {
left->SetText("0.");
right->SetText("00");
@ -293,8 +339,15 @@ public class Plugin : IDalamudPlugin {
member.Name->SetText(dpsText);
member.Name->TextColor = new ByteColor {
RGBA = this.Config.DpsColour,
RGBA = this.Config.TextColour,
};
member.Name->AddRed = (byte) Math.Clamp(this.Config.TextAddRed, 0, 255);
member.Name->AddGreen = (byte) Math.Clamp(this.Config.TextAddGreen, 0, 255);
member.Name->AddBlue = (byte) Math.Clamp(this.Config.TextAddBlue, 0, 255);
member.Name->MultiplyRed = (byte) Math.Clamp(this.Config.TextMulRed, 0, 100);
member.Name->MultiplyGreen = (byte) Math.Clamp(this.Config.TextMulGreen, 0, 100);
member.Name->MultiplyBlue = (byte) Math.Clamp(this.Config.TextMulBlue, 0, 100);
}
}
}

View File

@ -69,10 +69,21 @@ public class PluginUi : IDisposable {
anyChanged |= ImGui.Checkbox("Only alternate on jobs that use mana", ref this.Plugin.Config.ManaModeAlternateOnlyManaUsers);
}
var textColour = ConvertRgba(this.Plugin.Config.DpsColour);
var textColour = ConvertRgba(this.Plugin.Config.TextColour);
if (ImGui.ColorEdit3("DPS text colour", ref textColour)) {
anyChanged = true;
this.Plugin.Config.DpsColour = ConvertRgba(textColour);
this.Plugin.Config.TextColour = ConvertRgba(textColour);
}
if (ImGui.TreeNodeEx("Advanced colour options")) {
using var treePop = new OnDispose(ImGui.TreePop);
anyChanged |= ImGui.SliderInt("Add red", ref this.Plugin.Config.TextAddRed, 0, 255);
anyChanged |= ImGui.SliderInt("Add green", ref this.Plugin.Config.TextAddGreen, 0, 255);
anyChanged |= ImGui.SliderInt("Add blue", ref this.Plugin.Config.TextAddBlue, 0, 255);
anyChanged |= ImGui.SliderInt("Multiply red", ref this.Plugin.Config.TextMulRed, 0, 100);
anyChanged |= ImGui.SliderInt("Multiply green", ref this.Plugin.Config.TextMulGreen, 0, 100);
anyChanged |= ImGui.SliderInt("Multiply blue", ref this.Plugin.Config.TextMulBlue, 0, 100);
}
if (anyChanged) {