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

@ -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());
}
}
}
}