Fixes code according to modern code style. Fixes a few expression bugs.
This commit is contained in:
parent
89eea25e5f
commit
970fd563b2
3324 changed files with 441118 additions and 433755 deletions
|
|
@ -1,124 +1,125 @@
|
|||
using System.Collections.Generic;
|
||||
using Server.ContextMenus;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.ContextMenus;
|
||||
|
||||
namespace Server.Engines.Quests
|
||||
{
|
||||
public class TalkEntry : ContextMenuEntry
|
||||
{
|
||||
private BaseQuester m_Quester;
|
||||
public class TalkEntry : ContextMenuEntry
|
||||
{
|
||||
private BaseQuester m_Quester;
|
||||
|
||||
public TalkEntry( BaseQuester quester ) : base( quester.TalkNumber )
|
||||
{
|
||||
m_Quester = quester;
|
||||
}
|
||||
public TalkEntry(BaseQuester quester) : base(quester.TalkNumber)
|
||||
{
|
||||
m_Quester = quester;
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
Mobile from = Owner.From;
|
||||
public override void OnClick()
|
||||
{
|
||||
Mobile from = Owner.From;
|
||||
|
||||
if ( from.CheckAlive() && from is PlayerMobile mobile && m_Quester.CanTalkTo( mobile ) )
|
||||
m_Quester.OnTalk( mobile, true );
|
||||
}
|
||||
}
|
||||
if (from.CheckAlive() && from is PlayerMobile mobile && m_Quester.CanTalkTo(mobile))
|
||||
m_Quester.OnTalk(mobile, true);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class BaseQuester : BaseVendor
|
||||
{
|
||||
protected List<SBInfo> m_SBInfos = new List<SBInfo>();
|
||||
protected override List<SBInfo> SBInfos => m_SBInfos;
|
||||
public abstract class BaseQuester : BaseVendor
|
||||
{
|
||||
protected List<SBInfo> m_SBInfos = new List<SBInfo>();
|
||||
|
||||
public override bool IsActiveVendor => false;
|
||||
public override bool IsInvulnerable => true;
|
||||
public override bool DisallowAllMoves => true;
|
||||
public override bool ClickTitle => false;
|
||||
public override bool CanTeach => false;
|
||||
public BaseQuester() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual int TalkNumber // Talk
|
||||
=> 6146;
|
||||
public BaseQuester(string title) : base(title)
|
||||
{
|
||||
}
|
||||
|
||||
public override void InitSBInfo()
|
||||
{
|
||||
}
|
||||
public BaseQuester(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public BaseQuester() : this( null )
|
||||
{
|
||||
}
|
||||
protected override List<SBInfo> SBInfos => m_SBInfos;
|
||||
|
||||
public BaseQuester( string title ) : base( title )
|
||||
{
|
||||
}
|
||||
public override bool IsActiveVendor => false;
|
||||
public override bool IsInvulnerable => true;
|
||||
public override bool DisallowAllMoves => true;
|
||||
public override bool ClickTitle => false;
|
||||
public override bool CanTeach => false;
|
||||
|
||||
public BaseQuester( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public virtual int TalkNumber // Talk
|
||||
=> 6146;
|
||||
|
||||
public abstract void OnTalk( PlayerMobile player, bool contextMenu );
|
||||
public override void InitSBInfo()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual bool CanTalkTo( PlayerMobile to )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public abstract void OnTalk(PlayerMobile player, bool contextMenu);
|
||||
|
||||
public virtual int GetAutoTalkRange( PlayerMobile m )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
public virtual bool CanTalkTo(PlayerMobile to)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool CanBeDamaged()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public virtual int GetAutoTalkRange(PlayerMobile m)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected Item SetHue( Item item, int hue )
|
||||
{
|
||||
item.Hue = hue;
|
||||
return item;
|
||||
}
|
||||
public override bool CanBeDamaged()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void AddCustomContextEntries( Mobile from, List<ContextMenuEntry> list )
|
||||
{
|
||||
base.AddCustomContextEntries( from, list );
|
||||
protected Item SetHue(Item item, int hue)
|
||||
{
|
||||
item.Hue = hue;
|
||||
return item;
|
||||
}
|
||||
|
||||
if ( from.Alive && from is PlayerMobile mobile && TalkNumber > 0 && CanTalkTo( mobile ) )
|
||||
list.Add( new TalkEntry( this ) );
|
||||
}
|
||||
public override void AddCustomContextEntries(Mobile from, List<ContextMenuEntry> list)
|
||||
{
|
||||
base.AddCustomContextEntries(from, list);
|
||||
|
||||
public override void OnMovement( Mobile m, Point3D oldLocation )
|
||||
{
|
||||
if ( m.Alive && m is PlayerMobile pm )
|
||||
{
|
||||
int range = GetAutoTalkRange( pm );
|
||||
if (from.Alive && from is PlayerMobile mobile && TalkNumber > 0 && CanTalkTo(mobile))
|
||||
list.Add(new TalkEntry(this));
|
||||
}
|
||||
|
||||
if ( pm.Alive && range >= 0 && InRange( m, range ) && !InRange( oldLocation, range ) && CanTalkTo( pm ) )
|
||||
OnTalk( pm, false );
|
||||
}
|
||||
}
|
||||
public override void OnMovement(Mobile m, Point3D oldLocation)
|
||||
{
|
||||
if (m.Alive && m is PlayerMobile pm)
|
||||
{
|
||||
int range = GetAutoTalkRange(pm);
|
||||
|
||||
public void FocusTo( Mobile to )
|
||||
{
|
||||
QuestSystem.FocusTo( this, to );
|
||||
}
|
||||
if (pm.Alive && range >= 0 && InRange(m, range) && !InRange(oldLocation, range) && CanTalkTo(pm))
|
||||
OnTalk(pm, false);
|
||||
}
|
||||
}
|
||||
|
||||
public static Container GetNewContainer()
|
||||
{
|
||||
Bag bag = new Bag();
|
||||
bag.Hue = QuestSystem.RandomBrightHue();
|
||||
return bag;
|
||||
}
|
||||
public void FocusTo(Mobile to)
|
||||
{
|
||||
QuestSystem.FocusTo(this, to);
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public static Container GetNewContainer()
|
||||
{
|
||||
Bag bag = new Bag();
|
||||
bag.Hue = QuestSystem.RandomBrightHue();
|
||||
return bag;
|
||||
}
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,64 +2,64 @@ using Server.Mobiles;
|
|||
|
||||
namespace Server.Engines.Quests
|
||||
{
|
||||
public abstract class DynamicTeleporter : Item
|
||||
{
|
||||
public override int LabelNumber => 1049382; // a magical teleporter
|
||||
public abstract class DynamicTeleporter : Item
|
||||
{
|
||||
public DynamicTeleporter() : this(0x1822, 0x482)
|
||||
{
|
||||
}
|
||||
|
||||
public DynamicTeleporter() : this( 0x1822, 0x482 )
|
||||
{
|
||||
}
|
||||
public DynamicTeleporter(int itemID, int hue) : base(itemID)
|
||||
{
|
||||
Movable = false;
|
||||
Hue = hue;
|
||||
}
|
||||
|
||||
public DynamicTeleporter( int itemID, int hue ) : base( itemID )
|
||||
{
|
||||
Movable = false;
|
||||
Hue = hue;
|
||||
}
|
||||
public DynamicTeleporter(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public abstract bool GetDestination( PlayerMobile player, ref Point3D loc, ref Map map );
|
||||
public override int LabelNumber => 1049382; // a magical teleporter
|
||||
|
||||
public virtual int NotWorkingMessage // Nothing Happens.
|
||||
=> 500309;
|
||||
public virtual int NotWorkingMessage // Nothing Happens.
|
||||
=> 500309;
|
||||
|
||||
public override bool OnMoveOver( Mobile m )
|
||||
{
|
||||
if ( m is PlayerMobile pm )
|
||||
{
|
||||
Point3D loc = Point3D.Zero;
|
||||
Map map = null;
|
||||
public abstract bool GetDestination(PlayerMobile player, ref Point3D loc, ref Map map);
|
||||
|
||||
if ( GetDestination( pm, ref loc, ref map ) )
|
||||
{
|
||||
BaseCreature.TeleportPets( pm, loc, map );
|
||||
public override bool OnMoveOver(Mobile m)
|
||||
{
|
||||
if (m is PlayerMobile pm)
|
||||
{
|
||||
Point3D loc = Point3D.Zero;
|
||||
Map map = null;
|
||||
|
||||
pm.PlaySound( 0x1FE );
|
||||
pm.MoveToWorld( loc, map );
|
||||
if (GetDestination(pm, ref loc, ref map))
|
||||
{
|
||||
BaseCreature.TeleportPets(pm, loc, map);
|
||||
|
||||
return false;
|
||||
}
|
||||
pm.PlaySound(0x1FE);
|
||||
pm.MoveToWorld(loc, map);
|
||||
|
||||
pm.SendLocalizedMessage( NotWorkingMessage );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.OnMoveOver( m );
|
||||
}
|
||||
pm.SendLocalizedMessage(NotWorkingMessage);
|
||||
}
|
||||
|
||||
public DynamicTeleporter( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
return base.OnMoveOver(m);
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,186 +2,188 @@ using Server.Network;
|
|||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class EnchantedSextant : Item
|
||||
{
|
||||
//TODO: Trammel/Haven
|
||||
private static readonly Point2D[] m_TrammelBanks = {
|
||||
new Point2D( 652, 820 ),
|
||||
new Point2D( 1813, 2825 ),
|
||||
new Point2D( 3734, 2149 ),
|
||||
new Point2D( 2503, 552 ),
|
||||
new Point2D( 3764, 1317 ),
|
||||
new Point2D( 587, 2146 ),
|
||||
new Point2D( 1655, 1606 ),
|
||||
new Point2D( 1425, 1690 ),
|
||||
new Point2D( 4471, 1156 ),
|
||||
new Point2D( 1317, 3773 ),
|
||||
new Point2D( 2881, 684 ),
|
||||
new Point2D( 2731, 2192 ),
|
||||
new Point2D( 3620, 2617 ),
|
||||
new Point2D( 2880, 3472 ),
|
||||
new Point2D( 1897, 2684 ),
|
||||
new Point2D( 5346, 74 ),
|
||||
new Point2D( 5275, 3977 ),
|
||||
new Point2D( 5669, 3131 )
|
||||
};
|
||||
public class EnchantedSextant : Item
|
||||
{
|
||||
private const double m_LongDistance = 300.0;
|
||||
|
||||
private static readonly Point2D[] m_FeluccaBanks = {
|
||||
new Point2D( 652, 820 ),
|
||||
new Point2D( 1813, 2825 ),
|
||||
new Point2D( 3734, 2149 ),
|
||||
new Point2D( 2503, 552 ),
|
||||
new Point2D( 3764, 1317 ),
|
||||
new Point2D( 3695, 2511 ),
|
||||
new Point2D( 587, 2146 ),
|
||||
new Point2D( 1655, 1606 ),
|
||||
new Point2D( 1425, 1690 ),
|
||||
new Point2D( 4471, 1156 ),
|
||||
new Point2D( 1317, 3773 ),
|
||||
new Point2D( 2881, 684 ),
|
||||
new Point2D( 2731, 2192 ),
|
||||
new Point2D( 2880, 3472 ),
|
||||
new Point2D( 1897, 2684 ),
|
||||
new Point2D( 5346, 74 ),
|
||||
new Point2D( 5275, 3977 ),
|
||||
new Point2D( 5669, 3131 )
|
||||
};
|
||||
private const double m_ShortDistance = 5.0;
|
||||
|
||||
private static readonly Point2D[] m_IlshenarBanks = {
|
||||
new Point2D( 854, 680 ),
|
||||
new Point2D( 855, 603 ),
|
||||
new Point2D( 1226, 554 ),
|
||||
new Point2D( 1610, 556 )
|
||||
};
|
||||
//TODO: Trammel/Haven
|
||||
private static readonly Point2D[] m_TrammelBanks =
|
||||
{
|
||||
new Point2D(652, 820),
|
||||
new Point2D(1813, 2825),
|
||||
new Point2D(3734, 2149),
|
||||
new Point2D(2503, 552),
|
||||
new Point2D(3764, 1317),
|
||||
new Point2D(587, 2146),
|
||||
new Point2D(1655, 1606),
|
||||
new Point2D(1425, 1690),
|
||||
new Point2D(4471, 1156),
|
||||
new Point2D(1317, 3773),
|
||||
new Point2D(2881, 684),
|
||||
new Point2D(2731, 2192),
|
||||
new Point2D(3620, 2617),
|
||||
new Point2D(2880, 3472),
|
||||
new Point2D(1897, 2684),
|
||||
new Point2D(5346, 74),
|
||||
new Point2D(5275, 3977),
|
||||
new Point2D(5669, 3131)
|
||||
};
|
||||
|
||||
private static readonly Point2D[] m_MalasBanks = {
|
||||
new Point2D( 996, 519 ),
|
||||
new Point2D( 2048, 1345 )
|
||||
};
|
||||
private static readonly Point2D[] m_FeluccaBanks =
|
||||
{
|
||||
new Point2D(652, 820),
|
||||
new Point2D(1813, 2825),
|
||||
new Point2D(3734, 2149),
|
||||
new Point2D(2503, 552),
|
||||
new Point2D(3764, 1317),
|
||||
new Point2D(3695, 2511),
|
||||
new Point2D(587, 2146),
|
||||
new Point2D(1655, 1606),
|
||||
new Point2D(1425, 1690),
|
||||
new Point2D(4471, 1156),
|
||||
new Point2D(1317, 3773),
|
||||
new Point2D(2881, 684),
|
||||
new Point2D(2731, 2192),
|
||||
new Point2D(2880, 3472),
|
||||
new Point2D(1897, 2684),
|
||||
new Point2D(5346, 74),
|
||||
new Point2D(5275, 3977),
|
||||
new Point2D(5669, 3131)
|
||||
};
|
||||
|
||||
private const double m_LongDistance = 300.0;
|
||||
private const double m_ShortDistance = 5.0;
|
||||
private static readonly Point2D[] m_IlshenarBanks =
|
||||
{
|
||||
new Point2D(854, 680),
|
||||
new Point2D(855, 603),
|
||||
new Point2D(1226, 554),
|
||||
new Point2D(1610, 556)
|
||||
};
|
||||
|
||||
public override int LabelNumber => 1046226; // an enchanted sextant
|
||||
private static readonly Point2D[] m_MalasBanks =
|
||||
{
|
||||
new Point2D(996, 519),
|
||||
new Point2D(2048, 1345)
|
||||
};
|
||||
|
||||
[Constructible]
|
||||
public EnchantedSextant() : base( 0x1058 )
|
||||
{
|
||||
Weight = 2.0;
|
||||
}
|
||||
[Constructible]
|
||||
public EnchantedSextant() : base(0x1058)
|
||||
{
|
||||
Weight = 2.0;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !from.InRange( GetWorldLocation(), 2 ) )
|
||||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
|
||||
return;
|
||||
}
|
||||
public EnchantedSextant(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
Point2D[] banks;
|
||||
PMList moongates;
|
||||
if ( from.Map == Map.Trammel )
|
||||
{
|
||||
banks = m_TrammelBanks;
|
||||
moongates = PMList.Trammel;
|
||||
}
|
||||
else if ( from.Map == Map.Felucca )
|
||||
{
|
||||
banks = m_FeluccaBanks;
|
||||
moongates = PMList.Felucca;
|
||||
}
|
||||
else if ( from.Map == Map.Ilshenar )
|
||||
{
|
||||
public override int LabelNumber => 1046226; // an enchanted sextant
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!from.InRange(GetWorldLocation(), 2))
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
|
||||
return;
|
||||
}
|
||||
|
||||
Point2D[] banks;
|
||||
PMList moongates;
|
||||
if (from.Map == Map.Trammel)
|
||||
{
|
||||
banks = m_TrammelBanks;
|
||||
moongates = PMList.Trammel;
|
||||
}
|
||||
else if (from.Map == Map.Felucca)
|
||||
{
|
||||
banks = m_FeluccaBanks;
|
||||
moongates = PMList.Felucca;
|
||||
}
|
||||
else if (from.Map == Map.Ilshenar)
|
||||
{
|
||||
#if false
|
||||
banks = m_IlshenarBanks;
|
||||
moongates = PMList.Ilshenar;
|
||||
#else
|
||||
from.Send( new MessageLocalized( Serial, ItemID, MessageType.Label, 0x482, 3, 1061684, "", "" ) ); // The magic of the sextant fails...
|
||||
return;
|
||||
from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, 0x482, 3, 1061684, "",
|
||||
"")); // The magic of the sextant fails...
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
else if ( from.Map == Map.Malas )
|
||||
{
|
||||
banks = m_MalasBanks;
|
||||
moongates = PMList.Malas;
|
||||
}
|
||||
else
|
||||
{
|
||||
banks = null;
|
||||
moongates = null;
|
||||
}
|
||||
}
|
||||
else if (from.Map == Map.Malas)
|
||||
{
|
||||
banks = m_MalasBanks;
|
||||
moongates = PMList.Malas;
|
||||
}
|
||||
else
|
||||
{
|
||||
banks = null;
|
||||
moongates = null;
|
||||
}
|
||||
|
||||
Point3D closestMoongate = Point3D.Zero;
|
||||
double moongateDistance = double.MaxValue;
|
||||
if ( moongates != null )
|
||||
{
|
||||
foreach ( PMEntry entry in moongates.Entries )
|
||||
{
|
||||
double dist = from.GetDistanceToSqrt( entry.Location );
|
||||
if ( moongateDistance > dist )
|
||||
{
|
||||
closestMoongate = entry.Location;
|
||||
moongateDistance = dist;
|
||||
}
|
||||
}
|
||||
}
|
||||
Point3D closestMoongate = Point3D.Zero;
|
||||
double moongateDistance = double.MaxValue;
|
||||
if (moongates != null)
|
||||
foreach (PMEntry entry in moongates.Entries)
|
||||
{
|
||||
double dist = from.GetDistanceToSqrt(entry.Location);
|
||||
if (moongateDistance > dist)
|
||||
{
|
||||
closestMoongate = entry.Location;
|
||||
moongateDistance = dist;
|
||||
}
|
||||
}
|
||||
|
||||
Point2D closestBank = Point2D.Zero;
|
||||
double bankDistance = double.MaxValue;
|
||||
if ( banks != null )
|
||||
{
|
||||
foreach ( Point2D p in banks )
|
||||
{
|
||||
double dist = from.GetDistanceToSqrt( p );
|
||||
if ( bankDistance > dist )
|
||||
{
|
||||
closestBank = p;
|
||||
bankDistance = dist;
|
||||
}
|
||||
}
|
||||
}
|
||||
Point2D closestBank = Point2D.Zero;
|
||||
double bankDistance = double.MaxValue;
|
||||
if (banks != null)
|
||||
foreach (Point2D p in banks)
|
||||
{
|
||||
double dist = from.GetDistanceToSqrt(p);
|
||||
if (bankDistance > dist)
|
||||
{
|
||||
closestBank = p;
|
||||
bankDistance = dist;
|
||||
}
|
||||
}
|
||||
|
||||
int moonMsg;
|
||||
if ( moongateDistance == double.MaxValue )
|
||||
moonMsg = 1048021; // The sextant fails to find a Moongate nearby.
|
||||
else if ( moongateDistance > m_LongDistance )
|
||||
moonMsg = 1046449 + (int)from.GetDirectionTo( closestMoongate ); // A moongate is * from here
|
||||
else if ( moongateDistance > m_ShortDistance )
|
||||
moonMsg = 1048010 + (int)from.GetDirectionTo( closestMoongate ); // There is a Moongate * of here.
|
||||
else
|
||||
moonMsg = 1048018; // You are next to a Moongate at the moment.
|
||||
int moonMsg;
|
||||
if (moongateDistance == double.MaxValue)
|
||||
moonMsg = 1048021; // The sextant fails to find a Moongate nearby.
|
||||
else if (moongateDistance > m_LongDistance)
|
||||
moonMsg = 1046449 + (int)from.GetDirectionTo(closestMoongate); // A moongate is * from here
|
||||
else if (moongateDistance > m_ShortDistance)
|
||||
moonMsg = 1048010 + (int)from.GetDirectionTo(closestMoongate); // There is a Moongate * of here.
|
||||
else
|
||||
moonMsg = 1048018; // You are next to a Moongate at the moment.
|
||||
|
||||
from.Send( new MessageLocalized( Serial, ItemID, MessageType.Label, 0x482, 3, moonMsg, "", "" ) );
|
||||
from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, 0x482, 3, moonMsg, "", ""));
|
||||
|
||||
int bankMsg;
|
||||
if ( bankDistance == double.MaxValue )
|
||||
bankMsg = 1048020; // The sextant fails to find a Bank nearby.
|
||||
else if ( bankDistance > m_LongDistance )
|
||||
bankMsg = 1046462 + (int)from.GetDirectionTo( closestBank ); // A town is * from here
|
||||
else if ( bankDistance > m_ShortDistance )
|
||||
bankMsg = 1048002 + (int)from.GetDirectionTo( closestBank ); // There is a city Bank * of here.
|
||||
else
|
||||
bankMsg = 1048019; // You are next to a Bank at the moment.
|
||||
int bankMsg;
|
||||
if (bankDistance == double.MaxValue)
|
||||
bankMsg = 1048020; // The sextant fails to find a Bank nearby.
|
||||
else if (bankDistance > m_LongDistance)
|
||||
bankMsg = 1046462 + (int)from.GetDirectionTo(closestBank); // A town is * from here
|
||||
else if (bankDistance > m_ShortDistance)
|
||||
bankMsg = 1048002 + (int)from.GetDirectionTo(closestBank); // There is a city Bank * of here.
|
||||
else
|
||||
bankMsg = 1048019; // You are next to a Bank at the moment.
|
||||
|
||||
from.Send( new MessageLocalized( Serial, ItemID, MessageType.Label, 0x5AA, 3, bankMsg, "", "" ) );
|
||||
}
|
||||
from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, 0x5AA, 3, bankMsg, "", ""));
|
||||
}
|
||||
|
||||
public EnchantedSextant( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,192 +1,198 @@
|
|||
using System;
|
||||
using Server.Items;
|
||||
using Server.Regions;
|
||||
|
||||
namespace Server.Engines.Quests
|
||||
{
|
||||
public class HornOfRetreat : Item
|
||||
{
|
||||
private int m_Charges;
|
||||
public class HornOfRetreat : Item
|
||||
{
|
||||
private int m_Charges;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D DestLoc { get; set; }
|
||||
private Timer m_PlayTimer;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Map DestMap { get; set; }
|
||||
[Constructible]
|
||||
public HornOfRetreat() : base(0xFC4)
|
||||
{
|
||||
Hue = 0x482;
|
||||
Weight = 1.0;
|
||||
Charges = 10;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Charges
|
||||
{
|
||||
get => m_Charges;
|
||||
set{ m_Charges = value; InvalidateProperties(); }
|
||||
}
|
||||
public HornOfRetreat(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1049117; // Horn of Retreat
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Point3D DestLoc{ get; set; }
|
||||
|
||||
[Constructible]
|
||||
public HornOfRetreat() : base( 0xFC4 )
|
||||
{
|
||||
Hue = 0x482;
|
||||
Weight = 1.0;
|
||||
Charges = 10;
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Map DestMap{ get; set; }
|
||||
|
||||
public virtual bool ValidateUse( Mobile from )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Charges
|
||||
{
|
||||
get => m_Charges;
|
||||
set
|
||||
{
|
||||
m_Charges = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
public override int LabelNumber => 1049117; // Horn of Retreat
|
||||
|
||||
list.Add( 1060741, m_Charges.ToString() ); // charges: ~1_val~
|
||||
}
|
||||
public virtual bool ValidateUse(Mobile from)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private Timer m_PlayTimer;
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( IsChildOf( from.Backpack ) )
|
||||
{
|
||||
if ( !ValidateUse( from ) )
|
||||
{
|
||||
SendLocalizedMessageTo( from, 500309 ); // Nothing Happens.
|
||||
}
|
||||
else if ( Core.ML && from.Map != Map.Trammel && from.Map != Map.Malas )
|
||||
{
|
||||
from.SendLocalizedMessage( 1076154 ); // You can only use this in Trammel and Malas.
|
||||
}
|
||||
else if ( m_PlayTimer != null )
|
||||
{
|
||||
SendLocalizedMessageTo( from, 1042144 ); // This is currently in use.
|
||||
}
|
||||
else if ( Charges > 0 )
|
||||
{
|
||||
from.Animate( 34, 7, 1, true, false, 0 );
|
||||
from.PlaySound( 0xFF );
|
||||
from.SendLocalizedMessage( 1049115 ); // You play the horn and a sense of peace overcomes you...
|
||||
list.Add(1060741, m_Charges.ToString()); // charges: ~1_val~
|
||||
}
|
||||
|
||||
--Charges;
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (IsChildOf(from.Backpack))
|
||||
{
|
||||
if (!ValidateUse(from))
|
||||
{
|
||||
SendLocalizedMessageTo(from, 500309); // Nothing Happens.
|
||||
}
|
||||
else if (Core.ML && from.Map != Map.Trammel && from.Map != Map.Malas)
|
||||
{
|
||||
from.SendLocalizedMessage(1076154); // You can only use this in Trammel and Malas.
|
||||
}
|
||||
else if (m_PlayTimer != null)
|
||||
{
|
||||
SendLocalizedMessageTo(from, 1042144); // This is currently in use.
|
||||
}
|
||||
else if (Charges > 0)
|
||||
{
|
||||
from.Animate(34, 7, 1, true, false, 0);
|
||||
from.PlaySound(0xFF);
|
||||
from.SendLocalizedMessage(1049115); // You play the horn and a sense of peace overcomes you...
|
||||
|
||||
m_PlayTimer = Timer.DelayCall( TimeSpan.FromSeconds( 5.0 ), new TimerStateCallback( PlayTimer_Callback ), from );
|
||||
}
|
||||
else
|
||||
{
|
||||
SendLocalizedMessageTo( from, 1042544 ); // This item is out of charges.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SendLocalizedMessageTo( from, 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
}
|
||||
--Charges;
|
||||
|
||||
public virtual void PlayTimer_Callback( object state )
|
||||
{
|
||||
Mobile from = (Mobile)state;
|
||||
m_PlayTimer = Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerStateCallback(PlayTimer_Callback),
|
||||
from);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendLocalizedMessageTo(from, 1042544); // This item is out of charges.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SendLocalizedMessageTo(from, 1042001); // That must be in your pack for you to use it.
|
||||
}
|
||||
}
|
||||
|
||||
m_PlayTimer = null;
|
||||
public virtual void PlayTimer_Callback(object state)
|
||||
{
|
||||
Mobile from = (Mobile)state;
|
||||
|
||||
HornOfRetreatMoongate gate = new HornOfRetreatMoongate( DestLoc, DestMap, from, Hue );
|
||||
m_PlayTimer = null;
|
||||
|
||||
gate.MoveToWorld( from.Location, from.Map );
|
||||
HornOfRetreatMoongate gate = new HornOfRetreatMoongate(DestLoc, DestMap, from, Hue);
|
||||
|
||||
from.PlaySound( 0x20E );
|
||||
gate.MoveToWorld(from.Location, from.Map);
|
||||
|
||||
gate.SendLocalizedMessageTo( from, 1049102, from.Name ); // Quickly ~1_NAME~! Onward through the gate!
|
||||
}
|
||||
from.PlaySound(0x20E);
|
||||
|
||||
public HornOfRetreat( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
gate.SendLocalizedMessageTo(from, 1049102, from.Name); // Quickly ~1_NAME~! Onward through the gate!
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
writer.Write(0); // version
|
||||
|
||||
writer.Write( DestLoc );
|
||||
writer.Write( DestMap );
|
||||
writer.Write( m_Charges );
|
||||
}
|
||||
writer.Write(DestLoc);
|
||||
writer.Write(DestMap);
|
||||
writer.Write(m_Charges);
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
DestLoc = reader.ReadPoint3D();
|
||||
DestMap = reader.ReadMap();
|
||||
m_Charges = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
DestLoc = reader.ReadPoint3D();
|
||||
DestMap = reader.ReadMap();
|
||||
m_Charges = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class HornOfRetreatMoongate : Moongate
|
||||
{
|
||||
public override int LabelNumber => 1049114; // Sanctuary Gate
|
||||
public class HornOfRetreatMoongate : Moongate
|
||||
{
|
||||
private Mobile m_Caster;
|
||||
|
||||
private Mobile m_Caster;
|
||||
public HornOfRetreatMoongate(Point3D destLoc, Map destMap, Mobile caster, int hue)
|
||||
{
|
||||
m_Caster = caster;
|
||||
|
||||
public HornOfRetreatMoongate( Point3D destLoc, Map destMap, Mobile caster, int hue )
|
||||
{
|
||||
m_Caster = caster;
|
||||
Target = destLoc;
|
||||
TargetMap = destMap;
|
||||
|
||||
Target = destLoc;
|
||||
TargetMap = destMap;
|
||||
Hue = hue;
|
||||
Light = LightType.Circle300;
|
||||
|
||||
Hue = hue;
|
||||
Light = LightType.Circle300;
|
||||
Dispellable = false;
|
||||
|
||||
Dispellable = false;
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(10.0), Delete);
|
||||
}
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 10.0 ), Delete );
|
||||
}
|
||||
public HornOfRetreatMoongate(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void BeginConfirmation( Mobile from )
|
||||
{
|
||||
EndConfirmation( from );
|
||||
}
|
||||
public override int LabelNumber => 1049114; // Sanctuary Gate
|
||||
|
||||
public override void UseGate( Mobile m )
|
||||
{
|
||||
if ( m.Region.IsPartOf( typeof( Regions.Jail ) ) )
|
||||
{
|
||||
m.SendLocalizedMessage( 1114345 ); // You'll need a better jailbreak plan than that!
|
||||
}
|
||||
else if ( m == m_Caster )
|
||||
{
|
||||
base.UseGate( m );
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
public override void BeginConfirmation(Mobile from)
|
||||
{
|
||||
EndConfirmation(from);
|
||||
}
|
||||
|
||||
public HornOfRetreatMoongate( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override void UseGate(Mobile m)
|
||||
{
|
||||
if (m.Region.IsPartOf(typeof(Jail)))
|
||||
{
|
||||
m.SendLocalizedMessage(1114345); // You'll need a better jailbreak plan than that!
|
||||
}
|
||||
else if (m == m_Caster)
|
||||
{
|
||||
base.UseGate(m);
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
int version = reader.ReadInt();
|
||||
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,105 +2,91 @@ using Server.Mobiles;
|
|||
|
||||
namespace Server.Engines.Quests
|
||||
{
|
||||
public abstract class QuestItem : Item
|
||||
{
|
||||
public QuestItem( int itemID ) : base( itemID )
|
||||
{
|
||||
}
|
||||
public abstract class QuestItem : Item
|
||||
{
|
||||
public QuestItem(int itemID) : base(itemID)
|
||||
{
|
||||
}
|
||||
|
||||
public QuestItem( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public QuestItem(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public abstract bool CanDrop( PlayerMobile pm );
|
||||
public virtual bool Accepted => Deleted;
|
||||
|
||||
public virtual bool Accepted => Deleted;
|
||||
public abstract bool CanDrop(PlayerMobile pm);
|
||||
|
||||
public override bool DropToWorld( Mobile from, Point3D p )
|
||||
{
|
||||
bool ret = base.DropToWorld( from, p );
|
||||
public override bool DropToWorld(Mobile from, Point3D p)
|
||||
{
|
||||
bool ret = base.DropToWorld(from, p);
|
||||
|
||||
if ( ret && !Accepted && Parent != from.Backpack )
|
||||
{
|
||||
if ( from.AccessLevel > AccessLevel.Player )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (ret && !Accepted && Parent != from.Backpack)
|
||||
{
|
||||
if (from.AccessLevel > AccessLevel.Player) return true;
|
||||
|
||||
if ( !(from is PlayerMobile) || CanDrop( (PlayerMobile)from ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
from.SendLocalizedMessage( 1049343 ); // You can only drop quest items into the top-most level of your backpack while you still need them for your quest.
|
||||
return false;
|
||||
}
|
||||
if (!(from is PlayerMobile) || CanDrop((PlayerMobile)from)) return true;
|
||||
from.SendLocalizedMessage(
|
||||
1049343); // You can only drop quest items into the top-most level of your backpack while you still need them for your quest.
|
||||
return false;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public override bool DropToMobile( Mobile from, Mobile target, Point3D p )
|
||||
{
|
||||
bool ret = base.DropToMobile( from, target, p );
|
||||
public override bool DropToMobile(Mobile from, Mobile target, Point3D p)
|
||||
{
|
||||
bool ret = base.DropToMobile(from, target, p);
|
||||
|
||||
if ( ret && !Accepted && Parent != from.Backpack )
|
||||
{
|
||||
if ( from.AccessLevel > AccessLevel.Player )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (ret && !Accepted && Parent != from.Backpack)
|
||||
{
|
||||
if (from.AccessLevel > AccessLevel.Player) return true;
|
||||
|
||||
if ( !(from is PlayerMobile) || CanDrop( (PlayerMobile)from ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
from.SendLocalizedMessage( 1049344 ); // You decide against trading the item. You still need it for your quest.
|
||||
return false;
|
||||
}
|
||||
if (!(from is PlayerMobile) || CanDrop((PlayerMobile)from)) return true;
|
||||
from.SendLocalizedMessage(
|
||||
1049344); // You decide against trading the item. You still need it for your quest.
|
||||
return false;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public override bool DropToItem( Mobile from, Item target, Point3D p )
|
||||
{
|
||||
bool ret = base.DropToItem( from, target, p );
|
||||
public override bool DropToItem(Mobile from, Item target, Point3D p)
|
||||
{
|
||||
bool ret = base.DropToItem(from, target, p);
|
||||
|
||||
if ( ret && !Accepted && Parent != from.Backpack )
|
||||
{
|
||||
if ( from.AccessLevel > AccessLevel.Player )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (ret && !Accepted && Parent != from.Backpack)
|
||||
{
|
||||
if (from.AccessLevel > AccessLevel.Player) return true;
|
||||
|
||||
if ( !(from is PlayerMobile) || CanDrop( (PlayerMobile)from ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
from.SendLocalizedMessage( 1049343 ); // You can only drop quest items into the top-most level of your backpack while you still need them for your quest.
|
||||
return false;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
if (!(from is PlayerMobile) || CanDrop((PlayerMobile)from)) return true;
|
||||
from.SendLocalizedMessage(
|
||||
1049343); // You can only drop quest items into the top-most level of your backpack while you still need them for your quest.
|
||||
return false;
|
||||
}
|
||||
|
||||
public override DeathMoveResult OnParentDeath( Mobile parent )
|
||||
{
|
||||
if ( parent is PlayerMobile mobile && !CanDrop( mobile ) )
|
||||
return DeathMoveResult.MoveToBackpack;
|
||||
return ret;
|
||||
}
|
||||
|
||||
return base.OnParentDeath( parent );
|
||||
}
|
||||
public override DeathMoveResult OnParentDeath(Mobile parent)
|
||||
{
|
||||
if (parent is PlayerMobile mobile && !CanDrop(mobile))
|
||||
return DeathMoveResult.MoveToBackpack;
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
return base.OnParentDeath(parent);
|
||||
}
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,22 +2,22 @@ using Server.ContextMenus;
|
|||
|
||||
namespace Server.Engines.Quests
|
||||
{
|
||||
public class QuestCallbackEntry : ContextMenuEntry
|
||||
{
|
||||
private QuestCallback m_Callback;
|
||||
public class QuestCallbackEntry : ContextMenuEntry
|
||||
{
|
||||
private QuestCallback m_Callback;
|
||||
|
||||
public QuestCallbackEntry( int number, QuestCallback callback ) : this( number, -1, callback )
|
||||
{
|
||||
}
|
||||
public QuestCallbackEntry(int number, QuestCallback callback) : this(number, -1, callback)
|
||||
{
|
||||
}
|
||||
|
||||
public QuestCallbackEntry( int number, int range, QuestCallback callback ) : base( number, range )
|
||||
{
|
||||
m_Callback = callback;
|
||||
}
|
||||
public QuestCallbackEntry(int number, int range, QuestCallback callback) : base(number, range)
|
||||
{
|
||||
m_Callback = callback;
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
m_Callback?.Invoke();
|
||||
}
|
||||
}
|
||||
public override void OnClick()
|
||||
{
|
||||
m_Callback?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,139 +4,135 @@ using Server.Network;
|
|||
|
||||
namespace Server.Engines.Quests
|
||||
{
|
||||
public abstract class QuestConversation
|
||||
{
|
||||
public abstract object Message{ get; }
|
||||
public abstract class QuestConversation
|
||||
{
|
||||
public abstract object Message{ get; }
|
||||
|
||||
public virtual QuestItemInfo[] Info => null;
|
||||
public virtual bool Logged => true;
|
||||
public virtual QuestItemInfo[] Info => null;
|
||||
public virtual bool Logged => true;
|
||||
|
||||
public QuestSystem System { get; set; }
|
||||
public QuestSystem System{ get; set; }
|
||||
|
||||
public bool HasBeenRead { get; set; }
|
||||
public bool HasBeenRead{ get; set; }
|
||||
|
||||
public QuestConversation()
|
||||
{
|
||||
}
|
||||
public virtual void BaseDeserialize(GenericReader reader)
|
||||
{
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
public virtual void BaseDeserialize( GenericReader reader )
|
||||
{
|
||||
int version = reader.ReadEncodedInt();
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
HasBeenRead = reader.ReadBool();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
HasBeenRead = reader.ReadBool();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
ChildDeserialize(reader);
|
||||
}
|
||||
|
||||
ChildDeserialize( reader );
|
||||
}
|
||||
public virtual void ChildDeserialize(GenericReader reader)
|
||||
{
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
|
||||
public virtual void ChildDeserialize( GenericReader reader )
|
||||
{
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
public virtual void BaseSerialize(GenericWriter writer)
|
||||
{
|
||||
writer.WriteEncodedInt(0); // version
|
||||
|
||||
public virtual void BaseSerialize( GenericWriter writer )
|
||||
{
|
||||
writer.WriteEncodedInt( (int) 0 ); // version
|
||||
writer.Write(HasBeenRead);
|
||||
|
||||
writer.Write( (bool) HasBeenRead );
|
||||
ChildSerialize(writer);
|
||||
}
|
||||
|
||||
ChildSerialize( writer );
|
||||
}
|
||||
public virtual void ChildSerialize(GenericWriter writer)
|
||||
{
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public virtual void ChildSerialize( GenericWriter writer )
|
||||
{
|
||||
writer.WriteEncodedInt( (int) 0 ); // version
|
||||
}
|
||||
public virtual void OnRead()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void OnRead()
|
||||
{
|
||||
}
|
||||
}
|
||||
public class QuestConversationsGump : BaseQuestGump
|
||||
{
|
||||
private ArrayList m_Conversations;
|
||||
|
||||
public class QuestConversationsGump : BaseQuestGump
|
||||
{
|
||||
private ArrayList m_Conversations;
|
||||
public QuestConversationsGump(QuestConversation conv) : this(BuildList(conv))
|
||||
{
|
||||
}
|
||||
|
||||
public QuestConversationsGump( QuestConversation conv ) : this( BuildList( conv ) )
|
||||
{
|
||||
}
|
||||
public QuestConversationsGump(ArrayList conversations) : base(30, 50)
|
||||
{
|
||||
m_Conversations = conversations;
|
||||
|
||||
public QuestConversationsGump( ArrayList conversations ) : base( 30, 50 )
|
||||
{
|
||||
m_Conversations = conversations;
|
||||
Closable = false;
|
||||
|
||||
Closable = false;
|
||||
AddPage(0);
|
||||
|
||||
AddPage( 0 );
|
||||
AddImage(349, 10, 9392);
|
||||
AddImageTiled(349, 130, 100, 120, 9395);
|
||||
AddImageTiled(149, 10, 200, 140, 9391);
|
||||
AddImageTiled(149, 250, 200, 140, 9397);
|
||||
AddImage(349, 250, 9398);
|
||||
AddImage(35, 10, 9390);
|
||||
AddImageTiled(35, 150, 120, 100, 9393);
|
||||
AddImage(35, 250, 9396);
|
||||
|
||||
AddImage( 349, 10, 9392 );
|
||||
AddImageTiled( 349, 130, 100, 120, 9395 );
|
||||
AddImageTiled( 149, 10, 200, 140, 9391 );
|
||||
AddImageTiled( 149, 250, 200, 140, 9397 );
|
||||
AddImage( 349, 250, 9398 );
|
||||
AddImage( 35, 10, 9390 );
|
||||
AddImageTiled( 35, 150, 120, 100, 9393 );
|
||||
AddImage( 35, 250, 9396 );
|
||||
AddHtmlLocalized(110, 60, 200, 20, 1049069, White, false, false); // <STRONG>Conversation Event</STRONG>
|
||||
|
||||
AddHtmlLocalized( 110, 60, 200, 20, 1049069, White, false, false ); // <STRONG>Conversation Event</STRONG>
|
||||
AddImage(65, 14, 10102);
|
||||
AddImageTiled(81, 14, 349, 17, 10101);
|
||||
AddImage(426, 14, 10104);
|
||||
|
||||
AddImage( 65, 14, 10102 );
|
||||
AddImageTiled( 81, 14, 349, 17, 10101 );
|
||||
AddImage( 426, 14, 10104 );
|
||||
AddImageTiled(55, 40, 388, 323, 2624);
|
||||
AddAlphaRegion(55, 40, 388, 323);
|
||||
|
||||
AddImageTiled( 55, 40, 388, 323, 2624 );
|
||||
AddAlphaRegion( 55, 40, 388, 323 );
|
||||
AddImageTiled(75, 90, 200, 1, 9101);
|
||||
AddImage(75, 58, 9781);
|
||||
AddImage(380, 45, 223);
|
||||
|
||||
AddImageTiled( 75, 90, 200, 1, 9101 );
|
||||
AddImage( 75, 58, 9781 );
|
||||
AddImage( 380, 45, 223 );
|
||||
AddButton(220, 335, 2313, 2312, 1, GumpButtonType.Reply, 0);
|
||||
AddImage(0, 0, 10440);
|
||||
|
||||
AddButton( 220, 335, 2313, 2312, 1, GumpButtonType.Reply, 0 );
|
||||
AddImage( 0, 0, 10440 );
|
||||
AddPage(1);
|
||||
|
||||
AddPage( 1 );
|
||||
for (int i = 0; i < conversations.Count; ++i)
|
||||
{
|
||||
QuestConversation conv = (QuestConversation)conversations[conversations.Count - 1 - i];
|
||||
|
||||
for ( int i = 0; i < conversations.Count; ++i )
|
||||
{
|
||||
QuestConversation conv = (QuestConversation)conversations[conversations.Count - 1 - i];
|
||||
if (i > 0)
|
||||
{
|
||||
AddButton(65, 366, 9909, 9911, 0, GumpButtonType.Page, 1 + i);
|
||||
AddHtmlLocalized(90, 367, 50, 20, 1043354, Black, false, false); // Previous
|
||||
|
||||
if ( i > 0 )
|
||||
{
|
||||
AddButton( 65, 366, 9909, 9911, 0, GumpButtonType.Page, 1 + i );
|
||||
AddHtmlLocalized( 90, 367, 50, 20, 1043354, Black, false, false ); // Previous
|
||||
AddPage(1 + i);
|
||||
}
|
||||
|
||||
AddPage( 1 + i );
|
||||
}
|
||||
AddHtmlObject(70, 110, 365, 220, conv.Message, LightGreen, false, true);
|
||||
|
||||
AddHtmlObject( 70, 110, 365, 220, conv.Message, LightGreen, false, true );
|
||||
if (i > 0)
|
||||
{
|
||||
AddButton(420, 366, 9903, 9905, 0, GumpButtonType.Page, i);
|
||||
AddHtmlLocalized(370, 367, 50, 20, 1043353, Black, false, false); // Next
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( i > 0 )
|
||||
{
|
||||
AddButton( 420, 366, 9903, 9905, 0, GumpButtonType.Page, i );
|
||||
AddHtmlLocalized( 370, 367, 50, 20, 1043353, Black, false, false ); // Next
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
for (int i = m_Conversations.Count - 1; i >= 0; --i)
|
||||
{
|
||||
QuestConversation qc = (QuestConversation)m_Conversations[i];
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
for ( int i = m_Conversations.Count - 1; i >= 0; --i )
|
||||
{
|
||||
QuestConversation qc = (QuestConversation)m_Conversations[i];
|
||||
|
||||
if ( !qc.HasBeenRead )
|
||||
{
|
||||
qc.HasBeenRead = true;
|
||||
qc.OnRead();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!qc.HasBeenRead)
|
||||
{
|
||||
qc.HasBeenRead = true;
|
||||
qc.OnRead();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,58 +2,58 @@ using Server.Gumps;
|
|||
|
||||
namespace Server.Engines.Quests
|
||||
{
|
||||
public class QuestItemInfo
|
||||
{
|
||||
public object Name { get; set; }
|
||||
public class QuestItemInfo
|
||||
{
|
||||
public QuestItemInfo(object name, int itemID)
|
||||
{
|
||||
Name = name;
|
||||
ItemID = itemID;
|
||||
}
|
||||
|
||||
public int ItemID { get; set; }
|
||||
public object Name{ get; set; }
|
||||
|
||||
public QuestItemInfo( object name, int itemID )
|
||||
{
|
||||
Name = name;
|
||||
ItemID = itemID;
|
||||
}
|
||||
}
|
||||
public int ItemID{ get; set; }
|
||||
}
|
||||
|
||||
public class QuestItemInfoGump : BaseQuestGump
|
||||
{
|
||||
public QuestItemInfoGump( QuestItemInfo[] info ) : base( 485, 75 )
|
||||
{
|
||||
int height = 100 + (info.Length * 75);
|
||||
public class QuestItemInfoGump : BaseQuestGump
|
||||
{
|
||||
public QuestItemInfoGump(QuestItemInfo[] info) : base(485, 75)
|
||||
{
|
||||
int height = 100 + info.Length * 75;
|
||||
|
||||
AddPage( 0 );
|
||||
AddPage(0);
|
||||
|
||||
AddBackground( 5, 10, 145, height, 5054 );
|
||||
AddBackground(5, 10, 145, height, 5054);
|
||||
|
||||
AddImageTiled( 13, 20, 125, 10, 2624 );
|
||||
AddAlphaRegion( 13, 20, 125, 10 );
|
||||
AddImageTiled(13, 20, 125, 10, 2624);
|
||||
AddAlphaRegion(13, 20, 125, 10);
|
||||
|
||||
AddImageTiled( 13, height - 10, 128, 10, 2624 );
|
||||
AddAlphaRegion( 13, height - 10, 128, 10 );
|
||||
AddImageTiled(13, height - 10, 128, 10, 2624);
|
||||
AddAlphaRegion(13, height - 10, 128, 10);
|
||||
|
||||
AddImageTiled( 13, 20, 10, height - 30, 2624 );
|
||||
AddAlphaRegion( 13, 20, 10, height - 30 );
|
||||
AddImageTiled(13, 20, 10, height - 30, 2624);
|
||||
AddAlphaRegion(13, 20, 10, height - 30);
|
||||
|
||||
AddImageTiled( 131, 20, 10, height - 30, 2624 );
|
||||
AddAlphaRegion( 131, 20, 10, height - 30 );
|
||||
AddImageTiled(131, 20, 10, height - 30, 2624);
|
||||
AddAlphaRegion(131, 20, 10, height - 30);
|
||||
|
||||
AddHtmlLocalized( 67, 35, 120, 20, 1011233, White, false, false ); // INFO
|
||||
AddHtmlLocalized(67, 35, 120, 20, 1011233, White, false, false); // INFO
|
||||
|
||||
AddImage( 62, 52, 9157 );
|
||||
AddImage( 72, 52, 9157 );
|
||||
AddImage( 82, 52, 9157 );
|
||||
AddImage(62, 52, 9157);
|
||||
AddImage(72, 52, 9157);
|
||||
AddImage(82, 52, 9157);
|
||||
|
||||
AddButton( 25, 31, 1209, 1210, 777, GumpButtonType.Reply, 0 );
|
||||
AddButton(25, 31, 1209, 1210, 777, GumpButtonType.Reply, 0);
|
||||
|
||||
AddPage( 1 );
|
||||
AddPage(1);
|
||||
|
||||
for ( int i = 0; i < info.Length; ++i )
|
||||
{
|
||||
QuestItemInfo cur = info[i];
|
||||
for (int i = 0; i < info.Length; ++i)
|
||||
{
|
||||
QuestItemInfo cur = info[i];
|
||||
|
||||
AddHtmlObject( 25, 65 + (i * 75), 110, 20, cur.Name, 1153, false, false );
|
||||
AddItem( 45, 85 + (i * 75), cur.ItemID );
|
||||
}
|
||||
}
|
||||
}
|
||||
AddHtmlObject(25, 65 + i * 75, 110, 20, cur.Name, 1153, false, false);
|
||||
AddItem(45, 85 + i * 75, cur.ItemID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,255 +1,255 @@
|
|||
using System.Collections;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.Quests
|
||||
{
|
||||
public abstract class QuestObjective
|
||||
{
|
||||
private int m_CurProgress;
|
||||
public abstract class QuestObjective
|
||||
{
|
||||
private int m_CurProgress;
|
||||
|
||||
public abstract object Message{ get; }
|
||||
public abstract object Message{ get; }
|
||||
|
||||
public virtual int MaxProgress => 1;
|
||||
public virtual QuestItemInfo[] Info => null;
|
||||
public virtual int MaxProgress => 1;
|
||||
public virtual QuestItemInfo[] Info => null;
|
||||
|
||||
public QuestSystem System { get; set; }
|
||||
public QuestSystem System{ get; set; }
|
||||
|
||||
public bool HasBeenRead { get; set; }
|
||||
public bool HasBeenRead{ get; set; }
|
||||
|
||||
public int CurProgress
|
||||
{
|
||||
get => m_CurProgress;
|
||||
set{ m_CurProgress = value; CheckCompletionStatus(); }
|
||||
}
|
||||
public int CurProgress
|
||||
{
|
||||
get => m_CurProgress;
|
||||
set
|
||||
{
|
||||
m_CurProgress = value;
|
||||
CheckCompletionStatus();
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasCompleted { get; set; }
|
||||
public bool HasCompleted{ get; set; }
|
||||
|
||||
public virtual bool Completed => m_CurProgress >= MaxProgress;
|
||||
public virtual bool Completed => m_CurProgress >= MaxProgress;
|
||||
|
||||
public bool IsSingleObjective => ( MaxProgress == 1 );
|
||||
public bool IsSingleObjective => MaxProgress == 1;
|
||||
|
||||
public QuestObjective()
|
||||
{
|
||||
}
|
||||
public virtual void BaseDeserialize(GenericReader reader)
|
||||
{
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
public virtual void BaseDeserialize( GenericReader reader )
|
||||
{
|
||||
int version = reader.ReadEncodedInt();
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
HasBeenRead = reader.ReadBool();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_CurProgress = reader.ReadEncodedInt();
|
||||
HasCompleted = reader.ReadBool();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
HasBeenRead = reader.ReadBool();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_CurProgress = reader.ReadEncodedInt();
|
||||
HasCompleted = reader.ReadBool();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
ChildDeserialize(reader);
|
||||
}
|
||||
|
||||
ChildDeserialize( reader );
|
||||
}
|
||||
public virtual void ChildDeserialize(GenericReader reader)
|
||||
{
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
|
||||
public virtual void ChildDeserialize( GenericReader reader )
|
||||
{
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
public virtual void BaseSerialize(GenericWriter writer)
|
||||
{
|
||||
writer.WriteEncodedInt(1); // version
|
||||
|
||||
public virtual void BaseSerialize( GenericWriter writer )
|
||||
{
|
||||
writer.WriteEncodedInt( (int) 1 ); // version
|
||||
writer.Write(HasBeenRead);
|
||||
writer.WriteEncodedInt(m_CurProgress);
|
||||
writer.Write(HasCompleted);
|
||||
|
||||
writer.Write( (bool) HasBeenRead );
|
||||
writer.WriteEncodedInt( (int) m_CurProgress );
|
||||
writer.Write( (bool) HasCompleted );
|
||||
ChildSerialize(writer);
|
||||
}
|
||||
|
||||
ChildSerialize( writer );
|
||||
}
|
||||
public virtual void ChildSerialize(GenericWriter writer)
|
||||
{
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public virtual void ChildSerialize( GenericWriter writer )
|
||||
{
|
||||
writer.WriteEncodedInt( (int) 0 ); // version
|
||||
}
|
||||
public virtual void Complete()
|
||||
{
|
||||
CurProgress = MaxProgress;
|
||||
}
|
||||
|
||||
public virtual void Complete()
|
||||
{
|
||||
CurProgress = MaxProgress;
|
||||
}
|
||||
public virtual void RenderMessage(BaseQuestGump gump)
|
||||
{
|
||||
gump.AddHtmlObject(70, 130, 300, 100, Message, BaseQuestGump.Blue, false, false);
|
||||
}
|
||||
|
||||
public virtual void RenderMessage( BaseQuestGump gump )
|
||||
{
|
||||
gump.AddHtmlObject( 70, 130, 300, 100, Message, BaseQuestGump.Blue, false, false );
|
||||
}
|
||||
public virtual void RenderProgress(BaseQuestGump gump)
|
||||
{
|
||||
gump.AddHtmlObject(70, 260, 270, 100, Completed ? 1049077 : 1049078, BaseQuestGump.Blue, false, false);
|
||||
}
|
||||
|
||||
public virtual void RenderProgress( BaseQuestGump gump )
|
||||
{
|
||||
gump.AddHtmlObject( 70, 260, 270, 100, Completed ? 1049077 : 1049078, BaseQuestGump.Blue, false, false );
|
||||
}
|
||||
public virtual void CheckCompletionStatus()
|
||||
{
|
||||
if (Completed && !HasCompleted)
|
||||
{
|
||||
HasCompleted = true;
|
||||
OnComplete();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void CheckCompletionStatus()
|
||||
{
|
||||
if ( Completed && !HasCompleted )
|
||||
{
|
||||
HasCompleted = true;
|
||||
OnComplete();
|
||||
}
|
||||
}
|
||||
public virtual void OnRead()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void OnRead()
|
||||
{
|
||||
}
|
||||
public virtual bool GetTimerEvent()
|
||||
{
|
||||
return !Completed;
|
||||
}
|
||||
|
||||
public virtual bool GetTimerEvent()
|
||||
{
|
||||
return !Completed;
|
||||
}
|
||||
public virtual void CheckProgress()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void CheckProgress()
|
||||
{
|
||||
}
|
||||
public virtual void OnComplete()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void OnComplete()
|
||||
{
|
||||
}
|
||||
public virtual bool GetKillEvent(BaseCreature creature, Container corpse)
|
||||
{
|
||||
return !Completed;
|
||||
}
|
||||
|
||||
public virtual bool GetKillEvent( BaseCreature creature, Container corpse )
|
||||
{
|
||||
return !Completed;
|
||||
}
|
||||
public virtual void OnKill(BaseCreature creature, Container corpse)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void OnKill( BaseCreature creature, Container corpse )
|
||||
{
|
||||
}
|
||||
public virtual bool IgnoreYoungProtection(Mobile from)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool IgnoreYoungProtection( Mobile from )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public class QuestLogUpdatedGump : BaseQuestGump
|
||||
{
|
||||
private QuestSystem m_System;
|
||||
|
||||
public class QuestLogUpdatedGump : BaseQuestGump
|
||||
{
|
||||
private QuestSystem m_System;
|
||||
public QuestLogUpdatedGump(QuestSystem system) : base(3, 30)
|
||||
{
|
||||
m_System = system;
|
||||
|
||||
public QuestLogUpdatedGump( QuestSystem system ) : base( 3, 30 )
|
||||
{
|
||||
m_System = system;
|
||||
AddPage(0);
|
||||
|
||||
AddPage( 0 );
|
||||
AddImage(20, 5, 1417);
|
||||
|
||||
AddImage( 20, 5, 1417 );
|
||||
AddHtmlLocalized(0, 78, 120, 40, 1049079, White, false, false); // Quest Log Updated
|
||||
|
||||
AddHtmlLocalized( 0, 78, 120, 40, 1049079, White, false, false ); // Quest Log Updated
|
||||
AddImageTiled(0, 78, 120, 40, 2624);
|
||||
AddAlphaRegion(0, 78, 120, 40);
|
||||
|
||||
AddImageTiled( 0, 78, 120, 40, 2624 );
|
||||
AddAlphaRegion( 0, 78, 120, 40 );
|
||||
AddButton(30, 15, 5575, 5576, 1, GumpButtonType.Reply, 0);
|
||||
}
|
||||
|
||||
AddButton( 30, 15, 5575, 5576, 1, GumpButtonType.Reply, 0 );
|
||||
}
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 1)
|
||||
m_System.ShowQuestLog();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( info.ButtonID == 1 )
|
||||
m_System.ShowQuestLog();
|
||||
}
|
||||
}
|
||||
public class QuestObjectivesGump : BaseQuestGump
|
||||
{
|
||||
private ArrayList m_Objectives;
|
||||
|
||||
public class QuestObjectivesGump : BaseQuestGump
|
||||
{
|
||||
private ArrayList m_Objectives;
|
||||
public QuestObjectivesGump(QuestObjective obj) : this(BuildList(obj))
|
||||
{
|
||||
}
|
||||
|
||||
public QuestObjectivesGump( QuestObjective obj ) : this( BuildList( obj ) )
|
||||
{
|
||||
}
|
||||
public QuestObjectivesGump(ArrayList objectives) : base(90, 50)
|
||||
{
|
||||
m_Objectives = objectives;
|
||||
|
||||
public QuestObjectivesGump( ArrayList objectives ) : base( 90, 50 )
|
||||
{
|
||||
m_Objectives = objectives;
|
||||
Closable = false;
|
||||
|
||||
Closable = false;
|
||||
AddPage(0);
|
||||
|
||||
AddPage( 0 );
|
||||
AddImage(0, 0, 3600);
|
||||
AddImageTiled(0, 14, 15, 375, 3603);
|
||||
AddImageTiled(380, 14, 14, 375, 3605);
|
||||
AddImage(0, 376, 3606);
|
||||
AddImageTiled(15, 376, 370, 16, 3607);
|
||||
AddImageTiled(15, 0, 370, 16, 3601);
|
||||
AddImage(380, 0, 3602);
|
||||
AddImage(380, 376, 3608);
|
||||
|
||||
AddImage( 0, 0, 3600 );
|
||||
AddImageTiled( 0, 14, 15, 375, 3603 );
|
||||
AddImageTiled( 380, 14, 14, 375, 3605 );
|
||||
AddImage( 0, 376, 3606 );
|
||||
AddImageTiled( 15, 376, 370, 16, 3607 );
|
||||
AddImageTiled( 15, 0, 370, 16, 3601 );
|
||||
AddImage( 380, 0, 3602 );
|
||||
AddImage( 380, 376, 3608 );
|
||||
AddImageTiled(15, 15, 365, 365, 2624);
|
||||
AddAlphaRegion(15, 15, 365, 365);
|
||||
|
||||
AddImageTiled( 15, 15, 365, 365, 2624 );
|
||||
AddAlphaRegion( 15, 15, 365, 365 );
|
||||
AddImage(20, 87, 1231);
|
||||
AddImage(75, 62, 9307);
|
||||
|
||||
AddImage( 20, 87, 1231 );
|
||||
AddImage( 75, 62, 9307 );
|
||||
AddHtmlLocalized(117, 35, 230, 20, 1046026, Blue, false, false); // Quest Log
|
||||
|
||||
AddHtmlLocalized( 117, 35, 230, 20, 1046026, Blue, false, false ); // Quest Log
|
||||
AddImage(77, 33, 9781);
|
||||
AddImage(65, 110, 2104);
|
||||
|
||||
AddImage( 77, 33, 9781 );
|
||||
AddImage( 65, 110, 2104 );
|
||||
AddHtmlLocalized(79, 106, 230, 20, 1049073, Blue, false, false); // Objective:
|
||||
|
||||
AddHtmlLocalized( 79, 106, 230, 20, 1049073, Blue, false, false ); // Objective:
|
||||
AddImageTiled(68, 125, 120, 1, 9101);
|
||||
AddImage(65, 240, 2104);
|
||||
|
||||
AddImageTiled( 68, 125, 120, 1, 9101 );
|
||||
AddImage( 65, 240, 2104 );
|
||||
AddHtmlLocalized(79, 237, 230, 20, 1049076, Blue, false, false); // Progress details:
|
||||
|
||||
AddHtmlLocalized( 79, 237, 230, 20, 1049076, Blue, false, false ); // Progress details:
|
||||
AddImageTiled(68, 255, 120, 1, 9101);
|
||||
AddButton(175, 355, 2313, 2312, 1, GumpButtonType.Reply, 0);
|
||||
|
||||
AddImageTiled( 68, 255, 120, 1, 9101 );
|
||||
AddButton( 175, 355, 2313, 2312, 1, GumpButtonType.Reply, 0 );
|
||||
AddImage(341, 15, 10450);
|
||||
AddImage(341, 330, 10450);
|
||||
AddImage(15, 330, 10450);
|
||||
AddImage(15, 15, 10450);
|
||||
|
||||
AddImage( 341, 15, 10450 );
|
||||
AddImage( 341, 330, 10450 );
|
||||
AddImage( 15, 330, 10450 );
|
||||
AddImage( 15, 15, 10450 );
|
||||
AddPage(1);
|
||||
|
||||
AddPage( 1 );
|
||||
for (int i = 0; i < objectives.Count; ++i)
|
||||
{
|
||||
QuestObjective obj = (QuestObjective)objectives[objectives.Count - 1 - i];
|
||||
|
||||
for ( int i = 0; i < objectives.Count; ++i )
|
||||
{
|
||||
QuestObjective obj = (QuestObjective)objectives[objectives.Count - 1 - i];
|
||||
if (i > 0)
|
||||
{
|
||||
AddButton(55, 346, 9909, 9911, 0, GumpButtonType.Page, 1 + i);
|
||||
AddHtmlLocalized(82, 347, 50, 20, 1043354, White, false, false); // Previous
|
||||
|
||||
if ( i > 0 )
|
||||
{
|
||||
AddButton( 55, 346, 9909, 9911, 0, GumpButtonType.Page, 1 + i );
|
||||
AddHtmlLocalized( 82, 347, 50, 20, 1043354, White, false, false ); // Previous
|
||||
AddPage(1 + i);
|
||||
}
|
||||
|
||||
AddPage( 1 + i );
|
||||
}
|
||||
obj.RenderMessage(this);
|
||||
obj.RenderProgress(this);
|
||||
|
||||
obj.RenderMessage( this );
|
||||
obj.RenderProgress( this );
|
||||
if (i > 0)
|
||||
{
|
||||
AddButton(317, 346, 9903, 9905, 0, GumpButtonType.Page, i);
|
||||
AddHtmlLocalized(278, 347, 50, 20, 1043353, White, false, false); // Next
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( i > 0 )
|
||||
{
|
||||
AddButton( 317, 346, 9903, 9905, 0, GumpButtonType.Page, i );
|
||||
AddHtmlLocalized( 278, 347, 50, 20, 1043353, White, false, false ); // Next
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
for (int i = m_Objectives.Count - 1; i >= 0; --i)
|
||||
{
|
||||
QuestObjective obj = (QuestObjective)m_Objectives[i];
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
for ( int i = m_Objectives.Count - 1; i >= 0; --i )
|
||||
{
|
||||
QuestObjective obj = (QuestObjective)m_Objectives[i];
|
||||
|
||||
if ( !obj.HasBeenRead )
|
||||
{
|
||||
obj.HasBeenRead = true;
|
||||
obj.OnRead();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!obj.HasBeenRead)
|
||||
{
|
||||
obj.HasBeenRead = true;
|
||||
obj.OnRead();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,30 +2,30 @@ using System;
|
|||
|
||||
namespace Server.Engines.Quests
|
||||
{
|
||||
public class QuestRestartInfo
|
||||
{
|
||||
public Type QuestType { get; set; }
|
||||
public class QuestRestartInfo
|
||||
{
|
||||
public QuestRestartInfo(Type questType, TimeSpan restartDelay)
|
||||
{
|
||||
QuestType = questType;
|
||||
Reset(restartDelay);
|
||||
}
|
||||
|
||||
public DateTime RestartTime { get; set; }
|
||||
public QuestRestartInfo(Type questType, DateTime restartTime)
|
||||
{
|
||||
QuestType = questType;
|
||||
RestartTime = restartTime;
|
||||
}
|
||||
|
||||
public void Reset( TimeSpan restartDelay )
|
||||
{
|
||||
if ( restartDelay < TimeSpan.MaxValue )
|
||||
RestartTime = DateTime.UtcNow + restartDelay;
|
||||
else
|
||||
RestartTime = DateTime.MaxValue;
|
||||
}
|
||||
public Type QuestType{ get; set; }
|
||||
|
||||
public QuestRestartInfo( Type questType, TimeSpan restartDelay )
|
||||
{
|
||||
QuestType = questType;
|
||||
Reset( restartDelay );
|
||||
}
|
||||
public DateTime RestartTime{ get; set; }
|
||||
|
||||
public QuestRestartInfo( Type questType, DateTime restartTime )
|
||||
{
|
||||
QuestType = questType;
|
||||
RestartTime = restartTime;
|
||||
}
|
||||
}
|
||||
public void Reset(TimeSpan restartDelay)
|
||||
{
|
||||
if (restartDelay < TimeSpan.MaxValue)
|
||||
RestartTime = DateTime.UtcNow + restartDelay;
|
||||
else
|
||||
RestartTime = DateTime.MaxValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,193 +2,191 @@ using System;
|
|||
|
||||
namespace Server.Engines.Quests
|
||||
{
|
||||
public class QuestSerializer
|
||||
{
|
||||
public static object Construct( Type type )
|
||||
{
|
||||
try
|
||||
{
|
||||
return Activator.CreateInstance( type );
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public class QuestSerializer
|
||||
{
|
||||
public static object Construct(Type type)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Activator.CreateInstance(type);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Write( Type type, Type[] referenceTable, GenericWriter writer )
|
||||
{
|
||||
if ( type == null )
|
||||
{
|
||||
writer.WriteEncodedInt( (int) 0x00 );
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( int i = 0; i < referenceTable.Length; ++i )
|
||||
{
|
||||
if ( referenceTable[i] == type )
|
||||
{
|
||||
writer.WriteEncodedInt( (int) 0x01 );
|
||||
writer.WriteEncodedInt( (int) i );
|
||||
return;
|
||||
}
|
||||
}
|
||||
public static void Write(Type type, Type[] referenceTable, GenericWriter writer)
|
||||
{
|
||||
if (type == null)
|
||||
{
|
||||
writer.WriteEncodedInt(0x00);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < referenceTable.Length; ++i)
|
||||
if (referenceTable[i] == type)
|
||||
{
|
||||
writer.WriteEncodedInt(0x01);
|
||||
writer.WriteEncodedInt(i);
|
||||
return;
|
||||
}
|
||||
|
||||
writer.WriteEncodedInt( (int) 0x02 );
|
||||
writer.Write( type.FullName );
|
||||
}
|
||||
}
|
||||
writer.WriteEncodedInt(0x02);
|
||||
writer.Write(type.FullName);
|
||||
}
|
||||
}
|
||||
|
||||
public static Type ReadType( Type[] referenceTable, GenericReader reader )
|
||||
{
|
||||
int encoding = reader.ReadEncodedInt();
|
||||
public static Type ReadType(Type[] referenceTable, GenericReader reader)
|
||||
{
|
||||
int encoding = reader.ReadEncodedInt();
|
||||
|
||||
switch ( encoding )
|
||||
{
|
||||
default:
|
||||
case 0x00: // null
|
||||
{
|
||||
return null;
|
||||
}
|
||||
case 0x01: // indexed
|
||||
{
|
||||
int index = reader.ReadEncodedInt();
|
||||
switch (encoding)
|
||||
{
|
||||
default:
|
||||
case 0x00: // null
|
||||
{
|
||||
return null;
|
||||
}
|
||||
case 0x01: // indexed
|
||||
{
|
||||
int index = reader.ReadEncodedInt();
|
||||
|
||||
if ( index >= 0 && index < referenceTable.Length )
|
||||
return referenceTable[index];
|
||||
if (index >= 0 && index < referenceTable.Length)
|
||||
return referenceTable[index];
|
||||
|
||||
return null;
|
||||
}
|
||||
case 0x02: // by name
|
||||
{
|
||||
string fullName = reader.ReadString();
|
||||
return null;
|
||||
}
|
||||
case 0x02: // by name
|
||||
{
|
||||
string fullName = reader.ReadString();
|
||||
|
||||
if ( fullName == null )
|
||||
return null;
|
||||
if (fullName == null)
|
||||
return null;
|
||||
|
||||
return ScriptCompiler.FindTypeByFullName( fullName, false );
|
||||
}
|
||||
}
|
||||
}
|
||||
return ScriptCompiler.FindTypeByFullName(fullName, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static QuestSystem DeserializeQuest( GenericReader reader )
|
||||
{
|
||||
int encoding = reader.ReadEncodedInt();
|
||||
public static QuestSystem DeserializeQuest(GenericReader reader)
|
||||
{
|
||||
int encoding = reader.ReadEncodedInt();
|
||||
|
||||
switch ( encoding )
|
||||
{
|
||||
default:
|
||||
case 0x00: // null
|
||||
{
|
||||
return null;
|
||||
}
|
||||
case 0x01:
|
||||
{
|
||||
Type type = ReadType( QuestSystem.QuestTypes, reader );
|
||||
switch (encoding)
|
||||
{
|
||||
default:
|
||||
case 0x00: // null
|
||||
{
|
||||
return null;
|
||||
}
|
||||
case 0x01:
|
||||
{
|
||||
Type type = ReadType(QuestSystem.QuestTypes, reader);
|
||||
|
||||
QuestSystem qs = Construct( type ) as QuestSystem;
|
||||
QuestSystem qs = Construct(type) as QuestSystem;
|
||||
|
||||
qs?.BaseDeserialize( reader );
|
||||
qs?.BaseDeserialize(reader);
|
||||
|
||||
return qs;
|
||||
}
|
||||
}
|
||||
}
|
||||
return qs;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Serialize( QuestSystem qs, GenericWriter writer )
|
||||
{
|
||||
if ( qs == null )
|
||||
{
|
||||
writer.WriteEncodedInt( 0x00 );
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteEncodedInt( 0x01 );
|
||||
public static void Serialize(QuestSystem qs, GenericWriter writer)
|
||||
{
|
||||
if (qs == null)
|
||||
{
|
||||
writer.WriteEncodedInt(0x00);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteEncodedInt(0x01);
|
||||
|
||||
Write( qs.GetType(), QuestSystem.QuestTypes, writer );
|
||||
Write(qs.GetType(), QuestSystem.QuestTypes, writer);
|
||||
|
||||
qs.BaseSerialize( writer );
|
||||
}
|
||||
}
|
||||
qs.BaseSerialize(writer);
|
||||
}
|
||||
}
|
||||
|
||||
public static QuestObjective DeserializeObjective( Type[] referenceTable, GenericReader reader )
|
||||
{
|
||||
int encoding = reader.ReadEncodedInt();
|
||||
public static QuestObjective DeserializeObjective(Type[] referenceTable, GenericReader reader)
|
||||
{
|
||||
int encoding = reader.ReadEncodedInt();
|
||||
|
||||
switch ( encoding )
|
||||
{
|
||||
default:
|
||||
case 0x00: // null
|
||||
{
|
||||
return null;
|
||||
}
|
||||
case 0x01:
|
||||
{
|
||||
Type type = ReadType( referenceTable, reader );
|
||||
switch (encoding)
|
||||
{
|
||||
default:
|
||||
case 0x00: // null
|
||||
{
|
||||
return null;
|
||||
}
|
||||
case 0x01:
|
||||
{
|
||||
Type type = ReadType(referenceTable, reader);
|
||||
|
||||
QuestObjective obj = Construct( type ) as QuestObjective;
|
||||
QuestObjective obj = Construct(type) as QuestObjective;
|
||||
|
||||
obj?.BaseDeserialize( reader );
|
||||
obj?.BaseDeserialize(reader);
|
||||
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Serialize( Type[] referenceTable, QuestObjective obj, GenericWriter writer )
|
||||
{
|
||||
if ( obj == null )
|
||||
{
|
||||
writer.WriteEncodedInt( 0x00 );
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteEncodedInt( 0x01 );
|
||||
public static void Serialize(Type[] referenceTable, QuestObjective obj, GenericWriter writer)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
writer.WriteEncodedInt(0x00);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteEncodedInt(0x01);
|
||||
|
||||
Write( obj.GetType(), referenceTable, writer );
|
||||
Write(obj.GetType(), referenceTable, writer);
|
||||
|
||||
obj.BaseSerialize( writer );
|
||||
}
|
||||
}
|
||||
obj.BaseSerialize(writer);
|
||||
}
|
||||
}
|
||||
|
||||
public static QuestConversation DeserializeConversation( Type[] referenceTable, GenericReader reader )
|
||||
{
|
||||
int encoding = reader.ReadEncodedInt();
|
||||
public static QuestConversation DeserializeConversation(Type[] referenceTable, GenericReader reader)
|
||||
{
|
||||
int encoding = reader.ReadEncodedInt();
|
||||
|
||||
switch ( encoding )
|
||||
{
|
||||
default:
|
||||
case 0x00: // null
|
||||
{
|
||||
return null;
|
||||
}
|
||||
case 0x01:
|
||||
{
|
||||
Type type = ReadType( referenceTable, reader );
|
||||
switch (encoding)
|
||||
{
|
||||
default:
|
||||
case 0x00: // null
|
||||
{
|
||||
return null;
|
||||
}
|
||||
case 0x01:
|
||||
{
|
||||
Type type = ReadType(referenceTable, reader);
|
||||
|
||||
QuestConversation conv = Construct( type ) as QuestConversation;
|
||||
QuestConversation conv = Construct(type) as QuestConversation;
|
||||
|
||||
conv?.BaseDeserialize( reader );
|
||||
conv?.BaseDeserialize(reader);
|
||||
|
||||
return conv;
|
||||
}
|
||||
}
|
||||
}
|
||||
return conv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Serialize( Type[] referenceTable, QuestConversation conv, GenericWriter writer )
|
||||
{
|
||||
if ( conv == null )
|
||||
{
|
||||
writer.WriteEncodedInt( 0x00 );
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteEncodedInt( 0x01 );
|
||||
public static void Serialize(Type[] referenceTable, QuestConversation conv, GenericWriter writer)
|
||||
{
|
||||
if (conv == null)
|
||||
{
|
||||
writer.WriteEncodedInt(0x00);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteEncodedInt(0x01);
|
||||
|
||||
Write( conv.GetType(), referenceTable, writer );
|
||||
Write(conv.GetType(), referenceTable, writer);
|
||||
|
||||
conv.BaseSerialize( writer );
|
||||
}
|
||||
}
|
||||
}
|
||||
conv.BaseSerialize(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,41 +1,41 @@
|
|||
using System;
|
||||
using System.Xml;
|
||||
using Server.Regions;
|
||||
using Server.Mobiles;
|
||||
using Server.Regions;
|
||||
|
||||
namespace Server.Engines.Quests
|
||||
{
|
||||
public class CancelQuestRegion : BaseRegion
|
||||
{
|
||||
private Type m_Quest;
|
||||
public class CancelQuestRegion : BaseRegion
|
||||
{
|
||||
private Type m_Quest;
|
||||
|
||||
public Type Quest => m_Quest;
|
||||
public CancelQuestRegion(XmlElement xml, Map map, Region parent) : base(xml, map, parent)
|
||||
{
|
||||
ReadType(xml["quest"], "type", ref m_Quest);
|
||||
}
|
||||
|
||||
public CancelQuestRegion( XmlElement xml, Map map, Region parent ) : base( xml, map, parent )
|
||||
{
|
||||
ReadType( xml["quest"], "type", ref m_Quest );
|
||||
}
|
||||
public Type Quest => m_Quest;
|
||||
|
||||
public override bool OnMoveInto( Mobile m, Direction d, Point3D newLocation, Point3D oldLocation )
|
||||
{
|
||||
if ( !base.OnMoveInto ( m, d, newLocation, oldLocation ) )
|
||||
return false;
|
||||
public override bool OnMoveInto(Mobile m, Direction d, Point3D newLocation, Point3D oldLocation)
|
||||
{
|
||||
if (!base.OnMoveInto(m, d, newLocation, oldLocation))
|
||||
return false;
|
||||
|
||||
if ( m.AccessLevel > AccessLevel.Player )
|
||||
return true;
|
||||
if (m.AccessLevel > AccessLevel.Player)
|
||||
return true;
|
||||
|
||||
if ( m_Quest == null )
|
||||
return true;
|
||||
if (m_Quest == null)
|
||||
return true;
|
||||
|
||||
if ( m is PlayerMobile player && player.Quest != null && player.Quest.GetType() == m_Quest )
|
||||
{
|
||||
if ( !player.HasGump( typeof( QuestCancelGump ) ) )
|
||||
player.Quest.BeginCancelQuest();
|
||||
if (m is PlayerMobile player && player.Quest != null && player.Quest.GetType() == m_Quest)
|
||||
{
|
||||
if (!player.HasGump(typeof(QuestCancelGump)))
|
||||
player.Quest.BeginCancelQuest();
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,40 +1,38 @@
|
|||
using System;
|
||||
using System.Xml;
|
||||
using Server.Regions;
|
||||
using Server.Mobiles;
|
||||
using Server.Regions;
|
||||
|
||||
namespace Server.Engines.Quests
|
||||
{
|
||||
public class QuestCompleteObjectiveRegion : BaseRegion
|
||||
{
|
||||
private Type m_Quest;
|
||||
private Type m_Objective;
|
||||
public class QuestCompleteObjectiveRegion : BaseRegion
|
||||
{
|
||||
private Type m_Objective;
|
||||
private Type m_Quest;
|
||||
|
||||
public Type Quest => m_Quest;
|
||||
public Type Objective => m_Objective;
|
||||
public QuestCompleteObjectiveRegion(XmlElement xml, Map map, Region parent) : base(xml, map, parent)
|
||||
{
|
||||
XmlElement questEl = xml["quest"];
|
||||
|
||||
public QuestCompleteObjectiveRegion( XmlElement xml, Map map, Region parent ) : base( xml, map, parent )
|
||||
{
|
||||
XmlElement questEl = xml["quest"];
|
||||
ReadType(questEl, "type", ref m_Quest);
|
||||
ReadType(questEl, "complete", ref m_Objective);
|
||||
}
|
||||
|
||||
ReadType( questEl, "type", ref m_Quest );
|
||||
ReadType( questEl, "complete", ref m_Objective );
|
||||
}
|
||||
public Type Quest => m_Quest;
|
||||
public Type Objective => m_Objective;
|
||||
|
||||
public override void OnEnter( Mobile m )
|
||||
{
|
||||
base.OnEnter( m );
|
||||
public override void OnEnter(Mobile m)
|
||||
{
|
||||
base.OnEnter(m);
|
||||
|
||||
if ( m_Quest != null && m_Objective != null )
|
||||
{
|
||||
if ( m is PlayerMobile player && player.Quest != null && player.Quest.GetType() == m_Quest )
|
||||
{
|
||||
QuestObjective obj = player.Quest.FindObjective( m_Objective );
|
||||
if (m_Quest != null && m_Objective != null)
|
||||
if (m is PlayerMobile player && player.Quest != null && player.Quest.GetType() == m_Quest)
|
||||
{
|
||||
QuestObjective obj = player.Quest.FindObjective(m_Objective);
|
||||
|
||||
if ( obj != null && !obj.Completed )
|
||||
obj.Complete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (obj != null && !obj.Completed)
|
||||
obj.Complete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,57 +1,55 @@
|
|||
using System;
|
||||
using System.Xml;
|
||||
using Server.Regions;
|
||||
using Server.Mobiles;
|
||||
using Server.Regions;
|
||||
|
||||
namespace Server.Engines.Quests
|
||||
{
|
||||
public class QuestNoEntryRegion : BaseRegion
|
||||
{
|
||||
private Type m_Quest;
|
||||
private Type m_MinObjective;
|
||||
private Type m_MaxObjective;
|
||||
private int m_Message;
|
||||
public class QuestNoEntryRegion : BaseRegion
|
||||
{
|
||||
private Type m_MaxObjective;
|
||||
private int m_Message;
|
||||
private Type m_MinObjective;
|
||||
private Type m_Quest;
|
||||
|
||||
public Type Quest => m_Quest;
|
||||
public Type MinObjective => m_MinObjective;
|
||||
public Type MaxObjective => m_MaxObjective;
|
||||
public int Message => m_Message;
|
||||
public QuestNoEntryRegion(XmlElement xml, Map map, Region parent) : base(xml, map, parent)
|
||||
{
|
||||
XmlElement questEl = xml["quest"];
|
||||
|
||||
public QuestNoEntryRegion( XmlElement xml, Map map, Region parent ) : base( xml, map, parent )
|
||||
{
|
||||
XmlElement questEl = xml["quest"];
|
||||
ReadType(questEl, "type", ref m_Quest);
|
||||
ReadType(questEl, "min", ref m_MinObjective, false);
|
||||
ReadType(questEl, "max", ref m_MaxObjective, false);
|
||||
ReadInt32(questEl, "message", ref m_Message, false);
|
||||
}
|
||||
|
||||
ReadType( questEl, "type", ref m_Quest );
|
||||
ReadType( questEl, "min", ref m_MinObjective, false );
|
||||
ReadType( questEl, "max", ref m_MaxObjective, false );
|
||||
ReadInt32( questEl, "message", ref m_Message, false );
|
||||
}
|
||||
public Type Quest => m_Quest;
|
||||
public Type MinObjective => m_MinObjective;
|
||||
public Type MaxObjective => m_MaxObjective;
|
||||
public int Message => m_Message;
|
||||
|
||||
public override bool OnMoveInto( Mobile m, Direction d, Point3D newLocation, Point3D oldLocation )
|
||||
{
|
||||
if ( !base.OnMoveInto ( m, d, newLocation, oldLocation ) )
|
||||
return false;
|
||||
public override bool OnMoveInto(Mobile m, Direction d, Point3D newLocation, Point3D oldLocation)
|
||||
{
|
||||
if (!base.OnMoveInto(m, d, newLocation, oldLocation))
|
||||
return false;
|
||||
|
||||
if ( m.AccessLevel > AccessLevel.Player )
|
||||
return true;
|
||||
if (m.AccessLevel > AccessLevel.Player)
|
||||
return true;
|
||||
|
||||
if ( m is BaseCreature bc && !bc.Controlled && !bc.Summoned )
|
||||
return true;
|
||||
if (m is BaseCreature bc && !bc.Controlled && !bc.Summoned)
|
||||
return true;
|
||||
|
||||
if ( m_Quest == null )
|
||||
return true;
|
||||
if (m_Quest == null)
|
||||
return true;
|
||||
|
||||
if ( m is PlayerMobile player && player.Quest != null && player.Quest.GetType() == m_Quest
|
||||
&& ( m_MinObjective == null || player.Quest.FindObjective( m_MinObjective ) != null )
|
||||
&& ( m_MaxObjective == null || player.Quest.FindObjective( m_MaxObjective ) == null ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (m is PlayerMobile player && player.Quest != null && player.Quest.GetType() == m_Quest
|
||||
&& (m_MinObjective == null || player.Quest.FindObjective(m_MinObjective) != null)
|
||||
&& (m_MaxObjective == null || player.Quest.FindObjective(m_MaxObjective) == null))
|
||||
return true;
|
||||
|
||||
if ( m_Message != 0 )
|
||||
m.SendLocalizedMessage( m_Message );
|
||||
if (m_Message != 0)
|
||||
m.SendLocalizedMessage(m_Message);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,40 +1,38 @@
|
|||
using System;
|
||||
using System.Xml;
|
||||
using Server.Regions;
|
||||
using Server.Mobiles;
|
||||
using Server.Regions;
|
||||
|
||||
namespace Server.Engines.Quests
|
||||
{
|
||||
public class QuestOfferRegion : BaseRegion
|
||||
{
|
||||
private Type m_Quest;
|
||||
public class QuestOfferRegion : BaseRegion
|
||||
{
|
||||
private Type m_Quest;
|
||||
|
||||
public Type Quest => m_Quest;
|
||||
public QuestOfferRegion(XmlElement xml, Map map, Region parent) : base(xml, map, parent)
|
||||
{
|
||||
ReadType(xml["quest"], "type", ref m_Quest);
|
||||
}
|
||||
|
||||
public QuestOfferRegion( XmlElement xml, Map map, Region parent ) : base( xml, map, parent )
|
||||
{
|
||||
ReadType( xml["quest"], "type", ref m_Quest );
|
||||
}
|
||||
public Type Quest => m_Quest;
|
||||
|
||||
public override void OnEnter( Mobile m )
|
||||
{
|
||||
base.OnEnter( m );
|
||||
public override void OnEnter(Mobile m)
|
||||
{
|
||||
base.OnEnter(m);
|
||||
|
||||
if ( m_Quest == null )
|
||||
return;
|
||||
if (m_Quest == null)
|
||||
return;
|
||||
|
||||
if ( m is PlayerMobile player && player.Quest == null && QuestSystem.CanOfferQuest( m, m_Quest ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
QuestSystem qs = (QuestSystem) Activator.CreateInstance( m_Quest, new object[] { player } );
|
||||
qs.SendOffer();
|
||||
}
|
||||
catch ( Exception ex )
|
||||
{
|
||||
Console.WriteLine( "Error creating quest {0}: {1}", m_Quest, ex );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m is PlayerMobile player && player.Quest == null && QuestSystem.CanOfferQuest(m, m_Quest))
|
||||
try
|
||||
{
|
||||
QuestSystem qs = (QuestSystem)Activator.CreateInstance(m_Quest, player);
|
||||
qs.SendOffer();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Error creating quest {0}: {1}", m_Quest, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue