Fixes formatting (#200)

This commit is contained in:
Kamron Batman 2020-08-25 18:53:35 -07:00 committed by GitHub
parent 1f651992d7
commit 86b7b3aed1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
209 changed files with 51326 additions and 50397 deletions

View file

@ -1,83 +1,84 @@
/***************************************************************************
* ContextMenu.cs
* -------------------
* begin : May 1, 2002
* copyright : (C) The RunUO Software Team
* email : info@runuo.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* 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 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using System.Collections.Generic;
using System.Linq;
namespace Server.ContextMenus
{
/// <summary>
/// Represents the state of an active context menu. This includes who opened the menu, the menu's focus object, and a list of
/// <see cref="ContextMenuEntry">entries</see> that the menu is composed of.
/// <seealso cref="ContextMenuEntry" />
/// </summary>
public class ContextMenu
{
/// <summary>
/// Instantiates a new ContextMenu instance.
/// </summary>
/// <param name="from">
/// The <see cref="Mobile" /> who opened this ContextMenu.
/// <seealso cref="From" />
/// </param>
/// <param name="target">
/// The <see cref="Mobile" /> or <see cref="Item" /> for which this ContextMenu is on.
/// <seealso cref="Target" />
/// </param>
public ContextMenu(Mobile from, IEntity target)
{
From = from;
Target = target;
var list = new List<ContextMenuEntry>();
if (target is Mobile mobile)
mobile.GetContextMenuEntries(from, list);
else if (target is Item item)
item.GetContextMenuEntries(from, list);
Entries = list.ToArray();
for (var i = 0; i < Entries.Length; ++i)
Entries[i].Owner = this;
}
/// <summary>
/// Gets the <see cref="Mobile" /> who opened this ContextMenu.
/// </summary>
public Mobile From { get; }
/// <summary>
/// Gets an object of the <see cref="Mobile" /> or <see cref="Item" /> for which this ContextMenu is on.
/// </summary>
public IEntity Target { get; }
/// <summary>
/// Gets the list of <see cref="ContextMenuEntry">entries</see> contained in this ContextMenu.
/// </summary>
public ContextMenuEntry[] Entries { get; }
/// <summary>
/// Returns true if this ContextMenu requires packet version 2.
/// </summary>
public bool RequiresNewPacket =>
Entries.Any(t => t.Number < 3000000 || t.Number > 3032767);
}
}
/***************************************************************************
* ContextMenu.cs
* -------------------
* begin : May 1, 2002
* copyright : (C) The RunUO Software Team
* email : info@runuo.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* 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 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using System.Collections.Generic;
using System.Linq;
namespace Server.ContextMenus
{
/// <summary>
/// Represents the state of an active context menu. This includes who opened the menu, the menu's focus object, and a list
/// of
/// <see cref="ContextMenuEntry">entries</see> that the menu is composed of.
/// <seealso cref="ContextMenuEntry" />
/// </summary>
public class ContextMenu
{
/// <summary>
/// Instantiates a new ContextMenu instance.
/// </summary>
/// <param name="from">
/// The <see cref="Mobile" /> who opened this ContextMenu.
/// <seealso cref="From" />
/// </param>
/// <param name="target">
/// The <see cref="Mobile" /> or <see cref="Item" /> for which this ContextMenu is on.
/// <seealso cref="Target" />
/// </param>
public ContextMenu(Mobile from, IEntity target)
{
From = from;
Target = target;
var list = new List<ContextMenuEntry>();
if (target is Mobile mobile)
mobile.GetContextMenuEntries(from, list);
else if (target is Item item)
item.GetContextMenuEntries(from, list);
Entries = list.ToArray();
for (var i = 0; i < Entries.Length; ++i)
Entries[i].Owner = this;
}
/// <summary>
/// Gets the <see cref="Mobile" /> who opened this ContextMenu.
/// </summary>
public Mobile From { get; }
/// <summary>
/// Gets an object of the <see cref="Mobile" /> or <see cref="Item" /> for which this ContextMenu is on.
/// </summary>
public IEntity Target { get; }
/// <summary>
/// Gets the list of <see cref="ContextMenuEntry">entries</see> contained in this ContextMenu.
/// </summary>
public ContextMenuEntry[] Entries { get; }
/// <summary>
/// Returns true if this ContextMenu requires packet version 2.
/// </summary>
public bool RequiresNewPacket =>
Entries.Any(t => t.Number < 3000000 || t.Number > 3032767);
}
}