Reorganizes Project (#41)
This commit is contained in:
parent
08bf44af9a
commit
3614a66aee
3499 changed files with 79 additions and 55 deletions
|
|
@ -0,0 +1,133 @@
|
|||
using Server.Mobiles;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Engines.Quests.Collector
|
||||
{
|
||||
public class EnchantedPaints : QuestItem
|
||||
{
|
||||
[Constructible]
|
||||
public EnchantedPaints() : base(0xFC1)
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public EnchantedPaints(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool CanDrop(PlayerMobile player)
|
||||
{
|
||||
return !(player.Quest is CollectorQuest);
|
||||
|
||||
/*return !( qs.IsObjectiveInProgress( typeof( CaptureImagesObjective ) )
|
||||
|| qs.IsObjectiveInProgress( typeof( ReturnImagesObjective ) ) );*/
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (from is PlayerMobile player)
|
||||
{
|
||||
QuestSystem qs = player.Quest;
|
||||
|
||||
if (qs is CollectorQuest)
|
||||
if (qs.IsObjectiveInProgress(typeof(CaptureImagesObjective)))
|
||||
{
|
||||
player.SendAsciiMessage(0x59, "Target the creature whose image you wish to create.");
|
||||
player.Target = new InternalTarget(this);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage(1010085); // You cannot use this.
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private EnchantedPaints m_Paints;
|
||||
|
||||
public InternalTarget(EnchantedPaints paints) : base(-1, false, TargetFlags.None)
|
||||
{
|
||||
CheckLOS = false;
|
||||
m_Paints = paints;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (m_Paints.Deleted || !m_Paints.IsChildOf(from.Backpack))
|
||||
return;
|
||||
|
||||
if (from is PlayerMobile player)
|
||||
{
|
||||
QuestSystem qs = player.Quest;
|
||||
|
||||
if (!(qs is CollectorQuest))
|
||||
return;
|
||||
|
||||
CaptureImagesObjective obj = qs.FindObjective<CaptureImagesObjective>();
|
||||
|
||||
if (obj?.Completed != false)
|
||||
return;
|
||||
|
||||
if (targeted is Mobile)
|
||||
{
|
||||
CaptureResponse response = obj.CaptureImage(
|
||||
targeted.GetType().Name == "GreaterMongbat"
|
||||
? new Mongbat().GetType()
|
||||
: targeted.GetType(), out ImageType image);
|
||||
|
||||
switch (response)
|
||||
{
|
||||
case CaptureResponse.Valid:
|
||||
{
|
||||
player.SendLocalizedMessage(
|
||||
1055125); // The enchanted paints swirl for a moment then an image begins to take shape. *Click*
|
||||
player.AddToBackpack(new PaintedImage(image));
|
||||
|
||||
break;
|
||||
}
|
||||
case CaptureResponse.AlreadyDone:
|
||||
{
|
||||
player.SendAsciiMessage(0x2C,
|
||||
"You have already captured the image of this creature");
|
||||
|
||||
break;
|
||||
}
|
||||
case CaptureResponse.Invalid:
|
||||
{
|
||||
player.SendLocalizedMessage(
|
||||
1055124); // You have no interest in capturing the image of this creature.
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SendAsciiMessage(0x35, "You have no interest in that.");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage(1010085); // You cannot use this.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.Quests.Collector
|
||||
{
|
||||
public enum ImageType
|
||||
{
|
||||
Betrayer,
|
||||
Bogling,
|
||||
BogThing,
|
||||
Gazer,
|
||||
Beetle,
|
||||
GiantBlackWidow,
|
||||
Scorpion,
|
||||
JukaMage,
|
||||
JukaWarrior,
|
||||
Lich,
|
||||
MeerMage,
|
||||
MeerWarrior,
|
||||
Mongbat,
|
||||
Mummy,
|
||||
Pixie,
|
||||
PlagueBeast,
|
||||
SandVortex,
|
||||
StoneGargoyle,
|
||||
SwampDragon,
|
||||
Wisp,
|
||||
Juggernaut
|
||||
}
|
||||
|
||||
public class ImageTypeInfo
|
||||
{
|
||||
private static readonly ImageTypeInfo[] m_Table =
|
||||
{
|
||||
new ImageTypeInfo(9734, typeof(Betrayer), 75, 45),
|
||||
new ImageTypeInfo(9735, typeof(Bogling), 75, 45),
|
||||
new ImageTypeInfo(9736, typeof(BogThing), 60, 47),
|
||||
new ImageTypeInfo(9615, typeof(Gazer), 75, 45),
|
||||
new ImageTypeInfo(9743, typeof(Beetle), 60, 55),
|
||||
new ImageTypeInfo(9667, typeof(GiantBlackWidow), 55, 52),
|
||||
new ImageTypeInfo(9657, typeof(Scorpion), 65, 47),
|
||||
new ImageTypeInfo(9758, typeof(JukaMage), 75, 45),
|
||||
new ImageTypeInfo(9759, typeof(JukaWarrior), 75, 45),
|
||||
new ImageTypeInfo(9636, typeof(Lich), 75, 45),
|
||||
new ImageTypeInfo(9756, typeof(MeerMage), 75, 45),
|
||||
new ImageTypeInfo(9757, typeof(MeerWarrior), 75, 45),
|
||||
new ImageTypeInfo(9638, typeof(Mongbat), 70, 50),
|
||||
new ImageTypeInfo(9639, typeof(Mummy), 75, 45),
|
||||
new ImageTypeInfo(9654, typeof(Pixie), 75, 45),
|
||||
new ImageTypeInfo(9747, typeof(PlagueBeast), 60, 45),
|
||||
new ImageTypeInfo(9750, typeof(SandVortex), 60, 43),
|
||||
new ImageTypeInfo(9614, typeof(StoneGargoyle), 75, 45),
|
||||
new ImageTypeInfo(9753, typeof(SwampDragon), 50, 55),
|
||||
new ImageTypeInfo(8448, typeof(Wisp), 75, 45),
|
||||
new ImageTypeInfo(9746, typeof(Juggernaut), 55, 38)
|
||||
};
|
||||
|
||||
private static ImageType[] m_ImageTypeList;
|
||||
|
||||
public ImageTypeInfo(int figurine, Type type, int x, int y)
|
||||
{
|
||||
Figurine = figurine;
|
||||
Type = type;
|
||||
X = x;
|
||||
Y = y;
|
||||
}
|
||||
|
||||
public int Figurine{ get; }
|
||||
|
||||
public Type Type{ get; }
|
||||
|
||||
public int Name => Figurine < 0x4000 ? 1020000 + Figurine : 1078872 + Figurine;
|
||||
public int X{ get; }
|
||||
public int Y{ get; }
|
||||
|
||||
public static ImageTypeInfo Get(ImageType image)
|
||||
{
|
||||
int index = (int)image;
|
||||
return m_Table[index >= 0 && index < m_Table.Length ? index : 0];
|
||||
}
|
||||
|
||||
public static ImageType[] RandomList(int count)
|
||||
{
|
||||
if (m_ImageTypeList == null)
|
||||
{
|
||||
m_ImageTypeList = new ImageType[m_Table.Length];
|
||||
for (int i = 0; i < m_Table.Length; i++)
|
||||
m_ImageTypeList[i] = (ImageType)i;
|
||||
}
|
||||
|
||||
ImageType[] array = m_ImageTypeList.ToArray();
|
||||
Utility.Shuffle(array);
|
||||
return array.Take(count).ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
265
Projects/Scripts/Engines/Quests/Collector/Items/Obsidian.cs
Normal file
265
Projects/Scripts/Engines/Quests/Collector/Items/Obsidian.cs
Normal file
|
|
@ -0,0 +1,265 @@
|
|||
using System.Collections.Generic;
|
||||
using Server.ContextMenus;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Engines.Quests.Collector
|
||||
{
|
||||
public class Obsidian : Item
|
||||
{
|
||||
private const int m_Partial = 2;
|
||||
private const int m_Completed = 10;
|
||||
|
||||
private static readonly string[] m_Names =
|
||||
{
|
||||
null,
|
||||
"an aggressive cavalier",
|
||||
"a beguiling rogue",
|
||||
"a benevolent physician",
|
||||
"a brilliant artisan",
|
||||
"a capricious adventurer",
|
||||
"a clever beggar",
|
||||
"a convincing charlatan",
|
||||
"a creative inventor",
|
||||
"a creative tinker",
|
||||
"a cunning knave",
|
||||
"a dauntless explorer",
|
||||
"a despicable ruffian",
|
||||
"an earnest malcontent",
|
||||
"an exultant animal tamer",
|
||||
"a famed adventurer",
|
||||
"a fanatical crusader",
|
||||
"a fastidious clerk",
|
||||
"a fearless hunter",
|
||||
"a festive harlequin",
|
||||
"a fidgety assassin",
|
||||
"a fierce soldier",
|
||||
"a fierce warrior",
|
||||
"a frugal magnate",
|
||||
"a glib pundit",
|
||||
"a gnomic shaman",
|
||||
"a graceful noblewoman",
|
||||
"a idiotic madman",
|
||||
"a imaginative designer",
|
||||
"an inept conjurer",
|
||||
"an innovative architect",
|
||||
"an inventive blacksmith",
|
||||
"a judicious mayor",
|
||||
"a masterful chef",
|
||||
"a masterful woodworker",
|
||||
"a melancholy clown",
|
||||
"a melodic bard",
|
||||
"a merciful guard",
|
||||
"a mirthful jester",
|
||||
"a nervous surgeon",
|
||||
"a peaceful scholar",
|
||||
"a prolific gardener",
|
||||
"a quixotic knight",
|
||||
"a regal aristocrat",
|
||||
"a resourceful smith",
|
||||
"a reticent alchemist",
|
||||
"a sanctified priest",
|
||||
"a scheming patrician",
|
||||
"a shrewd mage",
|
||||
"a singing minstrel",
|
||||
"a skilled tailor",
|
||||
"a squeamish assassin",
|
||||
"a stoic swordsman",
|
||||
"a studious scribe",
|
||||
"a thought provoking writer",
|
||||
"a treacherous scoundrel",
|
||||
"a troubled poet",
|
||||
"an unflappable wizard",
|
||||
"a valiant warrior",
|
||||
"a wayward fool"
|
||||
};
|
||||
|
||||
private int m_Quantity;
|
||||
private string m_StatueName;
|
||||
|
||||
[Constructible]
|
||||
public Obsidian() : base(0x1EA7)
|
||||
{
|
||||
Hue = 0x497;
|
||||
|
||||
m_Quantity = 1;
|
||||
m_StatueName = "";
|
||||
}
|
||||
|
||||
public Obsidian(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Quantity
|
||||
{
|
||||
get => m_Quantity;
|
||||
set
|
||||
{
|
||||
if (value <= 1)
|
||||
m_Quantity = 1;
|
||||
else if (value >= m_Completed)
|
||||
m_Quantity = m_Completed;
|
||||
else
|
||||
m_Quantity = value;
|
||||
|
||||
if (m_Quantity < m_Partial)
|
||||
ItemID = 0x1EA7;
|
||||
else if (m_Quantity < m_Completed)
|
||||
ItemID = 0x1F13;
|
||||
else
|
||||
ItemID = 0x12CB;
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string StatueName
|
||||
{
|
||||
get => m_StatueName;
|
||||
set
|
||||
{
|
||||
m_StatueName = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public override bool ForceShowProperties => ObjectPropertyList.Enabled;
|
||||
|
||||
public static string RandomName(Mobile from)
|
||||
{
|
||||
int index = Utility.Random(m_Names.Length);
|
||||
if (m_Names[index] == null)
|
||||
return from.Name;
|
||||
return m_Names[index];
|
||||
}
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
if (m_Quantity < m_Partial)
|
||||
list.Add(1055137); // a section of an obsidian statue
|
||||
else if (m_Quantity < m_Completed)
|
||||
list.Add(1055138); // a partially reconstructed obsidian statue
|
||||
else
|
||||
list.Add(1055139, m_StatueName); // an obsidian statue of ~1_STATUE_NAME~
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
if (m_Quantity < m_Partial)
|
||||
LabelTo(from, 1055137); // a section of an obsidian statue
|
||||
else if (m_Quantity < m_Completed)
|
||||
LabelTo(from, 1055138); // a partially reconstructed obsidian statue
|
||||
else
|
||||
LabelTo(from, 1055139, m_StatueName); // an obsidian statue of ~1_STATUE_NAME~
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
||||
{
|
||||
base.GetContextMenuEntries(from, list);
|
||||
|
||||
if (from.Alive && m_Quantity >= m_Partial && m_Quantity < m_Completed && IsChildOf(from.Backpack))
|
||||
list.Add(new DisassembleEntry(this));
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (m_Quantity < m_Completed)
|
||||
{
|
||||
if (!IsChildOf(from.Backpack))
|
||||
from.Send(new MessageLocalized(Serial, ItemID, MessageType.Regular, 0x2C, 3, 500309, "",
|
||||
"")); // Nothing Happens.
|
||||
else
|
||||
from.Target = new InternalTarget(this);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
|
||||
writer.WriteEncodedInt(m_Quantity);
|
||||
writer.Write(m_StatueName);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_Quantity = reader.ReadEncodedInt();
|
||||
m_StatueName = Utility.Intern(reader.ReadString());
|
||||
}
|
||||
|
||||
private class DisassembleEntry : ContextMenuEntry
|
||||
{
|
||||
private Obsidian m_Obsidian;
|
||||
|
||||
public DisassembleEntry(Obsidian obsidian) : base(6142)
|
||||
{
|
||||
m_Obsidian = obsidian;
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
Mobile from = Owner.From;
|
||||
if (!m_Obsidian.Deleted && m_Obsidian.Quantity >= m_Partial && m_Obsidian.Quantity < m_Completed &&
|
||||
m_Obsidian.IsChildOf(from.Backpack) && from.CheckAlive())
|
||||
{
|
||||
for (int i = 0; i < m_Obsidian.Quantity - 1; i++)
|
||||
from.AddToBackpack(new Obsidian());
|
||||
|
||||
m_Obsidian.Quantity = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private Obsidian m_Obsidian;
|
||||
|
||||
public InternalTarget(Obsidian obsidian) : base(-1, false, TargetFlags.None)
|
||||
{
|
||||
m_Obsidian = obsidian;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (m_Obsidian.Deleted || m_Obsidian.Quantity >= m_Completed || !(targeted is Item targ))
|
||||
return;
|
||||
|
||||
if (m_Obsidian.IsChildOf(from.Backpack) && targ.IsChildOf(from.Backpack) && targ is Obsidian targObsidian &&
|
||||
targ != m_Obsidian)
|
||||
if (targObsidian.Quantity < m_Completed)
|
||||
{
|
||||
if (targObsidian.Quantity + m_Obsidian.Quantity <= m_Completed)
|
||||
{
|
||||
targObsidian.Quantity += m_Obsidian.Quantity;
|
||||
m_Obsidian.Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
int delta = m_Completed - targObsidian.Quantity;
|
||||
targObsidian.Quantity += delta;
|
||||
m_Obsidian.Quantity -= delta;
|
||||
}
|
||||
|
||||
if (targObsidian.Quantity >= m_Completed)
|
||||
targObsidian.StatueName = RandomName(from);
|
||||
|
||||
from.Send(new AsciiMessage(targObsidian.Serial, targObsidian.ItemID, MessageType.Regular, 0x59, 3,
|
||||
m_Obsidian.Name, "Something Happened."));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
from.Send(new MessageLocalized(m_Obsidian.Serial, m_Obsidian.ItemID, MessageType.Regular, 0x2C, 3, 500309,
|
||||
m_Obsidian.Name, "")); // Nothing Happens.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.Quests.Collector
|
||||
{
|
||||
public class PaintedImage : Item
|
||||
{
|
||||
private ImageType m_Image;
|
||||
|
||||
[Constructible]
|
||||
public PaintedImage(ImageType image) : base(0xFF3)
|
||||
{
|
||||
Weight = 1.0;
|
||||
Hue = 0x8FD;
|
||||
|
||||
m_Image = image;
|
||||
}
|
||||
|
||||
public PaintedImage(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public ImageType Image
|
||||
{
|
||||
get => m_Image;
|
||||
set
|
||||
{
|
||||
m_Image = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
ImageTypeInfo info = ImageTypeInfo.Get(m_Image);
|
||||
list.Add(1060847, "#1055126\t#" + info.Name); // a painted image of:
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
ImageTypeInfo info = ImageTypeInfo.Get(m_Image);
|
||||
LabelTo(from, 1060847, "#1055126\t#" + info.Name); // a painted image of:
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!from.InRange(GetWorldLocation(), 2))
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
|
||||
return;
|
||||
}
|
||||
|
||||
from.SendGump(new InternalGump(m_Image));
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
|
||||
writer.WriteEncodedInt((int)m_Image);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_Image = (ImageType)reader.ReadEncodedInt();
|
||||
}
|
||||
|
||||
private class InternalGump : Gump
|
||||
{
|
||||
public InternalGump(ImageType image) : base(75, 25)
|
||||
{
|
||||
ImageTypeInfo info = ImageTypeInfo.Get(image);
|
||||
|
||||
AddBackground(45, 20, 100, 100, 0xA3C);
|
||||
AddBackground(52, 29, 86, 82, 0xBB8);
|
||||
|
||||
AddItem(info.X, info.Y, info.Figurine);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue