diff --git a/Scripts/Engines/AI/Creature/BaseCreature.cs b/Scripts/Engines/AI/Creature/BaseCreature.cs index 7726db526..a42434e36 100644 --- a/Scripts/Engines/AI/Creature/BaseCreature.cs +++ b/Scripts/Engines/AI/Creature/BaseCreature.cs @@ -2912,7 +2912,6 @@ namespace Server.Mobiles { DebugSay( "I'm being attacked but my master told me not to fight." ); Warmode = false; - Combatant = null; return; } } diff --git a/Scripts/Engines/CannedEvil/ChampionSpawn.cs b/Scripts/Engines/CannedEvil/ChampionSpawn.cs index 5bc4ab014..cc3f34772 100644 --- a/Scripts/Engines/CannedEvil/ChampionSpawn.cs +++ b/Scripts/Engines/CannedEvil/ChampionSpawn.cs @@ -39,6 +39,8 @@ namespace Server.Engines.CannedEvil private bool m_HasBeenAdvanced; private bool m_ConfinedRoaming; + private Dictionary m_DamageEntries; + [CommandProperty( AccessLevel.GameMaster )] public bool ConfinedRoaming { @@ -70,6 +72,8 @@ namespace Server.Engines.CannedEvil m_ExpireDelay = TimeSpan.FromMinutes( 10.0 ); m_RestartDelay = TimeSpan.FromMinutes( 5.0 ); + m_DamageEntries = new Dictionary(); + Timer.DelayCall( TimeSpan.Zero, new TimerCallback( SetInitialSpawnArea ) ); } @@ -392,13 +396,24 @@ namespace Server.Engines.CannedEvil { if( m_Champion.Deleted ) { - if ( m_Platform != null ) + RegisterDamageTo( m_Champion ); + + if( m_Champion is BaseChampion ) + AwardArtifact( ((BaseChampion)m_Champion).GetArtifact() ); + + m_DamageEntries.Clear(); + + if( m_Platform != null ) m_Platform.Hue = 0x497; if( m_Altar != null ) { m_Altar.Hue = 0; - new StarRoomGate( true, m_Altar.Location, m_Altar.Map ); + + if( !Core.ML || Map == Map.Felucca ) + { + new StarRoomGate( true, m_Altar.Location, m_Altar.Map ); + } } m_Champion = null; @@ -421,9 +436,10 @@ namespace Server.Engines.CannedEvil --i; ++m_Kills; - Mobile killer = m.FindMostRecentDamager( false ); + RegisterDamageTo( m ); + if( killer is BaseCreature ) killer = ((BaseCreature)killer).GetMaster(); @@ -872,11 +888,103 @@ namespace Server.Engines.CannedEvil { } + public virtual void RegisterDamageTo( Mobile m ) + { + if( m == null ) + return; + + foreach( DamageEntry de in m.DamageEntries ) + { + if( de.HasExpired ) + continue; + + Mobile damager = de.Damager; + + Mobile master = damager.GetDamageMaster( m ); + + if( master != null ) + damager = master; + + RegisterDamage( damager, de.DamageGiven ); + } + } + + public void RegisterDamage( Mobile from, int amount ) + { + if( from == null || !from.Player ) + return; + + if( m_DamageEntries.ContainsKey( from ) ) + m_DamageEntries[from] += amount; + else + m_DamageEntries.Add( from, amount ); + } + + public void AwardArtifact( Item artifact ) + { + if (artifact == null ) + return; + + int totalDamage = 0; + + Dictionary validEntries = new Dictionary(); + + foreach (KeyValuePair kvp in m_DamageEntries) + { + if( IsEligable( kvp.Key, artifact ) ) + { + validEntries.Add( kvp.Key, kvp.Value ); + totalDamage += kvp.Value; + } + } + + int randomDamage = Utility.RandomMinMax( 1, totalDamage ); + + totalDamage = 0; + + foreach (KeyValuePair kvp in m_DamageEntries) + { + totalDamage += kvp.Value; + + if( totalDamage > randomDamage ) + { + GiveArtifact( kvp.Key, artifact ); + break; + } + } + } + + public void GiveArtifact( Mobile to, Item artifact ) + { + if ( to == null || artifact == null ) + return; + + Container pack = to.Backpack; + + if ( pack == null || !pack.TryDropItem( to, artifact, false ) ) + artifact.Delete(); + else + to.SendLocalizedMessage( 1062317 ); // For your valor in combating the fallen beast, a special artifact has been bestowed on you. + } + + public bool IsEligable( Mobile m, Item Artifact ) + { + //return true; + return m.Player && m.Alive && m.Region != null && m.Region == m_Region && m.Backpack != null && m.Backpack.CheckHold( m, Artifact, false ); + } + public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); - writer.Write( (int)4 ); // version + writer.Write( (int)5 ); // version + + writer.Write( m_DamageEntries.Count ); + foreach (KeyValuePair kvp in m_DamageEntries) + { + writer.Write( kvp.Key ); + writer.Write( kvp.Value ); + } writer.Write( m_ConfinedRoaming ); writer.WriteItem( m_Idol ); @@ -910,10 +1018,26 @@ namespace Server.Engines.CannedEvil { base.Deserialize( reader ); + m_DamageEntries = new Dictionary(); + int version = reader.ReadInt(); switch( version ) { + case 5: + { + int entries = reader.ReadInt(); + Mobile m; + int damage; + for( int i = 0; i < entries; ++i ) + { + m = reader.ReadMobile(); + damage = reader.ReadInt(); + m_DamageEntries.Add( m, damage ); + } + + goto case 4; + } case 4: { m_ConfinedRoaming = reader.ReadBool(); diff --git a/Scripts/Engines/Craft/Core/CraftItem.cs b/Scripts/Engines/Craft/Core/CraftItem.cs index 194224089..ec28d0b49 100644 --- a/Scripts/Engines/Craft/Core/CraftItem.cs +++ b/Scripts/Engines/Craft/Core/CraftItem.cs @@ -294,7 +294,8 @@ namespace Server.Engines.Craft 0x184A, 0x184C, // Heating stand (left) 0x184E, 0x1850, // Heating stand (right) 0x398C, 0x399F, // Fire field - 0x2DDB, 0x2DDC //Elven stove + 0x2DDB, 0x2DDC, //Elven stove + 0x19AA, 0x19BB // Veteran Reward Brazier }; private static int[] m_Ovens = new int[] diff --git a/Scripts/Engines/VeteranRewards/Character Statue Maker/CharacterStatue.cs b/Scripts/Engines/VeteranRewards/Character Statue Maker/CharacterStatue.cs new file mode 100644 index 000000000..0467aa926 --- /dev/null +++ b/Scripts/Engines/VeteranRewards/Character Statue Maker/CharacterStatue.cs @@ -0,0 +1,635 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Server; +using Server.Gumps; +using Server.Items; +using Server.Spells; +using Server.Multis; +using Server.Network; +using Server.Targeting; +using Server.Accounting; +using Server.ContextMenus; +using Server.Engines.VeteranRewards; + +namespace Server.Mobiles +{ + public enum StatueType + { + Marble, + Jade, + Bronze + } + + public enum StatuePose + { + Ready, + Casting, + Salute, + AllPraiseMe, + Fighting, + HandsOnHips + } + + public enum StatueMaterial + { + Antique, + Dark, + Medium, + Light + } + + public class CharacterStatue : Mobile, IRewardItem + { + private StatueType m_Type; + private StatuePose m_Pose; + private StatueMaterial m_Material; + + [CommandProperty( AccessLevel.GameMaster )] + public StatueType StatueType + { + get { return m_Type; } + set { m_Type = value; InvalidateHues(); InvalidatePose(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public StatuePose Pose + { + get { return m_Pose; } + set { m_Pose = value; InvalidatePose(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public StatueMaterial Material + { + get { return m_Material; } + set { m_Material = value; InvalidateHues(); InvalidatePose(); } + } + + private Mobile m_SculptedBy; + private DateTime m_SculptedOn; + + [CommandProperty( AccessLevel.GameMaster )] + public Mobile SculptedBy + { + get{ return m_SculptedBy; } + } + + [CommandProperty( AccessLevel.GameMaster )] + public DateTime SculptedOn + { + get{ return m_SculptedOn; } + } + + private CharacterStatuePlinth m_Plinth; + + public CharacterStatuePlinth Plinth + { + get { return m_Plinth; } + set { m_Plinth = value; } + } + + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; } + } + + public CharacterStatue( Mobile from, StatueType type ) : base() + { + m_Type = type; + m_Pose = StatuePose.Ready; + m_Material = StatueMaterial.Antique; + + m_SculptedBy = from; + m_SculptedOn = DateTime.Now; + + Direction = Direction.South; + AccessLevel = AccessLevel.Counselor; + Hits = HitsMax; + Blessed = true; + Frozen = true; + + CloneBody( from ); + CloneClothes( from ); + InvalidateHues(); + } + + public CharacterStatue( Serial serial ) : base( serial ) + { + } + + public override void OnDoubleClick( Mobile from ) + { + DisplayPaperdollTo( from ); + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_SculptedBy != null ) + { + if ( m_SculptedBy.Title != null ) + list.Add( 1076202, m_SculptedBy.Title + " " + m_SculptedBy.Name ); // Sculpted by ~1_Name~ + else + list.Add( 1076202, m_SculptedBy.Name ); // Sculpted by ~1_Name~ + } + } + + public override void GetContextMenuEntries( Mobile from, List list ) + { + base.GetContextMenuEntries( from, list ); + + if ( from.Alive ) + { + BaseHouse house = BaseHouse.FindHouseAt( this ); + + if ( ( house != null && house.IsCoOwner( from ) ) || (int) from.AccessLevel > (int) AccessLevel.Counselor ) + list.Add( new DemolishEntry( this ) ); + } + } + + public override void OnAfterDelete() + { + base.OnAfterDelete(); + + if ( m_Plinth != null && !m_Plinth.Deleted ) + m_Plinth.Delete(); + } + + protected override void OnMapChange( Map oldMap ) + { + InvalidatePose(); + + if ( m_Plinth != null ) + m_Plinth.Map = Map; + } + + protected override void OnLocationChange( Point3D oldLocation ) + { + InvalidatePose(); + + if ( m_Plinth != null ) + m_Plinth.Location = new Point3D( X, Y, Z - 5 ); + } + + public override bool CanBeRenamedBy( Mobile from ) + { + return false; + } + + public override bool CanBeDamaged() + { + return false; + } + + public void OnRequestedAnimation( Mobile from ) + { + from.Send( new UpdateStatueAnimation( this, 1, m_Animation, m_Frames ) ); + } + + public override void OnAosSingleClick( Mobile from ) + { + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( (int) 0 ); // version + + writer.Write( (int) m_Type ); + writer.Write( (int) m_Pose ); + writer.Write( (int) m_Material ); + + writer.Write( (Mobile) m_SculptedBy ); + writer.Write( (DateTime) m_SculptedOn ); + + writer.Write( (Item) m_Plinth ); + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_Type = (StatueType) reader.ReadInt(); + m_Pose = (StatuePose) reader.ReadInt(); + m_Material = (StatueMaterial) reader.ReadInt(); + + m_SculptedBy = reader.ReadMobile(); + m_SculptedOn = reader.ReadDateTime(); + + m_Plinth = reader.ReadItem() as CharacterStatuePlinth; + m_IsRewardItem = reader.ReadBool(); + + InvalidatePose(); + + Frozen = true; + } + + public void Sculpt( Mobile by ) + { + m_SculptedBy = by; + m_SculptedOn = DateTime.Now; + + InvalidateProperties(); + } + + public void Demolish( Mobile by ) + { + CharacterStatueDeed deed = new CharacterStatueDeed( null ); + + if ( by.PlaceInBackpack( deed ) ) + { + Internalize(); + + deed.Statue = this; + deed.IsRewardItem = m_IsRewardItem; + + if ( m_Plinth != null ) + m_Plinth.Internalize(); + } + else + { + by.SendLocalizedMessage( 500720 ); // You don't have enough room in your backpack! + deed.Delete(); + } + } + + public void Restore( CharacterStatue from ) + { + m_Material = from.Material; + m_Pose = from.Pose; + + Direction = from.Direction; + + CloneBody( from ); + CloneClothes( from ); + + InvalidateHues(); + InvalidatePose(); + } + + public void CloneBody( Mobile from ) + { + Name = from.Name; + BodyValue = from.BodyValue; + HairItemID = from.HairItemID; + FacialHairItemID = from.FacialHairItemID; + } + + public void CloneClothes( Mobile from ) + { + for ( int i = Items.Count - 1; i >= 0; i -- ) + Items[ i ].Delete(); + + for ( int i = from.Items.Count - 1; i >= 0; i -- ) + { + Item item = from.Items[ i ]; + + if ( item.Layer != Layer.Backpack && item.Layer != Layer.Mount && item.Layer != Layer.Bank ) + AddItem( CloneItem( item ) ); + } + } + + public Item CloneItem( Item item ) + { + Item cloned = new Item( item.ItemID ); + cloned.Layer = item.Layer; + cloned.Name = item.Name; + cloned.Hue = item.Hue; + cloned.Weight = item.Weight; + cloned.Movable = false; + + return cloned; + } + + public void InvalidateHues() + { + Hue = 0xB8F + (int) m_Type * 4 + (int) m_Material; + + HairHue = Hue; + + if ( FacialHairItemID > 0 ) + FacialHairHue = Hue; + + for ( int i = Items.Count - 1; i >= 0; i -- ) + Items[ i ].Hue = Hue; + + if ( m_Plinth != null ) + m_Plinth.InvalidateHue(); + } + + private int m_Animation; + private int m_Frames; + + public void InvalidatePose() + { + switch ( m_Pose ) + { + case StatuePose.Ready: + m_Animation = 4; + m_Frames = 0; + break; + case StatuePose.Casting: + m_Animation = 16; + m_Frames = 2; + break; + case StatuePose.Salute: + m_Animation = 33; + m_Frames = 1; + break; + case StatuePose.AllPraiseMe: + m_Animation = 17; + m_Frames = 4; + break; + case StatuePose.Fighting: + m_Animation = 31; + m_Frames = 5; + break; + case StatuePose.HandsOnHips: + m_Animation = 6; + m_Frames = 1; + break; + } + + if( Map != null ) + { + ProcessDelta(); + + Packet p = null; + + IPooledEnumerable eable = Map.GetClientsInRange( Location ); + + foreach( NetState state in eable ) + { + state.Mobile.ProcessDelta(); + + if( p == null ) + p = Packet.Acquire( new UpdateStatueAnimation( this, 1, m_Animation, m_Frames ) ); + + state.Send( p ); + } + + Packet.Release( p ); + + eable.Free(); + } + } + + private class DemolishEntry : ContextMenuEntry + { + private CharacterStatue m_Statue; + + public DemolishEntry( CharacterStatue statue ) : base( 6275, 2 ) + { + m_Statue = statue; + } + + public override void OnClick() + { + if ( m_Statue.Deleted ) + return; + + m_Statue.Demolish( Owner.From ); + } + } + } + + public class CharacterStatueDeed : Item, IRewardItem + { + public override int LabelNumber + { + get + { + if ( m_Statue != null ) + { + switch ( m_Statue.StatueType ) + { + case StatueType.Marble: return 1076189; + case StatueType.Jade: return 1076188; + case StatueType.Bronze: return 1076190; + } + } + + return 1076173; + } + } + + private CharacterStatue m_Statue; + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public CharacterStatue Statue + { + get { return m_Statue; } + set { m_Statue = value; } + } + + [CommandProperty( AccessLevel.GameMaster )] + public StatueType StatueType + { + get + { + if ( m_Statue != null ) + return m_Statue.StatueType; + + return StatueType.Marble; + } + } + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + public CharacterStatueDeed( CharacterStatue statue ) : base( 0x14F0 ) + { + m_Statue = statue; + + LootType = LootType.Blessed; + Weight = 1.0; + } + + public CharacterStatueDeed( Serial serial ) : base( serial ) + { + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_IsRewardItem ) + list.Add( 1076222 ); // 6th Year Veteran Reward + + if ( m_Statue != null ) + list.Add( 1076231, m_Statue.Name ); // Statue of ~1_Name~ + } + + public override void OnDoubleClick( Mobile from ) + { + Account acct = from.Account as Account; + + if ( acct != null && from.AccessLevel == AccessLevel.Player ) + { + TimeSpan time = TimeSpan.FromDays( RewardSystem.RewardInterval.TotalDays * 6 ) - ( DateTime.Now - acct.Created ); + + if ( time > TimeSpan.Zero ) + { + from.SendLocalizedMessage( 1008126, true, Math.Ceiling( time.TotalDays / RewardSystem.RewardInterval.TotalDays ).ToString() ); // Your account is not old enough to use this item. Months until you can use this item : + return; + } + } + + if ( IsChildOf( from.Backpack ) ) + { + if ( !from.IsBodyMod ) + { + from.SendLocalizedMessage( 1076194 ); // Select a place where you would like to put your statue. + from.Target = new CharacterStatueTarget( this, StatueType ); + } + else + from.SendLocalizedMessage( 1073648 ); // You may only proceed while in your original state... + } + else + from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it. + } + + public override void OnDelete() + { + base.OnDelete(); + + if ( m_Statue != null ) + m_Statue.Delete(); + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( (int) 0 ); // version + + writer.Write( (Mobile) m_Statue ); + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_Statue = reader.ReadMobile() as CharacterStatue; + m_IsRewardItem = reader.ReadBool(); + } + } + + public class CharacterStatueTarget : Target + { + private Item m_Maker; + private StatueType m_Type; + + public CharacterStatueTarget( Item maker, StatueType type ) : base( -1, true, TargetFlags.None ) + { + m_Maker = maker; + m_Type = type; + } + + protected override void OnTarget( Mobile from, object targeted ) + { + IPoint3D p = targeted as IPoint3D; + Map map = from.Map; + + if ( p == null || map == null || m_Maker == null || m_Maker.Deleted ) + return; + + if ( m_Maker.IsChildOf( from.Backpack ) ) + { + SpellHelper.GetSurfaceTop( ref p ); + BaseHouse house = null; + Point3D loc = new Point3D( p ); + + if ( targeted is Item && !((Item) targeted).IsLockedDown && !((Item) targeted).IsSecure && !(targeted is AddonComponent) ) + { + from.SendLocalizedMessage( 1076191 ); // Statues can only be placed in houses. + return; + } + else if ( from.IsBodyMod ) + { + from.SendLocalizedMessage( 1073648 ); // You may only proceed while in your original state... + return; + } + + AddonFitResult result = CouldFit( loc, map, from, ref house ); + + if ( result == AddonFitResult.Valid ) + { + CharacterStatue statue = new CharacterStatue( from, m_Type ); + CharacterStatuePlinth plinth = new CharacterStatuePlinth( statue ); + + house.Addons.Add( plinth ); + + if ( m_Maker is IRewardItem ) + statue.IsRewardItem = ( (IRewardItem) m_Maker).IsRewardItem; + + statue.Plinth = plinth; + plinth.MoveToWorld( loc, map ); + statue.InvalidatePose(); + + from.CloseGump( typeof( CharacterStatueGump ) ); + from.SendGump( new CharacterStatueGump( m_Maker, statue, from ) ); + } + else if ( result == AddonFitResult.Blocked ) + from.SendLocalizedMessage( 500269 ); // You cannot build that there. + else if ( result == AddonFitResult.NotInHouse ) + from.SendLocalizedMessage( 1076192 ); // Statues can only be placed in houses where you are the owner or co-owner. + else if ( result == AddonFitResult.DoorsNotClosed ) + from.SendMessage( "You must close all house doors before placing this." ); + else if ( result == AddonFitResult.DoorTooClose ) + from.SendLocalizedMessage( 500271 ); // You cannot build near the door. + } + else + from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it. + } + + public static AddonFitResult CouldFit( Point3D p, Map map, Mobile from, ref BaseHouse house ) + { + if ( !map.CanFit( p.X, p.Y, p.Z, 20, true, true, true ) ) + return AddonFitResult.Blocked; + else if ( !BaseAddon.CheckHouse( from, p, map, 20, ref house ) ) + return AddonFitResult.NotInHouse; + else + return CheckDoors( p, 20, house ); + } + + public static AddonFitResult CheckDoors( Point3D p, int height, BaseHouse house ) + { + ArrayList doors = house.Doors; + + for ( int i = 0; i < doors.Count; i ++ ) + { + BaseDoor door = doors[ i ] as BaseDoor; + + if ( door != null && door.Open ) + return AddonFitResult.DoorsNotClosed; + + Point3D doorLoc = door.GetWorldLocation(); + int doorHeight = door.ItemData.CalcHeight; + + if ( Utility.InRange( doorLoc, p, 1 ) && (p.Z == doorLoc.Z || ((p.Z + height) > doorLoc.Z && (doorLoc.Z + doorHeight) > p.Z)) ) + return AddonFitResult.DoorTooClose; + } + + return AddonFitResult.Valid; + } + } +} diff --git a/Scripts/Engines/VeteranRewards/Character Statue Maker/CharacterStatueMaker.cs b/Scripts/Engines/VeteranRewards/Character Statue Maker/CharacterStatueMaker.cs new file mode 100644 index 000000000..1ca900c0f --- /dev/null +++ b/Scripts/Engines/VeteranRewards/Character Statue Maker/CharacterStatueMaker.cs @@ -0,0 +1,174 @@ +using System; +using Server; +using Server.Mobiles; +using Server.Targets; +using Server.Engines.VeteranRewards; + +namespace Server.Items +{ + public class CharacterStatueMaker : Item, IRewardItem + { + public override int LabelNumber{ get{ return 1076173; } } // Character Statue Maker + + private bool m_IsRewardItem; + private StatueType m_Type; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public StatueType StatueType + { + get{ return m_Type; } + set{ m_Type = value; InvalidateHue(); } + } + + public CharacterStatueMaker( StatueType type ) : base( 0x32F0 ) + { + m_Type = type; + + InvalidateHue(); + + LootType = LootType.Blessed; + Weight = 5.0; + } + + public CharacterStatueMaker( Serial serial ) : base( serial ) + { + } + + public override void OnDoubleClick( Mobile from ) + { + if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, new object[] { m_Type } ) ) + return; + + if ( IsChildOf( from.Backpack ) ) + { + if ( !from.IsBodyMod ) + { + from.SendLocalizedMessage( 1076194 ); // Select a place where you would like to put your statue. + from.Target = new CharacterStatueTarget( this, m_Type ); + } + else + from.SendLocalizedMessage( 1073648 ); // You may only proceed while in your original state... + } + else + from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it. + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_IsRewardItem ) + list.Add( 1076222 ); // 6th Year Veteran Reward + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( (int) 0 ); // version + + writer.Write( (bool) m_IsRewardItem ); + writer.Write( (int) m_Type ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_IsRewardItem = reader.ReadBool(); + m_Type = (StatueType) reader.ReadInt(); + } + + public void InvalidateHue() + { + Hue = 0xB8F + (int) m_Type * 4; + } + } + + public class MarbleStatueMaker : CharacterStatueMaker + { + [Constructable] + public MarbleStatueMaker() : base( StatueType.Marble ) + { + } + + public MarbleStatueMaker( Serial serial ) : base( serial ) + { + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( (int) 0 ); // version + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + } + } + + public class JadeStatueMaker : CharacterStatueMaker + { + [Constructable] + public JadeStatueMaker() : base( StatueType.Jade ) + { + } + + public JadeStatueMaker( Serial serial ) : base( serial ) + { + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( (int) 0 ); // version + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + } + } + + public class BronzeStatueMaker : CharacterStatueMaker + { + [Constructable] + public BronzeStatueMaker() : base( StatueType.Bronze ) + { + } + + public BronzeStatueMaker( Serial serial ) : base( serial ) + { + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( (int) 0 ); // version + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + } + } +} diff --git a/Scripts/Engines/VeteranRewards/Character Statue Maker/CharacterStatuePlinth.cs b/Scripts/Engines/VeteranRewards/Character Statue Maker/CharacterStatuePlinth.cs new file mode 100644 index 000000000..66425e75e --- /dev/null +++ b/Scripts/Engines/VeteranRewards/Character Statue Maker/CharacterStatuePlinth.cs @@ -0,0 +1,127 @@ +using System; +using System.Globalization; +using Server; +using Server.Gumps; +using Server.Mobiles; +using Server.Multis; +using Server.Targets; + +namespace Server.Items +{ + public class CharacterStatuePlinth : Static, IAddon + { + public Item Deed{ get{ return new CharacterStatueDeed( m_Statue ); } } + public override int LabelNumber{ get{ return 1076201; } } // Character Statue + + private CharacterStatue m_Statue; + + public CharacterStatuePlinth( CharacterStatue statue ) : base( 0x32F2 ) + { + m_Statue = statue; + + InvalidateHue(); + } + + public CharacterStatuePlinth( Serial serial ) : base( serial ) + { + } + + public override void OnAfterDelete() + { + base.OnAfterDelete(); + + if ( m_Statue != null && !m_Statue.Deleted ) + m_Statue.Delete(); + } + + public override void OnMapChange() + { + if ( m_Statue != null ) + m_Statue.Map = Map; + } + + public override void OnLocationChange( Point3D oldLocation ) + { + if ( m_Statue != null ) + m_Statue.Location = new Point3D( X, Y, Z + 5 ); + } + + public override void OnDoubleClick( Mobile from ) + { + if ( m_Statue != null ) + from.SendGump( new CharacterPlinthGump( m_Statue ) ); + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( (int) 0 ); // version + + writer.Write( (Mobile) m_Statue ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_Statue = reader.ReadMobile() as CharacterStatue; + } + + public void InvalidateHue() + { + if ( m_Statue != null ) + Hue = 0xB8F + (int) m_Statue.StatueType * 4 + (int) m_Statue.Material; + } + + public virtual bool CouldFit( IPoint3D p, Map map ) + { + Point3D point = new Point3D( p.X, p.Y, p.Z ); + + if ( map == null || !map.CanFit( point, 20 ) ) + return false; + + BaseHouse house = BaseHouse.FindHouseAt( point, map, 20 ); + + if ( house == null ) + return false; + + AddonFitResult result = CharacterStatueTarget.CheckDoors( point, 20, house ); + + if ( result == AddonFitResult.Valid ) + return true; + + return false; + } + + private class CharacterPlinthGump : Gump + { + public CharacterPlinthGump( CharacterStatue statue ) : base( 60, 30 ) + { + Closable = true; + Disposable = true; + Dragable = true; + Resizable = false; + + AddPage( 0 ); + AddImage( 0, 0, 0x24F4 ); + AddHtml( 55, 50, 150, 20, statue.Name, false, false ); + AddHtml( 55, 75, 150, 20, statue.SculptedOn.ToString( "G", new CultureInfo("de-DE") ), false, false ); + AddHtmlLocalized( 55, 100, 150, 20, GetTypeNumber( statue.StatueType ), 0, false, false ); + } + + public int GetTypeNumber( StatueType type ) + { + switch ( type ) + { + case StatueType.Marble: return 1076181; + case StatueType.Jade: return 1076180; + case StatueType.Bronze: return 1076230; + default: return 1076181; + } + } + } + } +} diff --git a/Scripts/Engines/VeteranRewards/Character Statue Maker/Gumps/CharacterStatueGump.cs b/Scripts/Engines/VeteranRewards/Character Statue Maker/Gumps/CharacterStatueGump.cs new file mode 100644 index 000000000..99e50a5f5 --- /dev/null +++ b/Scripts/Engines/VeteranRewards/Character Statue Maker/Gumps/CharacterStatueGump.cs @@ -0,0 +1,229 @@ +using System; +using Server; +using Server.Items; +using Server.Mobiles; +using Server.Network; + +namespace Server.Gumps +{ + public class CharacterStatueGump : Gump + { + private Item m_Maker; + private CharacterStatue m_Statue; + private Timer m_Timer; + private Mobile m_Owner; + + private enum Buttons + { + Close, + Sculpt, + PosePrev, + PoseNext, + DirPrev, + DirNext, + MatPrev, + MatNext, + Restore + } + + public CharacterStatueGump( Item maker, CharacterStatue statue, Mobile owner ) : base( 60, 36 ) + { + m_Maker = maker; + m_Statue = statue; + m_Owner = owner; + + if ( m_Statue == null ) + return; + + Closable = true; + Disposable = true; + Dragable = true; + Resizable = false; + + AddPage( 0 ); + + AddBackground( 0, 0, 327, 324, 0x13BE ); + AddImageTiled( 10, 10, 307, 20, 0xA40 ); + AddImageTiled( 10, 40, 307, 244, 0xA40 ); + AddImageTiled( 10, 294, 307, 20, 0xA40 ); + AddAlphaRegion( 10, 10, 307, 304 ); + AddHtmlLocalized( 14, 12, 327, 20, 1076156, 0x7FFF, false, false ); // Character Statue Maker + + // pose + AddHtmlLocalized( 133, 41, 120, 20, 1076168, 0x7FFF, false, false ); // Choose Pose + AddHtmlLocalized( 133, 61, 120, 20, 1076208 + (int) m_Statue.Pose, 0x77E, false, false ); + AddButton( 163, 81, 0xFA5, 0xFA7, (int) Buttons.PoseNext, GumpButtonType.Reply, 0 ); + AddButton( 133, 81, 0xFAE, 0xFB0, (int) Buttons.PosePrev, GumpButtonType.Reply, 0 ); + + // direction + AddHtmlLocalized( 133, 126, 120, 20, 1076170, 0x7FFF, false, false ); // Choose Direction + AddHtmlLocalized( 133, 146, 120, 20, GetDirectionNumber( m_Statue.Direction ), 0x77E, false, false ); + AddButton( 163, 167, 0xFA5, 0xFA7, (int) Buttons.DirNext, GumpButtonType.Reply, 0 ); + AddButton( 133, 167, 0xFAE, 0xFB0, (int) Buttons.DirPrev, GumpButtonType.Reply, 0 ); + + // material + AddHtmlLocalized( 133, 211, 120, 20, 1076171, 0x7FFF, false, false ); // Choose Material + AddHtmlLocalized( 133, 231, 120, 20, GetMaterialNumber( m_Statue.StatueType, m_Statue.Material ), 0x77E, false, false ); + AddButton( 163, 253, 0xFA5, 0xFA7, (int) Buttons.MatNext, GumpButtonType.Reply, 0 ); + AddButton( 133, 253, 0xFAE, 0xFB0, (int) Buttons.MatPrev, GumpButtonType.Reply, 0 ); + + // cancel + AddButton( 10, 294, 0xFB1, 0xFB2, (int) Buttons.Close, GumpButtonType.Reply, 0 ); + AddHtmlLocalized( 45, 294, 80, 20, 1006045, 0x7FFF, false, false ); // Cancel + + // sculpt + AddButton( 234, 294, 0xFB7, 0xFB9, (int) Buttons.Sculpt, GumpButtonType.Reply, 0 ); + AddHtmlLocalized( 269, 294, 80, 20, 1076174, 0x7FFF, false, false ); // Sculpt + + // restore + if ( m_Maker is CharacterStatueDeed ) + { + AddButton( 107, 294, 0xFAB, 0xFAD, (int) Buttons.Restore, GumpButtonType.Reply, 0 ); + AddHtmlLocalized( 142, 294, 80, 20, 1076193, 0x7FFF, false, false ); // Restore + } + + m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 2.5 ), TimeSpan.FromSeconds( 2.5 ), new TimerCallback( CheckOnline ) ); + } + + private void CheckOnline() + { + if ( m_Owner != null && m_Owner.NetState == null ) + { + if ( m_Timer != null ) + m_Timer.Stop(); + + if ( m_Statue != null && !m_Statue.Deleted ) + m_Statue.Delete(); + } + } + + private int GetMaterialNumber( StatueType type, StatueMaterial material ) + { + switch ( material ) + { + case StatueMaterial.Antique: + + switch ( type ) + { + case StatueType.Bronze: return 1076187; + case StatueType.Jade: return 1076186; + case StatueType.Marble: return 1076182; + } + + return 1076187; + case StatueMaterial.Dark: + + if ( type == StatueType.Marble ) + return 1076183; + + return 1076182; + case StatueMaterial.Medium: return 1076184; + case StatueMaterial.Light: return 1076185; + default: return 1076187; + } + } + + private int GetDirectionNumber( Direction direction ) + { + switch ( direction ) + { + case Direction.North: return 1075389; + case Direction.Right: return 1075388; + case Direction.East: return 1075387; + case Direction.Down: return 1076204; + case Direction.South: return 1075386; + case Direction.Left: return 1075391; + case Direction.West: return 1075390; + case Direction.Up: return 1076205; + default: return 1075386; + } + } + + public override void OnResponse( NetState state, RelayInfo info ) + { + if ( m_Statue == null || m_Statue.Deleted ) + return; + + bool sendGump = false; + + if ( info.ButtonID == (int) Buttons.Sculpt ) + { + if ( m_Maker is CharacterStatueDeed ) + { + CharacterStatue backup = ( (CharacterStatueDeed) m_Maker ).Statue; + + if ( backup != null ) + backup.Delete(); + } + + if ( m_Maker != null ) + m_Maker.Delete(); + + m_Statue.Sculpt( state.Mobile ); + } + else if ( info.ButtonID == (int) Buttons.PosePrev ) + { + m_Statue.Pose = (StatuePose) ( ( (int) m_Statue.Pose + 5 ) % 6 ); + sendGump = true; + } + else if ( info.ButtonID == (int) Buttons.PoseNext ) + { + m_Statue.Pose = (StatuePose) ( ( (int) m_Statue.Pose + 1 ) % 6 ); + sendGump = true; + } + else if ( info.ButtonID == (int) Buttons.DirPrev ) + { + m_Statue.Direction = (Direction) ( ( (int) m_Statue.Direction + 7 ) % 8 ); + m_Statue.InvalidatePose(); + sendGump = true; + } + else if ( info.ButtonID == (int) Buttons.DirNext ) + { + m_Statue.Direction = (Direction) ( ( (int) m_Statue.Direction + 1 ) % 8 ); + m_Statue.InvalidatePose(); + sendGump = true; + } + else if ( info.ButtonID == (int) Buttons.MatPrev ) + { + m_Statue.Material = (StatueMaterial) ( ( (int) m_Statue.Material + 3 ) % 4 ); + sendGump = true; + } + else if ( info.ButtonID == (int) Buttons.MatNext ) + { + m_Statue.Material = (StatueMaterial) ( ( (int) m_Statue.Material + 1 ) % 4 ); + sendGump = true; + } + else if ( info.ButtonID == (int) Buttons.Restore ) + { + if ( m_Maker is CharacterStatueDeed ) + { + CharacterStatue backup = ( (CharacterStatueDeed) m_Maker ).Statue; + + if ( backup != null ) + m_Statue.Restore( backup ); + } + + sendGump = true; + } + else + { + m_Statue.Delete(); + } + + if ( sendGump ) + state.Mobile.SendGump( new CharacterStatueGump( m_Maker, m_Statue, m_Owner ) ); + + if ( m_Timer != null ) + m_Timer.Stop(); + } + + public override void OnServerClose( NetState owner ) + { + if ( m_Timer != null ) + m_Timer.Stop(); + + if ( m_Statue != null && !m_Statue.Deleted ) + m_Statue.Delete(); + } + } +} diff --git a/Scripts/Engines/VeteranRewards/Character Statue Maker/Packets.cs b/Scripts/Engines/VeteranRewards/Character Statue Maker/Packets.cs new file mode 100644 index 000000000..407516602 --- /dev/null +++ b/Scripts/Engines/VeteranRewards/Character Statue Maker/Packets.cs @@ -0,0 +1,23 @@ +using System; +using Server; + +namespace Server.Network +{ + public class UpdateStatueAnimation : Packet + { + public UpdateStatueAnimation( Mobile m, int status, int animation, int frame ) : base( 0xBF, 17 ) + { + m_Stream.Write( (short) 0x11 ); + m_Stream.Write( (short) 0x19 ); + m_Stream.Write( (byte) 0x5 ); + m_Stream.Write( (int) m.Serial ); + m_Stream.Write( (byte) 0 ); + m_Stream.Write( (byte) 0xFF ); + m_Stream.Write( (byte) status ); + m_Stream.Write( (byte) 0 ); + m_Stream.Write( (byte) animation ); + m_Stream.Write( (byte) 0 ); + m_Stream.Write( (byte) frame ); + } + } +} diff --git a/Scripts/Engines/VeteranRewards/RewardChoiceGump.cs b/Scripts/Engines/VeteranRewards/RewardChoiceGump.cs index 6b33651bb..cc5c71471 100644 --- a/Scripts/Engines/VeteranRewards/RewardChoiceGump.cs +++ b/Scripts/Engines/VeteranRewards/RewardChoiceGump.cs @@ -62,15 +62,19 @@ namespace Server.Engines.VeteranRewards RewardCategory[] categories = RewardSystem.Categories; + int page = 2; + for ( int i = 0; i < categories.Length; ++i ) { - if ( categories[i].Entries.Count == 0 ) + if ( !RewardSystem.HasAccess( m_From, categories[i] ) ) + { + page += 1; continue; + } - if ( !RewardSystem.HasAccess( m_From, (RewardEntry)categories[i].Entries[0] ) ) - continue; + AddButton( 100, 180 + (i * 40), 4005, 4005, 0, GumpButtonType.Page, page ); - AddButton( 100, 180 + (i * 40), 4005, 4005, 0, GumpButtonType.Page, 2 + i ); + page += PagesPerCategory( categories[ i ] ); if ( categories[i].NameString != null ) AddHtml( 135, 180 + (i * 40), 300, 20, categories[i].NameString, false, false ); @@ -78,8 +82,24 @@ namespace Server.Engines.VeteranRewards AddHtmlLocalized( 135, 180 + (i * 40), 300, 20, categories[i].Name, false, false ); } + page = 2; + for ( int i = 0; i < categories.Length; ++i ) - RenderCategory( categories[i], i ); + RenderCategory( categories[ i ], i, ref page ); + } + + private int PagesPerCategory( RewardCategory category ) + { + List entries = category.Entries; + int j = 0, i = 0; + + for ( j = 0; j < entries.Count; j++ ) + { + if ( RewardSystem.HasAccess( m_From, entries[ j ] ) ) + i++; + } + + return (int) Math.Ceiling( i / 24.0 ); } private int GetButtonID( int type, int index ) @@ -87,26 +107,44 @@ namespace Server.Engines.VeteranRewards return 2 + (index * 20) + type; } - private void RenderCategory( RewardCategory category, int index ) + private void RenderCategory( RewardCategory category, int index, ref int page ) { - AddPage( 2 + index ); + AddPage( page ); List entries = category.Entries; - for ( int i = 0; i < entries.Count; ++i ) + int i = 0; + + for ( int j = 0; j < entries.Count; ++j ) { - RewardEntry entry = entries[i]; + RewardEntry entry = entries[j]; if ( !RewardSystem.HasAccess( m_From, entry ) ) - break; + continue; - AddButton( 55 + ((i / 12) * 250), 80 + ((i % 12) * 25), 5540, 5541, GetButtonID( index, i ), GumpButtonType.Reply, 0 ); + if ( i == 24 ) + { + AddButton( 305, 415, 0xFA5, 0xFA7, 0, GumpButtonType.Page, ++page ); + AddHtmlLocalized( 340, 415, 200, 20, 1011066, false, false ); // Next page + + AddPage( page ); + + AddButton( 270, 415, 0xFAE, 0xFB0, 0, GumpButtonType.Page, page - 1 ); + AddHtmlLocalized( 185, 415, 200, 20, 1011067, false, false ); // Previous page + + i = 0; + } + + AddButton( 55 + ((i / 12) * 250), 80 + ((i % 12) * 25), 5540, 5541, GetButtonID( index, j ), GumpButtonType.Reply, 0 ); if ( entry.NameString != null ) AddHtml( 80 + ((i / 12) * 250), 80 + ((i % 12) * 25), 250, 20, entry.NameString, false, false ); else AddHtmlLocalized( 80 + ((i / 12) * 250), 80 + ((i % 12) * 25), 250, 20, entry.Name, false, false ); + ++i; } + + page += 1; } public RewardChoiceGump( Mobile from ) : base( 0, 0 ) diff --git a/Scripts/Engines/VeteranRewards/RewardConfirmGump.cs b/Scripts/Engines/VeteranRewards/RewardConfirmGump.cs index 095c461e1..ffcd62447 100644 --- a/Scripts/Engines/VeteranRewards/RewardConfirmGump.cs +++ b/Scripts/Engines/VeteranRewards/RewardConfirmGump.cs @@ -51,6 +51,9 @@ namespace Server.Engines.VeteranRewards if ( item != null ) { + if ( item is Server.Items.RedSoulstone ) + ((Server.Items.RedSoulstone) item).Account = m_From.Account.Username; + if ( RewardSystem.ConsumeRewardPoint( m_From ) ) m_From.AddToBackpack( item ); else diff --git a/Scripts/Engines/VeteranRewards/RewardDemolitionGump.cs b/Scripts/Engines/VeteranRewards/RewardDemolitionGump.cs new file mode 100644 index 000000000..3c9c65f1b --- /dev/null +++ b/Scripts/Engines/VeteranRewards/RewardDemolitionGump.cs @@ -0,0 +1,73 @@ +using System; +using Server; +using Server.Items; +using Server.Multis; +using Server.Network; + +namespace Server.Gumps +{ + public class RewardDemolitionGump : Gump + { + private IAddon m_Addon; + + private enum Buttons + { + Cancel, + Confirm, + } + + public RewardDemolitionGump( IAddon addon, int question ) : base( 150, 50 ) + { + m_Addon = addon; + + Closable = true; + Disposable = true; + Dragable = true; + Resizable = false; + + AddBackground( 0, 0, 220, 170, 0x13BE ); + AddBackground( 10, 10, 200, 150, 0xBB8 ); + + AddHtmlLocalized( 20, 30, 180, 60, question, false, false ); // Do you wish to re-deed this decoration? + + AddHtmlLocalized( 55, 100, 150, 25, 1011011, false, false ); // CONTINUE + AddButton( 20, 100, 0xFA5, 0xFA7, (int) Buttons.Confirm, GumpButtonType.Reply, 0 ); + + AddHtmlLocalized( 55, 125, 150, 25, 1011012, false, false ); // CANCEL + AddButton( 20, 125, 0xFA5, 0xFA7, (int) Buttons.Cancel, GumpButtonType.Reply, 0 ); + } + + public override void OnResponse( NetState sender, RelayInfo info ) + { + Item item = m_Addon as Item; + + if ( item == null || item.Deleted ) + return; + + if ( info.ButtonID == (int) Buttons.Confirm ) + { + Mobile m = sender.Mobile; + BaseHouse house = BaseHouse.FindHouseAt( m ); + + if ( house != null && house.IsOwner( m ) ) + { + if ( m.InRange( item.Location, 2 ) ) + { + Item deed = m_Addon.Deed; + + if ( deed != null ) + { + m.AddToBackpack( deed ); + house.Addons.Remove( item ); + item.Delete(); + } + } + else + m.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that. + } + else + m.SendLocalizedMessage( 1049784 ); // You can only re-deed this decoration if you are the house owner or originally placed the decoration. + } + } + } +} diff --git a/Scripts/Engines/VeteranRewards/RewardEntry.cs b/Scripts/Engines/VeteranRewards/RewardEntry.cs index 7a2d5f810..c0e6b36eb 100644 --- a/Scripts/Engines/VeteranRewards/RewardEntry.cs +++ b/Scripts/Engines/VeteranRewards/RewardEntry.cs @@ -7,6 +7,7 @@ namespace Server.Engines.VeteranRewards private RewardList m_List; private RewardCategory m_Category; private Type m_ItemType; + private Expansion m_RequiredExpansion; private int m_Name; private string m_NameString; private object[] m_Args; @@ -14,6 +15,7 @@ namespace Server.Engines.VeteranRewards public RewardList List{ get{ return m_List; } set{ m_List = value; } } public RewardCategory Category{ get{ return m_Category; } } public Type ItemType{ get{ return m_ItemType; } } + public Expansion RequiredExpansion{ get{ return m_RequiredExpansion; } } public int Name{ get{ return m_Name; } } public string NameString{ get{ return m_NameString; } } public object[] Args{ get{ return m_Args; } } @@ -40,6 +42,7 @@ namespace Server.Engines.VeteranRewards { m_Category = category; m_ItemType = itemType; + m_RequiredExpansion = Expansion.None; m_Name = name; m_Args = args; category.Entries.Add( this ); @@ -49,6 +52,27 @@ namespace Server.Engines.VeteranRewards { m_Category = category; m_ItemType = itemType; + m_RequiredExpansion = Expansion.None; + m_NameString = name; + m_Args = args; + category.Entries.Add( this ); + } + + public RewardEntry( RewardCategory category, int name, Type itemType, Expansion requiredExpansion, params object[] args ) + { + m_Category = category; + m_ItemType = itemType; + m_RequiredExpansion = requiredExpansion; + m_Name = name; + m_Args = args; + category.Entries.Add( this ); + } + + public RewardEntry( RewardCategory category, string name, Type itemType, Expansion requiredExpansion, params object[] args ) + { + m_Category = category; + m_ItemType = itemType; + m_RequiredExpansion = requiredExpansion; m_NameString = name; m_Args = args; category.Entries.Add( this ); diff --git a/Scripts/Engines/VeteranRewards/RewardOptionGump.cs b/Scripts/Engines/VeteranRewards/RewardOptionGump.cs new file mode 100644 index 000000000..29341de3c --- /dev/null +++ b/Scripts/Engines/VeteranRewards/RewardOptionGump.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; + +using Server; +using Server.Gumps; +using Server.Network; + +namespace Server.Gumps +{ + public interface IRewardOption + { + void GetOptions( RewardOptionList list ); + void OnOptionSelected( Mobile from, int choice ); + } + + public class RewardOptionGump : Gump + { + private RewardOptionList m_Options = new RewardOptionList(); + private IRewardOption m_Option; + + public RewardOptionGump( IRewardOption option ) : this( option, 0 ) + { + } + + public RewardOptionGump( IRewardOption option, int title ) : base( 60, 36 ) + { + m_Option = option; + + if ( m_Option != null ) + m_Option.GetOptions( m_Options ); + + AddPage( 0 ); + + AddBackground( 0, 0, 273, 324, 0x13BE ); + AddImageTiled( 10, 10, 253, 20, 0xA40 ); + AddImageTiled( 10, 40, 253, 244, 0xA40 ); + AddImageTiled( 10, 294, 253, 20, 0xA40 ); + AddAlphaRegion( 10, 10, 253, 304 ); + + AddButton( 10, 294, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0 ); + AddHtmlLocalized( 45, 296, 450, 20, 1060051, 0x7FFF, false, false ); // CANCEL + + if ( title > 0 ) + AddHtmlLocalized( 14, 12, 273, 20, title, 0x7FFF, false, false ); + else + AddHtmlLocalized( 14, 12, 273, 20, 1080392, 0x7FFF, false, false ); // Select your choice from the menu below. + + AddPage( 1 ); + + for ( int i = 0; i < m_Options.Count; i++ ) + { + AddButton( 19, 49 + i * 24, 0x845, 0x846, m_Options[ i ].ID, GumpButtonType.Reply, 0 ); + AddHtmlLocalized( 44, 47 + i * 24, 213, 20, m_Options[ i ].Cliloc, 0x7FFF, false, false ); + } + } + + public override void OnResponse( NetState sender, RelayInfo info ) + { + if ( m_Option != null && Contains( info.ButtonID ) ) + m_Option.OnOptionSelected( sender.Mobile, info.ButtonID ); + } + + private bool Contains( int chosen ) + { + if ( m_Options == null ) + return false; + + foreach ( RewardOption option in m_Options ) + { + if ( option.ID == chosen ) + return true; + } + + return false; + } + } + + public class RewardOption + { + private int m_ID; + private int m_Cliloc; + + public int ID{ get{ return m_ID; } } + public int Cliloc{ get{ return m_Cliloc; } } + + public RewardOption( int id, int cliloc ) + { + m_ID = id; + m_Cliloc = cliloc; + } + } + + public class RewardOptionList : List + { + public RewardOptionList() : base() + { + } + + public void Add( int id, int cliloc ) + { + Add( new RewardOption( id, cliloc ) ); + } + } +} diff --git a/Scripts/Engines/VeteranRewards/RewardSystem.cs b/Scripts/Engines/VeteranRewards/RewardSystem.cs index 9dc5312f0..cb1944e23 100644 --- a/Scripts/Engines/VeteranRewards/RewardSystem.cs +++ b/Scripts/Engines/VeteranRewards/RewardSystem.cs @@ -3,6 +3,8 @@ using Server; using Server.Items; using Server.Mobiles; using Server.Accounting; +using System.Collections; +using System.Collections.Generic; namespace Server.Engines.VeteranRewards { @@ -37,8 +39,28 @@ namespace Server.Engines.VeteranRewards public static bool SkillCapRewards = true; // assuming vet rewards are enabled, should total skill cap bonuses be awarded? (720 skills total at 4th level) public static TimeSpan RewardInterval = TimeSpan.FromDays( 30.0 ); + public static bool HasAccess( Mobile mob, RewardCategory category ) + { + List entries = category.Entries; + + for ( int j = 0; j < entries.Count; ++j ) + { + //RewardEntry entry = entries[j]; + if ( RewardSystem.HasAccess( mob, entries[j] ) ) + { + return true; + } + } + return false; + } + public static bool HasAccess( Mobile mob, RewardEntry entry ) { + if ( Core.Expansion < entry.RequiredExpansion ) + { + return false; + } + TimeSpan ts; return HasAccess( mob, entry.List, out ts ); } @@ -91,6 +113,25 @@ namespace Server.Engines.VeteranRewards return level; } + public static bool HasHalfLevel( Mobile mob ) + { + Account acct = mob.Account as Account; + + if ( acct == null ) + return false; + + return HasHalfLevel( acct ); + } + + public static bool HasHalfLevel( Account acct ) + { + TimeSpan totalTime = (DateTime.Now - acct.Created); + + Double level = (totalTime.TotalDays / RewardInterval.TotalDays); + + return level >= 0.5; + } + public static bool ConsumeRewardPoint( Mobile mob ) { int cur, max; @@ -205,6 +246,52 @@ namespace Server.Engines.VeteranRewards return true; } + public static int GetRewardYearLabel( Item item, object[] args ) + { + int level = GetRewardYear( item, args ); + int cliloc = 1076216 + level; + if( level > 9 ) + cliloc += 4231; + return cliloc; + } + + public static int GetRewardYear( Item item, object[] args ) + { + if ( m_Lists == null ) + SetupRewardTables(); + + Type type = item.GetType(); + + for ( int i = 0; i < m_Lists.Length; ++i ) + { + RewardList list = m_Lists[i]; + RewardEntry[] entries = list.Entries; + + for ( int j = 0; j < entries.Length; ++j ) + { + if ( entries[j].ItemType == type ) + { + if ( args == null && entries[j].Args.Length == 0 ) + return i + 1; + + if ( args.Length == entries[j].Args.Length ) + { + bool match = true; + + for ( int k = 0; match && k < args.Length; ++k ) + match = ( args[k].Equals( entries[j].Args[k] ) ); + + if ( match ) + return i + 1; + } + } + } + } + + // no entry? + return 0; + } + public static void SetupRewardTables() { RewardCategory monsterStatues = new RewardCategory( 1049750 ); @@ -212,6 +299,7 @@ namespace Server.Engines.VeteranRewards RewardCategory etherealSteeds = new RewardCategory( 1049751 ); RewardCategory specialDyeTubs = new RewardCategory( 1049753 ); RewardCategory houseAddOns = new RewardCategory( 1049754 ); + RewardCategory miscellaneous = new RewardCategory( 1078596 ); m_Categories = new RewardCategory[] { @@ -219,7 +307,8 @@ namespace Server.Engines.VeteranRewards cloaksAndRobes, etherealSteeds, specialDyeTubs, - houseAddOns + houseAddOns, + miscellaneous }; const int Bronze = 0x972; @@ -234,6 +323,8 @@ namespace Server.Engines.VeteranRewards const int Fire = 0x489; const int IceWhite = 0x47E; const int JetBlack = 0x001; + const int Pink = 0x490; + const int Crimson = 0x485; m_Lists = new RewardList[] { @@ -244,8 +335,10 @@ namespace Server.Engines.VeteranRewards new RewardEntry( specialDyeTubs, 1006047, typeof( SpecialDyeTub ) ), new RewardEntry( cloaksAndRobes, 1006009, typeof( RewardCloak ), Bronze, 1041286 ), new RewardEntry( cloaksAndRobes, 1006010, typeof( RewardRobe ), Bronze, 1041287 ), + new RewardEntry( cloaksAndRobes, 1080366, typeof( RewardDress ), Expansion.ML, Bronze, 1080366 ), new RewardEntry( cloaksAndRobes, 1006011, typeof( RewardCloak ), Copper, 1041288 ), new RewardEntry( cloaksAndRobes, 1006012, typeof( RewardRobe ), Copper, 1041289 ), + new RewardEntry( cloaksAndRobes, 1080367, typeof( RewardDress ), Expansion.ML, Copper, 1080367 ), new RewardEntry( monsterStatues, 1006024, typeof( MonsterStatuette ), MonsterStatuetteType.Crocodile ), new RewardEntry( monsterStatues, 1006025, typeof( MonsterStatuette ), MonsterStatuetteType.Daemon ), new RewardEntry( monsterStatues, 1006026, typeof( MonsterStatuette ), MonsterStatuetteType.Dragon ), @@ -259,71 +352,121 @@ namespace Server.Engines.VeteranRewards new RewardEntry( monsterStatues, 1006034, typeof( MonsterStatuette ), MonsterStatuetteType.Orc ), new RewardEntry( monsterStatues, 1006035, typeof( MonsterStatuette ), MonsterStatuetteType.Ratman ), new RewardEntry( monsterStatues, 1006036, typeof( MonsterStatuette ), MonsterStatuetteType.Skeleton ), - new RewardEntry( monsterStatues, 1006037, typeof( MonsterStatuette ), MonsterStatuetteType.Troll ) - //TODO: RedSoulstone - //Need to reorganize this to OSI. + new RewardEntry( monsterStatues, 1006037, typeof( MonsterStatuette ), MonsterStatuetteType.Troll ), + new RewardEntry( houseAddOns, 1062692, typeof( ContestMiniHouseDeed ), Expansion.AOS, MiniHouseType.MalasMountainPass ), + new RewardEntry( houseAddOns, 1072216, typeof( ContestMiniHouseDeed ), Expansion.SE, MiniHouseType.ChurchAtNight ), + new RewardEntry( miscellaneous, 1076155, typeof( RedSoulstone ), Expansion.ML ), + new RewardEntry( miscellaneous, 1080523, typeof( CommodityDeedBox ), Expansion.ML ), } ), new RewardList( RewardInterval, 2, new RewardEntry[] { new RewardEntry( specialDyeTubs, 1006052, typeof( LeatherDyeTub ) ), new RewardEntry( cloaksAndRobes, 1006014, typeof( RewardCloak ), Agapite, 1041290 ), new RewardEntry( cloaksAndRobes, 1006015, typeof( RewardRobe ), Agapite, 1041291 ), + new RewardEntry( cloaksAndRobes, 1080369, typeof( RewardDress ), Expansion.ML, Agapite, 1080369 ), new RewardEntry( cloaksAndRobes, 1006016, typeof( RewardCloak ), Golden, 1041292 ), - new RewardEntry( cloaksAndRobes, 1006017, typeof( RewardRobe ), Golden, 1041293 ) - /*new RewardEntry( houseAddOns, 0, typeof( BannerDeed ) ), - new RewardEntry( houseAddOns, 0, typeof( FlamingSkullDeed ) )*/ + new RewardEntry( cloaksAndRobes, 1006017, typeof( RewardRobe ), Golden, 1041293 ), + new RewardEntry( cloaksAndRobes, 1080368, typeof( RewardDress ), Expansion.ML, Golden, 1080368 ), + new RewardEntry( houseAddOns, 1006048, typeof( BannerDeed ) ), + new RewardEntry( houseAddOns, 1006049, typeof( FlamingHeadDeed ) ), + new RewardEntry( houseAddOns, 1080409, typeof( MinotaurStatueDeed ), Expansion.ML ) } ), new RewardList( RewardInterval, 3, new RewardEntry[] { new RewardEntry( cloaksAndRobes, 1006020, typeof( RewardCloak ), Verite, 1041294 ), new RewardEntry( cloaksAndRobes, 1006021, typeof( RewardRobe ), Verite, 1041295 ), + new RewardEntry( cloaksAndRobes, 1080370, typeof( RewardDress ), Expansion.ML, Verite, 1080370 ), new RewardEntry( cloaksAndRobes, 1006022, typeof( RewardCloak ), Valorite, 1041296 ), new RewardEntry( cloaksAndRobes, 1006023, typeof( RewardRobe ), Valorite, 1041297 ), + new RewardEntry( cloaksAndRobes, 1080371, typeof( RewardDress ), Expansion.ML, Valorite, 1080371 ), new RewardEntry( monsterStatues, 1006038, typeof( MonsterStatuette ), MonsterStatuetteType.Cow ), new RewardEntry( monsterStatues, 1006039, typeof( MonsterStatuette ), MonsterStatuetteType.Zombie ), new RewardEntry( monsterStatues, 1006040, typeof( MonsterStatuette ), MonsterStatuetteType.Llama ), new RewardEntry( etherealSteeds, 1006019, typeof( EtherealHorse ) ), new RewardEntry( etherealSteeds, 1006050, typeof( EtherealOstard ) ), - new RewardEntry( etherealSteeds, 1006051, typeof( EtherealLlama ) ) + new RewardEntry( etherealSteeds, 1006051, typeof( EtherealLlama ) ), + new RewardEntry( houseAddOns, 1080407, typeof( PottedCactusDeed ), Expansion.ML ) + } ), new RewardList( RewardInterval, 4, new RewardEntry[] { new RewardEntry( specialDyeTubs, 1049740, typeof( RunebookDyeTub ) ), new RewardEntry( cloaksAndRobes, 1049725, typeof( RewardCloak ), DarkGray, 1049757 ), new RewardEntry( cloaksAndRobes, 1049726, typeof( RewardRobe ), DarkGray, 1049756 ), + new RewardEntry( cloaksAndRobes, 1080374, typeof( RewardDress ), Expansion.ML, DarkGray, 1080374 ), new RewardEntry( cloaksAndRobes, 1049727, typeof( RewardCloak ), IceGreen, 1049759 ), new RewardEntry( cloaksAndRobes, 1049728, typeof( RewardRobe ), IceGreen, 1049758 ), + new RewardEntry( cloaksAndRobes, 1080372, typeof( RewardDress ), Expansion.ML, IceGreen, 1080372 ), new RewardEntry( cloaksAndRobes, 1049729, typeof( RewardCloak ), IceBlue, 1049761 ), new RewardEntry( cloaksAndRobes, 1049730, typeof( RewardRobe ), IceBlue, 1049760 ), + new RewardEntry( cloaksAndRobes, 1080373, typeof( RewardDress ), Expansion.ML, IceBlue, 1080373 ), new RewardEntry( monsterStatues, 1049742, typeof( MonsterStatuette ), MonsterStatuetteType.Ophidian ), new RewardEntry( monsterStatues, 1049743, typeof( MonsterStatuette ), MonsterStatuetteType.Reaper ), new RewardEntry( monsterStatues, 1049744, typeof( MonsterStatuette ), MonsterStatuetteType.Mongbat ), new RewardEntry( etherealSteeds, 1049746, typeof( EtherealKirin ) ), new RewardEntry( etherealSteeds, 1049745, typeof( EtherealUnicorn ) ), - new RewardEntry( etherealSteeds, 1049747, typeof( EtherealRidgeback ) ) - /*new RewardEntry( houseAddOns, 0, typeof( DecorativeShieldWallHanging ) ), - new RewardEntry( houseAddOns, 0, typeof( SkeletonWallHanging ) )*/ + new RewardEntry( etherealSteeds, 1049747, typeof( EtherealRidgeback ) ), + new RewardEntry( houseAddOns, 1049737, typeof( DecorativeShieldDeed ) ), + new RewardEntry( houseAddOns, 1049738, typeof( HangingSkeletonDeed ) ) } ), new RewardList( RewardInterval, 5, new RewardEntry[] { new RewardEntry( specialDyeTubs, 1049741, typeof( StatuetteDyeTub ) ), new RewardEntry( cloaksAndRobes, 1049731, typeof( RewardCloak ), JetBlack, 1049763 ), new RewardEntry( cloaksAndRobes, 1049732, typeof( RewardRobe ), JetBlack, 1049762 ), + new RewardEntry( cloaksAndRobes, 1080377, typeof( RewardDress ), Expansion.ML, JetBlack, 1080377 ), new RewardEntry( cloaksAndRobes, 1049733, typeof( RewardCloak ), IceWhite, 1049765 ), new RewardEntry( cloaksAndRobes, 1049734, typeof( RewardRobe ), IceWhite, 1049764 ), + new RewardEntry( cloaksAndRobes, 1080376, typeof( RewardDress ), Expansion.ML, IceWhite, 1080376 ), new RewardEntry( cloaksAndRobes, 1049735, typeof( RewardCloak ), Fire, 1049767 ), new RewardEntry( cloaksAndRobes, 1049736, typeof( RewardRobe ), Fire, 1049766 ), + new RewardEntry( cloaksAndRobes, 1080375, typeof( RewardDress ), Expansion.ML, Fire, 1080375 ), new RewardEntry( monsterStatues, 1049768, typeof( MonsterStatuette ), MonsterStatuetteType.Gazer ), new RewardEntry( monsterStatues, 1049769, typeof( MonsterStatuette ), MonsterStatuetteType.FireElemental ), new RewardEntry( monsterStatues, 1049770, typeof( MonsterStatuette ), MonsterStatuetteType.Wolf ), new RewardEntry( etherealSteeds, 1049749, typeof( EtherealSwampDragon ) ), - new RewardEntry( etherealSteeds, 1049748, typeof( EtherealBeetle ) ) - /*new RewardEntry( houseAddOns, 0, typeof( AnkhDecoration ) )*/ + new RewardEntry( etherealSteeds, 1049748, typeof( EtherealBeetle ) ), + new RewardEntry( houseAddOns, 1049739, typeof( StoneAnkhDeed ) ), + new RewardEntry( houseAddOns, 1080384, typeof( BloodyPentagramDeed ), Expansion.ML ) + } ), + new RewardList( RewardInterval, 6, new RewardEntry[] + { + new RewardEntry( houseAddOns, 1076188, typeof( CharacterStatueMaker ), Expansion.ML, StatueType.Jade ), + new RewardEntry( houseAddOns, 1076189, typeof( CharacterStatueMaker ), Expansion.ML, StatueType.Marble ), + new RewardEntry( houseAddOns, 1076190, typeof( CharacterStatueMaker ), Expansion.ML, StatueType.Bronze ), + new RewardEntry( houseAddOns, 1080527, typeof( RewardBrazierDeed ), Expansion.ML ) + } ), + new RewardList( RewardInterval, 7, new RewardEntry[] + { + new RewardEntry( houseAddOns, 1076157, typeof( CannonDeed ), Expansion.ML ), + new RewardEntry( houseAddOns, 1080550, typeof( TreeStumpDeed ), Expansion.ML ) } ), - //TODO: 6th year player statue Markers - //TODO: 7th year Decorative Cannon - //TODO: 8th year Weapon Engraving Tool - //TODO: 9th year Ridable polar bear + new RewardList( RewardInterval, 8, new RewardEntry[] + { + new RewardEntry( miscellaneous, 1076158, typeof( WeaponEngravingTool ), Expansion.ML ) + } ), + new RewardList( RewardInterval, 9, new RewardEntry[] + { + new RewardEntry( etherealSteeds, 1076159, typeof( RideablePolarBear ), Expansion.ML ), + new RewardEntry( houseAddOns, 1080549, typeof( WallBannerDeed ), Expansion.ML ) + } ), + new RewardList( RewardInterval, 10, new RewardEntry[] + { + new RewardEntry( monsterStatues, 1080520, typeof( MonsterStatuette ), Expansion.ML, MonsterStatuetteType.Harrower ), + new RewardEntry( monsterStatues, 1080521, typeof( MonsterStatuette ), Expansion.ML, MonsterStatuetteType.Efreet ), + + new RewardEntry( cloaksAndRobes, 1080382, typeof( RewardCloak ), Expansion.ML, Pink, 1080382 ), + new RewardEntry( cloaksAndRobes, 1080380, typeof( RewardRobe ), Expansion.ML, Pink, 1080380 ), + new RewardEntry( cloaksAndRobes, 1080378, typeof( RewardDress ), Expansion.ML, Pink, 1080378 ), + new RewardEntry( cloaksAndRobes, 1080383, typeof( RewardCloak ), Expansion.ML, Crimson, 1080383 ), + new RewardEntry( cloaksAndRobes, 1080381, typeof( RewardRobe ), Expansion.ML, Crimson, 1080381 ), + new RewardEntry( cloaksAndRobes, 1080379, typeof( RewardDress ), Expansion.ML, Crimson, 1080379 ), + + new RewardEntry( etherealSteeds, 1080386, typeof( EtherealCuSidhe ), Expansion.ML ), + + new RewardEntry( houseAddOns, 1080548, typeof( MiningCartDeed ), Expansion.ML ), + new RewardEntry( houseAddOns, 1080397, typeof( AnkhOfSacrificeDeed ), Expansion.ML ) + } ) }; } @@ -355,6 +498,12 @@ namespace Server.Engines.VeteranRewards e.Mobile.SkillsCap = 7000; } + if ( Core.ML && e.Mobile is PlayerMobile && !((PlayerMobile)e.Mobile).HasStatReward && HasHalfLevel( e.Mobile ) ) + { + ((PlayerMobile)e.Mobile).HasStatReward = true; + e.Mobile.StatCap += 5; + } + if ( cur < max ) e.Mobile.SendGump( new RewardNoticeGump( e.Mobile ) ); } diff --git a/Scripts/Items/Addons/BaseAddon.cs b/Scripts/Items/Addons/BaseAddon.cs index 3d9b427f8..4399555df 100644 --- a/Scripts/Items/Addons/BaseAddon.cs +++ b/Scripts/Items/Addons/BaseAddon.cs @@ -50,7 +50,7 @@ namespace Server.Items public virtual bool RetainDeedHue{ get{ return false; } } - public void OnChop( Mobile from ) + public virtual void OnChop( Mobile from ) { BaseHouse house = BaseHouse.FindHouseAt( this ); @@ -113,7 +113,7 @@ namespace Server.Items return ( CouldFit( p, map, null, ref h ) == AddonFitResult.Valid ); } - public AddonFitResult CouldFit( IPoint3D p, Map map, Mobile from, ref BaseHouse house ) + public virtual AddonFitResult CouldFit( IPoint3D p, Map map, Mobile from, ref BaseHouse house ) { if ( Deleted ) return AddonFitResult.Blocked; diff --git a/Scripts/Items/Armor/BaseArmor.cs b/Scripts/Items/Armor/BaseArmor.cs index 868255f09..2de335c00 100644 --- a/Scripts/Items/Armor/BaseArmor.cs +++ b/Scripts/Items/Armor/BaseArmor.cs @@ -97,6 +97,8 @@ namespace Server.Items public virtual int OldDexReq{ get{ return 0; } } public virtual int OldIntReq{ get{ return 0; } } + public virtual bool CanFortify{ get{ return true; } } + public override void OnAfterDuped( Item newItem ) { BaseArmor armor = newItem as BaseArmor; diff --git a/Scripts/Items/Champion Artifacts/Decorative/ArtifactLargeVase.cs b/Scripts/Items/Champion Artifacts/Decorative/ArtifactLargeVase.cs new file mode 100644 index 000000000..0dd023143 --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Decorative/ArtifactLargeVase.cs @@ -0,0 +1,32 @@ +using System; +using Server.Network; +using Server.Items; + +namespace Server.Items +{ + public class ArtifactLargeVase : Item + { + [Constructable] + public ArtifactLargeVase() : base( 0x0B47 ) + { + } + + public ArtifactLargeVase( 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/Items/Champion Artifacts/Decorative/ArtifactVase.cs b/Scripts/Items/Champion Artifacts/Decorative/ArtifactVase.cs new file mode 100644 index 000000000..c8905869b --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Decorative/ArtifactVase.cs @@ -0,0 +1,32 @@ +using System; +using Server.Network; +using Server.Items; + +namespace Server.Items +{ + public class ArtifactVase : Item + { + [Constructable] + public ArtifactVase() : base( 0x0B48 ) + { + } + + public ArtifactVase( 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/Items/Champion Artifacts/Decorative/DemonSkull.cs b/Scripts/Items/Champion Artifacts/Decorative/DemonSkull.cs new file mode 100644 index 000000000..e12ff049c --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Decorative/DemonSkull.cs @@ -0,0 +1,33 @@ +using System; +using Server.Network; +using Server.Items; + +namespace Server.Items +{ + [FlipableAttribute( 0x2250, 0x2251 )] + public class DemonSkull : Item + { + [Constructable] + public DemonSkull() : base( 0x2250 ) + { + } + + public DemonSkull( 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/Items/Champion Artifacts/Decorative/EvilIdolSkull.cs b/Scripts/Items/Champion Artifacts/Decorative/EvilIdolSkull.cs new file mode 100644 index 000000000..2e2119ea0 --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Decorative/EvilIdolSkull.cs @@ -0,0 +1,34 @@ +using System; +using Server.Network; +using Server.Items; + +namespace Server.Items +{ + public class EvilIdolSkull : Item + { + public override int LabelNumber{ get{ return 1095237; } } // Evil Idol + + [Constructable] + public EvilIdolSkull() : base( 0x1F18 ) + { + } + + public EvilIdolSkull( 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/Items/Champion Artifacts/Decorative/Futon.cs b/Scripts/Items/Champion Artifacts/Decorative/Futon.cs new file mode 100644 index 000000000..80edeb424 --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Decorative/Futon.cs @@ -0,0 +1,42 @@ +using System; +using Server; + +namespace Server.Items +{ + [Flipable] + public class Futon : Item + { + [Constructable] + public Futon() : base( Utility.RandomDouble() > 0.5 ? 0x295C : 0x295E ) + { + } + + public Futon( Serial serial ) : base( serial ) + { + } + + public void Flip() + { + switch ( ItemID ) + { + case 0x295C: ItemID = 0x295D; break; + case 0x295E: ItemID = 0x295F; break; + + case 0x295D: ItemID = 0x295C; break; + case 0x295F: ItemID = 0x295E; break; + } + } + + 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(); + } + } +} diff --git a/Scripts/Items/Champion Artifacts/Decorative/LavaTile.cs b/Scripts/Items/Champion Artifacts/Decorative/LavaTile.cs new file mode 100644 index 000000000..b6eb42663 --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Decorative/LavaTile.cs @@ -0,0 +1,32 @@ +using System; +using Server.Network; +using Server.Items; + +namespace Server.Items +{ + public class LavaTile : Item + { + [Constructable] + public LavaTile() : base( 0x12EE ) + { + } + + public LavaTile( 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/Items/Champion Artifacts/Decorative/Pier.cs b/Scripts/Items/Champion Artifacts/Decorative/Pier.cs new file mode 100644 index 000000000..7883ae112 --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Decorative/Pier.cs @@ -0,0 +1,32 @@ +using System; +using Server.Network; +using Server.Items; + +namespace Server.Items +{ + public class Pier : Item + { + [Constructable] + public Pier() : base( 0x03AE ) + { + } + + public Pier( 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/Items/Champion Artifacts/Decorative/SkullPole.cs b/Scripts/Items/Champion Artifacts/Decorative/SkullPole.cs new file mode 100644 index 000000000..b31446feb --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Decorative/SkullPole.cs @@ -0,0 +1,33 @@ +using System; +using Server.Network; +using Server.Items; + +namespace Server.Items +{ + public class SkullPole : Item + { + [Constructable] + public SkullPole() : base( 0x2204 ) + { + Weight = 5; + } + + public SkullPole( 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/Items/Champion Artifacts/Decorative/SwampTile.cs b/Scripts/Items/Champion Artifacts/Decorative/SwampTile.cs new file mode 100644 index 000000000..eff83d309 --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Decorative/SwampTile.cs @@ -0,0 +1,32 @@ +using System; +using Server.Network; +using Server.Items; + +namespace Server.Items +{ + public class SwampTile : Item + { + [Constructable] + public SwampTile() : base( 0x320D ) + { + } + + public SwampTile( 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/Items/Champion Artifacts/Decorative/TatteredAncientMummyWrapping.cs b/Scripts/Items/Champion Artifacts/Decorative/TatteredAncientMummyWrapping.cs new file mode 100644 index 000000000..5945c4f7b --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Decorative/TatteredAncientMummyWrapping.cs @@ -0,0 +1,35 @@ +using System; +using Server.Network; +using Server.Items; + +namespace Server.Items +{ + public class TatteredAncientMummyWrapping : Item + { + public override int LabelNumber{ get{ return 1094912; } } // Tattered Ancient Mummy Wrapping [Replica] + + [Constructable] + public TatteredAncientMummyWrapping() : base( 0xE21 ) + { + Hue = 0x909; + } + + public TatteredAncientMummyWrapping( 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/Items/Champion Artifacts/Decorative/WallBlood.cs b/Scripts/Items/Champion Artifacts/Decorative/WallBlood.cs new file mode 100644 index 000000000..31d7a0f2c --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Decorative/WallBlood.cs @@ -0,0 +1,32 @@ +using System; +using Server.Network; +using Server.Items; + +namespace Server.Items +{ + public class WallBlood : Item + { + [Constructable] + public WallBlood() : base( 0x1D95 ) + { + } + + public WallBlood( 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/Items/Champion Artifacts/Decorative/WaterTile.cs b/Scripts/Items/Champion Artifacts/Decorative/WaterTile.cs new file mode 100644 index 000000000..ce64be38e --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Decorative/WaterTile.cs @@ -0,0 +1,32 @@ +using System; +using Server.Network; +using Server.Items; + +namespace Server.Items +{ + public class WaterTile : Item + { + [Constructable] + public WaterTile() : base( 0x346E ) + { + } + + public WaterTile( 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/Items/Champion Artifacts/Decorative/Web.cs b/Scripts/Items/Champion Artifacts/Decorative/Web.cs new file mode 100644 index 000000000..aad2f0e8d --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Decorative/Web.cs @@ -0,0 +1,29 @@ +using System; +using Server; + +namespace Server.Items +{ + public class Web : Item + { + [Constructable] + public Web() : base( 0x10DD ) + { + } + + public Web( Serial serial ) : base( serial ) + { + } + + 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(); + } + } +} diff --git a/Scripts/Items/Champion Artifacts/Decorative/WindSpirit.cs b/Scripts/Items/Champion Artifacts/Decorative/WindSpirit.cs new file mode 100644 index 000000000..c244576d0 --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Decorative/WindSpirit.cs @@ -0,0 +1,34 @@ +using System; +using Server.Network; +using Server.Items; + +namespace Server.Items +{ + public class WindSpirit : Item + { + public override int LabelNumber{ get{ return 1094925; } } // Wind Spirit [Replica] + + [Constructable] + public WindSpirit() : base( 0x1F1F ) + { + } + + public WindSpirit( 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/Items/Champion Artifacts/Shared/ANecromancerShroud.cs b/Scripts/Items/Champion Artifacts/Shared/ANecromancerShroud.cs new file mode 100644 index 000000000..3973058c3 --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Shared/ANecromancerShroud.cs @@ -0,0 +1,41 @@ +using System; +using Server; + +namespace Server.Items +{ + public class ANecromancerShroud : Robe + { + public override int LabelNumber{ get{ return 1094913; } } // A Necromancer Shroud [Replica] + + public override int BaseColdResistance{ get{ return 5; } } + + public override int InitMinHits{ get{ return 150; } } + public override int InitMaxHits{ get{ return 150; } } + + public override bool CanFortify{ get{ return false; } } + + [Constructable] + public ANecromancerShroud() + { + Hue = 0x1; + } + + public ANecromancerShroud( Serial serial ) : base( serial ) + { + } + + 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(); + } + } +} diff --git a/Scripts/Items/Champion Artifacts/Shared/BraveKnightOfTheBritannia.cs b/Scripts/Items/Champion Artifacts/Shared/BraveKnightOfTheBritannia.cs new file mode 100644 index 000000000..9573b19d5 --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Shared/BraveKnightOfTheBritannia.cs @@ -0,0 +1,53 @@ +using System; +using Server; + +namespace Server.Items +{ + public class BraveKnightOfTheBritannia : Katana + { + public override int LabelNumber{ get{ return 1094909; } } // Brave Knight of The Britannia [Replica] + + public override int InitMinHits{ get{ return 150; } } + public override int InitMaxHits{ get{ return 150; } } + + public override bool CanFortify{ get{ return false; } } + + [Constructable] + public BraveKnightOfTheBritannia() + { + Attributes.WeaponSpeed = 30; + Attributes.WeaponDamage = 35; + + WeaponAttributes.HitLeechStam = 48; + WeaponAttributes.HitHarm = 26; + WeaponAttributes.HitLeechHits = 22; + } + + public override void GetDamageTypes( Mobile wielder, out int phys, out int fire, out int cold, out int pois, out int nrgy ) + { + phys = 0; + fire = 40; + cold = 30; + pois = 10; + nrgy = 20; + } + + public BraveKnightOfTheBritannia( Serial serial ) : base( serial ) + { + } + + 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(); + } + } +} diff --git a/Scripts/Items/Champion Artifacts/Shared/CaptainJohnsHat.cs b/Scripts/Items/Champion Artifacts/Shared/CaptainJohnsHat.cs new file mode 100644 index 000000000..9074874c3 --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Shared/CaptainJohnsHat.cs @@ -0,0 +1,52 @@ +using System; +using Server; + +namespace Server.Items +{ + public class CaptainJohnsHat : TricorneHat + { + public override int LabelNumber{ get{ return 1094911; } } // Captain John's Hat [Replica] + + public override int BasePhysicalResistance{ get{ return 2; } } + public override int BaseFireResistance{ get{ return 6; } } + public override int BaseColdResistance{ get{ return 9; } } + public override int BasePoisonResistance{ get{ return 7; } } + public override int BaseEnergyResistance{ get{ return 23; } } + + public override int InitMinHits{ get{ return 150; } } + public override int InitMaxHits{ get{ return 150; } } + + public override bool CanFortify{ get{ return false; } } + + [Constructable] + public CaptainJohnsHat() + { + Hue = 0x1; + + Attributes.BonusDex = 8; + Attributes.NightSight = 1; + Attributes.AttackChance = 15; + + SkillBonuses.Skill_1_Name = SkillName.Swords; + SkillBonuses.Skill_1_Value = 20; + } + + public CaptainJohnsHat( Serial serial ) : base( serial ) + { + } + + 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(); + } + } +} diff --git a/Scripts/Items/Champion Artifacts/Shared/DetectiveBoots.cs b/Scripts/Items/Champion Artifacts/Shared/DetectiveBoots.cs new file mode 100644 index 000000000..97069aba3 --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Shared/DetectiveBoots.cs @@ -0,0 +1,50 @@ +using System; +using Server; + +namespace Server.Items +{ + public class DetectiveBoots : Boots + { + public override int LabelNumber{ get{ return 1094894 + m_Level; } } // [Quality] Detective of the Royal Guard [Replica] + + public override int InitMinHits{ get{ return 150; } } + public override int InitMaxHits{ get{ return 150; } } + + public override bool CanFortify{ get{ return false; } } + + private int m_Level; + + [CommandProperty( AccessLevel.GameMaster )] + public int Level + { + get{ return m_Level; } + set{ m_Level = Math.Max( Math.Min( 2, value), 0 ); Attributes.BonusInt = 2 + m_Level; InvalidateProperties(); } + } + + [Constructable] + public DetectiveBoots() + { + Level = Utility.RandomMinMax( 0, 2 ); + } + + public DetectiveBoots( Serial serial ) : base( serial ) + { + } + + 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(); + + Level = Attributes.BonusInt - 2; + } + } +} diff --git a/Scripts/Items/Champion Artifacts/Shared/DjinnisRing.cs b/Scripts/Items/Champion Artifacts/Shared/DjinnisRing.cs new file mode 100644 index 000000000..c46ee10d0 --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Shared/DjinnisRing.cs @@ -0,0 +1,39 @@ +using System; +using Server; + +namespace Server.Items +{ + public class DjinnisRing : SilverRing + { + public override int LabelNumber{ get{ return 1094927; } } // Djinni's Ring [Replica] + + public override int InitMinHits{ get{ return 150; } } + public override int InitMaxHits{ get{ return 150; } } + + [Constructable] + public DjinnisRing() + { + Attributes.BonusInt = 5; + Attributes.SpellDamage = 10; + Attributes.CastSpeed = 2; + } + + public DjinnisRing( Serial serial ) : base( serial ) + { + } + + 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(); + } + } +} diff --git a/Scripts/Items/Champion Artifacts/Shared/EmbroideredOakLeafCloak.cs b/Scripts/Items/Champion Artifacts/Shared/EmbroideredOakLeafCloak.cs new file mode 100644 index 000000000..bb258b860 --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Shared/EmbroideredOakLeafCloak.cs @@ -0,0 +1,43 @@ +using System; +using Server; + +namespace Server.Items +{ + public class EmbroideredOakLeafCloak : BaseOuterTorso + { + public override int LabelNumber{ get{ return 1094901; } } // Embroidered Oak Leaf Cloak [Replica] + + public override int InitMinHits{ get{ return 150; } } + public override int InitMaxHits{ get{ return 150; } } + + public override bool CanFortify{ get{ return false; } } + + [Constructable] + public EmbroideredOakLeafCloak() : base( 0x2684 ) + { + Hue = 0x557; + StrRequirement = 0; + + SkillBonuses.Skill_1_Name = SkillName.Stealth; + SkillBonuses.Skill_1_Value = 5; + } + + public EmbroideredOakLeafCloak( Serial serial ) : base( serial ) + { + } + + 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(); + } + } +} diff --git a/Scripts/Items/Champion Artifacts/Shared/GuantletsOfAnger.cs b/Scripts/Items/Champion Artifacts/Shared/GuantletsOfAnger.cs new file mode 100644 index 000000000..cddfc958d --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Shared/GuantletsOfAnger.cs @@ -0,0 +1,49 @@ +using System; +using Server; + +namespace Server.Items +{ + public class GuantletsOfAnger : PlateGloves + { + public override int LabelNumber{ get{ return 1094902; } } // Gauntlets of Anger [Replica] + + public override int BasePhysicalResistance{ get{ return 4; } } + public override int BaseFireResistance{ get{ return 4; } } + public override int BaseColdResistance{ get{ return 5; } } + public override int BasePoisonResistance{ get{ return 6; } } + public override int BaseEnergyResistance{ get{ return 5; } } + + public override int InitMinHits{ get{ return 150; } } + public override int InitMaxHits{ get{ return 150; } } + + public override bool CanFortify{ get{ return false; } } + + [Constructable] + public GuantletsOfAnger() + { + Hue = 0x557; + + Attributes.BonusHits = 8; + Attributes.RegenHits = 2; + Attributes.DefendChance = 10; + } + + public GuantletsOfAnger( Serial serial ) : base( serial ) + { + } + + 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(); + } + } +} diff --git a/Scripts/Items/Champion Artifacts/Shared/LieutenantOfTheBritannianRoyalGuard.cs b/Scripts/Items/Champion Artifacts/Shared/LieutenantOfTheBritannianRoyalGuard.cs new file mode 100644 index 000000000..df6b0d4c9 --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Shared/LieutenantOfTheBritannianRoyalGuard.cs @@ -0,0 +1,43 @@ +using System; +using Server; + +namespace Server.Items +{ + public class LieutenantOfTheBritannianRoyalGuard : BodySash + { + public override int LabelNumber{ get{ return 1094910; } } // Lieutenant of the Britannian Royal Guard [Replica] + + public override int InitMinHits{ get{ return 150; } } + public override int InitMaxHits{ get{ return 150; } } + + public override bool CanFortify{ get{ return false; } } + + [Constructable] + public LieutenantOfTheBritannianRoyalGuard() + { + Hue = 0x7B; + + Attributes.BonusInt = 5; + Attributes.RegenMana = 2; + Attributes.LowerRegCost = 10; + } + + public LieutenantOfTheBritannianRoyalGuard( Serial serial ) : base( serial ) + { + } + + 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(); + } + } +} diff --git a/Scripts/Items/Champion Artifacts/Shared/OblivionsNeedle.cs b/Scripts/Items/Champion Artifacts/Shared/OblivionsNeedle.cs new file mode 100644 index 000000000..8c75cb5ab --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Shared/OblivionsNeedle.cs @@ -0,0 +1,44 @@ +using System; +using Server; + +namespace Server.Items +{ + public class OblivionsNeedle : Dagger + { + public override int LabelNumber{ get{ return 1094916; } } // Oblivion's Needle [Replica] + + public override int InitMinHits{ get{ return 150; } } + public override int InitMaxHits{ get{ return 150; } } + + public override bool CanFortify{ get{ return false; } } + + [Constructable] + public OblivionsNeedle() + { + Attributes.BonusStam = 20; + Attributes.AttackChance = 20; + Attributes.DefendChance = -20; + Attributes.WeaponDamage = 40; + + WeaponAttributes.HitLeechStam = 50; + } + + public OblivionsNeedle( Serial serial ) : base( serial ) + { + } + + 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(); + } + } +} diff --git a/Scripts/Items/Champion Artifacts/Shared/RoyalGuardSurvivalKnife.cs b/Scripts/Items/Champion Artifacts/Shared/RoyalGuardSurvivalKnife.cs new file mode 100644 index 000000000..51149c9f0 --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Shared/RoyalGuardSurvivalKnife.cs @@ -0,0 +1,44 @@ +using System; +using Server; + +namespace Server.Items +{ + public class RoyalGuardSurvivalKnife : SkinningKnife + { + public override int LabelNumber{ get{ return 1094918; } } // Royal Guard Survival Knife [Replica] + + public override int InitMinHits{ get{ return 150; } } + public override int InitMaxHits{ get{ return 150; } } + + public override bool CanFortify{ get{ return false; } } + + [Constructable] + public RoyalGuardSurvivalKnife() + { + Attributes.SpellChanneling = 1; + Attributes.Luck = 140; + Attributes.EnhancePotions = 25; + + WeaponAttributes.UseBestSkill = 1; + WeaponAttributes.LowerStatReq = 50; + } + + public RoyalGuardSurvivalKnife( Serial serial ) : base( serial ) + { + } + + 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(); + } + } +} diff --git a/Scripts/Items/Champion Artifacts/Shared/SamaritanRobe.cs b/Scripts/Items/Champion Artifacts/Shared/SamaritanRobe.cs new file mode 100644 index 000000000..457397068 --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Shared/SamaritanRobe.cs @@ -0,0 +1,41 @@ +using System; +using Server; + +namespace Server.Items +{ + public class SamaritanRobe : Robe + { + public override int LabelNumber{ get{ return 1094926; } } // Good Samaritan of Britannia [Replica] + + public override int BasePhysicalResistance{ get{ return 5; } } + + public override int InitMinHits{ get{ return 150; } } + public override int InitMaxHits{ get{ return 150; } } + + public override bool CanFortify{ get{ return false; } } + + [Constructable] + public SamaritanRobe() + { + Hue = 0x558; + } + + public SamaritanRobe( Serial serial ) : base( serial ) + { + } + + 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(); + } + } +} diff --git a/Scripts/Items/Champion Artifacts/Shared/TheMostKnowledgePerson.cs b/Scripts/Items/Champion Artifacts/Shared/TheMostKnowledgePerson.cs new file mode 100644 index 000000000..313121dd1 --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Shared/TheMostKnowledgePerson.cs @@ -0,0 +1,44 @@ +using System; +using Server; + +namespace Server.Items +{ + public class TheMostKnowledgePerson : BaseOuterTorso + { + public override int LabelNumber{ get{ return 1094893; } } // The Most Knowledge Person [Replica] + + public override int InitMinHits{ get{ return 150; } } + public override int InitMaxHits{ get{ return 150; } } + + public override bool CanFortify{ get{ return false; } } + + public override bool CanBeBlessed{ get{ return false; } } + + [Constructable] + public TheMostKnowledgePerson() : base( 0x2684 ) + { + Hue = 0x242; + StrRequirement = 0; + + Attributes.BonusHits = 3 + Utility.RandomMinMax( 0, 2 ); + } + + public TheMostKnowledgePerson( Serial serial ) : base( serial ) + { + } + + 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(); + } + } +} diff --git a/Scripts/Items/Champion Artifacts/Shared/TheRobeOfBritanniaAri.cs b/Scripts/Items/Champion Artifacts/Shared/TheRobeOfBritanniaAri.cs new file mode 100644 index 000000000..91191f67d --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Shared/TheRobeOfBritanniaAri.cs @@ -0,0 +1,42 @@ +using System; +using Server; + +namespace Server.Items +{ + public class TheRobeOfBritanniaAri : BaseOuterTorso + { + public override int LabelNumber{ get{ return 1094931; } } // The Robe of Britannia "Ari" [Replica] + + public override int BasePhysicalResistance{ get{ return 10; } } + + public override int InitMinHits{ get{ return 150; } } + public override int InitMaxHits{ get{ return 150; } } + + public override bool CanFortify{ get{ return false; } } + + [Constructable] + public TheRobeOfBritanniaAri() : base( 0x2684 ) + { + Hue = 0x486; + StrRequirement = 0; + } + + public TheRobeOfBritanniaAri( Serial serial ) : base( serial ) + { + } + + 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(); + } + } +} diff --git a/Scripts/Items/Champion Artifacts/Unique/AcidProofRobe.cs b/Scripts/Items/Champion Artifacts/Unique/AcidProofRobe.cs new file mode 100644 index 000000000..f6f17521c --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Unique/AcidProofRobe.cs @@ -0,0 +1,42 @@ +using System; +using Server; + +namespace Server.Items +{ + public class AcidProofRobe : Robe + { + public override int LabelNumber{ get{ return 1095236; } } // Acid-Proof Robe [Replica] + + public override int BaseFireResistance{ get{ return 4; } } + + public override int InitMinHits{ get{ return 150; } } + public override int InitMaxHits{ get{ return 150; } } + + public override bool CanFortify{ get{ return false; } } + + [Constructable] + public AcidProofRobe() + { + Hue = 0x1; + LootType = LootType.Blessed; + } + + public AcidProofRobe( Serial serial ) : base( serial ) + { + } + + 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(); + } + } +} diff --git a/Scripts/Items/Champion Artifacts/Unique/Calm.cs b/Scripts/Items/Champion Artifacts/Unique/Calm.cs new file mode 100644 index 000000000..8b24ce5e5 --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Unique/Calm.cs @@ -0,0 +1,44 @@ +using System; +using Server; + +namespace Server.Items +{ + public class Calm : Halberd + { + public override int LabelNumber{ get{ return 1094915; } } // Calm [Replica] + + public override int InitMinHits{ get{ return 150; } } + public override int InitMaxHits{ get{ return 150; } } + + public override bool CanFortify{ get{ return false; } } + + [Constructable] + public Calm() + { + Attributes.SpellChanneling = 1; + Attributes.WeaponSpeed = 20; + Attributes.WeaponDamage = 50; + + WeaponAttributes.HitLeechMana = 100; + WeaponAttributes.UseBestSkill = 1; + } + + public Calm( Serial serial ) : base( serial ) + { + } + + 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(); + } + } +} diff --git a/Scripts/Items/Champion Artifacts/Unique/CrownOfTalKeesh.cs b/Scripts/Items/Champion Artifacts/Unique/CrownOfTalKeesh.cs new file mode 100644 index 000000000..b08c87876 --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Unique/CrownOfTalKeesh.cs @@ -0,0 +1,49 @@ +using System; +using Server; + +namespace Server.Items +{ + public class CrownOfTalKeesh : Bandana + { + public override int LabelNumber{ get{ return 1094903; } } // Crown of Tal'Keesh [Replica] + + public override int BasePhysicalResistance{ get{ return 0; } } + public override int BaseFireResistance{ get{ return 5; } } + public override int BaseColdResistance{ get{ return 9; } } + public override int BasePoisonResistance{ get{ return 20; } } + public override int BaseEnergyResistance{ get{ return 20; } } + + public override int InitMinHits{ get{ return 150; } } + public override int InitMaxHits{ get{ return 150; } } + + public override bool CanFortify{ get{ return false; } } + + [Constructable] + public CrownOfTalKeesh() + { + Hue = 0x4F2; + + Attributes.BonusInt = 8; + Attributes.RegenMana = 4; + Attributes.SpellDamage = 10; + } + + public CrownOfTalKeesh( Serial serial ) : base( serial ) + { + } + + 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(); + } + } +} diff --git a/Scripts/Items/Champion Artifacts/Unique/FangOfRactus.cs b/Scripts/Items/Champion Artifacts/Unique/FangOfRactus.cs new file mode 100644 index 000000000..ce4f5d007 --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Unique/FangOfRactus.cs @@ -0,0 +1,47 @@ +using System; +using Server; + +namespace Server.Items +{ + public class FangOfRactus : Kryss + { + public override int LabelNumber{ get{ return 1094892; } } // Fang of Ractus [Replica] + + public override int InitMinHits{ get{ return 150; } } + public override int InitMaxHits{ get{ return 150; } } + + public override bool CanFortify{ get{ return false; } } + + [Constructable] + public FangOfRactus() + { + Hue = 0x1D9; + + Attributes.SpellChanneling = 1; + Attributes.AttackChance = 5; + Attributes.DefendChance = 5; + Attributes.WeaponDamage = 35; + + WeaponAttributes.HitPoisonArea = 20; + WeaponAttributes.ResistPoisonBonus = 15; + } + + public FangOfRactus( Serial serial ) : base( serial ) + { + } + + 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(); + } + } +} diff --git a/Scripts/Items/Champion Artifacts/Unique/GladiatorsCollar.cs b/Scripts/Items/Champion Artifacts/Unique/GladiatorsCollar.cs new file mode 100644 index 000000000..4b8f7d6a0 --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Unique/GladiatorsCollar.cs @@ -0,0 +1,50 @@ +using System; +using Server; + +namespace Server.Items +{ + public class GladiatorsCollar : PlateGorget + { + public override int LabelNumber{ get{ return 1094917; } } // Gladiator's Collar [Replica] + + public override int BasePhysicalResistance{ get{ return 18; } } + public override int BaseFireResistance{ get{ return 18; } } + public override int BaseColdResistance{ get{ return 17; } } + public override int BasePoisonResistance{ get{ return 18; } } + public override int BaseEnergyResistance{ get{ return 16; } } + + public override int InitMinHits{ get{ return 150; } } + public override int InitMaxHits{ get{ return 150; } } + + public override bool CanFortify{ get{ return false; } } + + [Constructable] + public GladiatorsCollar() + { + Hue = 0x967; + + Attributes.BonusHits = 10; + Attributes.AttackChance = 10; + + ArmorAttributes.MageArmor = 1; + } + + public GladiatorsCollar( Serial serial ) : base( serial ) + { + } + + 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(); + } + } +} diff --git a/Scripts/Items/Champion Artifacts/Unique/OrcChieftainHelm.cs b/Scripts/Items/Champion Artifacts/Unique/OrcChieftainHelm.cs new file mode 100644 index 000000000..bff4aade4 --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Unique/OrcChieftainHelm.cs @@ -0,0 +1,49 @@ +using System; +using Server; + +namespace Server.Items +{ + public class OrcChieftainHelm : OrcHelm + { + public override int LabelNumber{ get{ return 1094924; } } // Orc Chieftain Helm [Replica] + + public override int BasePhysicalResistance{ get{ return 23; } } + public override int BaseFireResistance{ get{ return 1; } } + public override int BaseColdResistance{ get{ return 23; } } + public override int BasePoisonResistance{ get{ return 3; } } + public override int BaseEnergyResistance{ get{ return 5; } } + + public override int InitMinHits{ get{ return 150; } } + public override int InitMaxHits{ get{ return 150; } } + + public override bool CanFortify{ get{ return false; } } + + [Constructable] + public OrcChieftainHelm() + { + Hue = 0x3F; + + Attributes.Luck = 100; + Attributes.BonusHits = 30; + Attributes.RegenHits = 3; + } + + public OrcChieftainHelm( Serial serial ) : base( serial ) + { + } + + 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(); + } + } +} diff --git a/Scripts/Items/Champion Artifacts/Unique/Pacify.cs b/Scripts/Items/Champion Artifacts/Unique/Pacify.cs new file mode 100644 index 000000000..1456c8574 --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Unique/Pacify.cs @@ -0,0 +1,45 @@ +using System; +using Server; + +namespace Server.Items +{ + public class Pacify : Pike + { + public override int LabelNumber{ get{ return 1094929; } } // Pacify [Replica] + + public override int InitMinHits{ get{ return 150; } } + public override int InitMaxHits{ get{ return 150; } } + + public override bool CanFortify{ get{ return false; } } + + [Constructable] + public Pacify() + { + Attributes.SpellChanneling = 1; + Attributes.AttackChance = 10; + Attributes.WeaponSpeed = 20; + Attributes.WeaponDamage = 50; + + WeaponAttributes.HitLeechMana = 100; + WeaponAttributes.UseBestSkill = 1; + } + + public Pacify( Serial serial ) : base( serial ) + { + } + + 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(); + } + } +} diff --git a/Scripts/Items/Champion Artifacts/Unique/Quell.cs b/Scripts/Items/Champion Artifacts/Unique/Quell.cs new file mode 100644 index 000000000..00c84cf9d --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Unique/Quell.cs @@ -0,0 +1,45 @@ +using System; +using Server; + +namespace Server.Items +{ + public class Quell : Bardiche + { + public override int LabelNumber{ get{ return 1094928; } } // Quell [Replica] + + public override int InitMinHits{ get{ return 150; } } + public override int InitMaxHits{ get{ return 150; } } + + public override bool CanFortify{ get{ return false; } } + + [Constructable] + public Quell() + { + Attributes.SpellChanneling = 1; + Attributes.WeaponSpeed = 20; + Attributes.WeaponDamage = 50; + Attributes.AttackChance = 10; + + WeaponAttributes.HitLeechMana = 100; + WeaponAttributes.UseBestSkill = 1; + } + + public Quell( Serial serial ) : base( serial ) + { + } + + 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(); + } + } +} diff --git a/Scripts/Items/Champion Artifacts/Unique/ShroudOfDeceit.cs b/Scripts/Items/Champion Artifacts/Unique/ShroudOfDeceit.cs new file mode 100644 index 000000000..0a453df90 --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Unique/ShroudOfDeceit.cs @@ -0,0 +1,52 @@ +using System; +using Server; + +namespace Server.Items +{ + public class ShroudOfDeciet : BoneChest + { + public override int LabelNumber{ get{ return 1094914; } } // Shroud of Deceit [Replica] + + public override int BasePhysicalResistance{ get{ return 11; } } + public override int BaseFireResistance{ get{ return 6; } } + public override int BaseColdResistance{ get{ return 18; } } + public override int BasePoisonResistance{ get{ return 15; } } + public override int BaseEnergyResistance{ get{ return 13; } } + + public override int InitMinHits{ get{ return 150; } } + public override int InitMaxHits{ get{ return 150; } } + + public override bool CanFortify{ get{ return false; } } + + [Constructable] + public ShroudOfDeciet() + { + Hue = 0x3D5; + + Attributes.RegenHits = 3; + + ArmorAttributes.MageArmor = 1; + + SkillBonuses.Skill_1_Name = SkillName.MagicResist; + SkillBonuses.Skill_1_Value = 10; + } + + public ShroudOfDeciet( Serial serial ) : base( serial ) + { + } + + 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(); + } + } +} diff --git a/Scripts/Items/Champion Artifacts/Unique/Subdue.cs b/Scripts/Items/Champion Artifacts/Unique/Subdue.cs new file mode 100644 index 000000000..6f8f4eecd --- /dev/null +++ b/Scripts/Items/Champion Artifacts/Unique/Subdue.cs @@ -0,0 +1,45 @@ +using System; +using Server; + +namespace Server.Items +{ + public class Subdue : Scythe + { + public override int LabelNumber{ get{ return 1094930; } } // Subdue [Replica] + + public override int InitMinHits{ get{ return 150; } } + public override int InitMaxHits{ get{ return 150; } } + + public override bool CanFortify{ get{ return false; } } + + [Constructable] + public Subdue() + { + Attributes.SpellChanneling = 1; + Attributes.WeaponSpeed = 20; + Attributes.WeaponDamage = 50; + Attributes.AttackChance = 10; + + WeaponAttributes.HitLeechMana = 100; + WeaponAttributes.UseBestSkill = 1; + } + + public Subdue( Serial serial ) : base( serial ) + { + } + + 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(); + } + } +} diff --git a/Scripts/Items/Clothing/BaseClothing.cs b/Scripts/Items/Clothing/BaseClothing.cs index 29b94d3db..60ca2df68 100644 --- a/Scripts/Items/Clothing/BaseClothing.cs +++ b/Scripts/Items/Clothing/BaseClothing.cs @@ -41,6 +41,7 @@ namespace Server.Items } #endregion + public virtual bool CanFortify{ get{ return false; } } private int m_MaxHitPoints; private int m_HitPoints; diff --git a/Scripts/Items/Clothing/Cloaks.cs b/Scripts/Items/Clothing/Cloaks.cs index 1311c059b..b0af4b482 100644 --- a/Scripts/Items/Clothing/Cloaks.cs +++ b/Scripts/Items/Clothing/Cloaks.cs @@ -1,4 +1,5 @@ using System; +using Server.Engines.VeteranRewards; namespace Server.Items { @@ -155,7 +156,7 @@ namespace Server.Items } [Flipable] - public class RewardCloak : BaseCloak, Engines.VeteranRewards.IRewardItem + public class RewardCloak : BaseCloak, IRewardItem { private int m_LabelNumber; private bool m_IsRewardItem; @@ -209,6 +210,14 @@ namespace Server.Items return false; } + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( Core.ML && m_IsRewardItem ) + list.Add( RewardSystem.GetRewardYearLabel( this, new object[]{ Hue, m_LabelNumber } ) ); // X Year Veteran Reward + } + public override bool CanEquip( Mobile m ) { if ( !base.CanEquip( m ) ) diff --git a/Scripts/Items/Clothing/OuterTorso.cs b/Scripts/Items/Clothing/OuterTorso.cs index abea21309..e3451ac54 100644 --- a/Scripts/Items/Clothing/OuterTorso.cs +++ b/Scripts/Items/Clothing/OuterTorso.cs @@ -1,4 +1,5 @@ using System; +using Server.Engines.VeteranRewards; namespace Server.Items { @@ -140,7 +141,7 @@ namespace Server.Items } [Flipable] - public class RewardRobe : BaseOuterTorso, Engines.VeteranRewards.IRewardItem + public class RewardRobe : BaseOuterTorso, IRewardItem { private int m_LabelNumber; private bool m_IsRewardItem; @@ -194,12 +195,20 @@ namespace Server.Items return false; } + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( Core.ML && m_IsRewardItem ) + list.Add( RewardSystem.GetRewardYearLabel( this, new object[]{ Hue, m_LabelNumber } ) ); // X Year Veteran Reward + } + public override bool CanEquip( Mobile m ) { if ( !base.CanEquip( m ) ) return false; - return !m_IsRewardItem || Engines.VeteranRewards.RewardSystem.CheckIsUsableBy( m, this, new object[]{ Hue, m_LabelNumber } ); + return !m_IsRewardItem || RewardSystem.CheckIsUsableBy( m, this, new object[]{ Hue, m_LabelNumber } ); } [Constructable] @@ -256,6 +265,131 @@ namespace Server.Items } } + [Flipable] + public class RewardDress : BaseOuterTorso, IRewardItem + { + private int m_LabelNumber; + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; } + } + + [CommandProperty( AccessLevel.GameMaster )] + public int Number + { + get{ return m_LabelNumber; } + set{ m_LabelNumber = value; InvalidateProperties(); } + } + + public override int LabelNumber + { + get + { + if ( m_LabelNumber > 0 ) + return m_LabelNumber; + + return base.LabelNumber; + } + } + + public override int BasePhysicalResistance{ get{ return 3; } } + + public override void OnAdded( object parent ) + { + base.OnAdded( parent ); + + if ( parent is Mobile ) + ((Mobile)parent).VirtualArmorMod += 2; + } + + public override void OnRemoved(object parent) + { + base.OnRemoved( parent ); + + if ( parent is Mobile ) + ((Mobile)parent).VirtualArmorMod -= 2; + } + + public override bool Dye( Mobile from, DyeTub sender ) + { + from.SendLocalizedMessage( sender.FailMessage ); + return false; + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_IsRewardItem ) + list.Add( RewardSystem.GetRewardYearLabel( this, new object[]{ Hue, m_LabelNumber } ) ); // X Year Veteran Reward + } + + public override bool CanEquip( Mobile m ) + { + if ( !base.CanEquip( m ) ) + return false; + + return !m_IsRewardItem || RewardSystem.CheckIsUsableBy( m, this, new object[]{ Hue, m_LabelNumber } ); + } + + [Constructable] + public RewardDress() : this( 0 ) + { + } + + [Constructable] + public RewardDress( int hue ) : this( hue, 0 ) + { + } + + [Constructable] + public RewardDress( int hue, int labelNumber ) : base( 0x1F01, hue ) + { + Weight = 2.0; + LootType = LootType.Blessed; + + m_LabelNumber = labelNumber; + } + + public RewardDress( Serial serial ) : base( serial ) + { + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.Write( (int) 0 ); // version + + writer.Write( (int) m_LabelNumber ); + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadInt(); + + switch ( version ) + { + case 0: + { + m_LabelNumber = reader.ReadInt(); + m_IsRewardItem = reader.ReadBool(); + break; + } + } + + if ( Parent is Mobile ) + ((Mobile)Parent).VirtualArmorMod += 2; + } + } + [Flipable] public class Robe : BaseOuterTorso, IArcaneEquip { diff --git a/Scripts/Items/Deeds/CommodityDeed.cs b/Scripts/Items/Deeds/CommodityDeed.cs index fd5154721..8e0ddf190 100644 --- a/Scripts/Items/Deeds/CommodityDeed.cs +++ b/Scripts/Items/Deeds/CommodityDeed.cs @@ -122,7 +122,9 @@ namespace Server.Items int number; BankBox box = from.FindBankNoCreate(); - + CommodityDeedBox cox = CommodityDeedBox.Find( this ); + + // Veteran Rewards mods if ( m_Commodity != null ) { if ( box != null && IsChildOf( box ) ) @@ -134,14 +136,46 @@ namespace Server.Items m_Commodity = null; Delete(); } + else if ( cox != null ) + { + if ( cox.IsSecure ) + { + number = 1047031; // The commodity has been redeemed. + + cox.DropItem( m_Commodity ); + + m_Commodity = null; + Delete(); + } + else + number = 1080525; // The commodity deed box must be secured before you can use it. + } else { - number = 1047024; // To claim the resources .... + if( Core.ML ) + { + number = 1080526; // That must be in your bank box or commodity deed box to use it. + } + else + { + number = 1047024; // To claim the resources .... + } } } - else if ( box == null || !IsChildOf( box ) ) + else if ( cox != null && !cox.IsSecure ) { - number = 1047026; // That must be in your bank box to use it. + number = 1080525; // The commodity deed box must be secured before you can use it. + } + else if ( ( box == null || !IsChildOf( box ) ) && cox == null ) + { + if( Core.ML ) + { + number = 1080526; // That must be in your bank box or commodity deed box to use it. + } + else + { + number = 1047026; // That must be in your bank box to use it. + } } else { @@ -176,8 +210,11 @@ namespace Server.Items else if ( targeted is Item ) { BankBox box = from.FindBankNoCreate(); + CommodityDeedBox cox = CommodityDeedBox.Find( m_Deed ); - if ( box != null && m_Deed.IsChildOf( box ) && ((Item)targeted).IsChildOf( box ) ) + // Veteran Rewards mods + if ( box != null && m_Deed.IsChildOf( box ) && ((Item)targeted).IsChildOf( box ) || + cox != null && cox.IsSecure && ((Item)targeted).IsChildOf( cox ) ) { if ( m_Deed.SetCommodity( (Item) targeted ) ) { @@ -190,7 +227,14 @@ namespace Server.Items } else { - number = 1047026; // That must be in your bank box to use it. + if( Core.ML ) + { + number = 1080526; // That must be in your bank box or commodity deed box to use it. + } + else + { + number = 1047026; // That must be in your bank box to use it. + } } } else diff --git a/Scripts/Items/Jewels/BaseJewel.cs b/Scripts/Items/Jewels/BaseJewel.cs index 6372be88a..2c21d6f4d 100644 --- a/Scripts/Items/Jewels/BaseJewel.cs +++ b/Scripts/Items/Jewels/BaseJewel.cs @@ -19,6 +19,9 @@ namespace Server.Items public abstract class BaseJewel : Item, ICraftable { + private int m_MaxHitPoints; + private int m_HitPoints; + private AosAttributes m_AosAttributes; private AosElementAttributes m_AosResistances; private AosSkillBonuses m_AosSkillBonuses; @@ -26,6 +29,36 @@ namespace Server.Items private GemType m_GemType; [CommandProperty( AccessLevel.GameMaster )] + public int MaxHitPoints + { + get{ return m_MaxHitPoints; } + set{ m_MaxHitPoints = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public int HitPoints + { + get + { + return m_HitPoints; + } + set + { + if ( value != m_HitPoints && MaxHitPoints > 0 ) + { + m_HitPoints = value; + + if ( m_HitPoints < 0 ) + Delete(); + else if ( m_HitPoints > MaxHitPoints ) + m_HitPoints = MaxHitPoints; + + InvalidateProperties(); + } + } + } + + [CommandProperty( AccessLevel.Player )] public AosAttributes Attributes { get{ return m_AosAttributes; } @@ -67,6 +100,9 @@ namespace Server.Items public override int EnergyResistance{ get{ return m_AosResistances.Energy; } } public virtual int BaseGemTypeNumber{ get{ return 0; } } + public virtual int InitMinHits{ get{ return 0; } } + public virtual int InitMaxHits{ get{ return 0; } } + public override int LabelNumber { get @@ -101,6 +137,8 @@ namespace Server.Items m_GemType = GemType.None; Layer = layer; + + m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax( InitMinHits, InitMaxHits ); } public override void OnAdded( object parent ) @@ -236,13 +274,19 @@ namespace Server.Items list.Add( 1060486, prop.ToString() ); // swing speed increase ~1_val~% base.AddResistanceProperties( list ); + + if ( m_HitPoints >= 0 && m_MaxHitPoints > 0 ) + list.Add( 1060639, "{0}\t{1}", m_HitPoints, m_MaxHitPoints ); // durability ~1_val~ / ~2_val~ } public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); - writer.Write( (int) 2 ); // version + writer.Write( (int) 3 ); // version + + writer.WriteEncodedInt( (int) m_MaxHitPoints ); + writer.WriteEncodedInt( (int) m_HitPoints ); writer.WriteEncodedInt( (int) m_Resource ); writer.WriteEncodedInt( (int) m_GemType ); @@ -260,6 +304,13 @@ namespace Server.Items switch ( version ) { + case 3: + { + m_MaxHitPoints = reader.ReadEncodedInt(); + m_HitPoints = reader.ReadEncodedInt(); + + goto case 2; + } case 2: { m_Resource = (CraftResource)reader.ReadEncodedInt(); diff --git a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/DyeTub.cs b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/DyeTub.cs index d6890e8e3..76904c46d 100644 --- a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/DyeTub.cs +++ b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/DyeTub.cs @@ -170,7 +170,7 @@ namespace Server.Items { BaseHouse house = BaseHouse.FindHouseAt( item ); - if ( house == null || !house.IsLockedDown( item ) ) + if ( house == null || ( !house.IsLockedDown( item ) && !house.IsSecure( item ) ) ) from.SendLocalizedMessage( 501022 ); // Furniture must be locked down to paint it. else if ( !house.IsCoOwner( from ) ) from.SendLocalizedMessage( 501023 ); // You must be the owner to use this item. diff --git a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/FurnitureDyeTub.cs b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/FurnitureDyeTub.cs index 50757ad86..ef4f002f6 100644 --- a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/FurnitureDyeTub.cs +++ b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/FurnitureDyeTub.cs @@ -37,6 +37,14 @@ namespace Server.Items { } + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( Core.ML && m_IsRewardItem ) + list.Add( 1076217 ); // 1st Year Veteran Reward + } + public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); diff --git a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/LeatherDyeTub.cs b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/LeatherDyeTub.cs index ec4a8ef9e..2f160573f 100644 --- a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/LeatherDyeTub.cs +++ b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/LeatherDyeTub.cs @@ -38,6 +38,14 @@ namespace Server.Items { } + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( Core.ML && m_IsRewardItem ) + list.Add( 1076218 ); // 2nd Year Veteran Reward + } + public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); diff --git a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/RewardBlackDyeTub.cs b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/RewardBlackDyeTub.cs index 585488df2..2957929f2 100644 --- a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/RewardBlackDyeTub.cs +++ b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/RewardBlackDyeTub.cs @@ -35,6 +35,14 @@ namespace Server.Items { } + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( Core.ML && m_IsRewardItem ) + list.Add( 1076217 ); // 1st Year Veteran Reward + } + public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); diff --git a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/RunebookDyeTub.cs b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/RunebookDyeTub.cs index 771188275..97cbe89f2 100644 --- a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/RunebookDyeTub.cs +++ b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/RunebookDyeTub.cs @@ -38,6 +38,14 @@ namespace Server.Items { } + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( Core.ML && m_IsRewardItem ) + list.Add( 1076220 ); // 4st Year Veteran Reward + } + public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); diff --git a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/SpecialDyeTub.cs b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/SpecialDyeTub.cs index b75661730..7da177f11 100644 --- a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/SpecialDyeTub.cs +++ b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/SpecialDyeTub.cs @@ -34,6 +34,14 @@ namespace Server.Items { } + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( Core.ML && m_IsRewardItem ) + list.Add( 1076217 ); // 1st Year Veteran Reward + } + public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); diff --git a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/StatuetteDyeTub.cs b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/StatuetteDyeTub.cs index 27ee69da3..7281563dd 100644 --- a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/StatuetteDyeTub.cs +++ b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/StatuetteDyeTub.cs @@ -38,6 +38,14 @@ namespace Server.Items { } + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( Core.ML && m_IsRewardItem ) + list.Add( 1076221 ); // 5st Year Veteran Reward + } + public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); diff --git a/Scripts/Items/Special/Bulk Order Rewards/Blacksmithy/PowderOfTemperament.cs b/Scripts/Items/Special/Bulk Order Rewards/Blacksmithy/PowderOfTemperament.cs index 549c9459a..b143e9a71 100644 --- a/Scripts/Items/Special/Bulk Order Rewards/Blacksmithy/PowderOfTemperament.cs +++ b/Scripts/Items/Special/Bulk Order Rewards/Blacksmithy/PowderOfTemperament.cs @@ -110,6 +110,12 @@ namespace Server.Items { BaseArmor ar = (BaseArmor)targeted; + if ( !ar.CanFortify ) + { + from.SendLocalizedMessage( 1049083 ); // You cannot use the powder on that item. + return; + } + if ( ar.IsChildOf( from.Backpack ) && m_Powder.IsChildOf( from.Backpack ) ) { int origMaxHP = ar.MaxHitPoints; @@ -168,6 +174,12 @@ namespace Server.Items { BaseWeapon wep = (BaseWeapon)targeted; + if ( !wep.CanFortify ) + { + from.SendLocalizedMessage( 1049083 ); // You cannot use the powder on that item. + return; + } + if ( wep.IsChildOf( from.Backpack ) && m_Powder.IsChildOf( from.Backpack ) ) { int origMaxHP = wep.MaxHitPoints; @@ -226,6 +238,12 @@ namespace Server.Items { BaseClothing clothing = (BaseClothing)targeted; + if ( !clothing.CanFortify ) + { + from.SendLocalizedMessage( 1049083 ); // You cannot use the powder on that item. + return; + } + if ( clothing.IsChildOf( from.Backpack ) && m_Powder.IsChildOf( from.Backpack ) ) { int origMaxHP = clothing.MaxHitPoints; diff --git a/Scripts/Items/Special/MiniHouses.cs b/Scripts/Items/Special/MiniHouses.cs index f2bb34796..3f017f998 100644 --- a/Scripts/Items/Special/MiniHouses.cs +++ b/Scripts/Items/Special/MiniHouses.cs @@ -31,6 +31,12 @@ namespace Server.Items public void Construct() { + foreach ( AddonComponent c in Components ) + { + c.Addon = null; + c.Delete(); + } + Components.Clear(); MiniHouseInfo info = MiniHouseInfo.GetInfo( m_Type ); @@ -40,7 +46,8 @@ namespace Server.Items for ( int y = 0; y < size; ++y ) for ( int x = 0; x < size; ++x ) - AddComponent( new AddonComponent( info.Graphics[num++] ), size - x - 1, size - y - 1, 0 ); + if ( info.Graphics[num] != 0x1 ) // Veteran Rewards Mod + AddComponent( new AddonComponent( info.Graphics[num++] ), size - x - 1, size - y - 1, 0 ); } public MiniHouseAddon( Serial serial ) : base( serial ) @@ -162,7 +169,9 @@ namespace Server.Items TwoStoryVilla, SandstoneHouseWithPatio, SmallStoneWorkshop, - SmallMarbleWorkshop + SmallMarbleWorkshop, + MalasMountainPass, //Veteran reward house + ChurchAtNight //Veteran reward house } public class MiniHouseInfo @@ -210,7 +219,9 @@ namespace Server.Items /* Two-story villa */ new MiniHouseInfo( 0x2300, 1, 1011319 ), /* Sandstone house with patio */ new MiniHouseInfo( 0x22F3, 1, 1011320 ), /* Small stone workshop */ new MiniHouseInfo( 0x22F6, 1, 1011321 ), - /* Small marble workshop */ new MiniHouseInfo( 0x22F4, 1, 1011322 ) + /* Small marble workshop */ new MiniHouseInfo( 0x22F4, 1, 1011322 ), + /* Malas Mountain Pass */ new MiniHouseInfo( 1062692, 0x2316, 0x2315, 0x2314, 0x2313 ), + /* Church At Night */ new MiniHouseInfo( 1072215, 0x2318, 0x2317, 0x2319, 0x1 ) }; public static MiniHouseInfo GetInfo( MiniHouseType type ) diff --git a/Scripts/Items/Special/MonsterStatuette.cs b/Scripts/Items/Special/MonsterStatuette.cs index 6e0dbafc3..adff303b8 100644 --- a/Scripts/Items/Special/MonsterStatuette.cs +++ b/Scripts/Items/Special/MonsterStatuette.cs @@ -4,6 +4,7 @@ using Server.Multis; using Server.Gumps; using Server.Items; using Server.Network; +using Server.Engines.VeteranRewards; namespace Server.Items { @@ -33,7 +34,16 @@ namespace Server.Items FireElemental, Wolf, PhillipsWoodenSteed, - Seahorse + Seahorse, + Harrower, + Efreet, + Slime, + PlagueBeast, + RedDeath, + Spider, + OphidianArchMage, + OphidianWarrior, + DreadHorn } public class MonsterStatuetteInfo @@ -41,10 +51,12 @@ namespace Server.Items private int m_LabelNumber; private int m_ItemID; private int[] m_Sounds; + private int m_Hue; public int LabelNumber{ get{ return m_LabelNumber; } } public int ItemID{ get{ return m_ItemID; } } public int[] Sounds{ get{ return m_Sounds; } } + public int Hue{ get{ return m_Hue; } } public MonsterStatuetteInfo( int labelNumber, int itemID, int baseSoundID ) { @@ -53,33 +65,49 @@ namespace Server.Items m_Sounds = new int[]{ baseSoundID, baseSoundID + 1, baseSoundID + 2, baseSoundID + 3, baseSoundID + 4 }; } + public MonsterStatuetteInfo( int labelNumber, int itemID, int[] sounds ) + { + m_LabelNumber = labelNumber; + m_ItemID = itemID; + m_Sounds = sounds; + } + private static MonsterStatuetteInfo[] m_Table = new MonsterStatuetteInfo[] { /* Crocodile */ new MonsterStatuetteInfo( 1041249, 0x20DA, 660 ), /* Daemon */ new MonsterStatuetteInfo( 1041250, 0x20D3, 357 ), /* Dragon */ new MonsterStatuetteInfo( 1041251, 0x20D6, 362 ), - /* EarthElemental */ new MonsterStatuetteInfo( 1041252, 0x20D7, 268 ), - /* Ettin */ new MonsterStatuetteInfo( 1041253, 0x20D8, 367 ), + /* EarthElemental */ new MonsterStatuetteInfo( 1041252, 0x20D7, 268 ), + /* Ettin */ new MonsterStatuetteInfo( 1041253, 0x20D8, 367 ), /* Gargoyle */ new MonsterStatuetteInfo( 1041254, 0x20D9, 372 ), /* Gorilla */ new MonsterStatuetteInfo( 1041255, 0x20F5, 158 ), - /* Lich */ new MonsterStatuetteInfo( 1041256, 0x20F8, 1001 ), + /* Lich */ new MonsterStatuetteInfo( 1041256, 0x20F8, 1001 ), /* Lizardman */ new MonsterStatuetteInfo( 1041257, 0x20DE, 417 ), - /* Ogre */ new MonsterStatuetteInfo( 1041258, 0x20DF, 427 ), - /* Orc */ new MonsterStatuetteInfo( 1041259, 0x20E0, 1114 ), + /* Ogre */ new MonsterStatuetteInfo( 1041258, 0x20DF, 427 ), + /* Orc */ new MonsterStatuetteInfo( 1041259, 0x20E0, 1114 ), /* Ratman */ new MonsterStatuetteInfo( 1041260, 0x20E3, 437 ), /* Skeleton */ new MonsterStatuetteInfo( 1041261, 0x20E7, 1165 ), - /* Troll */ new MonsterStatuetteInfo( 1041262, 0x20E9, 461 ), - /* Cow */ new MonsterStatuetteInfo( 1041263, 0x2103, 120 ), + /* Troll */ new MonsterStatuetteInfo( 1041262, 0x20E9, 461 ), + /* Cow */ new MonsterStatuetteInfo( 1041263, 0x2103, 120 ), /* Zombie */ new MonsterStatuetteInfo( 1041264, 0x20EC, 471 ), - /* Llama */ new MonsterStatuetteInfo( 1041265, 0x20F6, 1011 ), + /* Llama */ new MonsterStatuetteInfo( 1041265, 0x20F6, 1011 ), /* Ophidian */ new MonsterStatuetteInfo( 1049742, 0x2133, 634 ), /* Reaper */ new MonsterStatuetteInfo( 1049743, 0x20FA, 442 ), /* Mongbat */ new MonsterStatuetteInfo( 1049744, 0x20F9, 422 ), - /* Gazer */ new MonsterStatuetteInfo( 1049768, 0x20F4, 377 ), + /* Gazer */ new MonsterStatuetteInfo( 1049768, 0x20F4, 377 ), /* FireElemental */ new MonsterStatuetteInfo( 1049769, 0x20F3, 838 ), - /* Wolf */ new MonsterStatuetteInfo( 1049770, 0x2122, 229 ), - /* Phillip's Steed */ new MonsterStatuetteInfo( 1063488, 0x3FFE, 168 ), - /* Seahorse */ new MonsterStatuetteInfo( 1070819, 0x25BA, 138 ) + /* Wolf */ new MonsterStatuetteInfo( 1049770, 0x2122, 229 ), + /* Phillip's Steed */ new MonsterStatuetteInfo( 1063488, 0x3FFE, 168 ), + /* Seahorse */ new MonsterStatuetteInfo( 1070819, 0x25BA, 138 ), + /* Harrower */ new MonsterStatuetteInfo( 1080520, 0x25BB, new int[] { 0x289, 0x28A, 0x28B } ), + /* Efreet */ new MonsterStatuetteInfo( 1080521, 0x2590, 0x300 ), + /* Slime */ new MonsterStatuetteInfo( 1015246, 0x20E8, 456 ), + /* PlagueBeast */ new MonsterStatuetteInfo( 1029747, 0x2613, 0x1BF ), + /* RedDeath */ new MonsterStatuetteInfo( 1094932, 0x2617, new int[] { } ), + /* Spider */ new MonsterStatuetteInfo( 1029668, 0x25C4, 1170 ), + /* OphidianArchMage */ new MonsterStatuetteInfo( 1029641, 0x25A9, 639 ), + /* OphidianWarrior */ new MonsterStatuetteInfo( 1029645, 0x25AD, 634 ), + /* DreadHorn */ new MonsterStatuetteInfo( 1031651, 0x2D83, 0xA8 ) }; public static MonsterStatuetteInfo GetInfo( MonsterStatuetteType type ) @@ -93,7 +121,7 @@ namespace Server.Items } } - public class MonsterStatuette : Item, Engines.VeteranRewards.IRewardItem + public class MonsterStatuette : Item, IRewardItem { private MonsterStatuetteType m_Type; private bool m_TurnedOn; @@ -121,6 +149,14 @@ namespace Server.Items { m_Type = value; ItemID = MonsterStatuetteInfo.GetInfo( m_Type ).ItemID; + + if( m_Type == MonsterStatuetteType.Slime ) + Hue = Utility.RandomSlimeHue(); + else if( m_Type == MonsterStatuetteType.RedDeath ) + Hue = 0x21; + else + Hue = 0; + InvalidateProperties(); } } @@ -146,6 +182,11 @@ namespace Server.Items LootType = LootType.Blessed; m_Type = type; + + if( m_Type == MonsterStatuetteType.Slime ) + Hue = Utility.RandomSlimeHue(); + else if( m_Type == MonsterStatuetteType.RedDeath ) + Hue = 0x21; } public override bool HandlesOnMovement{ get{ return m_TurnedOn && IsLockedDown; } } @@ -156,7 +197,8 @@ namespace Server.Items { int[] sounds = MonsterStatuetteInfo.GetInfo( m_Type ).Sounds; - Effects.PlaySound( this.Location, this.Map, sounds[Utility.Random( sounds.Length )] ); + if( sounds.Length > 0 ) + Effects.PlaySound( this.Location, this.Map, sounds[Utility.Random( sounds.Length )] ); } base.OnMovement( m, oldLocation ); @@ -170,6 +212,9 @@ namespace Server.Items { base.GetProperties( list ); + if ( Core.ML && m_IsRewardItem ) + list.Add( RewardSystem.GetRewardYearLabel( this, new object[]{ m_Type } ) ); // X Year Veteran Reward + if ( m_TurnedOn ) list.Add( 502695 ); // turned on else diff --git a/Scripts/Items/Special/SoulStone.cs b/Scripts/Items/Special/SoulStone.cs index cf6d4635c..93ac749c8 100644 --- a/Scripts/Items/Special/SoulStone.cs +++ b/Scripts/Items/Special/SoulStone.cs @@ -3,16 +3,27 @@ using Server; using Server.Gumps; using Server.Network; using Server.Accounting; +using Server.Engines.VeteranRewards; +using Server.Multis; namespace Server.Items { - public class SoulStone : Item + public class SoulStone : Item, ISecurable { public override int LabelNumber { get { return 1030899; } } // soulstone private int m_ActiveItemID; private int m_InactiveItemID; + private SecureLevel m_Level; + + [CommandProperty( AccessLevel.GameMaster )] + public SecureLevel Level + { + get{ return m_Level; } + set{ m_Level = value; } + } + [CommandProperty( AccessLevel.GameMaster )] public virtual int ActiveItemID { @@ -725,7 +736,9 @@ namespace Server.Items { base.Serialize( writer ); - writer.WriteEncodedInt( 1 ); // version + writer.WriteEncodedInt( 2 ); // version + + writer.Write( (int)m_Level ); writer.Write( m_ActiveItemID ); writer.Write( m_InactiveItemID ); @@ -745,6 +758,11 @@ namespace Server.Items switch( version ) { + case 2: + { + m_Level = (SecureLevel)reader.ReadInt(); + goto case 1; + } case 1: { m_ActiveItemID = reader.ReadInt(); @@ -924,7 +942,7 @@ namespace Server.Items } } - public class RedSoulstone : SoulStone + public class RedSoulstone : SoulStone, IRewardItem { [Constructable] public RedSoulstone() @@ -944,11 +962,30 @@ namespace Server.Items { } + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_IsRewardItem ) + list.Add( 1076217 ); // 1st Year Veteran Reward + } + public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); - writer.Write( (int)0 ); // version + writer.Write( (int)1 ); // version + + writer.Write( (bool) m_IsRewardItem ); } public override void Deserialize( GenericReader reader ) @@ -956,6 +993,15 @@ namespace Server.Items base.Deserialize( reader ); int version = reader.ReadInt(); + + switch ( version ) + { + case 1: + { + m_IsRewardItem = reader.ReadBool(); + break; + } + } } } } \ No newline at end of file diff --git a/Scripts/Items/Special/Special Scrolls/StatScroll.cs b/Scripts/Items/Special/Special Scrolls/StatScroll.cs index 9cd255175..7b86c3fbb 100644 --- a/Scripts/Items/Special/Special Scrolls/StatScroll.cs +++ b/Scripts/Items/Special/Special Scrolls/StatScroll.cs @@ -1,5 +1,6 @@ using System; using Server; +using Server.Mobiles; using Server.Gumps; using Server.Network; @@ -72,7 +73,13 @@ namespace Server.Items if ( IsChildOf( from.Backpack ) ) { - if ( from.StatCap >= m_Value ) + int NewValue = m_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. } @@ -88,7 +95,7 @@ namespace Server.Items { from.SendLocalizedMessage( 1049512 ); // You feel a surge of magic as the scroll enhances your powers! - from.StatCap = m_Value; + 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 ); diff --git a/Scripts/Items/Special/Veteran Rewards/AnkhOfSacrifice.cs b/Scripts/Items/Special/Veteran Rewards/AnkhOfSacrifice.cs new file mode 100644 index 000000000..b2f235b28 --- /dev/null +++ b/Scripts/Items/Special/Veteran Rewards/AnkhOfSacrifice.cs @@ -0,0 +1,329 @@ +using System; +using System.Collections.Generic; +using Server; +using Server.Gumps; +using Server.Mobiles; +using Server.Network; +using Server.ContextMenus; +using Server.Engines.VeteranRewards; + +namespace Server.Items +{ + public class AnkhOfSacrificeComponent : AddonComponent + { + public override bool ForceShowProperties{ get{ return ObjectPropertyList.Enabled; } } + public override int LabelNumber{ get{ return 1027772; } } // Ankh of Sacrifice + + public AnkhOfSacrificeComponent( int itemID ) : base( itemID ) + { + } + + public AnkhOfSacrificeComponent( Serial serial ) : base( serial ) + { + } + + public override void GetContextMenuEntries( Mobile from, List list ) + { + base.GetContextMenuEntries( from, list ); + + if ( from is PlayerMobile ) + list.Add( new LockKarmaEntry( (PlayerMobile)from, Addon as AnkhOfSacrificeAddon ) ); + + list.Add( new ResurrectEntry( from, Addon as AnkhOfSacrificeAddon ) ); + } + + 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 static void Resurrect( PlayerMobile m, AnkhOfSacrificeAddon ankh ) + { + if ( m == null ) + { + } + else if ( !m.InRange( ankh.GetWorldLocation(), 2 ) ) + { + m.SendLocalizedMessage( 500446 ); // That is too far away. + } + else if ( m.Alive ) + { + m.SendLocalizedMessage( 1060197 ); // You are not dead, and thus cannot be resurrected! + } + else if ( m.AnkhNextUse > DateTime.Now ) + { + TimeSpan delay = m.AnkhNextUse - DateTime.Now; + + if ( delay.TotalMinutes > 0 ) + m.SendLocalizedMessage( 1079265, Math.Round( delay.TotalMinutes ).ToString() ); // You must wait ~1_minutes~ minutes before you can use this item. + else + m.SendLocalizedMessage( 1079263, Math.Round( delay.TotalSeconds ).ToString() ); // You must wait ~1_seconds~ seconds before you can use this item. + } + else + { + m.CloseGump( typeof( AnkhResurrectGump ) ); + m.SendGump( new AnkhResurrectGump( m, ResurrectMessage.VirtueShrine ) ); + } + } + + private class ResurrectEntry : ContextMenuEntry + { + private Mobile m_Mobile; + private AnkhOfSacrificeAddon m_Ankh; + + public ResurrectEntry( Mobile mobile, AnkhOfSacrificeAddon ankh ) : base( 6195, 2 ) + { + m_Mobile = mobile; + m_Ankh = ankh; + } + + public override void OnClick() + { + if ( m_Ankh == null || m_Ankh.Deleted ) + return; + + Resurrect( m_Mobile as PlayerMobile, m_Ankh ); + } + } + + private class LockKarmaEntry : ContextMenuEntry + { + private PlayerMobile m_Mobile; + private AnkhOfSacrificeAddon m_Ankh; + + public LockKarmaEntry( PlayerMobile mobile, AnkhOfSacrificeAddon ankh ) : base( mobile.KarmaLocked ? 6197 : 6196, 2 ) + { + m_Mobile = mobile; + m_Ankh = ankh; + } + + public override void OnClick() + { + if ( !m_Mobile.InRange( m_Ankh.GetWorldLocation(), 2 ) ) + m_Mobile.SendLocalizedMessage( 500446 ); // That is too far away. + else + { + m_Mobile.KarmaLocked = !m_Mobile.KarmaLocked; + + if ( m_Mobile.KarmaLocked ) + m_Mobile.SendLocalizedMessage( 1060192 ); // Your karma has been locked. Your karma can no longer be raised. + else + m_Mobile.SendLocalizedMessage( 1060191 ); // Your karma has been unlocked. Your karma can be raised again. + } + } + } + + private class AnkhResurrectGump : ResurrectGump + { + public AnkhResurrectGump( Mobile owner, ResurrectMessage msg ) : base( owner, owner, msg, false ) + { + } + + public override void OnResponse( NetState state, RelayInfo info ) + { + Mobile from = state.Mobile; + + if( info.ButtonID == 1 || info.ButtonID == 2 ) + { + if( from.Map == null || !from.Map.CanFit( from.Location, 16, false, false ) ) + { + from.SendLocalizedMessage( 502391 ); // Thou can not be resurrected there! + return; + } + + if ( from is PlayerMobile ) + { + ((PlayerMobile) from).AnkhNextUse = DateTime.Now + TimeSpan.FromHours( 1 ); + } + + base.OnResponse( state, info ); + } + } + } + } + public class AnkhOfSacrificeAddon : BaseAddon, IRewardItem + { + public override bool HandlesOnMovement{ get{ return true; } } + + public override BaseAddonDeed Deed + { + get + { + AnkhOfSacrificeDeed deed = new AnkhOfSacrificeDeed(); + deed.IsRewardItem = m_IsRewardItem; + + return deed; + } + } + + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + [Constructable] + public AnkhOfSacrificeAddon( bool east ) : base() + { + if ( east ) + { + AddComponent( new AnkhOfSacrificeComponent( 0x1D98 ), 0, 0, 0 ); + AddComponent( new AnkhOfSacrificeComponent( 0x1D97 ), 0, 1, 0 ); + AddComponent( new AnkhOfSacrificeComponent( 0x1CD6 ), 1, 0, 0 ); + AddComponent( new AnkhOfSacrificeComponent( 0x1CD4 ), 1, 1, 0 ); + AddComponent( new AnkhOfSacrificeComponent( 0x1CD0 ), 2, 0, 0 ); + AddComponent( new AnkhOfSacrificeComponent( 0x1CCE ), 2, 1, 0 ); + } + else + { + AddComponent( new AnkhOfSacrificeComponent( 0x1E5D ), 0, 0, 0 ); + AddComponent( new AnkhOfSacrificeComponent( 0x1E5C ), 1, 0, 0 ); + AddComponent( new AnkhOfSacrificeComponent( 0x1CD2 ), 0, 1, 0 ); + AddComponent( new AnkhOfSacrificeComponent( 0x1CD8 ), 1, 1, 0 ); + AddComponent( new AnkhOfSacrificeComponent( 0x1CCD ), 0, 2, 0 ); + AddComponent( new AnkhOfSacrificeComponent( 0x1CCE ), 1, 2, 0 ); + } + } + + public AnkhOfSacrificeAddon( Serial serial ) : base( serial ) + { + } + + public override void OnMovement( Mobile m, Point3D oldLocation ) + { + if ( !m.Alive && Utility.InRange( Location, m.Location, 1 ) && !Utility.InRange( Location, oldLocation, 1 ) ) + AnkhOfSacrificeComponent.Resurrect( m as PlayerMobile, this ); + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_IsRewardItem = reader.ReadBool(); + } + } + + public class AnkhOfSacrificeDeed : BaseAddonDeed, IRewardItem, IRewardOption + { + public override int LabelNumber{ get{ return 1080397; } } // Deed For An Ankh Of Sacrifice + + public override BaseAddon Addon + { + get + { + AnkhOfSacrificeAddon addon = new AnkhOfSacrificeAddon( m_East ); + addon.IsRewardItem = m_IsRewardItem; + + return addon; + } + } + + private bool m_East; + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + [Constructable] + public AnkhOfSacrificeDeed() : this( false ) + { + } + + [Constructable] + public AnkhOfSacrificeDeed( bool isRewardItem ) : base() + { + LootType = LootType.Blessed; + + m_IsRewardItem = isRewardItem; + } + + public AnkhOfSacrificeDeed( Serial serial ) : base( serial ) + { + } + + public override void OnDoubleClick( Mobile from ) + { + if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) ) + return; + + if ( IsChildOf( from.Backpack ) ) + { + from.CloseGump( typeof( RewardOptionGump ) ); + from.SendGump( new RewardOptionGump( this ) ); + } + else + from.SendLocalizedMessage( 1062334 ); // This item must be in your backpack to be used. + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_IsRewardItem ) + list.Add( 1080457 ); // 10th Year Veteran Reward + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_IsRewardItem = reader.ReadBool(); + } + + public void GetOptions( RewardOptionList list ) + { + list.Add( 1, 1080398 ); // Ankh of Sacrifice South + list.Add( 2, 1080399 ); // Ankh of Sacrifice East + } + + public void OnOptionSelected( Mobile from, int option ) + { + switch ( option ) + { + case 1: m_East = false; break; + case 2: m_East = true; break; + } + + if ( !Deleted ) + base.OnDoubleClick( from ); + } + } +} diff --git a/Scripts/Items/Special/Veteran Rewards/Banner.cs b/Scripts/Items/Special/Veteran Rewards/Banner.cs new file mode 100644 index 000000000..54a0b2158 --- /dev/null +++ b/Scripts/Items/Special/Veteran Rewards/Banner.cs @@ -0,0 +1,386 @@ +using System; +using Server; +using Server.Gumps; +using Server.Multis; +using Server.Network; +using Server.Targeting; +using Server.Engines.VeteranRewards; + +namespace Server.Items +{ + public class Banner : Item, IAddon, IDyable, IRewardItem + { + public override bool ForceShowProperties{ get{ return ObjectPropertyList.Enabled; } } + + public Item Deed + { + get + { + BannerDeed deed = new BannerDeed(); + deed.IsRewardItem = m_IsRewardItem; + + return deed; + } + } + + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + public bool FacingSouth + { + get{ return ( ItemID & 0x1 ) == 0; } + } + + [Constructable] + public Banner( int itemID ) : base( itemID ) + { + LootType = LootType.Blessed; + Movable = false; + } + + public Banner( Serial serial ) : base( serial ) + { + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( Core.ML && m_IsRewardItem ) + list.Add( 1076218 ); // 2nd Year Veteran Reward + } + + public override void OnDoubleClick( Mobile from ) + { + if ( from.InRange( Location, 2 ) ) + { + BaseHouse house = BaseHouse.FindHouseAt( this ); + + if ( house != null && house.IsOwner( from ) ) + { + from.CloseGump( typeof( RewardDemolitionGump ) ); + from.SendGump( new RewardDemolitionGump( this, 1018318 ) ); // Do you wish to re-deed this banner? + } + else + from.SendLocalizedMessage( 1018330 ); // You can only re-deed a banner if you placed it or you are the owner of the house. + } + else + from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that. + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_IsRewardItem = reader.ReadBool(); + } + + public bool Dye( Mobile from, DyeTub sender ) + { + if ( Deleted ) + return false; + + Hue = sender.DyedHue; + + return true; + } + + public bool CouldFit( IPoint3D p, Map map ) + { + if ( map == null || !map.CanFit( p.X, p.Y, p.Z, ItemData.Height ) ) + return false; + + if ( FacingSouth ) + return BaseAddon.IsWall( p.X, p.Y - 1, p.Z, map ); // north wall + else + return BaseAddon.IsWall( p.X - 1, p.Y, p.Z, map ); // west wall + } + } + + public class BannerDeed : Item, IRewardItem + { + public override int LabelNumber{ get{ return 1041007; } } // a banner deed + + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + [Constructable] + public BannerDeed() : base( 0x14F0 ) + { + LootType = LootType.Blessed; + Weight = 1.0; + } + + public BannerDeed( Serial serial ) : base( serial ) + { + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_IsRewardItem ) + list.Add( 1076218 ); // 2nd Year Veteran Reward + } + + public override void OnDoubleClick( Mobile from ) + { + if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) ) + return; + + if ( IsChildOf( from.Backpack ) ) + { + BaseHouse house = BaseHouse.FindHouseAt( from ); + + if ( house != null && house.IsOwner( from ) ) + { + from.CloseGump( typeof( InternalGump ) ); + from.SendGump( new InternalGump( this ) ); + } + else + from.SendLocalizedMessage( 502092 ); // You must be in your house to do this. + } + else + from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it. + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_IsRewardItem = reader.ReadBool(); + } + + private class InternalGump : Gump + { + public const int Start = 0x15AE; + public const int End = 0x15F4; + + private BannerDeed m_Banner; + + public InternalGump( BannerDeed banner ) : base( 100, 200 ) + { + m_Banner = banner; + + Closable = true; + Disposable = true; + Dragable = true; + Resizable = false; + + AddPage( 0 ); + + AddBackground( 25, 0, 520, 230, 0xA28 ); + AddLabel( 70, 12, 0x3E3, "Choose a Banner:" ); + + + int itemID = Start; + + for ( int i = 1; i <= 4; i++ ) + { + AddPage( i ); + + for ( int j = 0; j < 8; j++, itemID += 2 ) + { + AddItem( 50 + 60 * j, 70, itemID ); + AddButton( 50 + 60 * j, 50, 0x845, 0x846, itemID, GumpButtonType.Reply, 0 ); + } + + if ( i > 1 ) + AddButton( 75, 198, 0x8AF, 0x8AF, 0, GumpButtonType.Page, i - 1 ); + + if ( i < 4 ) + AddButton( 475, 198, 0x8B0, 0x8B0, 0, GumpButtonType.Page, i + 1 ); + } + } + + public override void OnResponse( NetState sender, RelayInfo info ) + { + if ( m_Banner == null | m_Banner.Deleted ) + return; + + Mobile m = sender.Mobile; + + if ( info.ButtonID >= Start && info.ButtonID <= End ) + { + if ( ( info.ButtonID & 0x1 ) == 0 ) + { + m.SendLocalizedMessage( 1042037 ); // Where would you like to place this banner? + m.Target = new InternalTarget( m_Banner, info.ButtonID ); + } + } + } + } + + private class InternalTarget : Target + { + private BannerDeed m_Banner; + private int m_ItemID; + + public InternalTarget( BannerDeed banner, int itemID ) : base( -1, true, TargetFlags.None ) + { + m_Banner = banner; + m_ItemID = itemID; + } + + protected override void OnTarget( Mobile from, object targeted ) + { + if ( m_Banner == null || m_Banner.Deleted ) + return; + + if ( m_Banner.IsChildOf( from.Backpack ) ) + { + BaseHouse house = BaseHouse.FindHouseAt( from ); + + if ( house != null && house.IsOwner( from ) ) + { + IPoint3D p = targeted as IPoint3D; + Map map = from.Map; + + if ( p == null || map == null ) + return; + + Point3D p3d = new Point3D( p ); + ItemData id = TileData.ItemTable[ m_ItemID & 0x3FFF ]; + + if ( map.CanFit( p3d, id.Height ) ) + { + house = BaseHouse.FindHouseAt( p3d, map, id.Height ); + + if ( house != null && house.IsOwner( from ) ) + { + bool north = BaseAddon.IsWall( p3d.X, p3d.Y - 1, p3d.Z, map ); + bool west = BaseAddon.IsWall( p3d.X - 1, p3d.Y, p3d.Z, map ); + + if ( north && west ) + { + from.CloseGump( typeof( FacingGump ) ); + from.SendGump( new FacingGump( m_Banner, m_ItemID, p3d, house ) ); + } + else if ( north || west ) + { + Banner banner = null; + + if ( north ) + banner = new Banner( m_ItemID ); + else if ( west ) + banner = new Banner( m_ItemID + 1 ); + + house.Addons.Add( banner ); + + banner.IsRewardItem = m_Banner.IsRewardItem; + banner.MoveToWorld( p3d, map ); + + m_Banner.Delete(); + } + else + from.SendLocalizedMessage( 1042039 ); // The banner must be placed next to a wall. + } + else + from.SendLocalizedMessage( 1042036 ); // That location is not in your house. + } + else + from.SendLocalizedMessage( 500269 ); // You cannot build that there. + } + else + from.SendLocalizedMessage( 502092 ); // You must be in your house to do this. + } + else + from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it. + } + + private class FacingGump : Gump + { + private BannerDeed m_Banner; + private int m_ItemID; + private Point3D m_Location; + private BaseHouse m_House; + + private enum Buttons + { + Cancel, + East, + South + } + + public FacingGump( BannerDeed banner, int itemID, Point3D location, BaseHouse house ) : base( 150, 50 ) + { + m_Banner = banner; + m_ItemID = itemID; + m_Location = location; + m_House = house; + + Closable = true; + Disposable = true; + Dragable = true; + Resizable = false; + + AddPage( 0 ); + + AddBackground( 0, 0, 300, 150, 0xA28 ); + + AddItem( 90, 30, itemID + 1 ); + AddItem( 180, 30, itemID ); + + AddButton( 50, 35, 0x868, 0x869, (int) Buttons.East, GumpButtonType.Reply, 0 ); + AddButton( 145, 35, 0x868, 0x869, (int) Buttons.South, GumpButtonType.Reply, 0 ); + } + + public override void OnResponse( NetState sender, RelayInfo info ) + { + if ( m_Banner == null || m_Banner.Deleted || m_House == null ) + return; + + Banner banner = null; + + if ( info.ButtonID == (int) Buttons.East ) + banner = new Banner( m_ItemID + 1 ); + if ( info.ButtonID == (int) Buttons.South ) + banner = new Banner( m_ItemID ); + + if ( banner != null ) + { + m_House.Addons.Add( banner ); + + banner.IsRewardItem = m_Banner.IsRewardItem; + banner.MoveToWorld( m_Location, sender.Mobile.Map ); + + m_Banner.Delete(); + } + } + } + } + } +} diff --git a/Scripts/Items/Special/Veteran Rewards/BloodyPentagram.cs b/Scripts/Items/Special/Veteran Rewards/BloodyPentagram.cs new file mode 100644 index 000000000..317182501 --- /dev/null +++ b/Scripts/Items/Special/Veteran Rewards/BloodyPentagram.cs @@ -0,0 +1,194 @@ +using System; +using Server; +using Server.Gumps; +using Server.Network; +using Server.Engines.VeteranRewards; + +namespace Server.Items +{ + public class BloodyPentagramComponent : AddonComponent + { + public override bool DisplayWeight{ get{ return false; } } + public override int LabelNumber{ get{ return 1080279; } } // Bloody Pentagram + + public BloodyPentagramComponent( int itemID ) : base( itemID ) + { + } + + public BloodyPentagramComponent( Serial serial ) : base( serial ) + { + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + } + } + + public class BloodyPentagramAddon : BaseAddon, IRewardItem + { + public override BaseAddonDeed Deed + { + get + { + BloodyPentagramDeed deed = new BloodyPentagramDeed(); + deed.IsRewardItem = m_IsRewardItem; + + return deed; + } + } + + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + [Constructable] + public BloodyPentagramAddon() : base() + { + AddComponent( new BloodyPentagramComponent( 0x1CF9 ), 0, 1, 0 ); + AddComponent( new BloodyPentagramComponent( 0x1CF8 ), 0, 2, 0 ); + AddComponent( new BloodyPentagramComponent( 0x1CF7 ), 0, 3, 0 ); + AddComponent( new BloodyPentagramComponent( 0x1CF6 ), 0, 4, 0 ); + AddComponent( new BloodyPentagramComponent( 0x1CF5 ), 0, 5, 0 ); + + AddComponent( new BloodyPentagramComponent( 0x1CFB ), 1, 0, 0 ); + AddComponent( new BloodyPentagramComponent( 0x1CFA ), 1, 1, 0 ); + AddComponent( new BloodyPentagramComponent( 0x1D09 ), 1, 2, 0 ); + AddComponent( new BloodyPentagramComponent( 0x1D08 ), 1, 3, 0 ); + AddComponent( new BloodyPentagramComponent( 0x1D07 ), 1, 4, 0 ); + AddComponent( new BloodyPentagramComponent( 0x1CF4 ), 1, 5, 0 ); + + AddComponent( new BloodyPentagramComponent( 0x1CFC ), 2, 0, 0 ); + AddComponent( new BloodyPentagramComponent( 0x1D0A ), 2, 1, 0 ); + AddComponent( new BloodyPentagramComponent( 0x1D11 ), 2, 2, 0 ); + AddComponent( new BloodyPentagramComponent( 0x1D10 ), 2, 3, 0 ); + AddComponent( new BloodyPentagramComponent( 0x1D06 ), 2, 4, 0 ); + AddComponent( new BloodyPentagramComponent( 0x1CF3 ), 2, 5, 0 ); + + AddComponent( new BloodyPentagramComponent( 0x1CFD ), 3, 0, 0 ); + AddComponent( new BloodyPentagramComponent( 0x1D0B ), 3, 1, 0 ); + AddComponent( new BloodyPentagramComponent( 0x1D12 ), 3, 2, 0 ); + AddComponent( new BloodyPentagramComponent( 0x1D0F ), 3, 3, 0 ); + AddComponent( new BloodyPentagramComponent( 0x1D05 ), 3, 4, 0 ); + AddComponent( new BloodyPentagramComponent( 0x1CF2 ), 3, 5, 0 ); + + AddComponent( new BloodyPentagramComponent( 0x1CFE ), 4, 0, 0 ); + AddComponent( new BloodyPentagramComponent( 0x1D0C ), 4, 1, 0 ); + AddComponent( new BloodyPentagramComponent( 0x1D0D ), 4, 2, 0 ); + AddComponent( new BloodyPentagramComponent( 0x1D0E ), 4, 3, 0 ); + AddComponent( new BloodyPentagramComponent( 0x1D04 ), 4, 4, 0 ); + AddComponent( new BloodyPentagramComponent( 0x1CF1 ), 4, 5, 0 ); + + AddComponent( new BloodyPentagramComponent( 0x1CFF ), 5, 0, 0 ); + AddComponent( new BloodyPentagramComponent( 0x1D00 ), 5, 1, 0 ); + AddComponent( new BloodyPentagramComponent( 0x1D01 ), 5, 2, 0 ); + AddComponent( new BloodyPentagramComponent( 0x1D02 ), 5, 3, 0 ); + AddComponent( new BloodyPentagramComponent( 0x1D03 ), 5, 4, 0 ); + } + + public BloodyPentagramAddon( Serial serial ) : base( serial ) + { + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_IsRewardItem = reader.ReadBool(); + } + } + + public class BloodyPentagramDeed : BaseAddonDeed, IRewardItem + { + public override int LabelNumber{ get{ return 1080384; } } // Bloody Pentagram + + public override BaseAddon Addon + { + get + { + BloodyPentagramAddon addon = new BloodyPentagramAddon(); + addon.IsRewardItem = m_IsRewardItem; + + return addon; + } + } + + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + [Constructable] + public BloodyPentagramDeed() : base() + { + LootType = LootType.Blessed; + } + + public BloodyPentagramDeed( Serial serial ) : base( serial ) + { + } + + public override void OnDoubleClick( Mobile from ) + { + if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) ) + return; + + base.OnDoubleClick( from ); + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_IsRewardItem ) + list.Add( 1076221 ); // 5th Year Veteran Reward + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_IsRewardItem = reader.ReadBool(); + } + } +} diff --git a/Scripts/Items/Special/Veteran Rewards/Brazier.cs b/Scripts/Items/Special/Veteran Rewards/Brazier.cs new file mode 100644 index 000000000..64592f8f9 --- /dev/null +++ b/Scripts/Items/Special/Veteran Rewards/Brazier.cs @@ -0,0 +1,237 @@ +using System; +using Server; +using Server.Gumps; +using Server.Multis; +using Server.Network; +using Server.Engines.VeteranRewards; + +namespace Server.Items +{ + public class RewardBrazier : Item, IRewardItem + { + public override bool ForceShowProperties{ get{ return ObjectPropertyList.Enabled; } } + + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + private Item m_Fire; + + private static int[] m_Art = new int[] + { + 0x19AA, 0x19BB + }; + + [Constructable] + public RewardBrazier() : this( Utility.RandomList( m_Art ) ) + { + } + + [Constructable] + public RewardBrazier( int itemID ) : base( itemID ) + { + LootType = LootType.Blessed; + Weight = 10.0; + } + + public RewardBrazier( Serial serial ) : base( serial ) + { + } + + public void TurnOff() + { + if ( m_Fire != null ) + { + m_Fire.Delete(); + m_Fire = null; + } + } + + public void TurnOn() + { + if ( m_Fire == null ) + m_Fire = new Item(); + + m_Fire.ItemID = 0x19AB; + m_Fire.Movable = false; + m_Fire.MoveToWorld( new Point3D( X, Y, Z + ItemData.Height + 2 ), Map ); + } + + public override void OnDoubleClick( Mobile from ) + { + if ( !from.InRange( this.GetWorldLocation(), 2 ) ) + { + from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that. + } + else if ( IsLockedDown ) + { + BaseHouse house = BaseHouse.FindHouseAt( from ); + + if ( house != null && house.IsCoOwner( from ) ) + { + if ( m_Fire != null ) + TurnOff(); + else + TurnOn(); + } + else + from.SendLocalizedMessage( 502436 ); // That is not accessible. + } + else + from.SendLocalizedMessage( 502692 ); // This must be in a house and be locked down to work. + } + + public override void OnLocationChange( Point3D old ) + { + if ( m_Fire != null ) + m_Fire.MoveToWorld( new Point3D( X, Y, Z + ItemData.Height ), Map ); + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_IsRewardItem ) + list.Add( 1076222 ); // 6th Year Veteran Reward + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (bool) m_IsRewardItem ); + writer.Write( (Item) m_Fire ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_IsRewardItem = reader.ReadBool(); + m_Fire = reader.ReadItem(); + } + } + + public class RewardBrazierDeed : Item, IRewardItem + { + public override int LabelNumber{ get{ return 1080527; } } // Brazier Deed + + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + [Constructable] + public RewardBrazierDeed() : base( 0x14F0 ) + { + LootType = LootType.Blessed; + Weight = 1.0; + } + + public RewardBrazierDeed( Serial serial ) : base( serial ) + { + } + + public override void OnDoubleClick( Mobile from ) + { + if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) ) + return; + + if ( IsChildOf( from.Backpack ) ) + { + from.CloseGump( typeof( InternalGump ) ); + from.SendGump( new InternalGump( this ) ); + } + else + from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it. + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_IsRewardItem ) + list.Add( 1076222 ); // 6th Year Veteran Reward + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_IsRewardItem = reader.ReadBool(); + } + + private class InternalGump : Gump + { + private RewardBrazierDeed m_Brazier; + + public InternalGump( RewardBrazierDeed brazier ) : base( 100, 200 ) + { + m_Brazier = brazier; + + Closable = true; + Disposable = true; + Dragable = true; + Resizable = false; + + AddPage( 0 ); + AddBackground( 0, 0, 200, 200, 2600 ); + + AddPage( 1 ); + AddLabel( 45, 15, 0, "Choose a Brazier:" ); + + AddItem( 40, 75, 0x19AA ); + AddButton( 55, 50, 0x845, 0x846, 0x19AA, GumpButtonType.Reply, 0 ); + + AddItem( 100, 75, 0x19BB ); + AddButton( 115, 50, 0x845, 0x846, 0x19BB, GumpButtonType.Reply, 0 ); + } + + public override void OnResponse( NetState sender, RelayInfo info ) + { + if ( m_Brazier == null | m_Brazier.Deleted ) + return; + + Mobile m = sender.Mobile; + + if ( info.ButtonID == 0x19AA || info.ButtonID == 0x19BB ) + { + RewardBrazier brazier = new RewardBrazier( info.ButtonID ); + brazier.IsRewardItem = m_Brazier.IsRewardItem; + + if ( !m.PlaceInBackpack( brazier ) ) + { + brazier.Delete(); + m.SendLocalizedMessage( 1078837 ); // Your backpack is full! Please make room and try again. + } + else + m_Brazier.Delete(); + } + } + } + } +} diff --git a/Scripts/Items/Special/Veteran Rewards/Cannon.cs b/Scripts/Items/Special/Veteran Rewards/Cannon.cs new file mode 100644 index 000000000..234c3c447 --- /dev/null +++ b/Scripts/Items/Special/Veteran Rewards/Cannon.cs @@ -0,0 +1,469 @@ +using System; +using Server; +using Server.Gumps; +using Server.Targeting; +using Server.Mobiles; +using Server.Network; +using Server.Engines.Quests.Haven; +using Server.Engines.VeteranRewards; + +namespace Server.Items +{ + public class CannonAddonComponent : AddonComponent + { + public override int LabelNumber{ get{ return 1076157; } } // Decorative Cannon + + public CannonAddonComponent( int itemID ) : base( itemID ) + { + LootType = LootType.Blessed; + } + + public CannonAddonComponent( Serial serial ) : base( serial ) + { + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( Addon is CannonAddon ) + { + if ( ((CannonAddon) Addon).IsRewardItem ) + list.Add( 1076223 ); // 7th Year Veteran Reward + + list.Add( 1076207, ((CannonAddon) Addon).Charges.ToString() ); // Remaining Charges: ~1_val~ + } + } + + 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 CannonAddon : BaseAddon + { + public override BaseAddonDeed Deed + { + get + { + CannonDeed deed = new CannonDeed(); + deed.Charges = m_Charges; + deed.IsRewardItem = m_IsRewardItem; + + return deed; + } + } + + private CannonDirection m_CannonDirection; + private int m_Charges; + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public CannonDirection CannonDirection + { + get{ return m_CannonDirection; } + } + + [CommandProperty( AccessLevel.GameMaster )] + public int Charges + { + get{ return m_Charges; } + set + { + m_Charges = value; + + foreach ( AddonComponent c in Components ) + c.InvalidateProperties(); + } + } + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set + { + m_IsRewardItem = value; + + foreach ( AddonComponent c in Components ) + c.InvalidateProperties(); + } + } + + [Constructable] + public CannonAddon( CannonDirection direction ) + { + m_CannonDirection = direction; + + switch ( direction ) + { + case CannonDirection.North: + { + AddComponent( new CannonAddonComponent( 0xE8D ), 0, 0, 0 ); + AddComponent( new CannonAddonComponent( 0xE8C ), 0, 1, 0 ); + AddComponent( new CannonAddonComponent( 0xE8B ), 0, 2, 0 ); + + break; + } + case CannonDirection.East: + { + AddComponent( new CannonAddonComponent( 0xE96 ), 0, 0, 0 ); + AddComponent( new CannonAddonComponent( 0xE95 ), -1, 0, 0 ); + AddComponent( new CannonAddonComponent( 0xE94 ), -2, 0, 0 ); + + break; + } + case CannonDirection.South: + { + AddComponent( new CannonAddonComponent( 0xE91 ), 0, 0, 0 ); + AddComponent( new CannonAddonComponent( 0xE92 ), 0, -1, 0 ); + AddComponent( new CannonAddonComponent( 0xE93 ), 0, -2, 0 ); + + break; + } + default: + { + AddComponent( new CannonAddonComponent( 0xE8E ), 0, 0, 0 ); + AddComponent( new CannonAddonComponent( 0xE8F ), 1, 0, 0 ); + AddComponent( new CannonAddonComponent( 0xE90 ), 2, 0, 0 ); + + break; + } + } + } + + public CannonAddon( Serial serial ) : base( serial ) + { + } + + public override void OnComponentUsed( AddonComponent c, Mobile from ) + { + if ( from.InRange( Location, 2 ) ) + { + if ( m_Charges > 0 ) + { + from.Target = new InternalTarget( this ); + } + else + { + if ( from.Backpack != null ) + { + PotionKeg keg = from.Backpack.FindItemByType( typeof( PotionKeg ) ) as PotionKeg; + + if ( Validate( keg ) > 0 ) + from.SendGump( new InternalGump( this, keg ) ); + else + from.SendLocalizedMessage( 1076198 ); // You do not have a full keg of explosion potions needed to recharge the cannon. + } + } + } + else + from.SendLocalizedMessage( 1076766 ); // That is too far away. + } + + public int Validate( PotionKeg keg ) + { + if ( keg != null && !keg.Deleted && keg.Held == 100 ) + { + if ( keg.Type == PotionEffect.ExplosionLesser ) + return 5; + else if ( keg.Type == PotionEffect.Explosion ) + return 10; + else if ( keg.Type == PotionEffect.ExplosionGreater ) + return 15; + } + + return 0; + } + + public void Fill( Mobile from, PotionKeg keg ) + { + Charges = Validate( keg ); + + if ( Charges > 0 ) + { + keg.Delete(); + from.SendLocalizedMessage( 1076199 ); // Your cannon is recharged. + } + else + from.SendLocalizedMessage( 1076198 ); // You do not have a full keg of explosion potions needed to recharge the cannon. + } + + private static int[] m_Effects = new int[] + { + 0x36B0, 0x3728, 0x3709, 0x36FE + }; + + public void DoFireEffect( IPoint3D target ) + { + Map map = Map; + + if ( target == null || map == null ) + return; + + Effects.PlaySound( target, map, Utility.RandomList( 0x11B, 0x11C, 0x11D ) ); + Effects.SendLocationEffect( target, map, Utility.RandomList( m_Effects ), 16, 1 ); + + for ( int count = Utility.Random( 3 ); count > 0; count-- ) + { + IPoint3D location = new Point3D( target.X + Utility.RandomMinMax( -1, 1 ), target.Y + Utility.RandomMinMax( -1, 1 ), target.Z ); + int effect = Utility.RandomList( m_Effects ); + Effects.SendLocationEffect( location, map, effect, 16, 1 ); + } + + Charges -= 1; + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (int) m_CannonDirection ); + writer.Write( (int) m_Charges ); + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_CannonDirection = (CannonDirection) reader.ReadInt(); + m_Charges = reader.ReadInt(); + m_IsRewardItem = reader.ReadBool(); + } + + private class InternalTarget : Target + { + private CannonAddon m_Cannon; + + public InternalTarget( CannonAddon cannon ) : base( 12, true, TargetFlags.None ) + { + m_Cannon = cannon; + } + + protected override void OnTarget( Mobile from, object targeted ) + { + if ( m_Cannon == null || m_Cannon.Deleted ) + return; + + IPoint3D p = targeted as IPoint3D; + + if ( p == null ) + return; + + if ( from.InLOS( new Point3D( p ) ) ) + { + if ( !Utility.InRange( new Point3D( p ), m_Cannon.Location, 2 ) ) + { + bool allow = false; + + int x = p.X - m_Cannon.X; + int y = p.Y - m_Cannon.Y; + + switch ( m_Cannon.CannonDirection ) + { + case CannonDirection.North: + if ( y < 0 && Math.Abs( x ) <= -y / 3 ) + allow = true; + + break; + case CannonDirection.East: + if ( x > 0 && Math.Abs( y ) <= x / 3 ) + allow = true; + + break; + case CannonDirection.South: + if ( y > 0 && Math.Abs( x ) <= y / 3 ) + allow = true; + + break; + case CannonDirection.West: + if ( x < 0 && Math.Abs( y ) <= -x / 3 ) + allow = true; + + break; + } + + if ( allow && Utility.InRange( new Point3D( p ), m_Cannon.Location, 14 ) ) + m_Cannon.DoFireEffect( p ); + else + from.SendLocalizedMessage( 1076203 ); // Target out of range. + } + else + from.SendLocalizedMessage( 1076215 ); // Cannon must be aimed farther away. + } + else + from.SendLocalizedMessage( 1049630 ); // You cannot see that target! + } + + protected override void OnTargetOutOfRange( Mobile from, object targeted ) + { + from.SendLocalizedMessage( 1076203 ); // Target out of range. + } + } + + private class InternalGump : Gump + { + private CannonAddon m_Cannon; + private PotionKeg m_Keg; + + private enum Buttons + { + Cancel, + Recharge + } + + public InternalGump( CannonAddon cannon, PotionKeg keg ) : base( 50, 50 ) + { + m_Cannon = cannon; + m_Keg = keg; + + Closable = true; + Disposable = true; + Dragable = true; + Resizable = false; + + AddPage( 0 ); + + AddBackground( 0, 0, 291, 133, 0x13BE ); + AddImageTiled( 5, 5, 280, 100, 0xA40 ); + + AddHtmlLocalized( 9, 9, 272, 100, 1076196, cannon.Validate( keg ).ToString(), 0x7FFF, false, false ); // You will need a full keg of explosion potions to recharge the cannon. Your keg will provide ~1_CHARGES~ charges. + + AddButton( 5, 107, 0xFB1, 0xFB2, (int) Buttons.Cancel, GumpButtonType.Reply, 0 ); + AddHtmlLocalized( 40, 109, 100, 20, 1060051, 0x7FFF, false, false ); // CANCEL + + AddButton( 160, 107, 0xFB7, 0xFB8, (int) Buttons.Recharge, GumpButtonType.Reply, 0 ); + AddHtmlLocalized( 195, 109, 120, 20, 1076197, 0x7FFF, false, false ); // Recharge + } + + public override void OnResponse( NetState state, RelayInfo info ) + { + if ( m_Cannon == null || m_Cannon.Deleted ) + return; + + if ( info.ButtonID == (int) Buttons.Recharge ) + m_Cannon.Fill( state.Mobile, m_Keg ); + } + } + } + + public class CannonDeed : BaseAddonDeed, IRewardItem, IRewardOption + { + public override int LabelNumber{ get{ return 1076195; } } // A deed for a cannon + + public override BaseAddon Addon + { + get + { + CannonAddon addon = new CannonAddon( m_Direction ); + addon.Charges = m_Charges; + addon.IsRewardItem = m_IsRewardItem; + + return addon; + } + } + + private CannonDirection m_Direction; + private int m_Charges; + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public int Charges + { + get{ return m_Charges; } + set{ m_Charges = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + [Constructable] + public CannonDeed() : base() + { + LootType = LootType.Blessed; + } + + public CannonDeed( Serial serial ) : base( serial ) + { + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_IsRewardItem ) + list.Add( 1076223 ); // 7th Year Veteran Reward + + list.Add( 1076207, m_Charges.ToString() ); // Remaining Charges: ~1_val~ + } + + public override void OnDoubleClick( Mobile from ) + { + if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) ) + return; + + if ( IsChildOf( from.Backpack ) ) + { + from.CloseGump( typeof( RewardOptionGump ) ); + from.SendGump( new RewardOptionGump( this ) ); + } + else + from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it. + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (int) m_Charges ); + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_Charges = reader.ReadInt(); + m_IsRewardItem = reader.ReadBool(); + } + + public void GetOptions( RewardOptionList list ) + { + list.Add( (int) CannonDirection.South, 1075386 ); // South + list.Add( (int) CannonDirection.East, 1075387 ); // East + list.Add( (int) CannonDirection.North, 1075389 ); // North + list.Add( (int) CannonDirection.West, 1075390 ); // West + } + + public void OnOptionSelected( Mobile from, int option ) + { + m_Direction = (CannonDirection) option; + + if ( !Deleted ) + base.OnDoubleClick( from ); + } + } +} diff --git a/Scripts/Items/Special/Veteran Rewards/CommodityDeedBox.cs b/Scripts/Items/Special/Veteran Rewards/CommodityDeedBox.cs new file mode 100644 index 000000000..b2f00ef42 --- /dev/null +++ b/Scripts/Items/Special/Veteran Rewards/CommodityDeedBox.cs @@ -0,0 +1,69 @@ +using System; +using Server; +using Server.Engines.VeteranRewards; + +namespace Server.Items +{ + [Furniture] + public class CommodityDeedBox : BaseContainer, IRewardItem + { + public override int LabelNumber{ get { return 1080523; } } // Commodity Deed Box + public override int DefaultGumpID{ get{ return 0x43; } } + + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + [Constructable] + public CommodityDeedBox() : base( 0x9AA ) + { + Hue = 0x47; + Weight = 4.0; + } + + public CommodityDeedBox( Serial serial ) : base( serial ) + { + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_IsRewardItem ) + list.Add( 1076217 ); // 1st Year Veteran Reward + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_IsRewardItem = reader.ReadBool(); + } + + public static CommodityDeedBox Find( Item deed ) + { + Item parent = deed; + + while ( parent != null && !( parent is CommodityDeedBox ) ) + parent = parent.Parent as Item; + + return parent as CommodityDeedBox; + } + } +} diff --git a/Scripts/Items/Special/Veteran Rewards/ContestMiniHouse.cs b/Scripts/Items/Special/Veteran Rewards/ContestMiniHouse.cs new file mode 100644 index 000000000..8bc20eafb --- /dev/null +++ b/Scripts/Items/Special/Veteran Rewards/ContestMiniHouse.cs @@ -0,0 +1,132 @@ +using System; +using Server; +using Server.Engines.VeteranRewards; + +namespace Server.Items +{ + public class ContestMiniHouse : MiniHouseAddon + { + public override BaseAddonDeed Deed + { + get + { + ContestMiniHouseDeed deed = new ContestMiniHouseDeed( Type ); + deed.IsRewardItem = m_IsRewardItem; + + return deed; + } + } + + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + [Constructable] + public ContestMiniHouse() : base( MiniHouseType.MalasMountainPass ) + { + } + + [Constructable] + public ContestMiniHouse( MiniHouseType type ) : base( type ) + { + } + + public ContestMiniHouse( Serial serial ) : base( serial ) + { + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_IsRewardItem = reader.ReadBool(); + } + } + + public class ContestMiniHouseDeed : MiniHouseDeed, IRewardItem + { + public override BaseAddon Addon + { + get + { + ContestMiniHouse addon = new ContestMiniHouse( Type ); + addon.IsRewardItem = m_IsRewardItem; + + return addon; + } + } + + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + [Constructable] + public ContestMiniHouseDeed() : base( MiniHouseType.MalasMountainPass ) + { + } + + [Constructable] + public ContestMiniHouseDeed( MiniHouseType type ) : base( type ) + { + } + + public ContestMiniHouseDeed( Serial serial ) : base( serial ) + { + } + + public override void OnDoubleClick( Mobile from ) + { + if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, new object[] { Type } ) ) + return; + + base.OnDoubleClick( from ); + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( Core.ML && m_IsRewardItem ) + list.Add( 1076217 ); // 1st Year Veteran Reward + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_IsRewardItem = reader.ReadBool(); + } + } +} diff --git a/Scripts/Items/Special/Veteran Rewards/DecorativeShield.cs b/Scripts/Items/Special/Veteran Rewards/DecorativeShield.cs new file mode 100644 index 000000000..49471f7f6 --- /dev/null +++ b/Scripts/Items/Special/Veteran Rewards/DecorativeShield.cs @@ -0,0 +1,400 @@ +using System; +using Server; +using Server.Gumps; +using Server.Multis; +using Server.Network; +using Server.Targeting; +using Server.Engines.VeteranRewards; + +namespace Server.Items +{ + public class DecorativeShield : Item, IAddon, IRewardItem + { + public override bool ForceShowProperties{ get{ return ObjectPropertyList.Enabled; } } + + public Item Deed + { + get + { + DecorativeShieldDeed deed = new DecorativeShieldDeed(); + deed.IsRewardItem = m_IsRewardItem; + + return deed; + } + } + + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + public bool FacingSouth + { + get + { + if ( ItemID < 0x1582 ) + return ( ItemID & 0x1 ) == 0; + + return ItemID <= 0x1585; + } + } + + [Constructable] + public DecorativeShield() : this( 0x156C ) + { + } + + [Constructable] + public DecorativeShield( int itemID ) : base( itemID ) + { + Movable = false; + } + + public DecorativeShield( Serial serial ) : base( serial ) + { + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( Core.ML && m_IsRewardItem ) + list.Add( 1076220 ); // 4th Year Veteran Reward + } + + public override void OnDoubleClick( Mobile from ) + { + if ( from.InRange( Location, 2 ) ) + { + BaseHouse house = BaseHouse.FindHouseAt( this ); + + if ( house != null && house.IsOwner( from ) ) + { + from.CloseGump( typeof( RewardDemolitionGump ) ); + from.SendGump( new RewardDemolitionGump( this, 1049783 ) ); // Do you wish to re-deed this decoration? + } + else + from.SendLocalizedMessage( 1049784 ); // You can only re-deed this decoration if you are the house owner or originally placed the decoration. + } + else + from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that. + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_IsRewardItem = reader.ReadBool(); + } + + public bool CouldFit( IPoint3D p, Map map ) + { + if ( map == null || !map.CanFit( p.X, p.Y, p.Z, ItemData.Height ) ) + return false; + + if ( FacingSouth ) + return BaseAddon.IsWall( p.X, p.Y - 1, p.Z, map ); // north wall + else + return BaseAddon.IsWall( p.X - 1, p.Y, p.Z, map ); // west wall + } + } + + public class DecorativeShieldDeed : Item, IRewardItem + { + public override int LabelNumber{ get{ return 1049771; } } // deed for a decorative shield wall hanging + + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + [Constructable] + public DecorativeShieldDeed() : base( 0x14F0 ) + { + LootType = LootType.Blessed; + Weight = 1.0; + } + + public DecorativeShieldDeed( Serial serial ) : base( serial ) + { + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_IsRewardItem ) + list.Add( 1076220 ); // 4th Year Veteran Reward + } + + public override void OnDoubleClick( Mobile from ) + { + if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) ) + return; + + if ( IsChildOf( from.Backpack ) ) + { + from.CloseGump( typeof( InternalGump ) ); + from.SendGump( new InternalGump( this ) ); + } + else + from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it. + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_IsRewardItem = reader.ReadBool(); + } + + public static int GetWestItemID( int east ) + { + switch ( east ) + { + case 0x1582: return 0x1635; + case 0x1583: return 0x1634; + case 0x1584: return 0x1637; + case 0x1585: return 0x1636; + default: return east + 1; + } + } + + private class InternalGump : Gump + { + public const int Start = 0x156C; + public const int End = 0x1585; + + private DecorativeShieldDeed m_Shield; + private int m_Page; + + public InternalGump( DecorativeShieldDeed shield ) : this( shield, 1 ) + { + } + + public InternalGump( DecorativeShieldDeed shield, int page ) : base( 150, 50 ) + { + m_Shield = shield; + m_Page = page; + + Closable = true; + Disposable = true; + Dragable = true; + Resizable = false; + + AddPage( 0 ); + + AddBackground( 25, 0, 500, 230, 0xA28 ); + + int itemID = Start; + + for ( int i = 1; i <= 2; i++ ) + { + AddPage( i ); + + for ( int j = 0; j < 9 - i; j++ ) + { + AddItem( 40 + j * 60, 70, itemID ); + AddButton( 60 + j * 60, 50, 0x845, 0x846, itemID, GumpButtonType.Reply, 0 ); + + if ( itemID < 0x1582 ) + itemID += 2; + else + itemID += 1; + } + + switch ( i ) + { + case 1: AddButton( 455, 198, 0x8B0, 0x8B0, 0, GumpButtonType.Page, 2 ); break; + case 2: AddButton( 70, 198, 0x8AF, 0x8AF, 0, GumpButtonType.Page, 1 ); break; + } + } + } + + public override void OnResponse( NetState sender, RelayInfo info ) + { + if ( m_Shield == null | m_Shield.Deleted ) + return; + + Mobile m = sender.Mobile; + + if ( info.ButtonID >= Start && info.ButtonID <= End ) + { + if ( ( info.ButtonID & 0x1 ) == 0 && info.ButtonID < 0x1582 || info.ButtonID >= 0x1582 && info.ButtonID <= 0x1585 ) + { + m.SendLocalizedMessage( 1049780 ); // Where would you like to place this decoration? + m.Target = new InternalTarget( m_Shield, info.ButtonID ); + } + } + } + } + + private class InternalTarget : Target + { + private DecorativeShieldDeed m_Shield; + private int m_ItemID; + + public InternalTarget( DecorativeShieldDeed shield, int itemID ) : base( -1, true, TargetFlags.None ) + { + m_Shield = shield; + m_ItemID = itemID; + } + + protected override void OnTarget( Mobile from, object targeted ) + { + if ( m_Shield == null || m_Shield.Deleted ) + return; + + if ( m_Shield.IsChildOf( from.Backpack ) ) + { + BaseHouse house = BaseHouse.FindHouseAt( from ); + + if ( house != null && house.IsOwner( from ) ) + { + IPoint3D p = targeted as IPoint3D; + Map map = from.Map; + + if ( p == null || map == null ) + return; + + Point3D p3d = new Point3D( p ); + ItemData id = TileData.ItemTable[ m_ItemID & 0x3FFF ]; + + if ( map.CanFit( p3d, id.Height ) ) + { + house = BaseHouse.FindHouseAt( p3d, map, id.Height ); + + if ( house != null && house.IsOwner( from ) ) + { + bool north = BaseAddon.IsWall( p3d.X, p3d.Y - 1, p3d.Z, map ); + bool west = BaseAddon.IsWall( p3d.X - 1, p3d.Y, p3d.Z, map ); + + if ( north && west ) + { + from.CloseGump( typeof( FacingGump ) ); + from.SendGump( new FacingGump( m_Shield, m_ItemID, p3d, house ) ); + } + else if ( north || west ) + { + DecorativeShield shield = null; + + if ( north ) + shield = new DecorativeShield( m_ItemID ); + else if ( west ) + shield = new DecorativeShield( GetWestItemID( m_ItemID ) ); + + house.Addons.Add( shield ); + + shield.IsRewardItem = m_Shield.IsRewardItem; + shield.MoveToWorld( p3d, map ); + + m_Shield.Delete(); + } + else + from.SendLocalizedMessage( 1049781 ); // This decoration must be placed next to a wall. + } + else + from.SendLocalizedMessage( 1042036 ); // That location is not in your house. + } + else + from.SendLocalizedMessage( 500269 ); // You cannot build that there. + } + else + from.SendLocalizedMessage( 502092 ); // You must be in your house to do this. + } + else + from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it. + } + + private class FacingGump : Gump + { + private DecorativeShieldDeed m_Shield; + private int m_ItemID; + private Point3D m_Location; + private BaseHouse m_House; + + private enum Buttons + { + Cancel, + South, + East + } + + public FacingGump( DecorativeShieldDeed shield, int itemID, Point3D location, BaseHouse house ) : base( 150, 50 ) + { + m_Shield = shield; + m_ItemID = itemID; + m_Location = location; + m_House = house; + + Closable = true; + Disposable = true; + Dragable = true; + Resizable = false; + + AddPage( 0 ); + AddBackground( 0, 0, 300, 150, 0xA28 ); + + AddItem( 90, 30, GetWestItemID( itemID ) ); + AddItem( 180, 30, itemID ); + + AddButton( 50, 35, 0x867, 0x869, (int) Buttons.East, GumpButtonType.Reply, 0 ); + AddButton( 145, 35, 0x867, 0x869, (int) Buttons.South, GumpButtonType.Reply, 0 ); + } + + public override void OnResponse( NetState sender, RelayInfo info ) + { + if ( m_Shield == null || m_Shield.Deleted || m_House == null ) + return; + + DecorativeShield shield = null; + + if ( info.ButtonID == (int) Buttons.East ) + shield = new DecorativeShield( GetWestItemID( m_ItemID ) ); + if ( info.ButtonID == (int) Buttons.South ) + shield = new DecorativeShield( m_ItemID ); + + if ( shield != null ) + { + m_House.Addons.Add( shield ); + + shield.IsRewardItem = m_Shield.IsRewardItem; + shield.MoveToWorld( m_Location, sender.Mobile.Map ); + + m_Shield.Delete(); + } + } + } + } + } +} diff --git a/Scripts/Items/Special/Veteran Rewards/FlamingHead.cs b/Scripts/Items/Special/Veteran Rewards/FlamingHead.cs new file mode 100644 index 000000000..3d638efbd --- /dev/null +++ b/Scripts/Items/Special/Veteran Rewards/FlamingHead.cs @@ -0,0 +1,257 @@ +using System; +using Server; +using Server.Gumps; +using Server.Multis; +using Server.Network; +using Server.Targeting; +using Server.Engines.VeteranRewards; + +namespace Server.Items +{ + public class FlamingHead : StoneFaceTrapNoDamage, IAddon, IRewardItem + { + public override int LabelNumber{ get{ return 1041266; } } // Flaming Head + public override bool ForceShowProperties{ get{ return ObjectPropertyList.Enabled; } } + + public Item Deed + { + get + { + FlamingHeadDeed deed = new FlamingHeadDeed(); + deed.IsRewardItem = m_IsRewardItem; + + return deed; + } + } + + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + [Constructable] + public FlamingHead() : this( StoneFaceTrapType.NorthWall ) + { + } + + [Constructable] + public FlamingHead( StoneFaceTrapType type ) : base() + { + LootType = LootType.Blessed; + Movable = false; + Type = type; + } + + public FlamingHead( Serial serial ) : base( serial ) + { + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( Core.ML && m_IsRewardItem ) + list.Add( 1076218 ); // 2nd Year Veteran Reward + } + + public override void OnDoubleClick( Mobile from ) + { + if ( from.InRange( Location, 2 ) ) + { + BaseHouse house = BaseHouse.FindHouseAt( this ); + + if ( house != null && house.IsOwner( from ) ) + { + from.CloseGump( typeof( RewardDemolitionGump ) ); + from.SendGump( new RewardDemolitionGump( this, 1018329 ) ); // Do you wish to re-deed this skull? + } + else + from.SendLocalizedMessage( 1018328 ); // You can only re-deed a skull if you placed it or you are the owner of the house. + } + else + from.Say( 1019045 ); // I can't reach that. + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_IsRewardItem = reader.ReadBool(); + } + + public bool CouldFit( IPoint3D p, Map map ) + { + if ( map == null || !map.CanFit( p.X, p.Y, p.Z, ItemData.Height ) ) + return false; + + if ( Type == StoneFaceTrapType.NorthWestWall ) + return BaseAddon.IsWall( p.X, p.Y - 1, p.Z, map ) && BaseAddon.IsWall( p.X - 1, p.Y, p.Z, map ); // north and west wall + else if ( Type == StoneFaceTrapType.NorthWall ) + return BaseAddon.IsWall( p.X, p.Y - 1, p.Z, map ); // north wall + else if ( Type == StoneFaceTrapType.WestWall ) + return BaseAddon.IsWall( p.X - 1, p.Y, p.Z, map ); // west wall + + return false; + } + } + + public class FlamingHeadDeed : Item, IRewardItem + { + public override int LabelNumber{ get{ return 1041050; } } // a flaming head deed + + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + [Constructable] + public FlamingHeadDeed() : base( 0x14F0 ) + { + LootType = LootType.Blessed; + Weight = 1.0; + } + + public FlamingHeadDeed( Serial serial ) : base( serial ) + { + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_IsRewardItem ) + list.Add( 1076218 ); // 2nd Year Veteran Reward + } + + public override void OnDoubleClick( Mobile from ) + { + if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) ) + return; + + if ( IsChildOf( from.Backpack ) ) + { + BaseHouse house = BaseHouse.FindHouseAt( from ); + + if ( house != null && house.IsOwner( from ) ) + { + from.SendLocalizedMessage( 1042264 ); // Where would you like to place this head? + from.Target = new InternalTarget( this ); + } + else + from.SendLocalizedMessage( 502115 ); // You must be in your house to do this. + } + else + from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it. + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_IsRewardItem = reader.ReadBool(); + } + + private class InternalTarget : Target + { + private FlamingHeadDeed m_Head; + + public InternalTarget( FlamingHeadDeed head ) : base( -1, true, TargetFlags.None ) + { + m_Head = head; + } + + protected override void OnTarget( Mobile from, object targeted ) + { + if ( m_Head == null || m_Head.Deleted ) + return; + + if ( m_Head.IsChildOf( from.Backpack ) ) + { + BaseHouse house = BaseHouse.FindHouseAt( from ); + + if ( house != null && house.IsOwner( from ) ) + { + IPoint3D p = targeted as IPoint3D; + Map map = from.Map; + + if ( p == null || map == null ) + return; + + Point3D p3d = new Point3D( p ); + ItemData id = TileData.ItemTable[ 0x10F5 ]; + + house = BaseHouse.FindHouseAt( p3d, map, id.Height ); + + if ( house != null && house.IsOwner( from ) ) + { + if ( map.CanFit( p3d, id.Height ) ) + { + bool north = BaseAddon.IsWall( p3d.X, p3d.Y - 1, p3d.Z, map ); + bool west = BaseAddon.IsWall( p3d.X - 1, p3d.Y, p3d.Z, map ); + + FlamingHead head = null; + + if ( north && west ) + head = new FlamingHead( StoneFaceTrapType.NorthWestWall ); + else if ( north ) + head = new FlamingHead( StoneFaceTrapType.NorthWall ); + else if ( west ) + head = new FlamingHead( StoneFaceTrapType.WestWall ); + + if ( north || west ) + { + house.Addons.Add( head ); + + head.IsRewardItem = m_Head.IsRewardItem; + head.MoveToWorld( p3d, map ); + + m_Head.Delete(); + } + else + from.SendLocalizedMessage( 1042266 ); // The head must be placed next to a wall. + } + else + from.SendLocalizedMessage( 1042266 ); // The head must be placed next to a wall. + } + else + from.SendLocalizedMessage( 1042036 ); // That location is not in your house. + } + else + from.SendLocalizedMessage( 502115 ); // You must be in your house to do this. + } + else + from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it. + } + } + } +} diff --git a/Scripts/Items/Special/Veteran Rewards/HangingSkeleton.cs b/Scripts/Items/Special/Veteran Rewards/HangingSkeleton.cs new file mode 100644 index 000000000..b6aa199f8 --- /dev/null +++ b/Scripts/Items/Special/Veteran Rewards/HangingSkeleton.cs @@ -0,0 +1,390 @@ +using System; +using Server; +using Server.Gumps; +using Server.Multis; +using Server.Network; +using Server.Targeting; +using Server.Engines.VeteranRewards; + +namespace Server.Items +{ + public class HangingSkeleton : Item, IAddon, IRewardItem + { + public override bool ForceShowProperties{ get{ return ObjectPropertyList.Enabled; } } + + public Item Deed + { + get + { + HangingSkeletonDeed deed = new HangingSkeletonDeed(); + deed.IsRewardItem = m_IsRewardItem; + + return deed; + } + } + + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + public bool FacingSouth + { + get + { + if ( ItemID == 0x1A03 || ItemID == 0x1A05 || ItemID == 0x1A09 || + ItemID == 0x1B1E || ItemID == 0x1B7F ) + return true; + + return false; + } + } + + [Constructable] + public HangingSkeleton() : this( 0x1596 ) + { + } + + [Constructable] + public HangingSkeleton( int itemID ) : base( itemID ) + { + LootType = LootType.Blessed; + Movable = false; + } + + public HangingSkeleton( Serial serial ) : base( serial ) + { + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( Core.ML && m_IsRewardItem ) + list.Add( 1076220 ); // 4th Year Veteran Reward + } + + public override void OnDoubleClick( Mobile from ) + { + if ( from.InRange( Location, 3 ) ) + { + BaseHouse house = BaseHouse.FindHouseAt( this ); + + if ( house != null && house.IsOwner( from ) ) + { + from.CloseGump( typeof( RewardDemolitionGump ) ); + from.SendGump( new RewardDemolitionGump( this, 1049783 ) ); // Do you wish to re-deed this decoration? + } + else + from.SendLocalizedMessage( 1049784 ); // You can only re-deed this decoration if you are the house owner or originally placed the decoration. + } + else + from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that. + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_IsRewardItem = reader.ReadBool(); + } + + public bool CouldFit( IPoint3D p, Map map ) + { + if ( map == null || !map.CanFit( p.X, p.Y, p.Z, ItemData.Height ) ) + return false; + + if ( FacingSouth ) + return BaseAddon.IsWall( p.X, p.Y - 1, p.Z, map ); // north wall + else + return BaseAddon.IsWall( p.X - 1, p.Y, p.Z, map ); // west wall + } + } + + public class HangingSkeletonDeed : Item, IRewardItem + { + public override int LabelNumber{ get{ return 1049772; } } // deed for a hanging skeleton decoration + + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + [Constructable] + public HangingSkeletonDeed() : base( 0x14F0 ) + { + LootType = LootType.Blessed; + Weight = 1.0; + } + + public HangingSkeletonDeed( Serial serial ) : base( serial ) + { + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_IsRewardItem ) + list.Add( 1076220 ); // 4th Year Veteran Reward + } + + public override void OnDoubleClick( Mobile from ) + { + if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) ) + return; + + if ( IsChildOf( from.Backpack ) ) + { + BaseHouse house = BaseHouse.FindHouseAt( from ); + + if ( house != null && house.IsOwner( from ) ) + { + from.CloseGump( typeof( InternalGump ) ); + from.SendGump( new InternalGump( this ) ); + } + else + from.SendLocalizedMessage( 502092 ); // You must be in your house to do this. + } + else + from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it. + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_IsRewardItem = reader.ReadBool(); + } + + public static int GetWestItemID( int south ) + { + switch ( south ) + { + case 0x1B1E: return 0x1B1D; + case 0x1B7F: return 0x1B7C; + default: return south + 1; + } + } + + private class InternalGump : Gump + { + private HangingSkeletonDeed m_Skeleton; + + public InternalGump( HangingSkeletonDeed skeleton ) : base( 100, 200 ) + { + m_Skeleton = skeleton; + + Closable = true; + Disposable = true; + Dragable = true; + Resizable = false; + + AddPage( 0 ); + + AddBackground( 25, 0, 500, 230, 0xA28 ); + + AddPage( 1 ); + + AddItem( 130, 70, 0x1A03 ); + AddButton( 150, 50, 0x845, 0x846, 0x1A03, GumpButtonType.Reply, 0 ); + + AddItem( 190, 70, 0x1A05 ); + AddButton( 210, 50, 0x845, 0x846, 0x1A05, GumpButtonType.Reply, 0 ); + + AddItem( 250, 70, 0x1A09 ); + AddButton( 270, 50, 0x845, 0x846, 0x1A09, GumpButtonType.Reply, 0 ); + + AddItem( 310, 70, 0x1B1E ); + AddButton( 330, 50, 0x845, 0x846, 0x1B1E, GumpButtonType.Reply, 0 ); + + AddItem( 370, 70, 0x1B7F ); + AddButton( 390, 50, 0x845, 0x846, 0x1B7F, GumpButtonType.Reply, 0 ); + } + + public override void OnResponse( NetState sender, RelayInfo info ) + { + if ( m_Skeleton == null | m_Skeleton.Deleted ) + return; + + Mobile m = sender.Mobile; + + if ( info.ButtonID == 0x1A03 || info.ButtonID == 0x1A05 || info.ButtonID == 0x1A09 || + info.ButtonID == 0x1B1E || info.ButtonID == 0x1B7F ) + { + m.SendLocalizedMessage( 1049780 ); // Where would you like to place this decoration? + m.Target = new InternalTarget( m_Skeleton, info.ButtonID ); + } + } + } + + private class InternalTarget : Target + { + private HangingSkeletonDeed m_Skeleton; + private int m_ItemID; + + public InternalTarget( HangingSkeletonDeed banner, int itemID ) : base( -1, true, TargetFlags.None ) + { + m_Skeleton = banner; + m_ItemID = itemID; + } + + protected override void OnTarget( Mobile from, object targeted ) + { + if ( m_Skeleton == null || m_Skeleton.Deleted ) + return; + + if ( m_Skeleton.IsChildOf( from.Backpack ) ) + { + BaseHouse house = BaseHouse.FindHouseAt( from ); + + if ( house != null && house.IsOwner( from ) ) + { + IPoint3D p = targeted as IPoint3D; + Map map = from.Map; + + if ( p == null || map == null ) + return; + + Point3D p3d = new Point3D( p ); + ItemData id = TileData.ItemTable[ m_ItemID & 0x3FFF ]; + + if ( map.CanFit( p3d, id.Height ) ) + { + house = BaseHouse.FindHouseAt( p3d, map, id.Height ); + + if ( house != null && house.IsOwner( from ) ) + { + bool north = BaseAddon.IsWall( p3d.X, p3d.Y - 1, p3d.Z, map ); + bool west = BaseAddon.IsWall( p3d.X - 1, p3d.Y, p3d.Z, map ); + + if ( north && west ) + { + from.CloseGump( typeof( FacingGump ) ); + from.SendGump( new FacingGump( m_Skeleton, m_ItemID, p3d, house ) ); + } + else if ( north || west ) + { + HangingSkeleton banner = null; + + if ( north ) + banner = new HangingSkeleton( m_ItemID ); + else if ( west ) + banner = new HangingSkeleton( GetWestItemID( m_ItemID ) ); + + house.Addons.Add( banner ); + + banner.IsRewardItem = m_Skeleton.IsRewardItem; + banner.MoveToWorld( p3d, map ); + + m_Skeleton.Delete(); + } + else + from.SendLocalizedMessage( 1042039 ); // The banner must be placed next to a wall. + } + else + from.SendLocalizedMessage( 1042036 ); // That location is not in your house. + } + else + from.SendLocalizedMessage( 500269 ); // You cannot build that there. + } + else + from.SendLocalizedMessage( 502092 ); // You must be in your house to do this. + } + else + from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it. + } + + private class FacingGump : Gump + { + private HangingSkeletonDeed m_Skeleton; + private int m_ItemID; + private Point3D m_Location; + private BaseHouse m_House; + + private enum Buttons + { + Cancel, + South, + East + } + + public FacingGump( HangingSkeletonDeed banner, int itemID, Point3D location, BaseHouse house ) : base( 150, 50 ) + { + m_Skeleton = banner; + m_ItemID = itemID; + m_Location = location; + m_House = house; + + Closable = true; + Disposable = true; + Dragable = true; + Resizable = false; + + AddPage( 0 ); + + AddBackground( 0, 0, 300, 150, 0xA28 ); + + AddItem( 90, 30, GetWestItemID( itemID ) ); + AddItem( 180, 30, itemID ); + + AddButton( 50, 35, 0x868, 0x869, (int) Buttons.East, GumpButtonType.Reply, 0 ); + AddButton( 145, 35, 0x868, 0x869, (int) Buttons.South, GumpButtonType.Reply, 0 ); + } + + public override void OnResponse( NetState sender, RelayInfo info ) + { + if ( m_Skeleton == null || m_Skeleton.Deleted || m_House == null ) + return; + + HangingSkeleton banner = null; + + if ( info.ButtonID == (int) Buttons.East ) + banner = new HangingSkeleton( GetWestItemID( m_ItemID ) ); + if ( info.ButtonID == (int) Buttons.South ) + banner = new HangingSkeleton( m_ItemID ); + + if ( banner != null ) + { + m_House.Addons.Add( banner ); + + banner.IsRewardItem = m_Skeleton.IsRewardItem; + banner.MoveToWorld( m_Location, sender.Mobile.Map ); + + m_Skeleton.Delete(); + } + } + } + } + } +} diff --git a/Scripts/Items/Special/Veteran Rewards/MiningCart.cs b/Scripts/Items/Special/Veteran Rewards/MiningCart.cs new file mode 100644 index 000000000..cf0746e72 --- /dev/null +++ b/Scripts/Items/Special/Veteran Rewards/MiningCart.cs @@ -0,0 +1,404 @@ +using System; +using System.Collections.Generic; + +using Server; +using Server.Gumps; +using Server.Multis; +using Server.Network; +using Server.Engines.VeteranRewards; + +namespace Server.Items +{ + public enum MiningCartType + { + OreSouth = 100, + OreEast = 101, + GemSouth = 102, + GemEast = 103 + } + + public class MiningCart : BaseAddon, IRewardItem + { + public override BaseAddonDeed Deed + { + get + { + MiningCartDeed deed = new MiningCartDeed(); + deed.IsRewardItem = m_IsRewardItem; + deed.Gems = m_Gems; + deed.Ore = m_Ore; + + return deed; + } + } + + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; } + } + + private MiningCartType m_CartType; + + [CommandProperty( AccessLevel.GameMaster )] + public MiningCartType CartType + { + get{ return m_CartType; } + } + + private int m_Gems; + + [CommandProperty( AccessLevel.GameMaster )] + public int Gems + { + get{ return m_Gems; } + set{ m_Gems = value; } + } + + private int m_Ore; + + [CommandProperty( AccessLevel.GameMaster )] + public int Ore + { + get{ return m_Ore; } + set{ m_Ore = value; } + } + + private Timer m_Timer; + + [Constructable] + public MiningCart( MiningCartType type ) : base() + { + m_CartType = type; + + switch ( type ) + { + case MiningCartType.OreSouth: + AddComponent( new AddonComponent( 0x1A83 ), 0, 0, 0 ); + AddComponent( new AddonComponent( 0x1A82 ), 0, 1, 0 ); + AddComponent( new AddonComponent( 0x1A86 ), 0, -1, 0 ); + break; + case MiningCartType.OreEast: + AddComponent( new AddonComponent( 0x1A88 ), 0, 0, 0 ); + AddComponent( new AddonComponent( 0x1A87 ), 1, 0, 0 ); + AddComponent( new AddonComponent( 0x1A8B ), -1, 0, 0 ); + break; + case MiningCartType.GemSouth: + AddComponent( new LocalizedAddonComponent( 0x1A83, 1080388 ), 0, 0, 0 ); + AddComponent( new LocalizedAddonComponent( 0x1A82, 1080388 ), 0, 1, 0 ); + AddComponent( new LocalizedAddonComponent( 0x1A86, 1080388 ), 0, -1, 0 ); + + AddComponent( new AddonComponent( 0xF2C ), 0, 0, 6 ); + AddComponent( new AddonComponent( 0xF1D ), 0, 0, 5 ); + AddComponent( new AddonComponent( 0xF2B ), 0, 0, 2 ); + AddComponent( new AddonComponent( 0xF21 ), 0, 0, 1 ); + AddComponent( new AddonComponent( 0xF22 ), 0, 0, 4 ); + AddComponent( new AddonComponent( 0xF2F ), 0, 0, 5 ); + AddComponent( new AddonComponent( 0xF26 ), 0, 0, 6 ); + AddComponent( new AddonComponent( 0xF27 ), 0, 0, 3 ); + AddComponent( new AddonComponent( 0xF29 ), 0, 0, 0 ); + break; + case MiningCartType.GemEast: + AddComponent( new LocalizedAddonComponent( 0x1A88, 1080388 ), 0, 0, 0 ); + AddComponent( new LocalizedAddonComponent( 0x1A87, 1080388 ), 1, 0, 0 ); + AddComponent( new LocalizedAddonComponent( 0x1A8B, 1080388 ), -1, 0, 0 ); + + AddComponent( new AddonComponent( 0xF2E ), 0, 0, 6 ); + AddComponent( new AddonComponent( 0xF12 ), 0, 0, 3 ); + AddComponent( new AddonComponent( 0xF29 ), 0, 0, 1 ); + AddComponent( new AddonComponent( 0xF24 ), 0, 0, 5 ); + AddComponent( new AddonComponent( 0xF21 ), 0, 0, 1 ); + AddComponent( new AddonComponent( 0xF2B ), 0, 0, 3 ); + AddComponent( new AddonComponent( 0xF2F ), 0, 0, 4 ); + AddComponent( new AddonComponent( 0xF23 ), 0, 0, 3 ); + AddComponent( new AddonComponent( 0xF27 ), 0, 0, 3 ); + break; + } + + m_Timer = Timer.DelayCall( TimeSpan.FromDays( 1 ), TimeSpan.FromDays( 1 ), new TimerCallback( GiveResources ) ); + } + + public MiningCart( Serial serial ) : base( serial ) + { + } + + private void GiveResources() + { + switch ( m_CartType ) + { + case MiningCartType.OreSouth: + case MiningCartType.OreEast: + m_Ore = Math.Min( 100, m_Ore + 10 ); + break; + case MiningCartType.GemSouth: + case MiningCartType.GemEast: + m_Gems = Math.Min( 50, m_Gems + 5 ); + break; + } + } + + public override void OnComponentUsed( AddonComponent c, Mobile from ) + { + BaseHouse house = BaseHouse.FindHouseAt( this ); + + if ( house != null && house.HasSecureAccess( from, SecureLevel.Friends ) ) + { + switch ( m_CartType ) + { + case MiningCartType.OreSouth: + case MiningCartType.OreEast: + if ( m_Ore > 0 ) + { + Item ingots = null; + + switch ( Utility.Random( 9 ) ) + { + case 0: ingots = new IronIngot(); break; + case 1: ingots = new DullCopperIngot(); break; + case 2: ingots = new ShadowIronIngot(); break; + case 3: ingots = new CopperIngot(); break; + case 4: ingots = new BronzeIngot(); break; + case 5: ingots = new GoldIngot(); break; + case 6: ingots = new AgapiteIngot(); break; + case 7: ingots = new VeriteIngot(); break; + case 8: ingots = new ValoriteIngot(); break; + } + + int amount = Math.Min( 10, m_Ore ); + ingots.Amount = amount; + + if ( !from.PlaceInBackpack( ingots ) ) + { + ingots.Delete(); + from.SendLocalizedMessage( 1078837 ); // Your backpack is full! Please make room and try again. + } + else + { + PublicOverheadMessage(MessageType.Regular, 0, 1094724, amount.ToString() ); // Ore: ~1_COUNT~ + m_Ore -= amount; + } + } + else + from.SendLocalizedMessage( 1094725 ); // There are no more resources available at this time. + + break; + case MiningCartType.GemSouth: + case MiningCartType.GemEast: + if ( m_Gems > 0 ) + { + Item gems = null; + + switch ( Utility.Random( 17 ) ) + { + case 0: gems = new Amber(); break; + case 1: gems = new Amethyst(); break; + case 2: gems = new Citrine(); break; + case 3: gems = new Diamond(); break; + case 4: gems = new Emerald(); break; + case 5: gems = new Ruby(); break; + case 6: gems = new Sapphire(); break; + case 7: gems = new StarSapphire(); break; + case 8: gems = new Tourmaline(); break; + + // Mondain's Legacy gems + case 9: gems = new PerfectEmerald(); break; + case 10: gems = new DarkSapphire(); break; + case 11: gems = new Turquoise(); break; + case 12: gems = new EcruCitrine(); break; + case 13: gems = new WhitePearl(); break; + case 14: gems = new FireRuby(); break; + case 15: gems = new BlueDiamond(); break; + case 16: gems = new BrilliantAmber(); break; + } + + int amount = Math.Min( 5, m_Gems ); + gems.Amount = amount; + + if ( !from.PlaceInBackpack( gems ) ) + { + gems.Delete(); + from.SendLocalizedMessage( 1078837 ); // Your backpack is full! Please make room and try again. + } + else + { + PublicOverheadMessage( MessageType.Regular, 0, 1094723, amount.ToString() ); // Gems: ~1_COUNT~ + m_Gems -= amount; + } + } + else + from.SendLocalizedMessage( 1094725 ); // There are no more resources available at this time. + + break; + } + } + else + from.SendLocalizedMessage( 1061637 ); // You are not allowed to access this. + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 1 ); // version + + #region version 1 + writer.Write( (int) m_CartType ); + #endregion + + writer.Write( (bool) m_IsRewardItem ); + writer.Write( (int) m_Gems ); + writer.Write( (int) m_Ore ); + + if ( m_Timer != null ) + writer.Write( (DateTime) m_Timer.Next ); + else + writer.Write( (DateTime) DateTime.Now + TimeSpan.FromDays( 1 ) ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + switch ( version ) + { + case 1: + m_CartType = (MiningCartType) reader.ReadInt(); + goto case 0; + case 0: + m_IsRewardItem = reader.ReadBool(); + m_Gems = reader.ReadInt(); + m_Ore = reader.ReadInt(); + + DateTime next = reader.ReadDateTime(); + + if ( next < DateTime.Now ) + next = DateTime.Now; + + m_Timer = Timer.DelayCall( next - DateTime.Now, TimeSpan.FromDays( 1 ), new TimerCallback( GiveResources ) ); + break; + } + } + } + + public class MiningCartDeed : BaseAddonDeed, IRewardItem, IRewardOption + { + public override int LabelNumber{ get{ return 1080385; } } // deed for a mining cart decoration + + public override BaseAddon Addon + { + get + { + MiningCart addon = new MiningCart( m_CartType ); + addon.IsRewardItem = m_IsRewardItem; + addon.Gems = m_Gems; + addon.Ore = m_Ore; + + return addon; + } + } + + private MiningCartType m_CartType; + + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + private int m_Gems; + + [CommandProperty( AccessLevel.GameMaster )] + public int Gems + { + get{ return m_Gems; } + set{ m_Gems = value; } + } + + private int m_Ore; + + [CommandProperty( AccessLevel.GameMaster )] + public int Ore + { + get{ return m_Ore; } + set{ m_Ore = value; } + } + + [Constructable] + public MiningCartDeed() : base() + { + LootType = LootType.Blessed; + } + + public MiningCartDeed( Serial serial ) : base( serial ) + { + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_IsRewardItem ) + list.Add( 1080457 ); // 10th Year Veteran Reward + } + + public override void OnDoubleClick( Mobile from ) + { + if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) ) + return; + + if ( IsChildOf( from.Backpack ) ) + { + from.CloseGump( typeof( RewardOptionGump ) ); + from.SendGump( new RewardOptionGump( this ) ); + } + else + from.SendLocalizedMessage( 1062334 ); // This item must be in your backpack to be used. + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (bool) m_IsRewardItem ); + writer.Write( (int) m_Gems ); + writer.Write( (int) m_Ore ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_IsRewardItem = reader.ReadBool(); + m_Gems = reader.ReadInt(); + m_Ore = reader.ReadInt(); + } + + public void GetOptions( RewardOptionList list ) + { + list.Add( (int) MiningCartType.OreSouth, 1080391 ); + list.Add( (int) MiningCartType.OreEast, 1080390 ); + list.Add( (int) MiningCartType.GemSouth, 1080500 ); + list.Add( (int) MiningCartType.GemEast, 1080499 ); + } + + public void OnOptionSelected( Mobile from, int choice ) + { + m_CartType = (MiningCartType) choice; + + if ( !Deleted ) + base.OnDoubleClick( from ); + } + } +} diff --git a/Scripts/Items/Special/Veteran Rewards/MinotaurStatue.cs b/Scripts/Items/Special/Veteran Rewards/MinotaurStatue.cs new file mode 100644 index 000000000..03c3e533a --- /dev/null +++ b/Scripts/Items/Special/Veteran Rewards/MinotaurStatue.cs @@ -0,0 +1,180 @@ +using System; +using Server; +using Server.Gumps; +using Server.Network; +using Server.Engines.VeteranRewards; + +namespace Server.Items +{ + public enum MinotaurStatueType + { + AttackSouth = 100, + AttackEast = 101, + DefendSouth = 102, + DefendEast = 103 + } + + public class MinotaurStatue : BaseAddon, IRewardItem + { + public override BaseAddonDeed Deed + { + get + { + MinotaurStatueDeed deed = new MinotaurStatueDeed(); + deed.IsRewardItem = m_IsRewardItem; + + return deed; + } + } + + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + [Constructable] + public MinotaurStatue( MinotaurStatueType type ) : base() + { + switch ( type ) + { + case MinotaurStatueType.AttackSouth: + AddComponent( new AddonComponent( 0x306C ), 0, 0, 0 ); + AddComponent( new AddonComponent( 0x306D ), -1, 0, 0 ); + AddComponent( new AddonComponent( 0x306E ), 0, -1, 0 ); + break; + case MinotaurStatueType.AttackEast: + AddComponent( new AddonComponent( 0x3074 ), 0, 0, 0 ); + AddComponent( new AddonComponent( 0x3075 ), -1, 0, 0 ); + AddComponent( new AddonComponent( 0x3076 ), 0, -1, 0 ); + break; + case MinotaurStatueType.DefendSouth: + AddComponent( new AddonComponent( 0x3072 ), 0, 0, 0 ); + AddComponent( new AddonComponent( 0x3073 ), 0, -1, 0 ); + break; + case MinotaurStatueType.DefendEast: + AddComponent( new AddonComponent( 0x306F ), 0, 0, 0 ); + AddComponent( new AddonComponent( 0x3070 ), -1, 0, 0 ); + AddComponent( new AddonComponent( 0x3071 ), 0, -1, 0 ); + break; + } + } + + public MinotaurStatue( Serial serial ) : base( serial ) + { + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_IsRewardItem = reader.ReadBool(); + } + } + + public class MinotaurStatueDeed : BaseAddonDeed, IRewardItem, IRewardOption + { + public override int LabelNumber{ get{ return 1080409; } } // Minotaur Statue Deed + + public override BaseAddon Addon + { + get + { + MinotaurStatue addon = new MinotaurStatue( m_StatueType ); + addon.IsRewardItem = m_IsRewardItem; + + return addon; + } + } + + private MinotaurStatueType m_StatueType; + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + [Constructable] + public MinotaurStatueDeed() : base() + { + LootType = LootType.Blessed; + } + + public MinotaurStatueDeed( Serial serial ) : base( serial ) + { + } + + public override void OnDoubleClick( Mobile from ) + { + if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) ) + return; + + if ( IsChildOf( from.Backpack ) ) + { + from.CloseGump( typeof( RewardOptionGump ) ); + from.SendGump( new RewardOptionGump( this ) ); + } + else + from.SendLocalizedMessage( 1062334 ); // This item must be in your backpack to be used. + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_IsRewardItem ) + list.Add( 1076218 ); // 2nd Year Veteran Reward + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_IsRewardItem = reader.ReadBool(); + } + + public void GetOptions( RewardOptionList list ) + { + list.Add( (int) MinotaurStatueType.AttackSouth, 1080410 ); // Minotaur Attack South + list.Add( (int) MinotaurStatueType.AttackEast, 1080411 ); // Minotaur Attack East + list.Add( (int) MinotaurStatueType.DefendSouth, 1080412 ); // Minotaur Defend South + list.Add( (int) MinotaurStatueType.DefendEast, 1080413 ); // Minotaur Defend East + } + + public void OnOptionSelected( Mobile from, int option ) + { + m_StatueType = (MinotaurStatueType) option; + + if ( !Deleted ) + base.OnDoubleClick( from ); + } + } +} diff --git a/Scripts/Items/Special/Veteran Rewards/PottedCactus.cs b/Scripts/Items/Special/Veteran Rewards/PottedCactus.cs new file mode 100644 index 000000000..6d7c541fc --- /dev/null +++ b/Scripts/Items/Special/Veteran Rewards/PottedCactus.cs @@ -0,0 +1,188 @@ +using System; +using Server; +using Server.Gumps; +using Server.Network; +using Server.Engines.VeteranRewards; + +namespace Server.Items +{ + public class RewardPottedCactus : Item, IRewardItem + { + public override bool ForceShowProperties{ get { return ObjectPropertyList.Enabled; } } + + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get { return m_IsRewardItem; } + set { m_IsRewardItem = value; InvalidateProperties(); } + } + + [Constructable] + public RewardPottedCactus() : this( Utility.RandomMinMax( 0x1E0F, 0x1E14 ) ) + { + } + + [Constructable] + public RewardPottedCactus( int itemID ) : base( itemID ) + { + Weight = 5.0; + } + + public RewardPottedCactus( Serial serial ) : base( serial ) + { + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 1 ); // version + + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + switch ( version ) + { + case 1: + m_IsRewardItem = reader.ReadBool(); + break; + } + + } + } + + public class PottedCactusDeed : Item, IRewardItem + { + public override int LabelNumber{ get{ return 1080407; } } // Potted Cactus Deed + + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + [Constructable] + public PottedCactusDeed() : base( 0x14F0 ) + { + LootType = LootType.Blessed; + Weight = 1.0; + } + + public PottedCactusDeed( Serial serial ) : base( serial ) + { + } + + public override void OnDoubleClick( Mobile from ) + { + if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) ) + return; + + if ( IsChildOf( from.Backpack ) ) + { + from.CloseGump( typeof( InternalGump ) ); + from.SendGump( new InternalGump( this ) ); + } + else + from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it. + } + + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_IsRewardItem ) + list.Add( 1076219 ); // 3rd Year Veteran Reward + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_IsRewardItem = reader.ReadBool(); + } + + private class InternalGump : Gump + { + private PottedCactusDeed m_Cactus; + + public InternalGump( PottedCactusDeed cactus ) : base( 100, 200 ) + { + m_Cactus = cactus; + + Closable = true; + Disposable = true; + Dragable = true; + Resizable = false; + + AddPage( 0 ); + AddBackground( 0, 0, 425, 250, 0xA28 ); + + AddPage( 1 ); + AddLabel( 45, 15, 0, "Choose a Potted Cactus:" ); + + AddItem( 45, 75, 0x1E0F ); + AddButton( 55, 50, 0x845, 0x846, 0x1E0F, GumpButtonType.Reply, 0 ); + + AddItem( 105, 75, 0x1E10 ); + AddButton( 115, 50, 0x845, 0x846, 0x1E10, GumpButtonType.Reply, 0 ); + + AddItem( 160, 75, 0x1E14 ); + AddButton( 175, 50, 0x845, 0x846, 0x1E14, GumpButtonType.Reply, 0 ); + + AddItem( 220, 75, 0x1E11 ); + AddButton( 235, 50, 0x845, 0x846, 0x1E11, GumpButtonType.Reply, 0 ); + + AddItem( 280, 75, 0x1E12 ); + AddButton( 295, 50, 0x845, 0x846, 0x1E12, GumpButtonType.Reply, 0 ); + + AddItem( 340, 75, 0x1E13 ); + AddButton( 355, 50, 0x845, 0x846, 0x1E13, GumpButtonType.Reply, 0 ); + } + + public override void OnResponse( NetState sender, RelayInfo info ) + { + if ( m_Cactus == null | m_Cactus.Deleted ) + return; + + Mobile m = sender.Mobile; + + if ( info.ButtonID >= 0x1E0F && info.ButtonID <= 0x1E14 ) + { + RewardPottedCactus cactus = new RewardPottedCactus( info.ButtonID ); + cactus.IsRewardItem = m_Cactus.IsRewardItem; + + if ( !m.PlaceInBackpack( cactus ) ) + { + cactus.Delete(); + m.SendLocalizedMessage( 1078837 ); // Your backpack is full! Please make room and try again. + } + else + m_Cactus.Delete(); + } + } + } + } +} diff --git a/Scripts/Items/Special/Veteran Rewards/StoneAnkh.cs b/Scripts/Items/Special/Veteran Rewards/StoneAnkh.cs new file mode 100644 index 000000000..f4c19d398 --- /dev/null +++ b/Scripts/Items/Special/Veteran Rewards/StoneAnkh.cs @@ -0,0 +1,269 @@ +using System; +using Server; +using Server.Multis; +using Server.Gumps; +using Server.Network; +using Server.Engines.VeteranRewards; + +namespace Server.Items +{ + public class StoneAnkhComponent : AddonComponent + { + public override bool ForceShowProperties{ get{ return ObjectPropertyList.Enabled; } } + + public StoneAnkhComponent( int itemID ) : base( itemID ) + { + Weight = 1.0; + } + + public StoneAnkhComponent( Serial serial ) : base( serial ) + { + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( Addon is StoneAnkh && ((StoneAnkh) Addon).IsRewardItem ) + list.Add( 1076221 ); // 5th Year Veteran Reward + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + } + } + + public class StoneAnkh : BaseAddon, IRewardItem + { + public override BaseAddonDeed Deed + { + get + { + StoneAnkhDeed deed = new StoneAnkhDeed(); + deed.IsRewardItem = m_IsRewardItem; + + return deed; + } + } + + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + [Constructable] + public StoneAnkh() : this( true ) + { + } + + [Constructable] + public StoneAnkh( bool east ) : base() + { + if ( east ) + { + AddComponent( new StoneAnkhComponent( 0x2 ), 0, 0, 0 ); + AddComponent( new StoneAnkhComponent( 0x3 ), 0, -1, 0 ); + } + else + { + AddComponent( new StoneAnkhComponent( 0x5 ), 0, 0, 0 ); + AddComponent( new StoneAnkhComponent( 0x4 ), -1, 0, 0 ); + } + } + + public StoneAnkh( Serial serial ) : base( serial ) + { + } + + public override void OnChop( Mobile from ) + { + from.SendLocalizedMessage( 500489 ); // You can't use an axe on that. + return; + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( Core.ML && m_IsRewardItem ) + list.Add( 1076221 ); // 5th Year Veteran Reward + } + + public override void OnComponentUsed( AddonComponent c, Mobile from ) + { + if ( from.InRange( Location, 2 ) ) + { + BaseHouse house = BaseHouse.FindHouseAt( this ); + + if ( house != null && house.IsOwner( from ) ) + { + from.CloseGump( typeof( RewardDemolitionGump ) ); + from.SendGump( new RewardDemolitionGump( this, 1049783 ) ); // Do you wish to re-deed this decoration? + } + else + from.SendLocalizedMessage( 1049784 ); // You can only re-deed this decoration if you are the house owner or originally placed the decoration. + } + else + from.Say( 1019045 ); // I can't reach that. + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_IsRewardItem = reader.ReadBool(); + } + } + + public class StoneAnkhDeed : BaseAddonDeed, IRewardItem + { + public override int LabelNumber{ get{ return 1049773; } } // deed for a stone ankh + + private bool m_East; + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + public override BaseAddon Addon + { + get + { + StoneAnkh addon = new StoneAnkh( m_East ); + addon.IsRewardItem = m_IsRewardItem; + + return addon; + } + } + + [Constructable] + public StoneAnkhDeed() : base() + { + LootType = LootType.Blessed; + } + + public StoneAnkhDeed( Serial serial ) : base( serial ) + { + } + + public override void OnDoubleClick( Mobile from ) + { + if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) ) + return; + + if ( IsChildOf( from.Backpack ) ) + { + from.CloseGump( typeof( InternalGump ) ); + from.SendGump( new InternalGump( this ) ); + } + else + from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it. + } + + private void SendTarget( Mobile m ) + { + base.OnDoubleClick( m ); + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_IsRewardItem ) + list.Add( 1076221 ); // 5th Year Veteran Reward + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_IsRewardItem = reader.ReadBool(); + } + + private class InternalGump : Gump + { + private StoneAnkhDeed m_Deed; + + private enum Buttons + { + Cancel, + South, + East + } + + public InternalGump( StoneAnkhDeed deed ) : base( 150, 50 ) + { + m_Deed = deed; + + Closable = true; + Disposable = true; + Dragable = true; + Resizable = false; + + AddPage( 0 ); + + AddBackground( 0, 0, 300, 150, 0xA28 ); + + AddItem( 90, 30, 0x4 ); + AddItem( 112, 30, 0x5 ); + AddButton( 50, 35, 0x867, 0x869, (int) Buttons.South, GumpButtonType.Reply, 0 ); // South + + AddItem( 170, 30, 0x2 ); + AddItem( 192, 30, 0x3 ); + AddButton( 145, 35, 0x867, 0x869, (int) Buttons.East, GumpButtonType.Reply, 0 ); // East + } + + public override void OnResponse( NetState sender, RelayInfo info ) + { + if ( m_Deed == null || m_Deed.Deleted ) + return; + + if ( info.ButtonID != (int) Buttons.Cancel ) + { + m_Deed.m_East = ( info.ButtonID == (int) Buttons.East ); + m_Deed.SendTarget( sender.Mobile ); + } + } + } + } +} diff --git a/Scripts/Items/Special/Veteran Rewards/TreeStump.cs b/Scripts/Items/Special/Veteran Rewards/TreeStump.cs new file mode 100644 index 000000000..bb0b119a4 --- /dev/null +++ b/Scripts/Items/Special/Veteran Rewards/TreeStump.cs @@ -0,0 +1,246 @@ +using System; +using Server; +using Server.Gumps; +using Server.Network; +using Server.Multis; +using Server.Engines.VeteranRewards; + +namespace Server.Items +{ + public class TreeStump : BaseAddon, IRewardItem + { + public override BaseAddonDeed Deed + { + get + { + TreeStumpDeed deed = new TreeStumpDeed(); + deed.IsRewardItem = m_IsRewardItem; + deed.Logs = m_Logs; + + return deed; + } + } + + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + private int m_Logs; + + [CommandProperty( AccessLevel.GameMaster )] + public int Logs + { + get{ return m_Logs; } + set{ m_Logs = value; InvalidateProperties(); } + } + + + private Timer m_Timer; + + [Constructable] + public TreeStump( int itemID ) : base() + { + AddComponent( new AddonComponent( itemID ), 0, 0, 0 ); + + m_Timer = Timer.DelayCall( TimeSpan.FromDays( 1 ), TimeSpan.FromDays( 1 ), new TimerCallback( GiveLogs ) ); + } + + public TreeStump( Serial serial ) : base( serial ) + { + } + + private void GiveLogs() + { + m_Logs = Math.Min( 100, m_Logs + 10 ); + } + + public override void OnComponentUsed( AddonComponent c, Mobile from ) + { + BaseHouse house = BaseHouse.FindHouseAt( this ); + + if ( house != null && house.HasSecureAccess( from, SecureLevel.Friends ) ) + { + if ( m_Logs > 0 ) + { + Item logs = null; + + switch ( Utility.Random( 7 ) ) + { + case 0: logs = new Log(); break; + case 1: logs = new AshLog(); break; + case 2: logs = new OakLog(); break; + case 3: logs = new YewLog(); break; + case 4: logs = new HeartwoodLog(); break; + case 5: logs = new BloodwoodLog(); break; + case 6: logs = new FrostwoodLog(); break; + } + + int amount = Math.Min( 10, m_Logs ); + logs.Amount = amount; + + if ( !from.PlaceInBackpack( logs ) ) + { + logs.Delete(); + from.SendLocalizedMessage( 1078837 ); // Your backpack is full! Please make room and try again. + } + else + { + m_Logs -= amount; + PublicOverheadMessage( MessageType.Regular, 0, 1094719, m_Logs.ToString() ); // Logs: ~1_COUNT~ + } + } + else + from.SendLocalizedMessage( 1094720 ); // There are no more logs available. + } + else + from.SendLocalizedMessage( 1061637 ); // You are not allowed to access this. + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (bool) m_IsRewardItem ); + writer.Write( (int) m_Logs ); + + if ( m_Timer != null ) + writer.Write( (DateTime) m_Timer.Next ); + else + writer.Write( (DateTime) DateTime.Now + TimeSpan.FromDays( 1 ) ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_IsRewardItem = reader.ReadBool(); + m_Logs = reader.ReadInt(); + + DateTime next = reader.ReadDateTime(); + + if ( next < DateTime.Now ) + next = DateTime.Now; + + m_Timer = Timer.DelayCall( next - DateTime.Now, TimeSpan.FromDays( 1 ), new TimerCallback( GiveLogs ) ); + } + } + + public class TreeStumpDeed : BaseAddonDeed, IRewardItem, IRewardOption + { + public override int LabelNumber{ get{ return 1080406; } } // a deed for a tree stump decoration + + public override BaseAddon Addon + { + get + { + TreeStump addon = new TreeStump( m_ItemID ); + addon.IsRewardItem = m_IsRewardItem; + addon.Logs = m_Logs; + + return addon; + } + } + + private int m_ItemID; + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + private int m_Logs; + + [CommandProperty( AccessLevel.GameMaster )] + public int Logs + { + get{ return m_Logs; } + set{ m_Logs = value; InvalidateProperties(); } + } + + [Constructable] + public TreeStumpDeed() : base() + { + LootType = LootType.Blessed; + } + + public TreeStumpDeed( Serial serial ) : base( serial ) + { + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_IsRewardItem ) + list.Add( 1076223 ); // 7th Year Veteran Reward + } + + public override void OnDoubleClick( Mobile from ) + { + if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) ) + return; + + if ( IsChildOf( from.Backpack ) ) + { + from.CloseGump( typeof( RewardOptionGump ) ); + from.SendGump( new RewardOptionGump( this ) ); + } + else + from.SendLocalizedMessage( 1062334 ); // This item must be in your backpack to be used. + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (bool) m_IsRewardItem ); + writer.Write( (int) m_Logs ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_IsRewardItem = reader.ReadBool(); + m_Logs = reader.ReadInt(); + } + + public void GetOptions( RewardOptionList list ) + { + list.Add( 1, 1080403 ); // Tree Stump with Axe West + list.Add( 2, 1080404 ); // Tree Stump with Axe North + list.Add( 3, 1080401 ); // Tree Stump East + list.Add( 4, 1080402 ); // Tree Stump South + } + + public void OnOptionSelected( Mobile from, int option ) + { + switch ( option ) + { + case 1: m_ItemID = 0xE56; break; + case 2: m_ItemID = 0xE58; break; + case 3: m_ItemID = 0xE57; break; + case 4: m_ItemID = 0xE59; break; + } + + if ( !Deleted ) + base.OnDoubleClick( from ); + } + } +} diff --git a/Scripts/Items/Special/Veteran Rewards/WallBanner.cs b/Scripts/Items/Special/Veteran Rewards/WallBanner.cs new file mode 100644 index 000000000..174f558d6 --- /dev/null +++ b/Scripts/Items/Special/Veteran Rewards/WallBanner.cs @@ -0,0 +1,500 @@ +using System; +using Server; +using Server.Gumps; +using Server.Multis; +using Server.Network; +using Server.Targeting; +using Server.Engines.VeteranRewards; + +namespace Server.Items +{ + public class WallBannerComponent : AddonComponent, IDyable + { + public override bool NeedsWall{ get{ return true; } } + public override Point3D WallPosition{ get{ return this.East ? new Point3D( -1, 0, 0 ) : new Point3D( 0, -1, 0 ); } } + + public bool East{ get { return ((WallBanner)Addon).East; } } + + public WallBannerComponent( int itemID ) : base( itemID ) + { + } + + public WallBannerComponent( Serial serial ) : base( serial ) + { + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + } + + public bool Dye( Mobile from, DyeTub sender ) + { + if ( Deleted ) + return false; + + if ( Addon != null ) + Addon.Hue = sender.DyedHue; + + return true; + } + } + + public class WallBanner : BaseAddon, IRewardItem + { + public override BaseAddonDeed Deed + { + get + { + WallBannerDeed deed = new WallBannerDeed(); + deed.IsRewardItem = m_IsRewardItem; + + return deed; + } + } + + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + private bool m_East; + + [CommandProperty( AccessLevel.GameMaster )] + public bool East + { + get{ return m_East; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + [Constructable] + public WallBanner( int bannerID ) : base() + { + m_East = ((bannerID % 2) == 1 ); + + switch ( bannerID ) + { + case 1: + AddComponent( new WallBannerComponent( 0x161F ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x161E ), 0, 1, 0 ); + AddComponent( new WallBannerComponent( 0x161D ), 0, 2, 0 ); + break; + case 2: + AddComponent( new WallBannerComponent( 0x1586 ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x1587 ), 1, 0, 0 ); + AddComponent( new WallBannerComponent( 0x1588 ), 2, 0, 0 ); + break; + case 3: + AddComponent( new WallBannerComponent( 0x1622 ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x1621 ), 0, 1, 0 ); + AddComponent( new WallBannerComponent( 0x1620 ), 0, 2, 0 ); + break; + case 4: + AddComponent( new WallBannerComponent( 0x1589 ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x158A ), 1, 0, 0 ); + AddComponent( new WallBannerComponent( 0x158B ), 2, 0, 0 ); + break; + case 5: + AddComponent( new WallBannerComponent( 0x1625 ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x1624 ), 0, 1, 0 ); + AddComponent( new WallBannerComponent( 0x1623 ), 0, 2, 0 ); + break; + case 6: + AddComponent( new WallBannerComponent( 0x158C ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x158D ), 1, 0, 0 ); + AddComponent( new WallBannerComponent( 0x158E ), 2, 0, 0 ); + break; + case 7: + AddComponent( new WallBannerComponent( 0x1628 ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x1627 ), 0, 1, 0 ); + AddComponent( new WallBannerComponent( 0x1626 ), 0, 2, 0 ); + break; + case 8: + AddComponent( new WallBannerComponent( 0x1590 ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x1591 ), 1, 0, 0 ); + AddComponent( new WallBannerComponent( 0x158F ), 2, 0, 0 ); + break; + case 9: + AddComponent( new WallBannerComponent( 0x162A ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x1629 ), 0, 1, 0 ); + AddComponent( new WallBannerComponent( 0x1626 ), 0, 2, 0 ); + break; + case 10: + AddComponent( new WallBannerComponent( 0x1592 ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x1593 ), 1, 0, 0 ); + AddComponent( new WallBannerComponent( 0x158F ), 2, 0, 0 ); + break; + case 11: + AddComponent( new WallBannerComponent( 0x162D ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x162C ), 0, 1, 0 ); + AddComponent( new WallBannerComponent( 0x162B ), 0, 2, 0 ); + break; + case 12: + AddComponent( new WallBannerComponent( 0x1594 ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x1595 ), 1, 0, 0 ); + AddComponent( new WallBannerComponent( 0x1596 ), 2, 0, 0 ); + break; + case 13: + AddComponent( new WallBannerComponent( 0x1632 ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x1631 ), 0, 1, 0 ); + AddComponent( new WallBannerComponent( 0x162E ), 0, 2, 0 ); + break; + case 14: + AddComponent( new WallBannerComponent( 0x1598 ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x159B ), 1, 0, 0 ); + AddComponent( new WallBannerComponent( 0x159C ), 2, 0, 0 ); + break; + case 15: + AddComponent( new WallBannerComponent( 0x1633 ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x1630 ), 0, 1, 0 ); + AddComponent( new WallBannerComponent( 0x162F ), 0, 2, 0 ); + break; + case 16: + AddComponent( new WallBannerComponent( 0x1599 ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x159A ), 1, 0, 0 ); + AddComponent( new WallBannerComponent( 0x159D ), 2, 0, 0 ); + break; + + + case 17: + AddComponent( new WallBannerComponent( 0x1610 ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x160F ), 0, 1, 0 ); + break; + case 18: + AddComponent( new WallBannerComponent( 0x15A0 ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x15A1 ), 1, 0, 0 ); + break; + + case 19: + AddComponent( new WallBannerComponent( 0x1612 ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x1611 ), 0, 1, 0 ); + break; + case 20: + AddComponent( new WallBannerComponent( 0x15A2 ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x15A3 ), 1, 0, 0 ); + break; + + case 21: + AddComponent( new WallBannerComponent( 0x1614 ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x1613 ), 0, 1, 0 ); + break; + case 22: + AddComponent( new WallBannerComponent( 0x15A4 ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x15A5 ), 1, 0, 0 ); + break; + + case 23: + AddComponent( new WallBannerComponent( 0x1616 ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x1615 ), 0, 1, 0 ); + break; + case 24: + AddComponent( new WallBannerComponent( 0x15A6 ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x15A7 ), 1, 0, 0 ); + break; + + case 25: + AddComponent( new WallBannerComponent( 0x1618 ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x1617 ), 0, 1, 0 ); + break; + case 26: + AddComponent( new WallBannerComponent( 0x15A8 ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x15A9 ), 1, 0, 0 ); + break; + + case 27: + AddComponent( new WallBannerComponent( 0x161A ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x1619 ), 0, 1, 0 ); + break; + case 28: + AddComponent( new WallBannerComponent( 0x15AA ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x15AB ), 1, 0, 0 ); + break; + + case 29: + AddComponent( new WallBannerComponent( 0x161C ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x161B ), 0, 1, 0 ); + break; + case 30: + AddComponent( new WallBannerComponent( 0x15AC ), 0, 0, 0 ); + AddComponent( new WallBannerComponent( 0x15AD ), 1, 0, 0 ); + break; + } + } + + public WallBanner( Serial serial ) : base( serial ) + { + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (bool) m_East ); + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_East = reader.ReadBool(); + m_IsRewardItem = reader.ReadBool(); + } + } + + public class WallBannerDeed : BaseAddonDeed, IRewardItem + { + public override int LabelNumber{ get{ return 1080549; } } // Wall Banner Deed + + public override BaseAddon Addon + { + get + { + WallBanner addon = new WallBanner( m_BannerID ); + addon.IsRewardItem = m_IsRewardItem; + + return addon; + } + } + + private int m_BannerID; + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + [Constructable] + public WallBannerDeed() : base() + { + LootType = LootType.Blessed; + } + + public WallBannerDeed( Serial serial ) : base( serial ) + { + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_IsRewardItem ) + list.Add( 1076225 ); // 9th Year Veteran Reward + } + + public override void OnDoubleClick( Mobile from ) + { + if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) ) + return; + + if ( IsChildOf( from.Backpack ) ) + { + from.CloseGump( typeof( InternalGump ) ); + from.SendGump( new InternalGump( this ) ); + } + else + from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it. + } + + public void Use( Mobile m, int bannerID ) + { + m_BannerID = bannerID; + + base.OnDoubleClick( m ); + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + + m_IsRewardItem = reader.ReadBool(); + } + + private class InternalGump : Gump + { + private WallBannerDeed m_WallBanner; + + public InternalGump( WallBannerDeed WallBanner ) : base( 150, 50 ) + { + m_WallBanner = WallBanner; + + Closable = true; + Disposable = true; + Dragable = true; + Resizable = false; + + AddBackground( 25, 0, 500, 265, 0xA28 ); + AddLabel( 70, 12, 0x3E3, "Choose a Wall Banner:" ); + + AddPage( 1 ); + + AddItem( 55, 110, 0x161D ); + AddItem( 75, 90, 0x161E ); + AddItem( 95, 70, 0x161F ); + AddButton( 70, 50, 0x845, 0x846, 1, GumpButtonType.Reply, 0 ); + AddItem( 105, 70, 0x1586 ); + AddItem( 125, 90, 0x1587 ); + AddItem( 145, 110, 0x1588 ); + AddButton( 145, 50, 0x845, 0x846, 2, GumpButtonType.Reply, 0 ); + AddItem( 200, 110, 0x1620 ); + AddItem( 220, 90, 0x1621 ); + AddItem( 240, 70, 0x1622 ); + AddButton( 220, 50, 0x845, 0x846, 3, GumpButtonType.Reply, 0 ); + AddItem( 250, 70, 0x1589 ); + AddItem( 270, 90, 0x158A ); + AddItem( 290, 110, 0x158B ); + AddButton( 300, 50, 0x845, 0x846, 4, GumpButtonType.Reply, 0 ); + AddItem( 350, 110, 0x1623 ); + AddItem( 370, 90, 0x1624 ); + AddItem( 390, 70, 0x1625 ); + AddButton( 365, 50, 0x845, 0x846, 5, GumpButtonType.Reply, 0 ); + AddItem( 400, 70, 0x158C ); + AddItem( 420, 90, 0x158D ); + AddItem( 440, 110, 0x158E ); + AddButton( 445, 50, 0x845, 0x846, 6, GumpButtonType.Reply, 0 ); + AddButton( 455, 205, 0x8B0, 0x8B0, 0, GumpButtonType.Page, 2 ); + + AddPage( 2 ); + + AddItem( 52, 110, 0x1626 ); + AddItem( 72, 90, 0x1627 ); + AddItem( 95, 70, 0x1628 ); + AddButton( 70, 50, 0x845, 0x846, 7, GumpButtonType.Reply, 0 ); + AddItem( 105, 70, 0x1590 ); + AddItem( 125, 90, 0x1591 ); + AddItem( 145, 110, 0x158F ); + AddButton( 145, 50, 0x845, 0x846, 8, GumpButtonType.Reply, 0 ); + AddItem( 197, 110, 0x1626 ); + AddItem( 217, 90, 0x1629 ); + AddItem( 240, 70, 0x162A ); + AddButton( 220, 50, 0x845, 0x846, 9, GumpButtonType.Reply, 0 ); + AddItem( 250, 70, 0x1592 ); + AddItem( 270, 90, 0x1593 ); + AddItem( 290, 110, 0x158F ); + AddButton( 300, 50, 0x845, 0x846, 10, GumpButtonType.Reply, 0 ); + AddItem( 340, 110, 0x162B ); + AddItem( 363, 90, 0x162C ); + AddItem( 385, 70, 0x162D ); + AddButton( 365, 50, 0x845, 0x846, 11, GumpButtonType.Reply, 0 ); + AddItem( 395, 70, 0x1594 ); + AddItem( 417, 90, 0x1595 ); + AddItem( 439, 111, 0x1596 ); + AddButton( 445, 50, 0x845, 0x846, 12, GumpButtonType.Reply, 0 ); + AddButton( 70, 205, 0x8AF, 0x8AF, 0, GumpButtonType.Page, 1 ); + AddButton( 455, 205, 0x8B0, 0x8B0, 0, GumpButtonType.Page, 3 ); + + AddPage( 3 ); + + AddItem( 55, 110, 0x162E ); + AddItem( 75, 93, 0x1631 ); + AddItem( 95, 70, 0x1632 ); + AddButton( 70, 50, 0x845, 0x846, 13, GumpButtonType.Reply, 0 ); + AddItem( 118, 70, 0x1598 ); + AddItem( 138, 94, 0x159B ); + AddItem( 159, 113, 0x159C ); + AddButton( 160, 50, 0x845, 0x846, 14, GumpButtonType.Reply, 0 ); + AddItem( 219, 111, 0x162F ); + AddItem( 238, 94, 0x1630 ); + AddItem( 258, 70, 0x1633 ); + AddButton( 240, 50, 0x845, 0x846, 15, GumpButtonType.Reply, 0 ); + AddItem( 279, 70, 0x1599 ); + AddItem( 298, 93, 0x159A ); + AddItem( 319, 113, 0x159D ); + AddButton( 320, 50, 0x845, 0x846, 16, GumpButtonType.Reply, 0 ); + AddItem( 380, 90, 0x160F ); + AddItem( 400, 70, 0x1610 ); + AddButton( 390, 50, 0x845, 0x846, 17, GumpButtonType.Reply, 0 ); + AddItem( 420, 70, 0x15A0 ); + AddItem( 440, 90, 0x15A1 ); + AddButton( 455, 50, 0x845, 0x846, 18, GumpButtonType.Reply, 0 ); + AddButton( 70, 205, 0x8AF, 0x8AF, 0, GumpButtonType.Page, 2 ); + AddButton( 455, 205, 0x8B0, 0x8B0, 0, GumpButtonType.Page, 4 ); + + AddPage( 4 ); + + AddItem( 55, 90, 0x1611 ); + AddItem( 75, 70, 0x1612 ); + AddButton( 70, 50, 0x845, 0x846, 19, GumpButtonType.Reply, 0 ); + AddItem( 105, 70, 0x15A2 ); + AddItem( 125, 90, 0x15A3 ); + AddButton( 145, 50, 0x845, 0x846, 20, GumpButtonType.Reply, 0 ); + AddItem( 200, 84, 0x1613 ); + AddItem( 220, 70, 0x1614 ); + AddButton( 215, 50, 0x845, 0x846, 21, GumpButtonType.Reply, 0 ); + AddItem( 250, 70, 0x15A4 ); + AddItem( 270, 84, 0x15A5 ); + AddButton( 290, 50, 0x845, 0x846, 22, GumpButtonType.Reply, 0 ); + AddItem( 350, 90, 0x1615 ); + AddItem( 370, 70, 0x1616 ); + AddButton( 365, 50, 0x845, 0x846, 23, GumpButtonType.Reply, 0 ); + AddItem( 400, 70, 0x15A6 ); + AddItem( 420, 90, 0x15A7 ); + AddButton( 445, 50, 0x845, 0x846, 24, GumpButtonType.Reply, 0 ); + AddButton( 70, 205, 0x8AF, 0x8AF, 0, GumpButtonType.Page, 3 ); + AddButton( 455, 205, 0x8B0, 0x8B0, 0, GumpButtonType.Page, 5 ); + + AddPage( 5 ); + + AddItem( 55, 90, 0x1617 ); + AddItem( 77, 70, 0x1618 ); + AddButton( 70, 50, 0x845, 0x846, 25, GumpButtonType.Reply, 0 ); + AddItem( 105, 70, 0x15A8 ); + AddItem( 127, 90, 0x15A9 ); + AddButton( 145, 50, 0x845, 0x846, 26, GumpButtonType.Reply, 0 ); + AddItem( 200, 90, 0x1619 ); + AddItem( 222, 70, 0x161A ); + AddButton( 220, 50, 0x845, 0x846, 27, GumpButtonType.Reply, 0 ); + AddItem( 250, 70, 0x15AA ); + AddItem( 272, 90, 0x15AB ); + AddButton( 300, 50, 0x845, 0x846, 28, GumpButtonType.Reply, 0 ); + AddItem( 350, 90, 0x161B ); + AddItem( 372, 70, 0x161C ); + AddButton( 365, 50, 0x845, 0x846, 29, GumpButtonType.Reply, 0 ); + AddItem( 400, 70, 0x15AC ); + AddItem( 422, 90, 0x15AD ); + AddButton( 445, 50, 0x845, 0x846, 30, GumpButtonType.Reply, 0 ); + AddButton( 70, 205, 0x8AF, 0x8AF, 0, GumpButtonType.Page, 4 ); + } + + public override void OnResponse( NetState sender, RelayInfo info ) + { + if ( m_WallBanner == null || m_WallBanner.Deleted ) + return; + + if ( info.ButtonID > 0 && info.ButtonID < 31 ) + m_WallBanner.Use( sender.Mobile, info.ButtonID ); + } + } + } +} diff --git a/Scripts/Items/Special/Veteran Rewards/WeaponEngravingTool.cs b/Scripts/Items/Special/Veteran Rewards/WeaponEngravingTool.cs new file mode 100644 index 000000000..f293ac71b --- /dev/null +++ b/Scripts/Items/Special/Veteran Rewards/WeaponEngravingTool.cs @@ -0,0 +1,330 @@ +using System; +using Server; +using Server.Mobiles; +using Server.Targeting; +using Server.Gumps; +using Server.Engines.VeteranRewards; + +namespace Server.Items +{ + public class WeaponEngravingTool : Item, IUsesRemaining, IRewardItem + { + public override int LabelNumber{ get{ return 1076158; } } // Weapon Engraving Tool + + private int m_UsesRemaining; + private bool m_IsRewardItem; + + [CommandProperty( AccessLevel.GameMaster )] + public int UsesRemaining + { + get{ return m_UsesRemaining; } + set{ m_UsesRemaining = value; InvalidateProperties(); } + } + + public virtual bool ShowUsesRemaining + { + get{ return true; } + set{} + } + + [CommandProperty( AccessLevel.GameMaster )] + public bool IsRewardItem + { + get{ return m_IsRewardItem; } + set{ m_IsRewardItem = value; InvalidateProperties(); } + } + + [Constructable] + public WeaponEngravingTool() : this( 10 ) + { + } + + [Constructable] + public WeaponEngravingTool( int uses ) : base( 0x32F8 ) + { + LootType = LootType.Blessed; + Weight = 1.0; + + m_UsesRemaining = uses; + } + + public WeaponEngravingTool( Serial serial ) : base( serial ) + { + } + + public override void OnDoubleClick( Mobile from ) + { + if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) ) + return; + + if ( m_UsesRemaining > 0 ) + { + from.SendLocalizedMessage( 1072357 ); // Select an object to engrave. + from.Target = new TargetWeapon( this ); + } + else + { + if ( from.Skills.Tinkering.Value == 0 ) + { + from.SendLocalizedMessage( 1076179 ); // Since you have no tinkering skill, you will need to find an NPC tinkerer to repair this for you. + } + else if ( from.Skills.Tinkering.Value < 75.0 ) + { + from.SendLocalizedMessage( 1076178 ); // Your tinkering skill is too low to fix this yourself. An NPC tinkerer can help you repair this for a fee. + } + else + { + Item diamond = from.Backpack.FindItemByType( typeof( BlueDiamond ) ); + + if ( diamond != null ) + from.SendGump( new ConfirmGump( this, null ) ); + else + from.SendLocalizedMessage( 1076166 ); // You do not have a blue diamond needed to recharge the engraving tool. + } + + from.SendLocalizedMessage( 1076163 ); // There are no charges left on this engraving tool. + } + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_IsRewardItem ) + list.Add( 1076224 ); // 8th Year Veteran Reward + + if ( ShowUsesRemaining ) + list.Add( 1060584, m_UsesRemaining.ToString() ); // uses remaining: ~1_val~ + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.Write( (int) 0 ); // version + + writer.Write( (int) m_UsesRemaining ); + writer.Write( (bool) m_IsRewardItem ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadInt(); + + m_UsesRemaining = reader.ReadInt(); + m_IsRewardItem = reader.ReadBool(); + } + + public virtual void Recharge( Mobile from, Mobile guildmaster ) + { + if ( from.Backpack != null ) + { + Item diamond = from.Backpack.FindItemByType( typeof( BlueDiamond ) ); + + if ( guildmaster != null ) + { + if ( m_UsesRemaining <= 0 ) + { + if ( diamond != null && Banker.Withdraw( from, 100000 ) ) + { + diamond.Consume(); + UsesRemaining = 10; + guildmaster.Say( 1076165 ); // Your weapon engraver should be good as new! + } + else + guildmaster.Say( 1076167 ); // You need a 100,000 gold and a blue diamond to recharge the weapon engraver. + } + else + guildmaster.Say( 1076164 ); // I can only help with this if you are carrying an engraving tool that needs repair. + } + else + { + if ( from.Skills.Tinkering.Value == 0 ) + { + from.SendLocalizedMessage( 1076179 ); // Since you have no tinkering skill, you will need to find an NPC tinkerer to repair this for you. + } + else if ( from.Skills.Tinkering.Value < 75.0 ) + { + from.SendLocalizedMessage( 1076178 ); // Your tinkering skill is too low to fix this yourself. An NPC tinkerer can help you repair this for a fee. + } + else if ( diamond != null ) + { + diamond.Consume(); + + if ( Utility.RandomDouble() < from.Skills.Tinkering.Value / 100 ) + { + UsesRemaining = 10; + from.SendLocalizedMessage( 1076165 ); // Your weapon engraver should be good as new! ????? + } + else + from.SendLocalizedMessage( 1076175 ); // You cracked the diamond attempting to fix the weapon engraver. + } + else + from.SendLocalizedMessage( 1076166 ); // You do not have a blue diamond needed to recharge the engraving tool. + } + } + } + + public static WeaponEngravingTool Find( Mobile from ) + { + if ( from.Backpack != null ) + return from.Backpack.FindItemByType( typeof( WeaponEngravingTool ) ) as WeaponEngravingTool; + + return null; + } + + private class TargetWeapon : Target + { + private WeaponEngravingTool m_Tool; + + public TargetWeapon( WeaponEngravingTool tool ) : base( -1, true, TargetFlags.None ) + { + m_Tool = tool; + } + + protected override void OnTarget( Mobile from, object targeted ) + { + if ( m_Tool == null || m_Tool.Deleted ) + return; + + if ( targeted is BaseWeapon ) + { + BaseWeapon item = (BaseWeapon) targeted; + + from.CloseGump( typeof( InternalGump ) ); + from.SendGump( new InternalGump( m_Tool, item ) ); + } + else + from.SendLocalizedMessage( 1072309 ); // The selected item cannot be engraved by this engraving tool. + } + } + + private class InternalGump : Gump + { + private WeaponEngravingTool m_Tool; + private BaseWeapon m_Target; + + private enum Buttons + { + Cancel, + Okay, + Text + } + + public InternalGump( WeaponEngravingTool tool, BaseWeapon target ) : base( 0, 0 ) + { + m_Tool = tool; + m_Target = target; + + Closable = true; + Disposable = true; + Dragable = true; + Resizable = false; + + AddBackground( 50, 50, 400, 300, 0xA28 ); + + AddPage( 0 ); + + AddHtmlLocalized( 50, 70, 400, 20, 1072359, 0x0, false, false ); //
Engraving Tool
+ AddHtmlLocalized( 75, 95, 350, 145, 1076229, 0x0, true, true ); // Please enter the text to add to the selected object. Leave the text area blank to remove any existing text. Removing text does not use a charge. + AddButton( 125, 300, 0x81A, 0x81B, (int) Buttons.Okay, GumpButtonType.Reply, 0 ); + AddButton( 320, 300, 0x819, 0x818, (int) Buttons.Cancel, GumpButtonType.Reply, 0 ); + AddImageTiled( 75, 245, 350, 40, 0xDB0 ); + AddImageTiled( 76, 245, 350, 2, 0x23C5 ); + AddImageTiled( 75, 245, 2, 40, 0x23C3 ); + AddImageTiled( 75, 285, 350, 2, 0x23C5 ); + AddImageTiled( 425, 245, 2, 42, 0x23C3 ); + + AddTextEntry( 75, 245, 350, 40, 0x0, (int) Buttons.Text, "" ); + } + + public override void OnResponse( Server.Network.NetState state, RelayInfo info ) + { + if ( m_Tool == null || m_Tool.Deleted || m_Target == null || m_Target.Deleted ) + return; + + if ( info.ButtonID == (int) Buttons.Okay ) + { + TextRelay relay = info.GetTextEntry( (int) Buttons.Text ); + + if ( relay != null ) + { + if ( String.IsNullOrEmpty( relay.Text ) ) + { + m_Target.EngravedText = null; + state.Mobile.SendLocalizedMessage( 1072362 ); // You remove the engraving from the object. + } + else + { + if ( relay.Text.Length > 64 ) + m_Target.EngravedText = relay.Text.Substring( 0, 64 ); + else + m_Target.EngravedText = relay.Text; + + state.Mobile.SendLocalizedMessage( 1072361 ); // You engraved the object. + m_Target.InvalidateProperties(); + m_Tool.UsesRemaining -= 1; + m_Tool.InvalidateProperties(); + } + } + } + else + state.Mobile.SendLocalizedMessage( 1072363 ); // The object was not engraved. + } + } + + public class ConfirmGump : Gump + { + private WeaponEngravingTool m_Engraver; + private Mobile m_Guildmaster; + + private enum Buttons + { + Cancel, + Confirm + } + + public ConfirmGump( WeaponEngravingTool engraver, Mobile guildmaster ) : base( 200, 200 ) + { + m_Engraver = engraver; + m_Guildmaster = guildmaster; + + Closable = false; + Disposable = true; + Dragable = true; + Resizable = false; + + AddPage( 0 ); + + AddBackground( 0, 0, 291, 133, 0x13BE ); + AddImageTiled( 5, 5, 280, 100, 0xA40 ); + + if ( guildmaster != null ) + { + AddHtmlLocalized( 9, 9, 272, 100, 1076169, 0x7FFF, false, false ); // It will cost you 100,000 gold and a blue diamond to recharge your weapon engraver with 10 charges. + AddHtmlLocalized( 195, 109, 120, 20, 1076172, 0x7FFF, false, false ); // Recharge it + } + else + { + AddHtmlLocalized( 9, 9, 272, 100, 1076176, 0x7FFF, false, false ); // You will need a blue diamond to repair the tip of the engraver. A successful repair will give the engraver 10 charges. + AddHtmlLocalized( 195, 109, 120, 20, 1076177, 0x7FFF, false, false ); // Replace the tip. + } + + AddButton( 160, 107, 0xFB7, 0xFB8, (int) Buttons.Confirm, GumpButtonType.Reply, 0 ); + AddButton( 5, 107, 0xFB1, 0xFB2, (int) Buttons.Cancel, GumpButtonType.Reply, 0 ); + AddHtmlLocalized( 40, 109, 100, 20, 1060051, 0x7FFF, false, false ); // CANCEL + } + + public override void OnResponse( Server.Network.NetState state, RelayInfo info ) + { + if ( m_Engraver == null || m_Engraver.Deleted ) + return; + + if ( info.ButtonID == (int) Buttons.Confirm ) + m_Engraver.Recharge( state.Mobile, m_Guildmaster ); + } + } + } +} diff --git a/Scripts/Items/Weapons/BaseWeapon.cs b/Scripts/Items/Weapons/BaseWeapon.cs index 21a802ca2..f4a7d9f41 100644 --- a/Scripts/Items/Weapons/BaseWeapon.cs +++ b/Scripts/Items/Weapons/BaseWeapon.cs @@ -23,6 +23,15 @@ namespace Server.Items public abstract class BaseWeapon : Item, IWeapon, IFactionItem, ICraftable, ISlayer, IDurability { + private string m_EngravedText; + + [CommandProperty( AccessLevel.GameMaster )] + public string EngravedText + { + get{ return m_EngravedText; } + set{ m_EngravedText = value; InvalidateProperties(); } + } + #region Factions private FactionItem m_FactionState; @@ -135,6 +144,8 @@ namespace Server.Items public virtual int InitMinHits{ get{ return 0; } } public virtual int InitMaxHits{ get{ return 0; } } + public virtual bool CanFortify{ get{ return true; } } + public override int PhysicalResistance{ get{ return m_AosWeaponAttributes.ResistPhysicalBonus; } } public override int FireResistance{ get{ return m_AosWeaponAttributes.ResistFireBonus; } } public override int ColdResistance{ get{ return m_AosWeaponAttributes.ResistColdBonus; } } @@ -2397,7 +2408,7 @@ namespace Server.Items public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); - + writer.Write( (int) 8 ); // version SaveFlag flags = SaveFlag.None; @@ -2432,6 +2443,7 @@ namespace Server.Items SetSaveFlag( ref flags, SaveFlag.SkillBonuses, !m_AosSkillBonuses.IsEmpty ); SetSaveFlag( ref flags, SaveFlag.Slayer2, m_Slayer2 != SlayerName.None ); SetSaveFlag( ref flags, SaveFlag.ElementalDamages, !m_AosElementDamages.IsEmpty ); + SetSaveFlag( ref flags, SaveFlag.EngravedText, !String.IsNullOrEmpty( m_EngravedText ) ); writer.Write( (int) flags ); @@ -2518,6 +2530,9 @@ namespace Server.Items if( GetSaveFlag( flags, SaveFlag.ElementalDamages ) ) m_AosElementDamages.Serialize( writer ); + + if( GetSaveFlag( flags, SaveFlag.EngravedText ) ) + writer.Write( (string) m_EngravedText ); } [Flags] @@ -2553,7 +2568,8 @@ namespace Server.Items PlayerConstructed = 0x04000000, SkillBonuses = 0x08000000, Slayer2 = 0x10000000, - ElementalDamages = 0x20000000 + ElementalDamages = 0x20000000, + EngravedText = 0x40000000 } public override void Deserialize( GenericReader reader ) @@ -2727,6 +2743,9 @@ namespace Server.Items else m_AosElementDamages = new AosElementAttributes( this ); + if( GetSaveFlag( flags, SaveFlag.EngravedText ) ) + m_EngravedText = reader.ReadString(); + break; } case 4: @@ -2989,6 +3008,9 @@ namespace Server.Items list.Add( LabelNumber ); else list.Add( Name ); + + if ( !String.IsNullOrEmpty( m_EngravedText ) ) + list.Add( 1062613, m_EngravedText ); } public override bool AllowEquipedCast( Mobile from ) diff --git a/Scripts/Mobiles/Animals/Mounts/Ethereals.cs b/Scripts/Mobiles/Animals/Mounts/Ethereals.cs index 938f66ed9..ff9371456 100644 --- a/Scripts/Mobiles/Animals/Mounts/Ethereals.cs +++ b/Scripts/Mobiles/Animals/Mounts/Ethereals.cs @@ -55,6 +55,8 @@ namespace Server.Mobiles list.Add( "Donation Ethereal" ); list.Add( "7.5 sec slower cast time if not a 9mo. Veteran" ); } + if ( Core.ML && m_IsRewardItem ) + list.Add( RewardSystem.GetRewardYearLabel( this, new object[]{ } ) ); // X Year Veteran Reward } [CommandProperty( AccessLevel.GameMaster )] @@ -701,6 +703,63 @@ namespace Server.Mobiles } } + public class RideablePolarBear : EtherealMount + { + public override int LabelNumber { get { return 1076159; } } // Rideable Polar Bear + public override int EtherealHue { get { return 0; } } + + [Constructable] + public RideablePolarBear() : base( 0x20E1, 0x3EC5 ) + { + } + + public RideablePolarBear( Serial serial ) : base( serial ) + { + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + } + } + + public class EtherealCuSidhe : EtherealMount + { + public override int LabelNumber { get { return 1080386; } } // Ethereal Cu Sidhe Statuette + + [Constructable] + public EtherealCuSidhe() : base( 0x2D96, 0x3E91 ) + { + } + + public EtherealCuSidhe( Serial serial ) : base( serial ) + { + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.WriteEncodedInt( 0 ); // version + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadEncodedInt(); + } + } + public class ChargerOfTheFallen : EtherealMount { public override int LabelNumber { get { return 1074816; } } // Charger of the Fallen Statuette diff --git a/Scripts/Mobiles/Monsters/ML/Special/Ilhenir.cs b/Scripts/Mobiles/Monsters/ML/Special/Ilhenir.cs index dfcfa8d01..31a6ccec2 100644 --- a/Scripts/Mobiles/Monsters/ML/Special/Ilhenir.cs +++ b/Scripts/Mobiles/Monsters/ML/Special/Ilhenir.cs @@ -1,17 +1,28 @@ using System; using Server; +using Server.Engines.CannedEvil; using Server.Items; namespace Server.Mobiles { [CorpseName("corpse of Ilhenir")] - public class Ilhenir : BaseCreature + public class Ilhenir : BaseChampion { + public override ChampionSkullType SkullType{ get{ return ChampionSkullType.Pain; } } + + public override Type[] UniqueList{ get{ return new Type[] { }; } } + public override Type[] SharedList{ get{ return new Type[] { typeof( ANecromancerShroud ), + typeof( LieutenantOfTheBritannianRoyalGuard ), + typeof( OblivionsNeedle ), + typeof( TheRobeOfBritanniaAri ) }; } } + public override Type[] DecorativeList{ get{ return new Type[] { typeof( MonsterStatuette ) }; } } + + public override MonsterStatuetteType[] StatueTypes{ get{ return new MonsterStatuetteType[] { MonsterStatuetteType.PlagueBeast, + MonsterStatuetteType.RedDeath }; } } // Based off of the Bone Demon, since Stratics and UOGuide are lacking in info. Many things guessed for now. [Constructable] - public Ilhenir() - : base(AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4) + public Ilhenir() : base(AIType.AI_Mage) { Name = "Ilhenir"; Title = "the Stained"; @@ -23,7 +34,7 @@ namespace Server.Mobiles SetHits( 9000 ); - SetDamage(4, 6); + SetDamage(21, 28); SetDamageType(ResistanceType.Physical, 60); SetDamageType(ResistanceType.Fire, 20); diff --git a/Scripts/Mobiles/Monsters/ML/Special/Meraktus.cs b/Scripts/Mobiles/Monsters/ML/Special/Meraktus.cs index b0bee34a1..13ffdf8cc 100644 --- a/Scripts/Mobiles/Monsters/ML/Special/Meraktus.cs +++ b/Scripts/Mobiles/Monsters/ML/Special/Meraktus.cs @@ -1,5 +1,6 @@ using System; using System.Collections; +using Server.Engines.CannedEvil; using Server.Items; using Server.Targeting; using Server.Misc; @@ -7,10 +8,22 @@ using Server.Misc; namespace Server.Mobiles { [CorpseName( "a minotaur corpse" )] - public class Meraktus : BaseCreature + public class Meraktus : BaseChampion { + public override ChampionSkullType SkullType{ get{ return ChampionSkullType.Pain; } } + + public override Type[] UniqueList{ get{ return new Type[] { typeof( Subdue ) }; } } + public override Type[] SharedList{ get{ return new Type[] { }; } } + public override Type[] DecorativeList{ get{ return new Type[] { typeof( ArtifactLargeVase ), + typeof( ArtifactVase ), + typeof( MinotaurStatueDeed ) }; } } + + public override MonsterStatuetteType[] StatueTypes{ get{ return new MonsterStatuetteType[] { }; } } + + public override bool NoGoodies{ get{ return true; } } + [Constructable] - public Meraktus() : base( AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4 ) // NEED TO CHECK + public Meraktus() : base( AIType.AI_Melee ) { Name = "Meraktus"; Title = "the Tormented"; @@ -22,7 +35,7 @@ namespace Server.Mobiles SetHits( 4100, 4200 ); - SetDamage( 3, 5 ); + SetDamage( 16, 30 ); SetDamageType( ResistanceType.Physical, 100 ); diff --git a/Scripts/Mobiles/Monsters/ML/Special/Twaulo.cs b/Scripts/Mobiles/Monsters/ML/Special/Twaulo.cs index 1cb69fd9e..db4c3c399 100644 --- a/Scripts/Mobiles/Monsters/ML/Special/Twaulo.cs +++ b/Scripts/Mobiles/Monsters/ML/Special/Twaulo.cs @@ -1,16 +1,25 @@ using System; using Server; +using Server.Engines.CannedEvil; using Server.Items; namespace Server.Mobiles { - public class Twaulo : BaseCreature + public class Twaulo : BaseChampion { // COMPLETELY guessed beyond stats. Stats/skills come from Stratics and UOGuide. No idea what the special attacks should be. // Based on Silvani, due to them both using Blue creatures. + + public override ChampionSkullType SkullType{ get{ return ChampionSkullType.Pain; } } + + public override Type[] UniqueList{ get{ return new Type[] { typeof( Quell ) }; } } + public override Type[] SharedList{ get{ return new Type[] { typeof( TheMostKnowledgePerson ), typeof( OblivionsNeedle ) }; } } + public override Type[] DecorativeList{ get{ return new Type[] { typeof( Pier ), typeof( MonsterStatuette ) }; } } + + public override MonsterStatuetteType[] StatueTypes{ get{ return new MonsterStatuetteType[] { MonsterStatuetteType.DreadHorn }; } } + [Constructable] - public Twaulo() - : base(AIType.AI_Archer, FightMode.Evil, 18, 1, 0.1, 0.2) + public Twaulo() : base(AIType.AI_Archer, FightMode.Evil) { Name = "Twaulo"; Title = "of the Glade"; @@ -23,7 +32,7 @@ namespace Server.Mobiles SetHits( 7500 ); - SetDamage( 3, 4 ); + SetDamage( 19, 24 ); SetDamageType( ResistanceType.Physical, 100 ); @@ -33,13 +42,12 @@ namespace Server.Mobiles SetResistance( ResistanceType.Poison, 50, 60 ); SetResistance( ResistanceType.Energy, 50, 60 ); - SetSkill( SkillName.Archery, 85.0, 100 ); // Guestimate - SetSkill( SkillName.EvalInt, 0 ); // Per Stratics?!? - SetSkill( SkillName.Magery, 0 ); // Per Stratics?!? - SetSkill( SkillName.Meditation, 0 ); // Per Stratics?!? - SetSkill( SkillName.MagicResist, 0 ); // Per Stratics?!? - SetSkill( SkillName.Tactics, 85.0, 100 ); // Stratics says 0?!? - SetSkill( SkillName.Wrestling, 0 ); // Per Stratics?!? + //Lacking OSI information skills are based on Centaurs and scaled up the way other champs are. + SetSkill( SkillName.Anatomy, 115.1, 135.0 ); + SetSkill( SkillName.Archery, 100.0 ); + SetSkill( SkillName.MagicResist, 100.5, 150.0 ); + SetSkill( SkillName.Tactics, 100.0 ); + SetSkill( SkillName.Wrestling, 100.0 ); Fame = 50000; Karma = 50000; @@ -64,65 +72,6 @@ namespace Server.Mobiles public override Poison PoisonImmune{ get{ return Poison.Regular; } } public override int TreasureMapLevel{ get{ return 5; } } - public void SpawnPixies( Mobile target ) - { - Map map = this.Map; - - if ( map == null ) - return; - - int newPixies = Utility.RandomMinMax( 3, 6 ); - - for ( int i = 0; i < newPixies; ++i ) - { - Pixie pixie = new Pixie(); - - pixie.Team = this.Team; - pixie.FightMode = FightMode.Closest; - - bool validLocation = false; - Point3D loc = this.Location; - - for ( int j = 0; !validLocation && j < 10; ++j ) - { - int x = X + Utility.Random( 3 ) - 1; - int y = Y + Utility.Random( 3 ) - 1; - int z = map.GetAverageZ( x, y ); - - if ( validLocation = map.CanFit( x, y, this.Z, 16, false, false ) ) - loc = new Point3D( x, y, Z ); - else if ( validLocation = map.CanFit( x, y, z, 16, false, false ) ) - loc = new Point3D( x, y, z ); - } - - pixie.MoveToWorld( loc, map ); - pixie.Combatant = target; - } - } - - public override void AlterDamageScalarFrom( Mobile caster, ref double scalar ) - { - if ( 0.1 >= Utility.RandomDouble() ) - SpawnPixies( caster ); - } - - public override void OnGaveMeleeAttack( Mobile defender ) - { - base.OnGaveMeleeAttack( defender ); - - defender.Damage( Utility.Random( 20, 10 ), this ); - defender.Stam -= Utility.Random( 20, 10 ); - defender.Mana -= Utility.Random( 20, 10 ); - } - - public override void OnGotMeleeAttack( Mobile attacker ) - { - base.OnGotMeleeAttack( attacker ); - - if ( 0.1 >= Utility.RandomDouble() ) - SpawnPixies( attacker ); - } - public Twaulo( Serial serial ) : base( serial ) { } diff --git a/Scripts/Mobiles/PlayerMobile.cs b/Scripts/Mobiles/PlayerMobile.cs index d32285919..db8ab553c 100644 --- a/Scripts/Mobiles/PlayerMobile.cs +++ b/Scripts/Mobiles/PlayerMobile.cs @@ -32,19 +32,20 @@ namespace Server.Mobiles public enum PlayerFlag // First 16 bits are reserved for default-distro use, start custom flags at 0x00010000 { None = 0x00000000, - Glassblowing = 0x00000001, + Glassblowing = 0x00000001, Masonry = 0x00000002, SandMining = 0x00000004, StoneMining = 0x00000008, - ToggleMiningStone = 0x00000010, + ToggleMiningStone = 0x00000010, KarmaLocked = 0x00000020, - AutoRenewInsurance = 0x00000040, - UseOwnFilter = 0x00000080, - PublicMyRunUO = 0x00000100, - PagingSquelched = 0x00000200, + AutoRenewInsurance = 0x00000040, + UseOwnFilter = 0x00000080, + PublicMyRunUO = 0x00000100, + PagingSquelched = 0x00000200, Young = 0x00000400, - AcceptGuildInvites = 0x00000800, - DisplayChampionTitle= 0x00001000 + AcceptGuildInvites = 0x00000800, + DisplayChampionTitle = 0x00001000, + HasStatReward = 0x00002000 } public enum NpcGuild @@ -291,8 +292,23 @@ namespace Server.Mobiles get{ return GetFlag( PlayerFlag.AcceptGuildInvites ); } set{ SetFlag( PlayerFlag.AcceptGuildInvites, value ); } } + + [CommandProperty( AccessLevel.GameMaster )] + public bool HasStatReward + { + get{ return GetFlag( PlayerFlag.HasStatReward ); } + set{ SetFlag( PlayerFlag.HasStatReward, value ); } + } #endregion + private DateTime m_AnkhNextUse; + + [CommandProperty( AccessLevel.GameMaster )] + public DateTime AnkhNextUse + { + get{ return m_AnkhNextUse; } + set{ m_AnkhNextUse = value; } + } public static Direction GetDirection4( Point3D from, Point3D to ) { @@ -2356,9 +2372,16 @@ namespace Server.Mobiles switch ( version ) { - case 26: + case 27: + { + m_AnkhNextUse = reader.ReadDateTime(); + + goto case 26; + } + case 26: { m_AutoStabled = reader.ReadStrongMobileList(); + goto case 25; } case 25: @@ -2642,8 +2665,9 @@ namespace Server.Mobiles base.Serialize( writer ); - writer.Write( (int) 26 ); // version + writer.Write( (int) 27 ); // version + writer.Write( (DateTime) m_AnkhNextUse ); writer.Write( m_AutoStabled, true ); if( m_AcquiredRecipes == null ) @@ -2785,6 +2809,9 @@ namespace Server.Mobiles public override bool CanSee( Mobile m ) { + if ( m is CharacterStatue ) + ((CharacterStatue) m).OnRequestedAnimation( this ); + if ( m is PlayerMobile && ((PlayerMobile)m).m_VisList.Contains( this ) ) return true; diff --git a/Scripts/Mobiles/Special/Barracoon.cs b/Scripts/Mobiles/Special/Barracoon.cs index ba02abd55..491d6779c 100644 --- a/Scripts/Mobiles/Special/Barracoon.cs +++ b/Scripts/Mobiles/Special/Barracoon.cs @@ -12,6 +12,15 @@ namespace Server.Mobiles { public override ChampionSkullType SkullType{ get{ return ChampionSkullType.Greed; } } + public override Type[] UniqueList{ get{ return new Type[] { typeof( FangOfRactus ) }; } } + public override Type[] SharedList{ get{ return new Type[] { typeof( EmbroideredOakLeafCloak ), + typeof( DjinnisRing ), + typeof( DetectiveBoots ), + typeof( GuantletsOfAnger ) }; } } + public override Type[] DecorativeList{ get{ return new Type[] { typeof( SwampTile ), typeof( MonsterStatuette ) }; } } + + public override MonsterStatuetteType[] StatueTypes{ get{ return new MonsterStatuetteType[] { MonsterStatuetteType.Slime }; } } + [Constructable] public Barracoon() : base( AIType.AI_Melee ) { diff --git a/Scripts/Mobiles/Special/BaseChampion.cs b/Scripts/Mobiles/Special/BaseChampion.cs index 2344627fd..86568536e 100644 --- a/Scripts/Mobiles/Special/BaseChampion.cs +++ b/Scripts/Mobiles/Special/BaseChampion.cs @@ -23,6 +23,13 @@ namespace Server.Mobiles public abstract ChampionSkullType SkullType{ get; } + public abstract Type[] UniqueList{ get; } + public abstract Type[] SharedList{ get; } + public abstract Type[] DecorativeList{ get; } + public abstract MonsterStatuetteType[] StatueTypes{ get; } + + public virtual bool NoGoodies{ get{ return false; } } + public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); @@ -37,6 +44,38 @@ namespace Server.Mobiles int version = reader.ReadInt(); } + public Item GetArtifact() + { + double random = Utility.RandomDouble(); + if ( 0.05 >= random ) + return CreateArtifact( UniqueList ); + else if ( 0.15 >= random ) + return CreateArtifact( SharedList ); + else if ( 0.30 >= random ) + return CreateArtifact( DecorativeList ); + return null; + } + + public Item CreateArtifact( Type[] list ) + { + if( list.Length == 0 ) + return null; + + int random = Utility.Random( list.Length ); + + Type type = list[random]; + + Item artifact = Loot.Construct( type ); + + if( artifact is MonsterStatuette && StatueTypes.Length > 0 ) + { + ((MonsterStatuette)artifact).Type = StatueTypes[Utility.Random( StatueTypes.Length )]; + ((MonsterStatuette)artifact).LootType = LootType.Regular; + } + + return artifact; + } + private PowerScroll CreateRandomPowerScroll() { int level; @@ -175,6 +214,9 @@ namespace Server.Mobiles { GivePowerScrolls(); + if( NoGoodies ) + return base.OnBeforeDeath(); + Map map = this.Map; if ( map != null ) diff --git a/Scripts/Mobiles/Special/Harrower.cs b/Scripts/Mobiles/Special/Harrower.cs index 33cb4372a..c8da2cc73 100644 --- a/Scripts/Mobiles/Special/Harrower.cs +++ b/Scripts/Mobiles/Special/Harrower.cs @@ -9,6 +9,10 @@ namespace Server.Mobiles { public class Harrower : BaseCreature { + public Type[] UniqueList{ get{ return new Type[] { typeof( AcidProofRobe ) }; } } + public Type[] SharedList{ get{ return new Type[] { typeof( TheRobeOfBritanniaAri ) }; } } + public Type[] DecorativeList{ get{ return new Type[] { typeof( EvilIdolSkull ), typeof( SkullPole ) }; } } + private bool m_TrueForm; private Item m_GateItem; private List m_Tentacles; @@ -361,16 +365,23 @@ namespace Server.Mobiles } } + m_DamageEntries = new Dictionary(); + for ( int i = 0; i < m_Tentacles.Count; ++i ) { Mobile m = m_Tentacles[i]; if ( !m.Deleted ) m.Kill(); + + RegisterDamageTo( m ); } m_Tentacles.Clear(); + RegisterDamageTo( this ); + AwardArtifact( GetArtifact() ); + if ( m_GateItem != null ) m_GateItem.Delete(); } @@ -384,6 +395,115 @@ namespace Server.Mobiles } } + Dictionary m_DamageEntries; + + public virtual void RegisterDamageTo( Mobile m ) + { + if( m == null ) + return; + + foreach( DamageEntry de in m.DamageEntries ) + { + Mobile damager = de.Damager; + + Mobile master = damager.GetDamageMaster( m ); + + if( master != null ) + damager = master; + + RegisterDamage( damager, de.DamageGiven ); + } + } + + public void RegisterDamage( Mobile from, int amount ) + { + if( from == null || !from.Player ) + return; + + if( m_DamageEntries.ContainsKey( from ) ) + m_DamageEntries[from] += amount; + else + m_DamageEntries.Add( from, amount ); + + from.SendMessage(String.Format("Total Damage: {0}", m_DamageEntries[from]) ); + } + + public void AwardArtifact( Item artifact ) + { + if (artifact == null ) + return; + + int totalDamage = 0; + + Dictionary validEntries = new Dictionary(); + + foreach (KeyValuePair kvp in m_DamageEntries) + { + if( IsEligable( kvp.Key, artifact ) ) + { + validEntries.Add( kvp.Key, kvp.Value ); + totalDamage += kvp.Value; + } + } + + int randomDamage = Utility.RandomMinMax( 1, totalDamage ); + + totalDamage = 0; + + foreach (KeyValuePair kvp in m_DamageEntries) + { + totalDamage += kvp.Value; + + if( totalDamage > randomDamage ) + { + GiveArtifact( kvp.Key, artifact ); + break; + } + } + } + + public void GiveArtifact( Mobile to, Item artifact ) + { + if ( to == null || artifact == null ) + return; + + Container pack = to.Backpack; + + if ( pack == null || !pack.TryDropItem( to, artifact, false ) ) + artifact.Delete(); + else + to.SendLocalizedMessage( 1062317 ); // For your valor in combating the fallen beast, a special artifact has been bestowed on you. + } + + public bool IsEligable( Mobile m, Item Artifact ) + { + return m.Player && m.Alive && m.InRange( Location, 32 ) && m.Backpack != null && m.Backpack.CheckHold( m, Artifact, false ); + } + + public Item GetArtifact() + { + double random = Utility.RandomDouble(); + if ( 0.05 >= random ) + return CreateArtifact( UniqueList ); + else if ( 0.15 >= random ) + return CreateArtifact( SharedList ); + else if ( 0.30 >= random ) + return CreateArtifact( DecorativeList ); + return null; + } + + public Item CreateArtifact( Type[] list ) + { + if( list.Length == 0 ) + return null; + + int random = Utility.Random( list.Length ); + + Type type = list[random]; + + return Loot.Construct( type ); + } + private class TeleportTimer : Timer { private Mobile m_Owner; diff --git a/Scripts/Mobiles/Special/LordOaks.cs b/Scripts/Mobiles/Special/LordOaks.cs index 3591c7dbc..f083008fc 100644 --- a/Scripts/Mobiles/Special/LordOaks.cs +++ b/Scripts/Mobiles/Special/LordOaks.cs @@ -12,6 +12,19 @@ namespace Server.Mobiles public override ChampionSkullType SkullType{ get{ return ChampionSkullType.Enlightenment; } } + public override Type[] UniqueList{ get{ return new Type[] { typeof( OrcChieftainHelm ) }; } } + public override Type[] SharedList{ get{ return new Type[] { typeof( RoyalGuardSurvivalKnife ), + typeof( DjinnisRing ), + typeof( LieutenantOfTheBritannianRoyalGuard ), + typeof( SamaritanRobe ), + typeof( DetectiveBoots ), + typeof( TheMostKnowledgePerson ) }; } } + public override Type[] DecorativeList{ get{ return new Type[] { typeof( WaterTile ), + typeof( WindSpirit ), + typeof( Pier ), }; } } + + public override MonsterStatuetteType[] StatueTypes{ get{ return new MonsterStatuetteType[] { }; } } + [Constructable] public LordOaks() : base( AIType.AI_Mage, FightMode.Evil ) { diff --git a/Scripts/Mobiles/Special/Mephitis.cs b/Scripts/Mobiles/Special/Mephitis.cs index e14286254..2b4d542aa 100644 --- a/Scripts/Mobiles/Special/Mephitis.cs +++ b/Scripts/Mobiles/Special/Mephitis.cs @@ -9,6 +9,12 @@ namespace Server.Mobiles { public override ChampionSkullType SkullType{ get{ return ChampionSkullType.Venom; } } + public override Type[] UniqueList{ get{ return new Type[] { typeof( Calm ) }; } } + public override Type[] SharedList{ get{ return new Type[] { typeof( OblivionsNeedle ), typeof( ANecromancerShroud ) }; } } + public override Type[] DecorativeList{ get{ return new Type[] { typeof( Web ), typeof( MonsterStatuette ) }; } } + + public override MonsterStatuetteType[] StatueTypes{ get{ return new MonsterStatuetteType[] { MonsterStatuetteType.Spider }; } } + [Constructable] public Mephitis() : base( AIType.AI_Melee ) { diff --git a/Scripts/Mobiles/Special/Neira.cs b/Scripts/Mobiles/Special/Neira.cs index 81ad43e3b..1262d89f2 100644 --- a/Scripts/Mobiles/Special/Neira.cs +++ b/Scripts/Mobiles/Special/Neira.cs @@ -10,6 +10,14 @@ namespace Server.Mobiles { public override ChampionSkullType SkullType{ get{ return ChampionSkullType.Death; } } + public override Type[] UniqueList{ get{ return new Type[] { typeof( ShroudOfDeciet ) }; } } + public override Type[] SharedList{ get{ return new Type[] { typeof( ANecromancerShroud ), + typeof( DetectiveBoots ), + typeof( CaptainJohnsHat ) }; } } + public override Type[] DecorativeList{ get{ return new Type[] { typeof( WallBlood ), typeof( TatteredAncientMummyWrapping ) }; } } + + public override MonsterStatuetteType[] StatueTypes{ get{ return new MonsterStatuetteType[] { }; } } + [Constructable] public Neira() : base( AIType.AI_Mage ) { diff --git a/Scripts/Mobiles/Special/Rikktor.cs b/Scripts/Mobiles/Special/Rikktor.cs index 78991b8cc..490eaa1c2 100644 --- a/Scripts/Mobiles/Special/Rikktor.cs +++ b/Scripts/Mobiles/Special/Rikktor.cs @@ -11,6 +11,17 @@ namespace Server.Mobiles { public override ChampionSkullType SkullType{ get{ return ChampionSkullType.Power; } } + public override Type[] UniqueList{ get{ return new Type[] { typeof( CrownOfTalKeesh ) }; } } + public override Type[] SharedList{ get{ return new Type[] { typeof( TheMostKnowledgePerson ), + typeof( BraveKnightOfTheBritannia ), + typeof( LieutenantOfTheBritannianRoyalGuard ) }; } } + public override Type[] DecorativeList{ get{ return new Type[] { typeof( LavaTile ), + typeof( MonsterStatuette ), + typeof( MonsterStatuette ) }; } } + + public override MonsterStatuetteType[] StatueTypes{ get{ return new MonsterStatuetteType[] { MonsterStatuetteType.OphidianArchMage, + MonsterStatuetteType.OphidianWarrior }; } } + [Constructable] public Rikktor() : base( AIType.AI_Melee ) { diff --git a/Scripts/Mobiles/Special/Semidar.cs b/Scripts/Mobiles/Special/Semidar.cs index 5695902dc..5b40bdbc0 100644 --- a/Scripts/Mobiles/Special/Semidar.cs +++ b/Scripts/Mobiles/Special/Semidar.cs @@ -9,6 +9,12 @@ namespace Server.Mobiles { public override ChampionSkullType SkullType{ get{ return ChampionSkullType.Pain; } } + public override Type[] UniqueList{ get{ return new Type[] { typeof( GladiatorsCollar ) }; } } + public override Type[] SharedList{ get{ return new Type[] { typeof( LieutenantOfTheBritannianRoyalGuard ) }; } } + public override Type[] DecorativeList{ get{ return new Type[] { typeof( LavaTile ), typeof( DemonSkull ) }; } } + + public override MonsterStatuetteType[] StatueTypes{ get{ return new MonsterStatuetteType[] { }; } } + [Constructable] public Semidar() : base( AIType.AI_Mage ) { diff --git a/Scripts/Mobiles/Special/Serado.cs b/Scripts/Mobiles/Special/Serado.cs index 227057102..864226e91 100644 --- a/Scripts/Mobiles/Special/Serado.cs +++ b/Scripts/Mobiles/Special/Serado.cs @@ -10,6 +10,15 @@ namespace Server.Mobiles { public override ChampionSkullType SkullType{ get{ return ChampionSkullType.Power; } } + public override Type[] UniqueList{ get{ return new Type[] { typeof( Pacify ) }; } } + public override Type[] SharedList{ get{ return new Type[] { typeof( BraveKnightOfTheBritannia ), + typeof( DetectiveBoots ), + typeof( EmbroideredOakLeafCloak ), + typeof( LieutenantOfTheBritannianRoyalGuard ) }; } } + public override Type[] DecorativeList{ get{ return new Type[] { typeof( Futon ), typeof( SwampTile ) }; } } + + public override MonsterStatuetteType[] StatueTypes{ get{ return new MonsterStatuetteType[] { }; } } + public override WeaponAbility GetWeaponAbility() { return WeaponAbility.DoubleStrike; diff --git a/Scripts/Mobiles/Vendors/NPC/Guildmasters/TinkerGuildmaster.cs b/Scripts/Mobiles/Vendors/NPC/Guildmasters/TinkerGuildmaster.cs index 0a20f59e1..284c31bb1 100644 --- a/Scripts/Mobiles/Vendors/NPC/Guildmasters/TinkerGuildmaster.cs +++ b/Scripts/Mobiles/Vendors/NPC/Guildmasters/TinkerGuildmaster.cs @@ -1,6 +1,9 @@ using System; using System.Collections; +using System.Collections.Generic; using Server; +using Server.Items; +using Server.ContextMenus; namespace Server.Mobiles { @@ -33,5 +36,50 @@ namespace Server.Mobiles int version = reader.ReadInt(); } + + public override void AddCustomContextEntries( Mobile from, List list ) + { + if ( Core.ML && from.Alive ) + { + RechargeEntry entry = new RechargeEntry( from, this ); + + if ( WeaponEngravingTool.Find( from ) == null ) + entry.Enabled = false; + + list.Add( entry ); + } + + base.AddCustomContextEntries( from, list ); + } + + private class RechargeEntry : ContextMenuEntry + { + private Mobile m_From; + private Mobile m_Vendor; + + public RechargeEntry( Mobile from, Mobile vendor ) : base( 6271, 6 ) + { + m_From = from; + m_Vendor = vendor; + } + + public override void OnClick() + { + if ( !Core.ML || m_Vendor == null || m_Vendor.Deleted ) + return; + + WeaponEngravingTool tool = WeaponEngravingTool.Find( m_From ); + + if ( tool != null && tool.UsesRemaining <= 0 ) + { + if ( Banker.GetBalance( m_From ) >= 100000 ) + m_From.SendGump( new WeaponEngravingTool.ConfirmGump( tool, m_Vendor ) ); + else + m_Vendor.Say( 1076167 ); // You need a 100,000 gold and a blue diamond to recharge the weapon engraver. + } + else + m_Vendor.Say( 1076164 ); // I can only help with this if you are carrying an engraving tool that needs repair. + } + } } } \ No newline at end of file diff --git a/Scripts/Multis/BaseHouse.cs b/Scripts/Multis/BaseHouse.cs index 0218f4fbc..f09a9dc7e 100644 --- a/Scripts/Multis/BaseHouse.cs +++ b/Scripts/Multis/BaseHouse.cs @@ -1024,6 +1024,8 @@ namespace Server.Multis return true; else if ( item is VendorRentalContract ) return true; + else if ( item is RewardBrazier ) + return true; return false; } @@ -1789,6 +1791,9 @@ namespace Server.Multis item.PublicOverheadMessage( Server.Network.MessageType.Label, 0x3B2, 501657 );//[no longer locked down] SetLockdown( item, false ); //TidyItemList( m_LockDowns ); + + if ( item is RewardBrazier ) + ((RewardBrazier) item).TurnOff(); } else if ( IsSecure( item ) ) { diff --git a/Scripts/Spells/Spellweaving/ArcaneCircle.cs b/Scripts/Spells/Spellweaving/ArcaneCircle.cs index 79c7507aa..689f65f3f 100644 --- a/Scripts/Spells/Spellweaving/ArcaneCircle.cs +++ b/Scripts/Spells/Spellweaving/ArcaneCircle.cs @@ -106,7 +106,7 @@ namespace Server.Spells.Spellweaving public static bool IsValidTile( int itemID ) { //Per OSI, Center tile only - return (itemID == 0xFEA || itemID == 0x1216 || itemID == 0x307F); // Pentagram center, Abbatoir center, Arcane Circle Center + return (itemID == 0xFEA || itemID == 0x1216 || itemID == 0x307F || itemID == 0x1D10 || itemID == 0x1D0F || itemID == 0x1D1F || itemID == 0x1D12 ); // Pentagram center, Abbatoir center, Arcane Circle Center, Bloody Pentagram has 4 tiles at center } private List GetArcanists()