/************************************************************************* * ModernUO * * Copyright 2019-2024 - ModernUO Development Team * * Email: hi@modernuo.com * * File: ContextMenuEntry.cs * * * * This program is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see . * *************************************************************************/ 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 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(Mobile from, IEntity target) { } }