#W# Virtue Tome and Shrines fast travel system done.
This commit is contained in:
parent
d93e61a058
commit
897f9006a4
4 changed files with 382 additions and 13 deletions
|
|
@ -8,24 +8,54 @@ namespace Server.Items
|
|||
{
|
||||
public class VirtueTome : Item
|
||||
{
|
||||
public bool[] Unlocked = new bool[8];
|
||||
|
||||
[Constructable]
|
||||
public VirtueTome() : base( 0x2259 ) // Standard spellbook graphic
|
||||
public VirtueTome() : base( 0x22C3 )
|
||||
{
|
||||
Name = "A Tome of Virtues";
|
||||
Hue = 1174; // A nice bright gold/yellow hue
|
||||
Hue = 1174;
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Blessed; // So they don't lose their travel hub on death
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public VirtueTome( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override bool OnDragDrop( Mobile from, Item dropped )
|
||||
{
|
||||
if ( dropped is VirtueSigil )
|
||||
{
|
||||
VirtueSigil sigil = (VirtueSigil)dropped;
|
||||
int index = (int)sigil.Shrine;
|
||||
|
||||
if ( index >= 0 && index < 8 )
|
||||
{
|
||||
if ( Unlocked[index] )
|
||||
{
|
||||
from.SendMessage( 33, "This tome already holds the knowledge of that shrine." );
|
||||
}
|
||||
else
|
||||
{
|
||||
Unlocked[index] = true;
|
||||
from.SendMessage( 63, "The knowledge of the shrine has been bound to your tome!" );
|
||||
|
||||
from.PlaySound( 0x244 );
|
||||
dropped.Delete();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return base.OnDragDrop( from, dropped );
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
from.SendLocalizedMessage( 1042001 );
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -39,13 +69,26 @@ namespace Server.Items
|
|||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int) 0 ); // version
|
||||
writer.Write( (int) 1 );
|
||||
|
||||
for ( int i = 0; i < 8; i++ )
|
||||
{
|
||||
writer.Write( Unlocked[i] );
|
||||
}
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if ( version >= 1 )
|
||||
{
|
||||
for ( int i = 0; i < 8; i++ )
|
||||
{
|
||||
Unlocked[i] = reader.ReadBool();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -53,16 +96,15 @@ namespace Server.Items
|
|||
{
|
||||
private PlayerMobile m_From;
|
||||
private VirtueTome m_Tome;
|
||||
private int m_TravelCost = 15; // <--- SET YOUR VIRTUE POINT COST HERE
|
||||
private int m_TravelCost = 15;
|
||||
|
||||
// Standard Britannia Shrine Locations
|
||||
private Point3D[] m_Shrines = new Point3D[]
|
||||
{
|
||||
new Point3D( 2487, 1485, 0 ), // Compassion
|
||||
new Point3D( 4137, 1092, 0 ), // Honesty
|
||||
new Point3D( 1879, 2823, 1 ), // Honor
|
||||
new Point3D( 4130, 2999, 0 ), // Humility
|
||||
new Point3D( 1658, 547, 0 ), // Justice
|
||||
new Point3D( 1658, 547, 0 ), // Justice
|
||||
new Point3D( 3743, 931, 2 ), // Sacrifice
|
||||
new Point3D( 1010, 1849, 5 ), // Spirituality
|
||||
new Point3D( 1250, 3410, 1 ) // Valor
|
||||
|
|
@ -80,14 +122,22 @@ namespace Server.Items
|
|||
AddHtml( 10, 40, 280, 20, String.Format( "Available Virtue Points: {0}", from.VirtuePoints ), false, false );
|
||||
AddHtml( 10, 60, 280, 20, String.Format( "Travel Cost: {0} Points", m_TravelCost ), false, false );
|
||||
|
||||
// Shrine Buttons
|
||||
int y = 90;
|
||||
string[] shrineNames = { "Compassion", "Honesty", "Honor", "Humility", "Justice", "Sacrifice", "Spirituality", "Valor" };
|
||||
|
||||
for ( int i = 0; i < shrineNames.Length; i++ )
|
||||
{
|
||||
AddButton( 20, y, 4005, 4007, i + 1, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 55, y, 0, shrineNames[i] );
|
||||
// Check if the shrine is unlocked
|
||||
if ( m_Tome.Unlocked[i] )
|
||||
{
|
||||
AddButton( 20, y, 4005, 4007, i + 1, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 55, y, 0, shrineNames[i] );
|
||||
}
|
||||
else
|
||||
{
|
||||
// If locked, hide the button and grey out the text
|
||||
AddLabel( 55, y, 922, shrineNames[i] + " (Locked)" );
|
||||
}
|
||||
y += 30;
|
||||
}
|
||||
}
|
||||
|
|
@ -100,15 +150,16 @@ namespace Server.Items
|
|||
{
|
||||
int index = button - 1;
|
||||
|
||||
if ( !m_Tome.Unlocked[index] )
|
||||
return;
|
||||
|
||||
if ( m_From.VirtuePoints >= m_TravelCost )
|
||||
{
|
||||
m_From.VirtuePoints -= m_TravelCost;
|
||||
m_From.SendMessage( 63, "You channel your virtues to step through the ether." );
|
||||
|
||||
// Teleport the player
|
||||
m_From.MoveToWorld( m_Shrines[index], Map.Britannia );
|
||||
|
||||
// Play a cool spell effect and sound
|
||||
Effects.SendLocationParticles( EffectItem.Create( m_From.Location, m_From.Map, EffectItem.DefaultDuration ), 0x3728, 10, 10, 2023 );
|
||||
m_From.PlaySound( 0x1FE );
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue