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

@ -15,7 +15,7 @@ namespace Server.Engines.Quests.Ambitious
{
// Red/Black Solen Queens killed:
gump.AddHtmlLocalized(70, 260, 270, 100, ((AmbitiousQueenQuest)System).RedSolen ? 1054064 : 1054065,
BaseQuestGump.Blue, false, false);
BaseQuestGump.Blue);
gump.AddLabel(70, 280, 0x64, CurProgress.ToString());
gump.AddLabel(100, 280, 0x64, "/");
gump.AddLabel(130, 280, 0x64, MaxProgress.ToString());

View file

@ -102,7 +102,7 @@ namespace Server.Engines.Quests.Collector
AddImageTiled(35, 150, 120, 100, 0x24B1);
AddImage(35, 300, 0x24B4);
AddHtmlLocalized(110, 60, 200, 20, 1049069, White, false, false); // <STRONG>Conversation Event</STRONG>
AddHtmlLocalized(110, 60, 200, 20, 1049069, White); // <STRONG>Conversation Event</STRONG>
AddImage(65, 14, 0x2776);
AddImageTiled(81, 14, 349, 17, 0x2775);
@ -121,12 +121,12 @@ namespace Server.Engines.Quests.Collector
true); // Sure, I have some sheet music for a Gabriel Piete song. I'd be happy to sell you a copy for 10 gold.
AddRadio(85, 350, 0x25F8, 0x25FB, true, 1);
AddHtmlLocalized(120, 356, 280, 20, 1014088, White, false, false); // I accept.
AddHtmlLocalized(120, 356, 280, 20, 1014088, White); // I accept.
AddRadio(85, 385, 0x25F8, 0x25FB, false, 0);
AddHtmlLocalized(120, 391, 280, 20, 1049012, White, false, false); // No thanks, I decline.
AddHtmlLocalized(120, 391, 280, 20, 1049012, White); // No thanks, I decline.
AddButton(340, 390, 0xF7, 0xF8, 1, GumpButtonType.Reply, 0);
AddButton(340, 390, 0xF7, 0xF8, 1);
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -143,15 +143,14 @@ namespace Server.Engines.Quests.Collector
if (obj?.Completed != false)
return;
if (player.Backpack != null && player.Backpack.ConsumeTotal(typeof(Gold), 10))
if (player.Backpack?.ConsumeTotal(typeof(Gold), 10) == true)
{
obj.Complete();
}
else
{
BankBox bank = player.FindBankNoCreate();
if (bank != null && bank.ConsumeTotal(typeof(Gold), 10))
if (player.FindBankNoCreate()?.ConsumeTotal(typeof(Gold), 10) == true)
obj.Complete();
else
@ -161,4 +160,4 @@ namespace Server.Engines.Quests.Collector
}
}
}
}
}

View file

@ -27,11 +27,7 @@ namespace Server.Engines.Quests
{
protected List<SBInfo> m_SBInfos = new List<SBInfo>();
public BaseQuester() : this(null)
{
}
public BaseQuester(string title) : base(title)
public BaseQuester(string title = null) : base(title)
{
}
@ -122,4 +118,4 @@ namespace Server.Engines.Quests
int version = reader.ReadInt();
}
}
}
}

View file

@ -4,11 +4,7 @@ namespace Server.Engines.Quests
{
public abstract class DynamicTeleporter : Item
{
public DynamicTeleporter() : this(0x1822, 0x482)
{
}
public DynamicTeleporter(int itemID, int hue) : base(itemID)
public DynamicTeleporter(int itemID = 0x1822, int hue = 0x482) : base(itemID)
{
Movable = false;
Hue = hue;
@ -62,4 +58,4 @@ namespace Server.Engines.Quests
int version = reader.ReadInt();
}
}
}
}

View file

