Modernization Fixes & Updates to Default Values (#3)

This commit is contained in:
Kamron Batman 2018-10-28 00:33:16 -07:00 • committed by GitHub
parent 445eddff68
commit dcf64091b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
768 changed files with 10507 additions and 14196 deletions

View file

@ -119,7 +119,8 @@ namespace Server.Engines.Quests.Hag
public override void OnRead()
{
if (System.FindObjective(typeof(FindIngredientObjective)) is FindIngredientObjective obj)
FindIngredientObjective obj = System.FindObjective<FindIngredientObjective>();
if (obj != null)
System.AddObjective(new FindIngredientObjective(obj.Ingredients, true));
}
}
@ -253,8 +254,7 @@ namespace Server.Engines.Quests.Hag
public override void OnRead()
{
if (System.FindObjective(typeof(FindIngredientObjective)) is FindIngredientObjective obj)
obj.NextStep();
System.FindObjective<FindIngredientObjective>()?.NextStep();
}
public override void ChildDeserialize(GenericReader reader)

View file

@ -13,18 +13,20 @@ namespace Server.Engines.Quests.Hag
{
Direction = Direction.South;
foreach (Item item in EquipItems) DropItem(item);
foreach (Item item in EquipItems)
DropItem(item);
}
public HagApprenticeCorpse(Serial serial) : base(serial)
{
}
// TODO: What is this? Why are we creating a mobile and deleting it?
private static Mobile GetOwner()
{
Mobile apprentice = new Mobile();
apprentice.Hue = Utility.RandomSkinHue();
apprentice.Hue = Race.Human.RandomSkinHue();
apprentice.Female = false;
apprentice.Body = 0x190;
@ -60,7 +62,9 @@ namespace Server.Engines.Quests.Hag
QuestSystem qs = player.Quest;
if (qs is WitchApprenticeQuest)
if (qs.FindObjective(typeof(FindApprenticeObjective)) is FindApprenticeObjective obj && !obj.Completed)
{
FindApprenticeObjective obj = qs.FindObjective<FindApprenticeObjective>();
if (obj?.Completed == false)
{
if (obj.Corpse == this)
{
@ -75,6 +79,7 @@ namespace Server.Engines.Quests.Hag
return;
}
}
}
SendLocalizedMessageTo(from, 1055048); // You examine the corpse, but find nothing of interest.

View file

@ -31,7 +31,9 @@ namespace Server.Engines.Quests.Hag
QuestSystem qs = player.Quest;
if (qs is WitchApprenticeQuest)
if (qs.FindObjective(typeof(FindZeefzorpulObjective)) is FindZeefzorpulObjective obj && !obj.Completed)
{
FindZeefzorpulObjective obj = qs.FindObjective<FindZeefzorpulObjective>();
if (obj?.Completed == false)
{
if (player.Map != Map.Trammel && player.Map != Map.Felucca || !player.InRange(obj.ImpLocation, 8))
{
@ -50,6 +52,7 @@ namespace Server.Engines.Quests.Hag
1055052); // The flute sparkles. Zeefzorpul must be in a good hiding place nearby.
}
}
}
}
}

View file

@ -56,8 +56,9 @@ namespace Server.Engines.Quests.Hag
QuestSystem qs = player.Quest;
if (qs is WitchApprenticeQuest)
if (qs.FindObjective(typeof(FindIngredientObjective)) is FindIngredientObjective obj && !obj.Completed &&
obj.Ingredient == Ingredient.Whiskey)
{
FindIngredientObjective obj = qs.FindObjective<FindIngredientObjective>();
if (obj?.Completed == false && obj.Ingredient == Ingredient.Whiskey)
{
PlaySound(Utility.RandomBool() ? 0x42E : 0x43F);
@ -83,6 +84,7 @@ namespace Server.Engines.Quests.Hag
return;
}
}
PlaySound(0x42C);
SayTo(player, 1055041); // The drunken pirate shakes his fist at you and goes back to drinking.

View file

@ -57,9 +57,9 @@ namespace Server.Engines.Quests.Hag
}
else
{
QuestObjective obj = qs.FindObjective(typeof(FindGrizeldaAboutMurderObjective));
QuestObjective obj = qs.FindObjective<FindGrizeldaAboutMurderObjective>();
if (obj != null && !obj.Completed)
if (obj?.Completed == false)
{
PlaySound(0x420);
PlaySound(0x20);
@ -74,9 +74,9 @@ namespace Server.Engines.Quests.Hag
}
else
{
obj = qs.FindObjective(typeof(ReturnRecipeObjective));
obj = qs.FindObjective<ReturnRecipeObjective>();
if (obj != null && !obj.Completed)
if (obj?.Completed == false)
{
PlaySound(0x258);
PlaySound(0x41B);
@ -90,9 +90,9 @@ namespace Server.Engines.Quests.Hag
}
else
{
obj = qs.FindObjective(typeof(ReturnIngredientsObjective));
obj = qs.FindObjective<ReturnIngredientsObjective>();
if (obj != null && !obj.Completed)
if (obj?.Completed == false)
{
Container cont = GetNewContainer();
@ -181,13 +181,12 @@ namespace Server.Engines.Quests.Hag
else
{
QuestSystem newQuest = new WitchApprenticeQuest(player);
bool inRestartPeriod = false;
if (qs != null)
{
newQuest.AddConversation(new DontOfferConversation());
}
else if (QuestSystem.CanOfferQuest(player, typeof(WitchApprenticeQuest), out inRestartPeriod))
else if (QuestSystem.CanOfferQuest(player, typeof(WitchApprenticeQuest), out bool inRestartPeriod))
{
PlaySound(0x20);
PlaySound(0x206);

View file

@ -58,13 +58,13 @@ namespace Server.Engines.Quests.Hag
// * You see a strange imp stealing a scrap of paper from the bloodied corpse *
Corpse.SendLocalizedMessageTo(player, 1055049);
Timer.DelayCall(TimeSpan.FromSeconds(3.0), new TimerStateCallback(DeleteImp), imp);
Timer.DelayCall(TimeSpan.FromSeconds(3.0), () => DeleteImp(imp));
}
}
private void DeleteImp(object imp)
private void DeleteImp(Mobile m)
{
if (imp is Mobile m && !m.Deleted)
if (m?.Deleted == false)
{
Effects.SendLocationEffect(m.Location, m.Map, 0x3728, 10, 10);
Effects.PlaySound(m.Location, m.Map, 0x1FE);
@ -215,7 +215,7 @@ namespace Server.Engines.Quests.Hag
imp.Direction = imp.GetDirectionTo(from);
Timer.DelayCall(TimeSpan.FromSeconds(3.0), new TimerStateCallback(DeleteImp), imp);
Timer.DelayCall(TimeSpan.FromSeconds(3.0), () => DeleteImp(imp));
}
private void DeleteImp(object imp)