using System; using Server; using Server.Gumps; using Server.Network; using Server.Mobiles; namespace Server.Items { public class VirtueTome : Item { [Constructable] public VirtueTome() : base( 0x2259 ) // Standard spellbook graphic { Name = "A Tome of Virtues"; Hue = 1174; // A nice bright gold/yellow hue Weight = 1.0; LootType = LootType.Blessed; // So they don't lose their travel hub on death } public VirtueTome( Serial serial ) : base( serial ) { } public override void OnDoubleClick( Mobile from ) { if ( !IsChildOf( from.Backpack ) ) { from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it. return; } if ( from is PlayerMobile ) { from.CloseGump( typeof( VirtueTomeGump ) ); from.SendGump( new VirtueTomeGump( (PlayerMobile)from, this ) ); } } 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(); } } public class VirtueTomeGump : Gump { private PlayerMobile m_From; private VirtueTome m_Tome; private int m_TravelCost = 15; // <--- SET YOUR VIRTUE POINT COST HERE // 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( 3743, 931, 2 ), // Sacrifice new Point3D( 1010, 1849, 5 ), // Spirituality new Point3D( 1250, 3410, 1 ) // Valor }; public VirtueTomeGump( PlayerMobile from, VirtueTome tome ) : base( 50, 50 ) { m_From = from; m_Tome = tome; AddPage( 0 ); AddBackground( 0, 0, 300, 380, 5054 ); AddHtml( 10, 10, 280, 20, "
The Shrines of Virtue
", false, false ); 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] ); y += 30; } } public override void OnResponse( NetState sender, RelayInfo info ) { int button = info.ButtonID; if ( button >= 1 && button <= 8 ) { int index = button - 1; 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 ); } else { m_From.SendMessage( 33, "You do not have enough Virtue Points to travel." ); } } } } }