@ -81,7 +81,7 @@ namespace Server.Engines.Quests
AddImageTiled(35, 150, 120, 100, 9393);
AddImage(35, 250, 9396);
AddHtmlLocalized(110, 60, 200, 20, 1049069, White, false, false); // <STRONG>Conversation Event</STRONG>
AddHtmlLocalized(110, 60, 200, 20, 1049069, White); // <STRONG>Conversation Event</STRONG>
AddImage(65, 14, 10102);
AddImageTiled(81, 14, 349, 17, 10101);
@ -94,7 +94,7 @@ namespace Server.Engines.Quests
AddImage(75, 58, 9781);
AddImage(380, 45, 223);
AddButton(220, 335, 2313, 2312, 1, GumpButtonType.Reply, 0);
AddButton(220, 335, 2313, 2312, 1);
AddImage(0, 0, 10440);
AddPage(1);
@ -106,7 +106,7 @@ namespace Server.Engines.Quests
if (i > 0)
{
AddButton(65, 366, 9909, 9911, 0, GumpButtonType.Page, 1 + i);
AddHtmlLocalized(90, 367, 50, 20, 1043354, Black, false, false); // Previous
AddHtmlLocalized(90, 367, 50, 20, 1043354, Black); // Previous
AddPage(1 + i);
}
@ -116,7 +116,7 @@ namespace Server.Engines.Quests
if (i > 0)
{
AddButton(420, 366, 9903, 9905, 0, GumpButtonType.Page, i);
AddHtmlLocalized(370, 367, 50, 20, 1043353, Black, false, false); // Next
AddHtmlLocalized(370, 367, 50, 20, 1043353, Black); // Next
}
}
}
@ -135,4 +135,4 @@ namespace Server.Engines.Quests
}
}
}
}
}

View file

@ -37,13 +37,13 @@ namespace Server.Engines.Quests
AddImageTiled(131, 20, 10, height - 30, 2624);
AddAlphaRegion(131, 20, 10, height - 30);
AddHtmlLocalized(67, 35, 120, 20, 1011233, White, false, false); // INFO
AddHtmlLocalized(67, 35, 120, 20, 1011233, White); // INFO
AddImage(62, 52, 9157);
AddImage(72, 52, 9157);
AddImage(82, 52, 9157);
AddButton(25, 31, 1209, 1210, 777, GumpButtonType.Reply, 0);
AddButton(25, 31, 1209, 1210, 777);
AddPage(1);
@ -56,4 +56,4 @@ namespace Server.Engines.Quests
}
}
}
}
}

View file

@ -147,12 +147,12 @@ namespace Server.Engines.Quests
AddImage(20, 5, 1417);
AddHtmlLocalized(0, 78, 120, 40, 1049079, White, false, false); // Quest Log Updated
AddHtmlLocalized(0, 78, 120, 40, 1049079, White); // Quest Log Updated
AddImageTiled(0, 78, 120, 40, 2624);
AddAlphaRegion(0, 78, 120, 40);
AddButton(30, 15, 5575, 5576, 1, GumpButtonType.Reply, 0);
AddButton(30, 15, 5575, 5576, 1);
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -193,20 +193,20 @@ namespace Server.Engines.Quests
AddImage(20, 87, 1231);
AddImage(75, 62, 9307);
AddHtmlLocalized(117, 35, 230, 20, 1046026, Blue, false, false); // Quest Log
AddHtmlLocalized(117, 35, 230, 20, 1046026, Blue); // Quest Log
AddImage(77, 33, 9781);
AddImage(65, 110, 2104);
AddHtmlLocalized(79, 106, 230, 20, 1049073, Blue, false, false); // Objective:
AddHtmlLocalized(79, 106, 230, 20, 1049073, Blue); // Objective:
AddImageTiled(68, 125, 120, 1, 9101);
AddImage(65, 240, 2104);
AddHtmlLocalized(79, 237, 230, 20, 1049076, Blue, false, false); // Progress details:
AddHtmlLocalized(79, 237, 230, 20, 1049076, Blue); // Progress details:
AddImageTiled(68, 255, 120, 1, 9101);
AddButton(175, 355, 2313, 2312, 1, GumpButtonType.Reply, 0);
AddButton(175, 355, 2313, 2312, 1);
AddImage(341, 15, 10450);
AddImage(341, 330, 10450);
@ -222,7 +222,7 @@ namespace Server.Engines.Quests
if (i > 0)
{
AddButton(55, 346, 9909, 9911, 0, GumpButtonType.Page, 1 + i);
AddHtmlLocalized(82, 347, 50, 20, 1043354, White, false, false); // Previous
AddHtmlLocalized(82, 347, 50, 20, 1043354, White); // Previous
AddPage(1 + i);
}
@ -233,7 +233,7 @@ namespace Server.Engines.Quests
if (i > 0)
{
AddButton(317, 346, 9903, 9905, 0, GumpButtonType.Page, i);
AddHtmlLocalized(278, 347, 50, 20, 1043353, White, false, false); // Next
AddHtmlLocalized(278, 347, 50, 20, 1043353, White); // Next
}
}
}
@ -252,4 +252,4 @@ namespace Server.Engines.Quests
}
}
}
}
}

View file

@ -512,34 +512,31 @@ namespace Server.Engines.Quests
AddImage(2, 248, 10006);
AddImage(2, 2, 10006);
AddHtmlLocalized(25, 22, 200, 20, 1049000, 32000, false, false); // Confirm Quest Cancellation
AddHtmlLocalized(25, 22, 200, 20, 1049000, 32000); // Confirm Quest Cancellation
AddImage(25, 40, 3007);
if (system.IsTutorial)
{
AddHtmlLocalized(25, 55, 300, 120, 1060836, White, false,
false); // This quest will give you valuable information, skills and equipment that will help you advance in the game at a quicker pace.<BR><BR>Are you certain you wish to cancel at this time?
AddHtmlLocalized(25, 55, 300, 120, 1060836, White); // This quest will give you valuable information, skills and equipment that will help you advance in the game at a quicker pace.<BR><BR>Are you certain you wish to cancel at this time?
}
else
{
AddHtmlLocalized(25, 60, 300, 20, 1049001, White, false, false); // You have chosen to abort your quest:
AddHtmlLocalized(25, 60, 300, 20, 1049001, White); // You have chosen to abort your quest:
AddImage(25, 81, 0x25E7);
AddHtmlObject(48, 80, 280, 20, system.Name, DarkGreen, false, false);
AddHtmlLocalized(25, 120, 280, 20, 1049002, White, false,
false); // Can this quest be restarted after quitting?
AddHtmlLocalized(25, 120, 280, 20, 1049002, White); // Can this quest be restarted after quitting?
AddImage(25, 141, 0x25E7);
AddHtmlLocalized(48, 140, 280, 20, system.RestartDelay < TimeSpan.MaxValue ? 1049016 : 1049017, DarkGreen,
false, false); // Yes/No
AddHtmlLocalized(48, 140, 280, 20, system.RestartDelay < TimeSpan.MaxValue ? 1049016 : 1049017, DarkGreen); // Yes/No
}
AddRadio(25, 175, 9720, 9723, true, 1);
AddHtmlLocalized(60, 180, 280, 20, 1049005, White, false, false); // Yes, I really want to quit!
AddHtmlLocalized(60, 180, 280, 20, 1049005, White); // Yes, I really want to quit!
AddRadio(25, 210, 9720, 9723, false, 0);
AddHtmlLocalized(60, 215, 280, 20, 1049006, White, false, false); // No, I don't want to quit.
AddHtmlLocalized(60, 215, 280, 20, 1049006, White); // No, I don't want to quit.
AddButton(265, 220, 247, 248, 1, GumpButtonType.Reply, 0);
AddButton(265, 220, 247, 248, 1);
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -565,7 +562,7 @@ namespace Server.Engines.Quests
AddAlphaRegion(50, 20, 400, 400);
AddImage(90, 33, 9005);
AddHtmlLocalized(130, 45, 270, 20, 1049010, White, false, false); // Quest Offer
AddHtmlLocalized(130, 45, 270, 20, 1049010, White); // Quest Offer
AddImageTiled(130, 65, 175, 1, 9101);
AddImage(140, 110, 1209);
@ -574,12 +571,12 @@ namespace Server.Engines.Quests
AddHtmlObject(98, 140, 312, 200, system.OfferMessage, LightGreen, false, true);
AddRadio(85, 350, 9720, 9723, true, 1);
AddHtmlLocalized(120, 356, 280, 20, 1049011, White, false, false); // I accept!
AddHtmlLocalized(120, 356, 280, 20, 1049011, White); // I accept!
AddRadio(85, 385, 9720, 9723, false, 0);
AddHtmlLocalized(120, 391, 280, 20, 1049012, White, false, false); // No thanks, I decline.
AddHtmlLocalized(120, 391, 280, 20, 1049012, White); // No thanks, I decline.
AddButton(340, 390, 247, 248, 1, GumpButtonType.Reply, 0);
AddButton(340, 390, 247, 248, 1);
AddImageTiled(50, 29, 30, 390, 10460);
AddImageTiled(34, 140, 17, 279, 9263);

