using SoulHarvest.Common;
using SoulHarvest.Items;
using SoulHarvest.Tiles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using System;
using System.Collections.Generic;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.GameContent.UI.Elements;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
using Terraria.UI;
namespace SoulHarvest.UI;
internal readonly record struct AltarEquipmentEntry(
AltarEquipmentEntryKind Kind,
DeathAltarItemReference? ItemReference,
int ItemType)
{
public bool IsCharacterSickle => Kind == AltarEquipmentEntryKind.CharacterSickle;
public bool IsCharacterDeathDomain => Kind == AltarEquipmentEntryKind.CharacterDeathDomain;
public bool IsCharacterProgression => IsCharacterSickle || IsCharacterDeathDomain;
public static AltarEquipmentEntry CreateCharacterSickle()
{
return new AltarEquipmentEntry(
AltarEquipmentEntryKind.CharacterSickle,
null,
ModContent.ItemType<NormalSickle>());
}
public static AltarEquipmentEntry CreateCharacterDeathDomain()
{
int itemType = ModContent.ItemType<DeathDomain>();
return new AltarEquipmentEntry(
AltarEquipmentEntryKind.CharacterDeathDomain,
new DeathAltarItemReference(DeathAltarItemStorage.CharacterDeathDomain, 0, itemType),
itemType);
}
public static AltarEquipmentEntry CreateItem(DeathAltarItemReference reference)
{
return new AltarEquipmentEntry(
AltarEquipmentEntryKind.UpgradeableItem,
reference,
reference.ExpectedItemType);
}
public bool TryGetDisplayItem(Player player, out Item item)
{
if (IsCharacterProgression)
{
item = new Item();
item.SetDefaults(ItemType);
return true;
}
if (ItemReference is DeathAltarItemReference reference)
return reference.TryResolve(player, out item);
item = new Item();
return false;
}
}
using SoulHarvest.Common;
using SoulHarvest.Items;
using SoulHarvest.Tiles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using System;
using System.Collections.Generic;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.GameContent.UI.Elements;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
using Terraria.UI;
namespace SoulHarvest.UI;
internal readonly record struct AltarEquipmentEntry(
AltarEquipmentEntryKind Kind,
DeathAltarItemReference? ItemReference,
int ItemType)
{
public bool IsCharacterSickle => Kind == AltarEquipmentEntryKind.CharacterSickle;
public bool IsCharacterDeathDomain => Kind == AltarEquipmentEntryKind.CharacterDeathDomain;
public bool IsCharacterProgression => IsCharacterSickle || IsCharacterDeathDomain;
public static AltarEquipmentEntry CreateCharacterSickle()
{
return new AltarEquipmentEntry(
AltarEquipmentEntryKind.CharacterSickle,
null,
ModContent.ItemType<NormalSickle>());
}
public static AltarEquipmentEntry CreateCharacterDeathDomain()
{
int itemType = ModContent.ItemType<DeathDomain>();
return new AltarEquipmentEntry(
AltarEquipmentEntryKind.CharacterDeathDomain,
new DeathAltarItemReference(DeathAltarItemStorage.CharacterDeathDomain, 0, itemType),
itemType);
}
public static AltarEquipmentEntry CreateItem(DeathAltarItemReference reference)
{
return new AltarEquipmentEntry(
AltarEquipmentEntryKind.UpgradeableItem,
reference,
reference.ExpectedItemType);
}
public bool TryGetDisplayItem(Player player, out Item item)
{
if (IsCharacterProgression)
{
item = new Item();
item.SetDefaults(ItemType);
return true;
}
if (ItemReference is DeathAltarItemReference reference)
return reference.TryResolve(player, out item);
item = new Item();
return false;
}
}