diff --git a/Scripts/Context Menus/AddToParty.cs b/Scripts/Context Menus/AddToParty.cs new file mode 100644 index 000000000..89735d351 --- /dev/null +++ b/Scripts/Context Menus/AddToParty.cs @@ -0,0 +1,23 @@ +using System; +using Server.Mobiles; +using Server.Engines.PartySystem; + +namespace Server.ContextMenus +{ + public class AddToPartyEntry : ContextMenuEntry + { + private Mobile m_From; + private Mobile m_Target; + + public AddToPartyEntry( Mobile from, Mobile target ) : base( 0197, 12 ) + { + m_From = from; + m_Target = target; + } + + public override void OnClick() + { + Party.Invite( m_From, m_Target ); + } + } +} diff --git a/Scripts/Context Menus/EjectPlayer.cs b/Scripts/Context Menus/EjectPlayer.cs new file mode 100644 index 000000000..bcbaec098 --- /dev/null +++ b/Scripts/Context Menus/EjectPlayer.cs @@ -0,0 +1,31 @@ +using System; +using Server.Mobiles; +using Server.Multis; + +namespace Server.ContextMenus +{ + public class EjectPlayerEntry : ContextMenuEntry + { + private Mobile m_From; + private Mobile m_Target; + private BaseHouse m_TargetHouse; + + public EjectPlayerEntry( Mobile from, Mobile target ) : base( 6206, 12 ) + { + m_From = from; + m_Target = target; + m_TargetHouse = BaseHouse.FindHouseAt( m_Target ); + } + + public override void OnClick() + { + if ( !m_From.Alive || m_TargetHouse.Deleted || !m_TargetHouse.IsFriend( m_From ) ) + return; + + if ( m_Target is Mobile ) + { + m_TargetHouse.Kick( m_From, (Mobile)m_Target ); + } + } + } +} diff --git a/Scripts/Engines/CannedEvil/ChampionSpawn.cs b/Scripts/Engines/CannedEvil/ChampionSpawn.cs index 83150d005..0f91c6657 100644 --- a/Scripts/Engines/CannedEvil/ChampionSpawn.cs +++ b/Scripts/Engines/CannedEvil/ChampionSpawn.cs @@ -388,135 +388,74 @@ namespace Server.Engines.CannedEvil } #region Scroll of Transcendence - private ScrollofTranscendence CreateRandomTramSoT() + private ScrollofTranscendence CreateRandomSoT( bool felucca ) { - int level; - double random = Utility.RandomDouble(); - - if (0.2 >= random) - level = 5; - else if (0.4 >= random) - level = 4; - else if (0.6 >= random) - level = 3; - else if (0.8 >= random) - level = 2; - else - level = 1; + int level = Utility.RandomMinMax( 1, 5 ); + + if ( felucca ) + level += 5; return ScrollofTranscendence.CreateRandom(level, level); } + #endregion - private ScrollofTranscendence CreateRandomFelSoT() + public static void GiveScrollTo( Mobile killer, SpecialScroll scroll ) { - int level; - double random = Utility.RandomDouble(); - - if (0.2 >= random) - level = 10; - else if (0.4 >= random) - level = 9; - else if (0.6 >= random) - level = 8; - else if (0.8 >= random) - level = 7; - else - level = 6; - - return ScrollofTranscendence.CreateRandom(level, level); - } - - private PowerScroll CreateRandomFelPS() - { - return PowerScroll.CreateRandomNoCraft(5, 5); - } - - public static void GiveScrollOfTranscendenceFelTo ( Mobile killer, ScrollofTranscendence SoTF ) - { - if( SoTF == null || killer == null ) //sanity + if( scroll == null || killer == null ) //sanity return; - killer.SendLocalizedMessage( 1094936 ); // You have received a Scroll of Transcendence! + if ( scroll is ScrollofTranscendence ) + killer.SendLocalizedMessage( 1094936 ); // You have received a Scroll of Transcendence! + else + killer.SendLocalizedMessage( 1049524 ); // You have received a scroll of power! if ( killer.Alive ) - killer.AddToBackpack( SoTF ); + killer.AddToBackpack( scroll ); else { if( killer.Corpse != null && !killer.Corpse.Deleted ) - killer.Corpse.DropItem( SoTF ); + killer.Corpse.DropItem( scroll ); else - killer.AddToBackpack( SoTF ); + killer.AddToBackpack( scroll ); } - - + // Justice reward PlayerMobile pm = (PlayerMobile)killer; for (int j = 0; j < pm.JusticeProtectors.Count; ++j) { Mobile prot = (Mobile)pm.JusticeProtectors[j]; - if (prot.Map != killer.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(killer, prot)) - continue; - - int chance = 0; - - switch (VirtueHelper.GetLevel(prot, VirtueName.Justice)) - { - case VirtueLevel.Seeker: chance = 60; break; - case VirtueLevel.Follower: chance = 80; break; - case VirtueLevel.Knight: chance = 100; break; - } - - if (chance > Utility.Random(100)) - { - prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice! - ScrollofTranscendence SoTFduplicate = new ScrollofTranscendence ( SoTF.Skill, SoTF.Value ); - prot.AddToBackpack( SoTFduplicate ); - } - } - } - public static void GivePowerScrollFelTo ( Mobile killer, PowerScroll PS ) - { - if( PS == null || killer == null ) //sanity - return; - - killer.SendLocalizedMessage(1049524); // You have received a scroll of power! - - if ( killer.Alive ) - killer.AddToBackpack( PS ); - else - { - if( killer.Corpse != null && !killer.Corpse.Deleted ) - killer.Corpse.DropItem( PS ); - else - killer.AddToBackpack( PS ); - } - - // Justice reward - PlayerMobile pm = (PlayerMobile)killer; - for (int j = 0; j < pm.JusticeProtectors.Count; ++j) - { - Mobile prot = (Mobile)pm.JusticeProtectors[j]; - if (prot.Map != killer.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(killer, prot)) + + if ( prot.Map != killer.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion( killer, prot ) ) continue; int chance = 0; - switch (VirtueHelper.GetLevel(prot, VirtueName.Justice)) + switch ( VirtueHelper.GetLevel( prot, VirtueName.Justice ) ) { case VirtueLevel.Seeker: chance = 60; break; case VirtueLevel.Follower: chance = 80; break; case VirtueLevel.Knight: chance = 100; break; } - if (chance > Utility.Random(100)) + if ( chance > Utility.Random( 100 ) ) { - prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice! - PowerScroll PSduplicate = new PowerScroll ( PS.Skill, PS.Value ); - prot.AddToBackpack( PSduplicate ); + try + { + prot.SendLocalizedMessage( 1049368 ); // You have been rewarded for your dedication to Justice! + + SpecialScroll scrollDupe = Activator.CreateInstance( scroll.GetType() ) as SpecialScroll; + + if ( scrollDupe != null ) + { + scrollDupe.Skill = scroll.Skill; + scrollDupe.Value = scroll.Value; + prot.AddToBackpack( scrollDupe ); + } + } + catch{} } } } - #endregion public void OnSlice() { @@ -588,23 +527,23 @@ namespace Server.Engines.CannedEvil if ( random <= 24 ) { - ScrollofTranscendence SoTF = CreateRandomFelSoT(); - GiveScrollOfTranscendenceFelTo ( pm, SoTF ); + ScrollofTranscendence SoTF = CreateRandomSoT( true ); + GiveScrollTo( pm, (SpecialScroll)SoTF ); } else { - PowerScroll PS = CreateRandomFelPS(); - GivePowerScrollFelTo ( pm, PS ); + PowerScroll PS = PowerScroll.CreateRandomNoCraft(5, 5); + GiveScrollTo( pm, (SpecialScroll)PS ); } } } - if ( Map == Map.Ilshenar || Map == Map.Tokuno ) + if ( Map == Map.Ilshenar || Map == Map.Tokuno || Map == Map.Malas ) { if ( Utility.RandomDouble() < 0.0015 ) { killer.SendLocalizedMessage( 1094936 ); // You have received a Scroll of Transcendence! - ScrollofTranscendence SoTT = CreateRandomTramSoT(); + ScrollofTranscendence SoTT = CreateRandomSoT( false ); killer.AddToBackpack( SoTT ); } } diff --git a/Scripts/Engines/Craft/Core/CraftItem.cs b/Scripts/Engines/Craft/Core/CraftItem.cs index bb86833e0..acc38f500 100644 --- a/Scripts/Engines/Craft/Core/CraftItem.cs +++ b/Scripts/Engines/Craft/Core/CraftItem.cs @@ -295,7 +295,10 @@ namespace Server.Engines.Craft 0x184E, 0x1850, // Heating stand (right) 0x398C, 0x399F, // Fire field 0x2DDB, 0x2DDC, //Elven stove - 0x19AA, 0x19BB // Veteran Reward Brazier + 0x19AA, 0x19BB, // Veteran Reward Brazier + 0x197A, 0x19A9, // Large Forge + 0x0FB1, 0x0FB1, // Small Forge + 0x2DD8, 0x2DD8 // Elven Forge }; private static int[] m_Ovens = new int[] diff --git a/Scripts/Engines/Party/DeclineTimer.cs b/Scripts/Engines/Party/DeclineTimer.cs index 7bad8eff1..c4ac7bc35 100644 --- a/Scripts/Engines/Party/DeclineTimer.cs +++ b/Scripts/Engines/Party/DeclineTimer.cs @@ -21,7 +21,7 @@ namespace Server.Engines.PartySystem t.Start(); } - private DeclineTimer( Mobile m, Mobile leader ) : base( TimeSpan.FromSeconds( 10.0 ) ) + private DeclineTimer( Mobile m, Mobile leader ) : base( TimeSpan.FromSeconds( 30.0 ) ) { m_Mobile = m; m_Leader = leader; diff --git a/Scripts/Items/Special/Special Scrolls/PowerScroll.cs b/Scripts/Items/Special/Special Scrolls/PowerScroll.cs index 26162cc10..bf993766a 100644 --- a/Scripts/Items/Special/Special Scrolls/PowerScroll.cs +++ b/Scripts/Items/Special/Special Scrolls/PowerScroll.cs @@ -2,14 +2,35 @@ using System; using Server; using Server.Gumps; using Server.Network; +using System.Collections; +using System.Collections.Generic; namespace Server.Items { - public class PowerScroll : Item + public class PowerScroll : SpecialScroll { - private SkillName m_Skill; - private double m_Value; - + public override int Message { get { return 1049469; } } /* Using a scroll increases the maximum amount of a specific skill or your maximum statistics. + * When used, the effect is not immediately seen without a gain of points with that skill or statistics. + * You can view your maximum skill values in your skills window. + * You can view your maximum statistic value in your statistics window. */ + public override int Title + { + get + { + double level = ( Value - 105.0 ) / 5.0; + + if ( level >= 0.0 && level <= 3.0 && Value % 5.0 == 0.0 ) + return 1049635 + (int)level; /* Wonderous Scroll (105 Skill): OR + * Exalted Scroll (110 Skill): OR + * Mythical Scroll (115 Skill): OR + * Legendary Scroll (120 Skill): */ + + return 0; + } + } + + public override string DefaultTitle{ get{ return String.Format( "Power Scroll ({0} Skill):", Value ); } } + private static SkillName[] m_Skills = new SkillName[] { SkillName.Blacksmith, @@ -38,28 +59,6 @@ namespace Server.Items private static SkillName[] m_AOSSkills = new SkillName[] { - SkillName.Blacksmith, - SkillName.Tailoring, - SkillName.Swords, - SkillName.Fencing, - SkillName.Macing, - SkillName.Archery, - SkillName.Wrestling, - SkillName.Parry, - SkillName.Tactics, - SkillName.Anatomy, - SkillName.Healing, - SkillName.Magery, - SkillName.Meditation, - SkillName.EvalInt, - SkillName.MagicResist, - SkillName.AnimalTaming, - SkillName.AnimalLore, - SkillName.Veterinary, - SkillName.Musicianship, - SkillName.Provocation, - SkillName.Discordance, - SkillName.Peacemaking, SkillName.Chivalry, SkillName.Focus, SkillName.Necromancy, @@ -70,242 +69,132 @@ namespace Server.Items private static SkillName[] m_SESkills = new SkillName[] { - SkillName.Blacksmith, - SkillName.Tailoring, - SkillName.Swords, - SkillName.Fencing, - SkillName.Macing, - SkillName.Archery, - SkillName.Wrestling, - SkillName.Parry, - SkillName.Tactics, - SkillName.Anatomy, - SkillName.Healing, - SkillName.Magery, - SkillName.Meditation, - SkillName.EvalInt, - SkillName.MagicResist, - SkillName.AnimalTaming, - SkillName.AnimalLore, - SkillName.Veterinary, - SkillName.Musicianship, - SkillName.Provocation, - SkillName.Discordance, - SkillName.Peacemaking, - SkillName.Chivalry, - SkillName.Focus, - SkillName.Necromancy, - SkillName.Stealing, - SkillName.Stealth, - SkillName.SpiritSpeak, SkillName.Ninjitsu, SkillName.Bushido }; + + private static List _Skills = new List(); - private static SkillName[] m_MLSkills = new SkillName[] + public static List Skills + { + get { - SkillName.Blacksmith, - SkillName.Tailoring, - SkillName.Swords, - SkillName.Fencing, - SkillName.Macing, - SkillName.Archery, - SkillName.Wrestling, - SkillName.Parry, - SkillName.Tactics, - SkillName.Anatomy, - SkillName.Healing, - SkillName.Magery, - SkillName.Meditation, - SkillName.EvalInt, - SkillName.MagicResist, - SkillName.AnimalTaming, - SkillName.AnimalLore, - SkillName.Veterinary, - SkillName.Musicianship, - SkillName.Provocation, - SkillName.Discordance, - SkillName.Peacemaking, - SkillName.Chivalry, - SkillName.Focus, - SkillName.Necromancy, - SkillName.Stealing, - SkillName.Stealth, - SkillName.SpiritSpeak, - SkillName.Ninjitsu, - SkillName.Bushido, - SkillName.Spellweaving - }; - - public static SkillName[] Skills{ get{ return ( Core.ML ? m_MLSkills : Core.SE ? m_SESkills : Core.AOS ? m_AOSSkills : m_Skills ); } } + if ( _Skills.Count == 0 ) + { + switch ( Core.Expansion ) + { + case Expansion.ML: _Skills.Add( SkillName.Spellweaving ); goto case Expansion.SE; + case Expansion.SE: _Skills.AddRange( m_SESkills ); goto case Expansion.AOS; + case Expansion.AOS: _Skills.AddRange( m_AOSSkills ); goto default; + default: _Skills.AddRange( m_Skills ); break; + } + } + + return _Skills; + } + } public static PowerScroll CreateRandom( int min, int max ) { min /= 5; max /= 5; - - SkillName[] skills = PowerScroll.Skills; - - return new PowerScroll( skills[Utility.Random( skills.Length )], 100 + (Utility.RandomMinMax( min, max ) * 5)); + + return new PowerScroll( Skills[Utility.Random( Skills.Count )], 100 + ( Utility.RandomMinMax( min, max ) * 5 ) ); } public static PowerScroll CreateRandomNoCraft( int min, int max ) { min /= 5; max /= 5; - - SkillName[] skills = PowerScroll.Skills; + SkillName skillName; do { - skillName = skills[Utility.Random( skills.Length )]; + skillName = Skills[Utility.Random( Skills.Count )]; } while ( skillName == SkillName.Blacksmith || skillName == SkillName.Tailoring ); return new PowerScroll( skillName, 100 + (Utility.RandomMinMax( min, max ) * 5)); } - [Constructable] - public PowerScroll( SkillName skill, double value ) : base( 0x14F0 ) + public PowerScroll() : this( SkillName.Alchemy, 0.0 ) { - base.Hue = 0x481; - base.Weight = 1.0; - - m_Skill = skill; - m_Value = value; - if ( m_Value > 105.0 ) - LootType = LootType.Cursed; + } + + [Constructable] + public PowerScroll( SkillName skill, double value ) : base( skill, value ) + { + Hue = 0x481; + + if ( Value == 105.0 ) + LootType = LootType.Regular; } public PowerScroll( Serial serial ) : base( serial ) { } - - [CommandProperty( AccessLevel.GameMaster )] - public SkillName Skill + + public override void AddNameProperty( ObjectPropertyList list ) { - get - { - return m_Skill; - } - set - { - m_Skill = value; - } - } - - [CommandProperty( AccessLevel.GameMaster )] - public double Value - { - get - { - return m_Value; - } - set - { - m_Value = value; - } - } - - private string GetNameLocalized() - { - return String.Concat( "#", (1044060 + (int)m_Skill).ToString() ); - } - - private string GetName() - { - int index = (int)m_Skill; - SkillInfo[] table = SkillInfo.Table; - - if ( index >= 0 && index < table.Length ) - return table[index].Name.ToLower(); + double level = ( Value - 105.0 ) / 5.0; + + if ( level >= 0.0 && level <= 3.0 && Value % 5.0 == 0.0 ) + list.Add( 1049639 + (int)level, GetNameLocalized() ); /* a wonderous scroll of ~1_type~ (105 Skill) OR + * an exalted scroll of ~1_type~ (110 Skill) OR + * a mythical scroll of ~1_type~ (115 Skill) OR + * a legendary scroll of ~1_type~ (120 Skill) */ else - return "???"; - } - - public override void AddNameProperty(ObjectPropertyList list) - { - if ( m_Value == 105.0 ) - list.Add( 1049639, GetNameLocalized() ); // a wonderous scroll of ~1_type~ (105 Skill) - else if ( m_Value == 110.0 ) - list.Add( 1049640, GetNameLocalized() ); // an exalted scroll of ~1_type~ (110 Skill) - else if ( m_Value == 115.0 ) - list.Add( 1049641, GetNameLocalized() ); // a mythical scroll of ~1_type~ (115 Skill) - else if ( m_Value == 120.0 ) - list.Add( 1049642, GetNameLocalized() ); // a legendary scroll of ~1_type~ (120 Skill) - else - list.Add( "a power scroll of {0} ({1} Skill)", GetName(), m_Value ); + list.Add( "a power scroll of {0} ({1} Skill)", GetName(), Value ); } public override void OnSingleClick( Mobile from ) { - if ( m_Value == 105.0 ) - base.LabelTo( from, 1049639, GetNameLocalized() ); // a wonderous scroll of ~1_type~ (105 Skill) - else if ( m_Value == 110.0 ) - base.LabelTo( from, 1049640, GetNameLocalized() ); // an exalted scroll of ~1_type~ (110 Skill) - else if ( m_Value == 115.0 ) - base.LabelTo( from, 1049641, GetNameLocalized() ); // a mythical scroll of ~1_type~ (115 Skill) - else if ( m_Value == 120.0 ) - base.LabelTo( from, 1049642, GetNameLocalized() ); // a legendary scroll of ~1_type~ (120 Skill) + double level = ( Value - 105.0 ) / 5.0; + + if ( level >= 0.0 && level <= 3.0 && Value % 5.0 == 0.0 ) + base.LabelTo( from, 1049639 + (int)level, GetNameLocalized() ); else - base.LabelTo( from, "a power scroll of {0} ({1} Skill)", GetName(), m_Value ); + base.LabelTo( from, "a power scroll of {0} ({1} Skill)", GetName(), Value ); + } + + public override bool CanUse( Mobile from ) + { + if ( !base.CanUse( from ) ) + return false; + + Skill skill = from.Skills[Skill]; + + if ( skill == null ) + return false; + + if ( skill.Cap >= Value ) + { + from.SendLocalizedMessage( 1049511, GetNameLocalized() ); // Your ~1_type~ is too high for this power scroll. + return false; + } + + return true; } - public void Use( Mobile from, bool firstStage ) + public override void Use( Mobile from ) { - if ( Deleted ) + if ( !CanUse( from ) ) return; + + from.SendLocalizedMessage( 1049513, GetNameLocalized() ); // You feel a surge of magic as the scroll enhances your ~1_type~! - if ( IsChildOf( from.Backpack ) ) - { - Skill skill = from.Skills[m_Skill]; + from.Skills[Skill].Cap = Value; - if ( skill != null ) - { - if ( skill.Cap >= m_Value ) - { - from.SendLocalizedMessage( 1049511, GetNameLocalized() ); // Your ~1_type~ is too high for this power scroll. - } - else - { - if ( firstStage ) - { - from.CloseGump(typeof(StatCapScroll.InternalGump)); - from.CloseGump(typeof(PowerScroll.InternalGump)); - #region Scroll of Alacrity - from.CloseGump(typeof(ScrollofAlacrity.InternalGump)); - #endregion - from.SendGump(new InternalGump(from, this)); - } - else - { - from.SendLocalizedMessage( 1049513, GetNameLocalized() ); // You feel a surge of magic as the scroll enhances your ~1_type~! + Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0, 0, 0, 0, 0, 5060, 0 ); + Effects.PlaySound( from.Location, from.Map, 0x243 ); - skill.Cap = m_Value; + Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 6, from.Y - 6, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 ); + Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 4, from.Y - 6, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 ); + Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 6, from.Y - 4, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 ); - Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0, 0, 0, 0, 0, 5060, 0 ); - Effects.PlaySound( from.Location, from.Map, 0x243 ); + Effects.SendTargetParticles( from, 0x375A, 35, 90, 0x00, 0x00, 9502, (EffectLayer)255, 0x100 ); - Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 6, from.Y - 6, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 ); - Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 4, from.Y - 6, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 ); - Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 6, from.Y - 4, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 ); - - Effects.SendTargetParticles( from, 0x375A, 35, 90, 0x00, 0x00, 9502, (EffectLayer)255, 0x100 ); - - Delete(); - } - } - } - } - else - { - from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it. - } - } - - public override void OnDoubleClick( Mobile from ) - { - Use( from, true ); + Delete(); } public override void Serialize( GenericWriter writer ) @@ -313,92 +202,22 @@ namespace Server.Items base.Serialize( writer ); writer.Write( (int) 0 ); // version - - writer.Write( (int) m_Skill ); - writer.Write( (double) m_Value ); } public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); - int version = reader.ReadInt(); + int version = ( InheritsItem ? 0 : reader.ReadInt() ); //Required for SpecialScroll insertion - switch ( version ) - { - case 0: - { - m_Skill = (SkillName)reader.ReadInt(); - m_Value = reader.ReadDouble(); - - break; - } - } - - if ( m_Value == 105.0 ) + if ( Value == 105.0 ) { LootType = LootType.Regular; } else { LootType = LootType.Cursed; - - if ( Insured ) - Insured = false; - } - } - - public class InternalGump : Gump - { - private Mobile m_Mobile; - private PowerScroll m_Scroll; - - public InternalGump( Mobile mobile, PowerScroll scroll ) : base( 25, 50 ) - { - m_Mobile = mobile; - m_Scroll = scroll; - - AddPage( 0 ); - - AddBackground( 25, 10, 420, 200, 5054 ); - - AddImageTiled( 33, 20, 401, 181, 2624 ); - AddAlphaRegion( 33, 20, 401, 181 ); - - AddHtmlLocalized( 40, 48, 387, 100, 1049469, true, true ); /* Using a scroll increases the maximum amount of a specific skill or your maximum statistics. - * When used, the effect is not immediately seen without a gain of points with that skill or statistics. - * You can view your maximum skill values in your skills window. - * You can view your maximum statistic value in your statistics window. - */ - - AddHtmlLocalized( 125, 148, 200, 20, 1049478, 0xFFFFFF, false, false ); // Do you wish to use this scroll? - - AddButton( 100, 172, 4005, 4007, 1, GumpButtonType.Reply, 0 ); - AddHtmlLocalized( 135, 172, 120, 20, 1046362, 0xFFFFFF, false, false ); // Yes - - AddButton( 275, 172, 4005, 4007, 0, GumpButtonType.Reply, 0 ); - AddHtmlLocalized( 310, 172, 120, 20, 1046363, 0xFFFFFF, false, false ); // No - - double value = scroll.m_Value; - - if ( value == 105.0 ) - AddHtmlLocalized( 40, 20, 260, 20, 1049635, 0xFFFFFF, false, false ); // Wonderous Scroll (105 Skill): - else if ( value == 110.0 ) - AddHtmlLocalized( 40, 20, 260, 20, 1049636, 0xFFFFFF, false, false ); // Exalted Scroll (110 Skill): - else if ( value == 115.0 ) - AddHtmlLocalized( 40, 20, 260, 20, 1049637, 0xFFFFFF, false, false ); // Mythical Scroll (115 Skill): - else if ( value == 120.0 ) - AddHtmlLocalized( 40, 20, 260, 20, 1049638, 0xFFFFFF, false, false ); // Legendary Scroll (120 Skill): - else - AddHtml( 40, 20, 260, 20, String.Format( "Power Scroll ({0} Skill):", value ), false, false ); - - AddHtmlLocalized( 310, 20, 120, 20, 1044060 + (int)scroll.m_Skill, 0xFFFFFF, false, false ); - } - - public override void OnResponse( NetState state, RelayInfo info ) - { - if ( info.ButtonID == 1 ) - m_Scroll.Use( m_Mobile, false ); + Insured = false; } } } diff --git a/Scripts/Items/Special/Special Scrolls/ScrollofAlacrity.cs b/Scripts/Items/Special/Special Scrolls/ScrollofAlacrity.cs index fe7e1ce8a..6af1ff219 100644 --- a/Scripts/Items/Special/Special Scrolls/ScrollofAlacrity.cs +++ b/Scripts/Items/Special/Special Scrolls/ScrollofAlacrity.cs @@ -29,136 +29,51 @@ using System.Collections.Generic; namespace Server.Items { - public class ScrollofAlacrity : Item + public class ScrollofAlacrity : SpecialScroll { public override int LabelNumber { get { return 1078604; } } // Scroll of Alacrity + + public override int Message { get { return 1078602; } } /*Using a Scroll of Transcendence for a given skill will permanently increase your current + *level in that skill by the amount of points displayed on the scroll. + *As you may not gain skills beyond your maximum skill cap, any excess points will be lost.*/ + + public override string DefaultTitle { get { return String.Format( "Scroll of Alacrity:" ); } } - private SkillName m_Skill; - - private static SkillName[] m_Skills = new SkillName[] - { - SkillName.Alchemy, - SkillName.Anatomy, - SkillName.AnimalLore, - SkillName.ItemID, - SkillName.ArmsLore, - SkillName.Parry, - SkillName.Begging, - SkillName.Blacksmith, - SkillName.Fletching, - SkillName.Peacemaking, - SkillName.Camping, - SkillName.Carpentry, - SkillName.Cartography, - SkillName.Cooking, - SkillName.DetectHidden, - SkillName.Discordance, - SkillName.EvalInt, - SkillName.Healing, - SkillName.Fishing, - SkillName.Forensics, - SkillName.Herding, - SkillName.Hiding, - SkillName.Provocation, - SkillName.Inscribe, - SkillName.Lockpicking, - SkillName.Magery, - SkillName.MagicResist, - SkillName.Tactics, - SkillName.Snooping, - SkillName.Musicianship, - SkillName.Poisoning, - SkillName.Archery, - SkillName.SpiritSpeak, - SkillName.Stealing, - SkillName.Tailoring, - SkillName.AnimalTaming, - SkillName.TasteID, - SkillName.Tinkering, - SkillName.Tracking, - SkillName.Veterinary, - SkillName.Swords, - SkillName.Macing, - SkillName.Fencing, - SkillName.Wrestling, - SkillName.Lumberjacking, - SkillName.Mining, - SkillName.Meditation, - SkillName.Stealth, - SkillName.RemoveTrap, - SkillName.Necromancy, - SkillName.Focus, - SkillName.Chivalry, - SkillName.Bushido, - SkillName.Ninjitsu, - SkillName.Spellweaving - }; - - public static SkillName[] Skills { get { return (m_Skills); } } - + public ScrollofAlacrity() : this( SkillName.Alchemy ) + { + } + [Constructable] - public ScrollofAlacrity(SkillName skill) - : base(0x14EF) + public ScrollofAlacrity( SkillName skill ) : base( skill, 0.0 ) { - base.Hue = 0x4AB; - base.Weight = 1.0; - - LootType = LootType.Cursed; - - m_Skill = skill; + ItemID = 0x14EF; + Hue = 0x4AB; } - public ScrollofAlacrity(Serial serial) - : base(serial) + public ScrollofAlacrity(Serial serial) : base(serial) { } - [CommandProperty(AccessLevel.GameMaster)] - public SkillName Skill - { - get - { - return m_Skill; - } - set - { - m_Skill = value; - } - } - - private string GetNameLocalized() - { - return String.Concat("#", (1044060 + (int)m_Skill).ToString()); - } - - private string GetName() - { - int index = (int)m_Skill; - SkillInfo[] table = SkillInfo.Table; - - if (index >= 0 && index < table.Length) - return table[index].Name.ToLower(); - else - return "???"; - } - public override void GetProperties(ObjectPropertyList list) { base.GetProperties(list); - list.Add(1071345, "{0} 15 Minutes", GetName());// Skill: ~1_val~ + list.Add(1071345, "{0} 15 Minutes", GetName()); // Skill: ~1_val~ } - - public void Use(Mobile from, bool firstStage) + + public override bool CanUse( Mobile from ) { + if ( !base.CanUse( from ) ) + return false; + PlayerMobile pm = from as PlayerMobile; - - if (Deleted) - return; - - /* to add when skillgain quests will be implemented + + if ( pm == null ) + return false; #region Mondain's Legacy + /* to add when skillgain quests will be implemented + for (int i = pm.Quests.Count - 1; i >= 0; i--) { BaseQuest quest = pm.Quests[i]; @@ -170,65 +85,59 @@ namespace Server.Items if (objective is ApprenticeObjective) { from.SendMessage("You are already under the effect of an enhanced skillgain quest."); - return; + return false; } } } - #endregion + */ - - if (!IsChildOf(from.Backpack)) - { - from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. - } - - else if (pm.AcceleratedStart > DateTime.Now) + #endregion + + #region Scroll of Alacrity + if (pm.AcceleratedStart > DateTime.Now) { from.SendLocalizedMessage(1077951); // You are already under the effect of an accelerated skillgain scroll. + return false; + } + #endregion + + return true; + } + + public override void Use( Mobile from ) + { + if ( !CanUse( from ) ) + return; + + PlayerMobile pm = from as PlayerMobile; + + if ( pm == null ) + return; + + double tskill = from.Skills[Skill].Base; + double tcap = from.Skills[Skill].Cap; + + if ( tskill >= tcap || from.Skills[Skill].Lock != SkillLock.Up ) + { + from.SendLocalizedMessage( 1094935 ); /*You cannot increase this skill at this time. The skill may be locked or set to lower in your skill menu. + *If you are at your total skill cap, you must use a Powerscroll to increase your current skill cap.*/ return; } + + from.SendLocalizedMessage( 1077956 ); // You are infused with intense energy. You are under the effects of an accelerated skillgain scroll. + + Effects.PlaySound( from.Location, from.Map, 0x1E9 ); + Effects.SendTargetParticles( from, 0x373A, 35, 45, 0x00, 0x00, 9502, (EffectLayer)255, 0x100 ); - else - { - if (firstStage) - { - from.CloseGump(typeof(StatCapScroll.InternalGump)); - from.CloseGump(typeof(PowerScroll.InternalGump)); - from.CloseGump(typeof(ScrollofTranscendence.InternalGump)); - from.CloseGump(typeof(ScrollofAlacrity.InternalGump)); - from.SendGump(new InternalGump(from, this)); - } - else - { - double tskill = from.Skills[m_Skill].Base; - double tcap = from.Skills[m_Skill].Cap; + pm.AcceleratedStart = DateTime.Now + TimeSpan.FromMinutes(15); - if (tskill >= tcap || from.Skills[m_Skill].Lock == SkillLock.Locked || from.Skills[m_Skill].Lock == SkillLock.Down) - { - from.SendLocalizedMessage(1094935); /*You cannot increase this skill at this time. The skill may be locked or set to lower in your skill menu. - *If you are at your total skill cap, you must use a Powerscroll to increase your current skill cap.*/ - return; - } - else - { - Effects.PlaySound(from.Location, from.Map, 0x1E9); + Timer t = (Timer)m_Table[from]; - Effects.SendTargetParticles(from, 0x373A, 35, 45, 0x00, 0x00, 9502, (EffectLayer)255, 0x100); + m_Table[from] = Timer.DelayCall( TimeSpan.FromMinutes( 15 ), new TimerStateCallback( Expire_Callback ), from ); - from.SendLocalizedMessage(1077956); // You are infused with intense energy. You are under the effects of an accelerated skillgain scroll. + pm.AcceleratedSkill = Skill; - pm.AcceleratedStart = DateTime.Now + TimeSpan.FromMinutes(15); - - Timer t = (Timer)m_Table[from]; - - m_Table[from] = Timer.DelayCall(TimeSpan.FromMinutes(15), new TimerStateCallback(Expire_Callback), from); - - pm.AcceleratedSkill = m_Skill; - - Delete(); - } - } - } + Delete(); } private static Hashtable m_Table = new Hashtable(); @@ -244,81 +153,21 @@ namespace Server.Items m.SendLocalizedMessage(1077957);// The intense energy dissipates. You are no longer under the effects of an accelerated skillgain scroll. } - public override void OnDoubleClick(Mobile from) - { - Use(from, true); - } - public override void Serialize(GenericWriter writer) { base.Serialize(writer); writer.Write((int)0); // version - - writer.Write((int)m_Skill); } public override void Deserialize(GenericReader reader) { base.Deserialize(reader); - int version = reader.ReadInt(); - - switch (version) - { - case 0: - { - m_Skill = (SkillName)reader.ReadInt(); - break; - } - } + int version = ( InheritsItem ? 0 : reader.ReadInt() ); //Required for SpecialScroll insertion LootType = LootType.Cursed; - - if (Insured) - Insured = false; - } - - public class InternalGump : Gump - { - private Mobile m_Mobile; - private ScrollofAlacrity m_Scroll; - - public InternalGump(Mobile mobile, ScrollofAlacrity scroll) - : base(25, 50) - { - m_Mobile = mobile; - m_Scroll = scroll; - - AddPage(0); - - AddBackground(25, 10, 420, 200, 5054); - - AddImageTiled(33, 20, 401, 181, 2624); - AddAlphaRegion(33, 20, 401, 181); - - AddHtmlLocalized(40, 48, 387, 100, 1078602, true, true); /* Using a Scroll of Alacrity for a given skill will increase the amount of skillgain - * you receive for that skill. Once the Scroll of Alacrity duration has expired, - * skillgain will return to normal for that skill. */ - - AddHtmlLocalized(125, 148, 200, 20, 1049478, 0xFFFFFF, false, false); // Do you wish to use this scroll? - - AddButton(100, 172, 4005, 4007, 1, GumpButtonType.Reply, 0); - AddHtmlLocalized(135, 172, 120, 20, 1046362, 0xFFFFFF, false, false); // Yes - - AddButton(275, 172, 4005, 4007, 0, GumpButtonType.Reply, 0); - AddHtmlLocalized(310, 172, 120, 20, 1046363, 0xFFFFFF, false, false); // No - - AddHtml(40, 20, 260, 20, String.Format("Scroll of Alacrity:"), false, false); - - AddHtmlLocalized(310, 20, 120, 20, 1044060 + (int)scroll.m_Skill, 0xFFFFFF, false, false); - } - - public override void OnResponse(NetState state, RelayInfo info) - { - if (info.ButtonID == 1) - m_Scroll.Use(m_Mobile, false); - } + Insured = false; } } } diff --git a/Scripts/Items/Special/Special Scrolls/ScrollofTranscendence.cs b/Scripts/Items/Special/Special Scrolls/ScrollofTranscendence.cs index bfc121c9d..c31e8116e 100644 --- a/Scripts/Items/Special/Special Scrolls/ScrollofTranscendence.cs +++ b/Scripts/Items/Special/Special Scrolls/ScrollofTranscendence.cs @@ -7,164 +7,61 @@ using Server.Engines.Quests; namespace Server.Items { - public class ScrollofTranscendence : Item + public class ScrollofTranscendence : SpecialScroll { public override int LabelNumber { get { return 1094934; } } // Scroll of Transcendence + + public override int Message { get { return 1094933; } } /*Using a Scroll of Transcendence for a given skill will permanently increase your current + *level in that skill by the amount of points displayed on the scroll. + *As you may not gain skills beyond your maximum skill cap, any excess points will be lost.*/ + + public override string DefaultTitle { get { return String.Format( "Scroll of Transcendence ({0} Skill):", Value ); } } - private SkillName m_Skill; - private double m_Value; - - private static SkillName[] m_Skills = new SkillName[] - { - SkillName.Alchemy, - SkillName.Anatomy, - SkillName.AnimalLore, - SkillName.ItemID, - SkillName.ArmsLore, - SkillName.Parry, - SkillName.Begging, - SkillName.Blacksmith, - SkillName.Fletching, - SkillName.Peacemaking, - SkillName.Camping, - SkillName.Carpentry, - SkillName.Cartography, - SkillName.Cooking, - SkillName.DetectHidden, - SkillName.Discordance, - SkillName.EvalInt, - SkillName.Healing, - SkillName.Fishing, - SkillName.Forensics, - SkillName.Herding, - SkillName.Hiding, - SkillName.Provocation, - SkillName.Inscribe, - SkillName.Lockpicking, - SkillName.Magery, - SkillName.MagicResist, - SkillName.Tactics, - SkillName.Snooping, - SkillName.Musicianship, - SkillName.Poisoning, - SkillName.Archery, - SkillName.SpiritSpeak, - SkillName.Stealing, - SkillName.Tailoring, - SkillName.AnimalTaming, - SkillName.TasteID, - SkillName.Tinkering, - SkillName.Tracking, - SkillName.Veterinary, - SkillName.Swords, - SkillName.Macing, - SkillName.Fencing, - SkillName.Wrestling, - SkillName.Lumberjacking, - SkillName.Mining, - SkillName.Meditation, - SkillName.Stealth, - SkillName.RemoveTrap, - SkillName.Necromancy, - SkillName.Focus, - SkillName.Chivalry, - SkillName.Bushido, - SkillName.Ninjitsu, - SkillName.Spellweaving - }; - - public static SkillName[] Skills { get { return (m_Skills); } } - - public static ScrollofTranscendence CreateRandom(int min, int max) + public static ScrollofTranscendence CreateRandom( int min, int max ) { - min /= 1; - max /= 1; + SkillName skill = (SkillName)Utility.Random( SkillInfo.Table.Length ); - SkillName[] skills = ScrollofTranscendence.Skills; - - return new ScrollofTranscendence(skills[Utility.Random(skills.Length)], Utility.RandomMinMax(min, max) * 0.1); + return new ScrollofTranscendence(skill, Utility.RandomMinMax(min, max) * 0.1); } + public ScrollofTranscendence() : this( SkillName.Alchemy, 0.0 ) + { + } + [Constructable] - public ScrollofTranscendence(SkillName skill, double value) - : base(0x14EF) + public ScrollofTranscendence( SkillName skill, double value ) : base( skill, value ) { + ItemID = 0x14EF; Hue = 0x490; - Weight = 1.0; - - m_Skill = skill; - m_Value = value; - if (m_Value > 0.0) - LootType = LootType.Cursed; } - public ScrollofTranscendence(Serial serial) - : base(serial) + public ScrollofTranscendence(Serial serial) : base(serial) { } - [CommandProperty(AccessLevel.GameMaster)] - public SkillName Skill - { - get - { - return m_Skill; - } - set - { - m_Skill = value; - } - } - - [CommandProperty(AccessLevel.GameMaster)] - public double Value - { - get - { - return m_Value; - } - set - { - m_Value = value; - } - } - - private string GetNameLocalized() - { - return String.Concat("#", (1044060 + (int)m_Skill).ToString()); - } - - private string GetName() - { - int index = (int)m_Skill; - SkillInfo[] table = SkillInfo.Table; - - if (index >= 0 && index < table.Length) - return table[index].Name.ToLower(); - else - return "???"; - } - - public override void GetProperties(ObjectPropertyList list) + public override void GetProperties( ObjectPropertyList list ) { base.GetProperties(list); - if (m_Value == 1) - list.Add(1076759, "{0}\t{1}.0 Skill Points", GetName(), m_Value); + if ( Value == 1 ) + list.Add(1076759, "{0}\t{1}.0 Skill Points", GetName(), Value); else - list.Add(1076759, "{0}\t{1} Skill Points", GetName(), m_Value); + list.Add(1076759, "{0}\t{1} Skill Points", GetName(), Value); } - - public void Use(Mobile from, bool firstStage) + + public override bool CanUse( Mobile from ) { + if ( !base.CanUse( from ) ) + return false; + PlayerMobile pm = from as PlayerMobile; - - if (Deleted) - return; - - /* to uncomment when skillgain quests will be implementes + + if ( pm == null ) + return false; #region Mondain's Legacy + /* to add when skillgain quests will be implemented + for (int i = pm.Quests.Count - 1; i >= 0; i--) { BaseQuest quest = pm.Quests[i]; @@ -176,177 +73,93 @@ namespace Server.Items if (objective is ApprenticeObjective) { from.SendMessage("You are already under the effect of an enhanced skillgain quest."); - return; + return false; } } } - #endregion + */ - - if (!IsChildOf(from.Backpack)) - { - from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. - } + #endregion + #region Scroll of Alacrity - else if (pm.AcceleratedStart > DateTime.Now) + if (pm.AcceleratedStart > DateTime.Now) { from.SendLocalizedMessage(1077951); // You are already under the effect of an accelerated skillgain scroll. - return; + return false; } #endregion - else + + return true; + } + + public override void Use( Mobile from ) + { + if ( !CanUse( from ) ) + return; + + double tskill = from.Skills[Skill].Base; + double tcap = from.Skills[Skill].Cap; + bool canGain = false; + + double newValue = Value; + + if ( ( tskill + newValue ) > tcap ) + newValue = tcap - tskill; + + if ( tskill < tcap && from.Skills[Skill].Lock == SkillLock.Up ) { - if (firstStage) + if ( ( from.SkillsTotal + newValue * 10 ) > from.SkillsCap ) { - from.CloseGump(typeof(StatCapScroll.InternalGump)); - from.CloseGump(typeof(PowerScroll.InternalGump)); - from.CloseGump(typeof(ScrollofTranscendence.InternalGump)); - from.CloseGump(typeof(ScrollofAlacrity.InternalGump)); - from.SendGump(new InternalGump(from, this)); + for ( int i = 0; i <= 54; i++ ) + { + if ( from.Skills[i].Lock == SkillLock.Down && tskill >= newValue ) + { + from.Skills[i].Base -= newValue; + canGain = true; + break; + } + } } else - { - double tskill = from.Skills[m_Skill].Base; - double tcap = from.Skills[m_Skill].Cap; - bool canGain = true; - - if (tskill >= tcap || from.Skills[m_Skill].Lock == SkillLock.Locked || from.Skills[m_Skill].Lock == SkillLock.Down) - { - from.SendLocalizedMessage(1094935); /*You cannot increase this skill at this time. The skill may be locked or set to lower in your skill menu. - *If you are at your total skill cap, you must use a Powerscroll to increase your current skill cap.*/ - return; - } - - if ((tskill + m_Value) > tcap) - m_Value = tcap - tskill; - - if ((from.SkillsTotal + m_Value * 10) > from.SkillsCap) - { - canGain = false; - for (int i = 0; i <= 54; i++) - { - if (from.Skills[i].Lock == SkillLock.Down && from.Skills[i].Base >= m_Value) - { - from.Skills[i].Base = from.Skills[i].Base - m_Value; - canGain = true; - break; - } - } - - if (!canGain) - { - from.SendLocalizedMessage(1094935); /*You cannot increase this skill at this time. The skill may be locked or set to lower in your skill menu. - *If you are at your total skill cap, you must use a Powerscroll to increase your current skill cap.*/ - return; - } - } - - if (tskill + m_Value > tcap) - { - from.Skills[m_Skill].Base = tcap; - } - else - { - from.Skills[m_Skill].Base = tskill + m_Value; - } - - from.SendLocalizedMessage(1049513, GetNameLocalized()); // You feel a surge of magic as the scroll enhances your ~1_type~! - - Effects.PlaySound(from.Location, from.Map, 0x1F7); - - Effects.SendTargetParticles(from, 0x373A, 35, 45, 0x00, 0x00, 9502, (EffectLayer)255, 0x100); - Effects.SendTargetParticles(from, 0x376A, 35, 45, 0x00, 0x00, 9502, (EffectLayer)255, 0x100); - - Delete(); - } + canGain = true; + } + + if ( !canGain ) + { + from.SendLocalizedMessage( 1094935 ); /*You cannot increase this skill at this time. The skill may be locked or set to lower in your skill menu. + *If you are at your total skill cap, you must use a Powerscroll to increase your current skill cap.*/ + return; } - } - public override void OnDoubleClick(Mobile from) - { - Use(from, true); - } + from.SendLocalizedMessage( 1049513, GetNameLocalized() ); // You feel a surge of magic as the scroll enhances your ~1_type~! + + from.Skills[Skill].Base += newValue; - public override void Serialize(GenericWriter writer) + Effects.PlaySound( from.Location, from.Map, 0x1F7 ); + Effects.SendTargetParticles( from, 0x373A, 35, 45, 0x00, 0x00, 9502, (EffectLayer)255, 0x100 ); + Effects.SendTargetParticles( from, 0x376A, 35, 45, 0x00, 0x00, 9502, (EffectLayer)255, 0x100 ); + + Delete(); + } + + public override void Serialize( GenericWriter writer ) { base.Serialize(writer); writer.Write((int)0); // version - - writer.Write((int)m_Skill); - writer.Write((double)m_Value); } - public override void Deserialize(GenericReader reader) + public override void Deserialize( GenericReader reader ) { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? 0 : reader.ReadInt() ); //Required for SpecialScroll insertion - switch (version) - { - case 0: - { - m_Skill = (SkillName)reader.ReadInt(); - m_Value = reader.ReadDouble(); - break; - } - } - - if (m_Value >= 0.1) - { - LootType = LootType.Cursed; - - if (Insured) - Insured = false; - } + LootType = LootType.Cursed; + Insured = false; if (Hue == 0x7E) Hue = 0x490; } - - public class InternalGump : Gump - { - private Mobile m_Mobile; - private ScrollofTranscendence m_Scroll; - - public InternalGump(Mobile mobile, ScrollofTranscendence scroll) - : base(25, 50) - { - m_Mobile = mobile; - m_Scroll = scroll; - - AddPage(0); - - AddBackground(25, 10, 420, 200, 5054); - - AddImageTiled(33, 20, 401, 181, 2624); - AddAlphaRegion(33, 20, 401, 181); - - AddHtmlLocalized(40, 48, 387, 100, 1094933, true, true); /*Using a Scroll of Transcendence for a given skill will permanently increase your current - *level in that skill by the amount of points displayed on the scroll. - *As you may not gain skills beyond your maximum skill cap, any excess points will be lost.*/ - - AddHtmlLocalized(125, 148, 200, 20, 1049478, 0xFFFFFF, false, false); // Do you wish to use this scroll? - - AddButton(100, 172, 4005, 4007, 1, GumpButtonType.Reply, 0); - AddHtmlLocalized(135, 172, 120, 20, 1046362, 0xFFFFFF, false, false); // Yes - - AddButton(275, 172, 4005, 4007, 0, GumpButtonType.Reply, 0); - AddHtmlLocalized(310, 172, 120, 20, 1046363, 0xFFFFFF, false, false); // No - - double value = scroll.m_Value; - - AddHtml(40, 20, 260, 20, String.Format("Scroll of Transcendence ({0} Skill):", value), false, false); - - AddHtmlLocalized(310, 20, 120, 20, 1044060 + (int)scroll.m_Skill, 0xFFFFFF, false, false); - } - - public override void OnResponse(NetState state, RelayInfo info) - { - if (info.ButtonID == 1) - m_Scroll.Use(m_Mobile, false); - } - } } } diff --git a/Scripts/Items/Special/Special Scrolls/SpecialScroll.cs b/Scripts/Items/Special/Special Scrolls/SpecialScroll.cs new file mode 100644 index 000000000..82a3e15ea --- /dev/null +++ b/Scripts/Items/Special/Special Scrolls/SpecialScroll.cs @@ -0,0 +1,187 @@ +using System; +using Server; +using Server.Gumps; +using Server.Network; + +namespace Server.Items +{ + public abstract class SpecialScroll : Item + { + private SkillName m_Skill; + private double m_Value; + + #region Old Item Serialization Vars + /* DO NOT USE! Only used in serialization of special scrolls that originally derived from Item */ + private bool m_InheritsItem; + + protected bool InheritsItem + { + get{ return m_InheritsItem; } + } + #endregion + + public abstract int Message{ get; } + public virtual int Title{ get { return 0; } } + public abstract string DefaultTitle{ get; } + + public SpecialScroll( SkillName skill, double value ) : base( 0x14F0 ) + { + LootType = LootType.Cursed; + Weight = 1.0; + + m_Skill = skill; + m_Value = value; + } + + public SpecialScroll( Serial serial ) : base( serial ) + { + } + + [CommandProperty( AccessLevel.GameMaster )] + public SkillName Skill + { + get { return m_Skill; } + set { m_Skill = value; } + } + + [CommandProperty( AccessLevel.GameMaster )] + public double Value + { + get { return m_Value; } + set { m_Value = value; } + } + + public virtual string GetNameLocalized() + { + return String.Concat( "#", (1044060 + (int)m_Skill).ToString() ); + } + + public virtual string GetName() + { + int index = (int)m_Skill; + SkillInfo[] table = SkillInfo.Table; + + if ( index >= 0 && index < table.Length ) + return table[index].Name.ToLower(); + else + return "???"; + } + + public virtual bool CanUse( Mobile from ) + { + if ( Deleted ) + return false; + + if ( !IsChildOf( from.Backpack ) ) + { + from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. + return false; + } + + return true; + } + + public virtual void Use( Mobile from ) + { + } + + public override void OnDoubleClick( Mobile from ) + { + if ( !CanUse( from ) ) + return; + + from.CloseGump( typeof( SpecialScroll.InternalGump ) ); + from.SendGump( new InternalGump( from, this ) ); + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.Write( (int) 1 ); // version + + writer.Write( (int) m_Skill ); + writer.Write( (double) m_Value ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadInt(); + + switch ( version ) + { + case 1: + { + m_Skill = (SkillName)reader.ReadInt(); + m_Value = reader.ReadDouble(); + break; + } + case 0: + { + m_InheritsItem = true; + + if ( !(this is StatCapScroll) ) + m_Skill = (SkillName)reader.ReadInt(); + else + m_Skill = SkillName.Alchemy; + + if ( this is ScrollofAlacrity ) + m_Value = 0.0; + else if ( this is StatCapScroll ) + m_Value = (double)reader.ReadInt(); + else + m_Value = reader.ReadDouble(); + + break; + } + } + } + + public class InternalGump : Gump + { + private Mobile m_Mobile; + private SpecialScroll m_Scroll; + + public InternalGump( Mobile mobile, SpecialScroll scroll ) : base( 25, 50 ) + { + m_Mobile = mobile; + m_Scroll = scroll; + + AddPage( 0 ); + + AddBackground( 25, 10, 420, 200, 5054 ); + + AddImageTiled( 33, 20, 401, 181, 2624 ); + AddAlphaRegion( 33, 20, 401, 181 ); + + AddHtmlLocalized( 40, 48, 387, 100, m_Scroll.Message, true, true ); + + AddHtmlLocalized( 125, 148, 200, 20, 1049478, 0xFFFFFF, false, false ); // Do you wish to use this scroll? + + AddButton( 100, 172, 4005, 4007, 1, GumpButtonType.Reply, 0 ); + AddHtmlLocalized( 135, 172, 120, 20, 1046362, 0xFFFFFF, false, false ); // Yes + + AddButton( 275, 172, 4005, 4007, 0, GumpButtonType.Reply, 0 ); + AddHtmlLocalized( 310, 172, 120, 20, 1046363, 0xFFFFFF, false, false ); // No + + if ( m_Scroll.Title != 0 ) + AddHtmlLocalized( 40, 20, 260, 20, m_Scroll.Title, 0xFFFFFF, false, false ); + else + AddHtml( 40, 20, 260, 20, m_Scroll.DefaultTitle, false, false ); + + if ( m_Scroll is StatCapScroll ) + AddHtmlLocalized( 310, 20, 120, 20, 1038019, 0xFFFFFF, false, false ); // Power + else + AddHtmlLocalized( 310, 20, 120, 20, 1044060 + (int)m_Scroll.Skill, 0xFFFFFF, false, false ); + } + + public override void OnResponse( NetState state, RelayInfo info ) + { + if ( info.ButtonID == 1 ) + m_Scroll.Use( m_Mobile ); + } + } + } +} diff --git a/Scripts/Items/Special/Special Scrolls/StatScroll.cs b/Scripts/Items/Special/Special Scrolls/StatScroll.cs index fa7af7dca..1c164bc8b 100644 --- a/Scripts/Items/Special/Special Scrolls/StatScroll.cs +++ b/Scripts/Items/Special/Special Scrolls/StatScroll.cs @@ -6,28 +6,39 @@ using Server.Network; namespace Server.Items { - public class StatCapScroll : Item + public class StatCapScroll : SpecialScroll { - private int m_Value; - - [CommandProperty( AccessLevel.GameMaster )] - public int Value + public override int Message { get { return 1049469; } } /* Using a scroll increases the maximum amount of a specific skill or your maximum statistics. + * When used, the effect is not immediately seen without a gain of points with that skill or statistics. + * You can view your maximum skill values in your skills window. + * You can view your maximum statistic value in your statistics window. */ + public override int Title { get { - return m_Value; + int level = ( (int)Value - 230 ) / 5; + + if ( level >= 0 && level <= 4 && Value % 5 == 0 ) + return 1049458 + level; /* Wonderous Scroll (+5 Maximum Stats): OR + * Exalted Scroll (+10 Maximum Stats): OR + * Mythical Scroll (+15 Maximum Stats): OR + * Legendary Scroll (+20 Maximum Stats): OR + * Ultimate Scroll (+25 Maximum Stats): */ + + return 0; } } + + public override string DefaultTitle { get { return String.Format( "Power Scroll ({0}{1} Maximum Stats):", ( (int)Value - 225 ) >= 0 ? "+" : "", (int)Value - 225 ); } } + public StatCapScroll() : this( 105 ) + { + } + [Constructable] - public StatCapScroll( int value ) : base( 0x14F0 ) + public StatCapScroll( int value ) : base( SkillName.Alchemy, value ) { Hue = 0x481; - Weight = 1.0; - - LootType = LootType.Cursed; - - m_Value = value; } public StatCapScroll( Serial serial ) : base( serial ) @@ -36,92 +47,69 @@ namespace Server.Items public override void AddNameProperty(ObjectPropertyList list) { - if ( m_Value == 230 ) - list.Add( 1049463, "#1049476" ); // a wonderous scroll of ~1_type~ (+5 Maximum Stats) - else if ( m_Value == 235 ) - list.Add( 1049464, "#1049476" ); // an exalted scroll of ~1_type~ (+10 Maximum Stats) - else if ( m_Value == 240 ) - list.Add( 1049465, "#1049476" ); // a mythical scroll of ~1_type~ (+15 Maximum Stats) - else if ( m_Value == 245 ) - list.Add( 1049466, "#1049476" ); // a legendary scroll of ~1_type~ (+20 Maximum Stats) - else if ( m_Value == 250 ) - list.Add( 1049467, "#1049476" ); // an ultimate scroll of ~1_type~ (+25 Maximum Stats) + int level = ( (int)Value - 230 ) / 5; + + if ( level >= 0 && level <= 4 && (int)Value % 5 == 0 ) + list.Add( 1049463 + level, "#1049476" ); /* a wonderous scroll of ~1_type~ (+5 Maximum Stats) OR + * an exalted scroll of ~1_type~ (+10 Maximum Stats) OR + * a mythical scroll of ~1_type~ (+15 Maximum Stats) OR + * a legendary scroll of ~1_type~ (+20 Maximum Stats) OR + * an ultimate scroll of ~1_type~ (+25 Maximum Stats) */ else - list.Add( "a scroll of power ({0}{1} Maximum Stats)", (m_Value - 225) >= 0 ? "+" : "", m_Value - 225 ); + list.Add( "a scroll of power ({0}{1} Maximum Stats)", (Value - 225) >= 0 ? "+" : "", Value - 225 ); } public override void OnSingleClick( Mobile from ) { - if ( m_Value == 230 ) - base.LabelTo( from, 1049463, "#1049476" ); // a wonderous scroll of ~1_type~ (+5 Maximum Stats) - else if ( m_Value == 235 ) - base.LabelTo( from, 1049464, "#1049476" ); // an exalted scroll of ~1_type~ (+10 Maximum Stats) - else if ( m_Value == 240 ) - base.LabelTo( from, 1049465, "#1049476" ); // a mythical scroll of ~1_type~ (+15 Maximum Stats) - else if ( m_Value == 245 ) - base.LabelTo( from, 1049466, "#1049476" ); // a legendary scroll of ~1_type~ (+20 Maximum Stats) - else if ( m_Value == 250 ) - base.LabelTo( from, 1049467, "#1049476" ); // an ultimate scroll of ~1_type~ (+25 Maximum Stats) + int level = ( (int)Value - 230 ) / 5; + + if ( level >= 0 && level <= 4 && (int)Value % 5 == 0 ) + base.LabelTo( from, 1049463 + level, "#1049476" ); else - base.LabelTo( from, "a scroll of power ({0}{1} Maximum Stats)", (m_Value - 225) >= 0 ? "+" : "", m_Value - 225 ); + base.LabelTo( from, "a scroll of power ({0}{1} Maximum Stats)", (Value - 225) >= 0 ? "+" : "", Value - 225 ); } - - public void Use( Mobile from, bool firstStage ) + + public override bool CanUse( Mobile from ) { - if ( Deleted ) + if ( !base.CanUse( from ) ) + return false; + + int newValue = (int)Value; + + if ( from is PlayerMobile && ((PlayerMobile)from).HasStatReward ) + newValue += 5; + + if ( from.StatCap >= newValue ) + { + from.SendLocalizedMessage( 1049510 ); // Your stats are too high for this power scroll. + return false; + } + + return true; + } + + public override void Use( Mobile from ) + { + if ( !CanUse( from ) ) return; - if ( IsChildOf( from.Backpack ) ) - { - int NewValue = m_Value; - if ( from is PlayerMobile && ((PlayerMobile)from).HasStatReward ) - { - NewValue += 5; - } + from.SendLocalizedMessage( 1049512 ); // You feel a surge of magic as the scroll enhances your powers! - if ( from.StatCap >= NewValue ) - { - from.SendLocalizedMessage( 1049510 ); // Your stats are too high for this power scroll. - } - else - { - if ( firstStage ) - { - from.CloseGump( typeof( StatCapScroll.InternalGump ) ); - from.CloseGump( typeof( PowerScroll.InternalGump ) ); - #region Scroll of Alacrity - from.CloseGump(typeof( ScrollofAlacrity.InternalGump ) ); - #endregion - from.SendGump( new InternalGump( from, this ) ); - } - else - { - from.SendLocalizedMessage( 1049512 ); // You feel a surge of magic as the scroll enhances your powers! - - from.StatCap = NewValue; - - Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0, 0, 0, 0, 0, 5060, 0 ); - Effects.PlaySound( from.Location, from.Map, 0x243 ); - - Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 6, from.Y - 6, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 ); - Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 4, from.Y - 6, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 ); - Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 6, from.Y - 4, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 ); - - Effects.SendTargetParticles( from, 0x375A, 35, 90, 0x00, 0x00, 9502, (EffectLayer)255, 0x100 ); - - Delete(); - } - } - } + if ( from is PlayerMobile && ((PlayerMobile)from).HasStatReward ) + from.StatCap = (int)Value + 5; else - { - from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it. - } - } + from.StatCap = (int)Value; - public override void OnDoubleClick( Mobile from ) - { - Use( from, true ); + Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0, 0, 0, 0, 0, 5060, 0 ); + Effects.PlaySound( from.Location, from.Map, 0x243 ); + + Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 6, from.Y - 6, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 ); + Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 4, from.Y - 6, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 ); + Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 6, from.Y - 4, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 ); + + Effects.SendTargetParticles( from, 0x375A, 35, 90, 0x00, 0x00, 9502, (EffectLayer)255, 0x100 ); + + Delete(); } public override void Serialize( GenericWriter writer ) @@ -129,86 +117,16 @@ namespace Server.Items base.Serialize( writer ); writer.Write( (int) 0 ); // version - - writer.Write( (int) m_Value ); } public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); - int version = reader.ReadInt(); + int version = ( InheritsItem ? 0 : reader.ReadInt() ); //Required for SpecialScroll insertion - switch ( version ) - { - case 0: - { - m_Value = reader.ReadInt(); - - break; - } - } - - if ( LootType != LootType.Cursed ) - LootType = LootType.Cursed; - - if ( Insured ) - Insured = false; - } - - public class InternalGump : Gump - { - private Mobile m_Mobile; - private StatCapScroll m_Scroll; - - public InternalGump( Mobile mobile, StatCapScroll scroll ) : base( 25, 50 ) - { - m_Mobile = mobile; - m_Scroll = scroll; - - AddPage( 0 ); - - AddBackground( 25, 10, 420, 200, 5054 ); - - AddImageTiled( 33, 20, 401, 181, 2624 ); - AddAlphaRegion( 33, 20, 401, 181 ); - - AddHtmlLocalized( 40, 48, 387, 100, 1049469, true, true ); /* Using a scroll increases the maximum amount of a specific skill or your maximum statistics. - * When used, the effect is not immediately seen without a gain of points with that skill or statistics. - * You can view your maximum skill values in your skills window. - * You can view your maximum statistic value in your statistics window. - */ - AddHtmlLocalized( 125, 148, 200, 20, 1049478, 0xFFFFFF, false, false ); // Do you wish to use this scroll? - - AddButton( 100, 172, 4005, 4007, 1, GumpButtonType.Reply, 0 ); - AddHtmlLocalized( 135, 172, 120, 20, 1046362, 0xFFFFFF, false, false ); // Yes - - AddButton( 275, 172, 4005, 4007, 0, GumpButtonType.Reply, 0 ); - AddHtmlLocalized( 310, 172, 120, 20, 1046363, 0xFFFFFF, false, false ); // No - - int value = scroll.m_Value; - - if ( value == 230 ) - AddHtmlLocalized( 40, 20, 260, 20, 1049458, 0xFFFFFF, false, false ); // Wonderous Scroll (+5 Maximum Stats): - else if ( value == 235 ) - AddHtmlLocalized( 40, 20, 260, 20, 1049459, 0xFFFFFF, false, false ); // Exalted Scroll (+10 Maximum Stats): - else if ( value == 240 ) - AddHtmlLocalized( 40, 20, 260, 20, 1049460, 0xFFFFFF, false, false ); // Mythical Scroll (+15 Maximum Stats): - else if ( value == 245 ) - AddHtmlLocalized( 40, 20, 260, 20, 1049461, 0xFFFFFF, false, false ); // Legendary Scroll (+20 Maximum Stats): - else if ( value == 250 ) - AddHtmlLocalized( 40, 20, 260, 20, 1049462, 0xFFFFFF, false, false ); // Ultimate Scroll (+25 Maximum Stats): - else - AddHtml( 40, 20, 260, 20, String.Format( "Power Scroll ({0}{1} Maximum Stats):", (value - 225) >= 0 ? "+" : "", value - 225), false, false ); - - AddHtmlLocalized( 310, 20, 120, 20, 1038019, 0xFFFFFF, false, false ); // Power - } - - public override void OnResponse( NetState state, RelayInfo info ) - { - if ( info.ButtonID == 1 ) - m_Scroll.Use( m_Mobile, false ); - } + LootType = LootType.Cursed; + Insured = false; } } } \ No newline at end of file diff --git a/Scripts/Misc/CharacterCreation.cs b/Scripts/Misc/CharacterCreation.cs index 7e329fa49..184a3db1c 100644 --- a/Scripts/Misc/CharacterCreation.cs +++ b/Scripts/Misc/CharacterCreation.cs @@ -64,7 +64,7 @@ namespace Server.Misc // The new AOS bankboxes don't have powerscrolls, they are automatically 'applied': - for ( int i = 0; i < PowerScroll.Skills.Length; ++i ) + for ( int i = 0; i < PowerScroll.Skills.Count; ++i ) m.Skills[PowerScroll.Skills[ i ]].Cap = 120.0; m.StatCap = 250; @@ -532,7 +532,7 @@ namespace Server.Misc { Bag bag = new Bag(); - for ( int i = 0; i < PowerScroll.Skills.Length; ++i ) + for ( int i = 0; i < PowerScroll.Skills.Count; ++i ) bag.DropItem( new PowerScroll( PowerScroll.Skills[i], 120.0 ) ); bag.DropItem( new StatCapScroll( 250 ) ); diff --git a/Scripts/Mobiles/Monsters/SE/RuneBeetle.cs b/Scripts/Mobiles/Monsters/SE/RuneBeetle.cs index 2bf4fd75b..59ac897d0 100644 --- a/Scripts/Mobiles/Monsters/SE/RuneBeetle.cs +++ b/Scripts/Mobiles/Monsters/SE/RuneBeetle.cs @@ -106,6 +106,7 @@ namespace Server.Mobiles public override Poison PoisonImmune{ get{ return Poison.Greater; } } public override Poison HitPoison{ get{ return Poison.Greater; } } public override FoodType FavoriteFood{ get{ return FoodType.FruitsAndVegies | FoodType.GrainsAndHay; } } + public override bool CanAngerOnTame { get { return true; } } public override void OnGaveMeleeAttack( Mobile defender ) { diff --git a/Scripts/Mobiles/PlayerMobile.cs b/Scripts/Mobiles/PlayerMobile.cs index 1ee9dde74..5f1f47501 100644 --- a/Scripts/Mobiles/PlayerMobile.cs +++ b/Scripts/Mobiles/PlayerMobile.cs @@ -1398,6 +1398,20 @@ namespace Server.Mobiles if( Alive ) list.Add( new CallbackEntry( 6210, new ContextCallback( ToggleChampionTitleDisplay ) ) ); } + if ( from != this ) + { + + if ( Alive && Core.Expansion >= Expansion.AOS ) + list.Add( new AddToPartyEntry( from, this ) ); + + BaseHouse curhouse = BaseHouse.FindHouseAt( this ); + + if( curhouse != null ) + { + if ( Alive && Core.Expansion >= Expansion.AOS && curhouse.IsAosRules && curhouse.IsFriend( from ) ) + list.Add( new EjectPlayerEntry( from, this ) ); + } + } } private void CancelProtection() diff --git a/Scripts/Multis/BaseHouse.cs b/Scripts/Multis/BaseHouse.cs index 0af6b78bb..b3317ee93 100644 --- a/Scripts/Multis/BaseHouse.cs +++ b/Scripts/Multis/BaseHouse.cs @@ -2011,7 +2011,7 @@ namespace Server.Multis { from.SendLocalizedMessage( 501346 ); // Uh oh...a bigger boot may be required! } - else if ( IsFriend( targ ) ) + else if ( IsFriend( targ ) && !Core.ML ) { from.SendLocalizedMessage( 501348 ); // You cannot eject a friend of the house! }