Clean up: Bugs, LINQ, constructors, default values, and null checks (#18)

This commit is contained in:
Kamron Batman 2019-03-11 14:29:59 -07:00 • committed by GitHub
parent e748af4430
commit 513e54f70e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1094 changed files with 15913 additions and 21892 deletions

View file

@ -3,7 +3,7 @@ namespace Server.Items
public class Bleach : PigmentsOfTokuno
{
[Constructible]
public Bleach() : base(PigmentType.None)
public Bleach()
{
LootType = LootType.Blessed;
}

View file

@ -3,12 +3,7 @@ namespace Server.Items
public class GamanHorns : Item
{
[Constructible]
public GamanHorns() : this(1)
{
}
[Constructible]
public GamanHorns(int amount) : base(0x1084)
public GamanHorns(int amount = 1) : base(0x1084)
{
LootType = LootType.Blessed;
Stackable = true;
@ -36,4 +31,4 @@ namespace Server.Items
int version = reader.ReadInt();
}
}
}
}

View file

@ -3,12 +3,7 @@ namespace Server.Items
public class PixieLeg : ChickenLeg
{
[Constructible]
public PixieLeg() : this(1)
{
}
[Constructible]
public PixieLeg(int amount) : base(amount)
public PixieLeg(int amount = 1) : base(amount)
{
LootType = LootType.Blessed;
Hue = 0x1C2;
@ -34,4 +29,4 @@ namespace Server.Items
int version = reader.ReadInt();
}
}
}
}

View file

@ -24,21 +24,8 @@ namespace Server.Engines.MLQuests.Items
public override bool Nontransferable => true;
public List<MLQuest> MLQuests
{
get
{
if (m_MLQuests == null)
{
m_MLQuests = MLQuestSystem.FindQuestList(GetType());
if (m_MLQuests == null)
m_MLQuests = MLQuestSystem.EmptyList;
}
return m_MLQuests;
}
}
public List<MLQuest> MLQuests => m_MLQuests ??
(m_MLQuests = MLQuestSystem.FindQuestList(GetType()) ?? MLQuestSystem.EmptyList);
public override void AddNameProperties(ObjectPropertyList list)
{
@ -101,21 +88,8 @@ namespace Server.Engines.MLQuests.Items
public override bool Nontransferable => true;
public List<MLQuest> MLQuests
{
get
{
if (m_MLQuests == null)
{
m_MLQuests = MLQuestSystem.FindQuestList(GetType());
if (m_MLQuests == null)
m_MLQuests = MLQuestSystem.EmptyList;
}
return m_MLQuests;
}
}
public List<MLQuest> MLQuests => m_MLQuests ??
(m_MLQuests = MLQuestSystem.FindQuestList(GetType()) ?? MLQuestSystem.EmptyList);
public override void HandleInvalidTransfer(Mobile from)
{
@ -163,4 +137,4 @@ namespace Server.Engines.MLQuests.Items
int version = reader.ReadInt();
}
}
}
}

View file

@ -3,12 +3,7 @@ namespace Server.Items
public class SapOfSosaria : Item
{
[Constructible]
public SapOfSosaria() : this(1)
{
}
[Constructible]
public SapOfSosaria(int amount) : base(0x1848)
public SapOfSosaria(int amount = 1) : base(0x1848)
{
LootType = LootType.Blessed;
Stackable = true;
@ -35,4 +30,4 @@ namespace Server.Items
int version = reader.ReadInt();
}
}
}
}

View file

@ -4,12 +4,7 @@ namespace Server.Items
public class SeveredElfEars : Item
{
[Constructible]
public SeveredElfEars() : this(1)
{
}
[Constructible]
public SeveredElfEars(int amount) : base(Utility.RandomList(0x312D, 0x312E))
public SeveredElfEars(int amount = 1) : base(Utility.RandomList(0x312D, 0x312E))
{
Stackable = true;
Amount = amount;
@ -33,4 +28,4 @@ namespace Server.Items
int version = reader.ReadInt();
}
}
}
}

View file

@ -4,12 +4,7 @@ namespace Server.Items
public class SeveredHumanEars : Item
{
[Constructible]
public SeveredHumanEars() : this(1)
{
}
[Constructible]
public SeveredHumanEars(int amount) : base(Utility.RandomList(0x312F, 0x3130))
public SeveredHumanEars(int amount = 1) : base(Utility.RandomList(0x312F, 0x3130))
{
Stackable = true;
Amount = amount;
@ -33,4 +28,4 @@ namespace Server.Items
int version = reader.ReadInt();
}
}
}
}

View file

@ -10,18 +10,13 @@ namespace Server.Engines.MLQuests.Items
[Constructible]
public MLQuestTeleporter()
: this(Point3D.Zero, null, null, null)
: this(Point3D.Zero)
{
}
[Constructible]
public MLQuestTeleporter(Point3D pointDest, Map mapDest)
: this(pointDest, mapDest, null, null)
{
}
[Constructible]
public MLQuestTeleporter(Point3D pointDest, Map mapDest, Type questType, TextDefinition message)
public MLQuestTeleporter(
Point3D pointDest, Map mapDest = null, Type questType = null, TextDefinition message = null)
: base(pointDest, mapDest)
{
m_QuestType = questType;
@ -110,18 +105,13 @@ namespace Server.Engines.MLQuests.Items
[Constructible]
public TicketTeleporter()
: this(Point3D.Zero, null, null, null)
: this(Point3D.Zero)
{
}
[Constructible]
public TicketTeleporter(Point3D pointDest, Map mapDest)
: this(pointDest, mapDest, null, null)
{
}
[Constructible]
public TicketTeleporter(Point3D pointDest, Map mapDest, Type ticketType, TextDefinition message)
public TicketTeleporter(
Point3D pointDest, Map mapDest = null, Type ticketType = null, TextDefinition message = null)
: base(pointDest, mapDest)
{
m_TicketType = ticketType;
@ -154,7 +144,7 @@ namespace Server.Engines.MLQuests.Items
if (m_TicketType == null)
return true;
Container pack = m.Backpack;
Item ticket = pack?.FindItemByType(m_TicketType, false) ?? m.Items.Find(item => m_TicketType.IsInstanceOfType(item));
@ -201,4 +191,4 @@ namespace Server.Engines.MLQuests.Items
Message = TextDefinition.Deserialize(reader);
}
}
}
}

View file

@ -3,12 +3,7 @@ namespace Server.Items
public class UnicornRibs : Item
{
[Constructible]
public UnicornRibs() : this(1)
{
}
[Constructible]
public UnicornRibs(int amount) : base(0x9F1)
public UnicornRibs(int amount = 1) : base(0x9F1)
{
LootType = LootType.Blessed;
Hue = 0x14B;
@ -36,4 +31,4 @@ namespace Server.Items
int version = reader.ReadInt();
}
}
}
}