Reorganizes Project (#41)
This commit is contained in:
parent
08bf44af9a
commit
3614a66aee
3499 changed files with 79 additions and 55 deletions
|
|
@ -0,0 +1,118 @@
|
|||
using System;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.Quests.Ambitious
|
||||
{
|
||||
public class AmbitiousQueenQuest : QuestSystem
|
||||
{
|
||||
private static Type[] m_TypeReferenceTable =
|
||||
{
|
||||
typeof(DontOfferConversation),
|
||||
typeof(AcceptConversation),
|
||||
typeof(DuringKillQueensConversation),
|
||||
typeof(GatherFungiConversation),
|
||||
typeof(DuringFungiGatheringConversation),
|
||||
typeof(EndConversation),
|
||||
typeof(FullBackpackConversation),
|
||||
typeof(End2Conversation),
|
||||
typeof(KillQueensObjective),
|
||||
typeof(ReturnAfterKillsObjective),
|
||||
typeof(GatherFungiObjective),
|
||||
typeof(GetRewardObjective)
|
||||
};
|
||||
|
||||
public AmbitiousQueenQuest(PlayerMobile from, bool redSolen) : base(from)
|
||||
{
|
||||
RedSolen = redSolen;
|
||||
}
|
||||
|
||||
// Serialization
|
||||
public AmbitiousQueenQuest()
|
||||
{
|
||||
}
|
||||
|
||||
public override Type[] TypeReferenceTable => m_TypeReferenceTable;
|
||||
|
||||
public override object Name => 1054146;
|
||||
|
||||
public override object OfferMessage => 1054060;
|
||||
|
||||
public override TimeSpan RestartDelay => TimeSpan.Zero;
|
||||
public override bool IsTutorial => false;
|
||||
|
||||
public override int Picture => 0x15C9;
|
||||
|
||||
public bool RedSolen{ get; private set; }
|
||||
|
||||
public override void ChildDeserialize(GenericReader reader)
|
||||
{
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
RedSolen = reader.ReadBool();
|
||||
}
|
||||
|
||||
public override void ChildSerialize(GenericWriter writer)
|
||||
{
|
||||
writer.WriteEncodedInt(0); // version
|
||||
|
||||
writer.Write(RedSolen);
|
||||
}
|
||||
|
||||
public override void Accept()
|
||||
{
|
||||
base.Accept();
|
||||
|
||||
AddConversation(new AcceptConversation());
|
||||
}
|
||||
|
||||
public static void GiveRewardTo(PlayerMobile player, ref bool bagOfSending, ref bool powderOfTranslocation,
|
||||
ref bool gold)
|
||||
{
|
||||
if (bagOfSending)
|
||||
{
|
||||
Item reward = new BagOfSending();
|
||||
|
||||
if (player.PlaceInBackpack(reward))
|
||||
{
|
||||
player.SendLocalizedMessage(1054074, "", 0x59); // You have been given a bag of sending.
|
||||
bagOfSending = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
reward.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
if (powderOfTranslocation)
|
||||
{
|
||||
Item reward = new PowderOfTranslocation(Utility.RandomMinMax(10, 12));
|
||||
|
||||
if (player.PlaceInBackpack(reward))
|
||||
{
|
||||
player.SendLocalizedMessage(1054075, "", 0x59); // You have been given some powder of translocation.
|
||||
powderOfTranslocation = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
reward.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
if (gold)
|
||||
{
|
||||
Item reward = new Gold(Utility.RandomMinMax(250, 350));
|
||||
|
||||
if (player.PlaceInBackpack(reward))
|
||||
{
|
||||
player.SendLocalizedMessage(1054076, "", 0x59); // You have been given some gold.
|
||||
gold = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
reward.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
namespace Server.Engines.Quests.Ambitious
|
||||
{
|
||||
public class DontOfferConversation : QuestConversation
|
||||
{
|
||||
public override object Message => 1054059;
|
||||
|
||||
public override bool Logged => false;
|
||||
}
|
||||
|
||||
public class AcceptConversation : QuestConversation
|
||||
{
|
||||
public override object Message => 1054061;
|
||||
|
||||
public override void OnRead()
|
||||
{
|
||||
System.AddObjective(new KillQueensObjective());
|
||||
}
|
||||
}
|
||||
|
||||
public class DuringKillQueensConversation : QuestConversation
|
||||
{
|
||||
public override object Message => 1054066;
|
||||
|
||||
public override bool Logged => false;
|
||||
}
|
||||
|
||||
public class GatherFungiConversation : QuestConversation
|
||||
{
|
||||
public override object Message => 1054068;
|
||||
|
||||
public override void OnRead()
|
||||
{
|
||||
System.AddObjective(new GatherFungiObjective());
|
||||
}
|
||||
}
|
||||
|
||||
public class DuringFungiGatheringConversation : QuestConversation
|
||||
{
|
||||
public override object Message => 1054070;
|
||||
|
||||
public override bool Logged => false;
|
||||
}
|
||||
|
||||
public class EndConversation : QuestConversation
|
||||
{
|
||||
public override object Message => 1054073;
|
||||
|
||||
public override void OnRead()
|
||||
{
|
||||
bool bagOfSending = true;
|
||||
bool powderOfTranslocation = true;
|
||||
bool gold = true;
|
||||
|
||||
AmbitiousQueenQuest.GiveRewardTo(System.From, ref bagOfSending, ref powderOfTranslocation, ref gold);
|
||||
|
||||
if (!bagOfSending && !powderOfTranslocation && !gold)
|
||||
System.Complete();
|
||||
else
|
||||
System.AddConversation(new FullBackpackConversation(true, bagOfSending, powderOfTranslocation, gold));
|
||||
}
|
||||
}
|
||||
|
||||
public class FullBackpackConversation : QuestConversation
|
||||
{
|
||||
private bool m_BagOfSending;
|
||||
private bool m_Gold;
|
||||
|
||||
private bool m_Logged;
|
||||
private bool m_PowderOfTranslocation;
|
||||
|
||||
public FullBackpackConversation(bool logged, bool bagOfSending, bool powderOfTranslocation, bool gold)
|
||||
{
|
||||
m_Logged = logged;
|
||||
|
||||
m_BagOfSending = bagOfSending;
|
||||
m_PowderOfTranslocation = powderOfTranslocation;
|
||||
m_Gold = gold;
|
||||
}
|
||||
|
||||
public FullBackpackConversation()
|
||||
{
|
||||
m_Logged = true;
|
||||
}
|
||||
|
||||
public override object Message => 1054077;
|
||||
|
||||
public override bool Logged => m_Logged;
|
||||
|
||||
public override void OnRead()
|
||||
{
|
||||
if (m_Logged)
|
||||
System.AddObjective(new GetRewardObjective(m_BagOfSending, m_PowderOfTranslocation, m_Gold));
|
||||
}
|
||||
|
||||
public override void ChildDeserialize(GenericReader reader)
|
||||
{
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
m_BagOfSending = reader.ReadBool();
|
||||
m_PowderOfTranslocation = reader.ReadBool();
|
||||
m_Gold = reader.ReadBool();
|
||||
}
|
||||
|
||||
public override void ChildSerialize(GenericWriter writer)
|
||||
{
|
||||
writer.WriteEncodedInt(0); // version
|
||||
|
||||
writer.Write(m_BagOfSending);
|
||||
writer.Write(m_PowderOfTranslocation);
|
||||
writer.Write(m_Gold);
|
||||
}
|
||||
}
|
||||
|
||||
public class End2Conversation : QuestConversation
|
||||
{
|
||||
public override object Message => 1054078;
|
||||
|
||||
public override void OnRead()
|
||||
{
|
||||
System.Complete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,199 @@
|
|||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.Quests.Ambitious
|
||||
{
|
||||
public abstract class BaseAmbitiousSolenQueen : BaseQuester
|
||||
{
|
||||
public BaseAmbitiousSolenQueen()
|
||||
{
|
||||
}
|
||||
|
||||
public BaseAmbitiousSolenQueen(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public abstract bool RedSolen{ get; }
|
||||
public override string DefaultName => "an ambitious solen queen";
|
||||
public override bool DisallowAllMoves => false;
|
||||
|
||||
public override void InitBody()
|
||||
{
|
||||
Body = 0x30F;
|
||||
|
||||
if (!RedSolen)
|
||||
Hue = 0x453;
|
||||
|
||||
SpeechHue = 0;
|
||||
}
|
||||
|
||||
public override int GetIdleSound()
|
||||
{
|
||||
return 0x10D;
|
||||
}
|
||||
|
||||
public override void OnTalk(PlayerMobile player, bool contextMenu)
|
||||
{
|
||||
Direction = GetDirectionTo(player);
|
||||
|
||||
if (player.Quest is AmbitiousQueenQuest qs && qs.RedSolen == RedSolen)
|
||||
{
|
||||
if (qs.IsObjectiveInProgress(typeof(KillQueensObjective)))
|
||||
{
|
||||
qs.AddConversation(new DuringKillQueensConversation());
|
||||
}
|
||||
else
|
||||
{
|
||||
QuestObjective obj = qs.FindObjective<ReturnAfterKillsObjective>();
|
||||
|
||||
if (obj?.Completed == false)
|
||||
{
|
||||
obj.Complete();
|
||||
}
|
||||
else if (qs.IsObjectiveInProgress(typeof(GatherFungiObjective)))
|
||||
{
|
||||
qs.AddConversation(new DuringFungiGatheringConversation());
|
||||
}
|
||||
else
|
||||
{
|
||||
GetRewardObjective lastObj = qs.FindObjective<GetRewardObjective>();
|
||||
|
||||
if (lastObj?.Completed == false)
|
||||
{
|
||||
bool bagOfSending = lastObj.BagOfSending;
|
||||
bool powderOfTranslocation = lastObj.PowderOfTranslocation;
|
||||
bool gold = lastObj.Gold;
|
||||
|
||||
AmbitiousQueenQuest.GiveRewardTo(player, ref bagOfSending, ref powderOfTranslocation, ref gold);
|
||||
|
||||
lastObj.BagOfSending = bagOfSending;
|
||||
lastObj.PowderOfTranslocation = powderOfTranslocation;
|
||||
lastObj.Gold = gold;
|
||||
|
||||
if (!bagOfSending && !powderOfTranslocation && !gold)
|
||||
lastObj.Complete();
|
||||
else
|
||||
qs.AddConversation(new FullBackpackConversation(false, lastObj.BagOfSending,
|
||||
lastObj.PowderOfTranslocation, lastObj.Gold));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QuestSystem newQuest = new AmbitiousQueenQuest(player, RedSolen);
|
||||
|
||||
if (player.Quest == null && QuestSystem.CanOfferQuest(player, typeof(AmbitiousQueenQuest)))
|
||||
newQuest.SendOffer();
|
||||
else
|
||||
newQuest.AddConversation(new DontOfferConversation());
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnDragDrop(Mobile from, Item dropped)
|
||||
{
|
||||
Direction = GetDirectionTo(from);
|
||||
|
||||
if (from is PlayerMobile player)
|
||||
if (player.Quest is AmbitiousQueenQuest qs && qs.RedSolen == RedSolen)
|
||||
{
|
||||
QuestObjective obj = qs.FindObjective<GatherFungiObjective>();
|
||||
|
||||
if (obj?.Completed == false)
|
||||
if (dropped is ZoogiFungus fungi)
|
||||
{
|
||||
if (fungi.Amount >= 50)
|
||||
{
|
||||
obj.Complete();
|
||||
|
||||
fungi.Amount -= 50;
|
||||
|
||||
if (fungi.Amount == 0)
|
||||
{
|
||||
fungi.Delete();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
SayTo(player,
|
||||
1054072); // Our arrangement was for 50 of the zoogi fungus. Please return to me when you have that amount.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return base.OnDragDrop(from, dropped);
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class RedAmbitiousSolenQueen : BaseAmbitiousSolenQueen
|
||||
{
|
||||
[Constructible]
|
||||
public RedAmbitiousSolenQueen()
|
||||
{
|
||||
}
|
||||
|
||||
public RedAmbitiousSolenQueen(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool RedSolen => true;
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class BlackAmbitiousSolenQueen : BaseAmbitiousSolenQueen
|
||||
{
|
||||
[Constructible]
|
||||
public BlackAmbitiousSolenQueen()
|
||||
{
|
||||
}
|
||||
|
||||
public BlackAmbitiousSolenQueen(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool RedSolen => false;
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.Quests.Ambitious
|
||||
{
|
||||
public class KillQueensObjective : QuestObjective
|
||||
{
|
||||
public override object Message => ((AmbitiousQueenQuest)System).RedSolen ? 1054062 : 1054063;
|
||||
|
||||
public override int MaxProgress => 5;
|
||||
|
||||
public override void RenderProgress(BaseQuestGump gump)
|
||||
{
|
||||
if (!Completed)
|
||||
{
|
||||
// Red/Black Solen Queens killed:
|
||||
gump.AddHtmlLocalized(70, 260, 270, 100, ((AmbitiousQueenQuest)System).RedSolen ? 1054064 : 1054065,
|
||||
BaseQuestGump.Blue);
|
||||
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;
|
||||
|
||||
bool redSolen = ((AmbitiousQueenQuest)System).RedSolen;
|
||||
|
||||
if (redSolen)
|
||||
return from is RedSolenQueen;
|
||||
return from is BlackSolenQueen;
|
||||
}
|
||||
|
||||
public override void OnKill(BaseCreature creature, Container corpse)
|
||||
{
|
||||
bool redSolen = ((AmbitiousQueenQuest)System).RedSolen;
|
||||
|
||||
if (redSolen)
|
||||
{
|
||||
if (creature is RedSolenQueen)
|
||||
CurProgress++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (creature is BlackSolenQueen)
|
||||
CurProgress++;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnComplete()
|
||||
{
|
||||
System.AddObjective(new ReturnAfterKillsObjective());
|
||||
}
|
||||
}
|
||||
|
||||
public class ReturnAfterKillsObjective : QuestObjective
|
||||
{
|
||||
public override object Message => 1054067;
|
||||
|
||||
public override void OnComplete()
|
||||
{
|
||||
System.AddConversation(new GatherFungiConversation());
|
||||
}
|
||||
}
|
||||
|
||||
public class GatherFungiObjective : QuestObjective
|
||||
{
|
||||
public override object Message => 1054069;
|
||||
|
||||
public override void OnComplete()
|
||||
{
|
||||
System.AddConversation(new EndConversation());
|
||||
}
|
||||
}
|
||||
|
||||
public class GetRewardObjective : QuestObjective
|
||||
{
|
||||
public GetRewardObjective(bool bagOfSending, bool powderOfTranslocation, bool gold)
|
||||
{
|
||||
BagOfSending = bagOfSending;
|
||||
PowderOfTranslocation = powderOfTranslocation;
|
||||
Gold = gold;
|
||||
}
|
||||
|
||||
public GetRewardObjective()
|
||||
{
|
||||
}
|
||||
|
||||
public override object Message => 1054148;
|
||||
|
||||
public bool BagOfSending{ get; set; }
|
||||
|
||||
public bool PowderOfTranslocation{ get; set; }
|
||||
|
||||
public bool Gold{ get; set; }
|
||||
|
||||
public override void OnComplete()
|
||||
{
|
||||
System.AddConversation(new End2Conversation());
|
||||
}
|
||||
|
||||
public override void ChildDeserialize(GenericReader reader)
|
||||
{
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
BagOfSending = reader.ReadBool();
|
||||
PowderOfTranslocation = reader.ReadBool();
|
||||
Gold = reader.ReadBool();
|
||||
}
|
||||
|
||||
public override void ChildSerialize(GenericWriter writer)
|
||||
{
|
||||
writer.WriteEncodedInt(0); // version
|
||||
|
||||
writer.Write(BagOfSending);
|
||||
writer.Write(PowderOfTranslocation);
|
||||
writer.Write(Gold);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue