- [X] Fixes an issue where a buffer smaller than 8 bytes would not double with enough space in some cases. - [X] Fixes an issue with dupe copying the savebuffer reference (ugh). - [X] Streamlines the IGenericWriter API to use better generics. - [X] Streamlines the IGenericReader API to use better generics. - [X] Forces `tidying` of a List/HashSet to be done externally since Writers/Readers should not have side effects. - [X] Fixes an issue where Tidying a list didn't TrimExcess, causing memory leaks. - [X] Reverted the meaning of `World.Running` to specifically refer to any world state post world loading. - NOTE: Do not use this if you want to block on world saves. Instead use checks against `WorldState.Saving` states. - [X] Fixes an issue with serializing negative DateTime deltas. - [X] Fixes a potential issue with serializing non-UTC DateTime. Bumps release version
120 lines
3.2 KiB
C#
120 lines
3.2 KiB
C#
using System;
|
|
using Server.Items;
|
|
using Server.Mobiles;
|
|
|
|
namespace Server.Engines.Quests.Doom
|
|
{
|
|
public class TheSummoningQuest : QuestSystem
|
|
{
|
|
private static readonly Type[] m_TypeReferenceTable =
|
|
{
|
|
typeof(AcceptConversation),
|
|
typeof(CollectBonesObjective),
|
|
typeof(VanquishDaemonConversation),
|
|
typeof(VanquishDaemonObjective)
|
|
};
|
|
|
|
public TheSummoningQuest(Victoria victoria, PlayerMobile from) : base(from) => Victoria = victoria;
|
|
|
|
public TheSummoningQuest()
|
|
{
|
|
}
|
|
|
|
public override Type[] TypeReferenceTable => m_TypeReferenceTable;
|
|
|
|
public Victoria Victoria { get; private set; }
|
|
|
|
public bool WaitForSummon { get; set; }
|
|
|
|
public override object Name => 1050025;
|
|
|
|
public override object OfferMessage => 1050020;
|
|
|
|
public override bool IsTutorial => false;
|
|
public override TimeSpan RestartDelay => TimeSpan.Zero;
|
|
public override int Picture => 0x15B5;
|
|
|
|
// NOTE: Quest not entirely OSI-accurate: some changes made to prevent numerous OSI bugs
|
|
|
|
public override void Slice()
|
|
{
|
|
if (WaitForSummon && Victoria != null)
|
|
{
|
|
var altar = Victoria.Altar;
|
|
|
|
if (altar != null && altar.Daemon?.Alive != true)
|
|
{
|
|
if (From.Map == Victoria.Map && From.InRange(Victoria, 8))
|
|
{
|
|
WaitForSummon = false;
|
|
|
|
AddConversation(new VanquishDaemonConversation());
|
|
}
|
|
}
|
|
}
|
|
|
|
base.Slice();
|
|
}
|
|
|
|
public static int GetDaemonBonesFor(BaseCreature creature)
|
|
{
|
|
if (creature?.Controlled != false || creature.Summoned)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
var fame = creature.Fame;
|
|
|
|
if (fame < 1500)
|
|
{
|
|
return Utility.Dice(2, 5, -1);
|
|
}
|
|
|
|
if (fame < 20000)
|
|
{
|
|
return Utility.Dice(2, 4, 8);
|
|
}
|
|
|
|
return 50;
|
|
}
|
|
|
|
public override void Cancel()
|
|
{
|
|
base.Cancel();
|
|
|
|
QuestObjective obj = FindObjective<CollectBonesObjective>();
|
|
|
|
if (obj?.CurProgress > 0)
|
|
{
|
|
From.BankBox.DropItem(new DaemonBone(obj.CurProgress));
|
|
|
|
From.SendLocalizedMessage(
|
|
1050030
|
|
); // The Daemon bones that you have thus far given to Victoria have been returned to you.
|
|
}
|
|
}
|
|
|
|
public override void Accept()
|
|
{
|
|
base.Accept();
|
|
|
|
AddConversation(new AcceptConversation());
|
|
}
|
|
|
|
public override void ChildDeserialize(IGenericReader reader)
|
|
{
|
|
var version = reader.ReadEncodedInt();
|
|
|
|
Victoria = reader.ReadEntity<Victoria>();
|
|
WaitForSummon = reader.ReadBool();
|
|
}
|
|
|
|
public override void ChildSerialize(IGenericWriter writer)
|
|
{
|
|
writer.WriteEncodedInt(0); // version
|
|
|
|
writer.Write(Victoria);
|
|
writer.Write(WaitForSummon);
|
|
}
|
|
}
|
|
}
|