* 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
406 lines
11 KiB
C#
406 lines
11 KiB
C#
using System;
|
|
using System.Linq;
|
|
using Server.Items;
|
|
using Server.Mobiles;
|
|
|
|
namespace Server.Engines.Quests.Hag
|
|
{
|
|
public class FindApprenticeObjective : QuestObjective
|
|
{
|
|
private static Point3D[] m_CorpseLocations =
|
|
{
|
|
new Point3D(778, 1158, 0),
|
|
new Point3D(698, 1443, 0),
|
|
new Point3D(785, 1548, 0),
|
|
new Point3D(734, 1504, 0),
|
|
new Point3D(819, 1266, 0)
|
|
};
|
|
|
|
private Point3D m_CorpseLocation;
|
|
|
|
public FindApprenticeObjective(bool init)
|
|
{
|
|
if (init)
|
|
m_CorpseLocation = RandomCorpseLocation();
|
|
}
|
|
|
|
public FindApprenticeObjective()
|
|
{
|
|
}
|
|
|
|
public override object Message => 1055014;
|
|
|
|
public Corpse Corpse{ get; private set; }
|
|
|
|
private static Point3D RandomCorpseLocation()
|
|
{
|
|
int index = Utility.Random(m_CorpseLocations.Length);
|
|
|
|
return m_CorpseLocations[index];
|
|
}
|
|
|
|
public override void CheckProgress()
|
|
{
|
|
PlayerMobile player = System.From;
|
|
Map map = player.Map;
|
|
|
|
if (Corpse?.Deleted == false || map != Map.Trammel && map != Map.Felucca ||
|
|
!player.InRange(m_CorpseLocation, 8))
|
|
return;
|
|
|
|
Corpse = new HagApprenticeCorpse();
|
|
Corpse.MoveToWorld(m_CorpseLocation, map);
|
|
|
|
Effects.SendLocationEffect(m_CorpseLocation, map, 0x3728, 10);
|
|
Effects.PlaySound(m_CorpseLocation, map, 0x1FE);
|
|
|
|
Mobile imp = new Zeefzorpul();
|
|
imp.MoveToWorld(m_CorpseLocation, map);
|
|
|
|
// * 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)
|
|
{
|
|
if (m?.Deleted == false)
|
|
{
|
|
Effects.SendLocationEffect(m.Location, m.Map, 0x3728, 10);
|
|
Effects.PlaySound(m.Location, m.Map, 0x1FE);
|
|
|
|
m.Delete();
|
|
}
|
|
}
|
|
|
|
public override void OnComplete()
|
|
{
|
|
System.AddConversation(new ApprenticeCorpseConversation());
|
|
}
|
|
|
|
public override void ChildDeserialize(GenericReader reader)
|
|
{
|
|
int version = reader.ReadEncodedInt();
|
|
|
|
switch (version)
|
|
{
|
|
case 1:
|
|
{
|
|
m_CorpseLocation = reader.ReadPoint3D();
|
|
goto case 0;
|
|
}
|
|
case 0:
|
|
{
|
|
Corpse = (Corpse)reader.ReadItem();
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (version == 0)
|
|
m_CorpseLocation = RandomCorpseLocation();
|
|
}
|
|
|
|
public override void ChildSerialize(GenericWriter writer)
|
|
{
|
|
if (Corpse?.Deleted == true)
|
|
Corpse = null;
|
|
|
|
writer.WriteEncodedInt(1); // version
|
|
|
|
writer.Write(m_CorpseLocation);
|
|
writer.Write(Corpse);
|
|
}
|
|
}
|
|
|
|
public class FindGrizeldaAboutMurderObjective : QuestObjective
|
|
{
|
|
public override object Message => 1055015;
|
|
|
|
public override void OnComplete()
|
|
{
|
|
System.AddConversation(new MurderConversation());
|
|
}
|
|
}
|
|
|
|
public class KillImpsObjective : QuestObjective
|
|
{
|
|
private int m_MaxProgress;
|
|
|
|
public KillImpsObjective(bool init)
|
|
{
|
|
if (init)
|
|
m_MaxProgress = Utility.RandomMinMax(1, 4);
|
|
}
|
|
|
|
public KillImpsObjective()
|
|
{
|
|
}
|
|
|
|
public override object Message => 1055016;
|
|
|
|
public override int MaxProgress => m_MaxProgress;
|
|
|
|
public override bool IgnoreYoungProtection(Mobile from)
|
|
{
|
|
if (!Completed && from is Imp)
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
|
|
public override void OnKill(BaseCreature creature, Container corpse)
|
|
{
|
|
if (creature is Imp)
|
|
CurProgress++;
|
|
}
|
|
|
|
public override void OnComplete()
|
|
{
|
|
PlayerMobile from = System.From;
|
|
|
|
Point3D loc = WitchApprenticeQuest.RandomZeefzorpulLocation();
|
|
|
|
MapItem mapItem = new MapItem();
|
|
mapItem.SetDisplay(loc.X - 200, loc.Y - 200, loc.X + 200, loc.Y + 200, 200, 200);
|
|
mapItem.AddWorldPin(loc.X, loc.Y);
|
|
from.AddToBackpack(mapItem);
|
|
|
|
from.AddToBackpack(new MagicFlute());
|
|
|
|
from.SendLocalizedMessage(1055061); // You have received a map and a magic flute.
|
|
|
|
System.AddConversation(new ImpDeathConversation(loc));
|
|
}
|
|
|
|
public override void ChildDeserialize(GenericReader reader)
|
|
{
|
|
int version = reader.ReadEncodedInt();
|
|
|
|
m_MaxProgress = reader.ReadInt();
|
|
}
|
|
|
|
public override void ChildSerialize(GenericWriter writer)
|
|
{
|
|
writer.WriteEncodedInt(0); // version
|
|
|
|
writer.Write(m_MaxProgress);
|
|
}
|
|
}
|
|
|
|
public class FindZeefzorpulObjective : QuestObjective
|
|
{
|
|
public FindZeefzorpulObjective(Point3D impLocation) => ImpLocation = impLocation;
|
|
|
|
public FindZeefzorpulObjective()
|
|
{
|
|
}
|
|
|
|
public override object Message => 1055017;
|
|
|
|
public Point3D ImpLocation{ get; private set; }
|
|
|
|
public override void OnComplete()
|
|
{
|
|
Mobile from = System.From;
|
|
Map map = from.Map;
|
|
|
|
Effects.SendLocationEffect(ImpLocation, map, 0x3728, 10);
|
|
Effects.PlaySound(ImpLocation, map, 0x1FE);
|
|
|
|
Mobile imp = new Zeefzorpul();
|
|
imp.MoveToWorld(ImpLocation, map);
|
|
|
|
imp.Direction = imp.GetDirectionTo(from);
|
|
|
|
Timer.DelayCall(TimeSpan.FromSeconds(3.0), () => DeleteImp(imp));
|
|
}
|
|
|
|
private void DeleteImp(object imp)
|
|
{
|
|
if (imp is Mobile m && !m.Deleted)
|
|
{
|
|
Effects.SendLocationEffect(m.Location, m.Map, 0x3728, 10);
|
|
Effects.PlaySound(m.Location, m.Map, 0x1FE);
|
|
|
|
m.Delete();
|
|
}
|
|
|
|
System.From.SendLocalizedMessage(1055062); // You have received the Magic Brew Recipe.
|
|
|
|
System.AddConversation(new ZeefzorpulConversation());
|
|
}
|
|
|
|
public override void ChildDeserialize(GenericReader reader)
|
|
{
|
|
int version = reader.ReadEncodedInt();
|
|
|
|
ImpLocation = reader.ReadPoint3D();
|
|
}
|
|
|
|
public override void ChildSerialize(GenericWriter writer)
|
|
{
|
|
writer.WriteEncodedInt(0); // version
|
|
|
|
writer.Write(ImpLocation);
|
|
}
|
|
}
|
|
|
|
public class ReturnRecipeObjective : QuestObjective
|
|
{
|
|
public override object Message => 1055018;
|
|
|
|
public override void OnComplete()
|
|
{
|
|
System.AddConversation(new RecipeConversation());
|
|
}
|
|
}
|
|
|
|
public class FindIngredientObjective : QuestObjective
|
|
{
|
|
public FindIngredientObjective(Ingredient[] oldIngredients, bool blackheartMet = false)
|
|
{
|
|
if (!blackheartMet)
|
|
{
|
|
Ingredients = new Ingredient[oldIngredients.Length + 1];
|
|
|
|
for (int i = 0; i < oldIngredients.Length; i++)
|
|
Ingredients[i] = oldIngredients[i];
|
|
|
|
Ingredients[^1] = IngredientInfo.RandomIngredient(oldIngredients);
|
|
}
|
|
else
|
|
{
|
|
Ingredients = new Ingredient[oldIngredients.Length];
|
|
|
|
for (int i = 0; i < oldIngredients.Length; i++)
|
|
Ingredients[i] = oldIngredients[i];
|
|
}
|
|
|
|
BlackheartMet = blackheartMet;
|
|
}
|
|
|
|
public override object Message =>
|
|
!BlackheartMet ? Step switch
|
|
{
|
|
if (!BlackheartMet)
|
|
return Step switch
|
|
{
|
|
1 =>
|
|
/* You must gather each ingredient on the Hag's list so that she can cook
|
|
* up her vile Magic Brew. The first ingredient is :
|
|
*/
|
|
1055019,
|
|
2 =>
|
|
/* You must gather each ingredient on the Hag's list so that she can cook
|
|
* up her vile Magic Brew. The second ingredient is :
|
|
*/
|
|
1055044,
|
|
_ => 1055045
|
|
};
|
|
|
|
/* You are still attempting to obtain a jug of Captain Blackheart's
|
|
* Whiskey, but the drunkard Captain refuses to share his unique brew.
|
|
* You must prove your worthiness as a pirate to Blackheart before he'll
|
|
* offer you a jug.
|
|
*/
|
|
return 1055055;
|
|
}
|
|
: 1055055;
|
|
|
|
public override int MaxProgress => IngredientInfo.Get(Ingredient).Quantity;
|
|
|
|
public Ingredient[] Ingredients{ get; private set; }
|
|
|
|
public Ingredient Ingredient => Ingredients[^1];
|
|
public int Step => Ingredients.Length;
|
|
public bool BlackheartMet{ get; private set; }
|
|
|
|
public override void RenderProgress(BaseQuestGump gump)
|
|
{
|
|
if (!Completed)
|
|
{
|
|
IngredientInfo info = IngredientInfo.Get(Ingredient);
|
|
|
|
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());
|
|
}
|
|
else
|
|
{
|
|
base.RenderProgress(gump);
|
|
}
|
|
}
|
|
|
|
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);
|
|
|
|
if (info.Creatures.Any(type => creature.GetType() == type))
|
|
{
|
|
Type type = info.Creatures[i];
|
|
|
|
if (creature.GetType() == type)
|
|
{
|
|
System.From.SendLocalizedMessage(1055043,
|
|
$"#{info.Name}"); // You gather a ~1_INGREDIENT_NAME~ from the corpse.
|
|
|
|
CurProgress++;
|
|
|
|
CurProgress++;
|
|
}
|
|
}
|
|
|
|
public override void OnComplete()
|
|
{
|
|
if (Ingredient != Ingredient.Whiskey) NextStep();
|
|
}
|
|
|
|
public void NextStep()
|
|
{
|
|
System.From.SendLocalizedMessage(
|
|
1055046); // You have completed your current task on the Hag's Magic Brew Recipe list.
|
|
|
|
if (Step < 3)
|
|
System.AddObjective(new FindIngredientObjective(Ingredients));
|
|
else
|
|
System.AddObjective(new ReturnIngredientsObjective());
|
|
}
|
|
|
|
public override void ChildDeserialize(GenericReader reader)
|
|
{
|
|
int version = reader.ReadEncodedInt();
|
|
|
|
Ingredients = new Ingredient[reader.ReadEncodedInt()];
|
|
for (int i = 0; i < Ingredients.Length; i++)
|
|
Ingredients[i] = (Ingredient)reader.ReadEncodedInt();
|
|
|
|
BlackheartMet = reader.ReadBool();
|
|
}
|
|
|
|
public override void ChildSerialize(GenericWriter writer)
|
|
{
|
|
writer.WriteEncodedInt(0); // version
|
|
|
|
writer.WriteEncodedInt(Ingredients.Length);
|
|
for (int i = 0; i < Ingredients.Length; i++)
|
|
writer.WriteEncodedInt((int)Ingredients[i]);
|
|
|
|
writer.Write(BlackheartMet);
|
|
}
|
|
}
|
|
|
|
public class ReturnIngredientsObjective : QuestObjective
|
|
{
|
|
public override object Message => 1055050;
|
|
|
|
public override void OnComplete()
|
|
{
|
|
System.AddConversation(new EndConversation());
|
|
}
|
|
}
|
|
}
|