Files

37 lines
1.1 KiB
C#

using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
using System.Collections.Generic;
namespace ForgottenWawiTech.Content.Items.Global
{
// Appends a rainbow developer marker line to items with the Developer rarity
public class DeveloperRarityTooltip : GlobalItem
{
public override bool InstancePerEntity => false;
private static int DevRarityId => ModContent.RarityType<Content.Rarities.FWTDeveloperItem>();
public override void ModifyTooltips(Item item, List<TooltipLine> tooltips)
{
if (item.rare != DevRarityId)
return;
// Build a hue-cycling color for the tooltip text
float time = Main.GlobalTimeWrappedHourly;
// Cycle hue 0..1 over 5 seconds
float hue = (time / 5f) % 1f;
Color rainbow = Main.hslToRgb(hue, 1f, 0.5f);
var line = new TooltipLine(Mod, "DeveloperMarker", "-Developer Based Item-")
{
OverrideColor = rainbow
};
tooltips.Add(line);
}
}
}