using Server.Network;
namespace Server.ContextMenus
{
///
/// Represents a single entry of a context menu.
///
///
public class ContextMenuEntry
{
///
/// Instantiates a new ContextMenuEntry with a given localization number (
/// )
/// and maximum range ().
///
///
/// The localization number containing the name of this entry.
///
///
///
/// The maximum range at which this entry can be used.
///
///
public ContextMenuEntry(int number, int range = -1)
{
if (number <= 0x7FFF) // Legacy code support
{
Number = 3000000 + number;
}
else
{
Number = number;
}
Range = range;
Enabled = true;
Color = 0xFFFF;
}
///
/// Gets or sets additional flags used in client communication.
///
public CMEFlags Flags { get; set; }
///
/// Gets or sets the that owns this entry.
///
public ContextMenu Owner { get; set; }
///
/// Gets or sets the localization number containing the name of this entry.
///
public int Number { get; set; }
///
/// Gets or sets the maximum range at which this entry may be used, in tiles. A value of -1 signifies no maximum range.
///
public int Range { get; set; }
///
/// Gets or sets the color for this entry. Format is A1-R5-G5-B5.
///
public int Color { get; set; }
///
/// Gets or sets whether this entry is enabled. When false, the entry will appear in a gray hue and
/// will never be invoked.
///
public bool Enabled { get; set; }
///
/// Gets a value indicating if non local use of this entry is permitted.
///
public virtual bool NonLocalUse => false;
///
/// Overridable. Virtual event invoked when the entry is clicked.
///
public virtual void OnClick()
{
}
}
}