View file

@ -65,7 +65,7 @@ namespace Server.Engines.Quests.Necro
{
if (!m_ToDelete && !Frozen)
{
if (m_Necromancer == null || m_Necromancer.Deleted || m_Necromancer.Map == Map.Internal)
if (m_Necromancer?.Deleted != false || m_Necromancer.Map == Map.Internal)
{
Delete();
return;
@ -240,4 +240,4 @@ namespace Server.Engines.Quests.Necro
Delete();
}
}
}
}

View file

@ -184,7 +184,7 @@ namespace Server.Engines.Quests.Ninja
if (!Completed)
{
// Henchmen killed:
gump.AddHtmlLocalized(70, 260, 270, 100, 1063207, BaseQuestGump.Blue, false, false);
gump.AddHtmlLocalized(70, 260, 270, 100, 1063207, BaseQuestGump.Blue);
gump.AddLabel(70, 280, 0x64, CurProgress.ToString());
gump.AddLabel(100, 280, 0x64, "/");
gump.AddLabel(130, 280, 0x64, MaxProgress.ToString());

View file

@ -15,7 +15,7 @@ namespace Server.Engines.Quests.Matriarch
{
// Black/Red Solen Infiltrators killed:
gump.AddHtmlLocalized(70, 260, 270, 100, ((SolenMatriarchQuest)System).RedSolen ? 1054088 : 1054087,
BaseQuestGump.Blue, false, false);
BaseQuestGump.Blue);
gump.AddLabel(70, 280, 0x64, CurProgress.ToString());
gump.AddLabel(100, 280, 0x64, "/");
gump.AddLabel(130, 280, 0x64, MaxProgress.ToString());
@ -80,8 +80,7 @@ namespace Server.Engines.Quests.Matriarch
{
if (!Completed)
{
gump.AddHtmlLocalized(70, 260, 270, 100, 1054093, BaseQuestGump.Blue, false,
false); // Gallons of Water gathered:
gump.AddHtmlLocalized(70, 260, 270, 100, 1054093, BaseQuestGump.Blue); // Gallons of Water gathered:
gump.AddLabel(70, 280, 0x64, (CurProgress / 5).ToString());
gump.AddLabel(100, 280, 0x64, "/");
gump.AddLabel(130, 280, 0x64, (MaxProgress / 5).ToString());

View file

@ -116,7 +116,7 @@ namespace Server.Engines.Quests.Naturalist
if (study.StudiedSpecialNest)
{
reward = new Seed(type, PlantHue.FireRed, false);
reward = new Seed(type, PlantHue.FireRed);
}
else
{
@ -134,7 +134,7 @@ namespace Server.Engines.Quests.Naturalist
break;
}
reward = new Seed(type, hue, false);
reward = new Seed(type, hue);
}
if (player.PlaceInBackpack(reward))

View file

@ -1,3 +1,5 @@
using System.Linq;
namespace Server.Engines.Quests.Naturalist
{
public class NestArea
@ -27,17 +29,7 @@ namespace Server.Engines.Quests.Naturalist
m_Rects = rects;
}
public static int NonSpecialCount
{
get
{
int n = 0;
foreach (NestArea area in m_Areas)
if (!area.Special)
n++;
return n;
}
}
public static int NonSpecialCount => m_Areas.Count(area => !area.Special);
public bool Special{ get; }
@ -54,10 +46,7 @@ namespace Server.Engines.Quests.Naturalist
public static NestArea Find(IPoint2D p)
{
foreach (NestArea area in m_Areas)
if (area.Contains(p))
return area;
return null;
return m_Areas.FirstOrDefault(area => area.Contains(p));
}
public static NestArea GetByID(int id)
@ -69,10 +58,7 @@ namespace Server.Engines.Quests.Naturalist
public bool Contains(IPoint2D p)
{
foreach (Rectangle2D rect in m_Rects)
if (rect.Contains(p))
return true;
return false;
return m_Rects.Any(rect => rect.Contains(p));
}
}
}

View file

@ -114,7 +114,7 @@ namespace Server.Engines.Quests.Naturalist
{
if (!Completed)
{
gump.AddHtmlLocalized(70, 260, 270, 100, 1054055, BaseQuestGump.Blue, false, false); // Solen Nests Studied :
gump.AddHtmlLocalized(70, 260, 270, 100, 1054055, BaseQuestGump.Blue); // Solen Nests Studied :
gump.AddLabel(70, 280, 0x64, CurProgress.ToString());
gump.AddLabel(100, 280, 0x64, "/");
gump.AddLabel(130, 280, 0x64, MaxProgress.ToString());
@ -171,7 +171,7 @@ namespace Server.Engines.Quests.Naturalist
{
string count = NestArea.NonSpecialCount.ToString();
gump.AddHtmlLocalized(70, 260, 270, 100, 1054055, BaseQuestGump.Blue, false, false); // Solen Nests Studied :
gump.AddHtmlLocalized(70, 260, 270, 100, 1054055, BaseQuestGump.Blue); // Solen Nests Studied :
gump.AddLabel(70, 280, 0x64, count);
gump.AddLabel(100, 280, 0x64, "/");
gump.AddLabel(130, 280, 0x64, count);

View file

@ -12,7 +12,7 @@ namespace Server.Engines.Quests.Zento
if (!Completed)
{
// Deathwatch Beetle Hatchlings killed:
gump.AddHtmlLocalized(70, 260, 270, 100, 1063318, 0x12DC6BF, false, false);
gump.AddHtmlLocalized(70, 260, 270, 100, 1063318, 0x12DC6BF);
gump.AddLabel(70, 280, 0x64, "0");
gump.AddLabel(100, 280, 0x64, "/");
@ -45,7 +45,7 @@ namespace Server.Engines.Quests.Zento
if (!Completed)
{
// Deathwatch Beetle Hatchlings killed:
gump.AddHtmlLocalized(70, 260, 270, 100, 1063318, 0x12DC6BF, false, false);
gump.AddHtmlLocalized(70, 260, 270, 100, 1063318, 0x12DC6BF);
gump.AddLabel(70, 280, 0x64, "1");
gump.AddLabel(100, 280, 0x64, "/");
@ -96,7 +96,7 @@ namespace Server.Engines.Quests.Zento
if (!Completed)
{
// Deathwatch Beetle Hatchlings killed:
gump.AddHtmlLocalized(70, 260, 270, 100, 1063318, 0x12DC6BF, false, false);
gump.AddHtmlLocalized(70, 260, 270, 100, 1063318, 0x12DC6BF);
gump.AddLabel(70, 280, 0x64, CurProgress.ToString());
gump.AddLabel(100, 280, 0x64, "/");

View file

@ -39,12 +39,12 @@ namespace Server.Engines.Quests.Doom
public virtual void BeginSummon(Mobile from)
{
if (Chyloth != null && !Chyloth.Deleted)
if (Chyloth?.Deleted == false)
{
from.SendLocalizedMessage(
1050010); // The ferry man has already been summoned. There is no need to ring for him again.
}
else if (Dragon != null && !Dragon.Deleted)
else if (Dragon?.Deleted == false)
{
from.SendLocalizedMessage(
1050017); // The ferryman has recently been summoned already. You decide against ringing the bell again so soon.
@ -83,9 +83,8 @@ namespace Server.Engines.Quests.Doom
2023, 0);
Effects.PlaySound(loc, Map, 0x1FE);
Chyloth = new Chyloth();
Chyloth = new Chyloth { Direction = (Direction)(7 & (4 + (int)from.GetDirectionTo(loc))) };
Chyloth.Direction = (Direction)(7 & (4 + (int)from.GetDirectionTo(loc)));
Chyloth.MoveToWorld(loc, Map);
Chyloth.Bell = this;
@ -117,4 +116,4 @@ namespace Server.Engines.Quests.Doom
Chyloth?.Delete();
}
}
}
}

View file

@ -254,16 +254,14 @@ namespace Server.Engines.Quests.Doom
AddImageTiled(15, 15, 365, 190, 2624);
AddRadio(30, 140, 9727, 9730, true, 1);
AddHtmlLocalized(65, 145, 300, 25, 1050050, 0x7FFF, false, false); // Yes, let's go!
AddHtmlLocalized(65, 145, 300, 25, 1050050, 0x7FFF); // Yes, let's go!
AddRadio(30, 175, 9727, 9730, false, 0);
AddHtmlLocalized(65, 178, 300, 25, 1050049, 0x7FFF, false, false); // No thanks, I'd rather stay here.
AddHtmlLocalized(65, 178, 300, 25, 1050049, 0x7FFF); // No thanks, I'd rather stay here.
AddHtmlLocalized(30, 20, 360, 35, 1050047, 0x7FFF, false,
false); // Another player has paid Chyloth for your passage across lake Mortis:
AddHtmlLocalized(30, 20, 360, 35, 1050047, 0x7FFF); // Another player has paid Chyloth for your passage across lake Mortis:
AddHtmlLocalized(30, 105, 345, 40, 1050048, 0x5B2D, false,
false); // Do you wish to accept their invitation at this time?
AddHtmlLocalized(30, 105, 345, 40, 1050048, 0x5B2D); // Do you wish to accept their invitation at this time?
AddImage(65, 72, 5605);
@ -272,7 +270,7 @@ namespace Server.Engines.Quests.Doom
AddLabel(90, 70, 1645, leader.Name);
AddButton(290, 175, 247, 248, 2, GumpButtonType.Reply, 0);
AddButton(290, 175, 247, 248, 2);
AddImageTiled(15, 14, 365, 1, 9107);
AddImageTiled(380, 14, 1, 190, 9105);
@ -308,4 +306,4 @@ namespace Server.Engines.Quests.Doom
}
}
}
}
}

View file

@ -28,7 +28,7 @@ namespace Server.Engines.Quests.Doom
{
get
{
if (m_Altar == null || m_Altar.Deleted || m_Altar.Map != Map ||
if (m_Altar?.Deleted != false || m_Altar.Map != Map ||
!Utility.InRange(m_Altar.Location, Location, AltarRange))
foreach (Item item in GetItemsInRange(AltarRange))
if (item is SummoningAltar altar)
@ -143,4 +143,4 @@ namespace Server.Engines.Quests.Doom
int version = reader.ReadInt();
}
}
}
}

View file

@ -77,7 +77,7 @@ namespace Server.Engines.Quests.Doom
QuestObjective obj = FindObjective<CollectBonesObjective>();
if (obj != null && obj.CurProgress > 0)
if (obj?.CurProgress > 0)
{
From.BankBox.DropItem(new DaemonBone(obj.CurProgress));
@ -109,4 +109,4 @@ namespace Server.Engines.Quests.Doom
writer.Write(WaitForSummon);
}
}
}
}

View file

@ -64,7 +64,7 @@ namespace Server.Engines.Quests.Haven
[CommandProperty(AccessLevel.GameMaster)]
public MilitiaCanoneer Canoneer{ get; set; }
public override bool HandlesOnMovement => Canoneer != null && !Canoneer.Deleted && Canoneer.Active;
public override bool HandlesOnMovement => Canoneer?.Deleted == false && Canoneer.Active;
public void DoFireEffect(IPoint3D target)
{
@ -101,7 +101,7 @@ namespace Server.Engines.Quests.Haven
public override void OnMovement(Mobile m, Point3D oldLocation)
{
if (Canoneer == null || Canoneer.Deleted || !Canoneer.Active)
if (!(Canoneer?.Deleted == false && Canoneer.Active))
return;
bool canFire;
@ -127,7 +127,7 @@ namespace Server.Engines.Quests.Haven
public override void Serialize(GenericWriter writer)
{
if (Canoneer != null && Canoneer.Deleted)
if (Canoneer?.Deleted == true)
Canoneer = null;
base.Serialize(writer);
@ -183,4 +183,4 @@ namespace Server.Engines.Quests.Haven
int version = reader.ReadInt();
}
}
}
}

View file

@ -133,13 +133,13 @@ namespace Server.Engines.Quests.Haven
public override void OnLocationChange(Point3D oldLoc)
{
if (m_Lantern != null && !m_Lantern.Deleted)
if (m_Lantern?.Deleted == false)
m_Lantern.Location = new Point3D(X, Y + 1, Z);
}
public override void OnMapChange()
{
if (m_Lantern != null && !m_Lantern.Deleted)
if (m_Lantern?.Deleted == false)
m_Lantern.Map = Map;
}
@ -147,13 +147,13 @@ namespace Server.Engines.Quests.Haven
{
base.OnAfterDelete();
if (m_Lantern != null && !m_Lantern.Deleted)
if (m_Lantern?.Deleted == false)
m_Lantern.Delete();
}
public override void Serialize(GenericWriter writer)
{
if (m_Lantern != null && m_Lantern.Deleted)
if (m_Lantern?.Deleted == true)
m_Lantern = null;
base.Serialize(writer);
@ -172,4 +172,4 @@ namespace Server.Engines.Quests.Haven
m_Lantern = (Lantern)reader.ReadItem();
}
}
}
}

