mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-14 20:54:16 +01:00
feat: item rarity color in SeString.CreateItemLink
This commit is contained in:
parent
982755c4a2
commit
3f78df23e3
1 changed files with 16 additions and 15 deletions
|
|
@ -171,6 +171,7 @@ public class SeString
|
||||||
var data = Service<DataManager>.Get();
|
var data = Service<DataManager>.Get();
|
||||||
|
|
||||||
var displayName = displayNameOverride;
|
var displayName = displayNameOverride;
|
||||||
|
var rarity = 1; // default: white
|
||||||
if (displayName == null)
|
if (displayName == null)
|
||||||
{
|
{
|
||||||
switch (kind)
|
switch (kind)
|
||||||
|
|
@ -178,7 +179,9 @@ public class SeString
|
||||||
case ItemPayload.ItemKind.Normal:
|
case ItemPayload.ItemKind.Normal:
|
||||||
case ItemPayload.ItemKind.Collectible:
|
case ItemPayload.ItemKind.Collectible:
|
||||||
case ItemPayload.ItemKind.Hq:
|
case ItemPayload.ItemKind.Hq:
|
||||||
displayName = data.GetExcelSheet<Item>()?.GetRow(itemId)?.Name;
|
var item = data.GetExcelSheet<Item>()?.GetRow(itemId);
|
||||||
|
displayName = item?.Name;
|
||||||
|
rarity = item.Rarity;
|
||||||
break;
|
break;
|
||||||
case ItemPayload.ItemKind.EventItem:
|
case ItemPayload.ItemKind.EventItem:
|
||||||
displayName = data.GetExcelSheet<EventItem>()?.GetRow(itemId)?.Name;
|
displayName = data.GetExcelSheet<EventItem>()?.GetRow(itemId)?.Name;
|
||||||
|
|
@ -202,21 +205,19 @@ public class SeString
|
||||||
displayName += $" {(char)SeIconChar.Collectible}";
|
displayName += $" {(char)SeIconChar.Collectible}";
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: probably a cleaner way to build these than doing the bulk+insert
|
var textColor = (ushort)(549 + ((rarity - 1) * 2));
|
||||||
var payloads = new List<Payload>(new Payload[]
|
var textGlowColor = (ushort)(textColor + 1);
|
||||||
{
|
|
||||||
new UIForegroundPayload(0x0225),
|
|
||||||
new UIGlowPayload(0x0226),
|
|
||||||
new ItemPayload(itemId, kind),
|
|
||||||
// arrow goes here
|
|
||||||
new TextPayload(displayName),
|
|
||||||
RawPayload.LinkTerminator,
|
|
||||||
UIGlowPayload.UIGlowOff,
|
|
||||||
UIForegroundPayload.UIForegroundOff,
|
|
||||||
});
|
|
||||||
payloads.InsertRange(3, TextArrowPayloads);
|
|
||||||
|
|
||||||
return new SeString(payloads);
|
return new SeStringBuilder()
|
||||||
|
.Add(new ItemPayload(itemId, kind))
|
||||||
|
.Append(TextArrowPayloads)
|
||||||
|
.AddUiForeground(textColor)
|
||||||
|
.AddUiGlow(textGlowColor)
|
||||||
|
.AddText(displayName)
|
||||||
|
.AddUiGlowOff()
|
||||||
|
.AddUiForegroundOff()
|
||||||
|
.Add(RawPayload.LinkTerminator)
|
||||||
|
.Build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue