/************************************************************************* * ModernUO * * Copyright 2019-2024 - ModernUO Development Team * * Email: hi@modernuo.com * * File: ContextMenu.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 . * *************************************************************************/ namespace Server.ContextMenus; /// /// Represents the state of an active context menu. This includes who opened the menu, the menu's focus object, and a list /// of /// entries that the menu is composed of. /// /// public class ContextMenu { /// /// Instantiates a new ContextMenu instance. /// /// /// The who opened this ContextMenu. /// /// /// /// The or to execute the ContextMenu on. /// /// /// /// An array of entries contained in this ContextMenu. /// /// public ContextMenu(Mobile from, IEntity target, ContextMenuEntry[] entries) { From = from; Target = target; Entries = entries; for (var i = 0; i < Entries.Length; i++) { var entry = Entries[i]; if (entry.Number is < 3000000 or > 3032767) { RequiresNewPacket = true; break; } } } /// /// Gets the who opened this ContextMenu. /// public Mobile From { get; } /// /// Gets an object of the or for which this ContextMenu is on. /// public IEntity Target { get; } /// /// Gets the list of entries contained in this ContextMenu. /// public ContextMenuEntry[] Entries { get; } /// /// Returns true if this ContextMenu requires packet version 2. /// public bool RequiresNewPacket { get; } }