#W# Source and Scripts added. Added Scripts/Settings.cs to expose some basic tweak able settings.
This commit is contained in:
parent
b51c58f514
commit
3045c83799
3512 changed files with 627673 additions and 0 deletions
70
Scripts/Engines/Quests/Core/Items/DynamicTeleporter.cs
Normal file
70
Scripts/Engines/Quests/Core/Items/DynamicTeleporter.cs
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.Quests
|
||||
{
|
||||
public abstract class DynamicTeleporter : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1049382; } } // a magical teleporter
|
||||
|
||||
public DynamicTeleporter() : this( 0x1822, 0x482 )
|
||||
{
|
||||
}
|
||||
|
||||
public DynamicTeleporter( int itemID, int hue ) : base( itemID )
|
||||
{
|
||||
Movable = false;
|
||||
Hue = hue;
|
||||
}
|
||||
|
||||
public abstract bool GetDestination( PlayerMobile player, ref Point3D loc, ref Map map );
|
||||
|
||||
public virtual int NotWorkingMessage{ get{ return 500309; } } // Nothing Happens.
|
||||
|
||||
public override bool OnMoveOver( Mobile m )
|
||||
{
|
||||
PlayerMobile pm = m as PlayerMobile;
|
||||
|
||||
if ( pm != null )
|
||||
{
|
||||
Point3D loc = Point3D.Zero;
|
||||
Map map = null;
|
||||
|
||||
if ( GetDestination( pm, ref loc, ref map ) )
|
||||
{
|
||||
BaseCreature.TeleportPets( pm, loc, map );
|
||||
|
||||
pm.PlaySound( 0x1FE );
|
||||
pm.MoveToWorld( loc, map );
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
pm.SendLocalizedMessage( this.NotWorkingMessage );
|
||||
}
|
||||
}
|
||||
|
||||
return base.OnMoveOver( m );
|
||||
}
|
||||
|
||||
public DynamicTeleporter( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
193
Scripts/Engines/Quests/Core/Items/EnchantedSextant.cs
Normal file
193
Scripts/Engines/Quests/Core/Items/EnchantedSextant.cs
Normal file
|
|
@ -0,0 +1,193 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class EnchantedSextant : Item
|
||||
{
|
||||
//TODO: Trammel/Haven
|
||||
private static readonly Point2D[] m_TrammelBanks = new Point2D[]
|
||||
{
|
||||
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_FeluccaBanks = new Point2D[]
|
||||
{
|
||||
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 static readonly Point2D[] m_IlshenarBanks = new Point2D[]
|
||||
{
|
||||
new Point2D( 854, 680 ),
|
||||
new Point2D( 855, 603 ),
|
||||
new Point2D( 1226, 554 ),
|
||||
new Point2D( 1610, 556 )
|
||||
};
|
||||
|
||||
private static readonly Point2D[] m_MalasBanks = new Point2D[]
|
||||
{
|
||||
new Point2D( 996, 519 ),
|
||||
new Point2D( 2048, 1345 )
|
||||
};
|
||||
|
||||
private const double m_LongDistance = 300.0;
|
||||
private const double m_ShortDistance = 5.0;
|
||||
|
||||
public override int LabelNumber { get { return 1046226; } } // an enchanted sextant
|
||||
|
||||
[Constructable]
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
#endif
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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 );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
206
Scripts/Engines/Quests/Core/Items/HornOfRetreat.cs
Normal file
206
Scripts/Engines/Quests/Core/Items/HornOfRetreat.cs
Normal file
|
|
@ -0,0 +1,206 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Engines.Quests;
|
||||
using Server.Engines.Quests.Necro;
|
||||
|
||||
namespace Server.Engines.Quests
|
||||
{
|
||||
public class HornOfRetreat : Item
|
||||
{
|
||||
private Point3D m_DestLoc;
|
||||
private Map m_DestMap;
|
||||
private int m_Charges;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D DestLoc
|
||||
{
|
||||
get{ return m_DestLoc; }
|
||||
set{ m_DestLoc = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Map DestMap
|
||||
{
|
||||
get{ return m_DestMap; }
|
||||
set{ m_DestMap = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Charges
|
||||
{
|
||||
get{ return m_Charges; }
|
||||
set{ m_Charges = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return 1049117; } } // Horn of Retreat
|
||||
|
||||
[Constructable]
|
||||
public HornOfRetreat() : base( 0xFC4 )
|
||||
{
|
||||
Hue = 0x482;
|
||||
Weight = 1.0;
|
||||
Charges = 10;
|
||||
}
|
||||
|
||||
public virtual bool ValidateUse( Mobile from )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
list.Add( 1060741, m_Charges.ToString() ); // charges: ~1_val~
|
||||
}
|
||||
|
||||
private Timer m_PlayTimer;
|
||||
|
||||
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...
|
||||
|
||||
--Charges;
|
||||
|
||||
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.
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void PlayTimer_Callback( object state )
|
||||
{
|
||||
Mobile from = (Mobile)state;
|
||||
|
||||
m_PlayTimer = null;
|
||||
|
||||
HornOfRetreatMoongate gate = new HornOfRetreatMoongate( this.DestLoc, this.DestMap, from, this.Hue );
|
||||
|
||||
gate.MoveToWorld( from.Location, from.Map );
|
||||
|
||||
from.PlaySound( 0x20E );
|
||||
|
||||
gate.SendLocalizedMessageTo( from, 1049102, from.Name ); // Quickly ~1_NAME~! Onward through the gate!
|
||||
}
|
||||
|
||||
public HornOfRetreat( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( m_DestLoc );
|
||||
writer.Write( m_DestMap );
|
||||
writer.Write( m_Charges );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_DestLoc = reader.ReadPoint3D();
|
||||
m_DestMap = reader.ReadMap();
|
||||
m_Charges = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class HornOfRetreatMoongate : Moongate
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1049114; } } // Sanctuary Gate
|
||||
|
||||
private Mobile m_Caster;
|
||||
|
||||
public HornOfRetreatMoongate( Point3D destLoc, Map destMap, Mobile caster, int hue )
|
||||
{
|
||||
m_Caster = caster;
|
||||
|
||||
Target = destLoc;
|
||||
TargetMap = destMap;
|
||||
|
||||
Hue = hue;
|
||||
Light = LightType.Circle300;
|
||||
|
||||
Dispellable = false;
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 10.0 ), new TimerCallback( Delete ) );
|
||||
}
|
||||
|
||||
public override void BeginConfirmation( Mobile from )
|
||||
{
|
||||
EndConfirmation( from );
|
||||
}
|
||||
|
||||
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 HornOfRetreatMoongate( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
121
Scripts/Engines/Quests/Core/Items/QuestItem.cs
Normal file
121
Scripts/Engines/Quests/Core/Items/QuestItem.cs
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.Quests
|
||||
{
|
||||
public abstract class QuestItem : Item
|
||||
{
|
||||
public QuestItem( int itemID ) : base( itemID )
|
||||
{
|
||||
}
|
||||
|
||||
public QuestItem( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public abstract bool CanDrop( PlayerMobile pm );
|
||||
|
||||
public virtual bool Accepted { get { return Deleted; } }
|
||||
|
||||
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;
|
||||
}
|
||||
else if ( !(from is PlayerMobile) || CanDrop( (PlayerMobile)from ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
else if ( !(from is PlayerMobile) || CanDrop( (PlayerMobile)from ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1049344 ); // You decide against trading the item. You still need it for your quest.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
else if ( !(from is PlayerMobile) || CanDrop( (PlayerMobile)from ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
public override DeathMoveResult OnParentDeath( Mobile parent )
|
||||
{
|
||||
if ( parent is PlayerMobile && !CanDrop( (PlayerMobile)parent ) )
|
||||
return DeathMoveResult.MoveToBackpack;
|
||||
else
|
||||
return base.OnParentDeath( parent );
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue