From aed6cda934654e8c49452b0a07c65e2164c4ab8c Mon Sep 17 00:00:00 2001 From: WarrentyExpired Date: Wed, 22 Jul 2026 14:01:35 -0400 Subject: [PATCH] #W# Finsihed up Lord British giving the VitureTome quest. --- Scripts/Items/VirtueTomeBook.cs | 66 ++++++++++++++ Scripts/Mobiles/Base/PlayerMobile.cs | 20 ++++- Scripts/Mobiles/Towns/LordBritish.cs | 123 ++++++++++++++++++++++++--- 3 files changed, 193 insertions(+), 16 deletions(-) create mode 100644 Scripts/Items/VirtueTomeBook.cs diff --git a/Scripts/Items/VirtueTomeBook.cs b/Scripts/Items/VirtueTomeBook.cs new file mode 100644 index 0000000..0b405ac --- /dev/null +++ b/Scripts/Items/VirtueTomeBook.cs @@ -0,0 +1,66 @@ +using System; +using Server; + +namespace Server.Items +{ + public class VirtuousQuestBook : BlueBook + { + [Constructable] + public VirtuousQuestBook() : base( "The Virtuous Quest", "Lord British", 3, false ) // 3 pages, false means players can't edit it + { + Hue = 1150; // Makes the book a royal white/silver + + Pages[0].Lines = new string[] + { + "Brave adventurer,", + "", + "Britannia is vast, and", + "I need those who walk", + "the path of the Avatar.", + "", + "I have gifted you a", + "Tome of Virtues." + }; + + Pages[1].Lines = new string[] + { + "Seek out the eight", + "ancient shrines hidden", + "across the lands.", + "", + "Stand at their center", + "and speak the sacred", + "mantras to prove your", + "worth." + }; + + Pages[2].Lines = new string[] + { + "Once your tome has", + "absorbed the knowledge", + "of all eight shrines,", + "return the book to me.", + "", + "I shall reward you", + "handsomely.", + "- Lord British" + }; + } + + public VirtuousQuestBook( 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(); + } + } +} diff --git a/Scripts/Mobiles/Base/PlayerMobile.cs b/Scripts/Mobiles/Base/PlayerMobile.cs index a5bfea4..c6e385c 100644 --- a/Scripts/Mobiles/Base/PlayerMobile.cs +++ b/Scripts/Mobiles/Base/PlayerMobile.cs @@ -98,6 +98,7 @@ namespace Server.Mobiles private int m_QuestLevel; private string m_MapMarkers; private int m_VirtuePoints; + private bool m_VirtueTomeCompleted; #region Getters & Setters @@ -286,6 +287,13 @@ namespace Server.Mobiles set { m_VirtuePoints = value; } } + [CommandProperty( AccessLevel.GameMaster )] + public bool VirtueTomeCompleted + { + get { return m_VirtueTomeCompleted; } + set { m_VirtueTomeCompleted = value; } + } + #endregion #region Auto Arrow Recovery @@ -1834,6 +1842,11 @@ namespace Server.Mobiles switch ( version ) { + case 2: + { + m_VirtueTomeCompleted = reader.ReadBool(); + goto case 1; + } case 1: { m_VirtuePoints = reader.ReadInt(); @@ -1932,9 +1945,12 @@ namespace Server.Mobiles base.Serialize( writer ); - writer.Write( (int) 1 ); // version + writer.Write( (int) 2 ); // version + //Version 2 Additions + writer.Write( (bool) m_VirtueTomeCompleted ); + //Version 1 Additions writer.Write( (int) m_VirtuePoints ); - + //Vesion 0 (Original Data) writer.Write( (DateTime) m_PeacedUntil ); writer.Write( (DateTime) m_AnkhNextUse ); diff --git a/Scripts/Mobiles/Towns/LordBritish.cs b/Scripts/Mobiles/Towns/LordBritish.cs index fc2ab92..8811d06 100644 --- a/Scripts/Mobiles/Towns/LordBritish.cs +++ b/Scripts/Mobiles/Towns/LordBritish.cs @@ -1,6 +1,8 @@ using System; using Server; using Server.Items; +using Server.Network; +using Server.Mobiles; namespace Server.Mobiles { @@ -11,30 +13,24 @@ namespace Server.Mobiles { Name = "Lord British"; Title = "the Sovereign of Britannia"; - Body = 400; // Human Male body type + Body = 400; HairItemID = 0x203B; HairHue = 0x44E; FacialHairItemID = 0x204B; FacialHairHue = 0x44E; - Hue = 0x83EA; // Standard human skin tone - SpeechHue = 0x3B2; // Royal yellow/gold text when he speaks + Hue = 0x83EA; + SpeechHue = 0x3B2; - // Make him invulnerable (Set to false if you want players to try and kill him!) //Blessed = true; - // Base Stats SetStr( 100 ); SetDex( 100 ); SetInt( 100 ); - // Base Skills SetSkill( SkillName.MagicResist, 100.0 ); SetSkill( SkillName.Swords, 100.0 ); SetSkill( SkillName.Tactics, 100.0 ); - - - // Custom colored plate armor (1150 is a bright white/silver hue) Item chest = new PlateChest(); chest.Hue = 1150; AddItem( chest ); @@ -55,7 +51,6 @@ namespace Server.Mobiles gorget.Hue = 1150; AddItem( gorget ); - // A royal red cloak Item cloak = new Cloak(); cloak.Hue = 32; AddItem( cloak ); @@ -67,17 +62,117 @@ namespace Server.Mobiles { } - public override void Serialize( GenericWriter writer ) + // 1. Tell the engine he listens to players + public override bool HandlesOnSpeech( Mobile from ) + { + return true; + } + // 2. Handing out the quest + public override void OnSpeech( SpeechEventArgs e ) + { + if ( e.Handled || !e.Mobile.InRange( this.Location, 3 ) ) + return; + + PlayerMobile pm = e.Mobile as PlayerMobile; + if ( pm == null ) + return; + + string speech = e.Speech.ToLower(); + + if ( speech.Contains( "virtuous quest" ) ) + { + this.Direction = this.GetDirectionTo( pm ); + + // Check if they already finished the quest in the past + if ( pm.VirtueTomeCompleted ) + { + this.Say( "You have already proven your mastery of the virtues, Champion!" ); + e.Handled = true; + return; + } + + Item existingTome = pm.Backpack.FindItemByType( typeof(VirtueTome) ); + + if ( existingTome != null ) + { + this.Say( "You already carry the Tome of Virtues, my friend. Seek the shrines!" ); + } + else + { + this.Say( "Ah, a brave soul! Take these texts and begin your journey." ); + this.Animate( 32, 5, 1, true, false, 0 ); + + pm.AddToBackpack( new VirtueTome() ); + pm.AddToBackpack( new VirtuousQuestBook() ); + + pm.SendMessage( 63, "Lord British places a Tome of Virtues and a journal into your pack." ); + pm.PlaySound( 0x249 ); + } + + e.Handled = true; + } + } + + // 3. Turning in the completed quest + public override bool OnDragDrop( Mobile from, Item dropped ) + { + PlayerMobile pm = from as PlayerMobile; + + if ( pm != null && dropped is VirtueTome ) + { + VirtueTome tome = (VirtueTome)dropped; + + // Check the PLAYER'S completion status, not the book's + if ( pm.VirtueTomeCompleted ) + { + this.Say( "You have already been rewarded for your virtuous deeds!" ); + return false; + } + + bool isComplete = true; + for ( int i = 0; i < 8; i++ ) + { + if ( !tome.Unlocked[i] ) + { + isComplete = false; + break; + } + } + + if ( isComplete ) + { + this.Say( "Astounding! You have mastered all eight virtues!" ); + this.Animate( 17, 5, 1, true, false, 0 ); + + // Flag the player as having completed the quest forever + pm.VirtueTomeCompleted = true; + + pm.AddToBackpack( new Gold( 5000 ) ); + pm.SendMessage( 63, "Lord British rewards you with 5,000 gold pieces!" ); + pm.PlaySound( 0x2E6 ); + + pm.AddToBackpack( tome ); + return true; + } + else + { + this.Say( "This tome is not yet complete. You must visit all eight shrines." ); + return false; + } + } + + return base.OnDragDrop( from, dropped ); + } + + public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); - - writer.Write( (int) 0 ); // version + writer.Write( (int) 0 ); } public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); - int version = reader.ReadInt(); } }