Fixed Hot Pink custom item colors
This commit is contained in:
1 parent
d1e82af80d
commit
042657f1e1
22 files changed
+115
-107
No files matched your search
@@ -3,6 +3,7 @@ using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Rarities;
|
||||
using CalamityMod.Tiles.Furniture.CraftingStations;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
@@ -63,5 +64,7 @@ namespace CalamityMod.Items.Accessories
|
||||
AddTile<DraedonsForge>().
|
||||
Register();
|
||||
}
|
||||
|
||||
public static Color RarityColor() => CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly / 2f % 1f, [ new Color(255, 196, 55), new Color(255, 231, 107), new Color(255, 254, 243) ]);
|
||||
}
|
||||
}
|
||||
@@ -637,5 +637,7 @@ namespace CalamityMod.Items.Accessories
|
||||
AddDecraftCondition(CalamityConditions.DownedSupremeCalamitas, CalamityConditions.DownedExoMechs).
|
||||
Register();
|
||||
}
|
||||
|
||||
public static Color RarityColor() => CalamityUtils.ColorSwap(new Color(255, 166, 0), new Color(25, 250, 25), 6f); //alternates between emerald green and amber (BanditHueh)
|
||||
}
|
||||
}
|
||||
@@ -80,5 +80,7 @@ namespace CalamityMod.Items.Armor.Demonshade
|
||||
|
||||
public string ExtensionTexture => "CalamityMod/Items/Armor/Demonshade/DemonshadeHelm_Extension";
|
||||
public Vector2 ExtensionSpriteOffset(PlayerDrawSet drawInfo) => new Vector2(0, -4f);
|
||||
|
||||
public static Color DemonshadeRarityColor() => CalamityUtils.ColorSwap(new Color(255, 132, 22), new Color(221, 85, 7), 4f);
|
||||
}
|
||||
}
|
||||
@@ -415,110 +415,6 @@ namespace CalamityMod.Items
|
||||
{
|
||||
if (item.type == ModContent.ItemType<TheCommunity>())
|
||||
nameLine.OverrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB);
|
||||
|
||||
// Developer items
|
||||
if (item.type == ModContent.ItemType<Sylvestaff>())
|
||||
nameLine.OverrideColor = new Color(249, 197, 255);
|
||||
if (item.type == ModContent.ItemType<StaffofBlushie>())
|
||||
nameLine.OverrideColor = new Color(0, 0, 255);
|
||||
if (item.type == ModContent.ItemType<TheDanceofLight>())
|
||||
nameLine.OverrideColor = TheDanceofLight.GetSyncedLightColor();
|
||||
if (item.type == ModContent.ItemType<NanoblackReaper>())
|
||||
nameLine.OverrideColor = new Color(0.34f, 0.34f + 0.66f * Main.DiscoG / 255f, 0.34f + 0.5f * Main.DiscoG / 255f);
|
||||
if (item.type == ModContent.ItemType<ShatteredCommunity>())
|
||||
nameLine.OverrideColor = ShatteredCommunity.GetRarityColor();
|
||||
if (item.type == ModContent.ItemType<Ozzathoth>())
|
||||
nameLine.OverrideColor = ShatteredCommunity.GetRarityColor();
|
||||
if (item.type == ModContent.ItemType<ProfanedSoulCrystal>())
|
||||
nameLine.OverrideColor = CalamityUtils.ColorSwap(new Color(255, 166, 0), new Color(25, 250, 25), 6f); //alternates between emerald green and amber (BanditHueh)
|
||||
if (item.type == ModContent.ItemType<TemporalUmbrella>())
|
||||
nameLine.OverrideColor = CalamityUtils.ColorSwap(new Color(210, 0, 255), new Color(255, 248, 24), 4f);
|
||||
if (item.type == ModContent.ItemType<Endogenesis>())
|
||||
nameLine.OverrideColor = CalamityUtils.ColorSwap(new Color(131, 239, 255), new Color(36, 55, 230), 4f);
|
||||
if (item.type == ModContent.ItemType<DraconicDestruction>())
|
||||
nameLine.OverrideColor = CalamityUtils.ColorSwap(new Color(255, 69, 0), new Color(139, 0, 0), 4f);
|
||||
if (item.type == ModContent.ItemType<ScarletDevil>())
|
||||
nameLine.OverrideColor = CalamityUtils.ColorSwap(new Color(191, 45, 71), new Color(185, 187, 253), 4f);
|
||||
if (item.type == ModContent.ItemType<RedSun>())
|
||||
nameLine.OverrideColor = CalamityUtils.ColorSwap(new Color(204, 86, 80), new Color(237, 69, 141), 4f);
|
||||
if (item.type == ModContent.ItemType<CrystylCrusher>())
|
||||
nameLine.OverrideColor = new Color(129, 29, 149);
|
||||
if (item.type == ModContent.ItemType<SomaPrime>())
|
||||
nameLine.OverrideColor = CalamityUtils.ColorSwap(new Color(255, 255, 255), new Color(0xD1, 0xCC, 0x6F), 4f);
|
||||
if (item.type == ModContent.ItemType<Svantechnical>())
|
||||
nameLine.OverrideColor = new Color(220, 20, 60);
|
||||
if (item.type == ModContent.ItemType<Contagion>())
|
||||
nameLine.OverrideColor = new Color(207, 17, 117);
|
||||
if (item.type == ModContent.ItemType<TriactisTruePaladinianMageHammerofMight>())
|
||||
nameLine.OverrideColor = new Color(227, 226, 180);
|
||||
if (item.type == ModContent.ItemType<IllustriousKnives>())
|
||||
nameLine.OverrideColor = CalamityUtils.ColorSwap(new Color(154, 255, 151), new Color(228, 151, 255), 4f);
|
||||
if (item.type == ModContent.ItemType<DemonshadeHelm>() || item.type == ModContent.ItemType<DemonshadeBreastplate>() || item.type == ModContent.ItemType<DemonshadeGreaves>())
|
||||
nameLine.OverrideColor = CalamityUtils.ColorSwap(new Color(255, 132, 22), new Color(221, 85, 7), 4f);
|
||||
if (item.type == ModContent.ItemType<AngelicAlliance>())
|
||||
{
|
||||
nameLine.OverrideColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly / 2f % 1f, new Color[]
|
||||
{
|
||||
new Color(255, 196, 55),
|
||||
new Color(255, 231, 107),
|
||||
new Color(255, 254, 243)
|
||||
});
|
||||
}
|
||||
|
||||
// TODO -- for cleanliness, ALL color math should either be a one-line color swap or inside the item's own file
|
||||
// The items that currently violate this are all below:
|
||||
// Eternity, Flamsteed Ring, Earth
|
||||
if (item.type == ModContent.ItemType<Eternity>())
|
||||
{
|
||||
List<Color> colorSet = new List<Color>()
|
||||
{
|
||||
new Color(188, 192, 193), // white
|
||||
new Color(157, 100, 183), // purple
|
||||
new Color(249, 166, 77), // honey-ish orange
|
||||
new Color(255, 105, 234), // pink
|
||||
new Color(67, 204, 219), // sky blue
|
||||
new Color(249, 245, 99), // bright yellow
|
||||
new Color(236, 168, 247), // purplish pink
|
||||
};
|
||||
if (nameLine != null)
|
||||
{
|
||||
int colorIndex = (int)(Main.GlobalTimeWrappedHourly / 2 % colorSet.Count);
|
||||
Color currentColor = colorSet[colorIndex];
|
||||
Color nextColor = colorSet[(colorIndex + 1) % colorSet.Count];
|
||||
nameLine.OverrideColor = Color.Lerp(currentColor, nextColor, Main.GlobalTimeWrappedHourly % 2f > 1f ? 1f : Main.GlobalTimeWrappedHourly % 1f);
|
||||
}
|
||||
}
|
||||
if (item.type == ModContent.ItemType<FlamsteedRing>())
|
||||
{
|
||||
if (Main.GlobalTimeWrappedHourly % 1f < 0.6f)
|
||||
{
|
||||
nameLine.OverrideColor = new Color(89, 229, 255);
|
||||
}
|
||||
else if (Main.GlobalTimeWrappedHourly % 1f < 0.8f)
|
||||
{
|
||||
nameLine.OverrideColor = Color.Lerp(new Color(89, 229, 255), Color.White, (Main.GlobalTimeWrappedHourly % 1f - 0.6f) / 0.2f);
|
||||
}
|
||||
else
|
||||
{
|
||||
nameLine.OverrideColor = Color.Lerp(Color.White, new Color(89, 229, 255), (Main.GlobalTimeWrappedHourly % 1f - 0.8f) / 0.2f);
|
||||
}
|
||||
}
|
||||
if (item.type == ModContent.ItemType<Earth>())
|
||||
{
|
||||
List<Color> earthColors = new List<Color>()
|
||||
{
|
||||
Color.OrangeRed,
|
||||
Color.MediumTurquoise,
|
||||
Color.LimeGreen
|
||||
};
|
||||
if (nameLine != null)
|
||||
{
|
||||
int colorIndex = (int)(Main.GlobalTimeWrappedHourly / 2 % earthColors.Count);
|
||||
Color currentColor = earthColors[colorIndex];
|
||||
Color nextColor = earthColors[(colorIndex + 1) % earthColors.Count];
|
||||
nameLine.OverrideColor = Color.Lerp(currentColor, nextColor, Main.GlobalTimeWrappedHourly % 2f > 1f ? 1f : Main.GlobalTimeWrappedHourly % 1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -144,5 +144,7 @@ namespace CalamityMod.Items.Tools
|
||||
AddTile<DraedonsForge>().
|
||||
Register();
|
||||
}
|
||||
|
||||
public static Color RarityColor() => new Color(129, 29, 149);
|
||||
}
|
||||
}
|
||||
@@ -60,5 +60,22 @@ namespace CalamityMod.Items.Weapons.Magic
|
||||
AddTile<DraedonsForge>().
|
||||
Register();
|
||||
}
|
||||
|
||||
public static Color RarityColor()
|
||||
{
|
||||
List<Color> colorSet = [
|
||||
new Color(188, 192, 193), // white
|
||||
new Color(157, 100, 183), // purple
|
||||
new Color(249, 166, 77), // honey-ish orange
|
||||
new Color(255, 105, 234), // pink
|
||||
new Color(67, 204, 219), // sky blue
|
||||
new Color(249, 245, 99), // bright yellow
|
||||
new Color(236, 168, 247), // purplish pink
|
||||
];
|
||||
int colorIndex = (int)(Main.GlobalTimeWrappedHourly / 2 % colorSet.Count);
|
||||
Color currentColor = colorSet[colorIndex];
|
||||
Color nextColor = colorSet[(colorIndex + 1) % colorSet.Count];
|
||||
return Color.Lerp(currentColor, nextColor, Main.GlobalTimeWrappedHourly % 2f > 1f ? 1f : Main.GlobalTimeWrappedHourly % 1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
using CalamityMod.Projectiles.Magic;
|
||||
using CalamityMod.Rarities;
|
||||
using CalamityMod.Tiles.Furniture.CraftingStations;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -44,5 +45,7 @@ namespace CalamityMod.Items.Weapons.Magic
|
||||
AddTile<DraedonsForge>().
|
||||
Register();
|
||||
}
|
||||
|
||||
public static Color RarityColor() => Color.Blue;
|
||||
}
|
||||
}
|
||||
@@ -111,5 +111,7 @@ namespace CalamityMod.Items.Weapons.Magic
|
||||
spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, scale, SpriteEffects.None, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Color RarityColor() => new Color(249, 197, 255);
|
||||
}
|
||||
}
|
||||
@@ -62,5 +62,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
AddTile<DraedonsForge>().
|
||||
Register();
|
||||
}
|
||||
|
||||
public static Color RarityColor() => CalamityUtils.ColorSwap(new Color(255, 69, 0), new Color(139, 0, 0), 4f);
|
||||
}
|
||||
}
|
||||
@@ -76,5 +76,14 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
AddTile<DraedonsForge>().
|
||||
Register();
|
||||
}
|
||||
|
||||
public static Color RarityColor()
|
||||
{
|
||||
List<Color> earthColors = [ Color.OrangeRed, Color.MediumTurquoise, Color.LimeGreen ];
|
||||
int colorIndex = (int)(Main.GlobalTimeWrappedHourly / 2 % earthColors.Count);
|
||||
Color currentColor = earthColors[colorIndex];
|
||||
Color nextColor = earthColors[(colorIndex + 1) % earthColors.Count];
|
||||
return Color.Lerp(currentColor, nextColor, Main.GlobalTimeWrappedHourly % 2f > 1f ? 1f : Main.GlobalTimeWrappedHourly % 1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,5 +62,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
AddTile<DraedonsForge>().
|
||||
Register();
|
||||
}
|
||||
|
||||
public static Color RarityColor() => CalamityUtils.ColorSwap(new Color(154, 255, 151), new Color(228, 151, 255), 4f);
|
||||
}
|
||||
}
|
||||
@@ -117,5 +117,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
AddTile<DraedonsForge>().
|
||||
Register();
|
||||
}
|
||||
|
||||
public static Color RarityColor() => CalamityUtils.ColorSwap(new Color(204, 86, 80), new Color(237, 69, 141), 4f);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using CalamityMod.Rarities;
|
||||
using CalamityMod.Tiles.Furniture.CraftingStations;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
@@ -44,5 +45,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
AddTile<DraedonsForge>().
|
||||
Register();
|
||||
}
|
||||
|
||||
public static Color RarityColor() => new Color(227, 226, 180);
|
||||
}
|
||||
}
|
||||
@@ -53,5 +53,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType<ContagionBow>(), damage, knockback, player.whoAmI);
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Color RarityColor() => new Color(207, 17, 117);
|
||||
}
|
||||
}
|
||||
@@ -76,5 +76,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
AddTile<DraedonsForge>().
|
||||
Register();
|
||||
}
|
||||
|
||||
public static Color RarityColor() => CalamityUtils.ColorSwap(new Color(255, 255, 255), new Color(0xD1, 0xCC, 0x6F), 4f);
|
||||
}
|
||||
}
|
||||
@@ -82,5 +82,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
AddTile<DraedonsForge>().
|
||||
Register();
|
||||
}
|
||||
|
||||
public static Color RarityColor() => new Color(220, 20, 60);
|
||||
}
|
||||
}
|
||||
@@ -174,5 +174,7 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
AddTile<DraedonsForge>().
|
||||
Register();
|
||||
}
|
||||
|
||||
public static Color RarityColor() => new Color(0.34f, 0.34f + 0.66f * Main.DiscoG / 255f, 0.34f + 0.5f * Main.DiscoG / 255f);
|
||||
}
|
||||
}
|
||||
@@ -53,5 +53,7 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
AddTile<DraedonsForge>().
|
||||
Register();
|
||||
}
|
||||
|
||||
public static Color RarityColor() => CalamityUtils.ColorSwap(new Color(191, 45, 71), new Color(185, 187, 253), 4f);
|
||||
}
|
||||
}
|
||||
@@ -101,5 +101,7 @@ namespace CalamityMod.Items.Weapons.Summon
|
||||
AddTile<DraedonsForge>().
|
||||
Register();
|
||||
}
|
||||
|
||||
public static Color RarityColor() => CalamityUtils.ColorSwap(new Color(131, 239, 255), new Color(36, 55, 230), 4f);
|
||||
}
|
||||
}
|
||||
@@ -204,5 +204,15 @@ namespace CalamityMod.Items.Weapons.Summon
|
||||
AddTile<DraedonsForge>().
|
||||
Register();
|
||||
}
|
||||
|
||||
public static Color RarityColor()
|
||||
{
|
||||
if (Main.GlobalTimeWrappedHourly % 1f < 0.6f)
|
||||
return new Color(89, 229, 255);
|
||||
else if (Main.GlobalTimeWrappedHourly % 1f < 0.8f)
|
||||
return Color.Lerp(new Color(89, 229, 255), Color.White, (Main.GlobalTimeWrappedHourly % 1f - 0.6f) / 0.2f);
|
||||
else
|
||||
return Color.Lerp(Color.White, new Color(89, 229, 255), (Main.GlobalTimeWrappedHourly % 1f - 0.8f) / 0.2f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -65,5 +65,7 @@ namespace CalamityMod.Items.Weapons.Summon
|
||||
AddTile<DraedonsForge>().
|
||||
Register();
|
||||
}
|
||||
|
||||
public static Color RarityColor() => CalamityUtils.ColorSwap(new Color(210, 0, 255), new Color(255, 248, 24), 4f);
|
||||
}
|
||||
}
|
||||
+42
-3
@@ -1,6 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using CalamityMod.Items.Accessories;
|
||||
using CalamityMod.Items.Accessories.Wings;
|
||||
using CalamityMod.Items.Armor.Demonshade;
|
||||
using CalamityMod.Items.Tools;
|
||||
using CalamityMod.Items.Weapons.Magic;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Graphics;
|
||||
@@ -23,13 +31,45 @@ namespace CalamityMod.Rarities
|
||||
{
|
||||
{ ModContent.ItemType<TiredTail>(), text => new TiredTailTextEffects(text) }
|
||||
};
|
||||
public static Dictionary<int, Func<Color>> CustomColors = new()
|
||||
{
|
||||
{ ModContent.ItemType<AngelicAlliance>(), AngelicAlliance.RarityColor },
|
||||
{ ModContent.ItemType<Contagion>(), Contagion.RarityColor },
|
||||
{ ModContent.ItemType<CrystylCrusher>(), CrystylCrusher.RarityColor },
|
||||
{ ModContent.ItemType<TheDanceofLight>(), TheDanceofLight.GetSyncedLightColor },
|
||||
{ ModContent.ItemType<DemonshadeHelm>(), DemonshadeHelm.DemonshadeRarityColor },
|
||||
{ ModContent.ItemType<DemonshadeBreastplate>(), DemonshadeHelm.DemonshadeRarityColor },
|
||||
{ ModContent.ItemType<DemonshadeGreaves>(), DemonshadeHelm.DemonshadeRarityColor },
|
||||
{ ModContent.ItemType<DraconicDestruction>(), DraconicDestruction.RarityColor },
|
||||
{ ModContent.ItemType<Earth>(), Earth.RarityColor },
|
||||
{ ModContent.ItemType<Endogenesis>(), Endogenesis.RarityColor },
|
||||
{ ModContent.ItemType<Eternity>(), Eternity.RarityColor },
|
||||
{ ModContent.ItemType<FlamsteedRing>(), FlamsteedRing.RarityColor },
|
||||
{ ModContent.ItemType<IllustriousKnives>(), IllustriousKnives.RarityColor },
|
||||
{ ModContent.ItemType<NanoblackReaper>(), NanoblackReaper.RarityColor },
|
||||
{ ModContent.ItemType<Ozzathoth>(), ShatteredCommunity.GetRarityColor }, // Yes, this reuses Shattered Community's color
|
||||
{ ModContent.ItemType<ProfanedSoulCrystal>(), ProfanedSoulCrystal.RarityColor },
|
||||
{ ModContent.ItemType<RedSun>(), RedSun.RarityColor },
|
||||
{ ModContent.ItemType<ScarletDevil>(), ScarletDevil.RarityColor },
|
||||
{ ModContent.ItemType<ShatteredCommunity>(), ShatteredCommunity.GetRarityColor },
|
||||
{ ModContent.ItemType<SomaPrime>(), SomaPrime.RarityColor },
|
||||
{ ModContent.ItemType<StaffofBlushie>(), StaffofBlushie.RarityColor },
|
||||
{ ModContent.ItemType<Svantechnical>(), Svantechnical.RarityColor },
|
||||
{ ModContent.ItemType<Sylvestaff>(), Sylvestaff.RarityColor },
|
||||
{ ModContent.ItemType<TemporalUmbrella>(), TemporalUmbrella.RarityColor },
|
||||
{ ModContent.ItemType<TriactisTruePaladinianMageHammerofMight>(), TriactisTruePaladinianMageHammerofMight.RarityColor }
|
||||
};
|
||||
|
||||
public static void Draw(Item Item, SpriteBatch spriteBatch, string text, int X, int Y, Color textColor, Color lightColor, float rotation,
|
||||
Vector2 origin, Vector2 baseScale, float time, bool renderTextSparkles, DynamicSpriteFont font)
|
||||
{
|
||||
if (CustomColors.TryGetValue(Item.type, out var color)) // For items which use a custom item color, give them that custom color.
|
||||
{
|
||||
textColor = color.Invoke();
|
||||
}
|
||||
TextSnippet[] snippets = ChatManager.ParseMessage(text, textColor).ToArray();
|
||||
|
||||
|
||||
if (CustomRarities.ContainsKey(Item.type)) //For items in the custom rarity table, give them custom rarity effects.
|
||||
if (CustomRarities.ContainsKey(Item.type)) // For items in the custom rarity table, give them custom rarity effects.
|
||||
{
|
||||
for (int i = 0; i < snippets.Length; i++)
|
||||
{
|
||||
@@ -45,7 +85,6 @@ namespace CalamityMod.Rarities
|
||||
ChatManager.ConvertNormalSnippets(snippets);
|
||||
|
||||
ChatManager.DrawColorCodedString(spriteBatch, font, snippets, new(X, Y), textColor, 0, Vector2.Zero, baseScale, out _, -1, true);
|
||||
|
||||
}
|
||||
|
||||
public static void Draw(Item Item, string text, int X, int Y, float rotation, Vector2 origin, Vector2 baseScale, Color? textColor = null, Color? lightColor = null, bool? renderTextSparkles = null)
|
||||
|
||||
Reference in new issue
Block a user