cleanup: Fixes bugs and cleans up code (#660)
This commit is contained in:
parent
1de0b656a9
commit
679e8100f4
99 changed files with 160 additions and 346 deletions
|
|
@ -35,7 +35,7 @@ namespace Server.Engines.BulkOrders
|
|||
return BulkGenericType.Iron;
|
||||
}
|
||||
|
||||
return itemType == null || itemType.IsSubclassOf(typeof(BaseArmor)) || itemType.IsSubclassOf(typeof(BaseShoes))
|
||||
return itemType?.IsSubclassOf(typeof(BaseArmor)) != false || itemType.IsSubclassOf(typeof(BaseShoes))
|
||||
? BulkGenericType.Leather
|
||||
: BulkGenericType.Cloth;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace Server.Engines.CannedEvil
|
|||
public class DungeonChampionSpawn : ChampionSpawn
|
||||
{
|
||||
[Constructible]
|
||||
public DungeonChampionSpawn() : base()
|
||||
public DungeonChampionSpawn()
|
||||
{
|
||||
CannedEvilTimer.AddSpawn(this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -772,11 +772,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
var pe = prefs.Find(players[j]);
|
||||
|
||||
if (pe.Disliked.Contains(ae.m_Arena.Name))
|
||||
{
|
||||
++ae.m_VotesAgainst;
|
||||
}
|
||||
else
|
||||
if (!pe.Disliked.Contains(ae.m_Arena.Name))
|
||||
{
|
||||
++ae.m_VotesFor;
|
||||
}
|
||||
|
|
@ -827,7 +823,6 @@ namespace Server.Engines.ConPVP
|
|||
private class ArenaEntry
|
||||
{
|
||||
public readonly Arena m_Arena;
|
||||
public int m_VotesAgainst;
|
||||
public int m_VotesFor;
|
||||
|
||||
public ArenaEntry(Arena arena) => m_Arena = arena;
|
||||
|
|
|
|||
|
|
@ -1924,24 +1924,7 @@ namespace Server.Engines.ConPVP
|
|||
var rx = dx - dy;
|
||||
var ry = dx + dy;
|
||||
|
||||
bool eastToWest;
|
||||
|
||||
if (rx >= 0 && ry >= 0)
|
||||
{
|
||||
eastToWest = false;
|
||||
}
|
||||
else if (rx >= 0)
|
||||
{
|
||||
eastToWest = true;
|
||||
}
|
||||
else if (ry >= 0)
|
||||
{
|
||||
eastToWest = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
eastToWest = false;
|
||||
}
|
||||
bool eastToWest = rx == 0 && ry >= 0 || rx >= 0 && ry == 0;
|
||||
|
||||
Effects.PlaySound(wall, Arena.Facet, 0x1F6);
|
||||
|
||||
|
|
|
|||
|
|
@ -456,8 +456,7 @@ namespace Server.Engines.ConPVP
|
|||
var point = m_Path[i];
|
||||
|
||||
var landTile = Map.Tiles.GetLandTile(point.X, point.Y);
|
||||
int landZ = 0, landAvg = 0, landTop = 0;
|
||||
Map.GetAverageZ(point.X, point.Y, ref landZ, ref landAvg, ref landTop);
|
||||
Map.GetAverageZ(point.X, point.Y, out var landZ, out _, out var landTop);
|
||||
|
||||
if (landZ <= point.Z && landTop >= point.Z && !landTile.Ignored)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ namespace Server.Engines.ConPVP
|
|||
public class TournamentBracketGump : Gump
|
||||
{
|
||||
private const int BlackColor32 = 0x000008;
|
||||
private const int LabelColor32 = 0xFFFFFF;
|
||||
private readonly Mobile m_From;
|
||||
private List<object> m_List;
|
||||
private readonly object m_Object;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.ContextMenus;
|
||||
using Server.Gumps;
|
||||
|
|
|
|||
|
|
@ -143,9 +143,9 @@ namespace Server.Engines.Craft
|
|||
{
|
||||
return expansion switch
|
||||
{
|
||||
Expansion.SE => (TextDefinition)1063363, // * Requires the "Samurai Empire" expansion
|
||||
Expansion.ML => (TextDefinition)1072651, // * Requires the "Mondain's Legacy" expansion
|
||||
_ => (TextDefinition)$"* Requires the \"{ExpansionInfo.GetInfo(expansion).Name}\" expansion"
|
||||
Expansion.SE => 1063363, // * Requires the "Samurai Empire" expansion
|
||||
Expansion.ML => 1072651, // * Requires the "Mondain's Legacy" expansion
|
||||
_ => $"* Requires the \"{ExpansionInfo.GetInfo(expansion).Name}\" expansion"
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -876,7 +876,7 @@ namespace Server.Engines.Craft
|
|||
}
|
||||
|
||||
public bool CheckSkills(
|
||||
Mobile from, Type typeRes, CraftSystem craftSystem, ref int quality, ref bool allRequiredSkills
|
||||
Mobile from, Type typeRes, CraftSystem craftSystem, ref int quality, out bool allRequiredSkills
|
||||
) =>
|
||||
CheckSkills(from, typeRes, craftSystem, ref quality, out allRequiredSkills, true);
|
||||
|
||||
|
|
@ -1132,9 +1132,7 @@ namespace Server.Engines.Craft
|
|||
var ignored = 1;
|
||||
var endquality = 1;
|
||||
|
||||
var allRequiredSkills = true;
|
||||
|
||||
if (CheckSkills(from, typeRes, craftSystem, ref ignored, ref allRequiredSkills))
|
||||
if (CheckSkills(from, typeRes, craftSystem, ref ignored, out var allRequiredSkills))
|
||||
{
|
||||
// Resource
|
||||
var resHue = 0;
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override void InitCraftList()
|
||||
{
|
||||
var index = -1;
|
||||
int index;
|
||||
|
||||
// Other Items
|
||||
if (Core.Expansion == Expansion.AOS || Core.Expansion == Expansion.SE)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Regions;
|
||||
using Server.Utilities;
|
||||
|
||||
namespace Server.Engines.Doom
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ namespace Server.Engines.Doom
|
|||
m_Tiles = new List<LeverPuzzleRegion>();
|
||||
for (; i < 9; i++)
|
||||
{
|
||||
m_Tiles.Add(new LeverPuzzleRegion(this, TA[i]));
|
||||
m_Tiles.Add(new LeverPuzzleRegion(TA[i]));
|
||||
}
|
||||
|
||||
m_Teles = new List<Item>();
|
||||
|
|
@ -400,7 +400,7 @@ namespace Server.Engines.Doom
|
|||
{
|
||||
if ((player = GetOccupant(i)) != null)
|
||||
{
|
||||
new RockTimer(player, this).Start();
|
||||
new RockTimer(player).Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -570,7 +570,7 @@ namespace Server.Engines.Doom
|
|||
m_Tiles = new List<LeverPuzzleRegion>();
|
||||
for (var i = 4; i < 9; i++)
|
||||
{
|
||||
m_Tiles.Add(new LeverPuzzleRegion(this, TA[i]));
|
||||
m_Tiles.Add(new LeverPuzzleRegion(TA[i]));
|
||||
}
|
||||
|
||||
m_LampRoom = new LampRoomRegion(this);
|
||||
|
|
@ -584,14 +584,12 @@ namespace Server.Engines.Doom
|
|||
{
|
||||
private readonly Mobile m_Player;
|
||||
private int Count;
|
||||
private LeverPuzzleController m_Controller;
|
||||
|
||||
public RockTimer(Mobile player, LeverPuzzleController controller)
|
||||
public RockTimer(Mobile player)
|
||||
: base(TimeSpan.Zero, TimeSpan.FromSeconds(.25))
|
||||
{
|
||||
Count = 0;
|
||||
m_Player = player;
|
||||
m_Controller = controller;
|
||||
}
|
||||
|
||||
private int Rock() => 0x1363 + Utility.Random(0, 11);
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ namespace Server.Engines.Doom
|
|||
{
|
||||
public Mobile m_Occupant;
|
||||
|
||||
public LeverPuzzleRegion(LeverPuzzleController controller, int[] loc)
|
||||
public LeverPuzzleRegion(int[] loc)
|
||||
: base(null, Map.Malas, Find(LeverPuzzleController.lr_Enter, Map.Malas), new Rectangle2D(loc[0], loc[1], 1, 1))
|
||||
{
|
||||
Register();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using System;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using System;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
using Server.Multis;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ namespace Server.Factions
|
|||
{
|
||||
base.InitOutfit();
|
||||
|
||||
AddItem(Utility.RandomBool() ? new QuarterStaff() : (Item)new ShepherdsCrook());
|
||||
AddItem(Utility.RandomBool() ? new QuarterStaff() : new ShepherdsCrook());
|
||||
}
|
||||
|
||||
public override void VendorBuy(Mobile from)
|
||||
|
|
|
|||
|
|
@ -168,8 +168,6 @@ namespace Server.Engines.Harvest
|
|||
return type;
|
||||
}
|
||||
|
||||
private static Map SafeMap(Map map) => map == null || map == Map.Internal ? Map.Trammel : map;
|
||||
|
||||
public override bool CheckResources(Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc, bool timed)
|
||||
{
|
||||
return from?.Backpack?.FindItemsByType<SOS>()
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ namespace Server.Engines.MLQuests.Items
|
|||
|
||||
writer.Write(0); // version
|
||||
|
||||
writer.Write(m_QuestType != null ? m_QuestType.FullName : null);
|
||||
writer.Write(m_QuestType?.FullName);
|
||||
TextDefinition.Serialize(writer, Message);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Items;
|
||||
|
|
@ -212,8 +211,8 @@ namespace Server.Movement
|
|||
var tiles = map.Tiles.GetStaticTiles(x, y, true);
|
||||
var landTile = map.Tiles.GetLandTile(x, y);
|
||||
var landData = TileData.LandTable[landTile.ID & TileData.MaxLandValue];
|
||||
var landBlocks = (landData.Flags & TileFlag.Impassable) != 0;
|
||||
var considerLand = !landTile.Ignored;
|
||||
var landBlocks = (landData.Flags & TileFlag.Impassable) != 0;
|
||||
|
||||
if (landBlocks && canSwim && (landData.Flags & TileFlag.Wet) != 0)
|
||||
{
|
||||
|
|
@ -224,9 +223,7 @@ namespace Server.Movement
|
|||
landBlocks = true;
|
||||
}
|
||||
|
||||
int landZ = 0, landCenter = 0, landTop = 0;
|
||||
|
||||
map.GetAverageZ(x, y, ref landZ, ref landCenter, ref landTop);
|
||||
map.GetAverageZ(x, y, out var landZ, out var landCenter, out _);
|
||||
|
||||
var moveIsOk = false;
|
||||
|
||||
|
|
@ -490,9 +487,7 @@ namespace Server.Movement
|
|||
landBlocks = true;
|
||||
}
|
||||
|
||||
int landZ = 0, landCenter = 0, landTop = 0;
|
||||
|
||||
map.GetAverageZ(xCheck, yCheck, ref landZ, ref landCenter, ref landTop);
|
||||
map.GetAverageZ(xCheck, yCheck, out var landZ, out var landCenter, out var landTop);
|
||||
|
||||
var considerLand = !landTile.Ignored;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
|
|
@ -429,9 +428,7 @@ namespace Server.Movement
|
|||
|
||||
var considerLand = !landTile.Ignored;
|
||||
|
||||
int landZ = 0, landCenter = 0, landTop = 0;
|
||||
|
||||
map.GetAverageZ(x, y, ref landZ, ref landCenter, ref landTop);
|
||||
map.GetAverageZ(x, y, out var landZ, out var landCenter, out _);
|
||||
|
||||
var moveIsOk = false;
|
||||
|
||||
|
|
@ -630,14 +627,13 @@ namespace Server.Movement
|
|||
int xCheck = loc.X, yCheck = loc.Y;
|
||||
|
||||
var landTile = map.Tiles.GetLandTile(xCheck, yCheck);
|
||||
int landZ = 0, landCenter = 0, landTop = 0;
|
||||
var flags = TileData.LandTable[landTile.ID & TileData.MaxLandValue].Flags;
|
||||
var impassable = (flags & TileFlag.Impassable) != 0;
|
||||
|
||||
// Impassable + swim on water is ok, otherwise block if cannot walk or impassable
|
||||
var landBlocks = (m.CantWalk || impassable) && !(impassable && m.CanSwim && (flags & TileFlag.Wet) != 0);
|
||||
|
||||
map.GetAverageZ(xCheck, yCheck, ref landZ, ref landCenter, ref landTop);
|
||||
map.GetAverageZ(xCheck, yCheck, out var landZ, out var landCenter, out var landTop);
|
||||
|
||||
var considerLand = !landTile.Ignored;
|
||||
|
||||
|
|
|
|||
|
|
@ -63,8 +63,6 @@ namespace Server.Engines.Quests.Collector
|
|||
Y = y;
|
||||
}
|
||||
|
||||
public ImageType Image { get; }
|
||||
|
||||
public int Figurine { get; }
|
||||
|
||||
public Type Type { get; }
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Commands.Generic;
|
||||
using Server.Network;
|
||||
|
||||
using static Server.Types;
|
||||
|
||||
namespace Server.Engines.Spawners
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
*************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Server.Buffers;
|
||||
using Server.Commands.Generic;
|
||||
using Server.Engines.Spawners;
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@ namespace Server.Gumps
|
|||
public ItemTileButtonInfo(Item i) : base(
|
||||
i.ItemID,
|
||||
i.Hue,
|
||||
i.Name == null || i.Name.Length <= 0 ? (TextDefinition)i.LabelNumber : (TextDefinition)i.Name
|
||||
i.Name == null || i.Name.Length <= 0 ? i.LabelNumber : i.Name
|
||||
) =>
|
||||
Item = i;
|
||||
|
||||
|
|
|
|||
|
|
@ -683,7 +683,7 @@ namespace Server.Mobiles
|
|||
return AddonFitResult.Blocked;
|
||||
}
|
||||
|
||||
if (!BaseAddon.CheckHouse(from, p, map, 20, ref house))
|
||||
if (!BaseAddon.CheckHouse(from, p, map, 20, out house))
|
||||
{
|
||||
return AddonFitResult.NotInHouse;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue