Fixes code according to modern code style. Fixes a few expression bugs.

This commit is contained in:
Kamron Batman 2018-09-15 09:58:51 -07:00
parent 89eea25e5f
commit 970fd563b2
3324 changed files with 441118 additions and 433755 deletions

View file

@ -1,231 +1,183 @@
namespace Server.Engines.Quests.Matriarch
{
public class DontOfferConversation : QuestConversation
{
private bool m_Friend;
public class DontOfferConversation : QuestConversation
{
private bool m_Friend;
public override object Message
{
get
{
if ( m_Friend )
{
/* <I>The Solen Matriarch smiles as you greet her.</I><BR><BR>
*
* It is good to see you again. I would offer to process some zoogi fungus for you,
* but you seem to be busy with another task at the moment. Perhaps you should
* finish whatever is occupying your attention at the moment and return to me once
* you're done.
*/
return 1054081;
}
public DontOfferConversation(bool friend)
{
m_Friend = friend;
}
/* <I>The Solen Matriarch smiles as she eats the seed you offered.</I><BR><BR>
*
* Thank you for that seed. It was quite delicious. <BR><BR>
*
* I would offer to make you a friend of my colony, but you seem to be busy with
* another task at the moment. Perhaps you should finish whatever is occupying
* your attention at the moment and return to me once you're done.
*/
return 1054079;
}
}
public DontOfferConversation()
{
}
public override bool Logged => false;
public override object Message
{
get
{
if (m_Friend) return 1054081;
public DontOfferConversation( bool friend )
{
m_Friend = friend;
}
/* <I>The Solen Matriarch smiles as she eats the seed you offered.</I><BR><BR>
*
* Thank you for that seed. It was quite delicious. <BR><BR>
*
* I would offer to make you a friend of my colony, but you seem to be busy with
* another task at the moment. Perhaps you should finish whatever is occupying
* your attention at the moment and return to me once you're done.
*/
return 1054079;
}
}
public DontOfferConversation()
{
}
public override bool Logged => false;
public override void ChildDeserialize( GenericReader reader )
{
int version = reader.ReadEncodedInt();
public override void ChildDeserialize(GenericReader reader)
{
int version = reader.ReadEncodedInt();
m_Friend = reader.ReadBool();
}
m_Friend = reader.ReadBool();
}
public override void ChildSerialize( GenericWriter writer )
{
writer.WriteEncodedInt( (int) 0 ); // version
public override void ChildSerialize(GenericWriter writer)
{
writer.WriteEncodedInt(0); // version
writer.Write( (bool) m_Friend );
}
}
writer.Write(m_Friend);
}
}
public class AcceptConversation : QuestConversation
{
public override object Message => 1054084;
public class AcceptConversation : QuestConversation
{
public override object Message => 1054084;
public AcceptConversation()
{
}
public override void OnRead()
{
System.AddObjective(new KillInfiltratorsObjective());
}
}
public override void OnRead()
{
System.AddObjective( new KillInfiltratorsObjective() );
}
}
public class DuringKillInfiltratorsConversation : QuestConversation
{
public override object Message => 1054089;
public class DuringKillInfiltratorsConversation : QuestConversation
{
public override object Message => 1054089;
public override bool Logged => false;
}
public override bool Logged => false;
public class GatherWaterConversation : QuestConversation
{
public override object Message => 1054091;
public DuringKillInfiltratorsConversation()
{
}
}
public override void OnRead()
{
System.AddObjective(new GatherWaterObjective());
}
}
public class GatherWaterConversation : QuestConversation
{
public override object Message => 1054091;
public class DuringWaterGatheringConversation : QuestConversation
{
public override object Message => 1054094;
public GatherWaterConversation()
{
}
public override bool Logged => false;
}
public override void OnRead()
{
System.AddObjective( new GatherWaterObjective() );
}
}
public class ProcessFungiConversation : QuestConversation
{
private bool m_Friend;
public class DuringWaterGatheringConversation : QuestConversation
{
public override object Message => 1054094;
public ProcessFungiConversation(bool friend)
{
m_Friend = friend;
}
public override bool Logged => false;
public ProcessFungiConversation()
{
}
public DuringWaterGatheringConversation()
{
}
}
public override object Message
{
get
{
if (m_Friend) return 1054097;
public class ProcessFungiConversation : QuestConversation
{
private bool m_Friend;
/* <I>The Solen Matriarch listens as you report the completion of your
* tasks to her.</I><BR><BR>
*
* I give you my thanks for your help, and I will gladly make you a friend of my
* solen colony. My warriors, workers, and queens will not longer look at you
* as an intruder and attack you when you enter our lair.<BR><BR>
*
* I will also process some zoogi fungus into powder of translocation for you.
* Two of the zoogi fungi are required for each measure of the powder. I will
* process up to 200 zoogi fungi into 100 measures of powder of translocation.<BR><BR>
*
* I will also give you some gold for assisting me and my colony, but first let's
* take care of your zoogi fungus.
*/
return 1054096;
}
}
public override object Message
{
get
{
if ( m_Friend )
{
/* <I>The Solen Matriarch listens as you report the completion of your
* tasks to her.</I><BR><BR>
*
* I give you my thanks for your help, and I will gladly process some zoogi
* fungus into powder of translocation for you. Two of the zoogi fungi are
* required for each measure of the powder. I will process up to 200 zoogi fungi
* into 100 measures of powder of translocation.<BR><BR>
*
* I will also give you some gold for assisting me and my colony, but first let's
* take care of your zoogi fungus.
*/
return 1054097;
}
public override void OnRead()
{
System.AddObjective(new ProcessFungiObjective());
}
/* <I>The Solen Matriarch listens as you report the completion of your
* tasks to her.</I><BR><BR>
*
* I give you my thanks for your help, and I will gladly make you a friend of my
* solen colony. My warriors, workers, and queens will not longer look at you
* as an intruder and attack you when you enter our lair.<BR><BR>
*
* I will also process some zoogi fungus into powder of translocation for you.
* Two of the zoogi fungi are required for each measure of the powder. I will
* process up to 200 zoogi fungi into 100 measures of powder of translocation.<BR><BR>
*
* I will also give you some gold for assisting me and my colony, but first let's
* take care of your zoogi fungus.
*/
return 1054096;
}
}
public override void ChildDeserialize(GenericReader reader)
{
int version = reader.ReadEncodedInt();
public ProcessFungiConversation( bool friend )
{
m_Friend = friend;
}
m_Friend = reader.ReadBool();
}
public override void OnRead()
{
System.AddObjective( new ProcessFungiObjective() );
}
public override void ChildSerialize(GenericWriter writer)
{
writer.WriteEncodedInt(0); // version
public ProcessFungiConversation()
{
}
writer.Write(m_Friend);
}
}
public override void ChildDeserialize( GenericReader reader )
{
int version = reader.ReadEncodedInt();
public class DuringFungiProcessConversation : QuestConversation
{
public override object Message => 1054099;
m_Friend = reader.ReadBool();
}
public override bool Logged => false;
}
public override void ChildSerialize( GenericWriter writer )
{
writer.WriteEncodedInt( (int) 0 ); // version
public class FullBackpackConversation : QuestConversation
{
private bool m_Logged;
writer.Write( (bool) m_Friend );
}
}
public FullBackpackConversation(bool logged)
{
m_Logged = logged;
}
public class DuringFungiProcessConversation : QuestConversation
{
public override object Message => 1054099;
public FullBackpackConversation()
{
m_Logged = true;
}
public override bool Logged => false;
public override object Message => 1054102;
public DuringFungiProcessConversation()
{
}
}
public override bool Logged => m_Logged;
public class FullBackpackConversation : QuestConversation
{
public override object Message => 1054102;
public override void OnRead()
{
if (m_Logged)
System.AddObjective(new GetRewardObjective());
}
}
private bool m_Logged;
public class EndConversation : QuestConversation
{
public override object Message => 1054101;
public override bool Logged => m_Logged;
public FullBackpackConversation( bool logged )
{
m_Logged = logged;
}
public FullBackpackConversation()
{
m_Logged = true;
}
public override void OnRead()
{
if ( m_Logged )
System.AddObjective( new GetRewardObjective() );
}
}
public class EndConversation : QuestConversation
{
public override object Message => 1054101;
public EndConversation()
{
}
public override void OnRead()
{
System.Complete();
}
}
}
public override void OnRead()
{
System.Complete();
}
}
}

View file

@ -1,317 +1,299 @@
using System.Collections.Generic;
using Server.ContextMenus;
using Server.Engines.Plants;
using Server.Items;
using Server.Mobiles;
using Server.Targeting;
using Server.ContextMenus;
using Server.Engines.Plants;
namespace Server.Engines.Quests.Matriarch
{
public abstract class BaseSolenMatriarch : BaseQuester
{
public abstract bool RedSolen{ get; }
public override string DefaultName => "the solen matriarch";
public override bool DisallowAllMoves => false;
public abstract class BaseSolenMatriarch : BaseQuester
{
public BaseSolenMatriarch()
{
Body = 0x328;
public BaseSolenMatriarch()
{
Body = 0x328;
if (!RedSolen)
Hue = 0x44E;
if ( !RedSolen )
Hue = 0x44E;
SpeechHue = 0;
}
SpeechHue = 0;
}
public BaseSolenMatriarch(Serial serial) : base(serial)
{
}
public override int GetIdleSound()
{
return 0x10D;
}
public abstract bool RedSolen{ get; }
public override string DefaultName => "the solen matriarch";
public override bool DisallowAllMoves => false;
public override bool CanTalkTo( PlayerMobile to )
{
if ( SolenMatriarchQuest.IsFriend( to, RedSolen ) )
return true;
public override int GetIdleSound()
{
return 0x10D;
}
return to.Quest is SolenMatriarchQuest qs && qs.RedSolen == RedSolen;
}
public override bool CanTalkTo(PlayerMobile to)
{
if (SolenMatriarchQuest.IsFriend(to, RedSolen))
return true;
public override void OnTalk( PlayerMobile player, bool contextMenu )
{
Direction = GetDirectionTo( player );
return to.Quest is SolenMatriarchQuest qs && qs.RedSolen == RedSolen;
}
if ( player.Quest is SolenMatriarchQuest qs && qs.RedSolen == RedSolen )
{
if ( qs.IsObjectiveInProgress( typeof( KillInfiltratorsObjective ) ) )
{
qs.AddConversation( new DuringKillInfiltratorsConversation() );
}
else
{
QuestObjective obj = qs.FindObjective( typeof( ReturnAfterKillsObjective ) );
public override void OnTalk(PlayerMobile player, bool contextMenu)
{
Direction = GetDirectionTo(player);
if ( obj != null && !obj.Completed )
{
obj.Complete();
}
else if ( qs.IsObjectiveInProgress( typeof( GatherWaterObjective ) ) )
{
qs.AddConversation( new DuringWaterGatheringConversation() );
}
else
{
obj = qs.FindObjective( typeof( ReturnAfterWaterObjective ) );
if (player.Quest is SolenMatriarchQuest qs && qs.RedSolen == RedSolen)
{
if (qs.IsObjectiveInProgress(typeof(KillInfiltratorsObjective)))
{
qs.AddConversation(new DuringKillInfiltratorsConversation());
}
else
{
QuestObjective obj = qs.FindObjective(typeof(ReturnAfterKillsObjective));
if ( obj != null && !obj.Completed )
{
obj.Complete();
}
else if ( qs.IsObjectiveInProgress( typeof( ProcessFungiObjective ) ) )
{
qs.AddConversation( new DuringFungiProcessConversation() );
}
else
{
obj = qs.FindObjective( typeof( GetRewardObjective ) );
if (obj != null && !obj.Completed)
{
obj.Complete();
}
else if (qs.IsObjectiveInProgress(typeof(GatherWaterObjective)))
{
qs.AddConversation(new DuringWaterGatheringConversation());
}
else
{
obj = qs.FindObjective(typeof(ReturnAfterWaterObjective));
if ( obj != null && !obj.Completed )
{
if ( SolenMatriarchQuest.GiveRewardTo( player ) )
{
obj.Complete();
}
else
{
qs.AddConversation( new FullBackpackConversation( false ) );
}
}
}
}
}
}
else if ( SolenMatriarchQuest.IsFriend( player, RedSolen ) )
{
QuestSystem newQuest = new SolenMatriarchQuest( player, RedSolen );
if (obj != null && !obj.Completed)
{
obj.Complete();
}
else if (qs.IsObjectiveInProgress(typeof(ProcessFungiObjective)))
{
qs.AddConversation(new DuringFungiProcessConversation());
}
else
{
obj = qs.FindObjective(typeof(GetRewardObjective));
if ( player.Quest == null && QuestSystem.CanOfferQuest( player, typeof( SolenMatriarchQuest ) ) )
{
newQuest.SendOffer();
}
else
{
newQuest.AddConversation( new DontOfferConversation( true ) );
}
}
}
if (obj != null && !obj.Completed)
{
if (SolenMatriarchQuest.GiveRewardTo(player))
obj.Complete();
else
qs.AddConversation(new FullBackpackConversation(false));
}
}
}
}
}
else if (SolenMatriarchQuest.IsFriend(player, RedSolen))
{
QuestSystem newQuest = new SolenMatriarchQuest(player, RedSolen);
public override bool OnDragDrop( Mobile from, Item dropped )
{
if ( from is PlayerMobile player )
{
if ( dropped is Seed )
{
if ( player.Quest is SolenMatriarchQuest qs && qs.RedSolen == RedSolen )
{
SayTo( player, 1054080 ); // Thank you for that plant seed. Those have such wonderful flavor.
}
else
{
QuestSystem newQuest = new SolenMatriarchQuest( player, RedSolen );
if (player.Quest == null && QuestSystem.CanOfferQuest(player, typeof(SolenMatriarchQuest)))
newQuest.SendOffer();
else
newQuest.AddConversation(new DontOfferConversation(true));
}
}
if ( player.Quest == null && QuestSystem.CanOfferQuest( player, typeof( SolenMatriarchQuest ) ) )
{
newQuest.SendOffer();
}
else
{
newQuest.AddConversation( new DontOfferConversation( SolenMatriarchQuest.IsFriend( player, RedSolen ) ) );
}
}
public override bool OnDragDrop(Mobile from, Item dropped)
{
if (from is PlayerMobile player)
{
if (dropped is Seed)
{
if (player.Quest is SolenMatriarchQuest qs && qs.RedSolen == RedSolen)
{
SayTo(player, 1054080); // Thank you for that plant seed. Those have such wonderful flavor.
}
else
{
QuestSystem newQuest = new SolenMatriarchQuest(player, RedSolen);
dropped.Delete();
return true;
}
if ( dropped is ZoogiFungus fungus )
{
OnGivenFungi( player, fungus );
if (player.Quest == null && QuestSystem.CanOfferQuest(player, typeof(SolenMatriarchQuest)))
newQuest.SendOffer();
else
newQuest.AddConversation(
new DontOfferConversation(SolenMatriarchQuest.IsFriend(player, RedSolen)));
}
return fungus.Deleted;
}
}
dropped.Delete();
return true;
}
return base.OnDragDrop( from, dropped );
}
if (dropped is ZoogiFungus fungus)
{
OnGivenFungi(player, fungus);
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
{
base.GetContextMenuEntries( from, list );
return fungus.Deleted;
}
}
if ( from.Alive )
{
if ( from is PlayerMobile pm )
{
if ( pm.Quest is SolenMatriarchQuest qs && qs.RedSolen == RedSolen )
{
if ( qs.IsObjectiveInProgress( typeof( ProcessFungiObjective ) ) )
{
list.Add( new ProcessZoogiFungusEntry( this, pm ) );
}
}
}
}
}
return base.OnDragDrop(from, dropped);
}
private class ProcessZoogiFungusEntry : ContextMenuEntry
{
private BaseSolenMatriarch m_Matriarch;
private PlayerMobile m_From;
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
{
base.GetContextMenuEntries(from, list);
public ProcessZoogiFungusEntry( BaseSolenMatriarch matriarch, PlayerMobile from ) : base( 6184 )
{
m_Matriarch = matriarch;
m_From = from;
}
if (from.Alive)
if (from is PlayerMobile pm)
if (pm.Quest is SolenMatriarchQuest qs && qs.RedSolen == RedSolen)
if (qs.IsObjectiveInProgress(typeof(ProcessFungiObjective)))
list.Add(new ProcessZoogiFungusEntry(this, pm));
}
public override void OnClick()
{
if ( m_From.Alive )
m_From.Target = new ProcessFungiTarget( m_Matriarch, m_From );
}
}
public void OnGivenFungi(PlayerMobile player, ZoogiFungus fungi)
{
Direction = GetDirectionTo(player);
private class ProcessFungiTarget : Target
{
private BaseSolenMatriarch m_Matriarch;
private PlayerMobile m_From;
if (player.Quest is SolenMatriarchQuest qs && qs.RedSolen == RedSolen)
{
QuestObjective obj = qs.FindObjective(typeof(ProcessFungiObjective));
public ProcessFungiTarget( BaseSolenMatriarch matriarch, PlayerMobile from ) : base( -1, false, TargetFlags.None )
{
m_Matriarch = matriarch;
m_From = from;
}
if (obj != null && !obj.Completed)
{
int amount = fungi.Amount / 2;
protected override void OnTargetCancel( Mobile from, TargetCancelType cancelType )
{
from.SendLocalizedMessage( 1042021, "", 0x59 ); // Cancelled.
}
if (amount > 100)
amount = 100;
protected override void OnTarget( Mobile from, object targeted )
{
if ( targeted is ZoogiFungus fungus )
{
if ( fungus.IsChildOf( m_From.Backpack ) )
m_Matriarch.OnGivenFungi( m_From, fungus );
else
m_From.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
}
}
}
if (amount > 0)
{
if (amount * 2 >= fungi.Amount)
fungi.Delete();
else
fungi.Amount -= amount * 2;
public void OnGivenFungi( PlayerMobile player, ZoogiFungus fungi )
{
Direction = GetDirectionTo( player );
PowderOfTranslocation powder = new PowderOfTranslocation(amount);
player.AddToBackpack(powder);
if ( player.Quest is SolenMatriarchQuest qs && qs.RedSolen == RedSolen )
{
QuestObjective obj = qs.FindObjective( typeof( ProcessFungiObjective ) );
player.SendLocalizedMessage(1054100); // You receive some powder of translocation.
if ( obj != null && !obj.Completed )
{
int amount = fungi.Amount / 2;
obj.Complete();
}
}
}
}
if ( amount > 100 )
amount = 100;
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
if ( amount > 0 )
{
if ( amount * 2 >= fungi.Amount )
fungi.Delete();
else
fungi.Amount -= amount * 2;
writer.WriteEncodedInt(0); // version
}
PowderOfTranslocation powder = new PowderOfTranslocation( amount );
player.AddToBackpack( powder );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
player.SendLocalizedMessage( 1054100 ); // You receive some powder of translocation.
int version = reader.ReadEncodedInt();
}
obj.Complete();
}
}
}
}
private class ProcessZoogiFungusEntry : ContextMenuEntry
{
private PlayerMobile m_From;
private BaseSolenMatriarch m_Matriarch;
public BaseSolenMatriarch( Serial serial ) : base( serial )
{
}
public ProcessZoogiFungusEntry(BaseSolenMatriarch matriarch, PlayerMobile from) : base(6184)
{
m_Matriarch = matriarch;
m_From = from;
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void OnClick()
{
if (m_From.Alive)
m_From.Target = new ProcessFungiTarget(m_Matriarch, m_From);
}
}
writer.WriteEncodedInt( (int) 0 ); // version
}
private class ProcessFungiTarget : Target
{
private PlayerMobile m_From;
private BaseSolenMatriarch m_Matriarch;
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public ProcessFungiTarget(BaseSolenMatriarch matriarch, PlayerMobile from) : base(-1, false, TargetFlags.None)
{
m_Matriarch = matriarch;
m_From = from;
}
int version = reader.ReadEncodedInt();
}
}
protected override void OnTargetCancel(Mobile from, TargetCancelType cancelType)
{
from.SendLocalizedMessage(1042021, "", 0x59); // Cancelled.
}
public class RedSolenMatriarch : BaseSolenMatriarch
{
public override bool RedSolen => true;
protected override void OnTarget(Mobile from, object targeted)
{
if (targeted is ZoogiFungus fungus)
{
if (fungus.IsChildOf(m_From.Backpack))
m_Matriarch.OnGivenFungi(m_From, fungus);
else
m_From.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
}
}
}
[Constructible]
public RedSolenMatriarch()
{
}
public class RedSolenMatriarch : BaseSolenMatriarch
{
[Constructible]
public RedSolenMatriarch()
{
}
public RedSolenMatriarch( Serial serial ) : base( serial )
{
}
public RedSolenMatriarch(Serial serial) : base(serial)
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override bool RedSolen => true;
writer.WriteEncodedInt( (int) 0 ); // version
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
writer.WriteEncodedInt(0); // version
}
int version = reader.ReadEncodedInt();
}
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
public class BlackSolenMatriarch : BaseSolenMatriarch
{
public override bool RedSolen => false;
int version = reader.ReadEncodedInt();
}
}
[Constructible]
public BlackSolenMatriarch()
{
}
public class BlackSolenMatriarch : BaseSolenMatriarch
{
[Constructible]
public BlackSolenMatriarch()
{
}
public BlackSolenMatriarch( Serial serial ) : base( serial )
{
}
public BlackSolenMatriarch(Serial serial) : base(serial)
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override bool RedSolen => false;
writer.WriteEncodedInt( (int) 0 ); // version
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
writer.WriteEncodedInt(0); // version
}
int version = reader.ReadEncodedInt();
}
}
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
}
}
}

View file

@ -1,169 +1,143 @@
using Server.Mobiles;
using Server.Items;
using Server.Mobiles;
namespace Server.Engines.Quests.Matriarch
{
public class KillInfiltratorsObjective : QuestObjective
{
public override object Message => ((SolenMatriarchQuest)System).RedSolen ? 1054086 : 1054085;
public class KillInfiltratorsObjective : QuestObjective
{
public override object Message => ((SolenMatriarchQuest)System).RedSolen ? 1054086 : 1054085;
public override int MaxProgress => 7;
public override int MaxProgress => 7;
public KillInfiltratorsObjective()
{
}
public override void RenderProgress(BaseQuestGump gump)
{
if (!Completed)
{
// Black/Red Solen Infiltrators killed:
gump.AddHtmlLocalized(70, 260, 270, 100, ((SolenMatriarchQuest)System).RedSolen ? 1054088 : 1054087,
BaseQuestGump.Blue, false, false);
gump.AddLabel(70, 280, 0x64, CurProgress.ToString());
gump.AddLabel(100, 280, 0x64, "/");
gump.AddLabel(130, 280, 0x64, MaxProgress.ToString());
}
else
{
base.RenderProgress(gump);
}
}
public override void RenderProgress( BaseQuestGump gump )
{
if ( !Completed )
{
// Black/Red Solen Infiltrators killed:
gump.AddHtmlLocalized( 70, 260, 270, 100, ((SolenMatriarchQuest)System).RedSolen ? 1054088 : 1054087, BaseQuestGump.Blue, false, false );
gump.AddLabel( 70, 280, 0x64, CurProgress.ToString() );
gump.AddLabel( 100, 280, 0x64, "/" );
gump.AddLabel( 130, 280, 0x64, MaxProgress.ToString() );
}
else
{
base.RenderProgress( gump );
}
}
public override bool IgnoreYoungProtection(Mobile from)
{
if (Completed)
return false;
public override bool IgnoreYoungProtection( Mobile from )
{
if ( Completed )
return false;
bool redSolen = ((SolenMatriarchQuest)System).RedSolen;
bool redSolen = ((SolenMatriarchQuest)System).RedSolen;
if (redSolen)
return from is BlackSolenInfiltratorWarrior || from is BlackSolenInfiltratorQueen;
return from is RedSolenInfiltratorWarrior || from is RedSolenInfiltratorQueen;
}
if ( redSolen )
return from is BlackSolenInfiltratorWarrior || from is BlackSolenInfiltratorQueen;
return from is RedSolenInfiltratorWarrior || from is RedSolenInfiltratorQueen;
}
public override void OnKill(BaseCreature creature, Container corpse)
{
bool redSolen = ((SolenMatriarchQuest)System).RedSolen;
public override void OnKill( BaseCreature creature, Container corpse )
{
bool redSolen = ((SolenMatriarchQuest)System).RedSolen;
if (redSolen)
{
if (creature is BlackSolenInfiltratorWarrior || creature is BlackSolenInfiltratorQueen)
CurProgress++;
}
else
{
if (creature is RedSolenInfiltratorWarrior || creature is RedSolenInfiltratorQueen)
CurProgress++;
}
}
if ( redSolen )
{
if ( creature is BlackSolenInfiltratorWarrior || creature is BlackSolenInfiltratorQueen )
CurProgress++;
}
else
{
if ( creature is RedSolenInfiltratorWarrior || creature is RedSolenInfiltratorQueen )
CurProgress++;
}
}
public override void OnComplete()
{
System.AddObjective(new ReturnAfterKillsObjective());
}
}
public override void OnComplete()
{
System.AddObjective( new ReturnAfterKillsObjective() );
}
}
public class ReturnAfterKillsObjective : QuestObjective
{
public override object Message => 1054090;
public class ReturnAfterKillsObjective : QuestObjective
{
public override object Message => 1054090;
public override void OnComplete()
{
System.AddConversation(new GatherWaterConversation());
}
}
public ReturnAfterKillsObjective()
{
}
public class GatherWaterObjective : QuestObjective
{
public override object Message => 1054092;
public override void OnComplete()
{
System.AddConversation( new GatherWaterConversation() );
}
}
public override int MaxProgress => 40;
public class GatherWaterObjective : QuestObjective
{
public override object Message => 1054092;
public override void RenderProgress(BaseQuestGump gump)
{
if (!Completed)
{
gump.AddHtmlLocalized(70, 260, 270, 100, 1054093, BaseQuestGump.Blue, false,
false); // Gallons of Water gathered:
gump.AddLabel(70, 280, 0x64, (CurProgress / 5).ToString());
gump.AddLabel(100, 280, 0x64, "/");
gump.AddLabel(130, 280, 0x64, (MaxProgress / 5).ToString());
}
else
{
base.RenderProgress(gump);
}
}
public override int MaxProgress => 40;
public override void OnComplete()
{
System.AddObjective(new ReturnAfterWaterObjective());
}
}
public GatherWaterObjective()
{
}
public class ReturnAfterWaterObjective : QuestObjective
{
public override object Message => 1054095;
public override void RenderProgress( BaseQuestGump gump )
{
if ( !Completed )
{
gump.AddHtmlLocalized( 70, 260, 270, 100, 1054093, BaseQuestGump.Blue, false, false ); // Gallons of Water gathered:
gump.AddLabel( 70, 280, 0x64, (CurProgress / 5).ToString() );
gump.AddLabel( 100, 280, 0x64, "/" );
gump.AddLabel( 130, 280, 0x64, (MaxProgress / 5).ToString() );
}
else
{
base.RenderProgress( gump );
}
}
public override void OnComplete()
{
PlayerMobile player = System.From;
bool redSolen = ((SolenMatriarchQuest)System).RedSolen;
public override void OnComplete()
{
System.AddObjective( new ReturnAfterWaterObjective() );
}
}
bool friend = SolenMatriarchQuest.IsFriend(player, redSolen);
public class ReturnAfterWaterObjective : QuestObjective
{
public override object Message => 1054095;
System.AddConversation(new ProcessFungiConversation(friend));
public ReturnAfterWaterObjective()
{
}
if (redSolen)
player.SolenFriendship = SolenFriendship.Red;
else
player.SolenFriendship = SolenFriendship.Black;
}
}
public override void OnComplete()
{
PlayerMobile player = System.From;
bool redSolen = ((SolenMatriarchQuest)System).RedSolen;
public class ProcessFungiObjective : QuestObjective
{
public override object Message => 1054098;
bool friend = SolenMatriarchQuest.IsFriend( player, redSolen );
public override void OnComplete()
{
if (SolenMatriarchQuest.GiveRewardTo(System.From))
System.Complete();
else
System.AddConversation(new FullBackpackConversation(true));
}
}
System.AddConversation( new ProcessFungiConversation( friend ) );
public class GetRewardObjective : QuestObjective
{
public override object Message => 1054149;
if ( redSolen )
player.SolenFriendship = SolenFriendship.Red;
else
player.SolenFriendship = SolenFriendship.Black;
}
}
public class ProcessFungiObjective : QuestObjective
{
public override object Message => 1054098;
public ProcessFungiObjective()
{
}
public override void OnComplete()
{
if ( SolenMatriarchQuest.GiveRewardTo( System.From ) )
{
System.Complete();
}
else
{
System.AddConversation( new FullBackpackConversation( true ) );
}
}
}
public class GetRewardObjective : QuestObjective
{
public override object Message => 1054149;
public GetRewardObjective()
{
}
public override void OnComplete()
{
System.AddConversation( new EndConversation() );
}
}
}
public override void OnComplete()
{
System.AddConversation(new EndConversation());
}
}
}

View file

@ -1,144 +1,124 @@
using System;
using Server.Mobiles;
using Server.Items;
using Server.Mobiles;
namespace Server.Engines.Quests.Matriarch
{
public class SolenMatriarchQuest : QuestSystem
{
private static Type[] m_TypeReferenceTable = {
typeof( DontOfferConversation ),
typeof( AcceptConversation ),
typeof( DuringKillInfiltratorsConversation ),
typeof( GatherWaterConversation ),
typeof( DuringWaterGatheringConversation ),
typeof( ProcessFungiConversation ),
typeof( DuringFungiProcessConversation ),
typeof( FullBackpackConversation ),
typeof( EndConversation ),
typeof( KillInfiltratorsObjective ),
typeof( ReturnAfterKillsObjective ),
typeof( GatherWaterObjective ),
typeof( ReturnAfterWaterObjective ),
typeof( ProcessFungiObjective ),
typeof( GetRewardObjective )
};
public class SolenMatriarchQuest : QuestSystem
{
private static Type[] m_TypeReferenceTable =
{
typeof(DontOfferConversation),
typeof(AcceptConversation),
typeof(DuringKillInfiltratorsConversation),
typeof(GatherWaterConversation),
typeof(DuringWaterGatheringConversation),
typeof(ProcessFungiConversation),
typeof(DuringFungiProcessConversation),
typeof(FullBackpackConversation),
typeof(EndConversation),
typeof(KillInfiltratorsObjective),
typeof(ReturnAfterKillsObjective),
typeof(GatherWaterObjective),
typeof(ReturnAfterWaterObjective),
typeof(ProcessFungiObjective),
typeof(GetRewardObjective)
};
public override Type[] TypeReferenceTable => m_TypeReferenceTable;
public SolenMatriarchQuest(PlayerMobile from, bool redSolen) : base(from)
{
RedSolen = redSolen;
}
public override object Name => 1054147;
// Serialization
public SolenMatriarchQuest()
{
}
public override object OfferMessage
{
get
{
if ( IsFriend( From, RedSolen ) )
{
/* <I>The Solen Matriarch smiles happily as you greet her.</I><BR><BR>
*
* Hello again. It is always good to see a friend of our colony.<BR><BR>
*
* Would you like me to process some zoogi fungus into powder of translocation
* for you? I would be happy to do so if you will first undertake a couple
* tasks for me.<BR><BR>
*
* First, I would like for you to eliminate some infiltrators from the other
* solen colony. They are spying on my colony, and I fear for the safety of my
* people. They must be slain.<BR><BR>
*
* After that, I must ask that you gather some water for me. Our water supplies
* are inadequate, so we must try to supplement our reserve using water vats here
* in our lair.<BR><BR>
*
* Will you accept my offer?
*/
return 1054083;
}
public override Type[] TypeReferenceTable => m_TypeReferenceTable;
/* <I>The Solen Matriarch smiles happily as she eats the seed you offered.</I><BR><BR>
*
* I think you for that seed. I was quite delicious. So full of flavor.<BR><BR>
*
* Hmm... if you would like, I could make you a friend of my colony. This would stop
* the warriors, workers, and queens of my colony from thinking you are an intruder,
* thus they would not attack you. In addition, as a friend of my colony I will process
* zoogi fungus into powder of translocation for you.<BR><BR>
*
* To become a friend of my colony, I ask that you complete a couple tasks for me. These
* are the same tasks I will ask of you when you wish me to process zoogi fungus,
* by the way.<BR><BR>
*
* First, I would like for you to eliminate some infiltrators from the other solen colony.
* They are spying on my colony, and I fear for the safety of my people. They must
* be slain.<BR><BR>
*
* After that, I must ask that you gather some water for me. Our water supplies are
* inadequate, so we must try to supplement our reserve using water vats here in our
* lair.<BR><BR>
*
* Will you accept my offer?
*/
return 1054082;
}
}
public override object Name => 1054147;
public override TimeSpan RestartDelay => TimeSpan.Zero;
public override bool IsTutorial => false;
public override object OfferMessage
{
get
{
if (IsFriend(From, RedSolen)) return 1054083;
public override int Picture => 0x15C9;
/* <I>The Solen Matriarch smiles happily as she eats the seed you offered.</I><BR><BR>
*
* I think you for that seed. I was quite delicious. So full of flavor.<BR><BR>
*
* Hmm... if you would like, I could make you a friend of my colony. This would stop
* the warriors, workers, and queens of my colony from thinking you are an intruder,
* thus they would not attack you. In addition, as a friend of my colony I will process
* zoogi fungus into powder of translocation for you.<BR><BR>
*
* To become a friend of my colony, I ask that you complete a couple tasks for me. These
* are the same tasks I will ask of you when you wish me to process zoogi fungus,
* by the way.<BR><BR>
*
* First, I would like for you to eliminate some infiltrators from the other solen colony.
* They are spying on my colony, and I fear for the safety of my people. They must
* be slain.<BR><BR>
*
* After that, I must ask that you gather some water for me. Our water supplies are
* inadequate, so we must try to supplement our reserve using water vats here in our
* lair.<BR><BR>
*
* Will you accept my offer?
*/
return 1054082;
}
}
public bool RedSolen { get; private set; }
public override TimeSpan RestartDelay => TimeSpan.Zero;
public override bool IsTutorial => false;
public SolenMatriarchQuest( PlayerMobile from, bool redSolen ) : base( from )
{
RedSolen = redSolen;
}
public override int Picture => 0x15C9;
// Serialization
public SolenMatriarchQuest()
{
}
public bool RedSolen{ get; private set; }
public override void ChildDeserialize( GenericReader reader )
{
int version = reader.ReadEncodedInt();
public override void ChildDeserialize(GenericReader reader)
{
int version = reader.ReadEncodedInt();
RedSolen = reader.ReadBool();
}
RedSolen = reader.ReadBool();
}
public override void ChildSerialize( GenericWriter writer )
{
writer.WriteEncodedInt( (int) 0 ); // version
public override void ChildSerialize(GenericWriter writer)
{
writer.WriteEncodedInt(0); // version
writer.Write( (bool) RedSolen );
}
writer.Write(RedSolen);
}
public override void Accept()
{
base.Accept();
public override void Accept()
{
base.Accept();
AddConversation( new AcceptConversation() );
}
AddConversation(new AcceptConversation());
}
public static bool IsFriend( PlayerMobile player, bool redSolen )
{
if ( redSolen )
return player.SolenFriendship == SolenFriendship.Red;
return player.SolenFriendship == SolenFriendship.Black;
}
public static bool IsFriend(PlayerMobile player, bool redSolen)
{
if (redSolen)
return player.SolenFriendship == SolenFriendship.Red;
return player.SolenFriendship == SolenFriendship.Black;
}
public static bool GiveRewardTo( PlayerMobile player )
{
Gold gold = new Gold( Utility.RandomMinMax( 250, 350 ) );
public static bool GiveRewardTo(PlayerMobile player)
{
Gold gold = new Gold(Utility.RandomMinMax(250, 350));
if ( player.PlaceInBackpack( gold ) )
{
player.SendLocalizedMessage( 1054076 ); // You have been given some gold.
return true;
}
if (player.PlaceInBackpack(gold))
{
player.SendLocalizedMessage(1054076); // You have been given some gold.
return true;
}
gold.Delete();
return false;
}
}
}
gold.Delete();
return false;
}
}
}