Updates Packets & Randomizer (#43)

* Fixes a bug with the main loop. Removes unnecessary optimizations for RDRand.

* WIP - Rewriting packets.

* Cleanup and updates README

* Converts more packets

* Fixes header

* Converts Effects packets.

* Forgot the send command

* Adds the start of containers packets.

* Adds message packets with caching

* Extends the send methods

* Starts to add Acquire methods

* Converted the packets

* Cleanup

* Cleanup

* Adds more packets

* Adds more packets

* Fixes clearing arrays from pool. Adds Mobile Incoming

* Converts more packets.

* Moves more packets

* Moves more packets

* Test compression

* Merges

* Migrating to an idiomatic syntax that also supports compression, and proxying.

* Optimize the stack alloc. Changes attributes

* Converted container packets

* Visual Studio doesn't auto save files. I am still getting used to subpar IDEs.

* Adds static packet caching. Will profile later. Converts more packets

* Fixes packets and changes how compression is configured

* WIP - Adds basics for Gumps. Not finished though.

* Fix file

* Fixes formatting

* Changed SpanWriter to be more idiomatic.

* Fixes Span vs RawSpan and missing stackallocs

* Converts over some more gumps

* WIP - Deletes 32bit support.

* Drops RDRand32 support.

* Fixes gump compilation

* Converting gump components

* Removes old huffman compression function

* Revert signature for backwards compatibility

* WIP - Converting more gump components

* Creates ArraySet for the strings. Updates AppendTo to reference that.

* Converts the maining gump components

* Cleans up gump components

* Cleans up directives

* Cleans up ArraySet and moves it. Adds null-coalescing-assignment

* Cleanup, Target Packets, and C# 8 changes.

* Removed OPL Packet

* World packets

* Fixing packet uses

* Cleans up code. Fixes packet uses in various places.

* More cleanup for packets

* Code cleanup

* Converts more packet uses and cleans up more code

* More code cleanup

* Finishes fixing the packets in Item

* Updates secure trade packets

* Updates core and gets it to compile.

* Moved packets to scripts. Fixed account handler use of packets

* Code cleanup

* Updates chat packets

* Code cleanuo

* Adds party packets, but need to implement them.

* Party packets WIP

* Finishes party packets

* Rearrange movement namespaces and classes

* Finishes plant packets

* Code Formatting

* Fixes moving effects

* Code cleanup, eliminates equipinfo

* Adds more packets. Fixes bugs with various packets.

* Finishes mahjon packets

* Fixes mahjong packet

* Code cleanup

* Finishes mahjong packets

* Adds Map packets

* Add multifacet maps and charts

* Cleans up some packets with UTF8

* Optimizes packets

* Cleans up more packets. Moves the MessageHelper

* Removes assistant support. Removes extended protocol. Incorporates MapUO packets as normal packets.

* Updates protocol extensions packet receiver

* Fixes a few bugs. Fixes a few more packets.

* Code cleanup and fixing more packets

* Fixes packet effects

* Cleaned up more code

* Buff Icon cleanup

* Removed unused constructors

* Code Cleanup. Adds BoatHS Packets

* Moves house files. Updates house foundation packets.

* Deployment cleanup

* Fixes:

* Code cleanup

* More code cleanup

* More code cleanup

* Cleaned up BaseHouse

* Enforces styling

* Converts foreach to linq where possible.

* Dont need that

* Goals/Readme updates

* Removes 32bit support at the highest level. Turns on HRT by default.

* Code cleanup. Fixes extended features packet.

* Fixes various bugs

* Code cleanup

* Code cleanup

* Code cleanup. Fixes gump X/Y assignment.

* Code cleanup using |= operator

* More code cleanup

* Cleanup

* Fixes spacing issues. Thanks Visual Studio. You suck.

* Compiler error

* Fixes NPE from RunUO 2.7

* Renames ScriptCompiler to AssemblyHandler. Fixes packets. Updates README

* Fixes more packets. Stupid trailing nulls.

* Fixes various bugs.

* Fixes for gumps

* Fixes more gump stuff. Going to split it out later since it is getting insane

* Recoded the gump writing

* WIP

* *Added output path of scripts project to dev branch
*Activated debugging in code
This commit is contained in:
Kamron Batman 2019-11-11 03:40:16 -08:00 committed by 3HMonkey
parent 7aa8fd3df1
commit 179cb50557
588 changed files with 10843 additions and 16177 deletions

View file

@ -167,11 +167,10 @@ namespace Server.Engines.Quests.Collector
{
if (m_Quantity < m_Completed)
{
if (!IsChildOf(from.Backpack))
from.Send(new MessageLocalized(Serial, ItemID, MessageType.Regular, 0x2C, 3, 500309, "",
"")); // Nothing Happens.
else
if (IsChildOf(from.Backpack))
from.Target = new InternalTarget(this);
else
Packets.SendMessageLocalized(from.NetState, Serial, ItemID, MessageType.Regular, 0x2C, 3, 500309); // Nothing Happens.
}
}
@ -245,15 +244,15 @@ namespace Server.Engines.Quests.Collector
if (targObsidian.Quantity >= m_Completed)
targObsidian.StatueName = RandomName(from);
from.Send(new AsciiMessage(targObsidian.Serial, targObsidian.ItemID, MessageType.Regular, 0x59, 3,
m_Obsidian.Name, "Something Happened."));
Packets.SendAsciiMessage(from.NetState, targObsidian.Serial, targObsidian.ItemID, MessageType.Regular, 0x59, 3,
m_Obsidian.Name, "Something Happened.");
return;
}
from.Send(new MessageLocalized(m_Obsidian.Serial, m_Obsidian.ItemID, MessageType.Regular, 0x2C, 3, 500309,
m_Obsidian.Name, "")); // Nothing Happens.
Packets.SendMessageLocalized(from.NetState, m_Obsidian.Serial, m_Obsidian.ItemID, MessageType.Regular, 0x2C, 3, 500309,
m_Obsidian.Name); // Nothing Happens.
}
}
}
}
}

View file

@ -359,4 +359,4 @@ namespace Server.Engines.Quests.Collector
{
public override object Message => 1055136;
}
}
}

View file

@ -99,11 +99,10 @@ namespace Server.Items
else if (from.Map == Map.Ilshenar)
{
#if false
banks = m_IlshenarBanks;
moongates = PMList.Ilshenar;
banks = m_IlshenarBanks;
moongates = PMList.Ilshenar;
#else
from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, 0x482, 3, 1061684, "",
"")); // The magic of the sextant fails...
Packets.SendMessageLocalized(from.NetState, Serial, ItemID, MessageType.Label, 0x482, 3, 1061684); // The magic of the sextant fails...
return;
#endif
}
@ -154,7 +153,7 @@ namespace Server.Items
else
moonMsg = 1048018; // You are next to a Moongate at the moment.
from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, 0x482, 3, moonMsg, "", ""));
Packets.SendMessageLocalized(from.NetState, Serial, ItemID, MessageType.Label, 0x482, 3, moonMsg);
int bankMsg;
if (bankDistance == double.MaxValue)
@ -166,7 +165,7 @@ namespace Server.Items
else
bankMsg = 1048019; // You are next to a Bank at the moment.
from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, 0x5AA, 3, bankMsg, "", ""));
Packets.SendMessageLocalized(from.NetState, Serial, ItemID, MessageType.Label, 0x5AA, 3, bankMsg);
}
public override void Serialize(GenericWriter writer)
@ -183,4 +182,4 @@ namespace Server.Items
int version = reader.ReadInt();
}
}
}
}

View file

@ -44,9 +44,7 @@ namespace Server.Engines.Quests
switch (encoding)
{
default:
{
return null;
}
case 0x01: // indexed
{
int index = reader.ReadEncodedInt();
@ -75,9 +73,7 @@ namespace Server.Engines.Quests
switch (encoding)
{
default:
{
return null;
}
case 0x01:
{
Type type = ReadType(QuestSystem.QuestTypes, reader);
@ -94,9 +90,7 @@ namespace Server.Engines.Quests
public static void Serialize(QuestSystem qs, GenericWriter writer)
{
if (qs == null)
{
writer.WriteEncodedInt(0x00);
}
else
{
writer.WriteEncodedInt(0x01);
@ -114,9 +108,7 @@ namespace Server.Engines.Quests
switch (encoding)
{
default:
{
return null;
}
case 0x01:
{
Type type = ReadType(referenceTable, reader);
@ -133,9 +125,7 @@ namespace Server.Engines.Quests
public static void Serialize(Type[] referenceTable, QuestObjective obj, GenericWriter writer)
{
if (obj == null)
{
writer.WriteEncodedInt(0x00);
}
else
{
writer.WriteEncodedInt(0x01);
@ -153,9 +143,7 @@ namespace Server.Engines.Quests
switch (encoding)
{
default:
{
return null;
}
case 0x01:
{
Type type = ReadType(referenceTable, reader);
@ -172,9 +160,7 @@ namespace Server.Engines.Quests
public static void Serialize(Type[] referenceTable, QuestConversation conv, GenericWriter writer)
{
if (conv == null)
{
writer.WriteEncodedInt(0x00);
}
else
{
writer.WriteEncodedInt(0x01);

View file

@ -259,7 +259,7 @@ namespace Server.Engines.Quests
From.SendGump(new QuestObjectivesGump(Objectives));
QuestObjective last = Objectives[Objectives.Count - 1];
QuestObjective last = Objectives[^1];
if (last.Info != null)
From.SendGump(new QuestItemInfoGump(last.Info));
@ -276,7 +276,7 @@ namespace Server.Engines.Quests
From.SendGump(new QuestConversationsGump(Conversations));
QuestConversation last = Conversations[Conversations.Count - 1];
QuestConversation last = Conversations[^1];
if (last.Info != null)
From.SendGump(new QuestItemInfoGump(last.Info));

View file

@ -1,13 +1,12 @@
using System;
using Server.Items;
using Server.Mobiles;
using Server.Network;
namespace Server.Engines.Quests.Necro
{
public class KronusScroll : QuestItem
{
private static readonly Rectangle2D m_WellOfTearsArea = new Rectangle2D(2080, 1346, 10, 10);
private static Rectangle2D m_WellOfTearsArea = new Rectangle2D(2080, 1346, 10, 10);
private static readonly Map m_WellOfTearsMap = Map.Malas;
[Constructible]
@ -134,9 +133,7 @@ namespace Server.Engines.Quests.Necro
int hue = Utility.RandomList(0x481, 0x482, 0x489, 0x497, 0x66D);
Effects.SendPacket(from, map,
new HuedEffect(EffectType.Moving, Serial.Zero, Serial.Zero, 0x36D4, from, to, 0, 0, false, true,
hue, 0));
Effects.SendMovingEffect(from, to, map, 0x36D4, 0, 0, false, true, hue);
}
}
@ -155,4 +152,4 @@ namespace Server.Engines.Quests.Necro
}
}
}
}
}

View file

@ -65,8 +65,8 @@ namespace Server.Engines.Quests.Necro
Maabus.Delete();
Maabus = null;
foreach (MaabusCoffinComponent c in Components)
c.TurnToFull();
foreach (AddonComponent addonComponent in Components)
(addonComponent as MaabusCoffinComponent)?.TurnToFull();
}
public override void Serialize(GenericWriter writer)
@ -151,4 +151,4 @@ namespace Server.Engines.Quests.Necro
m_EmptyItemID = reader.ReadInt();
}
}
}
}

View file

@ -258,7 +258,7 @@ namespace Server.Engines.Quests.Necro
public class FindWellOfTearsObjective : QuestObjective
{
private static readonly Rectangle2D m_WellOfTearsArea = new Rectangle2D(2080, 1346, 10, 10);
private static Rectangle2D m_WellOfTearsArea = new Rectangle2D(2080, 1346, 10, 10);
private bool m_Inside;

View file

@ -36,29 +36,29 @@ namespace Server.Engines.Quests.Haven
if (System.From.Profession == 2) // magician
return 1049386;
/* <I>Uzeraan nods at you with approval and begins to speak...</I><BR><BR>
*
* Now that you are ready, let me give you your first task.<BR><BR>
*
* As I mentioned earlier, we have been trying to fight back the wicked
* <I>Horde Minions</I> which have recently begun attacking our cities
* - but to no avail. Our need is great!<BR><BR>
*
* Your first task will be to assess the situation in the mountain pass,
* and help our troops defeat the Horde Minions there.<BR><BR>
*
* Take the road marked with glowing runes, that starts just outside of this mansion.
* Before you go into battle, it would be prudent to
* <a href="?ForceTopic27">review combat techniques</a> as well as
* <a href = "?ForceTopic29">information on healing yourself,
* using your Paladin ability 'Close Wounds'</a>.<BR><BR>
*
* To aid you in your fight, you may also wish to
* <a href = "?ForceTopic33">purchase equipment</a> from Frank the Blacksmith,
* who is standing just <a href = "?ForceTopic13">South</a> of here.<BR><BR>
*
* Good luck young Paladin!
*/
/* <I>Uzeraan nods at you with approval and begins to speak...</I><BR><BR>
*
* Now that you are ready, let me give you your first task.<BR><BR>
*
* As I mentioned earlier, we have been trying to fight back the wicked
* <I>Horde Minions</I> which have recently begun attacking our cities
* - but to no avail. Our need is great!<BR><BR>
*
* Your first task will be to assess the situation in the mountain pass,
* and help our troops defeat the Horde Minions there.<BR><BR>
*
* Take the road marked with glowing runes, that starts just outside of this mansion.
* Before you go into battle, it would be prudent to
* <a href="?ForceTopic27">review combat techniques</a> as well as
* <a href = "?ForceTopic29">information on healing yourself,
* using your Paladin ability 'Close Wounds'</a>.<BR><BR>
*
* To aid you in your fight, you may also wish to
* <a href = "?ForceTopic33">purchase equipment</a> from Frank the Blacksmith,
* who is standing just <a href = "?ForceTopic13">South</a> of here.<BR><BR>
*
* Good luck young Paladin!
*/
return 1060388;
}
}
@ -73,7 +73,7 @@ namespace Server.Engines.Quests.Haven
public class UzeraanReportConversation : QuestConversation
{
private static QuestItemInfo[] m_Info =
private static readonly QuestItemInfo[] m_Info =
{
new QuestItemInfo(1026153, 0x1822), // teleporter
new QuestItemInfo(1048032, 0xE76) // a bag
@ -469,4 +469,4 @@ namespace Server.Engines.Quests.Haven
public override bool Logged => false;
}
}
}

View file

@ -28,15 +28,14 @@ namespace Server.Engines.Quests.Haven
{
}
// TODO: What is this? Why are we creating and deleting a mobile?
// TODO: Should be a better way than making/deleting a mob.
private static Mobile GetOwner()
{
Mobile apprentice = new Mobile();
Mobile apprentice = new Mobile
{
Hue = Race.Human.RandomSkinHue(), Female = false, Body = 0x190, Name = NameList.RandomName("male")
};
apprentice.Hue = Race.Human.RandomSkinHue();
apprentice.Female = false;
apprentice.Body = 0x190;
apprentice.Name = NameList.RandomName("male");
apprentice.Delete();
@ -45,12 +44,14 @@ namespace Server.Engines.Quests.Haven
private static List<Item> GetEquipment()
{
List<Item> list = new List<Item>();
List<Item> list = new List<Item>
{
new Robe(QuestSystem.RandomBrightHue()),
new WizardsHat(Utility.RandomNeutralHue()),
new Shoes(Utility.RandomNeutralHue()),
new Spellbook()
};
list.Add(new Robe(QuestSystem.RandomBrightHue()));
list.Add(new WizardsHat(Utility.RandomNeutralHue()));
list.Add(new Shoes(Utility.RandomNeutralHue()));
list.Add(new Spellbook());
return list;
}
@ -86,11 +87,10 @@ namespace Server.Engines.Quests.Haven
int hue = Notoriety.GetHue(NotorietyHandlers.CorpseNotoriety(from, this));
if (ItemID == 0x2006) // Corpse form
from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, hue, 3, 1049144, "",
Name)); // the remains of ~1_NAME~ the apprentice
Packets.SendMessageLocalized(from.NetState, Serial, ItemID, MessageType.Label, hue, 3, 1049144, "",
Name); // the remains of ~1_NAME~ the apprentice
else
from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, hue, 3, 1049145, "",
"")); // the remains of a wizard's apprentice
Packets.SendMessageLocalized(from.NetState, Serial, ItemID, MessageType.Label, hue, 3, 1049145); // the remains of a wizard's apprentice
}
public override void Open(Mobile from, bool checkSelfLoot)

View file

@ -118,11 +118,10 @@ namespace Server.Engines.Quests.Haven
int hue = Notoriety.GetHue(NotorietyHandlers.CorpseNotoriety(from, this));
if (ItemID == 0x2006) // Corpse form
from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, hue, 3, 1049318, "",
Name)); // the remains of ~1_NAME~ the militia fighter
Packets.SendMessageLocalized(from.NetState, Serial, ItemID, MessageType.Label, hue, 3, 1049318, "",
Name); // the remains of ~1_NAME~ the militia fighter
else
from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, hue, 3, 1049319, "",
"")); // the remains of a militia fighter
Packets.SendMessageLocalized(from.NetState, Serial, ItemID, MessageType.Label, hue, 3, 1049318); // the remains of a militia fighters
}
public override void Open(Mobile from, bool checkSelfLoot)
@ -146,4 +145,4 @@ namespace Server.Engines.Quests.Haven
int version = reader.ReadInt();
}
}
}
}

View file

@ -72,9 +72,8 @@ namespace Server.Engines.Quests.Haven
public KillHordeMinionsStep Step{ get; private set; }
public override object Message
{
get
public override object Message =>
Step switch
{
return Step switch
{
@ -108,19 +107,7 @@ namespace Server.Engines.Quests.Haven
_ => 5
};
return 5;
}
}
public override bool Completed
{
get
{
if (Step == KillHordeMinionsStep.LearnKarma && HasBeenRead)
return true;
return base.Completed;
}
}
public override bool Completed => Step == KillHordeMinionsStep.LearnKarma && HasBeenRead || base.Completed;
public override void RenderProgress(BaseQuestGump gump)
{
@ -140,23 +127,15 @@ namespace Server.Engines.Quests.Haven
CheckCompletionStatus();
}
public override bool IgnoreYoungProtection(Mobile from)
{
// This restriction continues until the quest is ended
if (from is HordeMinion && from.Map == Map.Trammel && from.X >= 3314 && from.X <= 3814 && from.Y >= 2345 &&
from.Y <= 3095) // Haven island
return true;
return false;
}
public override bool IgnoreYoungProtection(Mobile from) =>
from is HordeMinion && from.Map == Map.Trammel && TreasureMap.IsInHavenIsland(from);
public override void OnKill(BaseCreature creature, Container corpse)
{
if (creature is HordeMinion && corpse.Map == Map.Trammel && corpse.X >= 3314 && corpse.X <= 3814 &&
corpse.Y >= 2345 && corpse.Y <= 3095) // Haven island
if (creature is HordeMinion && corpse.Map == Map.Trammel && TreasureMap.IsInHavenIsland(corpse))
{
if (CurProgress == 0)
System.From.Send(new DisplayHelpTopic(29, false)); // HEALING
ContentPackets.SendDisplayHelpTopic(System.From.NetState, 29, false); // HEALING
CurProgress++;
}
@ -340,49 +319,26 @@ namespace Server.Engines.Quests.Haven
{
public Container CorpseWithBone{ get; set; }
public override object Message
{
get
{
if (System.From.Profession == 5) return 1060755;
/* Use Uzeraan's teleporter to get to the Haunted graveyard.<BR><BR>
*
* Slay the undead until you find a <I>Daemon Bone</I>.
*/
return 1049362;
}
}
public override object Message => System.From.Profession == 5 ? 1060755 : 1049362;
public override void OnComplete()
{
System.AddObjective(new ReturnDaemonBoneObjective());
}
public override bool IgnoreYoungProtection(Mobile from)
{
// This restriction continues until the end of the quest
if ((from is Zombie || from is Skeleton) && from.Map == Map.Trammel && from.X >= 3391 && from.X <= 3424 &&
from.Y >= 2639 && from.Y <= 2664) // Haven graveyard
return true;
private static bool IsInHavenGraveyard(IPoint2D p) => p.X >= 3391 && p.X <= 3424 &&
p.Y >= 2639 && p.Y <= 2664;
return false;
}
public override bool IgnoreYoungProtection(Mobile from) =>
(from is Zombie || from is Skeleton) && from.Map == Map.Trammel && IsInHavenGraveyard(from);
public override bool GetKillEvent(BaseCreature creature, Container corpse)
{
if (base.GetKillEvent(creature, corpse))
return true;
return UzeraanTurmoilQuest.HasLostDaemonBone(System.From);
}
public override bool GetKillEvent(BaseCreature creature, Container corpse) =>
base.GetKillEvent(creature, corpse) || UzeraanTurmoilQuest.HasLostDaemonBone(System.From);
public override void OnKill(BaseCreature creature, Container corpse)
{
if ((creature is Zombie || creature is Skeleton) && corpse.Map == Map.Trammel && corpse.X >= 3391 &&
corpse.X <= 3424 && corpse.Y >= 2639 && corpse.Y <= 2664) // Haven graveyard
if (Utility.RandomDouble() < 0.25)
CorpseWithBone = corpse;
if ((creature is Zombie || creature is Skeleton) && corpse.Map == Map.Trammel && IsInHavenGraveyard(corpse) && Utility.RandomDouble() < 0.25)
CorpseWithBone = corpse;
}
public override void ChildDeserialize(GenericReader reader)

View file

@ -62,9 +62,8 @@ namespace Server.Engines.Quests.Haven
public override TimeSpan RestartDelay => TimeSpan.MaxValue;
public override bool IsTutorial => true;
public override int Picture
{
get
public override int Picture =>
From.Profession switch
{
return From.Profession switch
{

View file

@ -1,4 +1,5 @@
using System;
using System.Linq;
using Server.Mobiles;
namespace Server.Engines.Quests.Hag
@ -89,12 +90,7 @@ namespace Server.Engines.Quests.Hag
{
Ingredient currIngredient = (Ingredient)i;
bool found = false;
for (int j = 0; !found && j < oldIngredients.Length; j++)
if (oldIngredients[j] == currIngredient)
found = true;
if (!found)
if (oldIngredients.All(ingredient => ingredient != currIngredient))
ingredients[n++] = currIngredient;
}
@ -103,4 +99,4 @@ namespace Server.Engines.Quests.Hag
return ingredients[index];
}
}
}
}

View file

@ -46,7 +46,7 @@ namespace Server.Engines.Quests.Hag
{
int hue = Notoriety.GetHue(NotorietyHandlers.CorpseNotoriety(from, this));
from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, hue, 3, "", "a charred corpse"));
Packets.SendAsciiMessage(from.NetState, Serial, ItemID, MessageType.Label, hue, 3, "", "a charred corpse");
}
public override void Open(Mobile from, bool checkSelfLoot)
@ -96,4 +96,4 @@ namespace Server.Engines.Quests.Hag
int version = reader.ReadInt();
}
}
}
}

View file

@ -1,4 +1,5 @@
using System;
using System.Linq;
using Server.Items;
using Server.Mobiles;
@ -50,7 +51,7 @@ namespace Server.Engines.Quests.Hag
Corpse = new HagApprenticeCorpse();
Corpse.MoveToWorld(m_CorpseLocation, map);
Effects.SendLocationEffect(m_CorpseLocation, map, 0x3728, 10, 10);
Effects.SendLocationEffect(m_CorpseLocation, map, 0x3728, 10);
Effects.PlaySound(m_CorpseLocation, map, 0x1FE);
Mobile imp = new Zeefzorpul();
@ -66,7 +67,7 @@ namespace Server.Engines.Quests.Hag
{
if (m?.Deleted == false)
{
Effects.SendLocationEffect(m.Location, m.Map, 0x3728, 10, 10);
Effects.SendLocationEffect(m.Location, m.Map, 0x3728, 10);
Effects.PlaySound(m.Location, m.Map, 0x1FE);
m.Delete();
@ -204,7 +205,7 @@ namespace Server.Engines.Quests.Hag
Mobile from = System.From;
Map map = from.Map;
Effects.SendLocationEffect(ImpLocation, map, 0x3728, 10, 10);
Effects.SendLocationEffect(ImpLocation, map, 0x3728, 10);
Effects.PlaySound(ImpLocation, map, 0x1FE);
Mobile imp = new Zeefzorpul();
@ -219,7 +220,7 @@ namespace Server.Engines.Quests.Hag
{
if (imp is Mobile m && !m.Deleted)
{
Effects.SendLocationEffect(m.Location, m.Map, 0x3728, 10, 10);
Effects.SendLocationEffect(m.Location, m.Map, 0x3728, 10);
Effects.PlaySound(m.Location, m.Map, 0x1FE);
m.Delete();
@ -266,7 +267,7 @@ namespace Server.Engines.Quests.Hag
for (int i = 0; i < oldIngredients.Length; i++)
Ingredients[i] = oldIngredients[i];
Ingredients[Ingredients.Length - 1] = IngredientInfo.RandomIngredient(oldIngredients);
Ingredients[^1] = IngredientInfo.RandomIngredient(oldIngredients);
}
else
{
@ -279,13 +280,8 @@ namespace Server.Engines.Quests.Hag
BlackheartMet = blackheartMet;
}
public FindIngredientObjective()
{
}
public override object Message
{
get
public override object Message =>
!BlackheartMet ? Step switch
{
if (!BlackheartMet)
return Step switch
@ -310,21 +306,13 @@ namespace Server.Engines.Quests.Hag
*/
return 1055055;
}
}
: 1055055;
public override int MaxProgress
{
get
{
IngredientInfo info = IngredientInfo.Get(Ingredient);
return info.Quantity;
}
}
public override int MaxProgress => IngredientInfo.Get(Ingredient).Quantity;
public Ingredient[] Ingredients{ get; private set; }
public Ingredient Ingredient => Ingredients[Ingredients.Length - 1];
public Ingredient Ingredient => Ingredients[^1];
public int Step => Ingredients.Length;
public bool BlackheartMet{ get; private set; }
@ -345,26 +333,14 @@ namespace Server.Engines.Quests.Hag
}
}
public override bool IgnoreYoungProtection(Mobile from)
{
if (Completed)
return false;
IngredientInfo info = IngredientInfo.Get(Ingredient);
Type fromType = from.GetType();
for (int i = 0; i < info.Creatures.Length; i++)
if (fromType == info.Creatures[i])
return true;
return false;
}
public override bool IgnoreYoungProtection(Mobile from) =>
!Completed && IngredientInfo.Get(Ingredient).Creatures.Any(t => from.GetType() == t);
public override void OnKill(BaseCreature creature, Container corpse)
{
IngredientInfo info = IngredientInfo.Get(Ingredient);
for (int i = 0; i < info.Creatures.Length; i++)
if (info.Creatures.Any(type => creature.GetType() == type))
{
Type type = info.Creatures[i];
@ -375,8 +351,7 @@ namespace Server.Engines.Quests.Hag
CurProgress++;
break;
}
CurProgress++;
}
}