using System; using Server; using Server.Items; using Server.Network; using Server.Mobiles; namespace Server.Mobiles { public class LordBritish : BaseCreature { [Constructable] public LordBritish() : base( AIType.AI_Vendor, FightMode.None, 10, 1, 0.2, 0.4 ) { Name = "Lord British"; Title = "the Sovereign of Britannia"; Body = 400; HairItemID = 0x203B; HairHue = 0x44E; FacialHairItemID = 0x204B; FacialHairHue = 0x44E; Hue = 0x83EA; SpeechHue = 0x3B2; //Blessed = true; SetStr( 100 ); SetDex( 100 ); SetInt( 100 ); SetSkill( SkillName.MagicResist, 100.0 ); SetSkill( SkillName.Swords, 100.0 ); SetSkill( SkillName.Tactics, 100.0 ); Item chest = new PlateChest(); chest.Hue = 1150; AddItem( chest ); Item legs = new PlateLegs(); legs.Hue = 1150; AddItem( legs ); Item arms = new PlateArms(); arms.Hue = 1150; AddItem( arms ); Item gloves = new PlateGloves(); gloves.Hue = 1150; AddItem( gloves ); Item gorget = new PlateGorget(); gorget.Hue = 1150; AddItem( gorget ); Item cloak = new Cloak(); cloak.Hue = 32; AddItem( cloak ); AddItem( new ThighBoots() ); } public LordBritish( Serial serial ) : base( serial ) { } // 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; int instantBonus = 0; if ( pm.VirtueTomeCompleted ) instantBonus += 15; pm.StatCap = 200 + instantBonus; pm.AddToBackpack( new GoldDeed( 10000 ) ); pm.SendMessage( 63, "Lord British rewards you with 10,000 gold pieces and permanently increased your maximum stat cap to 215" ); 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 ); } public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); } } }