View file

@ -404,7 +404,7 @@ namespace Server.Engines.Quests.Haven
public override void ChildSerialize(GenericWriter writer)
{
if (CorpseWithBone != null && CorpseWithBone.Deleted)
if (CorpseWithBone?.Deleted == true)
CorpseWithBone = null;
writer.WriteEncodedInt(0); // version
@ -432,4 +432,4 @@ namespace Server.Engines.Quests.Haven
System.AddConversation(new BankerConversation());
}
}
}
}

View file

@ -43,23 +43,23 @@ namespace Server.Engines.Quests.Hag
PlayerMobile player = System.From;
Map map = player.Map;
if ((Corpse == null || Corpse.Deleted) && (map == Map.Trammel || map == Map.Felucca) &&
player.InRange(m_CorpseLocation, 8))
{
Corpse = new HagApprenticeCorpse();
Corpse.MoveToWorld(m_CorpseLocation, map);
if (Corpse?.Deleted == false || map != Map.Trammel && map != Map.Felucca ||
!player.InRange(m_CorpseLocation, 8))
return;
Effects.SendLocationEffect(m_CorpseLocation, map, 0x3728, 10, 10);
Effects.PlaySound(m_CorpseLocation, map, 0x1FE);
Corpse = new HagApprenticeCorpse();
Corpse.MoveToWorld(m_CorpseLocation, map);
Mobile imp = new Zeefzorpul();
imp.MoveToWorld(m_CorpseLocation, map);
Effects.SendLocationEffect(m_CorpseLocation, map, 0x3728, 10, 10);
Effects.PlaySound(m_CorpseLocation, map, 0x1FE);
// * You see a strange imp stealing a scrap of paper from the bloodied corpse *
Corpse.SendLocalizedMessageTo(player, 1055049);
Mobile imp = new Zeefzorpul();
imp.MoveToWorld(m_CorpseLocation, map);
Timer.DelayCall(TimeSpan.FromSeconds(3.0), () => DeleteImp(imp));
}
// * You see a strange imp stealing a scrap of paper from the bloodied corpse *
Corpse.SendLocalizedMessageTo(player, 1055049);
Timer.DelayCall(TimeSpan.FromSeconds(3.0), () => DeleteImp(imp));
}
private void DeleteImp(Mobile m)
@ -102,7 +102,7 @@ namespace Server.Engines.Quests.Hag
public override void ChildSerialize(GenericWriter writer)
{
if (Corpse != null && Corpse.Deleted)
if (Corpse?.Deleted == true)
Corpse = null;
writer.WriteEncodedInt(1); // version
@ -260,11 +260,7 @@ namespace Server.Engines.Quests.Hag
public class FindIngredientObjective : QuestObjective
{
public FindIngredientObjective(Ingredient[] oldIngredients) : this(oldIngredients, false)
{
}
public FindIngredientObjective(Ingredient[] oldIngredients, bool blackheartMet)
public FindIngredientObjective(Ingredient[] oldIngredients, bool blackheartMet = false)
{
if (!blackheartMet)
{
@ -345,7 +341,7 @@ namespace Server.Engines.Quests.Hag
{
IngredientInfo info = IngredientInfo.Get(Ingredient);
gump.AddHtmlLocalized(70, 260, 270, 100, info.Name, BaseQuestGump.Blue, false, false);
gump.AddHtmlLocalized(70, 260, 270, 100, info.Name, BaseQuestGump.Blue);
gump.AddLabel(70, 280, 0x64, CurProgress.ToString());
gump.AddLabel(100, 280, 0x64, "/");
gump.AddLabel(130, 280, 0x64, info.Quantity.ToString());
@ -439,4 +435,4 @@ namespace Server.Engines.Quests.Hag
System.AddConversation(new EndConversation());
}
}
}
}