Clean up: Bugs, LINQ, constructors, default values, and null checks (#18)
This commit is contained in:
parent
e748af4430
commit
513e54f70e
1094 changed files with 15913 additions and 21892 deletions
|
|
@ -6,17 +6,9 @@ namespace Server.Engines.MLQuests.Objectives
|
|||
{
|
||||
public class KillObjective : BaseObjective
|
||||
{
|
||||
public KillObjective()
|
||||
: this(0, null, null, null)
|
||||
{
|
||||
}
|
||||
|
||||
public KillObjective(int amount, Type[] types, TextDefinition name)
|
||||
: this(amount, types, name, null)
|
||||
{
|
||||
}
|
||||
|
||||
public KillObjective(int amount, Type[] types, TextDefinition name, QuestArea area)
|
||||
public KillObjective(
|
||||
int amount = 0, Type[] types = null, TextDefinition name = null, QuestArea area = null)
|
||||
{
|
||||
DesiredAmount = amount;
|
||||
AcceptedTypes = types;
|
||||
|
|
@ -36,11 +28,11 @@ namespace Server.Engines.MLQuests.Objectives
|
|||
{
|
||||
string amount = DesiredAmount.ToString();
|
||||
|
||||
g.AddHtmlLocalized(98, y, 312, 16, 1072204, 0x15F90, false, false); // Slay
|
||||
g.AddHtmlLocalized(98, y, 312, 16, 1072204, 0x15F90); // Slay
|
||||
g.AddLabel(133, y, 0x481, amount);
|
||||
|
||||
if (Name.Number > 0)
|
||||
g.AddHtmlLocalized(133 + amount.Length * 15, y, 190, 18, Name.Number, 0x77BF, false, false);
|
||||
g.AddHtmlLocalized(133 + amount.Length * 15, y, 190, 18, Name.Number, 0x77BF);
|
||||
else if (Name.String != null)
|
||||
g.AddLabel(133 + amount.Length * 15, y, 0x481, Name.String);
|
||||
|
||||
|
|
@ -50,10 +42,10 @@ namespace Server.Engines.MLQuests.Objectives
|
|||
|
||||
if (Area != null)
|
||||
{
|
||||
g.AddHtmlLocalized(103, y, 312, 20, 1018327, 0x15F90, false, false); // Location
|
||||
g.AddHtmlLocalized(103, y, 312, 20, 1018327, 0x15F90); // Location
|
||||
|
||||
if (Area.Name.Number > 0)
|
||||
g.AddHtmlLocalized(223, y, 312, 20, Area.Name.Number, 0xFFFFFF, false, false);
|
||||
g.AddHtmlLocalized(223, y, 312, 20, Area.Name.Number, 0xFFFFFF);
|
||||
else if (Area.Name.String != null)
|
||||
g.AddLabel(223, y, 0x481, Area.Name.String);
|
||||
|
||||
|
|
@ -73,12 +65,7 @@ namespace Server.Engines.MLQuests.Objectives
|
|||
|
||||
public class TimedKillObjective : KillObjective
|
||||
{
|
||||
public TimedKillObjective(TimeSpan duration, int amount, Type[] types, TextDefinition name)
|
||||
: this(duration, amount, types, name, null)
|
||||
{
|
||||
}
|
||||
|
||||
public TimedKillObjective(TimeSpan duration, int amount, Type[] types, TextDefinition name, QuestArea area)
|
||||
public TimedKillObjective(TimeSpan duration, int amount, Type[] types, TextDefinition name, QuestArea area = null)
|
||||
: base(amount, types, name, area)
|
||||
{
|
||||
Duration = duration;
|
||||
|
|
@ -112,7 +99,7 @@ namespace Server.Engines.MLQuests.Objectives
|
|||
foreach (Type acceptedType in Objective.AcceptedTypes)
|
||||
if (acceptedType.IsAssignableFrom(type))
|
||||
{
|
||||
if (Objective.Area != null && !Objective.Area.Contains(mob))
|
||||
if (Objective.Area?.Contains(mob) == false)
|
||||
return false;
|
||||
|
||||
PlayerMobile pm = Instance.Player;
|
||||
|
|
@ -140,11 +127,11 @@ namespace Server.Engines.MLQuests.Objectives
|
|||
|
||||
base.WriteToGump(g, ref y);
|
||||
|
||||
g.AddHtmlLocalized(103, y, 120, 16, 3000087, 0x15F90, false, false); // Total
|
||||
g.AddHtmlLocalized(103, y, 120, 16, 3000087, 0x15F90); // Total
|
||||
g.AddLabel(223, y, 0x481, Slain.ToString());
|
||||
y += 16;
|
||||
|
||||
g.AddHtmlLocalized(103, y, 120, 16, 1074782, 0x15F90, false, false); // Return to
|
||||
g.AddHtmlLocalized(103, y, 120, 16, 1074782, 0x15F90); // Return to
|
||||
g.AddLabel(223, y, 0x481, QuesterNameAttribute.GetQuesterNameFor(Instance.QuesterType));
|
||||
y += 16;
|
||||
}
|
||||
|
|
@ -156,4 +143,4 @@ namespace Server.Engines.MLQuests.Objectives
|
|||
writer.Write(Slain);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue