diff --git a/Scripts/Engines/Treasures of Tokuno/BasePigmentsOfTokuno.cs b/Scripts/Engines/Treasures of Tokuno/BasePigmentsOfTokuno.cs new file mode 100644 index 000000000..c7bee8a6a --- /dev/null +++ b/Scripts/Engines/Treasures of Tokuno/BasePigmentsOfTokuno.cs @@ -0,0 +1,204 @@ +using Server; +using System; +using Server.Misc; +using Server.Mobiles; + +namespace Server.Items +{ + public abstract class BasePigmentsOfTokuno : Item, IUsesRemaining + { + public override int LabelNumber { get { return 1070933; } } // Pigments of Tokuno + + private int m_UsesRemaining; + private TextDefinition m_Label; + + protected TextDefinition Label + { + get { return m_Label; } + set { m_Label = value; InvalidateProperties(); } + } + + #region Old Item Serialization Vars + /* DO NOT USE! Only used in serialization of pigments that originally derived from Item */ + private bool m_InheritsItem; + + protected bool InheritsItem + { + get{ return m_InheritsItem; } + } + #endregion + + public BasePigmentsOfTokuno() : base( 0xEFF ) + { + Weight = 1.0; + m_UsesRemaining = 1; + } + + public BasePigmentsOfTokuno( int uses ) : base( 0xEFF ) + { + Weight = 1.0; + m_UsesRemaining = uses; + } + + public BasePigmentsOfTokuno( Serial serial ) : base( serial ) + { + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if( m_Label != null && m_Label > 0 ) + TextDefinition.AddTo( list, m_Label ); + + list.Add( 1060584, m_UsesRemaining.ToString() ); // uses remaining: ~1_val~ + } + + public override void OnDoubleClick( Mobile from ) + { + if( IsAccessibleTo( from ) && from.InRange( GetWorldLocation(), 3 ) ) + { + from.SendLocalizedMessage( 1070929 ); // Select the artifact or enhanced magic item to dye. + from.BeginTarget( 3, false, Server.Targeting.TargetFlags.None, new TargetStateCallback( InternalCallback ), this ); + } + else + from.SendLocalizedMessage( 502436 ); // That is not accessible. + } + + private void InternalCallback( Mobile from, object targeted, object state ) + { + BasePigmentsOfTokuno pigment = (BasePigmentsOfTokuno)state; + + if( pigment.Deleted || pigment.UsesRemaining <= 0 || !from.InRange( pigment.GetWorldLocation(), 3 ) || !pigment.IsAccessibleTo( from )) + return; + + Item i = targeted as Item; + + if( i == null ) + from.SendLocalizedMessage( 1070931 ); // You can only dye artifacts and enhanced magic items with this tub. + else if( !from.InRange( i.GetWorldLocation(), 3 ) || !IsAccessibleTo( from ) ) + from.SendLocalizedMessage( 502436 ); // That is not accessible. + else if( from.Items.Contains( i ) ) + from.SendLocalizedMessage( 1070930 ); // Can't dye artifacts or enhanced magic items that are being worn. + else if( i.IsLockedDown ) + from.SendLocalizedMessage( 1070932 ); // You may not dye artifacts and enhanced magic items which are locked down. + else if( i is MetalPigmentsOfTokuno ) + from.SendLocalizedMessage( 1042417 ); // You cannot dye that. + else if( i is LesserPigmentsOfTokuno ) + from.SendLocalizedMessage( 1042417 ); // You cannot dye that. + else if( i is PigmentsOfTokuno ) + from.SendLocalizedMessage( 1042417 ); // You cannot dye that. + else if( !IsValidItem( i ) ) + from.SendLocalizedMessage( 1070931 ); // You can only dye artifacts and enhanced magic items with this tub. //Yes, it says tub on OSI. Don't ask me why ;p + else + { + //Notes: on OSI there IS no hue check to see if it's already hued. and no messages on successful hue either + i.Hue = Hue; + + if( --pigment.UsesRemaining <= 0 ) + pigment.Delete(); + + from.PlaySound(0x23E); // As per OSI TC1 + } + } + + public static bool IsValidItem( Item i ) + { + if( i is BasePigmentsOfTokuno ) + return false; + + Type t = i.GetType(); + + CraftResource resource = CraftResource.None; + + if( i is BaseWeapon ) + resource = ((BaseWeapon)i).Resource; + else if( i is BaseArmor ) + resource = ((BaseArmor)i).Resource; + + if( !CraftResources.IsStandard( resource ) ) + return true; + + return( + IsInTypeList( t, TreasuresOfTokuno.LesserArtifactsTotal ) + || IsInTypeList( t, TreasuresOfTokuno.GreaterArtifacts ) + || IsInTypeList( t, DemonKnight.ArtifactRarity10 ) + || IsInTypeList( t, DemonKnight.ArtifactRarity11 ) + || IsInTypeList( t, BaseCreature.MinorArtifactsMl ) + || IsInTypeList( t, StealableArtifactsSpawner.TypesOfEntires ) + || IsInTypeList( t, Paragon.Artifacts ) + || IsInTypeList( t, Leviathan.Artifacts ) + || IsInTypeList( t, TreasureMapChest.Artifacts ) + ); + } + + private static bool IsInTypeList( Type t, Type[] list ) + { + for( int i = 0; i < list.Length; i++ ) + { + if( list[i] == t ) return true; + } + + return false; + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.Write( (int)1 ); + + writer.WriteEncodedInt( m_UsesRemaining ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadInt(); + + switch ( version ) + { + case 1: + { + m_UsesRemaining = reader.ReadEncodedInt(); + break; + } + case 0: // Old pigments that inherited from item + { + m_InheritsItem = true; + + if ( this is LesserPigmentsOfTokuno ) + ((LesserPigmentsOfTokuno)this).Type = (LesserPigmentType)reader.ReadEncodedInt(); + else if ( this is PigmentsOfTokuno ) + ((PigmentsOfTokuno)this).Type = (PigmentType)reader.ReadEncodedInt(); + else if ( this is MetalPigmentsOfTokuno ) + reader.ReadEncodedInt(); + + m_UsesRemaining = reader.ReadEncodedInt(); + + break; + } + } + + + } + + #region IUsesRemaining Members + + [CommandProperty( AccessLevel.GameMaster )] + public int UsesRemaining + { + get { return m_UsesRemaining; } + set { m_UsesRemaining = value; InvalidateProperties(); } + } + + public bool ShowUsesRemaining + { + get { return true; } + set {} + } + + #endregion + } +} diff --git a/Scripts/Engines/Treasures of Tokuno/GreaterArtifacts.cs b/Scripts/Engines/Treasures of Tokuno/GreaterArtifacts.cs index 99cbea336..4c71eb1a0 100644 --- a/Scripts/Engines/Treasures of Tokuno/GreaterArtifacts.cs +++ b/Scripts/Engines/Treasures of Tokuno/GreaterArtifacts.cs @@ -384,50 +384,53 @@ namespace Server.Items BerserkerRed, NoxGreen, RumRed, - FireOrange + FireOrange, + FadedCoal, + Coal, + FadedGold, + StormBronze, + Rose, + MidnightCoal, + FadedBronze, + FadedRose, + DeepRose } - public class PigmentsOfTokuno : Item, IUsesRemaining + public class PigmentsOfTokuno : BasePigmentsOfTokuno { - public class PigmentInfo + private static int[][] m_Table = new int[][] { - //private PigmentType m_PigmentType; - private int m_Hue; - private TextDefinition m_Label; + // Hue, Label + new int[]{ /*PigmentType.None,*/ 0, -1 }, + new int[]{ /*PigmentType.ParagonGold,*/ 0x501, 1070987 }, + new int[]{ /*PigmentType.VioletCouragePurple,*/ 0x486, 1070988 }, + new int[]{ /*PigmentType.InvulnerabilityBlue,*/ 0x4F2, 1070989 }, + new int[]{ /*PigmentType.LunaWhite,*/ 0x47E, 1070990 }, + new int[]{ /*PigmentType.DryadGreen,*/ 0x48F, 1070991 }, + new int[]{ /*PigmentType.ShadowDancerBlack,*/ 0x455, 1070992 }, + new int[]{ /*PigmentType.BerserkerRed,*/ 0x21, 1070993 }, + new int[]{ /*PigmentType.NoxGreen,*/ 0x58C, 1070994 }, + new int[]{ /*PigmentType.RumRed,*/ 0x66C, 1070995 }, + new int[]{ /*PigmentType.FireOrange,*/ 0x54F, 1070996 }, + new int[]{ /*PigmentType.Fadedcoal,*/ 0x96A, 1079579 }, + new int[]{ /*PigmentType.Coal,*/ 0x96B, 1079580 }, + new int[]{ /*PigmentType.FadedGold,*/ 0x972, 1079581 }, + new int[]{ /*PigmentType.StormBronze,*/ 0x977, 1079582 }, + new int[]{ /*PigmentType.Rose,*/ 0x97C, 1079583 }, + new int[]{ /*PigmentType.MidnightCoal,*/ 0x96C, 1079584 }, + new int[]{ /*PigmentType.FadedBronze,*/ 0x975, 1079585 }, + new int[]{ /*PigmentType.FadedRose,*/ 0x97B, 1079586 }, + new int[]{ /*PigmentType.DeepRose,*/ 0x97E, 1079587 } + }; + + public static int[] GetInfo( PigmentType type ) + { + int v = (int)type; - public int Hue { get { return m_Hue; } } - public TextDefinition Label { get { return m_Label; } } - - public PigmentInfo( int hue, TextDefinition label ) - { - m_Hue = hue; - m_Label = label; - } - - private static PigmentInfo[] m_Table = new PigmentInfo[] - { - new PigmentInfo( /*PigmentType.None,*/ 0, -1 ), - new PigmentInfo( /*PigmentType.ParagonGold,*/ 0x501, 1070987 ), - new PigmentInfo( /*PigmentType.VioletCouragePurple,*/ 0x486, 1070988 ), - new PigmentInfo( /*PigmentType.InvulnerabilityBlue,*/ 0x4F2, 1070989 ), - new PigmentInfo( /*PigmentType.LunaWhite,*/ 0x47E, 1070990 ), - new PigmentInfo( /*PigmentType.DryadGreen,*/ 0x48F, 1070991 ), - new PigmentInfo( /*PigmentType.ShadowDancerBlack,*/ 0x455, 1070992 ), - new PigmentInfo( /*PigmentType.BerserkerRed,*/ 0x21, 1070993 ), - new PigmentInfo( /*PigmentType.NoxGreen,*/ 0x58C, 1070994 ), - new PigmentInfo( /*PigmentType.RumRed,*/ 0x66C, 1070995 ), - new PigmentInfo( /*PigmentType.FireOrange,*/ 0x54F, 1070996 ) - }; - - public static PigmentInfo GetInfo( PigmentType type ) - { - int v = (int)type; - - if( v < 0 || v >= m_Table.Length ) - v = 0; - - return m_Table[v]; - } + if( v < 0 || v >= m_Table.Length ) + v = 0; + + return m_Table[v]; } private PigmentType m_Type; @@ -439,15 +442,22 @@ namespace Server.Items set { m_Type = value; + + int v = (int)m_Type; - PigmentInfo p = PigmentInfo.GetInfo( m_Type ); - Hue = p.Hue; - InvalidateProperties(); + if ( v >= 0 && v < m_Table.Length ) + { + Hue = m_Table[v][0]; + Label = m_Table[v][1]; + } + else + { + Hue = 0; + Label = -1; + } } } - - private int m_UsesRemaining; - + public override int LabelNumber { get { return 1070933; } } // Pigments of Tokuno [Constructable] @@ -456,115 +466,17 @@ namespace Server.Items } [Constructable] - public PigmentsOfTokuno( PigmentType type ) : this( type, (type == PigmentType.None)? 10 : 50 ) + public PigmentsOfTokuno( PigmentType type ) : this( type, (type == PigmentType.None||type >= PigmentType.FadedCoal)? 10 : 50 ) { } [Constructable] - public PigmentsOfTokuno( PigmentType type, int uses ) : base( 0xEFF ) + public PigmentsOfTokuno( PigmentType type, int uses ) : base( uses ) { Weight = 1.0; - m_UsesRemaining = uses; Type = type; } - public override void GetProperties( ObjectPropertyList list ) - { - base.GetProperties( list ); - - if( m_Type != PigmentType.None ) - { - PigmentInfo p = PigmentInfo.GetInfo( m_Type ); - TextDefinition.AddTo( list, p.Label ); - } - - list.Add( 1060584, m_UsesRemaining.ToString() ); // uses remaining: ~1_val~ - } - - public override void OnDoubleClick( Mobile from ) - { - if( IsAccessibleTo( from ) && from.InRange( GetWorldLocation(), 3 ) ) - { - from.SendLocalizedMessage( 1070929 ); // Select the artifact or enhanced magic item to dye. - from.BeginTarget( 3, false, Server.Targeting.TargetFlags.None, new TargetStateCallback( InternalCallback ), this ); - } - else - from.SendLocalizedMessage( 502436 ); // That is not accessible. - } - - private void InternalCallback( Mobile from, object targeted, object state ) - { - PigmentsOfTokuno pigment = (PigmentsOfTokuno)state; - - if( pigment.Deleted || pigment.UsesRemaining <= 0 || !from.InRange( pigment.GetWorldLocation(), 3 ) || !pigment.IsAccessibleTo( from )) - return; - - Item i = targeted as Item; - - if( i == null ) - from.SendLocalizedMessage( 1070931 ); // You can only dye artifacts and enhanced magic items with this tub. - else if( !from.InRange( i.GetWorldLocation(), 3 ) || !IsAccessibleTo( from ) ) - from.SendLocalizedMessage( 502436 ); // That is not accessible. - else if( from.Items.Contains( i ) ) - from.SendLocalizedMessage( 1070930 ); // Can't dye artifacts or enhanced magic items that are being worn. - else if( i.IsLockedDown ) - from.SendLocalizedMessage( 1070932 ); // You may not dye artifacts and enhanced magic items which are locked down. - else if( i is PigmentsOfTokuno ) - from.SendLocalizedMessage( 1042417 ); // You cannot dye that. - else if( !IsValidItem( i ) ) - from.SendLocalizedMessage( 1070931 ); // You can only dye artifacts and enhanced magic items with this tub. //Yes, it says tub on OSI. Don't ask me why ;p - else - { - //Notes: on OSI there IS no hue check to see if it's already hued. and no messages on successful hue either - i.Hue = PigmentInfo.GetInfo( pigment.Type ).Hue; - - if( --pigment.UsesRemaining <= 0 ) - pigment.Delete(); - - from.PlaySound(0x23E); // As per OSI TC1 - } - } - - public static bool IsValidItem( Item i ) - { - if( i is PigmentsOfTokuno ) - return false; - - Type t = i.GetType(); - - CraftResource resource = CraftResource.None; - - if( i is BaseWeapon ) - resource = ((BaseWeapon)i).Resource; - else if( i is BaseArmor ) - resource = ((BaseArmor)i).Resource; - - if( !CraftResources.IsStandard( resource ) ) - return true; - - return( - IsInTypeList( t, TreasuresOfTokuno.LesserArtifacts ) - || IsInTypeList( t, TreasuresOfTokuno.GreaterArtifacts ) - || IsInTypeList( t, DemonKnight.ArtifactRarity10 ) - || IsInTypeList( t, DemonKnight.ArtifactRarity11 ) - || IsInTypeList( t, BaseCreature.MinorArtifactsMl ) - || IsInTypeList( t, StealableArtifactsSpawner.TypesOfEntires ) - || IsInTypeList( t, Paragon.Artifacts ) - || IsInTypeList( t, Leviathan.Artifacts ) - || IsInTypeList( t, TreasureMapChest.Artifacts ) - ); - } - - private static bool IsInTypeList( Type t, Type[] list ) - { - for( int i = 0; i < list.Length; i++ ) - { - if( list[i] == t ) return true; - } - - return false; - } - public PigmentsOfTokuno( Serial serial ) : base( serial ) { } @@ -573,38 +485,22 @@ namespace Server.Items { base.Serialize( writer ); - writer.Write( (int)0 ); + writer.Write( (int)1 ); writer.WriteEncodedInt( (int)m_Type ); - writer.WriteEncodedInt( m_UsesRemaining ); } public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); - int version = reader.ReadInt(); - - m_Type = (PigmentType)reader.ReadEncodedInt(); - m_UsesRemaining = reader.ReadEncodedInt(); + int version = ( InheritsItem ? 0 : reader.ReadInt() ); // Required for BasePigmentsOfTokuno insertion + + switch ( version ) + { + case 1: Type = (PigmentType)reader.ReadEncodedInt(); break; + case 0: break; + } } - - #region IUsesRemaining Members - - [CommandProperty( AccessLevel.GameMaster )] - public int UsesRemaining - { - get { return m_UsesRemaining; } - set { m_UsesRemaining = value; InvalidateProperties(); } - } - - public bool ShowUsesRemaining - { - get { return true; } - set {} - } - - - #endregion } } \ No newline at end of file diff --git a/Scripts/Engines/Treasures of Tokuno/LesserArtifacts.cs b/Scripts/Engines/Treasures of Tokuno/LesserArtifacts.cs index aa70d04f5..a4ab801b9 100644 --- a/Scripts/Engines/Treasures of Tokuno/LesserArtifacts.cs +++ b/Scripts/Engines/Treasures of Tokuno/LesserArtifacts.cs @@ -1,5 +1,7 @@ using Server; using System; +using Server.Misc; +using Server.Mobiles; namespace Server.Items { @@ -582,6 +584,47 @@ namespace Server.Items int version = reader.ReadInt(); } } + + public class LeurociansMempoOfFortune : LeatherMempo + { + public override int LabelNumber { get { return 1071460; } } // Leurocian's mempo of fortune + + public override int BasePhysicalResistance{ get{ return 15; } } + public override int BaseFireResistance{ get{ return 10; } } + public override int BaseColdResistance{ get{ return 10; } } + public override int BasePoisonResistance{ get{ return 10; } } + public override int BaseEnergyResistance{ get{ return 15; } } + + [Constructable] + public LeurociansMempoOfFortune() : base() + { + LootType = LootType.Regular; + Hue = 0x501; + + Attributes.Luck = 300; + Attributes.RegenMana = 1; + } + + public LeurociansMempoOfFortune( 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(); + } + public override int InitMinHits { get { return 255; } } + public override int InitMaxHits { get { return 255; } } + } //Non weapon/armor ones: @@ -742,8 +785,87 @@ namespace Server.Items { LabelTo( from, 1070936, m_SwordsName ); // Honorable Swords of ~1_name~ } + } - //TODO: the Chest of Heirlooms + [Furniture] + [Flipable( 0x2811, 0x2812 )] + public class ChestOfHeirlooms : LockableContainer + { + public override int LabelNumber{ get{ return 1070937; } } // Chest of heirlooms + + [Constructable] + public ChestOfHeirlooms() : base( 0x2811 ) + { + Locked = true; + LockLevel = 95; + MaxLockLevel = 140; + RequiredSkill = 95; + + TrapType = TrapType.ExplosionTrap; + TrapLevel = 10; + TrapPower = 100; + + GumpID = 0x10B; + + for ( int i = 0; i < 10; ++i ) + { + Item item = Loot.ChestOfHeirloomsContains(); + + int attributeCount = Utility.RandomMinMax( 1, 5 ); + int min = 20; + int max = 80; + + if ( item is BaseWeapon ) + { + BaseWeapon weapon = (BaseWeapon)item; + + if ( Core.AOS ) + BaseRunicTool.ApplyAttributesTo( weapon, attributeCount, min, max ); + else + { + weapon.DamageLevel = (WeaponDamageLevel)Utility.Random( 6 ); + weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random( 6 ); + weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random( 6 ); + } + } + else if ( item is BaseArmor ) + { + BaseArmor armor = (BaseArmor)item; + + if ( Core.AOS ) + BaseRunicTool.ApplyAttributesTo( armor, attributeCount, min, max ); + else + { + armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random( 6 ); + armor.Durability = (ArmorDurabilityLevel)Utility.Random( 6 ); + } + } + else if( item is BaseHat && Core.AOS ) + BaseRunicTool.ApplyAttributesTo( (BaseHat)item, attributeCount, min, max ); + else if( item is BaseJewel && Core.AOS ) + BaseRunicTool.ApplyAttributesTo( (BaseJewel)item, attributeCount, min, max ); + + DropItem( item ); + } + } + + public ChestOfHeirlooms( 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(); + } } public class FluteOfRenewal : BambooFlute @@ -782,4 +904,149 @@ namespace Server.Items Slayer = SlayerGroup.Groups[Utility.Random( SlayerGroup.Groups.Length - 1 )].Super.Name; } } + + public enum LesserPigmentType + { + None, + PaleOrange, + FreshRose, + ChaosBlue, + Silver, + NobleGold, + LightGreen, + PaleBlue, + FreshPlum, + DeepBrown, + BurntBrown + } + + public class LesserPigmentsOfTokuno : BasePigmentsOfTokuno + { + + private static int[][] m_Table = new int[][] + { + // Hue, Label + new int[]{ /*PigmentType.None,*/ 0, -1 }, + new int[]{ /*PigmentType.PaleOrange,*/ 0x02E, 1071458 }, + new int[]{ /*PigmentType.FreshRose,*/ 0x4B9, 1071455 }, + new int[]{ /*PigmentType.ChaosBlue,*/ 0x005, 1071459 }, + new int[]{ /*PigmentType.Silver,*/ 0x3E9, 1071451 }, + new int[]{ /*PigmentType.NobleGold,*/ 0x227, 1071457 }, + new int[]{ /*PigmentType.LightGreen,*/ 0x1C8, 1071454 }, + new int[]{ /*PigmentType.PaleBlue,*/ 0x24F, 1071456 }, + new int[]{ /*PigmentType.FreshPlum,*/ 0x145, 1071450 }, + new int[]{ /*PigmentType.DeepBrown,*/ 0x3F0, 1071452 }, + new int[]{ /*PigmentType.BurntBrown,*/ 0x41A, 1071453 } + }; + + public static int[] GetInfo( LesserPigmentType type ) + { + int v = (int)type; + + if( v < 0 || v >= m_Table.Length ) + v = 0; + + return m_Table[v]; + } + + private LesserPigmentType m_Type; + + [CommandProperty( AccessLevel.GameMaster )] + public LesserPigmentType Type + { + get { return m_Type; } + set + { + m_Type = value; + + int v = (int)m_Type; + + if ( v >= 0 && v < m_Table.Length ) + { + Hue = m_Table[v][0]; + Label = m_Table[v][1]; + } + else + { + Hue = 0; + Label = -1; + } + } + } + + [Constructable] + public LesserPigmentsOfTokuno() : this( (LesserPigmentType)Utility.Random(0,11) ) + { + } + + [Constructable] + public LesserPigmentsOfTokuno( LesserPigmentType type ) : base( 1 ) + { + Weight = 1.0; + Type = type; + } + + public LesserPigmentsOfTokuno( Serial serial ) : base( serial ) + { + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.Write( (int)1 ); + + writer.WriteEncodedInt( (int)m_Type ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = ( InheritsItem ? 0 : reader.ReadInt() ); // Required for BasePigmentsOfTokuno insertion + + switch ( version ) + { + case 1: Type = (LesserPigmentType)reader.ReadEncodedInt(); break; + case 0: break; + } + } + } + + public class MetalPigmentsOfTokuno : BasePigmentsOfTokuno + { + [Constructable] + public MetalPigmentsOfTokuno() : base( 1 ) + { + RandomHue(); + Label = -1; + } + + public MetalPigmentsOfTokuno( Serial serial ) : base( serial ) + { + } + + public void RandomHue() + { + int a = Utility.Random(0,30); + if ( a != 0 ) + Hue = a + 0x960; + else + Hue = 0; + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.Write( (int)0 ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = ( InheritsItem ? 0 : reader.ReadInt() ); // Required for BasePigmentsOfTokuno insertion + } + } } \ No newline at end of file diff --git a/Scripts/Engines/Treasures of Tokuno/TreasuresOfTokuno.cs b/Scripts/Engines/Treasures of Tokuno/TreasuresOfTokuno.cs index 0369798e3..5fce51610 100644 --- a/Scripts/Engines/Treasures of Tokuno/TreasuresOfTokuno.cs +++ b/Scripts/Engines/Treasures of Tokuno/TreasuresOfTokuno.cs @@ -9,24 +9,80 @@ using Server.Mobiles; namespace Server.Misc { + public enum TreasuresOfTokunoEra + { + None, + ToTOne, + ToTTwo, + ToTThree + } + public class TreasuresOfTokuno { - private static bool m_Enabled = (Core.Expansion == Expansion.SE); - public static bool Enabled { get { return m_Enabled; } } - public const int ItemsPerReward = 10; - - private static Type[] m_LesserArtifacts = new Type[] + + private static Type[] m_LesserArtifactsTotal = new Type[] { + typeof( AncientFarmersKasa ), typeof( AncientSamuraiDo ), typeof( ArmsOfTacticalExcellence ), typeof( BlackLotusHood ), + typeof( DaimyosHelm ), typeof( DemonForks ), typeof( DragonNunchaku ), typeof( Exiler ), typeof( GlovesOfTheSun ), + typeof( HanzosBow ), typeof( LegsOfStability ), typeof( PeasantsBokuto ), typeof( PilferedDancerFans ), typeof( TheDestroyer ), + typeof( TomeOfEnlightenment ), typeof( AncientUrn ), typeof( HonorableSwords ), typeof( PigmentsOfTokuno ), typeof( FluteOfRenewal ), + typeof( LeurociansMempoOfFortune ), typeof( LesserPigmentsOfTokuno ), typeof( MetalPigmentsOfTokuno ), typeof( ChestOfHeirlooms ) + }; + + public static Type[] LesserArtifactsTotal { get { return m_LesserArtifactsTotal; } } + + private static TreasuresOfTokunoEra _DropEra = TreasuresOfTokunoEra.None; + private static TreasuresOfTokunoEra _RewardEra = TreasuresOfTokunoEra.ToTOne; + + public static TreasuresOfTokunoEra DropEra + { + get { return _DropEra; } + set { _DropEra = value; } + } + + public static TreasuresOfTokunoEra RewardEra + { + get { return _RewardEra; } + set { _RewardEra = value; } + } + + private static Type[][] m_LesserArtifacts = new Type[][] + { + // ToT One Rewards + new Type[] { typeof( AncientFarmersKasa ), typeof( AncientSamuraiDo ), typeof( ArmsOfTacticalExcellence ), typeof( BlackLotusHood ), typeof( DaimyosHelm ), typeof( DemonForks ), typeof( DragonNunchaku ), typeof( Exiler ), typeof( GlovesOfTheSun ), typeof( HanzosBow ), typeof( LegsOfStability ), typeof( PeasantsBokuto ), typeof( PilferedDancerFans ), typeof( TheDestroyer ), - typeof( TomeOfEnlightenment ), typeof( AncientUrn ), typeof( HonorableSwords ), typeof( PigmentsOfTokuno ), typeof( FluteOfRenewal ) //TODO: Chest of heirlooms - }; + typeof( TomeOfEnlightenment ), typeof( AncientUrn ), typeof( HonorableSwords ), typeof( PigmentsOfTokuno ), + typeof( FluteOfRenewal ), typeof( ChestOfHeirlooms ) + }, + // ToT Two Rewards + new Type[] { + typeof( MetalPigmentsOfTokuno ), typeof( AncientFarmersKasa ), typeof( AncientSamuraiDo ), typeof( ArmsOfTacticalExcellence ), + typeof( MetalPigmentsOfTokuno ), typeof( BlackLotusHood ), typeof( DaimyosHelm ), typeof( DemonForks ), + typeof( MetalPigmentsOfTokuno ), typeof( DragonNunchaku ), typeof( Exiler ), typeof( GlovesOfTheSun ), typeof( HanzosBow ), + typeof( MetalPigmentsOfTokuno ), typeof( LegsOfStability ), typeof( PeasantsBokuto ), typeof( PilferedDancerFans ), typeof( TheDestroyer ), + typeof( MetalPigmentsOfTokuno ), typeof( TomeOfEnlightenment ), typeof( AncientUrn ), typeof( HonorableSwords ), + typeof( MetalPigmentsOfTokuno ), typeof( FluteOfRenewal ), typeof( ChestOfHeirlooms ) + }, + // ToT Three Rewards + new Type[] { + typeof( LesserPigmentsOfTokuno ), typeof( AncientFarmersKasa ), typeof( AncientSamuraiDo ), typeof( ArmsOfTacticalExcellence ), + typeof( LesserPigmentsOfTokuno ), typeof( BlackLotusHood ), typeof( DaimyosHelm ), typeof( HanzosBow ), + typeof( LesserPigmentsOfTokuno ), typeof( DemonForks ), typeof( DragonNunchaku ), typeof( Exiler ), typeof( GlovesOfTheSun ), + typeof( LesserPigmentsOfTokuno ), typeof( LegsOfStability ), typeof( PeasantsBokuto ), typeof( PilferedDancerFans ), typeof( TheDestroyer ), + typeof( LesserPigmentsOfTokuno ), typeof( TomeOfEnlightenment ), typeof( AncientUrn ), typeof( HonorableSwords ), typeof( FluteOfRenewal ), + typeof( LesserPigmentsOfTokuno ), typeof( LeurociansMempoOfFortune ), typeof( ChestOfHeirlooms ) + } + }; - public static Type[] LesserArtifacts { get { return m_LesserArtifacts; } } + public static Type[] LesserArtifacts + { + get { return m_LesserArtifacts[(int)RewardEra-1]; } + } - private static Type[] m_GreaterArtifacts = null; + private static Type[][] m_GreaterArtifacts = null; public static Type[] GreaterArtifacts { @@ -34,14 +90,20 @@ namespace Server.Misc { if( m_GreaterArtifacts == null ) { - m_GreaterArtifacts = new Type[ToTRedeemGump.NormalRewards.Length]; + m_GreaterArtifacts = new Type[ToTRedeemGump.NormalRewards.Length][]; + for( int i = 0; i < m_GreaterArtifacts.Length; i++ ) { - m_GreaterArtifacts[i] = ToTRedeemGump.NormalRewards[i].Type; + m_GreaterArtifacts[i] = new Type[ToTRedeemGump.NormalRewards[i].Length]; + + for( int j = 0; j < m_GreaterArtifacts[i].Length; j++ ) + { + m_GreaterArtifacts[i][j] = ToTRedeemGump.NormalRewards[i][j].Type; + } } } - return m_GreaterArtifacts; + return m_GreaterArtifacts[(int)RewardEra-1]; } } @@ -64,7 +126,7 @@ namespace Server.Misc PlayerMobile pm = killer as PlayerMobile; BaseCreature bc = victim as BaseCreature; - if( !Enabled || pm == null || bc == null || !CheckLocation( bc ) || !CheckLocation( pm )|| !killer.InRange( victim, 18 )) + if( DropEra == TreasuresOfTokunoEra.None || pm == null || bc == null || !CheckLocation( bc ) || !CheckLocation( pm )|| !killer.InRange( victim, 18 )) return; if( bc.Controlled || bc.Owners.Count > 0 || bc.Fame <= 0 ) @@ -90,26 +152,30 @@ namespace Server.Misc if( chance > Utility.RandomDouble() ) { Item i = null; - + try { - i = Activator.CreateInstance( m_LesserArtifacts[Utility.Random( m_LesserArtifacts.Length )] ) as Item; + i = Activator.CreateInstance( m_LesserArtifacts[(int)DropEra-1][Utility.Random( m_LesserArtifacts[(int)DropEra-1].Length )] ) as Item; } catch { } if( i != null ) { - if( pm.AddToBackpack( i ) ) + pm.SendLocalizedMessage( 1062317 ); // For your valor in combating the fallen beast, a special artifact has been bestowed on you. + + if( !pm.PlaceInBackpack( i ) ) { - pm.SendLocalizedMessage( 1062317 ); // For your valor in combating the fallen beast, a special artifact has been bestowed on you. - pm.ToTTotalMonsterFame = 0; - } - else - { - //Place in bank possibly? - i.Delete(); + if( pm.BankBox != null && pm.BankBox.TryDropItem( killer, i, false ) ) + pm.SendLocalizedMessage( 1079730 ); // The item has been placed into your bank box. + else + { + pm.SendLocalizedMessage( 1072523 ); // You find an artifact, but your backpack and bank are too full to hold it. + i.MoveToWorld( pm.Location, pm.Map ); + } } + + pm.ToTTotalMonsterFame = 0; } } } @@ -128,11 +194,11 @@ namespace Server.Mobiles protected ArrayList m_SBInfos = new ArrayList(); protected override ArrayList SBInfos { get { return m_SBInfos; } } + public override void InitSBInfo() { } - public override void InitOutfit() { AddItem( new Waraji( 0x711 ) ); @@ -180,9 +246,6 @@ namespace Server.Mobiles public override void OnMovement( Mobile m, Point3D oldLocation ) { - //if( !TreasuresOfTokuno.Enabled ) //He still accepts items even if ToTs are turned off. - // return; - if( m.Alive && m is PlayerMobile ) { PlayerMobile pm = (PlayerMobile)m; @@ -196,7 +259,7 @@ namespace Server.Mobiles SayTo( pm, 1070980 ); // Congratulations! You have turned in enough minor treasures to earn a greater reward. pm.CloseGump( typeof( ToTTurnInGump ) ); //Sanity - + if( !pm.HasGump( typeof( ToTRedeemGump ) ) ) pm.SendGump( new ToTRedeemGump( this, false ) ); } @@ -254,17 +317,18 @@ namespace Server.Gumps if( pack == null ) return new ArrayList(); - ArrayList items = new ArrayList( pack.FindItemsByType( TreasuresOfTokuno.LesserArtifacts ) ); + ArrayList items = new ArrayList( pack.FindItemsByType( TreasuresOfTokuno.LesserArtifactsTotal ) ); ArrayList buttons = new ArrayList(); for( int i = 0; i < items.Count; i++ ) { Item item = (Item)items[i]; - //bool acceptable = true; - - /* TODO: - if( item is ChestOfHeirlooms ) - */ + if( item is ChestOfHeirlooms && !((ChestOfHeirlooms)item).Locked ) + continue; + + if( item is ChestOfHeirlooms && ((ChestOfHeirlooms)item).TrapLevel != 10 ) + continue; + if( item is PigmentsOfTokuno && ((PigmentsOfTokuno)item).Type != PigmentType.None ) continue; @@ -301,7 +365,7 @@ namespace Server.Gumps { m_Collector.SayTo( pm, 1070980 ); // Congratulations! You have turned in enough minor treasures to earn a greater reward. - pm.CloseGump( typeof( ToTTurnInGump ) ); //SAnity + pm.CloseGump( typeof( ToTTurnInGump ) ); //Sanity if( !pm.HasGump( typeof( ToTRedeemGump ) ) ) pm.SendGump( new ToTRedeemGump( m_Collector, false ) ); @@ -378,14 +442,17 @@ namespace Server.Gumps } } - public PigmentsTileButtonInfo( PigmentType p ) : base( 0xEFF, PigmentsOfTokuno.PigmentInfo.GetInfo( p ).Hue, PigmentsOfTokuno.PigmentInfo.GetInfo( p ).Label ) + public PigmentsTileButtonInfo( PigmentType p ) : base( 0xEFF, PigmentsOfTokuno.GetInfo( p )[0], PigmentsOfTokuno.GetInfo( p )[1] ) { m_Pigment = p; } } - private static TypeTileButtonInfo[] m_NormalRewards = new TypeTileButtonInfo[] - { + #region ToT Normal Rewards Table + private static TypeTileButtonInfo[][] m_NormalRewards = new TypeTileButtonInfo[][] + { + // ToT One Rewards + new TypeTileButtonInfo[] { new TypeTileButtonInfo( typeof( SwordsOfProsperity ), 0x27A9, 1070963, 1071002 ), new TypeTileButtonInfo( typeof( SwordOfTheStampede ), 0x27A2, 1070964, 1070978 ), new TypeTileButtonInfo( typeof( WindsEdge ), 0x27A3, 1070965, 1071003 ), @@ -394,14 +461,47 @@ namespace Server.Gumps new TypeTileButtonInfo( typeof( RuneBeetleCarapace ), 0x277D, 1070968, 1071006 ), new TypeTileButtonInfo( typeof( KasaOfTheRajin ), 0x2798, 1070969, 1071007 ), new TypeTileButtonInfo( typeof( Stormgrip ), 0x2792, 1070970, 1071008 ), - new TypeTileButtonInfo( typeof( TomeOfLostKnowledge ), 0xEFA, 0x530, 1070971, 1071009 ), - new TypeTileButtonInfo( typeof( PigmentsOfTokuno ), 0xEFF, 1070933, 1071011 ) - }; + new TypeTileButtonInfo( typeof( TomeOfLostKnowledge ), 0x0EFA, 0x530, 1070971, 1071009 ), + new TypeTileButtonInfo( typeof( PigmentsOfTokuno ), 0x0EFF, 1070933, 1071011 ) + }, + // ToT Two Rewards + new TypeTileButtonInfo[] { + new TypeTileButtonInfo( typeof( SwordsOfProsperity ), 0x27A9, 1070963, 1071002 ), + new TypeTileButtonInfo( typeof( SwordOfTheStampede ), 0x27A2, 1070964, 1070978 ), + new TypeTileButtonInfo( typeof( WindsEdge ), 0x27A3, 1070965, 1071003 ), + new TypeTileButtonInfo( typeof( DarkenedSky ), 0x27AD, 1070966, 1071004 ), + new TypeTileButtonInfo( typeof( TheHorselord ), 0x27A5, 1070967, 1071005 ), + new TypeTileButtonInfo( typeof( RuneBeetleCarapace ), 0x277D, 1070968, 1071006 ), + new TypeTileButtonInfo( typeof( KasaOfTheRajin ), 0x2798, 1070969, 1071007 ), + new TypeTileButtonInfo( typeof( Stormgrip ), 0x2792, 1070970, 1071008 ), + new TypeTileButtonInfo( typeof( TomeOfLostKnowledge ), 0x0EFA, 0x530, 1070971, 1071009 ), + new TypeTileButtonInfo( typeof( PigmentsOfTokuno ), 0x0EFF, 1070933, 1071011 ) + }, + // ToT Three Rewards + new TypeTileButtonInfo[] { + new TypeTileButtonInfo( typeof( SwordsOfProsperity ), 0x27A9, 1070963, 1071002 ), + new TypeTileButtonInfo( typeof( SwordOfTheStampede ), 0x27A2, 1070964, 1070978 ), + new TypeTileButtonInfo( typeof( WindsEdge ), 0x27A3, 1070965, 1071003 ), + new TypeTileButtonInfo( typeof( DarkenedSky ), 0x27AD, 1070966, 1071004 ), + new TypeTileButtonInfo( typeof( TheHorselord ), 0x27A5, 1070967, 1071005 ), + new TypeTileButtonInfo( typeof( RuneBeetleCarapace ), 0x277D, 1070968, 1071006 ), + new TypeTileButtonInfo( typeof( KasaOfTheRajin ), 0x2798, 1070969, 1071007 ), + new TypeTileButtonInfo( typeof( Stormgrip ), 0x2792, 1070970, 1071008 ), + new TypeTileButtonInfo( typeof( TomeOfLostKnowledge ), 0x0EFA, 0x530, 1070971, 1071009 ) + } + }; + #endregion - public static TypeTileButtonInfo[] NormalRewards { get { return m_NormalRewards; } } + public static TypeTileButtonInfo[][] NormalRewards + { + get { return m_NormalRewards; } + } - private static PigmentsTileButtonInfo[] m_PigmentRewards = new PigmentsTileButtonInfo[] - { + #region ToT Pigment Rewards Table + private static PigmentsTileButtonInfo[][] m_PigmentRewards = new PigmentsTileButtonInfo[][] + { + // ToT One Pigment Rewards + new PigmentsTileButtonInfo[] { new PigmentsTileButtonInfo( PigmentType.ParagonGold ), new PigmentsTileButtonInfo( PigmentType.VioletCouragePurple ), new PigmentsTileButtonInfo( PigmentType.InvulnerabilityBlue ), @@ -412,13 +512,43 @@ namespace Server.Gumps new PigmentsTileButtonInfo( PigmentType.NoxGreen ), new PigmentsTileButtonInfo( PigmentType.RumRed ), new PigmentsTileButtonInfo( PigmentType.FireOrange ) - }; + }, + // ToT Two Pigment Rewards + new PigmentsTileButtonInfo[] { + new PigmentsTileButtonInfo( PigmentType.FadedCoal ), + new PigmentsTileButtonInfo( PigmentType.Coal ), + new PigmentsTileButtonInfo( PigmentType.FadedGold ), + new PigmentsTileButtonInfo( PigmentType.StormBronze ), + new PigmentsTileButtonInfo( PigmentType.Rose ), + new PigmentsTileButtonInfo( PigmentType.MidnightCoal ), + new PigmentsTileButtonInfo( PigmentType.FadedBronze ), + new PigmentsTileButtonInfo( PigmentType.FadedRose ), + new PigmentsTileButtonInfo( PigmentType.DeepRose ) + }, + // ToT Three Pigment Rewards + new PigmentsTileButtonInfo[] { + new PigmentsTileButtonInfo( PigmentType.ParagonGold ), + new PigmentsTileButtonInfo( PigmentType.VioletCouragePurple ), + new PigmentsTileButtonInfo( PigmentType.InvulnerabilityBlue ), + new PigmentsTileButtonInfo( PigmentType.LunaWhite ), + new PigmentsTileButtonInfo( PigmentType.DryadGreen ), + new PigmentsTileButtonInfo( PigmentType.ShadowDancerBlack ), + new PigmentsTileButtonInfo( PigmentType.BerserkerRed ), + new PigmentsTileButtonInfo( PigmentType.NoxGreen ), + new PigmentsTileButtonInfo( PigmentType.RumRed ), + new PigmentsTileButtonInfo( PigmentType.FireOrange ) + } + }; + #endregion - public static PigmentsTileButtonInfo[] PigmentRewards { get { return m_PigmentRewards; } } + public static PigmentsTileButtonInfo[][] PigmentRewards + { + get { return m_PigmentRewards; } + } private Mobile m_Collector; - public ToTRedeemGump( Mobile collector, bool pigments ) : base( pigments ? 1070986 : 1070985, pigments ? (ImageTileButtonInfo[])m_PigmentRewards : (ImageTileButtonInfo[])m_NormalRewards ) + public ToTRedeemGump( Mobile collector, bool pigments ) : base( pigments ? 1070986 : 1070985, pigments ? (ImageTileButtonInfo[])m_PigmentRewards[(int)TreasuresOfTokuno.RewardEra-1] : (ImageTileButtonInfo[])m_NormalRewards[(int)TreasuresOfTokuno.RewardEra-1] ) { m_Collector = collector; } diff --git a/Scripts/Engines/Treasures of Tokuno/TreasuresOfTokunoPersistance.cs b/Scripts/Engines/Treasures of Tokuno/TreasuresOfTokunoPersistance.cs new file mode 100644 index 000000000..a455c4d40 --- /dev/null +++ b/Scripts/Engines/Treasures of Tokuno/TreasuresOfTokunoPersistance.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; + +namespace Server.Misc +{ + public class TreasuresOfTokunoPersistance : Item + { + private static TreasuresOfTokunoPersistance m_Instance; + + public static TreasuresOfTokunoPersistance Instance{ get{ return m_Instance; } } + + public override string DefaultName + { + get { return "TreasuresOfTokuno Persistance - Internal"; } + } + + public static void Initialize() + { + if ( m_Instance == null ) + new TreasuresOfTokunoPersistance(); + } + + public TreasuresOfTokunoPersistance() : base( 1 ) + { + Movable = false; + + if ( m_Instance == null || m_Instance.Deleted ) + m_Instance = this; + else + base.Delete(); + } + + public TreasuresOfTokunoPersistance( Serial serial ) : base( serial ) + { + m_Instance = this; + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.Write( (int) 0 ); // version + + writer.WriteEncodedInt( (int)TreasuresOfTokuno.RewardEra ); + writer.WriteEncodedInt( (int)TreasuresOfTokuno.DropEra ); + } + + public override void Deserialize(GenericReader reader) + { + base.Deserialize( reader ); + + int version = reader.ReadInt(); + + switch ( version ) + { + case 0: + { + TreasuresOfTokuno.RewardEra = (TreasuresOfTokunoEra)reader.ReadEncodedInt(); + TreasuresOfTokuno.DropEra = (TreasuresOfTokunoEra)reader.ReadEncodedInt(); + + break; + } + } + } + + public override void Delete() + { + } + } +} diff --git a/Scripts/Gumps/ToTAdminGump.cs b/Scripts/Gumps/ToTAdminGump.cs new file mode 100644 index 000000000..463b143ba --- /dev/null +++ b/Scripts/Gumps/ToTAdminGump.cs @@ -0,0 +1,138 @@ +using System; +using Server; +using Server.Gumps; +using Server.Misc; +using Server.Items; +using Server.Network; +using Server.Commands; +using Server.Mobiles; + +namespace Server.Gumps +{ + public class ToTAdminGump : Gump + { + private int m_ToTEras; + private static string[] m_ToTInfo = + { + //Opening Message + "
Treasures of Tokuno Admin

" + + "-Use the gems to switch eras
" + + "-Drop era and Reward era can be changed seperately
" + + "-Drop era can be deactivated, Reward era is always activated", + //Treasures of Tokuno 1 message + "
Treasures of Tokuno 1

" + + "-10 charge Bleach Pigment can drop as a Lesser Artifact
" + + "-50 charge Neon Pigments available as a reward
", + //Treasures of Tokuno 2 message + "
Treasures of Tokuno 2

" + + "-30 types of 1 charge Metallic Pigments drop as Lesser Artifacts
" + + "-1 charge Bleach Pigment can drop as a Lesser Artifact
" + + "-10 charge Greater Metallic Pigments available as a reward", + //Treasures of Tokuno 3 message + "
Treasures of Tokuno 3

" + + "-10 types of 1 charge Fresh Pigments drop as Lesser Artifacts
" + + "-1 charge Bleach Pigment can drop as a Lesser Artifact
" + + "-Leurocian's Mempo Of Fortune can drop as a Lesser Artifact" + }; + + public ToTAdminGump() : base( 30, 50 ) + { + Closable=true; + Disposable=true; + Dragable=true; + Resizable=false; + + m_ToTEras = Enum.GetValues( typeof( TreasuresOfTokunoEra ) ).Length - 1; + + AddPage( 0 ); + AddBackground( 0, 0, 320, 75 + (m_ToTEras * 25), 9200 ); + AddImageTiled( 25, 18, 270, 10, 9267 ); + AddLabel( 75, 5, 54, "Treasures of Tokuno Admin" ); + AddLabel( 10, 25, 54, "ToT Era" ); + AddLabel( 90, 25, 54, "Drop Era" ); + AddLabel( 195, 25, 54, "Reward Era" ); + AddLabel( 287, 25, 54, "Info" ); + + AddBackground( 320, 0, 200, 150, 9200 ); + AddImageTiled( 325, 5, 190, 140, 2624 ); + AddAlphaRegion( 325, 5, 190, 140 ); + + SetupToTEras(); + } + + public void SetupToTEras() + { + bool isActivated = TreasuresOfTokuno.DropEra != TreasuresOfTokunoEra.None; + AddButton( 75, 50, isActivated ? 2361 : 2360, isActivated ? 2361 : 2360, 1, GumpButtonType.Reply, 0 ); + AddLabel( 90, 45, isActivated ? 167 : 137, isActivated ? "Activated" : "Deactivated" ); + + for ( int i = 0; i < m_ToTEras; i++ ) + { + int yoffset = (i * 25); + + bool isThisDropEra = ((int)TreasuresOfTokuno.DropEra - 1) == i; + bool isThisRewardEra = ((int)TreasuresOfTokuno.RewardEra - 1) == i; + int dropButtonID = isThisDropEra ? 2361 : 2360; + int rewardButtonID = isThisRewardEra ? 2361 : 2360; + + AddLabel( 10, 70 + yoffset, 2100, "ToT " + ( i + 1 ) ); + AddButton( 75, 75 + yoffset, dropButtonID, dropButtonID, 2 + ( i * 2 ), GumpButtonType.Reply, 0); + AddLabel( 90, 70 + yoffset, isThisDropEra ? 167 : 137, isThisDropEra ? "Active" : "Inactive" ); + AddButton( 180, 75 + yoffset, rewardButtonID, rewardButtonID, 2 + ( i * 2 ) + 1, GumpButtonType.Reply, 0); + AddLabel( 195, 70 + yoffset, isThisRewardEra ? 167 : 137, isThisRewardEra ? "Active" : "Inactive" ); + + AddButton( 285, 70 + yoffset, 4005, 4006, i, GumpButtonType.Page, 2 + i); + } + + for ( int i = 0; i < m_ToTInfo.Length; i++ ) + { + AddPage( 1 + i ); + AddHtml( 330, 10, 180, 130, m_ToTInfo[i], false, true ); + } + } + + public override void OnResponse( NetState sender, RelayInfo info ) + { + int button = info.ButtonID; + Mobile from = sender.Mobile; + + if ( button == 1 ) + { + TreasuresOfTokuno.DropEra = TreasuresOfTokunoEra.None; + from.SendMessage( "Treasures of Tokuno Drops have been deactivated" ); + } + else if ( button >= 2 ) + { + int selectedToT; + if ( button % 2 == 0 ) + { + selectedToT = button / 2; + TreasuresOfTokuno.DropEra = (TreasuresOfTokunoEra)( selectedToT ); + from.SendMessage( "Treasures of Tokuno " + selectedToT + " Drops have been enabled" ); + } + else + { + selectedToT = (button - 1) / 2; + TreasuresOfTokuno.RewardEra = (TreasuresOfTokunoEra)( selectedToT ); + from.SendMessage( "Treasures of Tokuno " + selectedToT + " Rewards have been enabled" ); + } + } + } + + public static void Initialize() + { + CommandSystem.Register( "ToTAdmin", AccessLevel.Administrator, new CommandEventHandler( ToTAdmin_OnCommand ) ); + } + + [Usage( "ToTAdmin" )] + [Description( "Displays a menu to configure Treasures of Tokuno." )] + public static void ToTAdmin_OnCommand( CommandEventArgs e ) + { + ToTAdminGump tg; + + tg = new ToTAdminGump(); + e.Mobile.CloseGump( typeof( ToTAdminGump ) ); + e.Mobile.SendGump( tg ); + } + } +} diff --git a/Scripts/Misc/CharacterCreation.cs b/Scripts/Misc/CharacterCreation.cs index 184a3db1c..60bde5cf0 100644 --- a/Scripts/Misc/CharacterCreation.cs +++ b/Scripts/Misc/CharacterCreation.cs @@ -361,7 +361,7 @@ namespace Server.Misc PlaceItemIn( bank, 18, 124, cont ); - if( TreasuresOfTokuno.Enabled ) + if( Core.SE ) { cont = new Bag(); cont.Hue = 0x501; @@ -373,7 +373,7 @@ namespace Server.Misc PlaceItemIn( cont, 92, 80, new DragonNunchaku() ); PlaceItemIn( cont, 42, 56, new PeasantsBokuto() ); PlaceItemIn( cont, 44, 71, new TomeOfEnlightenment() ); - //PlaceItemIn( cont, 35, 35, new ChestOfHeirlooms() ); //Chest of Heirlooms + PlaceItemIn( cont, 35, 35, new ChestOfHeirlooms() ); PlaceItemIn( cont, 29, 0, new HonorableSwords() ); PlaceItemIn( cont, 49, 85, new AncientUrn() ); PlaceItemIn( cont, 51, 58, new FluteOfRenewal() ); diff --git a/Scripts/Misc/Loot.cs b/Scripts/Misc/Loot.cs index 945aa3c52..94cd7727d 100644 --- a/Scripts/Misc/Loot.cs +++ b/Scripts/Misc/Loot.cs @@ -546,6 +546,13 @@ namespace Server return Construct( m_WeaponTypes, m_RangedWeaponTypes, m_ArmorTypes, m_HatTypes, m_ShieldTypes, m_JewelryTypes ); } + + #region Chest of Heirlooms + public static Item ChestOfHeirloomsContains() + { + return Construct( m_SEArmorTypes, m_SEHatTypes, m_SEWeaponTypes, m_SERangedWeaponTypes, m_JewelryTypes ); + } + #endregion public static Item RandomGem() { diff --git a/Scripts/Mobiles/AI/Creature/BaseCreature.cs b/Scripts/Mobiles/AI/Creature/BaseCreature.cs index e047e2ffc..4c4d23122 100644 --- a/Scripts/Mobiles/AI/Creature/BaseCreature.cs +++ b/Scripts/Mobiles/AI/Creature/BaseCreature.cs @@ -4485,7 +4485,7 @@ namespace Server.Mobiles Faction.HandleDeath( this, ds.m_Mobile ); } - if( !givenToTKill ) + if( !givenToTKill && Map == Map.Tokuno ) { givenToTKill = true; TreasuresOfTokuno.HandleKill( this, ds.m_Mobile );