using SoulHarvest.Common;
using SoulHarvest.Items;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using System;
using System.Collections.Generic;
using System.Text;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.GameContent.UI.Elements;
using Terraria.GameInput;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
using Terraria.UI;
namespace SoulHarvest.UI;
internal static class ReaperUIData
{
private static readonly Dictionary<ReaperFormId, Texture2D> FormTextures = [];
public static IReadOnlyList<ReaperFormId> BranchForms => ReaperDefinitions.BranchForms;
public static Color GetPrimaryColor(ReaperFormId form) => form switch
{
ReaperFormId.Bone => new Color(86, 221, 226),
ReaperFormId.Blood => new Color(229, 45, 68),
ReaperFormId.Infernal => new Color(247, 115, 28),
ReaperFormId.Frost => new Color(105, 189, 255),
ReaperFormId.Soul => new Color(119, 99, 242),
ReaperFormId.Void => new Color(184, 54, 235),
ReaperFormId.Death => new Color(226, 34, 51),
_ => new Color(198, 205, 194)
};
public static Color GetSecondaryColor(ReaperFormId form) => form switch
{
ReaperFormId.Bone => new Color(227, 246, 232),
ReaperFormId.Blood => new Color(255, 145, 158),
ReaperFormId.Infernal => new Color(255, 215, 87),
ReaperFormId.Frost => new Color(226, 250, 255),
ReaperFormId.Soul => new Color(91, 221, 245),
ReaperFormId.Void => new Color(246, 96, 224),
ReaperFormId.Death => new Color(250, 194, 190),
_ => new Color(225, 222, 206)
};
// Compatibility for the combat HUD/form wheel. The panorama below does not
// use this method; it loads all form emblems from their resource paths.
public static int GetItemType(ReaperFormId form) => form switch
{
ReaperFormId.Bone => ModContent.ItemType<SkullSickle>(),
ReaperFormId.Blood => ModContent.ItemType<BloodSickle>(),
ReaperFormId.Infernal => ModContent.ItemType<DevilSickle>(),
ReaperFormId.Frost => ModContent.ItemType<FrostSickle>(),
ReaperFormId.Soul => ModContent.ItemType<SoulSickle>(),
ReaperFormId.Void => ModContent.ItemType<VoidSickle>(),
ReaperFormId.Death => ModContent.ItemType<DeathSickle>(),
_ => ModContent.ItemType<NormalSickle>()
};
public static string GetEnergyName(ReaperFormId form) => Language.GetTextValue($"Mods.SoulHarvest.UI.ReaperHUD.EnergyNames.{form}");
public static bool IsUnlocked(ReaperProgressionState progression, ReaperFormId form)
{
return form == ReaperFormId.Death
? progression.DeathFormUnlocked
: form == ReaperFormId.Base || progression.GetStage(form) > ReaperStage.Locked;
}
public static Texture2D GetFormTexture(ReaperFormId form)
{
if (FormTextures.TryGetValue(form, out Texture2D? cached) && !cached.IsDisposed)
return cached;
// Old form items are visual emblems now. Address their art directly so
// this character UI never constructs an item just to obtain a texture.
string path = form switch
{
ReaperFormId.Bone => "SoulHarvest/Items/SkullSickle",
ReaperFormId.Blood => "SoulHarvest/Items/BloodSickle",
ReaperFormId.Infernal => "SoulHarvest/Items/DevilSickle",
ReaperFormId.Frost => "SoulHarvest/Items/FrostSickle",
ReaperFormId.Soul => "SoulHarvest/Items/SoulSickle",
ReaperFormId.Void => "SoulHarvest/Items/VoidSickle",
ReaperFormId.Death => "SoulHarvest/Items/DeathSickle",
_ => "SoulHarvest/Items/NormalSickle"
};
Texture2D texture = ModContent.Request<Texture2D>(path, AssetRequestMode.ImmediateLoad).Value;
FormTextures[form] = texture;
return texture;
}
public static string GetFormName(ReaperFormId form) => Language.GetTextValue($"Mods.SoulHarvest.UI.ReaperTree.Forms.{form}.Name");
public static string GetFormSummary(ReaperFormId form) => Language.GetTextValue($"Mods.SoulHarvest.UI.ReaperTree.Forms.{form}.Summary");
public static string GetSkillName(ReaperFormId form, int index) => Language.GetTextValue($"Mods.SoulHarvest.UI.ReaperTree.Skills.{form}.Skill{index + 1}.Name");
public static string GetSkillDescription(ReaperFormId form, int index) => Language.GetTextValue($"Mods.SoulHarvest.UI.ReaperTree.Skills.{form}.Skill{index + 1}.Description");
public static string GetUltimateName(ReaperFormId form) => Language.GetTextValue($"Mods.SoulHarvest.UI.ReaperTree.Forms.{form}.Ultimate");
public static string GetBranchLabel(ReaperFormId form) => Language.GetTextValue($"Mods.SoulHarvest.UI.ReaperTree.BranchLabels.{form}");
public static string GetCommonNodeName(ReaperCommonNode node) => Language.GetTextValue($"Mods.SoulHarvest.UI.ReaperTree.CommonNodes.{node}.Name");
public static string GetCommonNodeDescription(ReaperCommonNode node) => Language.GetTextValue($"Mods.SoulHarvest.UI.ReaperTree.CommonNodes.{node}.Description");
public static string GetStageName(int stage) => Language.GetTextValue($"Mods.SoulHarvest.UI.ReaperTree.StageNames.Stage{Math.Clamp(stage, 1, 3)}");
}
using SoulHarvest.Common;
using SoulHarvest.Items;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using System;
using System.Collections.Generic;
using System.Text;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.GameContent.UI.Elements;
using Terraria.GameInput;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
using Terraria.UI;
namespace SoulHarvest.UI;
internal static class ReaperUIData
{
private static readonly Dictionary<ReaperFormId, Texture2D> FormTextures = [];
public static IReadOnlyList<ReaperFormId> BranchForms => ReaperDefinitions.BranchForms;
public static Color GetPrimaryColor(ReaperFormId form) => form switch
{
ReaperFormId.Bone => new Color(86, 221, 226),
ReaperFormId.Blood => new Color(229, 45, 68),
ReaperFormId.Infernal => new Color(247, 115, 28),
ReaperFormId.Frost => new Color(105, 189, 255),
ReaperFormId.Soul => new Color(119, 99, 242),
ReaperFormId.Void => new Color(184, 54, 235),
ReaperFormId.Death => new Color(226, 34, 51),
_ => new Color(198, 205, 194)
};
public static Color GetSecondaryColor(ReaperFormId form) => form switch
{
ReaperFormId.Bone => new Color(227, 246, 232),
ReaperFormId.Blood => new Color(255, 145, 158),
ReaperFormId.Infernal => new Color(255, 215, 87),
ReaperFormId.Frost => new Color(226, 250, 255),
ReaperFormId.Soul => new Color(91, 221, 245),
ReaperFormId.Void => new Color(246, 96, 224),
ReaperFormId.Death => new Color(250, 194, 190),
_ => new Color(225, 222, 206)
};
// Compatibility for the combat HUD/form wheel. The panorama below does not
// use this method; it loads all form emblems from their resource paths.
public static int GetItemType(ReaperFormId form) => form switch
{
ReaperFormId.Bone => ModContent.ItemType<SkullSickle>(),
ReaperFormId.Blood => ModContent.ItemType<BloodSickle>(),
ReaperFormId.Infernal => ModContent.ItemType<DevilSickle>(),
ReaperFormId.Frost => ModContent.ItemType<FrostSickle>(),
ReaperFormId.Soul => ModContent.ItemType<SoulSickle>(),
ReaperFormId.Void => ModContent.ItemType<VoidSickle>(),
ReaperFormId.Death => ModContent.ItemType<DeathSickle>(),
_ => ModContent.ItemType<NormalSickle>()
};
public static string GetEnergyName(ReaperFormId form) => Language.GetTextValue($"Mods.SoulHarvest.UI.ReaperHUD.EnergyNames.{form}");
public static bool IsUnlocked(ReaperProgressionState progression, ReaperFormId form)
{
return form == ReaperFormId.Death
? progression.DeathFormUnlocked
: form == ReaperFormId.Base || progression.GetStage(form) > ReaperStage.Locked;
}
public static Texture2D GetFormTexture(ReaperFormId form)
{
if (FormTextures.TryGetValue(form, out Texture2D? cached) && !cached.IsDisposed)
return cached;
// Old form items are visual emblems now. Address their art directly so
// this character UI never constructs an item just to obtain a texture.
string path = form switch
{
ReaperFormId.Bone => "SoulHarvest/Items/SkullSickle",
ReaperFormId.Blood => "SoulHarvest/Items/BloodSickle",
ReaperFormId.Infernal => "SoulHarvest/Items/DevilSickle",
ReaperFormId.Frost => "SoulHarvest/Items/FrostSickle",
ReaperFormId.Soul => "SoulHarvest/Items/SoulSickle",
ReaperFormId.Void => "SoulHarvest/Items/VoidSickle",
ReaperFormId.Death => "SoulHarvest/Items/DeathSickle",
_ => "SoulHarvest/Items/NormalSickle"
};
Texture2D texture = ModContent.Request<Texture2D>(path, AssetRequestMode.ImmediateLoad).Value;
FormTextures[form] = texture;
return texture;
}
public static string GetFormName(ReaperFormId form) => Language.GetTextValue($"Mods.SoulHarvest.UI.ReaperTree.Forms.{form}.Name");
public static string GetFormSummary(ReaperFormId form) => Language.GetTextValue($"Mods.SoulHarvest.UI.ReaperTree.Forms.{form}.Summary");
public static string GetSkillName(ReaperFormId form, int index) => Language.GetTextValue($"Mods.SoulHarvest.UI.ReaperTree.Skills.{form}.Skill{index + 1}.Name");
public static string GetSkillDescription(ReaperFormId form, int index) => Language.GetTextValue($"Mods.SoulHarvest.UI.ReaperTree.Skills.{form}.Skill{index + 1}.Description");
public static string GetUltimateName(ReaperFormId form) => Language.GetTextValue($"Mods.SoulHarvest.UI.ReaperTree.Forms.{form}.Ultimate");
public static string GetBranchLabel(ReaperFormId form) => Language.GetTextValue($"Mods.SoulHarvest.UI.ReaperTree.BranchLabels.{form}");
public static string GetCommonNodeName(ReaperCommonNode node) => Language.GetTextValue($"Mods.SoulHarvest.UI.ReaperTree.CommonNodes.{node}.Name");
public static string GetCommonNodeDescription(ReaperCommonNode node) => Language.GetTextValue($"Mods.SoulHarvest.UI.ReaperTree.CommonNodes.{node}.Description");
public static string GetStageName(int stage) => Language.GetTextValue($"Mods.SoulHarvest.UI.ReaperTree.StageNames.Stage{Math.Clamp(stage, 1, 3)}");
}