acdream/src/AcDream.Plugin.Abstractions/EquipmentAutomation.cs

64 lines
1.8 KiB
C#

namespace AcDream.Plugin.Abstractions;
/// <summary>One owned item that can participate in VTank equipment policy.</summary>
public readonly record struct PluginEquipmentItem(
uint ObjectId,
string Name,
uint ItemType,
uint ValidLocations,
uint EquippedLocation,
uint ContainerObjectId,
uint WielderObjectId,
byte CombatUse,
int DamageType,
int WeaponSkill,
int Damage,
double DamageVariance)
{
public bool IsEquipped => EquippedLocation != 0u;
/// <summary>Retail AMMO_TYPE bit from PublicWeenieDesc.</summary>
public uint AmmoType { get; init; }
public int StackSize { get; init; } = 1;
public int WeaponType { get; init; }
}
public enum PluginEquipmentCommandStatus
{
Unavailable = 0,
InvalidItem,
Busy,
AlreadyEquipped,
Started,
Refused,
}
public readonly record struct PluginEquipmentCommandResult(
PluginEquipmentCommandStatus Status,
string? Notice = null)
{
public bool Accepted => Status is
PluginEquipmentCommandStatus.AlreadyEquipped
or PluginEquipmentCommandStatus.Started;
}
/// <summary>
/// Borrowed inventory equipment view and one request through the client's
/// canonical confirmed AutoWield transaction.
/// </summary>
public interface IEquipmentAutomation
{
bool IsAvailable => false;
bool IsBusy => false;
IReadOnlyList<PluginEquipmentItem> CaptureOwnedEquipment() =>
Array.Empty<PluginEquipmentItem>();
/// <param name="requestedLocation">
/// Zero asks retail AutoWield to choose; otherwise this is the exact
/// retail INVENTORY_LOC bit requested by a profile.
/// </param>
PluginEquipmentCommandResult Equip(
uint objectId,
uint requestedLocation = 0u) =>
new(PluginEquipmentCommandStatus.Unavailable);
}