Reorganizes Project (#41)

This commit is contained in:
Kamron Batman 2019-08-02 18:13:40 -07:00 • committed by GitHub
parent 08bf44af9a
commit 3614a66aee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3499 changed files with 79 additions and 55 deletions

View file

@ -0,0 +1,186 @@
using Server.Items;
namespace Server.Engines.Quests.Haven
{
public enum CannonDirection
{
North,
East,
South,
West
}
public class Cannon : BaseAddon
{
[Constructible]
public Cannon(CannonDirection direction)
{
CannonDirection = direction;
switch (direction)
{
case CannonDirection.North:
{
AddComponent(new CannonComponent(0xE8D), 0, 0, 0);
AddComponent(new CannonComponent(0xE8C), 0, 1, 0);
AddComponent(new CannonComponent(0xE8B), 0, 2, 0);
break;
}
case CannonDirection.East:
{
AddComponent(new CannonComponent(0xE96), 0, 0, 0);
AddComponent(new CannonComponent(0xE95), -1, 0, 0);
AddComponent(new CannonComponent(0xE94), -2, 0, 0);
break;
}
case CannonDirection.South:
{
AddComponent(new CannonComponent(0xE91), 0, 0, 0);
AddComponent(new CannonComponent(0xE92), 0, -1, 0);
AddComponent(new CannonComponent(0xE93), 0, -2, 0);
break;
}
default:
{
AddComponent(new CannonComponent(0xE8E), 0, 0, 0);
AddComponent(new CannonComponent(0xE8F), 1, 0, 0);
AddComponent(new CannonComponent(0xE90), 2, 0, 0);
break;
}
}
}
public Cannon(Serial serial) : base(serial)
{
}
[CommandProperty(AccessLevel.GameMaster)]
public CannonDirection CannonDirection{ get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public MilitiaCanoneer Canoneer{ get; set; }
public override bool HandlesOnMovement => Canoneer?.Deleted == false && Canoneer.Active;
public void DoFireEffect(IPoint3D target)
{
Point3D from;
switch (CannonDirection)
{
case CannonDirection.North:
from = new Point3D(X, Y - 1, Z);
break;
case CannonDirection.East:
from = new Point3D(X + 1, Y, Z);
break;
case CannonDirection.South:
from = new Point3D(X, Y + 1, Z);
break;
default:
from = new Point3D(X - 1, Y, Z);
break;
}
Effects.SendLocationEffect(from, Map, 0x36B0, 16, 1);
Effects.PlaySound(from, Map, 0x11D);
Effects.SendLocationEffect(target, Map, 0x36B0, 16, 1);
Effects.PlaySound(target, Map, 0x11D);
}
public void Fire(Mobile from, Mobile target)
{
DoFireEffect(target);
target.Damage(9999, from);
}
public override void OnMovement(Mobile m, Point3D oldLocation)
{
if (!(Canoneer?.Deleted == false && Canoneer.Active))
return;
bool canFire;
switch (CannonDirection)
{
case CannonDirection.North:
canFire = m.X >= X - 7 && m.X <= X + 7 && m.Y == Y - 7 && oldLocation.Y < Y - 7;
break;
case CannonDirection.East:
canFire = m.Y >= Y - 7 && m.Y <= Y + 7 && m.X == X + 7 && oldLocation.X > X + 7;
break;
case CannonDirection.South:
canFire = m.X >= X - 7 && m.X <= X + 7 && m.Y == Y + 7 && oldLocation.Y > Y + 7;
break;
default:
canFire = m.Y >= Y - 7 && m.Y <= Y + 7 && m.X == X - 7 && oldLocation.X < X - 7;
break;
}
if (canFire && Canoneer.WillFire(this, m))
Fire(Canoneer, m);
}
public override void Serialize(GenericWriter writer)
{
if (Canoneer?.Deleted == true)
Canoneer = null;
base.Serialize(writer);
writer.Write(0); // version
writer.WriteEncodedInt((int)CannonDirection);
writer.Write(Canoneer);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
CannonDirection = (CannonDirection)reader.ReadEncodedInt();
Canoneer = (MilitiaCanoneer)reader.ReadMobile();
}
}
public class CannonComponent : AddonComponent
{
public CannonComponent(int itemID) : base(itemID)
{
}
public CannonComponent(Serial serial) : base(serial)
{
}
[CommandProperty(AccessLevel.GameMaster)]
public MilitiaCanoneer Canoneer
{
get => Addon is Cannon cannon ? cannon.Canoneer : null;
set
{
if (Addon is Cannon cannon) cannon.Canoneer = value;
}
}
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();
}
}
}

View file

@ -0,0 +1,69 @@
using Server.Items;
using Server.Mobiles;
namespace Server.Engines.Quests.Haven
{
public class DaemonBloodChest : MetalChest
{
[Constructible]
public DaemonBloodChest()
{
Movable = false;
}
public DaemonBloodChest(Serial serial) : base(serial)
{
}
public override void OnDoubleClick(Mobile from)
{
if (from is PlayerMobile player && player.InRange(GetWorldLocation(), 2))
{
QuestSystem qs = player.Quest;
if (qs is UzeraanTurmoilQuest)
{
QuestObjective obj = qs.FindObjective<GetDaemonBloodObjective>();
if (obj?.Completed == false || UzeraanTurmoilQuest.HasLostDaemonBlood(player))
{
Item vial = new QuestDaemonBlood();
if (player.PlaceInBackpack(vial))
{
player.SendLocalizedMessage(1049331, "",
0x22); // You take a vial of blood from the chest and put it in your pack.
if (obj?.Completed == false)
obj.Complete();
}
else
{
player.SendLocalizedMessage(1049338, "",
0x22); // You find a vial of blood, but can't pick it up because your pack is too full. Come back when you have more room in your pack.
vial.Delete();
}
return;
}
}
}
base.OnDoubleClick(from);
}
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();
}
}
}

View file

@ -0,0 +1,38 @@
using Server.Mobiles;
namespace Server.Engines.Quests.Haven
{
public class QuestDaemonBlood : QuestItem
{
[Constructible]
public QuestDaemonBlood() : base(0xF7D)
{
Weight = 1.0;
}
public QuestDaemonBlood(Serial serial) : base(serial)
{
}
public override bool CanDrop(PlayerMobile player)
{
return !(player.Quest is UzeraanTurmoilQuest);
/*return !qs.IsObjectiveInProgress( typeof( ReturnDaemonBloodObjective ) );*/
}
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();
}
}
}

View file

@ -0,0 +1,38 @@
using Server.Mobiles;
namespace Server.Engines.Quests.Haven
{
public class QuestDaemonBone : QuestItem
{
[Constructible]
public QuestDaemonBone() : base(0xF80)
{
Weight = 1.0;
}
public QuestDaemonBone(Serial serial) : base(serial)
{
}
public override bool CanDrop(PlayerMobile player)
{
return !(player.Quest is UzeraanTurmoilQuest);
//return !qs.IsObjectiveInProgress( typeof( ReturnDaemonBoneObjective ) );
}
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();
}
}
}

View file

@ -0,0 +1,38 @@
using Server.Mobiles;
namespace Server.Engines.Quests.Haven
{
public class QuestFertileDirt : QuestItem
{
[Constructible]
public QuestFertileDirt() : base(0xF81)
{
Weight = 1.0;
}
public QuestFertileDirt(Serial serial) : base(serial)
{
}
public override bool CanDrop(PlayerMobile player)
{
return !(player.Quest is UzeraanTurmoilQuest);
//return !qs.IsObjectiveInProgress( typeof( ReturnFertileDirtObjective ) );
}
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();
}
}
}

View file

@ -0,0 +1,175 @@
using System.Collections.Generic;
using Server.Items;
using Server.Misc;
using Server.Mobiles;
using Server.Network;
namespace Server.Engines.Quests.Haven
{
public class SchmendrickApprenticeCorpse : Corpse
{
private static int m_HairHue;
private Lantern m_Lantern;
[Constructible]
public SchmendrickApprenticeCorpse() : base(GetOwner(), GetHair(), GetFacialHair(), GetEquipment())
{
Direction = Direction.West;
foreach (Item item in EquipItems)
DropItem(item);
m_Lantern = new Lantern { Movable = false, Protected = true };
m_Lantern.Ignite();
}
public SchmendrickApprenticeCorpse(Serial serial) : base(serial)
{
}
// TODO: What is this? Why are we creating and deleting a mobile?
private static Mobile GetOwner()
{
Mobile apprentice = new Mobile();
apprentice.Hue = Race.Human.RandomSkinHue();
apprentice.Female = false;
apprentice.Body = 0x190;
apprentice.Name = NameList.RandomName("male");
apprentice.Delete();
return apprentice;
}
private static List<Item> GetEquipment()
{
List<Item> list = new List<Item>();
list.Add(new Robe(QuestSystem.RandomBrightHue()));
list.Add(new WizardsHat(Utility.RandomNeutralHue()));
list.Add(new Shoes(Utility.RandomNeutralHue()));
list.Add(new Spellbook());
return list;
}
private static HairInfo GetHair()
{
m_HairHue = Race.Human.RandomHairHue();
return new HairInfo(Race.Human.RandomHair(false), m_HairHue);
}
private static FacialHairInfo GetFacialHair()
{
m_HairHue = Race.Human.RandomHairHue();
return new FacialHairInfo(Race.Human.RandomFacialHair(false), m_HairHue);
}
public override void AddNameProperty(ObjectPropertyList list)
{
if (ItemID == 0x2006) // Corpse form
{
list.Add("a human corpse");
list.Add(1049144, Name); // the remains of ~1_NAME~ the apprentice
}
else
{
list.Add(1049145); // the remains of a wizard's apprentice
}
}
public override void OnSingleClick(Mobile from)
{
int hue = Notoriety.GetHue(NotorietyHandlers.CorpseNotoriety(from, this));
if (ItemID == 0x2006) // Corpse form
from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, hue, 3, 1049144, "",
Name)); // the remains of ~1_NAME~ the apprentice
else
from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, hue, 3, 1049145, "",
"")); // the remains of a wizard's apprentice
}
public override void Open(Mobile from, bool checkSelfLoot)
{
if (!from.InRange(GetWorldLocation(), 2))
return;
if (from is PlayerMobile player)
{
QuestSystem qs = player.Quest;
if (qs is UzeraanTurmoilQuest)
{
QuestObjective obj = qs.FindObjective<FindApprenticeObjective>();
if (obj?.Completed == false)
{
Item scroll = new SchmendrickScrollOfPower();
if (player.PlaceInBackpack(scroll))
{
player.SendLocalizedMessage(1049147, "", 0x22); // You find the scroll and put it in your pack.
obj.Complete();
}
else
{
player.SendLocalizedMessage(1049146, "",
0x22); // You find the scroll, but can't pick it up because your pack is too full. Come back when you have more room in your pack.
scroll.Delete();
}
return;
}
}
}
from.SendLocalizedMessage(1049143, "",
0x22); // This is the corpse of a wizard's apprentice. You can't bring yourself to search it without a good reason.
}
public override void OnLocationChange(Point3D oldLoc)
{
if (m_Lantern?.Deleted == false)
m_Lantern.Location = new Point3D(X, Y + 1, Z);
}
public override void OnMapChange()
{
if (m_Lantern?.Deleted == false)
m_Lantern.Map = Map;
}
public override void OnAfterDelete()
{
base.OnAfterDelete();
if (m_Lantern?.Deleted == false)
m_Lantern.Delete();
}
public override void Serialize(GenericWriter writer)
{
if (m_Lantern?.Deleted == true)
m_Lantern = null;
base.Serialize(writer);
writer.Write(0); // version
writer.Write(m_Lantern);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
m_Lantern = (Lantern)reader.ReadItem();
}
}
}

