using System; using Server; using Server.Gumps; using Server.Network; using Server.Mobiles; namespace Server.Items { public class VirtueTome : Item { public bool[] Unlocked = new bool[8]; [Constructable] public VirtueTome() : base( 0x22C3 ) { Name = "A Tome of Virtues"; Hue = 1174; Weight = 1.0; 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 ); 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) 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(); } } } } public class VirtueTomeGump : Gump { private PlayerMobile m_From; private VirtueTome m_Tome; private int m_TravelCost = 15; 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 ); // --- NEW MODERN BACKGROUND START --- AddBackground( 0, 0, 300, 420, 9270 ); // Dark semi-transparent border AddAlphaRegion( 10, 10, 280, 400 ); // Darkened center panel // --- NEW MODERN BACKGROUND END --- // Header Title AddLabel( 75, 15, 1153, "THE SHRINES OF VIRTUE" ); // Point Information AddLabel( 20, 45, 1152, String.Format( "Available Virtue Points: {0}", from.VirtuePoints ) ); AddLabel( 20, 70, 1152, String.Format( "Travel Cost: {0} Points", m_TravelCost ) ); int y = 110; string[] shrineNames = { "Compassion", "Honesty", "Honor", "Humility", "Justice", "Sacrifice", "Spirituality", "Valor" }; for ( int i = 0; i < shrineNames.Length; i++ ) { // Check if the shrine is unlocked if ( m_Tome.Unlocked[i] ) { AddButton( 20, y, 4005, 4006, i + 1, GumpButtonType.Reply, 0 ); AddLabel( 55, y, 1152, shrineNames[i] ); } else { // If locked, hide the button and grey out the text (Hue 922 is a nice soft grey) AddLabel( 55, y, 922, shrineNames[i] + " (Locked)" ); } y += 35; // Increased spacing slightly to fit the new button style } } public override void OnResponse( NetState sender, RelayInfo info ) { int button = info.ButtonID; if ( button >= 1 && button <= 8 ) { 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." ); m_From.MoveToWorld( m_Shrines[index], Map.Britannia ); 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." ); } } } } }