ModernUO/Projects/UOContent/Engines/Quests/Study of the Solen Hive/StudyOfSolenQuest.cs
Kamron Batman 4ddb3de026
fix(core): Fixes several serialization issues (#355)
- [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
2020-12-23 07:11:41 -08:00

63 lines
1.7 KiB
C#

using System;
using Server.Mobiles;
namespace Server.Engines.Quests.Naturalist
{
public class StudyOfSolenQuest : QuestSystem
{
private static readonly Type[] m_TypeReferenceTable =
{
typeof(StudyNestsObjective),
typeof(ReturnToNaturalistObjective),
typeof(DontOfferConversation),
typeof(AcceptConversation),
typeof(NaturalistDuringStudyConversation),
typeof(EndConversation),
typeof(SpecialEndConversation),
typeof(FullBackpackConversation)
};
public StudyOfSolenQuest(PlayerMobile from, Naturalist naturalist) : base(from) => Naturalist = naturalist;
// Serialization
public StudyOfSolenQuest()
{
}
public override Type[] TypeReferenceTable => m_TypeReferenceTable;
public override object Name => 1054041;
public override object OfferMessage => 1054042;
public override TimeSpan RestartDelay => TimeSpan.Zero;
public override bool IsTutorial => false;
public override int Picture => 0x15C7;
public Naturalist Naturalist { get; private set; }
public override void ChildDeserialize(IGenericReader reader)
{
var version = reader.ReadEncodedInt();
Naturalist = (Naturalist)reader.ReadEntity<Mobile>();
}
public override void ChildSerialize(IGenericWriter writer)
{
writer.WriteEncodedInt(0); // version
writer.Write(Naturalist);
}
public override void Accept()
{
base.Accept();
Naturalist?.PlaySound(0x431);
AddConversation(new AcceptConversation());
}
}
}