Cleanup & Fixes for .NET 5 (#309)

- [X] Fixes several bugs
- [X] Updates more ordinal issues
- [X] Cleans up the code a bit
- [X] Turns classes static that should have been
- [X] Changes TcpServer.Instances to a HashSet

Bumps release version
This commit is contained in:
Kamron Batman 2020-11-15 10:03:50 -08:00 • committed by GitHub
parent 4ad8811df2
commit 525cda5413
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
266 changed files with 1348 additions and 1800 deletions

View file

@ -92,15 +92,7 @@ namespace Server.Mobiles
public override DeathMoveResult GetInventoryMoveResultFor(Item item) => DeathMoveResult.MoveToCorpse;
public override bool IsSnoop(Mobile from)
{
if (PackAnimal.CheckAccess(this, from))
{
return false;
}
return base.IsSnoop(from);
}
public override bool IsSnoop(Mobile from) => !PackAnimal.CheckAccess(this, from) && base.IsSnoop(from);
public override bool OnDragDrop(Mobile from, Item item)
{
@ -157,7 +149,7 @@ namespace Server.Mobiles
}
}
public class PackAnimal
public static class PackAnimal
{
public static void GetContextMenuEntries(BaseCreature animal, Mobile from, List<ContextMenuEntry> list)
{
@ -167,21 +159,10 @@ namespace Server.Mobiles
}
}
public static bool CheckAccess(BaseCreature animal, Mobile from)
{
if (from == animal || from.AccessLevel >= AccessLevel.GameMaster)
{
return true;
}
if (from.Alive && animal.Controlled && !animal.IsDeadPet &&
(from == animal.ControlMaster || from == animal.SummonMaster || animal.IsPetFriend(from)))
{
return true;
}
return false;
}
public static bool CheckAccess(BaseCreature animal, Mobile from) =>
from == animal || from.AccessLevel >= AccessLevel.GameMaster || from.Alive && animal.Controlled &&
!animal.IsDeadPet &&
(from == animal.ControlMaster || from == animal.SummonMaster || animal.IsPetFriend(from));
public static void CombineBackpacks(BaseCreature animal)
{

View file

@ -43,8 +43,7 @@ namespace Server.Mobiles
public virtual bool AllowMaleRider => true;
public virtual bool AllowFemaleRider => true;
[Hue]
[CommandProperty(AccessLevel.GameMaster)]
[Hue, CommandProperty(AccessLevel.GameMaster)]
public override int Hue
{
get => base.Hue;

View file

@ -141,7 +141,7 @@ namespace Server.Mobiles
if (Core.ML && IsRewardItem)
{
list.Add(RewardSystem.GetRewardYearLabel(this, new object[] { })); // X Year Veteran Reward
list.Add(RewardSystem.GetRewardYearLabel(this, Array.Empty<object>())); // X Year Veteran Reward
}
}

View file

@ -1361,7 +1361,7 @@ namespace Server.Mobiles
from.Damage(amount, from);
}
base.Damage(amount, from);
base.Damage(amount, from, informMount);
if (SubdueBeforeTame && !Controlled && oldHits > HitsMax / 10 && Hits <= HitsMax / 10)
{

View file

@ -3,7 +3,7 @@ using Server.Network;
namespace Server.Mobiles
{
public class SolenHelper
public static class SolenHelper
{
public static void PackPicnicBasket(BaseCreature solen)
{

View file

@ -113,7 +113,7 @@ namespace Server.Mobiles
}
Effects.PlaySound(this, GetDeathSound());
Effects.SendLocationEffect(Location, Map, 0x3709, 30, 10, 0x835, 0);
Effects.SendLocationEffect(Location, Map, 0x3709, 30, 10, 0x835);
rm.MoveToWorld(Location, Map);
Delete();

View file

@ -67,7 +67,7 @@ namespace Server.Mobiles
public override string CorpseName => "a corpse of Ilhenir";
public override ChampionSkullType SkullType => ChampionSkullType.Pain;
public override Type[] UniqueList => new Type[] { };
public override Type[] UniqueList => Array.Empty<Type>();
public override Type[] SharedList => new[]
{

View file

@ -62,7 +62,7 @@ namespace Server.Mobiles
public override ChampionSkullType SkullType => ChampionSkullType.Pain;
public override Type[] UniqueList => new[] { typeof(Subdue) };
public override Type[] SharedList => new Type[] { };
public override Type[] SharedList => Array.Empty<Type>();
public override Type[] DecorativeList => new[]
{

View file

@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using Server.Engines.Plants;
using Server.Items;
using Server.Network;
namespace Server.Mobiles
{
@ -96,9 +95,7 @@ namespace Server.Mobiles
Location,
to.Location,
10,
0,
false,
false
0
);
AOS.Damage(to, this, Utility.RandomMinMax(50, 65), 100, 0, 0, 0, 0);

View file

@ -1749,9 +1749,7 @@ namespace Server.Mobiles
if (item is BaseArmor || item is BaseWeapon)
{
Hits = Hits;
Stam = Stam;
Mana = Mana;
CheckStatTimers();
}
if (NetState != null)
@ -1766,9 +1764,7 @@ namespace Server.Mobiles
if (item is BaseArmor || item is BaseWeapon)
{
Hits = Hits;
Stam = Stam;
Mana = Mana;
CheckStatTimers();
}
if (NetState != null)
@ -1876,12 +1872,7 @@ namespace Server.Mobiles
}
}
if (DuelContext?.AllowSkillUse(this, skill) == false)
{
return false;
}
return DesignContext.Check(this);
return DuelContext?.AllowSkillUse(this, skill) != false && DesignContext.Check(this);
}
public virtual void RecheckTownProtection()

View file

@ -71,7 +71,7 @@ namespace Server.Mobiles
typeof(DirtPatch)
};
public override MonsterStatuetteType[] StatueTypes => new MonsterStatuetteType[] { };
public override MonsterStatuetteType[] StatueTypes => Array.Empty<MonsterStatuetteType>();
public override string DefaultName => "Lord Oaks";

View file

@ -82,7 +82,7 @@ namespace Server.Mobiles
public override Type[] DecorativeList => new[] { typeof(WallBlood), typeof(TatteredAncientMummyWrapping) };
public override MonsterStatuetteType[] StatueTypes => new MonsterStatuetteType[] { };
public override MonsterStatuetteType[] StatueTypes => Array.Empty<MonsterStatuetteType>();
public override string DefaultName => "Neira";

View file

@ -4,7 +4,7 @@ using Server.Utilities;
namespace Server.Mobiles
{
public class Paragon
public static class Paragon
{
public static double ChestChance = .10; // Chance that a paragon will carry a paragon chest
public static double ChocolateIngredientChance = .20; // Chance that a paragon will drop a chocolatiering ingredient

View file

@ -56,7 +56,7 @@ namespace Server.Mobiles
public override Type[] DecorativeList => new[] { typeof(LavaTile), typeof(DemonSkull) };
public override MonsterStatuetteType[] StatueTypes => new MonsterStatuetteType[] { };
public override MonsterStatuetteType[] StatueTypes => Array.Empty<MonsterStatuetteType>();
public override string DefaultName => "Semidar";

View file

@ -63,7 +63,7 @@ namespace Server.Mobiles
public override Type[] DecorativeList => new[] { typeof(Futon), typeof(SwampTile) };
public override MonsterStatuetteType[] StatueTypes => new MonsterStatuetteType[] { };
public override MonsterStatuetteType[] StatueTypes => Array.Empty<MonsterStatuetteType>();
public override string DefaultName => "Serado";

View file

@ -89,8 +89,7 @@ namespace Server.Mobiles
CommandSystem.Register("TownCriers", AccessLevel.GameMaster, TownCriers_OnCommand);
}
[Usage("TownCriers")]
[Description("Manages the global town crier list.")]
[Usage("TownCriers"), Description("Manages the global town crier list.")]
public static void TownCriers_OnCommand(CommandEventArgs e)
{
e.Mobile.SendGump(new TownCrierGump(e.Mobile, Instance));

View file

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using Server.ContextMenus;
using Server.Gumps;
@ -386,7 +387,7 @@ namespace Server.Mobiles
CloseClaimList(e.Mobile);
var index = e.Speech.IndexOf(' ');
var index = e.Speech.IndexOf(' ', StringComparison.Ordinal);
if (index != -1)
{