View file

@ -0,0 +1,39 @@
using Server.Mobiles;
namespace Server.Engines.Quests.Haven
{
public class SchmendrickScrollOfPower : QuestItem
{
public SchmendrickScrollOfPower() : base(0xE34)
{
Weight = 1.0;
Hue = 0x34D;
}
public SchmendrickScrollOfPower(Serial serial) : base(serial)
{
}
public override int LabelNumber => 1049118; // a scroll with ancient markings
public override bool CanDrop(PlayerMobile player)
{
return !(player.Quest is UzeraanTurmoilQuest qs &&
qs.IsObjectiveInProgress(typeof(ReturnScrollOfPowerObjective)));
}
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();
}
}
}

View file

@ -0,0 +1,37 @@
using Server.Mobiles;
namespace Server.Engines.Quests.Haven
{
public class UzeraanTurmoilHorn : HornOfRetreat
{
[Constructible]
public UzeraanTurmoilHorn()
{
DestLoc = new Point3D(3597, 2582, 0);
DestMap = Map.Trammel;
}
public UzeraanTurmoilHorn(Serial serial) : base(serial)
{
}
public override bool ValidateUse(Mobile from)
{
return from is PlayerMobile pm && pm.Quest is UzeraanTurmoilQuest;
}
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();
}
}
}

View file

@ -0,0 +1,73 @@
using Server.Mobiles;
namespace Server.Engines.Quests.Haven
{
public class UzeraanTurmoilTeleporter : DynamicTeleporter
{
[Constructible]
public UzeraanTurmoilTeleporter()
{
}
public UzeraanTurmoilTeleporter(Serial serial) : base(serial)
{
}
public override bool GetDestination(PlayerMobile player, ref Point3D loc, ref Map map)
{
QuestSystem qs = player.Quest;
if (qs is UzeraanTurmoilQuest)
{
if (qs.IsObjectiveInProgress(typeof(FindSchmendrickObjective))
|| qs.IsObjectiveInProgress(typeof(FindApprenticeObjective))
|| UzeraanTurmoilQuest.HasLostScrollOfPower(player))
{
loc = new Point3D(5222, 1858, 0);
map = Map.Trammel;
return true;
}
if (qs.IsObjectiveInProgress(typeof(FindDryadObjective))
|| UzeraanTurmoilQuest.HasLostFertileDirt(player))
{
loc = new Point3D(3557, 2690, 2);
map = Map.Trammel;
return true;
}
if (player.Profession != 5 // paladin
&& (qs.IsObjectiveInProgress(typeof(GetDaemonBoneObjective))
|| UzeraanTurmoilQuest.HasLostDaemonBone(player)))
{
loc = new Point3D(3422, 2653, 48);
map = Map.Trammel;
return true;
}
if (qs.IsObjectiveInProgress(typeof(CashBankCheckObjective)))
{
loc = new Point3D(3624, 2610, 0);
map = Map.Trammel;
return true;
}
}
return false;
}
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();
}
}
}