From 4df455f33cca1a82b7962aeb0c0880d8ca839ae5 Mon Sep 17 00:00:00 2001 From: xavier Date: Sat, 2 Oct 2010 15:25:30 +0000 Subject: [PATCH] Fixed issue with secured dye tubs in houses http://www.uodemise.com/forum/showthread.php?t=147193 Smith/Tailor PS should not be cursed http://www.uodemise.com/forum/showthread.php?t=148415 Large crafting system overhaul http://www.uodemise.com/forum/showthread.php?t=119342 --- Scripts/Engines/Craft/Core/CraftContext.cs | 21 + Scripts/Engines/Craft/Core/CraftGump.cs | 92 ++- Scripts/Engines/Craft/Core/CraftGumpItem.cs | 7 +- Scripts/Engines/Craft/Core/CraftItem.cs | 354 +++++++-- Scripts/Engines/Craft/Core/CraftSystem.cs | 38 +- Scripts/Engines/Craft/Core/Enhance.cs | 275 ++++--- Scripts/Engines/Craft/DefBowFletching.cs | 13 +- Scripts/Engines/Craft/DefCarpentry.cs | 340 +++++++-- Scripts/Engines/Craft/DefTailoring.cs | 39 +- Scripts/Engines/Craft/DefTinkering.cs | 13 +- Scripts/Engines/Plants/PlantItem.cs | 2 +- Scripts/Items/Addons/AbbatoirAddon.cs | 10 +- .../Items/Addons/AlchemistTableEastAddon.cs | 12 +- .../Items/Addons/AlchemistTableSouthAddon.cs | 12 +- Scripts/Items/Addons/AnvilEastAddon.cs | 10 +- Scripts/Items/Addons/AnvilSouthAddon.cs | 10 +- .../Items/Addons/ArcaneBookshelfEastAddon.cs | 8 +- .../Items/Addons/ArcaneBookshelfSouthAddon.cs | 10 +- Scripts/Items/Addons/ArcaneCircleAddon.cs | 10 +- .../Items/Addons/ArcanistStatueEastAddon.cs | 12 +- .../Items/Addons/ArcanistStatueSouthAddon.cs | 12 +- Scripts/Items/Addons/BallotBox.cs | 9 +- Scripts/Items/Addons/BaseAddon.cs | 2 +- Scripts/Items/Addons/BaseAddonDeed.cs | 26 +- Scripts/Items/Addons/DartBoard.cs | 18 +- Scripts/Items/Addons/ElvenBedEastAddon.cs | 10 +- Scripts/Items/Addons/ElvenBedSouthAddon.cs | 10 +- Scripts/Items/Addons/ElvenDresserEastAddon.cs | 10 +- .../Items/Addons/ElvenDresserSouthAddon.cs | 10 +- Scripts/Items/Addons/ElvenForgeAddon.cs | 13 +- .../Items/Addons/ElvenLoveseatEastAddon.cs | 16 +- .../Items/Addons/ElvenLoveseatSouthAddon.cs | 16 +- .../Addons/ElvenSpinningwheelEastAddon.cs | 12 +- .../Addons/ElvenSpinningwheelSouthAddon.cs | 12 +- Scripts/Items/Addons/ElvenStoveEastAddon.cs | 12 +- Scripts/Items/Addons/ElvenStoveSouthAddon.cs | 12 +- .../Items/Addons/ElvenWashbasinEastAddon.cs | 12 +- .../Items/Addons/ElvenWashbasinSouthAddon.cs | 12 +- .../Items/Addons/FancyElvenTableEastAddon.cs | 18 +- .../Items/Addons/FancyElvenTableSouthAddon.cs | 18 +- Scripts/Items/Addons/FlourMillEastAddon.cs | 10 +- Scripts/Items/Addons/FlourMillSouthAddon.cs | 10 +- Scripts/Items/Addons/LargeBedEastAddon.cs | 10 +- Scripts/Items/Addons/LargeBedSouthAddon.cs | 10 +- Scripts/Items/Addons/LargeForgeEastAddon.cs | 10 +- Scripts/Items/Addons/LargeForgeSouthAddon.cs | 10 +- Scripts/Items/Addons/LoomEastAddon.cs | 10 +- Scripts/Items/Addons/LoomSouthAddon.cs | 10 +- .../Items/Addons/OrnateElvenTableEastAddon.cs | 18 +- .../Addons/OrnateElvenTableSouthAddon.cs | 18 +- Scripts/Items/Addons/ParrotPerchAddon.cs | 14 +- Scripts/Items/Addons/PentagramAddon.cs | 10 +- Scripts/Items/Addons/PickpocketDips.cs | 20 +- Scripts/Items/Addons/SmallBedEastAddon.cs | 10 +- Scripts/Items/Addons/SmallBedSouthAddon.cs | 10 +- Scripts/Items/Addons/SmallForgeAddon.cs | 10 +- .../Items/Addons/SpinningwheelEastAddon.cs | 10 +- .../Items/Addons/SpinningwheelSouthAddon.cs | 10 +- .../Items/Addons/SquirrelStatueEastAddon.cs | 10 +- .../Items/Addons/SquirrelStatueSouthAddon.cs | 10 +- Scripts/Items/Addons/StoneOvenEastAddon.cs | 10 +- Scripts/Items/Addons/StoneOvenSouthAddon.cs | 10 +- Scripts/Items/Addons/TallElvenBedEastAddon.cs | 10 +- .../Items/Addons/TallElvenBedSouthAddon.cs | 10 +- Scripts/Items/Addons/TrainingDummies.cs | 20 +- .../Items/Addons/WarriorStatueEastAddon.cs | 10 +- .../Items/Addons/WarriorStatueSouthAddon.cs | 10 +- Scripts/Items/Addons/WaterTroughEastAddon.cs | 10 +- Scripts/Items/Addons/WaterTroughSouthAddon.cs | 10 +- Scripts/Items/Armor/BaseArmor.cs | 221 ++++-- .../Items/Armor/Plate/HeavyPlateJingasa.cs | 2 + .../Items/Armor/Plate/LightPlateJingasa.cs | 2 + Scripts/Items/Armor/Plate/PlateDo.cs | 2 + Scripts/Items/Armor/Plate/PlateHaidate.cs | 2 + Scripts/Items/Armor/Plate/PlateHatsuburi.cs | 2 + Scripts/Items/Armor/Plate/PlateHiroSode.cs | 2 + Scripts/Items/Armor/Plate/PlateMempo.cs | 2 + Scripts/Items/Armor/Plate/PlateSuneate.cs | 2 + .../Items/Armor/Plate/SmallPlateJingasa.cs | 2 + Scripts/Items/Clothing/BaseClothing.cs | 2 +- Scripts/Items/Construction/Chairs/Benchs.cs | 11 +- Scripts/Items/Construction/Chairs/Chairs.cs | 49 +- Scripts/Items/Construction/Chairs/Stools.cs | 10 +- Scripts/Items/Construction/Chairs/Thrones.cs | 10 +- .../Items/Construction/Misc/BarrelParts.cs | 14 +- Scripts/Items/Construction/Misc/BookStand.cs | 33 + Scripts/Items/Construction/Misc/Easle.cs | 53 +- Scripts/Items/Construction/Misc/MusicStand.cs | 30 +- Scripts/Items/Construction/Misc/Screens.cs | 24 +- Scripts/Items/Construction/Misc/Statues.cs | 78 +- Scripts/Items/Construction/Misc/Vase.cs | 18 +- Scripts/Items/Construction/Tables/Tables.cs | 28 +- .../Items/Construction/Tables/WritingTable.cs | 4 +- Scripts/Items/Containers/Container.cs | 297 +++++++- .../Items/Containers/FillableContainers.cs | 6 + .../Items/Containers/FurnitureContainer.cs | 309 ++++++-- Scripts/Items/Containers/LockableContainer.cs | 83 ++- Scripts/Items/Containers/ParagonChest.cs | 2 + Scripts/Items/Containers/TreasureChest.cs | 4 + Scripts/Items/Games/Backgammon.cs | 2 +- .../Games/{BaseBoard.cs => BaseGameBoard.cs} | 16 +- Scripts/Items/Games/BasePiece.cs | 8 +- Scripts/Items/Games/CheckerBoard.cs | 2 +- Scripts/Items/Games/CheckersPieces.cs | 4 +- Scripts/Items/Games/ChessPieces.cs | 24 +- Scripts/Items/Games/Chessboard.cs | 2 +- Scripts/Items/Jewels/BaseJewel.cs | 2 +- Scripts/Items/Lights/BaseLight.cs | 101 ++- Scripts/Items/Lights/RedHangingLantern.cs | 9 +- Scripts/Items/Lights/WhiteHangingLantern.cs | 9 +- Scripts/Items/Misc/BaseCraftableItem.cs | 159 ++++ Scripts/Items/Misc/BaseOtherEquipable.cs | 683 ++++++++++++++++++ Scripts/Items/Misc/BonusAttribute.cs | 416 +++++++++++ Scripts/Items/Misc/FlipableAttribute.cs | 14 +- Scripts/Items/Misc/PlayerBulletinBoards.cs | 74 +- Scripts/Items/Shields/WoodenShield.cs | 2 + .../Skill Items/Carpenter Items/Board.cs | 123 +++- .../Items/Skill Items/Fishing/FishingPole.cs | 10 +- Scripts/Items/Skill Items/Lumberjack/Log.cs | 128 +++- .../Items/Skill Items/Magical/Spellbook.cs | 2 +- .../Musical Instruments/BaseInstrument.cs | 46 +- .../Tailor Items/Dyetubs/DyeTub.cs | 1 + .../Tailor Items/Misc/Dressform.cs | 17 +- .../Items/Skill Items/Tools/BaseRunicTool.cs | 4 +- .../Skill Items/Tools/RunicDovetailSaw.cs | 77 ++ .../Special/Special Scrolls/PowerScroll.cs | 6 +- Scripts/Items/Weapons/BaseWeapon.cs | 279 +++++-- Scripts/Misc/AOS.cs | 59 +- Scripts/Misc/ResourceInfo.cs | 446 +++++++++--- Scripts/Mobiles/PlayerMobile.cs | 3 + Scripts/Multis/BaseHouse.cs | 11 +- Scripts/Skills/Meditation.cs | 5 +- 132 files changed, 4914 insertions(+), 1012 deletions(-) create mode 100644 Scripts/Items/Construction/Misc/BookStand.cs rename Scripts/Items/Games/{BaseBoard.cs => BaseGameBoard.cs} (83%) create mode 100644 Scripts/Items/Misc/BaseCraftableItem.cs create mode 100644 Scripts/Items/Misc/BaseOtherEquipable.cs create mode 100644 Scripts/Items/Misc/BonusAttribute.cs create mode 100644 Scripts/Items/Skill Items/Tools/RunicDovetailSaw.cs diff --git a/Scripts/Engines/Craft/Core/CraftContext.cs b/Scripts/Engines/Craft/Core/CraftContext.cs index 254626c66..61026da17 100644 --- a/Scripts/Engines/Craft/Core/CraftContext.cs +++ b/Scripts/Engines/Craft/Core/CraftContext.cs @@ -19,6 +19,16 @@ namespace Server.Engines.Craft private int m_LastGroupIndex; private bool m_DoNotColor; private CraftMarkOption m_MarkOption; + + #region Hue State Vars + private bool m_CheckedHues; + private List m_Hues; + private Item m_CompareHueTo; + + public bool CheckedHues { get { return m_CheckedHues; } set { m_CheckedHues = value; } } + public List Hues { get { return m_Hues; } set { m_Hues = value; } } + public Item CompareHueTo { get { return m_CompareHueTo; } set { m_CompareHueTo = value; } } + #endregion public List Items { get { return m_Items; } } public int LastResourceIndex{ get{ return m_LastResourceIndex; } set{ m_LastResourceIndex = value; } } @@ -33,6 +43,10 @@ namespace Server.Engines.Craft m_LastResourceIndex = -1; m_LastResourceIndex2 = -1; m_LastGroupIndex = -1; + + m_CheckedHues = false; + m_Hues = new List(); + m_CompareHueTo = null; } public CraftItem LastMade @@ -55,5 +69,12 @@ namespace Server.Engines.Craft m_Items.Insert( 0, item ); } + + public void ResetHueStateVars() + { + m_CheckedHues = false; + m_Hues = new List(); + m_CompareHueTo = null; + } } } \ No newline at end of file diff --git a/Scripts/Engines/Craft/Core/CraftGump.cs b/Scripts/Engines/Craft/Core/CraftGump.cs index 5bb081f34..0ba365c44 100644 --- a/Scripts/Engines/Craft/Core/CraftGump.cs +++ b/Scripts/Engines/Craft/Core/CraftGump.cs @@ -125,25 +125,22 @@ namespace Server.Engines.Craft nameString = subResource.NameString; nameNumber = subResource.NameNumber; - resourceType = subResource.ItemType; + resourceType = subResource.ItemType; } - int resourceCount = 0; - - if ( from.Backpack != null ) - { - Item[] items = from.Backpack.FindItemsByType( resourceType, true ); - - for ( int i = 0; i < items.Length; ++i ) - resourceCount += items[i].Amount; - } + int resourceCount = GetResourceAmount( resourceType ); AddButton( 15, 362, 4005, 4007, GetButtonID( 6, 0 ), GumpButtonType.Reply, 0 ); if ( nameNumber > 0 ) - AddHtmlLocalized( 50, 365, 250, 18, nameNumber, resourceCount.ToString(), LabelColor, false, false ); + { + if ( context.DoNotColor ) + AddLabel( 50, 364, LabelHue, "*" ); + + AddHtmlLocalized( context.DoNotColor ? 61 : 50, 365, 250, 18, nameNumber, resourceCount.ToString(), LabelColor, false, false ); + } else - AddLabel( 50, 362, LabelHue, String.Format( "{0} ({1} Available)", nameString, resourceCount ) ); + AddLabel( 50, 362, LabelHue, String.Format( "{0} ({1} Available)", nameString, resourceCount ) ); } // **************************************** @@ -155,7 +152,7 @@ namespace Server.Engines.Craft int resIndex = ( context == null ? -1 : context.LastResourceIndex2 ); - Type resourceType = craftSystem.CraftSubRes2.ResType; + Type resourceType = craftSystem.CraftSubRes2.ResType; if ( resIndex > -1 ) { @@ -163,25 +160,22 @@ namespace Server.Engines.Craft nameString = subResource.NameString; nameNumber = subResource.NameNumber; - resourceType = subResource.ItemType; + resourceType = subResource.ItemType; } - int resourceCount = 0; - - if ( from.Backpack != null ) - { - Item[] items = from.Backpack.FindItemsByType( resourceType, true ); - - for ( int i = 0; i < items.Length; ++i ) - resourceCount += items[i].Amount; - } + int resourceCount = GetResourceAmount( resourceType ); AddButton( 15, 382, 4005, 4007, GetButtonID( 6, 7 ), GumpButtonType.Reply, 0 ); if ( nameNumber > 0 ) - AddHtmlLocalized( 50, 385, 250, 18, nameNumber, resourceCount.ToString(), LabelColor, false, false ); + { + if ( context.DoNotColor ) + AddLabel( 50, 384, LabelHue, "*" ); + + AddHtmlLocalized( context.DoNotColor ? 61 : 50, 385, 250, 18, nameNumber, resourceCount.ToString(), LabelColor, false, false ); + } else - AddLabel( 50, 385, LabelHue, String.Format( "{0} ({1} Available)", nameString, resourceCount ) ); + AddLabel( 50, 385, LabelHue, String.Format( "{0} ({1} Available)", nameString, resourceCount ) ); } // **************************************** @@ -221,15 +215,7 @@ namespace Server.Engines.Craft AddHtmlLocalized( 255, 263, 200, 18, (context == null || !context.DoNotColor) ? 1061591 : 1061590, LabelColor, false, false ); } - int resourceCount = 0; - - if ( from.Backpack != null ) - { - Item[] items = from.Backpack.FindItemsByType( subResource.ItemType, true ); - - for ( int j = 0; j < items.Length; ++j ) - resourceCount += items[j].Amount; - } + int resourceCount = GetResourceAmount( subResource.ItemType ); AddButton( 220, 60 + (index * 20), 4005, 4007, GetButtonID( 5, i ), GumpButtonType.Reply, 0 ); @@ -364,6 +350,44 @@ namespace Server.Engines.Craft { return 1 + type + (index * 7); } + + public int GetResourceAmount( Type resourceType ) + { + int resourceCount = 0; + + Item[] items; + + if ( m_From.Backpack != null ) + { + if ( m_CraftSystem is DefCarpentry || m_CraftSystem is DefTailoring ) + { + CraftResource resource = CraftResources.GetFromType( resourceType ); + CraftResourceInfo resourceInfo = CraftResources.GetInfo( resource ); + Type[] typeList = resourceInfo.ResourceTypes; + + for ( int i = 0; i < typeList.Length; ++i ) + { + items = m_From.Backpack.FindItemsByType( typeList[i], true ); + + for ( int j = 0; j < items.Length; ++j ) + { + resourceCount += items[j].Amount; + } + } + } + else + { + items = m_From.Backpack.FindItemsByType( resourceType, true ); + + for ( int i = 0; i < items.Length; ++i ) + { + resourceCount += items[i].Amount; + } + } + } + + return resourceCount; + } public void CraftItem( CraftItem item ) { diff --git a/Scripts/Engines/Craft/Core/CraftGumpItem.cs b/Scripts/Engines/Craft/Core/CraftGumpItem.cs index 0c5e63e19..6589c7e05 100644 --- a/Scripts/Engines/Craft/Core/CraftGumpItem.cs +++ b/Scripts/Engines/Craft/Core/CraftGumpItem.cs @@ -81,7 +81,7 @@ namespace Server.Engines.Craft AddLabel( 330, 40, LabelHue, craftItem.NameString ); if ( craftItem.UseAllRes ) - AddHtmlLocalized( 170, 302 + (m_OtherCount++ * 20), 310, 18, 1048176, LabelColor, false, false ); // Makes as many as possible at once + AddHtmlLocalized( 170, 302 + (m_OtherCount++ * 20), 310, 18, craftItem.UseAllMessage, LabelColor, false, false ); DrawItem(); DrawSkill(); @@ -122,7 +122,10 @@ namespace Server.Engines.Craft { Type type = m_CraftItem.ItemType; - AddItem( 20, 50, CraftItem.ItemIDOf( type ) ); + int itemID = m_CraftItem.ForceGumpItemID ? m_CraftItem.GumpItemID : CraftItem.ItemIDOf( type ); + + if ( !type.IsSubclassOf( typeof( BaseAddonDeed ) ) || type.IsDefined( typeof( CraftItemIDAttribute ), true ) ) + AddItem( 20, 50, itemID ); if ( m_CraftItem.IsMarkable( type ) ) { diff --git a/Scripts/Engines/Craft/Core/CraftItem.cs b/Scripts/Engines/Craft/Core/CraftItem.cs index acc38f500..42311b849 100644 --- a/Scripts/Engines/Craft/Core/CraftItem.cs +++ b/Scripts/Engines/Craft/Core/CraftItem.cs @@ -6,6 +6,7 @@ using Server.Items; using Server.Factions; using Server.Mobiles; using Server.Commands; +using Server.Targeting; namespace Server.Engines.Craft { @@ -24,6 +25,8 @@ namespace Server.Engines.Craft private CraftResCol m_arCraftRes; private CraftSkillCol m_arCraftSkill; private Type m_Type; + + private object[] m_CraftArgs; private string m_GroupNameString; private int m_GroupNameNumber; @@ -36,6 +39,8 @@ namespace Server.Engines.Craft private int m_Stam; private bool m_UseAllRes; + private int m_UseAllMessage; + private int m_MultiplyBy; private bool m_NeedHeat; private bool m_NeedOven; @@ -44,14 +49,42 @@ namespace Server.Engines.Craft private bool m_UseSubRes2; private bool m_ForceNonExceptional; + private bool m_ForceGumpItemID; + private int m_GumpItemID; + + private bool m_BeginHueSelector; + private Type m_TypeToCompare; + + public int UseAllMessage + { + get { return m_UseAllMessage; } + set { m_UseAllMessage = value; } + } + + public int MultiplyBy + { + get { return m_MultiplyBy; } + set { m_MultiplyBy = value; } + } public bool ForceNonExceptional { get { return m_ForceNonExceptional; } set { m_ForceNonExceptional = value; } } - + public bool ForceGumpItemID + { + get { return m_ForceGumpItemID; } + set { m_ForceGumpItemID = value; } + } + + public int GumpItemID + { + get { return m_GumpItemID; } + set { m_GumpItemID = value; } + } + private Expansion m_RequiredExpansion; public Expansion RequiredExpansion @@ -133,6 +166,8 @@ namespace Server.Engines.Craft m_GroupNameNumber = groupName; m_NameNumber = name; + + m_MultiplyBy = 1; } public void AddRes( Type type, TextDefinition name, int amount ) @@ -152,6 +187,12 @@ namespace Server.Engines.Craft CraftSkill craftSkill = new CraftSkill( skillToMake, minSkill, maxSkill ); m_arCraftSkill.Add( craftSkill ); } + + public object[] CraftArgs + { + get { return m_CraftArgs; } + set { m_CraftArgs = value; } + } public int Mana { @@ -361,18 +402,37 @@ namespace Server.Engines.Craft typeof( Spellbook ), typeof( Runebook ), typeof( BaseQuiver ) }; + private static Type[] m_MarkableAOSTable = new Type[] + { + typeof( BaseCraftableItem ), + typeof( BasePlayerBB ), + typeof( BaseLight ), + typeof( BaseOtherEquipable ), + typeof( BaseFurnitureContainer ), + typeof( LockableContainer ) + }; #endregion public bool IsMarkable( Type type ) { if( m_ForceNonExceptional ) //Don't even display the stuff for marking if it can't ever be exceptional. return false; - + for ( int i = 0; i < m_MarkableTable.Length; ++i ) { if ( type == m_MarkableTable[i] || type.IsSubclassOf( m_MarkableTable[i] ) ) return true; } + + // Carpentry prior to AOS did not have exceptional items. + if ( Core.AOS ) + { + for ( int i = 0; i < m_MarkableAOSTable.Length; ++i ) + { + if ( type == m_MarkableAOSTable[i] || type.IsSubclassOf( m_MarkableAOSTable[i] ) ) + return true; + } + } return false; } @@ -573,13 +633,19 @@ namespace Server.Engines.Craft { return ConsumeRes( from, typeRes, craftSystem, ref resHue, ref maxAmount, consumeType, ref message, false ); } - + public bool ConsumeRes( Mobile from, Type typeRes, CraftSystem craftSystem, ref int resHue, ref int maxAmount, ConsumeType consumeType, ref object message, bool isFailure ) { - Container ourPack = from.Backpack; + Container c = from.Backpack; + + CraftContext context = craftSystem.GetContext( from ); + + m_System = craftSystem; - if ( ourPack == null ) + if ( c == null || !(c is BaseContainer) ) return false; + + BaseContainer ourPack = (BaseContainer)c; if ( m_NeedHeat && !Find( from, m_HeatSources ) ) { @@ -637,10 +703,15 @@ namespace Server.Engines.Craft amounts[i] = craftRes.Amount; - // For stackable items that can ben crafted more than one at a time + // For stackable items that can be crafted more than one at a time if ( UseAllRes ) { - int tempAmount = ourPack.GetAmount( types[i] ); + if ( !context.CheckedHues ) + if ( RetainsColorFrom( m_System, types[i][0] ) ) + CheckMulitpleHues( from, types[i] ); + + int tempAmount = ourPack.GetAmountCompared( types[i], new CheckItemGroup( CheckHueGrouping ), context.CompareHueTo ); + tempAmount /= amounts[i]; if ( tempAmount < maxAmount ) { @@ -707,12 +778,12 @@ namespace Server.Engines.Craft // Consume ALL if ( consumeType == ConsumeType.All ) { - m_ResHue = 0; m_ResAmount = 0; m_System = craftSystem; - + m_ResHue = 0; m_ResAmount = 0; + if ( IsQuantityType( types ) ) index = ConsumeQuantity( ourPack, types, amounts ); else - index = ourPack.ConsumeTotalGrouped( types, amounts, true, new OnItemConsumed( OnResourceConsumed ), new CheckItemGroup( CheckHueGrouping ) ); + index = ourPack.ConsumeTotalGroupedCompared( types, amounts, true, new OnItemConsumed( OnResourceConsumed ), new CheckItemGroup( CheckHueGrouping ), context.CompareHueTo ); resHue = m_ResHue; } @@ -728,12 +799,12 @@ namespace Server.Engines.Craft amounts[i] = 1; } - m_ResHue = 0; m_ResAmount = 0; m_System = craftSystem; + m_ResHue = 0; m_ResAmount = 0; if ( IsQuantityType( types ) ) index = ConsumeQuantity( ourPack, types, amounts ); else - index = ourPack.ConsumeTotalGrouped( types, amounts, true, new OnItemConsumed( OnResourceConsumed ), new CheckItemGroup( CheckHueGrouping ) ); + index = ourPack.ConsumeTotalGroupedCompared( types, amounts, true, new OnItemConsumed( OnResourceConsumed ), new CheckItemGroup( CheckHueGrouping ), context.CompareHueTo ); resHue = m_ResHue; } @@ -757,7 +828,21 @@ namespace Server.Engines.Craft { for ( int i = 0; i < types.Length; i++ ) { - if ( ourPack.GetBestGroupAmount( types[i], true, new CheckItemGroup( CheckHueGrouping ) ) < amounts[i] ) + if ( !context.CheckedHues ) + if ( RetainsColorFrom( m_System, types[i][0] ) ) + CheckMulitpleHues( from, types[i] ); + + if ( craftSystem.UsesHueSelector( this, types[i][0] ) ) + { + if ( context.CompareHueTo == null && context.Hues.Count > 1 ) + { + m_BeginHueSelector = true; + m_TypeToCompare = types[i][0]; + return false; + } + } + + if ( ourPack.GetComparedGroupAmount( types[i], true, new CheckItemGroup( CheckHueGrouping ), context.CompareHueTo ) < amounts[i] ) { index = i; break; @@ -784,11 +869,106 @@ namespace Server.Engines.Craft message = res.MessageString; else message = 502925; // You don't have the resources required to make that item. - + return false; } } + private class SelectHuedTarget : Target + { + private CraftItem m_CraftItem; + private CraftSystem m_CraftSystem; + private Type m_TypeRes; + private BaseTool m_Tool; + + public SelectHuedTarget( CraftItem craftItem, CraftSystem craftSystem, Type typeRes, BaseTool tool ) : base( -1, true, TargetFlags.None ) + { + m_CraftItem = craftItem; + m_CraftSystem = craftSystem; + m_TypeRes = typeRes; + m_Tool = tool; + } + + protected override void OnTarget( Mobile from, object targeted ) + { + CraftContext context = m_CraftSystem.GetContext( from ); + + if ( context == null ) + return; + + if ( targeted is Item ) + { + Item target = (Item)targeted; + + Type targType = target.GetType(); + + List types = new List(); + + Type baseType = m_CraftItem.GetBaseResType( m_CraftSystem, m_TypeRes ); + + for ( int i = 0; i < m_TypesTable.Length; ++i ) + { + if ( m_TypesTable[i][0] == baseType ) + { + types.AddRange( m_TypesTable[i] ); + break; + } + } + + if ( types.Count <= 0 ) + types.Add( m_TypeRes ); + + for ( int i = 0; i < types.Count; ++i ) + { + if ( target.IsChildOf( from.Backpack ) && targType == types[i] ) + { + context.CompareHueTo = target; + context.Hues = new List( new int[] { target.Hue } ); + m_CraftItem.Craft( from, m_CraftSystem, m_TypeRes, m_Tool ); + return; + } + } + } + + from.Target = new SelectHuedTarget( m_CraftItem, m_CraftSystem, m_TypeRes, m_Tool ); + from.SendLocalizedMessage( 1046439 ); // That is not a valid target. + from.SendLocalizedMessage( 1074794 ); // Target the material to use: + } + + protected override void OnTargetCancel( Mobile from, TargetCancelType cancelType ) + { + CraftContext context = m_CraftSystem.GetContext( from ); + + if ( context != null ) + context.ResetHueStateVars(); + + if ( cancelType == TargetCancelType.Canceled ) + from.SendGump( new CraftGump( from, m_CraftSystem, m_Tool, 0 ) ); + } + } + + public Type GetBaseResType( CraftSystem craftSystem, Type typeRes ) + { + CraftSubResCol resCol = ( UseSubRes2 ? craftSystem.CraftSubRes2 : craftSystem.CraftSubRes ); + CraftRes craftRes = Resources.GetAt( 0 ); + + foreach ( CraftRes res in Resources ) + { + if ( res.ItemType == typeRes ) + { + craftRes = res; + break; + } + } + + Type baseType = craftRes.ItemType; + + if ( (baseType == resCol.ResType) && ( typeRes != null ) ) + baseType = typeRes; + + return baseType; + } + private int m_ResHue; private int m_ResAmount; private CraftSystem m_System; @@ -804,6 +984,25 @@ namespace Server.Engines.Craft m_ResAmount = amount; } } + + private void CheckMulitpleHues( Mobile from, Type[] types ) + { + Item[] items = from.Backpack.FindItemsByType( types, true ); + + CraftContext context = m_System.GetContext( from ); + + if ( context == null || context.CheckedHues || items.Length < 1 ) + return; + + for ( int i = 0; i < items.Length; ++i ) + if ( !context.Hues.Contains( items[i].Hue ) ) + context.Hues.Add( items[i].Hue ); + + context.CheckedHues = true; + + if ( m_UseAllRes && !m_System.UsesHueSelector( this, types[0] ) ) + context.CompareHueTo = items[0]; + } private int CheckHueGrouping( Item a, Item b ) { @@ -814,6 +1013,16 @@ namespace Server.Engines.Craft { if( m_ForceNonExceptional ) return 0.0; + + // Carpentry prior to AOS did not have exceptional items + if ( !Core.AOS ) + { + for ( int i = 0; i < m_MarkableAOSTable.Length; ++i ) + { + if ( m_Type == m_MarkableAOSTable[i] || m_Type.IsSubclassOf( m_MarkableAOSTable[i] ) ) + return 0.0; + } + } switch ( system.ECA ) { @@ -891,7 +1100,7 @@ namespace Server.Engines.Craft return chance; } - + public void Craft( Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool ) { if ( from.BeginAction( typeof( CraftSystem ) ) ) @@ -912,15 +1121,15 @@ namespace Server.Engines.Craft int resHue = 0; int maxAmount = 0; object message = null; + + CraftContext context = craftSystem.GetContext( from ); if( ConsumeRes( from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.None, ref message ) ) { message = null; - + if( ConsumeAttributes( from, ref message, false ) ) { - CraftContext context = craftSystem.GetContext( from ); - if( context != null ) context.OnMade( this ); @@ -932,6 +1141,9 @@ namespace Server.Engines.Craft } else { + if ( context != null ) + context.ResetHueStateVars(); + from.EndAction( typeof( CraftSystem ) ); from.SendGump( new CraftGump( from, craftSystem, tool, message ) ); } @@ -939,7 +1151,20 @@ namespace Server.Engines.Craft else { from.EndAction( typeof( CraftSystem ) ); - from.SendGump( new CraftGump( from, craftSystem, tool, message ) ); + + if ( m_BeginHueSelector ) + { + m_BeginHueSelector = false; + from.SendLocalizedMessage( 1074794 ); // Target the material to use: + from.Target = new SelectHuedTarget( this, craftSystem, m_TypeToCompare, tool ); + } + else + { + if ( context != null ) + context.ResetHueStateVars(); + + from.SendGump( new CraftGump( from, craftSystem, tool, message ) ); + } } } else @@ -1064,26 +1289,31 @@ namespace Server.Engines.Craft return; } + + CraftContext context = craftSystem.GetContext( from ); - tool.UsesRemaining--; - - if ( craftSystem is DefBlacksmithy ) + if ( context != null && context.Hues.Count <= 1 ) { - AncientSmithyHammer hammer = from.FindItemOnLayer( Layer.OneHanded ) as AncientSmithyHammer; - if ( hammer != null && hammer != tool ) + tool.UsesRemaining--; + + if ( craftSystem is DefBlacksmithy ) { - hammer.UsesRemaining--; - if ( hammer.UsesRemaining < 1 ) - hammer.Delete(); + AncientSmithyHammer hammer = from.FindItemOnLayer( Layer.OneHanded ) as AncientSmithyHammer; + if ( hammer != null && hammer != tool ) + { + hammer.UsesRemaining--; + if ( hammer.UsesRemaining < 1 ) + hammer.Delete(); + } } + + if ( tool.UsesRemaining < 1 ) + toolBroken = true; + + if ( toolBroken ) + tool.Delete(); } - if ( tool.UsesRemaining < 1 ) - toolBroken = true; - - if ( toolBroken ) - tool.Delete(); - int num = 0; Item item; @@ -1098,7 +1328,19 @@ namespace Server.Engines.Craft } else { - item = Activator.CreateInstance( ItemType ) as Item; + if ( CraftArgs != null ) + { + try{ item = Activator.CreateInstance( ItemType, CraftArgs ) as Item; } + catch + { + item = null; + //An internal error occurred, Please notify a game master that you received this message. + from.SendGump( new CraftGump( from, craftSystem, tool, 1043288 ) ); + return; + } + } + else + item = Activator.CreateInstance( ItemType ) as Item; } if ( item != null ) @@ -1115,6 +1357,8 @@ namespace Server.Engines.Craft else item.Amount = maxAmount; } + + item.Amount *= m_MultiplyBy; from.AddToBackpack( item ); @@ -1197,13 +1441,18 @@ namespace Server.Engines.Craft return; } - tool.UsesRemaining--; + CraftContext context = craftSystem.GetContext( from ); - if ( tool.UsesRemaining < 1 ) - toolBroken = true; + if ( context != null && context.Hues.Count <= 1 ) + { + tool.UsesRemaining--; - if ( toolBroken ) - tool.Delete(); + if ( tool.UsesRemaining < 1 ) + toolBroken = true; + + if ( toolBroken ) + tool.Delete(); + } // SkillCheck failed. int num = craftSystem.PlayEndingEffect( from, true, true, toolBroken, endquality, false, this ); @@ -1281,6 +1530,8 @@ namespace Server.Engines.Craft if ( cc != null ) cc.EndCraftAction(); + + context.ResetHueStateVars(); return; } @@ -1298,9 +1549,30 @@ namespace Server.Engines.Craft { if ( context.MarkOption == CraftMarkOption.DoNotMark ) makersMark = false; - - m_CraftItem.CompleteCraft( quality, makersMark, m_From, m_CraftSystem, m_TypeRes, m_Tool, null ); + + Type comparerResType = null; + + if ( context.CompareHueTo != null ) + comparerResType = context.CompareHueTo.GetType(); + + Type baseType = m_CraftItem.GetBaseResType( m_CraftSystem, ( comparerResType != null ? comparerResType : m_TypeRes ) ); + + if ( context.Hues != null && context.Hues.Count > 0 && m_CraftItem.UseAllRes && !m_CraftSystem.UsesHueSelector( m_CraftItem, baseType ) ) + { + while ( context.Hues.Count > 0 ) + { + if ( context.CompareHueTo != null ) + context.CompareHueTo.Hue = context.Hues[0]; + + m_CraftItem.CompleteCraft( quality, makersMark, m_From, m_CraftSystem, m_TypeRes, m_Tool, null ); + context.Hues.RemoveAt( 0 ); + } + } + else + m_CraftItem.CompleteCraft( quality, makersMark, m_From, m_CraftSystem, m_TypeRes, m_Tool, null ); } + + context.ResetHueStateVars(); } } } diff --git a/Scripts/Engines/Craft/Core/CraftSystem.cs b/Scripts/Engines/Craft/Core/CraftSystem.cs index b4695ef90..86312fa35 100644 --- a/Scripts/Engines/Craft/Core/CraftSystem.cs +++ b/Scripts/Engines/Craft/Core/CraftSystem.cs @@ -50,6 +50,11 @@ namespace Server.Engines.Craft { return false; } + + public virtual bool UsesHueSelector( CraftItem item, Type type ) + { + return false; + } public CraftContext GetContext( Mobile m ) { @@ -145,6 +150,11 @@ namespace Server.Engines.Craft { return AddCraft( typeItem, group, name, MainSkill, minSkill, maxSkill, typeRes, nameRes, amount, message ); } + + public int AddCraft( Type typeItem, TextDefinition group, TextDefinition name, double minSkill, double maxSkill, Type typeRes, TextDefinition nameRes, int amount, TextDefinition message, object[] args ) + { + return AddCraft( typeItem, group, name, MainSkill, minSkill, maxSkill, typeRes, nameRes, amount, message, args ); + } public int AddCraft( Type typeItem, TextDefinition group, TextDefinition name, SkillName skillToMake, double minSkill, double maxSkill, Type typeRes, TextDefinition nameRes, int amount ) { @@ -152,11 +162,17 @@ namespace Server.Engines.Craft } public int AddCraft( Type typeItem, TextDefinition group, TextDefinition name, SkillName skillToMake, double minSkill, double maxSkill, Type typeRes, TextDefinition nameRes, int amount, TextDefinition message ) + { + return AddCraft( typeItem, group, name, skillToMake, minSkill, maxSkill, typeRes, nameRes, amount, "", null ); + } + + public int AddCraft( Type typeItem, TextDefinition group, TextDefinition name, SkillName skillToMake, double minSkill, double maxSkill, Type typeRes, TextDefinition nameRes, int amount, TextDefinition message, object[] args ) { CraftItem craftItem = new CraftItem( typeItem, group, name ); craftItem.AddRes( typeRes, nameRes, amount, message ); craftItem.AddSkill( skillToMake, minSkill, maxSkill ); - + craftItem.CraftArgs = args; + DoGroup( group, craftItem ); return m_CraftItems.Add( craftItem ); } @@ -197,10 +213,16 @@ namespace Server.Engines.Craft craftItem.Hits = hits; } - public void SetUseAllRes( int index, bool useAll ) + public void SetUseAllRes( int index, bool useAll ) + { + SetUseAllRes( index, useAll, 1048176); // Default message is "Makes as many as possible at once" + } + + public void SetUseAllRes( int index, bool useAll, int message ) { CraftItem craftItem = m_CraftItems.GetAt( index ); craftItem.UseAllRes = useAll; + craftItem.UseAllMessage = message; } public void SetNeedHeat( int index, bool needHeat ) @@ -255,6 +277,12 @@ namespace Server.Engines.Craft CraftItem craftItem = m_CraftItems.GetAt( index ); craftItem.AddRecipe( id, this ); } + + public void MultiplyBy( int index, int multiple ) + { + CraftItem craftItem = m_CraftItems.GetAt( index ); + craftItem.MultiplyBy = multiple; + } public void ForceNonExceptional( int index ) { @@ -262,6 +290,12 @@ namespace Server.Engines.Craft craftItem.ForceNonExceptional = true; } + public void ForceGumpItemID( int index, int itemID ) + { + CraftItem craftItem = m_CraftItems.GetAt( index ); + craftItem.ForceGumpItemID = true; + craftItem.GumpItemID = itemID; + } public void SetSubRes( Type type, string name ) { diff --git a/Scripts/Engines/Craft/Core/Enhance.cs b/Scripts/Engines/Craft/Core/Enhance.cs index 9b6e2e37f..0d6db28fe 100644 --- a/Scripts/Engines/Craft/Core/Enhance.cs +++ b/Scripts/Engines/Craft/Core/Enhance.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using Server; using Server.Targeting; using Server.Items; @@ -29,7 +30,7 @@ namespace Server.Engines.Craft if ( !item.IsChildOf( from.Backpack ) ) return EnhanceResult.NotInBackpack; - if ( !(item is BaseArmor) && !(item is BaseWeapon) ) + if ( !(item is BaseArmor) && !(item is BaseWeapon) && !(item is BaseOtherEquipable) ) return EnhanceResult.BadItem; if ( item is IArcaneEquip ) @@ -85,19 +86,10 @@ namespace Server.Engines.Craft } } - int phys = 0, fire = 0, cold = 0, pois = 0, nrgy = 0; - int dura = 0, luck = 0, lreq = 0, dinc = 0; int baseChance = 0; - - bool physBonus = false; - bool fireBonus = false; - bool coldBonus = false; - bool nrgyBonus = false; - bool poisBonus = false; - bool duraBonus = false; - bool luckBonus = false; - bool lreqBonus = false; - bool dincBonus = false; + + BonusAttribute[] bonusAttrs = null; + BonusAttribute[] randomAttrs = null; if ( item is BaseWeapon ) { @@ -107,23 +99,15 @@ namespace Server.Engines.Craft return EnhanceResult.AlreadyEnhanced; baseChance = 20; - - dura = weapon.MaxHitPoints; - luck = weapon.Attributes.Luck; - lreq = weapon.WeaponAttributes.LowerStatReq; - dinc = weapon.Attributes.WeaponDamage; - - fireBonus = ( attributes.WeaponFireDamage > 0 ); - coldBonus = ( attributes.WeaponColdDamage > 0 ); - nrgyBonus = ( attributes.WeaponEnergyDamage > 0 ); - poisBonus = ( attributes.WeaponPoisonDamage > 0 ); - - duraBonus = ( attributes.WeaponDurability > 0 ); - luckBonus = ( attributes.WeaponLuck > 0 ); - lreqBonus = ( attributes.WeaponLowerRequirements > 0 ); - dincBonus = ( dinc > 0 ); + + CheckSkill( ref baseChance, from, craftSystem ); + + int numOfRand = attributes.RandomAttributeCount; + + bonusAttrs = attributes.WeaponAttributes; + randomAttrs = BonusAttributesHelper.GetRandomAttributes( attributes.WeaponRandomAttributes, numOfRand ); } - else + else if ( item is BaseArmor ) { BaseArmor armor = (BaseArmor)item; @@ -131,62 +115,48 @@ namespace Server.Engines.Craft return EnhanceResult.AlreadyEnhanced; baseChance = 20; - - phys = armor.PhysicalResistance; - fire = armor.FireResistance; - cold = armor.ColdResistance; - pois = armor.PoisonResistance; - nrgy = armor.EnergyResistance; - - dura = armor.MaxHitPoints; - luck = armor.Attributes.Luck; - lreq = armor.ArmorAttributes.LowerStatReq; - - physBonus = ( attributes.ArmorPhysicalResist > 0 ); - fireBonus = ( attributes.ArmorFireResist > 0 ); - coldBonus = ( attributes.ArmorColdResist > 0 ); - nrgyBonus = ( attributes.ArmorEnergyResist > 0 ); - poisBonus = ( attributes.ArmorPoisonResist > 0 ); - - duraBonus = ( attributes.ArmorDurability > 0 ); - luckBonus = ( attributes.ArmorLuck > 0 ); - lreqBonus = ( attributes.ArmorLowerRequirements > 0 ); - dincBonus = false; + + CheckSkill( ref baseChance, from, craftSystem ); + + int numOfRand = attributes.RandomAttributeCount; + + if ( armor.UsesShieldAttrs ) + { + bonusAttrs = attributes.ShieldAttributes; + randomAttrs = BonusAttributesHelper.GetRandomAttributes( attributes.ShieldRandomAttributes, numOfRand ); + } + else + { + bonusAttrs = info.AttributeInfo.ArmorAttributes; + randomAttrs = BonusAttributesHelper.GetRandomAttributes( attributes.ArmorRandomAttributes, numOfRand ); + } } + else if ( item is BaseOtherEquipable ) + { + BaseOtherEquipable otherEquip = (BaseOtherEquipable)item; - int skill = from.Skills[craftSystem.MainSkill].Fixed / 10; - - if ( skill >= 100 ) - baseChance -= (skill - 90) / 10; + if ( !CraftResources.IsStandard( otherEquip.Resource ) ) + return EnhanceResult.AlreadyEnhanced; + baseChance = 20; + + CheckSkill( ref baseChance, from, craftSystem ); + + int numOfRand = attributes.RandomAttributeCount; + + bonusAttrs = attributes.OtherAttributes; + randomAttrs = BonusAttributesHelper.GetRandomAttributes( attributes.OtherRandomAttributes, numOfRand ); + } + + List attrs = new List(); + if ( bonusAttrs != null && bonusAttrs.Length > 0 ) + attrs.AddRange( bonusAttrs ); + if ( randomAttrs != null && randomAttrs.Length > 0 ) + attrs.AddRange( randomAttrs ); + EnhanceResult res = EnhanceResult.Success; - - if ( physBonus ) - CheckResult( ref res, baseChance + phys ); - - if ( fireBonus ) - CheckResult( ref res, baseChance + fire ); - - if ( coldBonus ) - CheckResult( ref res, baseChance + cold ); - - if ( nrgyBonus ) - CheckResult( ref res, baseChance + nrgy ); - - if ( poisBonus ) - CheckResult( ref res, baseChance + pois ); - - if ( duraBonus ) - CheckResult( ref res, baseChance + (dura / 40) ); - - if ( luckBonus ) - CheckResult( ref res, baseChance + 10 + (luck / 2) ); - - if ( lreqBonus ) - CheckResult( ref res, baseChance + (lreq / 4) ); - - if ( dincBonus ) - CheckResult( ref res, baseChance + (dinc / 4) ); + + TryEnhance( attrs, item, baseChance, ref res ); switch ( res ) { @@ -206,17 +176,29 @@ namespace Server.Engines.Craft if( item is BaseWeapon ) { BaseWeapon w = (BaseWeapon)item; + + w.RandomAttributes = randomAttrs; w.Resource = resource; - int hue = w.GetElementalDamageHue(); - if( hue > 0 ) - w.Hue = hue; + w.Hue = w.GetElementalDamageHue( w.Hue ); } - else if( item is BaseArmor ) //Sanity + else if( item is BaseArmor ) { + BaseArmor ar = (BaseArmor)item; + + ar.RandomAttributes = randomAttrs; + ((BaseArmor)item).Resource = resource; } + else if( item is BaseOtherEquipable ) //Sanity + { + BaseOtherEquipable otherEquip = (BaseOtherEquipable)item; + + otherEquip.RandomAttributes = randomAttrs; + + ((BaseOtherEquipable)item).Resource = resource; + } break; } @@ -244,6 +226,129 @@ namespace Server.Engines.Craft else if ( chance > random ) res = EnhanceResult.Broken; } + + public static void CheckSkill( ref int baseChance, Mobile from, CraftSystem craftSystem ) + { + int skill = from.Skills[craftSystem.MainSkill].Fixed / 10; + + if ( skill >= 100 ) + baseChance -= (skill - 90) / 10; + } + + public static void TryEnhance( List attrs, Item item, int baseChance, ref EnhanceResult res ) + { + foreach ( BonusAttribute attr in attrs ) + { + if ( res != EnhanceResult.Success ) + return; + + if ( attr.Attribute == null ) + continue; + + Type type = attr.Attribute.GetType(); + + if ( type == typeof( AosAttribute ) ) + { + AosAttribute aosAttr = (AosAttribute)attr.Attribute; + + if ( aosAttr == AosAttribute.SpellChanneling ) + continue; + + if ( item is IAosAttributes ) + CheckResult( ref res, baseChance + GetChance( aosAttr, ((IAosAttributes)item).Attributes ) ); + } + else if ( type == typeof( AosWeaponAttribute ) ) + { + if ( item is BaseWeapon ) + CheckResult( ref res, baseChance + GetChance( (AosWeaponAttribute)attr.Attribute, ((BaseWeapon)item).WeaponAttributes ) ); + } + else if ( type == typeof( AosArmorAttribute ) ) + { + if ( (AosArmorAttribute)attr.Attribute == AosArmorAttribute.MageArmor ) + continue; + + if ( item is BaseArmor ) + CheckResult( ref res, baseChance + GetChance( (AosArmorAttribute)attr.Attribute, ((BaseArmor)item).ArmorAttributes ) ); + } + else if ( type == typeof( ResistanceType ) ) + { + if ( item is BaseArmor ) + { + BaseArmor ar = (BaseArmor)item; + + switch ( (ResistanceType)attr.Attribute ) + { + case ResistanceType.Physical: + CheckResult( ref res, baseChance + ar.PhysicalResistance ); + break; + case ResistanceType.Fire: + CheckResult( ref res, baseChance + ar.FireResistance ); + break; + case ResistanceType.Cold: + CheckResult( ref res, baseChance + ar.ColdResistance ); + break; + case ResistanceType.Poison: + CheckResult( ref res, baseChance + ar.PoisonResistance ); + break; + case ResistanceType.Energy: + CheckResult( ref res, baseChance + ar.EnergyResistance ); + break; + } + } + } + } + } + + public static int GetChance( AosAttribute attr, AosAttributes itemAttrs ) + { + int chance; + + switch ( attr ) + { + case AosAttribute.LowerWeight: chance = itemAttrs[attr] / 40; break; + case AosAttribute.WeaponDamage: chance = itemAttrs[attr] / 4; break; + case AosAttribute.Luck: chance = 10 + itemAttrs[attr] / 2; break; + default: + chance = itemAttrs[attr] / 2; break; + } + + return chance; + } + + public static int GetChance( AosArmorAttribute attr, AosArmorAttributes itemAttrs ) + { + int chance; + + switch ( attr ) + { + case AosArmorAttribute.DurabilityBonus: chance = itemAttrs[attr] / 40; break; + case AosArmorAttribute.LowerStatReq: chance = itemAttrs[attr] / 4; break; + default: + chance = itemAttrs[attr] / 2; break; + } + + return chance; + } + + public static int GetChance( AosWeaponAttribute attr, AosWeaponAttributes itemAttrs ) + { + int chance; + + switch ( attr ) + { + case AosWeaponAttribute.DurabilityBonus: chance = itemAttrs[attr] / 40; break; + case AosWeaponAttribute.LowerStatReq: chance = itemAttrs[attr] / 4; break; + case AosWeaponAttribute.ResistPhysicalBonus: + case AosWeaponAttribute.ResistFireBonus: + case AosWeaponAttribute.ResistColdBonus: + case AosWeaponAttribute.ResistPoisonBonus: + case AosWeaponAttribute.ResistEnergyBonus: chance = itemAttrs[attr]; break; + default: + chance = itemAttrs[attr] / 2; break; + } + + return chance; + } public static void BeginTarget( Mobile from, CraftSystem craftSystem, BaseTool tool ) { diff --git a/Scripts/Engines/Craft/DefBowFletching.cs b/Scripts/Engines/Craft/DefBowFletching.cs index 2d267e278..f8ffab23a 100644 --- a/Scripts/Engines/Craft/DefBowFletching.cs +++ b/Scripts/Engines/Craft/DefBowFletching.cs @@ -27,6 +27,17 @@ namespace Server.Engines.Craft return m_CraftSystem; } } + + public override CraftECA ECA + { + get + { + if ( Core.AOS ) + return CraftECA.ChanceMinusSixtyToFourtyFive; + + return CraftECA.FiftyPercentChanceMinusTenPercent; + } + } public override double GetChanceAtMin( CraftItem item ) { @@ -81,8 +92,6 @@ namespace Server.Engines.Craft } } - public override CraftECA ECA{ get{ return CraftECA.FiftyPercentChanceMinusTenPercent; } } - public override void InitCraftList() { int index = -1; diff --git a/Scripts/Engines/Craft/DefCarpentry.cs b/Scripts/Engines/Craft/DefCarpentry.cs index 095a4f2ff..e14fefe36 100644 --- a/Scripts/Engines/Craft/DefCarpentry.cs +++ b/Scripts/Engines/Craft/DefCarpentry.cs @@ -27,6 +27,8 @@ namespace Server.Engines.Craft return m_CraftSystem; } } + + public override CraftECA ECA{ get{ return CraftECA.ChanceMinusSixtyToFourtyFive; } } public override double GetChanceAtMin( CraftItem item ) { @@ -46,6 +48,14 @@ namespace Server.Engines.Craft return 0; } + + public override bool RetainsColorFrom( CraftItem item, Type type ) + { + if ( item.ItemType.IsSubclassOf( typeof( BaseWeapon ) ) || item.ItemType.IsSubclassOf( typeof( BaseArmor ) ) ) + return true; + + return false; + } public override void PlayCraftEffect( Mobile from ) { @@ -88,15 +98,30 @@ namespace Server.Engines.Craft // Other Items if ( Core.Expansion == Expansion.AOS || Core.Expansion == Expansion.SE ) { - index = AddCraft( typeof( Board ), 1044294, 1027127, 0.0, 0.0, typeof( Log ), 1044466, 1, 1044465 ); + index = AddCraft( typeof( Board ), 1044294, 1027127, 0.0, 0.0, typeof( Log ), 1044466, 1, 1044465 ); SetUseAllRes( index, true ); } AddCraft( typeof( BarrelStaves ), 1044294, 1027857, 00.0, 25.0, typeof( Log ), 1044041, 5, 1044351 ); AddCraft( typeof( BarrelLid ), 1044294, 1027608, 11.0, 36.0, typeof( Log ), 1044041, 4, 1044351 ); - AddCraft( typeof( ShortMusicStand ), 1044294, 1044313, 78.9, 103.9, typeof( Log ), 1044041, 15, 1044351 ); - AddCraft( typeof( TallMusicStand ), 1044294, 1044315, 81.5, 106.5, typeof( Log ), 1044041, 20, 1044351 ); - AddCraft( typeof( Easle ), 1044294, 1044317, 86.8, 111.8, typeof( Log ), 1044041, 20, 1044351 ); + AddCraft( typeof( ShortMusicStand ), 1044294, 1044313, 78.9, 103.9, typeof( Log ), 1044041, 15, 1044351 ); //Left + + index = AddCraft( typeof( ShortMusicStand ), 1044294, 1044314, 78.9, 103.9, typeof( Log ), 1044041, 15, 1044351, new object[] { 0xEB8 } ); //Right + ForceGumpItemID( index, 0xEB8 ); + + AddCraft( typeof( TallMusicStand ), 1044294, 1044315, 81.5, 106.5, typeof( Log ), 1044041, 20, 1044351 ); //Left + + index = AddCraft( typeof( TallMusicStand ), 1044294, 1044316, 81.5, 106.5, typeof( Log ), 1044041, 20, 1044351, new object[] { 0xEBC } ); //Right + ForceGumpItemID( index, 0xEBC ); + + AddCraft( typeof( EasleWithCanvas ), 1044294, 1044317, 86.8, 111.8, typeof( Log ), 1044041, 20, 1044351 ); //South + + index = AddCraft( typeof( EasleWithCanvas ), 1044294, 1044318, 86.8, 111.8, typeof( Log ), 1044041, 20, 1044351, new object[] { 0xF68 } ); //East + ForceGumpItemID( index, 0xF68 ); + + index = AddCraft( typeof( EasleWithCanvas ), 1044294, 1044319, 86.8, 111.8, typeof( Log ), 1044041, 20, 1044351, new object[] { 0xF6A } ); //North + ForceGumpItemID( index, 0xF6A ); + if( Core.SE ) { index = AddCraft( typeof( RedHangingLantern ), 1044294, 1029412, 65.0, 90.0, typeof( Log ), 1044041, 5, 1044351 ); @@ -120,12 +145,19 @@ namespace Server.Engines.Craft if( Core.AOS ) //Duplicate Entries to preserve ordering depending on era { - index = AddCraft( typeof( FishingPole ), 1044294, 1023519, 68.4, 93.4, typeof( Log ), 1044041, 5, 1044351 ); //This is in the categor of Other during AoS + index = AddCraft( typeof( FishingPole ), 1044294, 1023519, 68.4, 93.4, typeof( Log ), 1044041, 5, 1044351 ); //This is in the category of Other during AoS AddSkill( index, SkillName.Tailoring, 40.0, 45.0 ); AddRes( index, typeof( Cloth ), 1044286, 5, 1044287 ); } - + if( Core.ML ) + { + index = AddCraft( typeof( ArcanistStatueSouthDeed ), 1044294, 1072885, 0.0, 35.0, typeof( Log ), 1044041, 250, 1044351 ); + SetNeededExpansion( index, Expansion.ML ); + + index = AddCraft( typeof( ArcanistStatueEastDeed ), 1044294, 1072886, 0.0, 35.0, typeof( Log ), 1044041, 250, 1044351 ); + SetNeededExpansion( index, Expansion.ML ); + } // Furniture AddCraft( typeof( FootStool ), 1044291, 1022910, 11.0, 36.0, typeof( Log ), 1044041, 9, 1044351 ); @@ -150,6 +182,30 @@ namespace Server.Engines.Craft index = AddCraft( typeof( PlainLowTable ), 1044291, 1030266, 80.0, 105.0, typeof( Log ), 1044041, 35, 1044351 ); SetNeededExpansion( index, Expansion.SE ); } + + if( Core.ML ) + { + index = AddCraft( typeof( OrnateElvenTableSouthDeed ), 1044291, 1072869, 85.0, 110.0, typeof( Log ), 1044041, 60, 1044351 ); + SetNeededExpansion( index, Expansion.ML ); + + index = AddCraft( typeof( OrnateElvenTableEastDeed ), 1044291, 1073384, 85.0, 110.0, typeof( Log ), 1044041, 60, 1044351 ); + SetNeededExpansion( index, Expansion.ML ); + + index = AddCraft( typeof( FancyElvenTableSouthDeed ), 1044291, 1073385, 80.0, 105.0, typeof( Log ), 1044041, 50, 1044351 ); + SetNeededExpansion( index, Expansion.ML ); + + index = AddCraft( typeof( FancyElvenTableEastDeed ), 1044291, 1073386, 80.0, 105.0, typeof( Log ), 1044041, 50, 1044351 ); + SetNeededExpansion( index, Expansion.ML ); + + index = AddCraft( typeof( ElvenBookStand ), 1044291, 1031741, 80.0, 105.0, typeof( Log ), 1044041, 20, 1044351 ); + SetNeededExpansion( index, Expansion.ML ); + + index = AddCraft( typeof( BigElvenChair ), 1044291, 1031755, 85.0, 110.0, typeof( Log ), 1044041, 40, 1044351 ); + SetNeededExpansion( index, Expansion.ML ); + + index = AddCraft( typeof( ElvenReadingChair ), 1044291, 1072160, 80.0, 105.0, typeof( Log ), 1044041, 30, 1044351 ); + SetNeededExpansion( index, Expansion.ML ); + } // Containers AddCraft( typeof( WoodenBox ), 1044292, 1023709, 21.0, 46.0, typeof( Log ), 1044041, 10, 1044351 ); @@ -190,22 +246,44 @@ namespace Server.Engines.Craft index = AddCraft( typeof( ElegantArmoire ), 1044292, 1030330, 90.0, 115.0, typeof( Log ), 1044041, 40, 1044351 ); SetNeededExpansion( index, Expansion.SE ); - index = AddCraft( typeof( MapleArmoire ), 1044292, 1030328, 90.0, 115.0, typeof( Log ), 1044041, 40, 1044351 ); + index = AddCraft( typeof( MapleArmoire ), 1044292, 1030332, 90.0, 115.0, typeof( Log ), 1044041, 40, 1044351 ); SetNeededExpansion( index, Expansion.SE ); - index = AddCraft( typeof( CherryArmoire ), 1044292, 1030328, 90.0, 115.0, typeof( Log ), 1044041, 40, 1044351 ); + index = AddCraft( typeof( CherryArmoire ), 1044292, 1030334, 90.0, 115.0, typeof( Log ), 1044041, 40, 1044351 ); SetNeededExpansion( index, Expansion.SE ); } index = AddCraft( typeof( Keg ), 1044292, 1023711, 57.8, 82.8, typeof( BarrelStaves ), 1044288, 3, 1044253 ); AddRes( index, typeof( BarrelHoops ), 1044289, 1, 1044253 ); AddRes( index, typeof( BarrelLid ), 1044251, 1, 1044253 ); + ForceNonExceptional( index ); + + if ( Core.ML ) + { + index = AddCraft( typeof( ElvenWashBasinSouthDeed ), 1044292, 1072865, 70.0, 95.0, typeof( Log ), 1044041, 40, 1044351 ); + SetNeededExpansion( index, Expansion.ML ); + + index = AddCraft( typeof( ElvenWashBasinEastDeed ), 1044292, 1073387, 70.0, 95.0, typeof( Log ), 1044041, 40, 1044351 ); + SetNeededExpansion( index, Expansion.ML ); + + index = AddCraft( typeof( OrnateElvenChest ), 1044292, 1031761, 80.0, 105.0, typeof( Log ), 1044041, 30, 1044351 ); + SetNeededExpansion( index, Expansion.ML ); + + index = AddCraft( typeof( OrnateElvenBox ), 1044292, 1031763, 80.0, 105.0, typeof( Log ), 1044041, 25, 1044351 ); + SetNeededExpansion( index, Expansion.ML ); + } // Staves and Shields - AddCraft( typeof( ShepherdsCrook ), 1044295, 1023713, 78.9, 103.9, typeof( Log ), 1044041, 7, 1044351 ); - AddCraft( typeof( QuarterStaff ), 1044295, 1023721, 73.6, 98.6, typeof( Log ), 1044041, 6, 1044351 ); - AddCraft( typeof( GnarledStaff ), 1044295, 1025112, 78.9, 103.9, typeof( Log ), 1044041, 7, 1044351 ); - AddCraft( typeof( WoodenShield ), 1044295, 1027034, 52.6, 77.6, typeof( Log ), 1044041, 9, 1044351 ); + int group; + if ( Core.ML ) + group = 1044566; // Armor and Weapons are seperated post ML + else + group = 1044295; + + AddCraft( typeof( ShepherdsCrook ), group, 1023713, 78.9, 103.9, typeof( Log ), 1044041, 7, 1044351 ); + AddCraft( typeof( QuarterStaff ), group, 1023721, 73.6, 98.6, typeof( Log ), 1044041, 6, 1044351 ); + AddCraft( typeof( GnarledStaff ), group, 1025112, 78.9, 103.9, typeof( Log ), 1044041, 7, 1044351 ); + AddCraft( typeof( WoodenShield ), ( Core.ML ? 1062760 : 1044295 ), 1027034, 52.6, 77.6, typeof( Log ), 1044041, 9, 1044351 ); if( !Core.AOS ) //Duplicate Entries to preserve ordering depending on era { @@ -216,17 +294,23 @@ namespace Server.Engines.Craft if( Core.SE ) { - index = AddCraft( typeof( Bokuto ), 1044295, 1030227, 70.0, 95.0, typeof( Log ), 1044041, 6, 1044351 ); + index = AddCraft( typeof( Bokuto ), group, 1030227, 70.0, 95.0, typeof( Log ), 1044041, 6, 1044351 ); SetNeededExpansion( index, Expansion.SE ); - index = AddCraft( typeof( Fukiya ), 1044295, 1030229, 60.0, 85.0, typeof( Log ), 1044041, 6, 1044351 ); + index = AddCraft( typeof( Fukiya ), group, 1030229, 60.0, 85.0, typeof( Log ), 1044041, 6, 1044351 ); SetNeededExpansion( index, Expansion.SE ); - index = AddCraft( typeof( Tetsubo ), 1044295, 1030225, 85.0, 110.0, typeof( Log ), 1044041, 8, 1044351 ); + index = AddCraft( typeof( Tetsubo ), group, 1030225, 85.0, 110.0, typeof( Log ), 1044041, 8, 1044351 ); AddSkill( index, SkillName.Tinkering, 40.0, 45.0 ); AddRes( index, typeof( IronIngot ), 1044036, 5, 1044037 ); SetNeededExpansion( index, Expansion.SE ); } + + if ( Core.ML ) + { + index = AddCraft( typeof( WildStaff ), 1044566, 1031557, 63.8, 144.6, typeof( Log ), 1044041, 16, 1044351 ); + SetNeededExpansion( index, Expansion.ML ); + } // Instruments index = AddCraft( typeof( LapHarp ), 1044293, 1023762, 63.1, 88.1, typeof( Log ), 1044041, 20, 1044351 ); @@ -261,16 +345,61 @@ namespace Server.Engines.Craft } // Misc - index = AddCraft( typeof( SmallBedSouthDeed ), 1044290, 1044321, 94.7, 113.1, typeof( Log ), 1044041, 100, 1044351 ); + if ( Core.ML ) + { + index = AddCraft( typeof( PlayerBBEast ), 1044290, 1062420, 85.0, 110.0, typeof( Log ), 1044041, 50, 1044351 ); + + index = AddCraft( typeof( PlayerBBSouth ), 1044290, 1062421, 85.0, 110.0, typeof( Log ), 1044041, 50, 1044351 ); + + index = AddCraft( typeof( ParrotPerchDeed ), 1044290, 1032214, 50.0, 85.0, typeof( Log ), 1044041, 100, 1044351 ); + SetNeededExpansion( index, Expansion.ML ); + + index = AddCraft( typeof( ArcaneCircleDeed ), 1044290, 1032411, 94.7, 119.6, typeof( Log ), 1044041, 100, 1044351 ); + AddRes( index, typeof( BlueDiamond ), 1032696, 2, 1044253 ); + AddRes( index, typeof( PerfectEmerald ), 1032692, 2, 1044253 ); + AddRes( index, typeof( FireRuby ), 1032695, 2, 1044253 ); + SetNeededExpansion( index, Expansion.ML ); + + index = AddCraft( typeof( TallElvenBedSouthDeed ), 1044290, 1072858, 94.7, 119.6, typeof( Log ), 1044041, 200, 1044351 ); + AddRes( index, typeof( Cloth ), 1044286, 100, 1044287 ); + AddRecipe( index, 116 ); + SetNeededExpansion( index, Expansion.ML ); + + index = AddCraft( typeof( TallElvenBedEastDeed ), 1044290, 1072859, 94.7, 119.6, typeof( Log ), 1044041, 200, 1044351 ); + AddRes( index, typeof( Cloth ), 1044286, 100, 1044287 ); + AddRecipe( index, 117 ); + SetNeededExpansion( index, Expansion.ML ); + + index = AddCraft( typeof( ElvenBedSouthDeed ), 1044290, 1072860, 94.7, 119.6, typeof( Log ), 1044041, 100, 1044351 ); + AddRes( index, typeof( Cloth ), 1044286, 100, 1044287 ); + SetNeededExpansion( index, Expansion.ML ); + + index = AddCraft( typeof( ElvenBedEastDeed ), 1044290, 1072861, 94.7, 119.6, typeof( Log ), 1044041, 100, 1044351 ); + AddRes( index, typeof( Cloth ), 1044286, 100, 1044287 ); + SetNeededExpansion( index, Expansion.ML ); + + index = AddCraft( typeof( ElvenLoveseatSouthDeed ), 1044290, 1072867, 80.0, 105.0, typeof( Log ), 1044041, 50, 1044351 ); + SetNeededExpansion( index, Expansion.ML ); + + index = AddCraft( typeof( ElvenLoveseatEastDeed ), 1044290, 1073372, 80.0, 105.0, typeof( Log ), 1044041, 50, 1044351 ); + SetNeededExpansion( index, Expansion.ML ); + + index = AddCraft( typeof( AlchemistTableSouthDeed ), 1044290, 1073396, 85.0, 110.0, typeof( Log ), 1044041, 70, 1044351 ); + SetNeededExpansion( index, Expansion.ML ); + + index = AddCraft( typeof( AlchemistTableEastDeed ), 1044290, 1073397, 85.0, 110.0, typeof( Log ), 1044041, 70, 1044351 ); + SetNeededExpansion( index, Expansion.ML ); + } + index = AddCraft( typeof( SmallBedSouthDeed ), 1044290, 1044321, 94.7, 119.6, typeof( Log ), 1044041, 100, 1044351 ); AddSkill( index, SkillName.Tailoring, 75.0, 80.0 ); AddRes( index, typeof( Cloth ), 1044286, 100, 1044287 ); - index = AddCraft( typeof( SmallBedEastDeed ), 1044290, 1044322, 94.7, 113.1, typeof( Log ), 1044041, 100, 1044351 ); + index = AddCraft( typeof( SmallBedEastDeed ), 1044290, 1044322, 94.7, 119.6, typeof( Log ), 1044041, 100, 1044351 ); AddSkill( index, SkillName.Tailoring, 75.0, 80.0 ); AddRes( index, typeof( Cloth ), 1044286, 100, 1044287 ); - index = AddCraft( typeof( LargeBedSouthDeed ), 1044290,1044323, 94.7, 113.1, typeof( Log ), 1044041, 150, 1044351 ); + index = AddCraft( typeof( LargeBedSouthDeed ), 1044290,1044323, 94.7, 119.6, typeof( Log ), 1044041, 150, 1044351 ); AddSkill( index, SkillName.Tailoring, 75.0, 80.0 ); AddRes( index, typeof( Cloth ), 1044286, 150, 1044287 ); - index = AddCraft( typeof( LargeBedEastDeed ), 1044290, 1044324, 94.7, 113.1, typeof( Log ), 1044041, 150, 1044351 ); + index = AddCraft( typeof( LargeBedEastDeed ), 1044290, 1044324, 94.7, 119.6, typeof( Log ), 1044041, 150, 1044351 ); AddSkill( index, SkillName.Tailoring, 75.0, 80.0 ); AddRes( index, typeof( Cloth ), 1044286, 150, 1044287 ); AddCraft( typeof( DartBoardSouthDeed ), 1044290, 1044325, 15.7, 40.7, typeof( Log ), 1044041, 5, 1044351 ); @@ -283,47 +412,72 @@ namespace Server.Engines.Craft AddSkill( index, SkillName.Magery, 50.0, 55.0 ); AddRes( index, typeof( IronIngot ), 1044036, 40, 1044037 ); - if ( Core.AOS ) + if ( Core.Expansion == Expansion.AOS || Core.Expansion == Expansion.SE ) //Duplicate Entries to preserve ordering depending on era { AddCraft( typeof( PlayerBBEast ), 1044290, 1062420, 85.0, 110.0, typeof( Log ), 1044041, 50, 1044351 ); AddCraft( typeof( PlayerBBSouth ), 1044290, 1062421, 85.0, 110.0, typeof( Log ), 1044041, 50, 1044351 ); } - // Blacksmithy - index = AddCraft( typeof( SmallForgeDeed ), 1044296, 1044330, 73.6, 98.6, typeof( Log ), 1044041, 5, 1044351 ); - AddSkill( index, SkillName.Blacksmith, 75.0, 80.0 ); - AddRes( index, typeof( IronIngot ), 1044036, 75, 1044037 ); - index = AddCraft( typeof( LargeForgeEastDeed ), 1044296, 1044331, 78.9, 103.9, typeof( Log ), 1044041, 5, 1044351 ); - AddSkill( index, SkillName.Blacksmith, 80.0, 85.0 ); - AddRes( index, typeof( IronIngot ), 1044036, 100, 1044037 ); - index = AddCraft( typeof( LargeForgeSouthDeed ), 1044296, 1044332, 78.9, 103.9, typeof( Log ), 1044041, 5, 1044351 ); - AddSkill( index, SkillName.Blacksmith, 80.0, 85.0 ); - AddRes( index, typeof( IronIngot ), 1044036, 100, 1044037 ); - index = AddCraft( typeof( AnvilEastDeed ), 1044296, 1044333, 73.6, 98.6, typeof( Log ), 1044041, 5, 1044351 ); - AddSkill( index, SkillName.Blacksmith, 75.0, 80.0 ); - AddRes( index, typeof( IronIngot ), 1044036, 150, 1044037 ); - index = AddCraft( typeof( AnvilSouthDeed ), 1044296, 1044334, 73.6, 98.6, typeof( Log ), 1044041, 5, 1044351 ); - AddSkill( index, SkillName.Blacksmith, 75.0, 80.0 ); - AddRes( index, typeof( IronIngot ), 1044036, 150, 1044037 ); + if ( !Core.ML ) //Duplicate Entries to preserve ordering depending on era + { + // Blacksmithy + index = AddCraft( typeof( SmallForgeDeed ), 1044296, 1044330, 73.6, 98.6, typeof( Log ), 1044041, 5, 1044351 ); + AddSkill( index, SkillName.Blacksmith, 75.0, 80.0 ); + AddRes( index, typeof( IronIngot ), 1044036, 75, 1044037 ); + index = AddCraft( typeof( LargeForgeEastDeed ), 1044296, 1044331, 78.9, 103.9, typeof( Log ), 1044041, 5, 1044351 ); + AddSkill( index, SkillName.Blacksmith, 80.0, 85.0 ); + AddRes( index, typeof( IronIngot ), 1044036, 100, 1044037 ); + index = AddCraft( typeof( LargeForgeSouthDeed ), 1044296, 1044332, 78.9, 103.9, typeof( Log ), 1044041, 5, 1044351 ); + AddSkill( index, SkillName.Blacksmith, 80.0, 85.0 ); + AddRes( index, typeof( IronIngot ), 1044036, 100, 1044037 ); + index = AddCraft( typeof( AnvilEastDeed ), 1044296, 1044333, 73.6, 98.6, typeof( Log ), 1044041, 5, 1044351 ); + AddSkill( index, SkillName.Blacksmith, 75.0, 80.0 ); + AddRes( index, typeof( IronIngot ), 1044036, 150, 1044037 ); + index = AddCraft( typeof( AnvilSouthDeed ), 1044296, 1044334, 73.6, 98.6, typeof( Log ), 1044041, 5, 1044351 ); + AddSkill( index, SkillName.Blacksmith, 75.0, 80.0 ); + AddRes( index, typeof( IronIngot ), 1044036, 150, 1044037 ); - // Training - index = AddCraft( typeof( TrainingDummyEastDeed ), 1044297, 1044335, 68.4, 93.4, typeof( Log ), 1044041, 55, 1044351 ); - AddSkill( index, SkillName.Tailoring, 50.0, 55.0 ); - AddRes( index, typeof( Cloth ), 1044286, 60, 1044287 ); - index = AddCraft( typeof( TrainingDummySouthDeed ), 1044297, 1044336, 68.4, 93.4, typeof( Log ), 1044041, 55, 1044351 ); - AddSkill( index, SkillName.Tailoring, 50.0, 55.0 ); - AddRes( index, typeof( Cloth ), 1044286, 60, 1044287 ); - index = AddCraft( typeof( PickpocketDipEastDeed ), 1044297, 1044337, 73.6, 98.6, typeof( Log ), 1044041, 65, 1044351 ); - AddSkill( index, SkillName.Tailoring, 50.0, 55.0 ); - AddRes( index, typeof( Cloth ), 1044286, 60, 1044287 ); - index = AddCraft( typeof( PickpocketDipSouthDeed ), 1044297, 1044338, 73.6, 98.6, typeof( Log ), 1044041, 65, 1044351 ); - AddSkill( index, SkillName.Tailoring, 50.0, 55.0 ); - AddRes( index, typeof( Cloth ), 1044286, 60, 1044287 ); + // Training + index = AddCraft( typeof( TrainingDummyEastDeed ), 1044297, 1044335, 68.4, 93.4, typeof( Log ), 1044041, 55, 1044351 ); + AddSkill( index, SkillName.Tailoring, 50.0, 55.0 ); + AddRes( index, typeof( Cloth ), 1044286, 60, 1044287 ); + index = AddCraft( typeof( TrainingDummySouthDeed ), 1044297, 1044336, 68.4, 93.4, typeof( Log ), 1044041, 55, 1044351 ); + AddSkill( index, SkillName.Tailoring, 50.0, 55.0 ); + AddRes( index, typeof( Cloth ), 1044286, 60, 1044287 ); + index = AddCraft( typeof( PickpocketDipEastDeed ), 1044297, 1044337, 73.6, 98.6, typeof( Log ), 1044041, 65, 1044351 ); + AddSkill( index, SkillName.Tailoring, 50.0, 55.0 ); + AddRes( index, typeof( Cloth ), 1044286, 60, 1044287 ); + index = AddCraft( typeof( PickpocketDipSouthDeed ), 1044297, 1044338, 73.6, 98.6, typeof( Log ), 1044041, 65, 1044351 ); + AddSkill( index, SkillName.Tailoring, 50.0, 55.0 ); + AddRes( index, typeof( Cloth ), 1044286, 60, 1044287 ); + } - // Tailoring - index = AddCraft( typeof( Dressform ), 1044298, 1044339, 63.1, 88.1, typeof( Log ), 1044041, 25, 1044351 ); + // Tailoring and Cooking + index = AddCraft( typeof( Dressform ), 1044298, 1044339, 63.1, 88.1, typeof( Log ), 1044041, 25, 1044351 ); //Front AddSkill( index, SkillName.Tailoring, 65.0, 70.0 ); AddRes( index, typeof( Cloth ), 1044286, 10, 1044287 ); + index = AddCraft( typeof( Dressform ), 1044298, 1044340, 63.1, 88.1, typeof( Log ), 1044041, 25, 1044351, new object[] { 0xEC7 } ); //Side + AddSkill( index, SkillName.Tailoring, 65.0, 70.0 ); + AddRes( index, typeof( Cloth ), 1044286, 10, 1044287 ); + ForceGumpItemID( index, 0xEC7 ); + if ( Core.ML ) + { + index = AddCraft( typeof( ElvenSpinningwheelEastDeed ), 1044298, 1073393, 75.0, 100, typeof( Log ), 1044041, 60, 1044351 ); + AddSkill( index, SkillName.Tailoring, 65.0, 70.0 ); + AddRes( index, typeof( Cloth ), 1044286, 40, 1044287 ); + SetNeededExpansion( index, Expansion.ML ); + + index = AddCraft( typeof( ElvenSpinningwheelSouthDeed ), 1044298, 1072878, 75.0, 100, typeof( Log ), 1044041, 60, 1044351 ); + AddSkill( index, SkillName.Tailoring, 65.0, 70.0 ); + AddRes( index, typeof( Cloth ), 1044286, 40, 1044287 ); + SetNeededExpansion( index, Expansion.ML ); + + index = AddCraft( typeof( ElvenStoveSouthDeed ), 1044298, 1073394, 85.0, 110.0, typeof( Log ), 1044041, 80, 1044351 ); + SetNeededExpansion( index, Expansion.ML ); + + index = AddCraft( typeof( ElvenStoveEastDeed ), 1044298, 1073395, 85.0, 110.0, typeof( Log ), 1044041, 80, 1044351 ); + SetNeededExpansion( index, Expansion.ML ); + } index = AddCraft( typeof( SpinningwheelEastDeed ), 1044298, 1044341, 73.6, 98.6, typeof( Log ), 1044041, 75, 1044351 ); AddSkill( index, SkillName.Tailoring, 65.0, 70.0 ); AddRes( index, typeof( Cloth ), 1044286, 25, 1044287 ); @@ -337,36 +491,82 @@ namespace Server.Engines.Craft AddSkill( index, SkillName.Tailoring, 65.0, 70.0 ); AddRes( index, typeof( Cloth ), 1044286, 25, 1044287 ); - // Cooking - index = AddCraft( typeof( StoneOvenEastDeed ), 1044299, 1044345, 68.4, 93.4, typeof( Log ), 1044041, 85, 1044351 ); + + //Cooking + if ( Core.ML ) + group = 1044298; // These are merged into the Tailoring and Cooking definition after ML + else + group = 1044299; + + index = AddCraft( typeof( StoneOvenEastDeed ), group, 1044345, 68.4, 93.4, typeof( Log ), 1044041, 85, 1044351 ); AddSkill( index, SkillName.Tinkering, 50.0, 55.0 ); AddRes( index, typeof( IronIngot ), 1044036, 125, 1044037 ); - index = AddCraft( typeof( StoneOvenSouthDeed ), 1044299, 1044346, 68.4, 93.4, typeof( Log ), 1044041, 85, 1044351 ); + index = AddCraft( typeof( StoneOvenSouthDeed ), group, 1044346, 68.4, 93.4, typeof( Log ), 1044041, 85, 1044351 ); AddSkill( index, SkillName.Tinkering, 50.0, 55.0 ); AddRes( index, typeof( IronIngot ), 1044036, 125, 1044037 ); - index = AddCraft( typeof( FlourMillEastDeed ), 1044299, 1044347, 94.7, 119.7, typeof( Log ), 1044041, 100, 1044351 ); + index = AddCraft( typeof( FlourMillEastDeed ), group, 1044347, 94.7, 119.7, typeof( Log ), 1044041, 100, 1044351 ); AddSkill( index, SkillName.Tinkering, 50.0, 55.0 ); AddRes( index, typeof( IronIngot ), 1044036, 50, 1044037 ); - index = AddCraft( typeof( FlourMillSouthDeed ), 1044299, 1044348, 94.7, 119.7, typeof( Log ), 1044041, 100, 1044351 ); + index = AddCraft( typeof( FlourMillSouthDeed ), group, 1044348, 94.7, 119.7, typeof( Log ), 1044041, 100, 1044351 ); AddSkill( index, SkillName.Tinkering, 50.0, 55.0 ); AddRes( index, typeof( IronIngot ), 1044036, 50, 1044037 ); - AddCraft( typeof( WaterTroughEastDeed ), 1044299, 1044349, 94.7, 119.7, typeof( Log ), 1044041, 150, 1044351 ); - AddCraft( typeof( WaterTroughSouthDeed ), 1044299, 1044350, 94.7, 119.7, typeof( Log ), 1044041, 150, 1044351 ); + AddCraft( typeof( WaterTroughEastDeed ), group, 1044349, 94.7, 119.7, typeof( Log ), 1044041, 150, 1044351 ); + AddCraft( typeof( WaterTroughSouthDeed ), group, 1044350, 94.7, 119.7, typeof( Log ), 1044041, 150, 1044351 ); + + if ( Core.ML ) //Duplicate Entries to preserve ordering depending on era + { + // Blacksmithy + index = AddCraft( typeof( ElvenForgeDeed ), 1044296, 1031736, 94.7, 119.7, typeof( Log ), 1044041, 200, 1044351 ); + SetNeededExpansion( index, Expansion.ML ); + index = AddCraft( typeof( SmallForgeDeed ), 1044296, 1044330, 73.6, 98.6, typeof( Log ), 1044041, 5, 1044351 ); + AddSkill( index, SkillName.Blacksmith, 75.0, 80.0 ); + AddRes( index, typeof( IronIngot ), 1044036, 75, 1044037 ); + index = AddCraft( typeof( LargeForgeEastDeed ), 1044296, 1044331, 78.9, 103.9, typeof( Log ), 1044041, 5, 1044351 ); + AddSkill( index, SkillName.Blacksmith, 80.0, 85.0 ); + AddRes( index, typeof( IronIngot ), 1044036, 100, 1044037 ); + index = AddCraft( typeof( LargeForgeSouthDeed ), 1044296, 1044332, 78.9, 103.9, typeof( Log ), 1044041, 5, 1044351 ); + AddSkill( index, SkillName.Blacksmith, 80.0, 85.0 ); + AddRes( index, typeof( IronIngot ), 1044036, 100, 1044037 ); + index = AddCraft( typeof( AnvilEastDeed ), 1044296, 1044333, 73.6, 98.6, typeof( Log ), 1044041, 5, 1044351 ); + AddSkill( index, SkillName.Blacksmith, 75.0, 80.0 ); + AddRes( index, typeof( IronIngot ), 1044036, 150, 1044037 ); + index = AddCraft( typeof( AnvilSouthDeed ), 1044296, 1044334, 73.6, 98.6, typeof( Log ), 1044041, 5, 1044351 ); + AddSkill( index, SkillName.Blacksmith, 75.0, 80.0 ); + AddRes( index, typeof( IronIngot ), 1044036, 150, 1044037 ); + + // Training + index = AddCraft( typeof( TrainingDummyEastDeed ), 1044297, 1044335, 68.4, 93.4, typeof( Log ), 1044041, 55, 1044351 ); + AddSkill( index, SkillName.Tailoring, 50.0, 55.0 ); + AddRes( index, typeof( Cloth ), 1044286, 60, 1044287 ); + index = AddCraft( typeof( TrainingDummySouthDeed ), 1044297, 1044336, 68.4, 93.4, typeof( Log ), 1044041, 55, 1044351 ); + AddSkill( index, SkillName.Tailoring, 50.0, 55.0 ); + AddRes( index, typeof( Cloth ), 1044286, 60, 1044287 ); + index = AddCraft( typeof( PickpocketDipEastDeed ), 1044297, 1044337, 73.6, 98.6, typeof( Log ), 1044041, 65, 1044351 ); + AddSkill( index, SkillName.Tailoring, 50.0, 55.0 ); + AddRes( index, typeof( Cloth ), 1044286, 60, 1044287 ); + index = AddCraft( typeof( PickpocketDipSouthDeed ), 1044297, 1044338, 73.6, 98.6, typeof( Log ), 1044041, 65, 1044351 ); + AddSkill( index, SkillName.Tailoring, 50.0, 55.0 ); + AddRes( index, typeof( Cloth ), 1044286, 60, 1044287 ); + } MarkOption = true; Repair = Core.AOS; - - SetSubRes( typeof( Log ), 1072643 ); - - // Add every material you want the player to be able to choose from - // This will override the overridable material TODO: Verify the required skill amount - AddSubRes( typeof( Log ), 1072643, 00.0, 1044041, 1072652 ); - AddSubRes( typeof( OakLog ), 1072644, 65.0, 1044041, 1072652 ); - AddSubRes( typeof( AshLog ), 1072645, 80.0, 1044041, 1072652 ); - AddSubRes( typeof( YewLog ), 1072646, 95.0, 1044041, 1072652 ); - AddSubRes( typeof( HeartwoodLog ), 1072647, 100.0, 1044041, 1072652 ); - AddSubRes( typeof( BloodwoodLog ), 1072648, 100.0, 1044041, 1072652 ); - AddSubRes( typeof( FrostwoodLog ), 1072649, 100.0, 1044041, 1072652 ); + CanEnhance = Core.ML; + + if ( Core.ML ) + { + SetSubRes( typeof( Log ), 1072643 ); + + // Add every material you want the player to be able to choose from + // This will override the overridable material TODO: Verify the required skill amount + AddSubRes( typeof( Log ), 1072643, 00.0, 1044041, 1072652 ); + AddSubRes( typeof( OakLog ), 1072644, 65.0, 1044041, 1072652 ); + AddSubRes( typeof( AshLog ), 1072645, 80.0, 1044041, 1072652 ); + AddSubRes( typeof( YewLog ), 1072646, 95.0, 1044041, 1072652 ); + AddSubRes( typeof( HeartwoodLog ), 1072647, 100.0, 1044041, 1072652 ); + AddSubRes( typeof( BloodwoodLog ), 1072648, 100.0, 1044041, 1072652 ); + AddSubRes( typeof( FrostwoodLog ), 1072649, 100.0, 1044041, 1072652 ); + } } } } \ No newline at end of file diff --git a/Scripts/Engines/Craft/DefTailoring.cs b/Scripts/Engines/Craft/DefTailoring.cs index 6d25ab6dd..e10d53c12 100644 --- a/Scripts/Engines/Craft/DefTailoring.cs +++ b/Scripts/Engines/Craft/DefTailoring.cs @@ -48,28 +48,21 @@ namespace Server.Engines.Craft return 0; } - - private static Type[] m_TailorColorables = new Type[] - { - typeof( GozaMatEastDeed ), typeof( GozaMatSouthDeed ), - typeof( SquareGozaMatEastDeed ), typeof( SquareGozaMatSouthDeed ), - typeof( BrocadeGozaMatEastDeed ), typeof( BrocadeGozaMatSouthDeed ), - typeof( BrocadeSquareGozaMatEastDeed ), typeof( BrocadeSquareGozaMatSouthDeed ) - }; - + public override bool RetainsColorFrom( CraftItem item, Type type ) { - if ( type != typeof( Cloth ) && type != typeof( UncutCloth ) ) + if ( item.ItemType == typeof( OilCloth ) ) return false; - - type = item.ItemType; - - bool contains = false; - - for ( int i = 0; !contains && i < m_TailorColorables.Length; ++i ) - contains = ( m_TailorColorables[i] == type ); - - return contains; + + return true; + } + + public override bool UsesHueSelector( CraftItem item, Type type ) + { + if ( item.ItemType == typeof( UncutCloth ) ) + return false; + + return true; } public override void PlayCraftEffect( Mobile from ) @@ -105,6 +98,14 @@ namespace Server.Engines.Craft public override void InitCraftList() { int index = -1; + + #region Materials + index = AddCraft( typeof( UncutCloth ), 1044457, 1044458, 0.0, 0.0, typeof( BoltOfCloth ), 1044453, 1, 1044253 ); + MultiplyBy( index, 50 ); + SetUseAllRes( index, true, 1044460 ); // Cut bolts of cloth into pieces of ready cloth. + index = AddCraft( typeof( UncutCloth ), 1044457, 1044459, 0.0, 0.0, typeof( Cloth ), 1044455, 1, 1044253 ); + SetUseAllRes( index, true, 1044461 ); // Combine available cloth into piles by color. + #endregion #region Hats AddCraft( typeof( SkullCap ), 1011375, 1025444, 0.0, 25.0, typeof( Cloth ), 1044286, 2, 1044287 ); diff --git a/Scripts/Engines/Craft/DefTinkering.cs b/Scripts/Engines/Craft/DefTinkering.cs index f6a2259db..3db96aac9 100644 --- a/Scripts/Engines/Craft/DefTinkering.cs +++ b/Scripts/Engines/Craft/DefTinkering.cs @@ -34,6 +34,17 @@ namespace Server.Engines.Craft private DefTinkering() : base( 1, 1, 1.25 )// base( 1, 1, 3.0 ) { } + + public override CraftECA ECA + { + get + { + if ( Core.AOS ) + return CraftECA.ChanceMinusSixtyToFourtyFive; + + return CraftECA.ChanceMinusSixty; + } + } public override double GetChanceAtMin( CraftItem item ) { @@ -225,7 +236,7 @@ namespace Server.Engines.Craft AddCraft( typeof( Key ), 1044050, 1024112, 20.0, 70.0, typeof( IronIngot ), 1044036, 3, 1044037 ); AddCraft( typeof( Globe ), 1044050, 1024167, 55.0, 105.0, typeof( IronIngot ), 1044036, 4, 1044037 ); AddCraft( typeof( Spyglass ), 1044050, 1025365, 60.0, 110.0, typeof( IronIngot ), 1044036, 4, 1044037 ); - AddCraft( typeof( Lantern ), 1044050, 1022597, 30.0, 80.0, typeof( IronIngot ), 1044036, 2, 1044037 ); + AddCraft( typeof( Lantern ), 1044050, 1022597, 30.0, 80.0, typeof( IronIngot ), 1044036, 4, 1044037 ); AddCraft( typeof( HeatingStand ), 1044050, 1026217, 60.0, 110.0, typeof( IronIngot ), 1044036, 4, 1044037 ); if ( Core.SE ) diff --git a/Scripts/Engines/Plants/PlantItem.cs b/Scripts/Engines/Plants/PlantItem.cs index c490b9629..11b6dbb36 100644 --- a/Scripts/Engines/Plants/PlantItem.cs +++ b/Scripts/Engines/Plants/PlantItem.cs @@ -192,7 +192,7 @@ namespace Server.Engines.Plants m_PlantStatus = PlantStatus.BowlOfDirt; m_PlantSystem = new PlantSystem( this, fertileDirt ); - m_Level = SecureLevel.CoOwners; + m_Level = SecureLevel.Owner; m_Instances.Add( this ); } diff --git a/Scripts/Items/Addons/AbbatoirAddon.cs b/Scripts/Items/Addons/AbbatoirAddon.cs index 392f1d078..cb0d37eef 100644 --- a/Scripts/Items/Addons/AbbatoirAddon.cs +++ b/Scripts/Items/Addons/AbbatoirAddon.cs @@ -8,7 +8,12 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new AbbatoirDeed(); } } [Constructable] - public AbbatoirAddon() + public AbbatoirAddon() : this( 0 ) + { + } + + [Constructable] + public AbbatoirAddon( int hue ) { AddComponent( new AddonComponent( 0x120E ), -1, -1, 0 ); AddComponent( new AddonComponent( 0x120F ), 0, -1, 0 ); @@ -19,6 +24,7 @@ namespace Server.Items AddComponent( new AddonComponent( 0x1214 ), -1, 1, 0 ); AddComponent( new AddonComponent( 0x1213 ), 0, 1, 0 ); AddComponent( new AddonComponent( 0x1212 ), 1, 1, 0 ); + Hue = hue; } public AbbatoirAddon( Serial serial ) : base( serial ) @@ -42,7 +48,7 @@ namespace Server.Items public class AbbatoirDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new AbbatoirAddon(); } } + public override BaseAddon Addon{ get{ return new AbbatoirAddon( Hue ); } } public override int LabelNumber{ get{ return 1044329; } } // abbatoir [Constructable] diff --git a/Scripts/Items/Addons/AlchemistTableEastAddon.cs b/Scripts/Items/Addons/AlchemistTableEastAddon.cs index 19577e023..4ec9379d6 100644 --- a/Scripts/Items/Addons/AlchemistTableEastAddon.cs +++ b/Scripts/Items/Addons/AlchemistTableEastAddon.cs @@ -1,5 +1,6 @@ using System; using Server; +using Server.Engines.Craft; namespace Server.Items { @@ -8,9 +9,15 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new AlchemistTableEastDeed(); } } [Constructable] - public AlchemistTableEastAddon() + public AlchemistTableEastAddon() : this( 0 ) + { + } + + [Constructable] + public AlchemistTableEastAddon( int hue ) { AddComponent( new AddonComponent( 0x2DD3 ), 0, 0, 0 ); + Hue = hue; } public AlchemistTableEastAddon( Serial serial ) : base( serial ) @@ -32,9 +39,10 @@ namespace Server.Items } } + [CraftItemID( 0x2DD3 )] public class AlchemistTableEastDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new AlchemistTableEastAddon(); } } + public override BaseAddon Addon{ get{ return new AlchemistTableEastAddon( Hue ); } } public override int LabelNumber{ get{ return 1073397; } } // alchemist table (east) [Constructable] diff --git a/Scripts/Items/Addons/AlchemistTableSouthAddon.cs b/Scripts/Items/Addons/AlchemistTableSouthAddon.cs index 1302da0d9..38568ba7c 100644 --- a/Scripts/Items/Addons/AlchemistTableSouthAddon.cs +++ b/Scripts/Items/Addons/AlchemistTableSouthAddon.cs @@ -1,5 +1,6 @@ using System; using Server; +using Server.Engines.Craft; namespace Server.Items { @@ -8,9 +9,15 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new AlchemistTableSouthDeed(); } } [Constructable] - public AlchemistTableSouthAddon() + public AlchemistTableSouthAddon() : this( 0 ) + { + } + + [Constructable] + public AlchemistTableSouthAddon( int hue ) { AddComponent( new AddonComponent( 0x2DD4 ), 0, 0, 0 ); + Hue = hue; } public AlchemistTableSouthAddon( Serial serial ) : base( serial ) @@ -32,9 +39,10 @@ namespace Server.Items } } + [CraftItemID( 0x2DD4 )] public class AlchemistTableSouthDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new AlchemistTableSouthAddon(); } } + public override BaseAddon Addon{ get{ return new AlchemistTableSouthAddon( Hue ); } } public override int LabelNumber{ get{ return 1073396; } } // alchemist table (south) [Constructable] diff --git a/Scripts/Items/Addons/AnvilEastAddon.cs b/Scripts/Items/Addons/AnvilEastAddon.cs index 2df2183ff..601e603c4 100644 --- a/Scripts/Items/Addons/AnvilEastAddon.cs +++ b/Scripts/Items/Addons/AnvilEastAddon.cs @@ -8,9 +8,15 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new AnvilEastDeed(); } } [Constructable] - public AnvilEastAddon() + public AnvilEastAddon() : this( 0 ) + { + } + + [Constructable] + public AnvilEastAddon( int hue ) { AddComponent( new AnvilComponent( 0xFAF ), 0, 0, 0 ); + Hue = hue; } public AnvilEastAddon( Serial serial ) : base( serial ) @@ -34,7 +40,7 @@ namespace Server.Items public class AnvilEastDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new AnvilEastAddon(); } } + public override BaseAddon Addon{ get{ return new AnvilEastAddon( Hue ); } } public override int LabelNumber{ get{ return 1044333; } } // anvil (east) [Constructable] diff --git a/Scripts/Items/Addons/AnvilSouthAddon.cs b/Scripts/Items/Addons/AnvilSouthAddon.cs index e635c91ac..c5308b647 100644 --- a/Scripts/Items/Addons/AnvilSouthAddon.cs +++ b/Scripts/Items/Addons/AnvilSouthAddon.cs @@ -8,9 +8,15 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new AnvilSouthDeed(); } } [Constructable] - public AnvilSouthAddon() + public AnvilSouthAddon() : this( 0 ) + { + } + + [Constructable] + public AnvilSouthAddon( int hue ) { AddComponent( new AnvilComponent( 0xFB0 ), 0, 0, 0 ); + Hue = hue; } public AnvilSouthAddon( Serial serial ) : base( serial ) @@ -34,7 +40,7 @@ namespace Server.Items public class AnvilSouthDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new AnvilSouthAddon(); } } + public override BaseAddon Addon{ get{ return new AnvilSouthAddon( Hue ); } } public override int LabelNumber{ get{ return 1044334; } } // anvil (south) [Constructable] diff --git a/Scripts/Items/Addons/ArcaneBookshelfEastAddon.cs b/Scripts/Items/Addons/ArcaneBookshelfEastAddon.cs index 673d197d9..22056a1d0 100644 --- a/Scripts/Items/Addons/ArcaneBookshelfEastAddon.cs +++ b/Scripts/Items/Addons/ArcaneBookshelfEastAddon.cs @@ -8,10 +8,16 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new ArcaneBookshelfEastDeed(); } } [Constructable] - public ArcaneBookshelfEastAddon() + public ArcaneBookshelfEastAddon() : this( 0 ) + { + } + + [Constructable] + public ArcaneBookshelfEastAddon( int hue ) { AddComponent( new AddonComponent( 0x3084 ), 0, 0, 0 ); AddComponent( new AddonComponent( 0x3085 ), -1, 0, 0 ); + Hue = hue; } public ArcaneBookshelfEastAddon( Serial serial ) : base( serial ) diff --git a/Scripts/Items/Addons/ArcaneBookshelfSouthAddon.cs b/Scripts/Items/Addons/ArcaneBookshelfSouthAddon.cs index f7e6499fc..d520068f6 100644 --- a/Scripts/Items/Addons/ArcaneBookshelfSouthAddon.cs +++ b/Scripts/Items/Addons/ArcaneBookshelfSouthAddon.cs @@ -8,10 +8,16 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new ArcaneBookshelfSouthDeed(); } } [Constructable] - public ArcaneBookshelfSouthAddon() + public ArcaneBookshelfSouthAddon() : this( 0 ) + { + } + + [Constructable] + public ArcaneBookshelfSouthAddon( int hue ) { AddComponent( new AddonComponent( 0x3087 ), 0, 0, 0 ); AddComponent( new AddonComponent( 0x3086 ), 0, 1, 0 ); + Hue = hue; } public ArcaneBookshelfSouthAddon( Serial serial ) : base( serial ) @@ -35,7 +41,7 @@ namespace Server.Items public class ArcaneBookshelfSouthDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new ArcaneBookshelfSouthAddon(); } } + public override BaseAddon Addon{ get{ return new ArcaneBookshelfSouthAddon( Hue ); } } public override int LabelNumber{ get{ return 1072871; } } // arcane bookshelf (south) [Constructable] diff --git a/Scripts/Items/Addons/ArcaneCircleAddon.cs b/Scripts/Items/Addons/ArcaneCircleAddon.cs index 2905c5eed..41082d43b 100644 --- a/Scripts/Items/Addons/ArcaneCircleAddon.cs +++ b/Scripts/Items/Addons/ArcaneCircleAddon.cs @@ -8,7 +8,12 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new ArcaneCircleDeed(); } } [Constructable] - public ArcaneCircleAddon() + public ArcaneCircleAddon() : this( 0 ) + { + } + + [Constructable] + public ArcaneCircleAddon( int hue ) { AddComponent( new AddonComponent( 0x3080 ), -1, 0, 0 ); AddComponent( new AddonComponent( 0x3082 ), 0, -1, 0 ); @@ -19,6 +24,7 @@ namespace Server.Items AddComponent( new AddonComponent( 0x307C ), 0, 1, 0 ); AddComponent( new AddonComponent( 0x307B ), 1, 1, 0 ); AddComponent( new AddonComponent( 0x3083 ), 1, 1, 0 ); + Hue = hue; } public ArcaneCircleAddon( Serial serial ) : base( serial ) @@ -42,7 +48,7 @@ namespace Server.Items public class ArcaneCircleDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new ArcaneCircleAddon(); } } + public override BaseAddon Addon{ get{ return new ArcaneCircleAddon( Hue ); } } public override int LabelNumber{ get{ return 1072703; } } // arcane circle [Constructable] diff --git a/Scripts/Items/Addons/ArcanistStatueEastAddon.cs b/Scripts/Items/Addons/ArcanistStatueEastAddon.cs index 1f13f1851..7f665845b 100644 --- a/Scripts/Items/Addons/ArcanistStatueEastAddon.cs +++ b/Scripts/Items/Addons/ArcanistStatueEastAddon.cs @@ -1,5 +1,6 @@ using System; using Server; +using Server.Engines.Craft; namespace Server.Items { @@ -8,9 +9,15 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new ArcanistStatueEastDeed(); } } [Constructable] - public ArcanistStatueEastAddon() + public ArcanistStatueEastAddon() : this( 0 ) + { + } + + [Constructable] + public ArcanistStatueEastAddon( int hue ) { AddComponent( new AddonComponent( 0x2D0E ), 0, 0, 0 ); + Hue = hue; } public ArcanistStatueEastAddon( Serial serial ) : base( serial ) @@ -32,9 +39,10 @@ namespace Server.Items } } + [CraftItemID( 0x2D0E )] public class ArcanistStatueEastDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new ArcanistStatueEastAddon(); } } + public override BaseAddon Addon{ get{ return new ArcanistStatueEastAddon( Hue ); } } public override int LabelNumber{ get{ return 1072886; } } // arcanist statue (east) [Constructable] diff --git a/Scripts/Items/Addons/ArcanistStatueSouthAddon.cs b/Scripts/Items/Addons/ArcanistStatueSouthAddon.cs index 1f055dec4..c9c00f590 100644 --- a/Scripts/Items/Addons/ArcanistStatueSouthAddon.cs +++ b/Scripts/Items/Addons/ArcanistStatueSouthAddon.cs @@ -1,5 +1,6 @@ using System; using Server; +using Server.Engines.Craft; namespace Server.Items { @@ -8,9 +9,15 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new ArcanistStatueSouthDeed(); } } [Constructable] - public ArcanistStatueSouthAddon() + public ArcanistStatueSouthAddon() : this( 0 ) + { + } + + [Constructable] + public ArcanistStatueSouthAddon( int hue ) { AddComponent( new AddonComponent( 0x2D0F ), 0, 0, 0 ); + Hue = hue; } public ArcanistStatueSouthAddon( Serial serial ) : base( serial ) @@ -32,9 +39,10 @@ namespace Server.Items } } + [CraftItemID( 0x2D0F )] public class ArcanistStatueSouthDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new ArcanistStatueSouthAddon(); } } + public override BaseAddon Addon{ get{ return new ArcanistStatueSouthAddon( Hue ); } } public override int LabelNumber{ get{ return 1072885; } } // arcanist statue (south) [Constructable] diff --git a/Scripts/Items/Addons/BallotBox.cs b/Scripts/Items/Addons/BallotBox.cs index 3d32741a9..73c5e6f36 100644 --- a/Scripts/Items/Addons/BallotBox.cs +++ b/Scripts/Items/Addons/BallotBox.cs @@ -336,9 +336,14 @@ namespace Server.Items { public override BaseAddonDeed Deed{ get{ return new BallotBoxDeed(); } } - public BallotBoxAddon() + public BallotBoxAddon() : this( 0 ) + { + } + + public BallotBoxAddon( int hue ) { AddComponent( new BallotBox(), 0, 0, 0 ); + Hue = hue; } public BallotBoxAddon( Serial serial ) : base( serial ) @@ -362,7 +367,7 @@ namespace Server.Items public class BallotBoxDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new BallotBoxAddon(); } } + public override BaseAddon Addon{ get{ return new BallotBoxAddon( Hue ); } } public override int LabelNumber{ get{ return 1044327; } } // ballot box diff --git a/Scripts/Items/Addons/BaseAddon.cs b/Scripts/Items/Addons/BaseAddon.cs index 9449d24d1..70ddf831e 100644 --- a/Scripts/Items/Addons/BaseAddon.cs +++ b/Scripts/Items/Addons/BaseAddon.cs @@ -47,7 +47,7 @@ namespace Server.Items m_Components = new List(); } - public virtual bool RetainDeedHue{ get{ return false; } } + public virtual bool RetainDeedHue{ get{ return ( Core.ML ? true : false ); } } public virtual void OnChop( Mobile from ) { diff --git a/Scripts/Items/Addons/BaseAddonDeed.cs b/Scripts/Items/Addons/BaseAddonDeed.cs index 8fdcd2d75..e24f60080 100644 --- a/Scripts/Items/Addons/BaseAddonDeed.cs +++ b/Scripts/Items/Addons/BaseAddonDeed.cs @@ -3,11 +3,12 @@ using System.Collections.Generic; using Server; using Server.Multis; using Server.Targeting; +using Server.Engines.Craft; namespace Server.Items { [Flipable( 0x14F0, 0x14EF )] - public abstract class BaseAddonDeed : Item + public abstract class BaseAddonDeed : Item, ICraftable { public abstract BaseAddon Addon{ get; } @@ -47,6 +48,29 @@ namespace Server.Items else from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it. } + + #region ICraftable Members + public virtual int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue ) + { + Type resourceType = typeRes; + + if ( resourceType == null ) + resourceType = craftItem.Resources.GetAt( 0 ).ItemType; + + CraftResource resource = CraftResources.GetFromType( resourceType ); + + CraftContext context = craftSystem.GetContext( from ); + + if ( context != null && context.DoNotColor ) + Hue = 0; + else if ( resource == CraftResource.None ) + Hue = resHue; + else + Hue = CraftResources.GetHue( resource ); + + return 1; + } + #endregion private class InternalTarget : Target { diff --git a/Scripts/Items/Addons/DartBoard.cs b/Scripts/Items/Addons/DartBoard.cs index 1744382a1..373e507b6 100644 --- a/Scripts/Items/Addons/DartBoard.cs +++ b/Scripts/Items/Addons/DartBoard.cs @@ -104,9 +104,14 @@ namespace Server.Items { public override BaseAddonDeed Deed{ get{ return new DartBoardEastDeed(); } } - public DartBoardEastAddon() + public DartBoardEastAddon() : this( 0 ) + { + } + + public DartBoardEastAddon( int hue ) { AddComponent( new DartBoard( true ), 0, 0, 0 ); + Hue = hue; } public DartBoardEastAddon( Serial serial ) : base( serial ) @@ -130,7 +135,7 @@ namespace Server.Items public class DartBoardEastDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new DartBoardEastAddon(); } } + public override BaseAddon Addon{ get{ return new DartBoardEastAddon( Hue ); } } public override int LabelNumber{ get{ return 1044326; } } // dartboard (east) @@ -162,9 +167,14 @@ namespace Server.Items { public override BaseAddonDeed Deed{ get{ return new DartBoardSouthDeed(); } } - public DartBoardSouthAddon() + public DartBoardSouthAddon() : this( 0 ) + { + } + + public DartBoardSouthAddon( int hue ) { AddComponent( new DartBoard( false ), 0, 0, 0 ); + Hue = hue; } public DartBoardSouthAddon( Serial serial ) : base( serial ) @@ -188,7 +198,7 @@ namespace Server.Items public class DartBoardSouthDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new DartBoardSouthAddon(); } } + public override BaseAddon Addon{ get{ return new DartBoardSouthAddon( Hue ); } } public override int LabelNumber{ get{ return 1044325; } } // dartboard (south) diff --git a/Scripts/Items/Addons/ElvenBedEastAddon.cs b/Scripts/Items/Addons/ElvenBedEastAddon.cs index 75b168e4f..c7aeda459 100644 --- a/Scripts/Items/Addons/ElvenBedEastAddon.cs +++ b/Scripts/Items/Addons/ElvenBedEastAddon.cs @@ -8,10 +8,16 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new ElvenBedEastDeed(); } } [Constructable] - public ElvenBedEastAddon() + public ElvenBedEastAddon() : this( 0 ) + { + } + + [Constructable] + public ElvenBedEastAddon( int hue ) { AddComponent( new AddonComponent( 0x304D ), 0, 0, 0 ); AddComponent( new AddonComponent( 0x304C ), 1, 0, 0 ); + Hue = hue; } public ElvenBedEastAddon( Serial serial ) : base( serial ) @@ -35,7 +41,7 @@ namespace Server.Items public class ElvenBedEastDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new ElvenBedEastAddon(); } } + public override BaseAddon Addon{ get{ return new ElvenBedEastAddon( Hue ); } } public override int LabelNumber{ get{ return 1072861; } } // elven bed (east) [Constructable] diff --git a/Scripts/Items/Addons/ElvenBedSouthAddon.cs b/Scripts/Items/Addons/ElvenBedSouthAddon.cs index 8c76245db..8ee2cb6cb 100644 --- a/Scripts/Items/Addons/ElvenBedSouthAddon.cs +++ b/Scripts/Items/Addons/ElvenBedSouthAddon.cs @@ -8,10 +8,16 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new ElvenBedSouthDeed(); } } [Constructable] - public ElvenBedSouthAddon() + public ElvenBedSouthAddon() : this( 0 ) + { + } + + [Constructable] + public ElvenBedSouthAddon( int hue ) { AddComponent( new AddonComponent( 0x3050 ), 0, 0, 0 ); AddComponent( new AddonComponent( 0x3051 ), 0, -1, 0 ); + Hue = hue; } public ElvenBedSouthAddon( Serial serial ) : base( serial ) @@ -35,7 +41,7 @@ namespace Server.Items public class ElvenBedSouthDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new ElvenBedSouthAddon(); } } + public override BaseAddon Addon{ get{ return new ElvenBedSouthAddon( Hue ); } } public override int LabelNumber{ get{ return 1072860; } } // elven bed (south) [Constructable] diff --git a/Scripts/Items/Addons/ElvenDresserEastAddon.cs b/Scripts/Items/Addons/ElvenDresserEastAddon.cs index f5f2bef60..9702c750b 100644 --- a/Scripts/Items/Addons/ElvenDresserEastAddon.cs +++ b/Scripts/Items/Addons/ElvenDresserEastAddon.cs @@ -8,10 +8,16 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new ElvenDresserEastDeed(); } } [Constructable] - public ElvenDresserEastAddon() + public ElvenDresserEastAddon() : this( 0 ) + { + } + + [Constructable] + public ElvenDresserEastAddon( int hue ) { AddComponent( new AddonComponent( 0x30E4 ), 0, 0, 0 ); AddComponent( new AddonComponent( 0x30E3 ), 0, -1, 0 ); + Hue = hue; } public ElvenDresserEastAddon( Serial serial ) : base( serial ) @@ -35,7 +41,7 @@ namespace Server.Items public class ElvenDresserEastDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new ElvenDresserEastAddon(); } } + public override BaseAddon Addon{ get{ return new ElvenDresserEastAddon( Hue ); } } public override int LabelNumber{ get{ return 1073388; } } // elven dresser (east) [Constructable] diff --git a/Scripts/Items/Addons/ElvenDresserSouthAddon.cs b/Scripts/Items/Addons/ElvenDresserSouthAddon.cs index 4db58cee8..ab831db3c 100644 --- a/Scripts/Items/Addons/ElvenDresserSouthAddon.cs +++ b/Scripts/Items/Addons/ElvenDresserSouthAddon.cs @@ -8,10 +8,16 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new ElvenDresserSouthDeed(); } } [Constructable] - public ElvenDresserSouthAddon() + public ElvenDresserSouthAddon() : this( 0 ) + { + } + + [Constructable] + public ElvenDresserSouthAddon( int hue ) { AddComponent( new AddonComponent( 0x30E5 ), 0, 0, 0 ); AddComponent( new AddonComponent( 0x30E6 ), 1, 0, 0 ); + Hue = hue; } public ElvenDresserSouthAddon( Serial serial ) : base( serial ) @@ -35,7 +41,7 @@ namespace Server.Items public class ElvenDresserSouthDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new ElvenDresserSouthAddon(); } } + public override BaseAddon Addon{ get{ return new ElvenDresserSouthAddon( Hue ); } } public override int LabelNumber{ get{ return 1072864; } } // elven dresser (south) [Constructable] diff --git a/Scripts/Items/Addons/ElvenForgeAddon.cs b/Scripts/Items/Addons/ElvenForgeAddon.cs index 2db9e1682..fdde614b1 100644 --- a/Scripts/Items/Addons/ElvenForgeAddon.cs +++ b/Scripts/Items/Addons/ElvenForgeAddon.cs @@ -1,5 +1,6 @@ using System; using Server; +using Server.Engines.Craft; namespace Server.Items { @@ -8,11 +9,18 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new ElvenForgeDeed(); } } [Constructable] - public ElvenForgeAddon() + public ElvenForgeAddon() : this( 0 ) + { + } + + [Constructable] + public ElvenForgeAddon( int hue ) { AddComponent( new AddonComponent( 0x2DD8 ), 0, 0, 0 ); + Hue = hue; } + public ElvenForgeAddon( Serial serial ) : base( serial ) { } @@ -32,9 +40,10 @@ namespace Server.Items } } + [CraftItemID( 0x2DD8 )] public class ElvenForgeDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new ElvenForgeAddon(); } } + public override BaseAddon Addon{ get{ return new ElvenForgeAddon( Hue ); } } public override int LabelNumber{ get{ return 1072875; } } // squirrel statue (east) [Constructable] diff --git a/Scripts/Items/Addons/ElvenLoveseatEastAddon.cs b/Scripts/Items/Addons/ElvenLoveseatEastAddon.cs index 706e93b97..ddd050224 100644 --- a/Scripts/Items/Addons/ElvenLoveseatEastAddon.cs +++ b/Scripts/Items/Addons/ElvenLoveseatEastAddon.cs @@ -1,5 +1,6 @@ using System; using Server; +using Server.Engines.Craft; namespace Server.Items { @@ -8,10 +9,16 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new ElvenLoveseatEastDeed(); } } [Constructable] - public ElvenLoveseatEastAddon() + public ElvenLoveseatEastAddon() : this( 0 ) { - AddComponent( new AddonComponent( 0x3089 ), 0, 0, 0 ); - AddComponent( new AddonComponent( 0x3088 ), 1, 0, 0 ); + } + + [Constructable] + public ElvenLoveseatEastAddon( int hue ) + { + AddComponent( new AddonComponent( 0x308A ), 0, 0, 0 ); + AddComponent( new AddonComponent( 0x308B ), 0, -1, 0 ); + Hue = hue; } public ElvenLoveseatEastAddon( Serial serial ) : base( serial ) @@ -33,9 +40,10 @@ namespace Server.Items } } + [CraftItemID( 0x2DE0 )] public class ElvenLoveseatEastDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new ElvenLoveseatEastAddon(); } } + public override BaseAddon Addon{ get{ return new ElvenLoveseatEastAddon( Hue ); } } public override int LabelNumber{ get{ return 1073372; } } // elven loveseat (east) [Constructable] diff --git a/Scripts/Items/Addons/ElvenLoveseatSouthAddon.cs b/Scripts/Items/Addons/ElvenLoveseatSouthAddon.cs index 071e7c59b..e9f1e66ec 100644 --- a/Scripts/Items/Addons/ElvenLoveseatSouthAddon.cs +++ b/Scripts/Items/Addons/ElvenLoveseatSouthAddon.cs @@ -1,5 +1,6 @@ using System; using Server; +using Server.Engines.Craft; namespace Server.Items { @@ -8,10 +9,16 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new ElvenLoveseatSouthDeed(); } } [Constructable] - public ElvenLoveseatSouthAddon() + public ElvenLoveseatSouthAddon() : this( 0 ) { - AddComponent( new AddonComponent( 0x308A ), 0, 0, 0 ); - AddComponent( new AddonComponent( 0x308B ), 0, -1, 0 ); + } + + [Constructable] + public ElvenLoveseatSouthAddon( int hue ) + { + AddComponent( new AddonComponent( 0x3089 ), 0, 0, 0 ); + AddComponent( new AddonComponent( 0x3088 ), 1, 0, 0 ); + Hue = hue; } public ElvenLoveseatSouthAddon( Serial serial ) : base( serial ) @@ -33,9 +40,10 @@ namespace Server.Items } } + [CraftItemID( 0x2DDF )] public class ElvenLoveseatSouthDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new ElvenLoveseatSouthAddon(); } } + public override BaseAddon Addon{ get{ return new ElvenLoveseatSouthAddon( Hue ); } } public override int LabelNumber{ get{ return 1072867; } } // elven loveseat (south) [Constructable] diff --git a/Scripts/Items/Addons/ElvenSpinningwheelEastAddon.cs b/Scripts/Items/Addons/ElvenSpinningwheelEastAddon.cs index 06aea8891..4216dc00c 100644 --- a/Scripts/Items/Addons/ElvenSpinningwheelEastAddon.cs +++ b/Scripts/Items/Addons/ElvenSpinningwheelEastAddon.cs @@ -1,5 +1,6 @@ using System; using Server; +using Server.Engines.Craft; namespace Server.Items { @@ -8,9 +9,15 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new ElvenSpinningwheelEastDeed(); } } [Constructable] - public ElvenSpinningwheelEastAddon() + public ElvenSpinningwheelEastAddon() : this( 0 ) + { + } + + [Constructable] + public ElvenSpinningwheelEastAddon( int hue ) { AddComponent( new AddonComponent( 0x2DD9 ), 0, 0, 0 ); + Hue = hue; } public ElvenSpinningwheelEastAddon( Serial serial ) : base( serial ) @@ -106,9 +113,10 @@ namespace Server.Items } } + [CraftItemID( 0x2DD9 )] public class ElvenSpinningwheelEastDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new ElvenSpinningwheelEastAddon(); } } + public override BaseAddon Addon{ get{ return new ElvenSpinningwheelEastAddon( Hue ); } } public override int LabelNumber{ get{ return 1073393; } } // elven spinning wheel (east) [Constructable] diff --git a/Scripts/Items/Addons/ElvenSpinningwheelSouthAddon.cs b/Scripts/Items/Addons/ElvenSpinningwheelSouthAddon.cs index 0df8698ea..b45bd8400 100644 --- a/Scripts/Items/Addons/ElvenSpinningwheelSouthAddon.cs +++ b/Scripts/Items/Addons/ElvenSpinningwheelSouthAddon.cs @@ -1,5 +1,6 @@ using System; using Server; +using Server.Engines.Craft; namespace Server.Items { @@ -8,9 +9,15 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new ElvenSpinningwheelSouthDeed(); } } [Constructable] - public ElvenSpinningwheelSouthAddon() + public ElvenSpinningwheelSouthAddon() : this( 0 ) + { + } + + [Constructable] + public ElvenSpinningwheelSouthAddon( int hue ) { AddComponent( new AddonComponent( 0x2DDA ), 0, 0, 0 ); + Hue = hue; } public ElvenSpinningwheelSouthAddon( Serial serial ) : base( serial ) @@ -108,9 +115,10 @@ namespace Server.Items } } + [CraftItemID( 0x2DDA )] public class ElvenSpinningwheelSouthDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new ElvenSpinningwheelSouthAddon(); } } + public override BaseAddon Addon{ get{ return new ElvenSpinningwheelSouthAddon( Hue ); } } public override int LabelNumber{ get{ return 1072878; } } // spinning wheel (south) [Constructable] diff --git a/Scripts/Items/Addons/ElvenStoveEastAddon.cs b/Scripts/Items/Addons/ElvenStoveEastAddon.cs index 952a28914..9994808b0 100644 --- a/Scripts/Items/Addons/ElvenStoveEastAddon.cs +++ b/Scripts/Items/Addons/ElvenStoveEastAddon.cs @@ -1,5 +1,6 @@ using System; using Server; +using Server.Engines.Craft; namespace Server.Items { @@ -8,9 +9,15 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new ElvenStoveEastDeed(); } } [Constructable] - public ElvenStoveEastAddon() + public ElvenStoveEastAddon() : this( 0 ) + { + } + + [Constructable] + public ElvenStoveEastAddon( int hue ) { AddComponent( new AddonComponent( 0x2DDB ), 0, 0, 0 ); + Hue = hue; } public ElvenStoveEastAddon( Serial serial ) : base( serial ) @@ -32,9 +39,10 @@ namespace Server.Items } } + [CraftItemID( 0x2DDB )] public class ElvenStoveEastDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new ElvenStoveEastAddon(); } } + public override BaseAddon Addon{ get{ return new ElvenStoveEastAddon( Hue ); } } public override int LabelNumber{ get{ return 1073395; } } // elven oven (east) [Constructable] diff --git a/Scripts/Items/Addons/ElvenStoveSouthAddon.cs b/Scripts/Items/Addons/ElvenStoveSouthAddon.cs index 2a4aa4b29..5d79f1cdf 100644 --- a/Scripts/Items/Addons/ElvenStoveSouthAddon.cs +++ b/Scripts/Items/Addons/ElvenStoveSouthAddon.cs @@ -1,5 +1,6 @@ using System; using Server; +using Server.Engines.Craft; namespace Server.Items { @@ -8,9 +9,15 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new ElvenStoveSouthDeed(); } } [Constructable] - public ElvenStoveSouthAddon() + public ElvenStoveSouthAddon() : this( 0 ) + { + } + + [Constructable] + public ElvenStoveSouthAddon( int hue ) { AddComponent( new AddonComponent( 0x2DDC ), 0, 0, 0 ); + Hue = hue; } public ElvenStoveSouthAddon( Serial serial ) : base( serial ) @@ -32,9 +39,10 @@ namespace Server.Items } } + [CraftItemID( 0x2DDC )] public class ElvenStoveSouthDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new ElvenStoveSouthAddon(); } } + public override BaseAddon Addon{ get{ return new ElvenStoveSouthAddon( Hue ); } } public override int LabelNumber{ get{ return 1073394; } } // elven oven (south) [Constructable] diff --git a/Scripts/Items/Addons/ElvenWashbasinEastAddon.cs b/Scripts/Items/Addons/ElvenWashbasinEastAddon.cs index dc07b415c..25e39723a 100644 --- a/Scripts/Items/Addons/ElvenWashbasinEastAddon.cs +++ b/Scripts/Items/Addons/ElvenWashbasinEastAddon.cs @@ -1,5 +1,6 @@ using System; using Server; +using Server.Engines.Craft; namespace Server.Items { @@ -8,10 +9,16 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new ElvenWashBasinEastDeed(); } } [Constructable] - public ElvenWashBasinEastAddon() + public ElvenWashBasinEastAddon() : this( 0 ) + { + } + + [Constructable] + public ElvenWashBasinEastAddon( int hue ) { AddComponent( new AddonComponent( 0x30DF ), 0, 0, 0 ); AddComponent( new AddonComponent( 0x30E0 ), 0, 1, 0 ); + Hue = hue; } public ElvenWashBasinEastAddon( Serial serial ) : base( serial ) @@ -33,9 +40,10 @@ namespace Server.Items } } + [CraftItemID( 0x2D0C )] public class ElvenWashBasinEastDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new ElvenWashBasinEastAddon(); } } + public override BaseAddon Addon{ get{ return new ElvenWashBasinEastAddon( Hue ); } } public override int LabelNumber{ get{ return 1073387; } } // elven wash basin (east) [Constructable] diff --git a/Scripts/Items/Addons/ElvenWashbasinSouthAddon.cs b/Scripts/Items/Addons/ElvenWashbasinSouthAddon.cs index 6a32fc416..1d22e53bf 100644 --- a/Scripts/Items/Addons/ElvenWashbasinSouthAddon.cs +++ b/Scripts/Items/Addons/ElvenWashbasinSouthAddon.cs @@ -1,5 +1,6 @@ using System; using Server; +using Server.Engines.Craft; namespace Server.Items { @@ -8,10 +9,16 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new ElvenWashBasinSouthDeed(); } } [Constructable] - public ElvenWashBasinSouthAddon() + public ElvenWashBasinSouthAddon() : this( 0 ) + { + } + + [Constructable] + public ElvenWashBasinSouthAddon( int hue ) { AddComponent( new AddonComponent( 0x30E1 ), 0, 0, 0 ); AddComponent( new AddonComponent( 0x30E2 ), 1, 0, 0 ); + Hue = hue; } public ElvenWashBasinSouthAddon( Serial serial ) : base( serial ) @@ -33,9 +40,10 @@ namespace Server.Items } } + [CraftItemID( 0x2D0B )] public class ElvenWashBasinSouthDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new ElvenWashBasinSouthAddon(); } } + public override BaseAddon Addon{ get{ return new ElvenWashBasinSouthAddon( Hue ); } } public override int LabelNumber{ get{ return 1072865; } } // elven wash basin (south) [Constructable] diff --git a/Scripts/Items/Addons/FancyElvenTableEastAddon.cs b/Scripts/Items/Addons/FancyElvenTableEastAddon.cs index ebd4f6414..0d62a2660 100644 --- a/Scripts/Items/Addons/FancyElvenTableEastAddon.cs +++ b/Scripts/Items/Addons/FancyElvenTableEastAddon.cs @@ -1,5 +1,6 @@ using System; using Server; +using Server.Engines.Craft; namespace Server.Items { @@ -8,11 +9,17 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new FancyElvenTableEastDeed(); } } [Constructable] - public FancyElvenTableEastAddon() + public FancyElvenTableEastAddon() : this( 0 ) { - AddComponent( new AddonComponent( 0x3094 ), -1, 0, 0 ); - AddComponent( new AddonComponent( 0x3093 ), 0, 0, 0 ); - AddComponent( new AddonComponent( 0x3092 ), 1, 0, 0 ); + } + + [Constructable] + public FancyElvenTableEastAddon( int hue ) + { + AddComponent( new AddonComponent( 0x3095 ), 0, 1, 0 ); + AddComponent( new AddonComponent( 0x3096 ), 0, 0, 0 ); + AddComponent( new AddonComponent( 0x3097 ), 0, -1, 0 ); + Hue = hue; } public FancyElvenTableEastAddon( Serial serial ) : base( serial ) @@ -34,9 +41,10 @@ namespace Server.Items } } + [CraftItemID( 0x2DE8 )] public class FancyElvenTableEastDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new FancyElvenTableEastAddon(); } } + public override BaseAddon Addon{ get{ return new FancyElvenTableEastAddon( Hue ); } } public override int LabelNumber{ get{ return 1073386; } } // hardwood table (east) [Constructable] diff --git a/Scripts/Items/Addons/FancyElvenTableSouthAddon.cs b/Scripts/Items/Addons/FancyElvenTableSouthAddon.cs index b59b27481..942f66ff6 100644 --- a/Scripts/Items/Addons/FancyElvenTableSouthAddon.cs +++ b/Scripts/Items/Addons/FancyElvenTableSouthAddon.cs @@ -1,5 +1,6 @@ using System; using Server; +using Server.Engines.Craft; namespace Server.Items { @@ -8,11 +9,17 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new FancyElvenTableSouthDeed(); } } [Constructable] - public FancyElvenTableSouthAddon() + public FancyElvenTableSouthAddon() : this( 0 ) { - AddComponent( new AddonComponent( 0x3095 ), 0, 1, 0 ); - AddComponent( new AddonComponent( 0x3096 ), 0, 0, 0 ); - AddComponent( new AddonComponent( 0x3097 ), 0, -1, 0 ); + } + + [Constructable] + public FancyElvenTableSouthAddon( int hue ) + { + AddComponent( new AddonComponent( 0x3094 ), -1, 0, 0 ); + AddComponent( new AddonComponent( 0x3093 ), 0, 0, 0 ); + AddComponent( new AddonComponent( 0x3092 ), 1, 0, 0 ); + Hue = hue; } public FancyElvenTableSouthAddon( Serial serial ) : base( serial ) @@ -34,9 +41,10 @@ namespace Server.Items } } + [CraftItemID( 0x2DE7 )] public class FancyElvenTableSouthDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new FancyElvenTableSouthAddon(); } } + public override BaseAddon Addon{ get{ return new FancyElvenTableSouthAddon( Hue ); } } public override int LabelNumber{ get{ return 1073385; } } // hardwood table (south) [Constructable] diff --git a/Scripts/Items/Addons/FlourMillEastAddon.cs b/Scripts/Items/Addons/FlourMillEastAddon.cs index c8eecd59d..b9c957fe6 100644 --- a/Scripts/Items/Addons/FlourMillEastAddon.cs +++ b/Scripts/Items/Addons/FlourMillEastAddon.cs @@ -160,11 +160,17 @@ namespace Server.Items } [Constructable] - public FlourMillEastAddon() + public FlourMillEastAddon() : this( 0 ) + { + } + + [Constructable] + public FlourMillEastAddon( int hue ) { AddComponent( new AddonComponent( 0x1920 ),-1, 0, 0 ); AddComponent( new AddonComponent( 0x1922 ), 0, 0, 0 ); AddComponent( new AddonComponent( 0x1924 ), 1, 0, 0 ); + Hue = hue; } public FlourMillEastAddon( Serial serial ) : base( serial ) @@ -201,7 +207,7 @@ namespace Server.Items public class FlourMillEastDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new FlourMillEastAddon(); } } + public override BaseAddon Addon{ get{ return new FlourMillEastAddon( Hue ); } } public override int LabelNumber{ get{ return 1044347; } } // flour mill (east) [Constructable] diff --git a/Scripts/Items/Addons/FlourMillSouthAddon.cs b/Scripts/Items/Addons/FlourMillSouthAddon.cs index 82d3b59d8..36b8b1fdb 100644 --- a/Scripts/Items/Addons/FlourMillSouthAddon.cs +++ b/Scripts/Items/Addons/FlourMillSouthAddon.cs @@ -146,11 +146,17 @@ namespace Server.Items } [Constructable] - public FlourMillSouthAddon() + public FlourMillSouthAddon() : this( 0 ) + { + } + + [Constructable] + public FlourMillSouthAddon( int hue ) { AddComponent( new AddonComponent( 0x192C ), 0,-1, 0 ); AddComponent( new AddonComponent( 0x192E ), 0, 0, 0 ); AddComponent( new AddonComponent( 0x1930 ), 0, 1, 0 ); + Hue = hue; } public FlourMillSouthAddon( Serial serial ) : base( serial ) @@ -187,7 +193,7 @@ namespace Server.Items public class FlourMillSouthDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new FlourMillSouthAddon(); } } + public override BaseAddon Addon{ get{ return new FlourMillSouthAddon( Hue ); } } public override int LabelNumber{ get{ return 1044348; } } // flour mill (south) [Constructable] diff --git a/Scripts/Items/Addons/LargeBedEastAddon.cs b/Scripts/Items/Addons/LargeBedEastAddon.cs index ac77ea22b..2f2612b68 100644 --- a/Scripts/Items/Addons/LargeBedEastAddon.cs +++ b/Scripts/Items/Addons/LargeBedEastAddon.cs @@ -8,12 +8,18 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new LargeBedEastDeed(); } } [Constructable] - public LargeBedEastAddon() + public LargeBedEastAddon() : this( 0 ) + { + } + + [Constructable] + public LargeBedEastAddon( int hue ) { AddComponent( new AddonComponent( 0xA7D ), 0, 0, 0 ); AddComponent( new AddonComponent( 0xA7C ), 0, 1, 0 ); AddComponent( new AddonComponent( 0xA79 ), 1, 0, 0 ); AddComponent( new AddonComponent( 0xA78 ), 1, 1, 0 ); + Hue = hue; } public LargeBedEastAddon( Serial serial ) : base( serial ) @@ -37,7 +43,7 @@ namespace Server.Items public class LargeBedEastDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new LargeBedEastAddon(); } } + public override BaseAddon Addon{ get{ return new LargeBedEastAddon( Hue ); } } public override int LabelNumber{ get{ return 1044324; } } // large bed (east) [Constructable] diff --git a/Scripts/Items/Addons/LargeBedSouthAddon.cs b/Scripts/Items/Addons/LargeBedSouthAddon.cs index 29be75761..be008a615 100644 --- a/Scripts/Items/Addons/LargeBedSouthAddon.cs +++ b/Scripts/Items/Addons/LargeBedSouthAddon.cs @@ -8,12 +8,18 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new LargeBedSouthDeed(); } } [Constructable] - public LargeBedSouthAddon() + public LargeBedSouthAddon() : this( 0 ) + { + } + + [Constructable] + public LargeBedSouthAddon( int hue ) { AddComponent( new AddonComponent( 0xA83 ), 0, 0, 0 ); AddComponent( new AddonComponent( 0xA7F ), 0, 1, 0 ); AddComponent( new AddonComponent( 0xA82 ), 1, 0, 0 ); AddComponent( new AddonComponent( 0xA7E ), 1, 1, 0 ); + Hue = hue; } public LargeBedSouthAddon( Serial serial ) : base( serial ) @@ -37,7 +43,7 @@ namespace Server.Items public class LargeBedSouthDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new LargeBedSouthAddon(); } } + public override BaseAddon Addon{ get{ return new LargeBedSouthAddon( Hue ); } } public override int LabelNumber{ get{ return 1044323; } } // large bed (south) [Constructable] diff --git a/Scripts/Items/Addons/LargeForgeEastAddon.cs b/Scripts/Items/Addons/LargeForgeEastAddon.cs index d98bea26c..17d850adc 100644 --- a/Scripts/Items/Addons/LargeForgeEastAddon.cs +++ b/Scripts/Items/Addons/LargeForgeEastAddon.cs @@ -8,12 +8,18 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new LargeForgeEastDeed(); } } [Constructable] - public LargeForgeEastAddon() + public LargeForgeEastAddon() : this( 0 ) + { + } + + [Constructable] + public LargeForgeEastAddon( int hue ) { AddComponent( new ForgeComponent( 0x1986 ), 0, 0, 0 ); AddComponent( new ForgeComponent( 0x198A ), 0, 1, 0 ); AddComponent( new ForgeComponent( 0x1996 ), 0, 2, 0 ); AddComponent( new ForgeComponent( 0x1992 ), 0, 3, 0 ); + Hue = hue; } public LargeForgeEastAddon( Serial serial ) : base( serial ) @@ -37,7 +43,7 @@ namespace Server.Items public class LargeForgeEastDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new LargeForgeEastAddon(); } } + public override BaseAddon Addon{ get{ return new LargeForgeEastAddon( Hue ); } } public override int LabelNumber{ get{ return 1044331; } } // large forge (east) [Constructable] diff --git a/Scripts/Items/Addons/LargeForgeSouthAddon.cs b/Scripts/Items/Addons/LargeForgeSouthAddon.cs index a51061c45..f4677a54e 100644 --- a/Scripts/Items/Addons/LargeForgeSouthAddon.cs +++ b/Scripts/Items/Addons/LargeForgeSouthAddon.cs @@ -8,12 +8,18 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new LargeForgeSouthDeed(); } } [Constructable] - public LargeForgeSouthAddon() + public LargeForgeSouthAddon() : this( 0 ) + { + } + + [Constructable] + public LargeForgeSouthAddon( int hue ) { AddComponent( new ForgeComponent( 0x197A ), 0, 0, 0 ); AddComponent( new ForgeComponent( 0x197E ), 1, 0, 0 ); AddComponent( new ForgeComponent( 0x19A2 ), 2, 0, 0 ); AddComponent( new ForgeComponent( 0x199E ), 3, 0, 0 ); + Hue = hue; } public LargeForgeSouthAddon( Serial serial ) : base( serial ) @@ -37,7 +43,7 @@ namespace Server.Items public class LargeForgeSouthDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new LargeForgeSouthAddon(); } } + public override BaseAddon Addon{ get{ return new LargeForgeSouthAddon( Hue ); } } public override int LabelNumber{ get{ return 1044332; } } // large forge (south) [Constructable] diff --git a/Scripts/Items/Addons/LoomEastAddon.cs b/Scripts/Items/Addons/LoomEastAddon.cs index 6f49f4e4e..a6a4b182b 100644 --- a/Scripts/Items/Addons/LoomEastAddon.cs +++ b/Scripts/Items/Addons/LoomEastAddon.cs @@ -17,10 +17,16 @@ namespace Server.Items public int Phase{ get{ return m_Phase; } set{ m_Phase = value; } } [Constructable] - public LoomEastAddon() + public LoomEastAddon() : this( 0 ) + { + } + + [Constructable] + public LoomEastAddon( int hue ) { AddComponent( new AddonComponent( 0x1060 ), 0, 0, 0 ); AddComponent( new AddonComponent( 0x105F ), 0, 1, 0 ); + Hue = hue; } public LoomEastAddon( Serial serial ) : base( serial ) @@ -55,7 +61,7 @@ namespace Server.Items public class LoomEastDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new LoomEastAddon(); } } + public override BaseAddon Addon{ get{ return new LoomEastAddon( Hue ); } } public override int LabelNumber{ get{ return 1044343; } } // loom (east) [Constructable] diff --git a/Scripts/Items/Addons/LoomSouthAddon.cs b/Scripts/Items/Addons/LoomSouthAddon.cs index ff0b5e24b..3abe592a9 100644 --- a/Scripts/Items/Addons/LoomSouthAddon.cs +++ b/Scripts/Items/Addons/LoomSouthAddon.cs @@ -12,10 +12,16 @@ namespace Server.Items public int Phase{ get{ return m_Phase; } set{ m_Phase = value; } } [Constructable] - public LoomSouthAddon() + public LoomSouthAddon() : this( 0 ) + { + } + + [Constructable] + public LoomSouthAddon( int hue ) { AddComponent( new AddonComponent( 0x1061 ), 0, 0, 0 ); AddComponent( new AddonComponent( 0x1062 ), 1, 0, 0 ); + Hue = hue; } public LoomSouthAddon( Serial serial ) : base( serial ) @@ -50,7 +56,7 @@ namespace Server.Items public class LoomSouthDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new LoomSouthAddon(); } } + public override BaseAddon Addon{ get{ return new LoomSouthAddon( Hue ); } } public override int LabelNumber{ get{ return 1044344; } } // loom (south) [Constructable] diff --git a/Scripts/Items/Addons/OrnateElvenTableEastAddon.cs b/Scripts/Items/Addons/OrnateElvenTableEastAddon.cs index 222c03fc7..a0d9ab6a2 100644 --- a/Scripts/Items/Addons/OrnateElvenTableEastAddon.cs +++ b/Scripts/Items/Addons/OrnateElvenTableEastAddon.cs @@ -1,5 +1,6 @@ using System; using Server; +using Server.Engines.Craft; namespace Server.Items { @@ -8,11 +9,17 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new OrnateElvenTableEastDeed(); } } [Constructable] - public OrnateElvenTableEastAddon() + public OrnateElvenTableEastAddon() : this( 0 ) { - AddComponent( new AddonComponent( 0x308E ), -1, 0, 0 ); - AddComponent( new AddonComponent( 0x308D ), 0, 0, 0 ); - AddComponent( new AddonComponent( 0x308C ), 1, 0, 0 ); + } + + [Constructable] + public OrnateElvenTableEastAddon( int hue ) + { + AddComponent( new AddonComponent( 0x308F ), 0, 1, 0 ); + AddComponent( new AddonComponent( 0x3090 ), 0, 0, 0 ); + AddComponent( new AddonComponent( 0x3091 ), 0, -1, 0 ); + Hue = hue; } public OrnateElvenTableEastAddon( Serial serial ) : base( serial ) @@ -34,9 +41,10 @@ namespace Server.Items } } + [CraftItemID( 0x2DE2 )] public class OrnateElvenTableEastDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new OrnateElvenTableEastAddon(); } } + public override BaseAddon Addon{ get{ return new OrnateElvenTableEastAddon( Hue ); } } public override int LabelNumber{ get{ return 1073384; } } // ornate table (east) [Constructable] diff --git a/Scripts/Items/Addons/OrnateElvenTableSouthAddon.cs b/Scripts/Items/Addons/OrnateElvenTableSouthAddon.cs index 7f00e92da..ee7ab7d63 100644 --- a/Scripts/Items/Addons/OrnateElvenTableSouthAddon.cs +++ b/Scripts/Items/Addons/OrnateElvenTableSouthAddon.cs @@ -1,5 +1,6 @@ using System; using Server; +using Server.Engines.Craft; namespace Server.Items { @@ -8,11 +9,17 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new OrnateElvenTableSouthDeed(); } } [Constructable] - public OrnateElvenTableSouthAddon() + public OrnateElvenTableSouthAddon() : this( 0 ) { - AddComponent( new AddonComponent( 0x308F ), 0, 1, 0 ); - AddComponent( new AddonComponent( 0x3090 ), 0, 0, 0 ); - AddComponent( new AddonComponent( 0x3091 ), 0, -1, 0 ); + } + + [Constructable] + public OrnateElvenTableSouthAddon( int hue ) + { + AddComponent( new AddonComponent( 0x308E ), -1, 0, 0 ); + AddComponent( new AddonComponent( 0x308D ), 0, 0, 0 ); + AddComponent( new AddonComponent( 0x308C ), 1, 0, 0 ); + Hue = hue; } public OrnateElvenTableSouthAddon( Serial serial ) : base( serial ) @@ -34,9 +41,10 @@ namespace Server.Items } } + [CraftItemID( 0x2DE1 )] public class OrnateElvenTableSouthDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new OrnateElvenTableSouthAddon(); } } + public override BaseAddon Addon{ get{ return new OrnateElvenTableSouthAddon( Hue ); } } public override int LabelNumber{ get{ return 1072869; } } // ornate table (south) [Constructable] diff --git a/Scripts/Items/Addons/ParrotPerchAddon.cs b/Scripts/Items/Addons/ParrotPerchAddon.cs index 9e16cf1ff..ac8673b09 100644 --- a/Scripts/Items/Addons/ParrotPerchAddon.cs +++ b/Scripts/Items/Addons/ParrotPerchAddon.cs @@ -1,5 +1,6 @@ using System; using Server; +using Server.Engines.Craft; namespace Server.Items { @@ -8,9 +9,15 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new ParrotPerchDeed(); } } [Constructable] - public ParrotPerchAddon() + public ParrotPerchAddon() : this( 0 ) { - AddComponent( new AddonComponent( 0x2FF4 ), 0, 0, 0 ); + } + + [Constructable] + public ParrotPerchAddon( int hue ) + { + AddComponent( new AddonComponent( 0x2FB6 ), 0, 0, 0 ); + Hue = hue; } public ParrotPerchAddon( Serial serial ) : base( serial ) @@ -32,9 +39,10 @@ namespace Server.Items } } + [CraftItemID( 0x2FB6 )] public class ParrotPerchDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new ParrotPerchAddon(); } } + public override BaseAddon Addon{ get{ return new ParrotPerchAddon( Hue ); } } public override int LabelNumber{ get{ return 1072617; } } // parrot perch [Constructable] diff --git a/Scripts/Items/Addons/PentagramAddon.cs b/Scripts/Items/Addons/PentagramAddon.cs index 379a9209e..d1919a212 100644 --- a/Scripts/Items/Addons/PentagramAddon.cs +++ b/Scripts/Items/Addons/PentagramAddon.cs @@ -8,7 +8,12 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new PentagramDeed(); } } [Constructable] - public PentagramAddon() + public PentagramAddon() : this( 0 ) + { + } + + [Constructable] + public PentagramAddon( int hue ) { AddComponent( new AddonComponent( 0xFE7 ), -1, -1, 0 ); AddComponent( new AddonComponent( 0xFE8 ), 0, -1, 0 ); @@ -19,6 +24,7 @@ namespace Server.Items AddComponent( new AddonComponent( 0xFE9 ), -1, 1, 0 ); AddComponent( new AddonComponent( 0xFEC ), 0, 1, 0 ); AddComponent( new AddonComponent( 0xFED ), 1, 1, 0 ); + Hue = hue; } public PentagramAddon( Serial serial ) : base( serial ) @@ -42,7 +48,7 @@ namespace Server.Items public class PentagramDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new PentagramAddon(); } } + public override BaseAddon Addon{ get{ return new PentagramAddon( Hue ); } } public override int LabelNumber{ get{ return 1044328; } } // pentagram [Constructable] diff --git a/Scripts/Items/Addons/PickpocketDips.cs b/Scripts/Items/Addons/PickpocketDips.cs index 7a20aacc9..2462b0cc0 100644 --- a/Scripts/Items/Addons/PickpocketDips.cs +++ b/Scripts/Items/Addons/PickpocketDips.cs @@ -161,9 +161,15 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new PickpocketDipEastDeed(); } } [Constructable] - public PickpocketDipEastAddon() + public PickpocketDipEastAddon() : this( 0 ) + { + } + + [Constructable] + public PickpocketDipEastAddon( int hue ) { AddComponent( new PickpocketDip( 0x1EC3 ), 0, 0, 0 ); + Hue = hue; } public PickpocketDipEastAddon( Serial serial ) : base( serial ) @@ -187,7 +193,7 @@ namespace Server.Items public class PickpocketDipEastDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new PickpocketDipEastAddon(); } } + public override BaseAddon Addon{ get{ return new PickpocketDipEastAddon( Hue ); } } public override int LabelNumber{ get{ return 1044337; } } // pickpocket dip (east) [Constructable] @@ -219,9 +225,15 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new PickpocketDipSouthDeed(); } } [Constructable] - public PickpocketDipSouthAddon() + public PickpocketDipSouthAddon() : this( 0 ) + { + } + + [Constructable] + public PickpocketDipSouthAddon( int hue ) { AddComponent( new PickpocketDip( 0x1EC0 ), 0, 0, 0 ); + Hue = hue; } public PickpocketDipSouthAddon( Serial serial ) : base( serial ) @@ -245,7 +257,7 @@ namespace Server.Items public class PickpocketDipSouthDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new PickpocketDipSouthAddon(); } } + public override BaseAddon Addon{ get{ return new PickpocketDipSouthAddon( Hue ); } } public override int LabelNumber{ get{ return 1044338; } } // pickpocket dip (south) [Constructable] diff --git a/Scripts/Items/Addons/SmallBedEastAddon.cs b/Scripts/Items/Addons/SmallBedEastAddon.cs index bc223c201..bd7631eaf 100644 --- a/Scripts/Items/Addons/SmallBedEastAddon.cs +++ b/Scripts/Items/Addons/SmallBedEastAddon.cs @@ -8,10 +8,16 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new SmallBedEastDeed(); } } [Constructable] - public SmallBedEastAddon() + public SmallBedEastAddon() : this( 0 ) + { + } + + [Constructable] + public SmallBedEastAddon( int hue ) { AddComponent( new AddonComponent( 0xA5D ), 0, 0, 0 ); AddComponent( new AddonComponent( 0xA62 ), 1, 0, 0 ); + Hue = hue; } public SmallBedEastAddon( Serial serial ) : base( serial ) @@ -35,7 +41,7 @@ namespace Server.Items public class SmallBedEastDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new SmallBedEastAddon(); } } + public override BaseAddon Addon{ get{ return new SmallBedEastAddon( Hue ); } } public override int LabelNumber{ get{ return 1044322; } } // small bed (east) [Constructable] diff --git a/Scripts/Items/Addons/SmallBedSouthAddon.cs b/Scripts/Items/Addons/SmallBedSouthAddon.cs index 678de43a0..ac7a6e5cb 100644 --- a/Scripts/Items/Addons/SmallBedSouthAddon.cs +++ b/Scripts/Items/Addons/SmallBedSouthAddon.cs @@ -8,10 +8,16 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new SmallBedSouthDeed(); } } [Constructable] - public SmallBedSouthAddon() + public SmallBedSouthAddon() : this( 0 ) + { + } + + [Constructable] + public SmallBedSouthAddon( int hue ) { AddComponent( new AddonComponent( 0xA63 ), 0, 0, 0 ); AddComponent( new AddonComponent( 0xA5C ), 0, 1, 0 ); + Hue = hue; } public SmallBedSouthAddon( Serial serial ) : base( serial ) @@ -35,7 +41,7 @@ namespace Server.Items public class SmallBedSouthDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new SmallBedSouthAddon(); } } + public override BaseAddon Addon{ get{ return new SmallBedSouthAddon( Hue ); } } public override int LabelNumber{ get{ return 1044321; } } // small bed (south) [Constructable] diff --git a/Scripts/Items/Addons/SmallForgeAddon.cs b/Scripts/Items/Addons/SmallForgeAddon.cs index 5a461fb9e..289acfa14 100644 --- a/Scripts/Items/Addons/SmallForgeAddon.cs +++ b/Scripts/Items/Addons/SmallForgeAddon.cs @@ -8,9 +8,15 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new SmallForgeDeed(); } } [Constructable] - public SmallForgeAddon() + public SmallForgeAddon() : this( 0 ) + { + } + + [Constructable] + public SmallForgeAddon( int hue ) { AddComponent( new ForgeComponent( 0xFB1 ), 0, 0, 0 ); + Hue = hue; } public SmallForgeAddon( Serial serial ) : base( serial ) @@ -34,7 +40,7 @@ namespace Server.Items public class SmallForgeDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new SmallForgeAddon(); } } + public override BaseAddon Addon{ get{ return new SmallForgeAddon( Hue ); } } public override int LabelNumber{ get{ return 1044330; } } // small forge [Constructable] diff --git a/Scripts/Items/Addons/SpinningwheelEastAddon.cs b/Scripts/Items/Addons/SpinningwheelEastAddon.cs index 6d07f86c1..6352a846a 100644 --- a/Scripts/Items/Addons/SpinningwheelEastAddon.cs +++ b/Scripts/Items/Addons/SpinningwheelEastAddon.cs @@ -16,9 +16,15 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new SpinningwheelEastDeed(); } } [Constructable] - public SpinningwheelEastAddon() + public SpinningwheelEastAddon() : this( 0 ) + { + } + + [Constructable] + public SpinningwheelEastAddon( int hue ) { AddComponent( new AddonComponent( 0x1019 ), 0, 0, 0 ); + Hue = hue; } public SpinningwheelEastAddon( Serial serial ) : base( serial ) @@ -118,7 +124,7 @@ namespace Server.Items public class SpinningwheelEastDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new SpinningwheelEastAddon(); } } + public override BaseAddon Addon{ get{ return new SpinningwheelEastAddon( Hue ); } } public override int LabelNumber{ get{ return 1044341; } } // spining wheel (east) [Constructable] diff --git a/Scripts/Items/Addons/SpinningwheelSouthAddon.cs b/Scripts/Items/Addons/SpinningwheelSouthAddon.cs index a2cd565f3..285cb0c3c 100644 --- a/Scripts/Items/Addons/SpinningwheelSouthAddon.cs +++ b/Scripts/Items/Addons/SpinningwheelSouthAddon.cs @@ -8,9 +8,15 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new SpinningwheelSouthDeed(); } } [Constructable] - public SpinningwheelSouthAddon() + public SpinningwheelSouthAddon() : this( 0 ) + { + } + + [Constructable] + public SpinningwheelSouthAddon( int hue ) { AddComponent( new AddonComponent( 0x1015 ), 0, 0, 0 ); + Hue = hue; } public SpinningwheelSouthAddon( Serial serial ) : base( serial ) @@ -110,7 +116,7 @@ namespace Server.Items public class SpinningwheelSouthDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new SpinningwheelSouthAddon(); } } + public override BaseAddon Addon{ get{ return new SpinningwheelSouthAddon( Hue ); } } public override int LabelNumber{ get{ return 1044342; } } // spining wheel (south) [Constructable] diff --git a/Scripts/Items/Addons/SquirrelStatueEastAddon.cs b/Scripts/Items/Addons/SquirrelStatueEastAddon.cs index 6c7427ef5..06129f7bf 100644 --- a/Scripts/Items/Addons/SquirrelStatueEastAddon.cs +++ b/Scripts/Items/Addons/SquirrelStatueEastAddon.cs @@ -8,9 +8,15 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new SquirrelStatueEastDeed(); } } [Constructable] - public SquirrelStatueEastAddon() + public SquirrelStatueEastAddon() : this( 0 ) + { + } + + [Constructable] + public SquirrelStatueEastAddon( int hue ) { AddComponent( new AddonComponent( 0x2D10 ), 0, 0, 0 ); + Hue = hue; } public SquirrelStatueEastAddon( Serial serial ) : base( serial ) @@ -34,7 +40,7 @@ namespace Server.Items public class SquirrelStatueEastDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new SquirrelStatueEastAddon(); } } + public override BaseAddon Addon{ get{ return new SquirrelStatueEastAddon( Hue ); } } public override int LabelNumber{ get{ return 1073398; } } // squirrel statue (east) [Constructable] diff --git a/Scripts/Items/Addons/SquirrelStatueSouthAddon.cs b/Scripts/Items/Addons/SquirrelStatueSouthAddon.cs index a4269ee25..3c30ba9de 100644 --- a/Scripts/Items/Addons/SquirrelStatueSouthAddon.cs +++ b/Scripts/Items/Addons/SquirrelStatueSouthAddon.cs @@ -8,9 +8,15 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new SquirrelStatueSouthDeed(); } } [Constructable] - public SquirrelStatueSouthAddon() + public SquirrelStatueSouthAddon() : this( 0 ) + { + } + + [Constructable] + public SquirrelStatueSouthAddon( int hue ) { AddComponent( new AddonComponent( 0x2D11 ), 0, 0, 0 ); + Hue = hue; } public SquirrelStatueSouthAddon( Serial serial ) : base( serial ) @@ -34,7 +40,7 @@ namespace Server.Items public class SquirrelStatueSouthDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new SquirrelStatueSouthAddon(); } } + public override BaseAddon Addon{ get{ return new SquirrelStatueSouthAddon( Hue ); } } public override int LabelNumber{ get{ return 1072884; } } // squirrel statue (south) [Constructable] diff --git a/Scripts/Items/Addons/StoneOvenEastAddon.cs b/Scripts/Items/Addons/StoneOvenEastAddon.cs index 59811cba7..57fa28f46 100644 --- a/Scripts/Items/Addons/StoneOvenEastAddon.cs +++ b/Scripts/Items/Addons/StoneOvenEastAddon.cs @@ -8,10 +8,16 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new StoneOvenEastDeed(); } } [Constructable] - public StoneOvenEastAddon() + public StoneOvenEastAddon() : this( 0 ) + { + } + + [Constructable] + public StoneOvenEastAddon( int hue ) { AddComponent( new AddonComponent( 0x92C ), 0, 0, 0 ); AddComponent( new AddonComponent( 0x92B ), 0, 1, 0 ); + Hue = hue; } public StoneOvenEastAddon( Serial serial ) : base( serial ) @@ -35,7 +41,7 @@ namespace Server.Items public class StoneOvenEastDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new StoneOvenEastAddon(); } } + public override BaseAddon Addon{ get{ return new StoneOvenEastAddon( Hue ); } } public override int LabelNumber{ get{ return 1044345; } } // stone oven (east) [Constructable] diff --git a/Scripts/Items/Addons/StoneOvenSouthAddon.cs b/Scripts/Items/Addons/StoneOvenSouthAddon.cs index 380a55449..a85d3d9a8 100644 --- a/Scripts/Items/Addons/StoneOvenSouthAddon.cs +++ b/Scripts/Items/Addons/StoneOvenSouthAddon.cs @@ -8,10 +8,16 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new StoneOvenSouthDeed(); } } [Constructable] - public StoneOvenSouthAddon() + public StoneOvenSouthAddon() : this( 0 ) + { + } + + [Constructable] + public StoneOvenSouthAddon( int hue ) { AddComponent( new AddonComponent( 0x931 ), -1, 0, 0 ); AddComponent( new AddonComponent( 0x930 ), 0, 0, 0 ); + Hue = hue; } public StoneOvenSouthAddon( Serial serial ) : base( serial ) @@ -35,7 +41,7 @@ namespace Server.Items public class StoneOvenSouthDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new StoneOvenSouthAddon(); } } + public override BaseAddon Addon{ get{ return new StoneOvenSouthAddon( Hue ); } } public override int LabelNumber{ get{ return 1044346; } } // stone oven (south) [Constructable] diff --git a/Scripts/Items/Addons/TallElvenBedEastAddon.cs b/Scripts/Items/Addons/TallElvenBedEastAddon.cs index 48fb16680..865acc815 100644 --- a/Scripts/Items/Addons/TallElvenBedEastAddon.cs +++ b/Scripts/Items/Addons/TallElvenBedEastAddon.cs @@ -8,12 +8,18 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new TallElvenBedEastDeed(); } } [Constructable] - public TallElvenBedEastAddon() + public TallElvenBedEastAddon() : this( 0 ) + { + } + + [Constructable] + public TallElvenBedEastAddon( int hue ) { AddComponent( new AddonComponent( 0x3054 ), 0, 0, 0 ); AddComponent( new AddonComponent( 0x3053 ), 1, 0, 0 ); AddComponent( new AddonComponent( 0x3055 ), 2, -1, 0 ); AddComponent( new AddonComponent( 0x3052 ), 2, 0, 0 ); + Hue = hue; } public TallElvenBedEastAddon( Serial serial ) : base( serial ) @@ -37,7 +43,7 @@ namespace Server.Items public class TallElvenBedEastDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new TallElvenBedEastAddon(); } } + public override BaseAddon Addon{ get{ return new TallElvenBedEastAddon( Hue ); } } public override int LabelNumber{ get{ return 1072859; } } // tall elven bed (east) [Constructable] diff --git a/Scripts/Items/Addons/TallElvenBedSouthAddon.cs b/Scripts/Items/Addons/TallElvenBedSouthAddon.cs index c981f4d09..8fab084a8 100644 --- a/Scripts/Items/Addons/TallElvenBedSouthAddon.cs +++ b/Scripts/Items/Addons/TallElvenBedSouthAddon.cs @@ -8,12 +8,18 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new TallElvenBedSouthDeed(); } } [Constructable] - public TallElvenBedSouthAddon() + public TallElvenBedSouthAddon() : this( 0 ) + { + } + + [Constructable] + public TallElvenBedSouthAddon( int hue ) { AddComponent( new AddonComponent( 0x3058 ), 0, 0, 0 ); // angolo alto sx AddComponent( new AddonComponent( 0x3057 ), -1, 1, 0 ); // angolo basso sx AddComponent( new AddonComponent( 0x3059 ), 0, -1, 0 ); // angolo alto dx AddComponent( new AddonComponent( 0x3056 ), 0, 1, 0 ); // angolo basso dx + Hue = hue; } public TallElvenBedSouthAddon( Serial serial ) : base( serial ) @@ -37,7 +43,7 @@ namespace Server.Items public class TallElvenBedSouthDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new TallElvenBedSouthAddon(); } } + public override BaseAddon Addon{ get{ return new TallElvenBedSouthAddon( Hue ); } } public override int LabelNumber{ get{ return 1072858; } } // tall elven bed (south) [Constructable] diff --git a/Scripts/Items/Addons/TrainingDummies.cs b/Scripts/Items/Addons/TrainingDummies.cs index d77feb36b..0a01ac325 100644 --- a/Scripts/Items/Addons/TrainingDummies.cs +++ b/Scripts/Items/Addons/TrainingDummies.cs @@ -171,9 +171,15 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new TrainingDummyEastDeed(); } } [Constructable] - public TrainingDummyEastAddon() + public TrainingDummyEastAddon() : this( 0 ) + { + } + + [Constructable] + public TrainingDummyEastAddon( int hue ) { AddComponent( new TrainingDummy( 0x1074 ), 0, 0, 0 ); + Hue = hue; } public TrainingDummyEastAddon( Serial serial ) : base( serial ) @@ -197,7 +203,7 @@ namespace Server.Items public class TrainingDummyEastDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new TrainingDummyEastAddon(); } } + public override BaseAddon Addon{ get{ return new TrainingDummyEastAddon( Hue ); } } public override int LabelNumber{ get{ return 1044335; } } // training dummy (east) [Constructable] @@ -229,9 +235,15 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new TrainingDummySouthDeed(); } } [Constructable] - public TrainingDummySouthAddon() + public TrainingDummySouthAddon() : this( 0 ) + { + } + + [Constructable] + public TrainingDummySouthAddon( int hue ) { AddComponent( new TrainingDummy( 0x1070 ), 0, 0, 0 ); + Hue = hue; } public TrainingDummySouthAddon( Serial serial ) : base( serial ) @@ -255,7 +267,7 @@ namespace Server.Items public class TrainingDummySouthDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new TrainingDummySouthAddon(); } } + public override BaseAddon Addon{ get{ return new TrainingDummySouthAddon( Hue ); } } public override int LabelNumber{ get{ return 1044336; } } // training dummy (south) [Constructable] diff --git a/Scripts/Items/Addons/WarriorStatueEastAddon.cs b/Scripts/Items/Addons/WarriorStatueEastAddon.cs index 8e87608b6..37ee35bef 100644 --- a/Scripts/Items/Addons/WarriorStatueEastAddon.cs +++ b/Scripts/Items/Addons/WarriorStatueEastAddon.cs @@ -8,9 +8,15 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new WarriorStatueEastDeed(); } } [Constructable] - public WarriorStatueEastAddon() + public WarriorStatueEastAddon() : this( 0 ) + { + } + + [Constructable] + public WarriorStatueEastAddon( int hue ) { AddComponent( new AddonComponent( 0x2D12 ), 0, 0, 0 ); + Hue = hue; } public WarriorStatueEastAddon( Serial serial ) : base( serial ) @@ -34,7 +40,7 @@ namespace Server.Items public class WarriorStatueEastDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new WarriorStatueEastAddon(); } } + public override BaseAddon Addon{ get{ return new WarriorStatueEastAddon( Hue ); } } public override int LabelNumber{ get{ return 1072888; } } // warrior statue (east) [Constructable] diff --git a/Scripts/Items/Addons/WarriorStatueSouthAddon.cs b/Scripts/Items/Addons/WarriorStatueSouthAddon.cs index 0369aef53..472eecf25 100644 --- a/Scripts/Items/Addons/WarriorStatueSouthAddon.cs +++ b/Scripts/Items/Addons/WarriorStatueSouthAddon.cs @@ -8,9 +8,15 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new WarriorStatueSouthDeed(); } } [Constructable] - public WarriorStatueSouthAddon() + public WarriorStatueSouthAddon() : this( 0 ) + { + } + + [Constructable] + public WarriorStatueSouthAddon( int hue ) { AddComponent( new AddonComponent( 0x2D13 ), 0, 0, 0 ); + Hue = hue; } public WarriorStatueSouthAddon( Serial serial ) : base( serial ) @@ -34,7 +40,7 @@ namespace Server.Items public class WarriorStatueSouthDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new WarriorStatueSouthAddon(); } } + public override BaseAddon Addon{ get{ return new WarriorStatueSouthAddon( Hue ); } } public override int LabelNumber{ get{ return 1072887; } } // warrior statue (south) [Constructable] diff --git a/Scripts/Items/Addons/WaterTroughEastAddon.cs b/Scripts/Items/Addons/WaterTroughEastAddon.cs index 2c317df6a..ff3bf9d53 100644 --- a/Scripts/Items/Addons/WaterTroughEastAddon.cs +++ b/Scripts/Items/Addons/WaterTroughEastAddon.cs @@ -8,10 +8,16 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new WaterTroughEastDeed(); } } [Constructable] - public WaterTroughEastAddon() + public WaterTroughEastAddon() : this( 0 ) + { + } + + [Constructable] + public WaterTroughEastAddon( int hue ) { AddComponent( new AddonComponent( 0xB41 ), 0, 0, 0 ); AddComponent( new AddonComponent( 0xB42 ), 0, 1, 0 ); + Hue = hue; } public WaterTroughEastAddon( Serial serial ) : base( serial ) @@ -41,7 +47,7 @@ namespace Server.Items public class WaterTroughEastDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new WaterTroughEastAddon(); } } + public override BaseAddon Addon{ get{ return new WaterTroughEastAddon( Hue ); } } public override int LabelNumber{ get{ return 1044349; } } // water trough (east) [Constructable] diff --git a/Scripts/Items/Addons/WaterTroughSouthAddon.cs b/Scripts/Items/Addons/WaterTroughSouthAddon.cs index ffe6577b7..50e79b884 100644 --- a/Scripts/Items/Addons/WaterTroughSouthAddon.cs +++ b/Scripts/Items/Addons/WaterTroughSouthAddon.cs @@ -8,10 +8,16 @@ namespace Server.Items public override BaseAddonDeed Deed{ get{ return new WaterTroughSouthDeed(); } } [Constructable] - public WaterTroughSouthAddon() + public WaterTroughSouthAddon() : this( 0 ) + { + } + + [Constructable] + public WaterTroughSouthAddon( int hue ) { AddComponent( new AddonComponent( 0xB43 ), 0, 0, 0 ); AddComponent( new AddonComponent( 0xB44 ), 1, 0, 0 ); + Hue = hue; } public WaterTroughSouthAddon( Serial serial ) : base( serial ) @@ -41,7 +47,7 @@ namespace Server.Items public class WaterTroughSouthDeed : BaseAddonDeed { - public override BaseAddon Addon{ get{ return new WaterTroughSouthAddon(); } } + public override BaseAddon Addon{ get{ return new WaterTroughSouthAddon( Hue ); } } public override int LabelNumber{ get{ return 1044350; } } // water trough (south) [Constructable] diff --git a/Scripts/Items/Armor/BaseArmor.cs b/Scripts/Items/Armor/BaseArmor.cs index c66d6ef3e..002f1f099 100644 --- a/Scripts/Items/Armor/BaseArmor.cs +++ b/Scripts/Items/Armor/BaseArmor.cs @@ -10,7 +10,7 @@ using ABT = Server.Items.ArmorBodyType; namespace Server.Items { - public abstract class BaseArmor : Item, IScissorable, IFactionItem, ICraftable, IWearableDurability + public abstract class BaseArmor : Item, IScissorable, IFactionItem, ICraftable, IWearableDurability, IAosAttributes { #region Factions private FactionItem m_FactionState; @@ -61,6 +61,9 @@ namespace Server.Items private AosAttributes m_AosAttributes; private AosArmorAttributes m_AosArmorAttributes; private AosSkillBonuses m_AosSkillBonuses; + + private BonusAttribute[] m_BonusRandomAttributes; + private double m_OriginalWeight; // Overridable values. These values are provided to override the defaults which get defined in the individual armor scripts. private int m_ArmorBase = -1; @@ -98,6 +101,9 @@ namespace Server.Items public virtual int OldIntReq{ get{ return 0; } } public virtual bool CanFortify{ get{ return true; } } + + public virtual bool MageArmorOnExceptional{ get{ return false; } } + public virtual bool UsesShieldAttrs{ get{ return false; } } public override void OnAfterDuped( Item newItem ) { @@ -109,8 +115,11 @@ namespace Server.Items armor.m_AosAttributes = new AosAttributes( newItem, m_AosAttributes ); armor.m_AosArmorAttributes = new AosArmorAttributes( newItem, m_AosArmorAttributes ); armor.m_AosSkillBonuses = new AosSkillBonuses( newItem, m_AosSkillBonuses ); + armor.m_BonusRandomAttributes = m_BonusRandomAttributes; } + #region Getters & Setters + [CommandProperty( AccessLevel.GameMaster )] public AMA MeditationAllowance { @@ -246,18 +255,37 @@ namespace Server.Items { if ( m_Resource != value ) { - UnscaleDurability(); + if ( !Core.AOS ) + UnscaleDurability(); + if ( Core.AOS && !CraftResources.IsStandard( m_Resource ) ) + { + BonusAttributesHelper.RemoveAttrsFrom( this, GetResourceBonusAttrs() ); + BonusAttributesHelper.RemoveAttrsFrom( this, RandomAttributes ); + RandomAttributes = null; + } + m_Resource = value; Hue = CraftResources.GetHue( m_Resource ); - + + if ( Core.AOS && !CraftResources.IsStandard( m_Resource ) ) + { + // Enhance sets RandomAttributes so check if it's null/empty first before getting new random attributes. + if ( RandomAttributes == null || RandomAttributes.Length == 0 ) + RandomAttributes = BonusAttributesHelper.GetRandomAttributes( GetResourceRandomAttrs(), GetResourceAttrs().RandomAttributeCount ); + + BonusAttributesHelper.ApplyAttributesTo( this, GetResourceBonusAttrs() ); + BonusAttributesHelper.ApplyAttributesTo( this, RandomAttributes ); + } + Invalidate(); InvalidateProperties(); if ( Parent is Mobile ) ((Mobile)Parent).UpdateResistances(); - ScaleDurability(); + if ( !Core.AOS ) + ScaleDurability(); } } } @@ -375,6 +403,14 @@ namespace Server.Items get{ return m_AosSkillBonuses; } set{} } + + public BonusAttribute[] RandomAttributes + { + get { return m_BonusRandomAttributes; } + set { m_BonusRandomAttributes = value; } + } + + #endregion public int ComputeStatReq( StatType type ) { @@ -421,11 +457,11 @@ namespace Server.Items public virtual int BasePoisonResistance{ get{ return 0; } } public virtual int BaseEnergyResistance{ get{ return 0; } } - public override int PhysicalResistance{ get{ return BasePhysicalResistance + GetProtOffset() + GetResourceAttrs().ArmorPhysicalResist + m_PhysicalBonus; } } - public override int FireResistance{ get{ return BaseFireResistance + GetProtOffset() + GetResourceAttrs().ArmorFireResist + m_FireBonus; } } - public override int ColdResistance{ get{ return BaseColdResistance + GetProtOffset() + GetResourceAttrs().ArmorColdResist + m_ColdBonus; } } - public override int PoisonResistance{ get{ return BasePoisonResistance + GetProtOffset() + GetResourceAttrs().ArmorPoisonResist + m_PoisonBonus; } } - public override int EnergyResistance{ get{ return BaseEnergyResistance + GetProtOffset() + GetResourceAttrs().ArmorEnergyResist + m_EnergyBonus; } } + public override int PhysicalResistance{ get{ return BasePhysicalResistance + GetProtOffset() + m_PhysicalBonus; } } + public override int FireResistance{ get{ return BaseFireResistance + GetProtOffset() + m_FireBonus; } } + public override int ColdResistance{ get{ return BaseColdResistance + GetProtOffset() + m_ColdBonus; } } + public override int PoisonResistance{ get{ return BasePoisonResistance + GetProtOffset() + m_PoisonBonus; } } + public override int EnergyResistance{ get{ return BaseEnergyResistance + GetProtOffset() + m_EnergyBonus; } } public virtual int InitMinHits{ get{ return 0; } } public virtual int InitMaxHits{ get{ return 0; } } @@ -481,6 +517,26 @@ namespace Server.Items return info.AttributeInfo; } + + public BonusAttribute[] GetResourceBonusAttrs() + { + CraftAttributeInfo attrInfo = GetResourceAttrs(); + + if ( UsesShieldAttrs ) + return attrInfo.ShieldAttributes; + + return attrInfo.ArmorAttributes; + } + + public BonusAttribute[] GetResourceRandomAttrs() + { + CraftAttributeInfo attrInfo = GetResourceAttrs(); + + if ( UsesShieldAttrs ) + return attrInfo.ShieldRandomAttributes; + + return attrInfo.ArmorRandomAttributes; + } public int GetProtOffset() { @@ -494,6 +550,25 @@ namespace Server.Items return 0; } + + public void ModifyWeight() + { + double v = 0; + + v = 100 - GetWeightBonus(); + + Weight = m_OriginalWeight * (v / 100); + } + + public int GetWeightBonus() + { + int v = Attributes.LowerWeight; + + if ( v > 100 ) + v = 100; + + return v; + } public void UnscaleDurability() { @@ -532,15 +607,6 @@ namespace Server.Items if ( Core.AOS ) { bonus += m_AosArmorAttributes.DurabilityBonus; - - CraftResourceInfo resInfo = CraftResources.GetInfo( m_Resource ); - CraftAttributeInfo attrInfo = null; - - if ( resInfo != null ) - attrInfo = resInfo.AttributeInfo; - - if ( attrInfo != null ) - bonus += attrInfo.ArmorDurability; } return bonus; @@ -647,16 +713,6 @@ namespace Server.Items int v = m_AosArmorAttributes.LowerStatReq; - CraftResourceInfo info = CraftResources.GetInfo( m_Resource ); - - if ( info != null ) - { - CraftAttributeInfo attrInfo = info.AttributeInfo; - - if ( attrInfo != null ) - v += attrInfo.ArmorLowerRequirements; - } - if ( v > 100 ) v = 100; @@ -735,14 +791,16 @@ namespace Server.Items IntReq = 0x00200000, MedAllowance = 0x00400000, SkillBonuses = 0x00800000, - PlayerConstructed = 0x01000000 + PlayerConstructed = 0x01000000, + BonusAttributes = 0x02000000, + OriginalWeight = 0x04000000 } public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); - writer.Write( (int) 7 ); // version + writer.Write( (int) 8 ); // version SaveFlag flags = SaveFlag.None; @@ -771,7 +829,9 @@ namespace Server.Items SetSaveFlag( ref flags, SaveFlag.MedAllowance, m_Meditate != (AMA)(-1) ); SetSaveFlag( ref flags, SaveFlag.SkillBonuses, !m_AosSkillBonuses.IsEmpty ); SetSaveFlag( ref flags, SaveFlag.PlayerConstructed, m_PlayerConstructed != false ); - + SetSaveFlag( ref flags, SaveFlag.BonusAttributes, m_BonusRandomAttributes != null && m_BonusRandomAttributes.Length > 0 ); + SetSaveFlag( ref flags, SaveFlag.OriginalWeight, m_OriginalWeight != 0 ); + writer.WriteEncodedInt( (int) flags ); if ( GetSaveFlag( flags, SaveFlag.Attributes ) ) @@ -842,6 +902,16 @@ namespace Server.Items if ( GetSaveFlag( flags, SaveFlag.SkillBonuses ) ) m_AosSkillBonuses.Serialize( writer ); + + if ( GetSaveFlag( flags, SaveFlag.BonusAttributes ) ) + { + writer.Write( (int)m_BonusRandomAttributes.Length ); + for ( int i = 0; i < m_BonusRandomAttributes.Length; i++ ) + m_BonusRandomAttributes[i].Serialize( writer ); + } + + if ( GetSaveFlag( flags, SaveFlag.OriginalWeight ) ) + writer.Write( (double)m_OriginalWeight ); } public override void Deserialize( GenericReader reader ) @@ -852,6 +922,7 @@ namespace Server.Items switch ( version ) { + case 8: case 7: case 6: case 5: @@ -972,6 +1043,17 @@ namespace Server.Items if ( GetSaveFlag( flags, SaveFlag.PlayerConstructed ) ) m_PlayerConstructed = true; + + if ( GetSaveFlag( flags, SaveFlag.BonusAttributes ) ) + { + m_BonusRandomAttributes = new BonusAttribute[reader.ReadInt()]; + + for( int i = 0; i < m_BonusRandomAttributes.Length; i++ ) + m_BonusRandomAttributes[i] = new BonusAttribute( reader ); + } + + if ( GetSaveFlag( flags, SaveFlag.OriginalWeight ) ) + m_OriginalWeight = reader.ReadDouble(); break; } @@ -1129,6 +1211,18 @@ namespace Server.Items if ( version < 7 ) m_PlayerConstructed = true; // we don't know, so, assume it's crafted + + if ( version < 8 ) + { + int hits = m_HitPoints; + int maxHits = m_MaxHitPoints; + + m_OriginalWeight = Weight; + BonusAttributesHelper.ApplyAttributesTo( this, GetResourceBonusAttrs() ); + + m_HitPoints = hits; + m_MaxHitPoints = maxHits; + } } public virtual CraftResource DefaultResource{ get{ return CraftResource.Iron; } } @@ -1149,6 +1243,8 @@ namespace Server.Items m_AosAttributes = new AosAttributes( this ); m_AosArmorAttributes = new AosArmorAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); + + m_OriginalWeight = Weight; } public override bool AllowSecureTrade( Mobile from, Mobile to, Mobile newOwner, bool accepted ) @@ -1386,7 +1482,7 @@ namespace Server.Items default: oreType = 0; break; } - if ( m_Quality == ArmorQuality.Exceptional ) + if ( m_Quality == ArmorQuality.Exceptional && !( m_Resource >= CraftResource.RegularWood && m_Resource <= CraftResource.Frostwood ) ) { if ( oreType != 0 ) list.Add( 1053100, "#{0}\t{1}", oreType, GetNameString() ); // exceptional ~1_oretype~ ~2_armortype~ @@ -1411,28 +1507,16 @@ namespace Server.Items return ( m_AosAttributes.SpellChanneling != 0 ); } - - public virtual int GetLuckBonus() - { - CraftResourceInfo resInfo = CraftResources.GetInfo( m_Resource ); - - if ( resInfo == null ) - return 0; - - CraftAttributeInfo attrInfo = resInfo.AttributeInfo; - - if ( attrInfo == null ) - return 0; - - return attrInfo.ArmorLuck; - } - + public override void GetProperties( ObjectPropertyList list ) { base.GetProperties( list ); if ( m_Crafter != null ) list.Add( 1050043, m_Crafter.Name ); // crafted by ~1_NAME~ + + if ( m_Quality == ArmorQuality.Exceptional && ( m_Resource >= CraftResource.RegularWood && m_Resource <= CraftResource.Frostwood ) ) + list.Add( 1060636 ); // exceptional #region Factions if ( m_FactionState != null ) @@ -1485,7 +1569,7 @@ namespace Server.Items if ( (prop = GetLowerStatReq()) != 0 ) list.Add( 1060435, prop.ToString() ); // lower requirements ~1_val~% - if ( (prop = (GetLuckBonus() + m_AosAttributes.Luck)) != 0 ) + if ( (prop = m_AosAttributes.Luck) != 0 ) list.Add( 1060436, prop.ToString() ); // luck ~1_val~ if ( (prop = m_AosArmorAttributes.MageArmor) != 0 ) @@ -1599,23 +1683,15 @@ namespace Server.Items if ( makersMark ) Crafter = from; - Type resourceType = typeRes; - - if ( resourceType == null ) - resourceType = craftItem.Resources.GetAt( 0 ).ItemType; - - Resource = CraftResources.GetFromType( resourceType ); - PlayerConstructed = true; - - CraftContext context = craftSystem.GetContext( from ); - - if ( context != null && context.DoNotColor ) - Hue = 0; - if( Quality == ArmorQuality.Exceptional ) { - DistributeBonuses( (tool is BaseRunicTool ? 6 : Core.SE ? 15 : 14) ); // Not sure since when, but right now 15 points are added, not 14. + if ( !(this is BaseShield) ) + DistributeBonuses( (tool is BaseRunicTool ? 6 : Core.SE ? 15 : 14) ); // Not sure since when, but right now 15 points are added, not 14. + if ( Core.SE ) + if ( MageArmorOnExceptional ) + ArmorAttributes[AosArmorAttribute.MageArmor] = 1; + if( Core.ML && !(this is BaseShield) ) { int bonus = (int)(from.Skills.ArmsLore.Value / 20); @@ -1638,7 +1714,26 @@ namespace Server.Items if ( Core.AOS && tool is BaseRunicTool ) ((BaseRunicTool)tool).ApplyAttributesTo( this ); + + Type resourceType = typeRes; + if ( resourceType == null ) + resourceType = craftItem.Resources.GetAt( 0 ).ItemType; + + Resource = CraftResources.GetFromType( resourceType ); + + PlayerConstructed = true; + + CraftContext context = craftSystem.GetContext( from ); + + if ( context != null ) + { + if ( context.DoNotColor ) + Hue = 0; + else if ( context.CompareHueTo != null ) + Hue = context.CompareHueTo.Hue; + } + return quality; } diff --git a/Scripts/Items/Armor/Plate/HeavyPlateJingasa.cs b/Scripts/Items/Armor/Plate/HeavyPlateJingasa.cs index b76a955e5..46b573353 100644 --- a/Scripts/Items/Armor/Plate/HeavyPlateJingasa.cs +++ b/Scripts/Items/Armor/Plate/HeavyPlateJingasa.cs @@ -18,6 +18,8 @@ namespace Server.Items public override int OldStrReq{ get{ return 55; } } public override int ArmorBase{ get{ return 4; } } + + public override bool MageArmorOnExceptional{ get{ return true; } } public override ArmorMaterialType MaterialType{ get{ return ArmorMaterialType.Plate; } } diff --git a/Scripts/Items/Armor/Plate/LightPlateJingasa.cs b/Scripts/Items/Armor/Plate/LightPlateJingasa.cs index 1087dfd14..aad0a3b0d 100644 --- a/Scripts/Items/Armor/Plate/LightPlateJingasa.cs +++ b/Scripts/Items/Armor/Plate/LightPlateJingasa.cs @@ -18,6 +18,8 @@ namespace Server.Items public override int OldStrReq{ get{ return 55; } } public override int ArmorBase{ get{ return 4; } } + + public override bool MageArmorOnExceptional{ get{ return true; } } public override ArmorMaterialType MaterialType{ get{ return ArmorMaterialType.Plate; } } diff --git a/Scripts/Items/Armor/Plate/PlateDo.cs b/Scripts/Items/Armor/Plate/PlateDo.cs index ca5cfb2ff..0851c6416 100644 --- a/Scripts/Items/Armor/Plate/PlateDo.cs +++ b/Scripts/Items/Armor/Plate/PlateDo.cs @@ -18,6 +18,8 @@ namespace Server.Items public override int OldStrReq{ get{ return 85; } } public override int ArmorBase{ get{ return 3; } } + + public override bool MageArmorOnExceptional{ get{ return true; } } public override ArmorMaterialType MaterialType{ get{ return ArmorMaterialType.Plate; } } diff --git a/Scripts/Items/Armor/Plate/PlateHaidate.cs b/Scripts/Items/Armor/Plate/PlateHaidate.cs index eb666c361..4f21a1198 100644 --- a/Scripts/Items/Armor/Plate/PlateHaidate.cs +++ b/Scripts/Items/Armor/Plate/PlateHaidate.cs @@ -18,6 +18,8 @@ namespace Server.Items public override int OldStrReq{ get{ return 80; } } public override int ArmorBase{ get{ return 3; } } + + public override bool MageArmorOnExceptional{ get{ return true; } } public override ArmorMaterialType MaterialType{ get{ return ArmorMaterialType.Plate; } } diff --git a/Scripts/Items/Armor/Plate/PlateHatsuburi.cs b/Scripts/Items/Armor/Plate/PlateHatsuburi.cs index a34f66512..d826c8b50 100644 --- a/Scripts/Items/Armor/Plate/PlateHatsuburi.cs +++ b/Scripts/Items/Armor/Plate/PlateHatsuburi.cs @@ -18,6 +18,8 @@ namespace Server.Items public override int OldStrReq{ get{ return 65; } } public override int ArmorBase{ get{ return 4; } } + + public override bool MageArmorOnExceptional{ get{ return true; } } public override ArmorMaterialType MaterialType{ get{ return ArmorMaterialType.Plate; } } diff --git a/Scripts/Items/Armor/Plate/PlateHiroSode.cs b/Scripts/Items/Armor/Plate/PlateHiroSode.cs index f67981cd4..accdc6692 100644 --- a/Scripts/Items/Armor/Plate/PlateHiroSode.cs +++ b/Scripts/Items/Armor/Plate/PlateHiroSode.cs @@ -18,6 +18,8 @@ namespace Server.Items public override int OldStrReq{ get{ return 75; } } public override int ArmorBase{ get{ return 3; } } + + public override bool MageArmorOnExceptional{ get{ return true; } } public override ArmorMaterialType MaterialType{ get{ return ArmorMaterialType.Plate; } } diff --git a/Scripts/Items/Armor/Plate/PlateMempo.cs b/Scripts/Items/Armor/Plate/PlateMempo.cs index a7b9cc34c..650bcc72b 100644 --- a/Scripts/Items/Armor/Plate/PlateMempo.cs +++ b/Scripts/Items/Armor/Plate/PlateMempo.cs @@ -18,6 +18,8 @@ namespace Server.Items public override int OldStrReq{ get{ return 50; } } public override int ArmorBase{ get{ return 4; } } + + public override bool MageArmorOnExceptional{ get{ return true; } } public override ArmorMaterialType MaterialType{ get{ return ArmorMaterialType.Plate; } } diff --git a/Scripts/Items/Armor/Plate/PlateSuneate.cs b/Scripts/Items/Armor/Plate/PlateSuneate.cs index 0e2bdd7ee..51df99459 100644 --- a/Scripts/Items/Armor/Plate/PlateSuneate.cs +++ b/Scripts/Items/Armor/Plate/PlateSuneate.cs @@ -18,6 +18,8 @@ namespace Server.Items public override int OldStrReq{ get{ return 80; } } public override int ArmorBase{ get{ return 3; } } + + public override bool MageArmorOnExceptional{ get{ return true; } } public override ArmorMaterialType MaterialType{ get{ return ArmorMaterialType.Plate; } } diff --git a/Scripts/Items/Armor/Plate/SmallPlateJingasa.cs b/Scripts/Items/Armor/Plate/SmallPlateJingasa.cs index 8cf5a63fe..c2d93e0cc 100644 --- a/Scripts/Items/Armor/Plate/SmallPlateJingasa.cs +++ b/Scripts/Items/Armor/Plate/SmallPlateJingasa.cs @@ -18,6 +18,8 @@ namespace Server.Items public override int OldStrReq{ get{ return 55; } } public override int ArmorBase{ get{ return 4; } } + + public override bool MageArmorOnExceptional{ get{ return true; } } public override ArmorMaterialType MaterialType{ get{ return ArmorMaterialType.Plate; } } diff --git a/Scripts/Items/Clothing/BaseClothing.cs b/Scripts/Items/Clothing/BaseClothing.cs index 00c0e68ae..567aac7b6 100644 --- a/Scripts/Items/Clothing/BaseClothing.cs +++ b/Scripts/Items/Clothing/BaseClothing.cs @@ -21,7 +21,7 @@ namespace Server.Items int MaxArcaneCharges{ get; set; } } - public abstract class BaseClothing : Item, IDyable, IScissorable, IFactionItem, ICraftable, IWearableDurability + public abstract class BaseClothing : Item, IDyable, IScissorable, IFactionItem, ICraftable, IWearableDurability, IAosAttributes { #region Factions private FactionItem m_FactionState; diff --git a/Scripts/Items/Construction/Chairs/Benchs.cs b/Scripts/Items/Construction/Chairs/Benchs.cs index 4c067d168..151da454e 100644 --- a/Scripts/Items/Construction/Chairs/Benchs.cs +++ b/Scripts/Items/Construction/Chairs/Benchs.cs @@ -4,12 +4,12 @@ namespace Server.Items { [Furniture] [Flipable( 0xB2D, 0xB2C )] - public class WoodenBench : Item + public class WoodenBench : BaseCraftableItem { [Constructable] - public WoodenBench() : base( 0xB2D ) + public WoodenBench() : base( 0xB2C ) { - Weight = 6; + Weight = 1; } public WoodenBench(Serial serial) : base(serial) @@ -27,7 +27,10 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion + + if ( Weight == 6 ) + Weight = 1; } } } \ No newline at end of file diff --git a/Scripts/Items/Construction/Chairs/Chairs.cs b/Scripts/Items/Construction/Chairs/Chairs.cs index ff1ac6c38..11a2547b7 100644 --- a/Scripts/Items/Construction/Chairs/Chairs.cs +++ b/Scripts/Items/Construction/Chairs/Chairs.cs @@ -4,10 +4,10 @@ namespace Server.Items { [Furniture] [Flipable( 0xB4F, 0xB4E, 0xB50, 0xB51 )] - public class FancyWoodenChairCushion : Item + public class FancyWoodenChairCushion : BaseCraftableItem { [Constructable] - public FancyWoodenChairCushion() : base(0xB4F) + public FancyWoodenChairCushion() : base(0xB4E) { Weight = 20.0; } @@ -27,7 +27,7 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion if ( Weight == 6.0 ) Weight = 20.0; @@ -36,10 +36,10 @@ namespace Server.Items [Furniture] [Flipable( 0xB53, 0xB52, 0xB54, 0xB55 )] - public class WoodenChairCushion : Item + public class WoodenChairCushion : BaseCraftableItem { [Constructable] - public WoodenChairCushion() : base(0xB53) + public WoodenChairCushion() : base(0xB52) { Weight = 20.0; } @@ -59,7 +59,7 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion if ( Weight == 6.0 ) Weight = 20.0; @@ -68,10 +68,10 @@ namespace Server.Items [Furniture] [Flipable( 0xB57, 0xB56, 0xB59, 0xB58 )] - public class WoodenChair : Item + public class WoodenChair : BaseCraftableItem { [Constructable] - public WoodenChair() : base(0xB57) + public WoodenChair() : base(0xB56) { Weight = 20.0; } @@ -91,7 +91,7 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion if ( Weight == 6.0 ) Weight = 20.0; @@ -100,10 +100,10 @@ namespace Server.Items [Furniture] [Flipable( 0xB5B, 0xB5A, 0xB5C, 0xB5D )] - public class BambooChair : Item + public class BambooChair : BaseCraftableItem { [Constructable] - public BambooChair() : base(0xB5B) + public BambooChair() : base(0xB5A) { Weight = 20.0; } @@ -123,7 +123,7 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion if ( Weight == 6.0 ) Weight = 20.0; @@ -132,8 +132,9 @@ namespace Server.Items [DynamicFliping] [Flipable(0x1218, 0x1219, 0x121A, 0x121B)] - public class StoneChair : Item + public class StoneChair : BaseCraftableItem { + public override CraftResource DefaultResource{ get{ return CraftResource.Iron; } } [Constructable] public StoneChair() : base(0x1218) { @@ -155,13 +156,13 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion } } - [DynamicFliping] + [Furniture] [Flipable( 0x2DE3, 0x2DE4, 0x2DE5, 0x2DE6 )] - public class OrnateElvenChair : Item + public class OrnateElvenChair : BaseCraftableItem { [Constructable] public OrnateElvenChair() : base( 0x2DE3 ) @@ -184,16 +185,16 @@ namespace Server.Items { base.Deserialize( reader ); - int version = reader.ReadEncodedInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadEncodedInt() ); //Required for BaseCraftableItem insertion } } - [DynamicFliping] + [Furniture] [Flipable( 0x2DEB, 0x2DEC, 0x2DED, 0x2DEE )] - public class BigElvenChair : Item + public class BigElvenChair : BaseCraftableItem { [Constructable] - public BigElvenChair() : base( 0x2DEB ) + public BigElvenChair() : base( 0x2DED ) { } @@ -212,13 +213,13 @@ namespace Server.Items { base.Deserialize( reader ); - int version = reader.ReadEncodedInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadEncodedInt() ); //Required for BaseCraftableItem insertion } } - [DynamicFliping] + [Furniture] [Flipable( 0x2DF5, 0x2DF6 )] - public class ElvenReadingChair : Item + public class ElvenReadingChair : BaseCraftableItem { [Constructable] public ElvenReadingChair() : base( 0x2DF5 ) @@ -240,7 +241,7 @@ namespace Server.Items { base.Deserialize( reader ); - int version = reader.ReadEncodedInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadEncodedInt() ); //Required for BaseCraftableItem insertion } } } \ No newline at end of file diff --git a/Scripts/Items/Construction/Chairs/Stools.cs b/Scripts/Items/Construction/Chairs/Stools.cs index 00ea2a27b..b23a53a80 100644 --- a/Scripts/Items/Construction/Chairs/Stools.cs +++ b/Scripts/Items/Construction/Chairs/Stools.cs @@ -3,7 +3,7 @@ using System; namespace Server.Items { [Furniture] - public class Stool : Item + public class Stool : BaseCraftableItem { [Constructable] public Stool() : base( 0xA2A ) @@ -26,7 +26,7 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion if ( Weight == 6.0 ) Weight = 10.0; @@ -34,12 +34,12 @@ namespace Server.Items } [Furniture] - public class FootStool : Item + public class FootStool : BaseCraftableItem { [Constructable] public FootStool() : base( 0xB5E ) { - Weight = 6.0; + Weight = 10.0; } public FootStool(Serial serial) : base(serial) @@ -57,7 +57,7 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion if ( Weight == 6.0 ) Weight = 10.0; diff --git a/Scripts/Items/Construction/Chairs/Thrones.cs b/Scripts/Items/Construction/Chairs/Thrones.cs index 0024f4418..707211364 100644 --- a/Scripts/Items/Construction/Chairs/Thrones.cs +++ b/Scripts/Items/Construction/Chairs/Thrones.cs @@ -4,7 +4,7 @@ namespace Server.Items { [Furniture] [Flipable(0xB32, 0xB33)] - public class Throne : Item + public class Throne : BaseCraftableItem { [Constructable] public Throne() : base(0xB33) @@ -27,7 +27,7 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion if ( Weight == 6.0 ) Weight = 1.0; @@ -36,10 +36,10 @@ namespace Server.Items [Furniture] [Flipable( 0xB2E, 0xB2F, 0xB31, 0xB30 )] - public class WoodenThrone : Item + public class WoodenThrone : BaseCraftableItem { [Constructable] - public WoodenThrone() : base(0xB2E) + public WoodenThrone() : base(0xB2F) { Weight = 15.0; } @@ -59,7 +59,7 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion if ( Weight == 6.0 ) Weight = 15.0; diff --git a/Scripts/Items/Construction/Misc/BarrelParts.cs b/Scripts/Items/Construction/Misc/BarrelParts.cs index f61401a2a..71b64b19b 100644 --- a/Scripts/Items/Construction/Misc/BarrelParts.cs +++ b/Scripts/Items/Construction/Misc/BarrelParts.cs @@ -2,8 +2,11 @@ using System; namespace Server.Items { - public class BarrelLid : Item + public class BarrelLid : BaseCraftableItem { + public override bool DisplaysResource{ get{ return false; } } + public override bool DisplaysMakersMark{ get{ return false; } } + [Constructable] public BarrelLid() : base(0x1DB8) { @@ -25,13 +28,16 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion } } [FlipableAttribute(0x1EB1, 0x1EB2, 0x1EB3, 0x1EB4)] - public class BarrelStaves : Item + public class BarrelStaves : BaseCraftableItem { + public override bool DisplaysResource{ get{ return false; } } + public override bool DisplaysMakersMark{ get{ return false; } } + [Constructable] public BarrelStaves() : base(0x1EB1) { @@ -53,7 +59,7 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion } } diff --git a/Scripts/Items/Construction/Misc/BookStand.cs b/Scripts/Items/Construction/Misc/BookStand.cs new file mode 100644 index 000000000..e663fec9d --- /dev/null +++ b/Scripts/Items/Construction/Misc/BookStand.cs @@ -0,0 +1,33 @@ +using System; + +namespace Server.Items +{ + [Furniture] + [Flipable( false, 0x2DDD, 0x2DDE )] + public class ElvenBookStand : BaseCraftableItem + { + [Constructable] + public ElvenBookStand() : base( 0x2DDD ) + { + Weight = 20.0; + } + + public ElvenBookStand(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(); //Required for BaseCraftableItem insertion + } + } +} diff --git a/Scripts/Items/Construction/Misc/Easle.cs b/Scripts/Items/Construction/Misc/Easle.cs index d3a180fcc..696a488f2 100644 --- a/Scripts/Items/Construction/Misc/Easle.cs +++ b/Scripts/Items/Construction/Misc/Easle.cs @@ -3,13 +3,18 @@ using System; namespace Server.Items { [Furniture] - [Flipable(0xF65, 0xF67, 0xF69)] - public class Easle : Item + [Flipable( false, 0xF65, 0xF67, 0xF69 )] + public class Easle : BaseCraftableItem { [Constructable] - public Easle() : base(0xF65) + public Easle() : base( 0xF65 ) { - Weight = 25.0; + } + + [Constructable] + public Easle( int itemID ) : base( itemID ) + { + Weight = 24.0; } public Easle(Serial serial) : base(serial) @@ -27,10 +32,44 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion - if ( Weight == 10.0 ) - Weight = 25.0; + if ( Weight == 10.0 || Weight == 25.0 ) + Weight = 24.0; + } + } + + [Furniture] + [Flipable( false, 0xF66, 0xF68, 0xF6A )] + public class EasleWithCanvas : BaseCraftableItem + { + [Constructable] + public EasleWithCanvas() : base( 0xF66 ) + { + } + + [Constructable] + public EasleWithCanvas( int itemID ) : base( itemID ) + { + Weight = 24.0; + } + + public EasleWithCanvas(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(); } } } \ No newline at end of file diff --git a/Scripts/Items/Construction/Misc/MusicStand.cs b/Scripts/Items/Construction/Misc/MusicStand.cs index ce76b1b1b..042587f7d 100644 --- a/Scripts/Items/Construction/Misc/MusicStand.cs +++ b/Scripts/Items/Construction/Misc/MusicStand.cs @@ -3,11 +3,18 @@ using System; namespace Server.Items { [Furniture] - [Flipable(0xEBB, 0xEBC)] - public class TallMusicStand : Item + [Flipable( false, 0xEBB, 0xEBC )] + public class TallMusicStand : BaseCraftableItem { + public override bool DisplaysResource{ get{ return false; } } + [Constructable] - public TallMusicStand() : base(0xEBB) + public TallMusicStand() : this( 0xEBB ) + { + } + + [Constructable] + public TallMusicStand( int itemID ) : base( itemID ) { Weight = 10.0; } @@ -27,7 +34,7 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion if ( Weight == 8.0 ) Weight = 10.0; @@ -35,11 +42,18 @@ namespace Server.Items } [Furniture] - [Flipable(0xEB6,0xEB8)] - public class ShortMusicStand : Item + [Flipable( false, 0xEB6,0xEB8 )] + public class ShortMusicStand : BaseCraftableItem { + public override bool DisplaysResource{ get{ return false; } } + [Constructable] - public ShortMusicStand() : base(0xEB6) + public ShortMusicStand() : this( 0xEB6 ) + { + } + + [Constructable] + public ShortMusicStand( int itemID ) : base( itemID ) { Weight = 10.0; } @@ -59,7 +73,7 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion if ( Weight == 6.0 ) Weight = 10.0; diff --git a/Scripts/Items/Construction/Misc/Screens.cs b/Scripts/Items/Construction/Misc/Screens.cs index c538d4e22..3a228082e 100644 --- a/Scripts/Items/Construction/Misc/Screens.cs +++ b/Scripts/Items/Construction/Misc/Screens.cs @@ -4,12 +4,12 @@ namespace Server.Items { [Furniture] [Flipable( 0x24D0, 0x24D1, 0x24D2, 0x24D3, 0x24D4 )] - public class BambooScreen : Item + public class BambooScreen : BaseCraftableItem { [Constructable] - public BambooScreen() : base(0x24D0) + public BambooScreen() : base( 0x24D1 ) { - Weight = 20.0; + Weight = 1.0; } public BambooScreen(Serial serial) : base(serial) @@ -27,19 +27,21 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); - + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion + + if ( Weight == 20.0 ) + Weight = 1.0; } } [Furniture] [Flipable( 0x24CB, 0x24CC, 0x24CD, 0x24CE, 0x24CF )] - public class ShojiScreen : Item + public class ShojiScreen : BaseCraftableItem { [Constructable] - public ShojiScreen() : base(0x24CB) + public ShojiScreen() : base( 0x24CB ) { - Weight = 20.0; + Weight = 1.0; } public ShojiScreen(Serial serial) : base(serial) @@ -57,8 +59,10 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); - + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion + + if ( Weight == 20.0 ) + Weight = 1.0; } } diff --git a/Scripts/Items/Construction/Misc/Statues.cs b/Scripts/Items/Construction/Misc/Statues.cs index 22aedeeb5..04da029c8 100644 --- a/Scripts/Items/Construction/Misc/Statues.cs +++ b/Scripts/Items/Construction/Misc/Statues.cs @@ -2,8 +2,10 @@ using System; namespace Server.Items { - public class StatueSouth : Item - { + public class StatueSouth : BaseCraftableItem + { + public override CraftResource DefaultResource{ get{ return CraftResource.Iron; } } + [Constructable] public StatueSouth() : base(0x139A) { @@ -27,12 +29,14 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion } } - public class StatueSouth2 : Item - { + public class StatueSouth2 : BaseCraftableItem + { + public override CraftResource DefaultResource{ get{ return CraftResource.Iron; } } + [Constructable] public StatueSouth2() : base(0x1227) { @@ -56,11 +60,11 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion } } - public class StatueNorth : Item + public class StatueNorth : BaseCraftableItem { [Constructable] public StatueNorth() : base(0x139B) @@ -85,11 +89,11 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion } } - public class StatueWest : Item + public class StatueWest : BaseCraftableItem { [Constructable] public StatueWest() : base(0x1226) @@ -114,11 +118,11 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion } } - public class StatueEast : Item + public class StatueEast : BaseCraftableItem { [Constructable] public StatueEast() : base(0x139C) @@ -143,12 +147,14 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion } } - public class StatueEast2 : Item - { + public class StatueEast2 : BaseCraftableItem + { + public override CraftResource DefaultResource{ get{ return CraftResource.Iron; } } + [Constructable] public StatueEast2() : base(0x1224) { @@ -172,12 +178,14 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion } } - public class StatueSouthEast : Item - { + public class StatueSouthEast : BaseCraftableItem + { + public override CraftResource DefaultResource{ get{ return CraftResource.Iron; } } + [Constructable] public StatueSouthEast() : base(0x1225) { @@ -201,12 +209,14 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion } } - public class BustSouth : Item - { + public class BustSouth : BaseCraftableItem + { + public override CraftResource DefaultResource{ get{ return CraftResource.Iron; } } + [Constructable] public BustSouth() : base(0x12CB) { @@ -230,12 +240,14 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion } } - public class BustEast : Item - { + public class BustEast : BaseCraftableItem + { + public override CraftResource DefaultResource{ get{ return CraftResource.Iron; } } + [Constructable] public BustEast() : base(0x12CA) { @@ -259,12 +271,14 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion } } - public class StatuePegasus : Item + public class StatuePegasus : BaseCraftableItem { + public override CraftResource DefaultResource{ get{ return CraftResource.Iron; } } + [Constructable] public StatuePegasus() : base(0x139D) { @@ -288,12 +302,14 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion } } - public class StatuePegasus2 : Item + public class StatuePegasus2 : BaseCraftableItem { + public override CraftResource DefaultResource{ get{ return CraftResource.Iron; } } + [Constructable] public StatuePegasus2() : base(0x1228) { @@ -317,12 +333,14 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion } } - public class SmallTowerSculpture : Item + public class SmallTowerSculpture : BaseCraftableItem { + public override CraftResource DefaultResource{ get{ return CraftResource.Iron; } } + [Constructable] public SmallTowerSculpture() : base(0x241A) { @@ -344,7 +362,7 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion } } } \ No newline at end of file diff --git a/Scripts/Items/Construction/Misc/Vase.cs b/Scripts/Items/Construction/Misc/Vase.cs index 87778301b..497ab10ed 100644 --- a/Scripts/Items/Construction/Misc/Vase.cs +++ b/Scripts/Items/Construction/Misc/Vase.cs @@ -2,8 +2,10 @@ using System; namespace Server.Items { - public class Vase : Item + public class Vase : BaseCraftableItem { + public override CraftResource DefaultResource{ get{ return CraftResource.Iron; } } + [Constructable] public Vase() : base( 0xB46 ) { @@ -25,12 +27,14 @@ namespace Server.Items { base.Deserialize( reader ); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion } } - public class LargeVase : Item + public class LargeVase : BaseCraftableItem { + public override CraftResource DefaultResource{ get{ return CraftResource.Iron; } } + [Constructable] public LargeVase() : base( 0xB45 ) { @@ -52,12 +56,14 @@ namespace Server.Items { base.Deserialize( reader ); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion } } - public class SmallUrn : Item + public class SmallUrn : BaseCraftableItem { + public override CraftResource DefaultResource{ get{ return CraftResource.Iron; } } + [Constructable] public SmallUrn() : base( 0x241C ) { @@ -79,7 +85,7 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion } } } \ No newline at end of file diff --git a/Scripts/Items/Construction/Tables/Tables.cs b/Scripts/Items/Construction/Tables/Tables.cs index 22078e896..43bfc33f1 100644 --- a/Scripts/Items/Construction/Tables/Tables.cs +++ b/Scripts/Items/Construction/Tables/Tables.cs @@ -4,7 +4,7 @@ namespace Server.Items { [Furniture] - public class ElegantLowTable : Item + public class ElegantLowTable : BaseCraftableItem { [Constructable] public ElegantLowTable() : base(0x2819) @@ -27,13 +27,12 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); - + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion } } [Furniture] - public class PlainLowTable : Item + public class PlainLowTable : BaseCraftableItem { [Constructable] public PlainLowTable() : base(0x281A) @@ -56,17 +55,16 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); - + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion } } [Furniture] [Flipable(0xB90,0xB7D)] - public class LargeTable : Item + public class LargeTable : BaseCraftableItem { [Constructable] - public LargeTable() : base(0xB90) + public LargeTable() : base(0xB7D) { Weight = 1.0; } @@ -86,7 +84,7 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion if ( Weight == 4.0 ) Weight = 1.0; @@ -95,10 +93,10 @@ namespace Server.Items [Furniture] [Flipable(0xB35,0xB34)] - public class Nightstand : Item + public class Nightstand : BaseCraftableItem { [Constructable] - public Nightstand() : base(0xB35) + public Nightstand() : base(0xB34) { Weight = 1.0; } @@ -118,7 +116,7 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion if ( Weight == 4.0 ) Weight = 1.0; @@ -127,10 +125,10 @@ namespace Server.Items [Furniture] [Flipable(0xB8F,0xB7C)] - public class YewWoodTable : Item + public class YewWoodTable : BaseCraftableItem { [Constructable] - public YewWoodTable() : base(0xB8F) + public YewWoodTable() : base(0xB7C) { Weight = 1.0; } @@ -150,7 +148,7 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion if ( Weight == 4.0 ) Weight = 1.0; diff --git a/Scripts/Items/Construction/Tables/WritingTable.cs b/Scripts/Items/Construction/Tables/WritingTable.cs index 3ece21dab..22f3c7aef 100644 --- a/Scripts/Items/Construction/Tables/WritingTable.cs +++ b/Scripts/Items/Construction/Tables/WritingTable.cs @@ -4,7 +4,7 @@ namespace Server.Items { [Furniture] [Flipable(0xB4A,0xB49, 0xB4B, 0xB4C)] - public class WritingTable : Item + public class WritingTable : BaseCraftableItem { [Constructable] public WritingTable() : base(0xB4A) @@ -27,7 +27,7 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion if ( Weight == 4.0 ) Weight = 1.0; diff --git a/Scripts/Items/Containers/Container.cs b/Scripts/Items/Containers/Container.cs index 8453f12ae..91bfd4686 100644 --- a/Scripts/Items/Containers/Container.cs +++ b/Scripts/Items/Containers/Container.cs @@ -139,7 +139,250 @@ namespace Server.Items public BaseContainer( Serial serial ) : base( serial ) { } + + #region Consume[...] + public int ConsumeTotalGroupedCompared( Type[][] types, int[] amounts, bool recurse, OnItemConsumed callback, CheckItemGroup grouper, Item compareTo ) + { + if ( types.Length != amounts.Length ) + throw new ArgumentException(); + else if ( grouper == null ) + throw new ArgumentNullException(); + Item[][][] items = new Item[types.Length][][]; + int[] totals = new int[types.Length]; + + bool hasComparer = false; + + Item originalComparer = compareTo; + + int comparerType = -1; + + for ( int i = 0; i < types.Length; ++i ) + { + Item[] typedItems = FindItemsByType( types[i], recurse ); + + List> groups = new List>(); + + int idx = 0; + + if ( originalComparer != null ) + { + for ( int j = 0; j < types[i].Length; ++j ) + { + if ( originalComparer.GetType() == types[i][j] ) + { + hasComparer = true; + compareTo = originalComparer; + comparerType = i; + break; + } + } + } + + while( idx < typedItems.Length ) + { + Item a = typedItems[idx++]; + List group = new List(); + + if ( !hasComparer ) + { + compareTo = a; + group.Add( a ); + } + else if ( grouper( compareTo, a ) == 0 ) + group.Add( a ); + + while( idx < typedItems.Length ) + { + Item b = typedItems[idx]; + int v = grouper( compareTo, b ); + + if( v == 0 ) + group.Add( b ); + else + break; + + ++idx; + } + + groups.Add( group ); + } + + compareTo = originalComparer; + hasComparer = false; + + items[i] = new Item[groups.Count][]; + + bool hasEnough = false; + + for ( int j = 0; j < groups.Count; ++j ) + { + items[i][j] = groups[j].ToArray(); + + for ( int k = 0; k < items[i][j].Length; ++k ) + totals[i] += items[i][j][k].Amount; + } + + if ( totals[i] >= amounts[i] ) + hasEnough = true; + + if ( !hasEnough ) + return i; + } + + + for ( int i = 0; i < items.Length; ++i ) + { + int need = amounts[i]; + + if ( originalComparer != null && comparerType == i ) + { + object parent = originalComparer.RootParent; + + if ( parent is Mobile ) + { + Mobile m = (Mobile)parent; + + if ( this.RootParent is Mobile && m == (Mobile)this.RootParent ) + ConsumeNeeded( ref need, originalComparer, callback ); + } + } + + for ( int j = 0; j < items[i].Length && need > 0; ++j ) + { + if ( totals[i] >= amounts[i] ) + { + for ( int k = 0; k < items[i][j].Length && need > 0; ++k ) + { + Item item = items[i][j][k]; + + if ( !item.Deleted ) + ConsumeNeeded( ref need, item, callback ); + } + } + } + } + + return -1; + } + + private void ConsumeNeeded( ref int need, Item item, OnItemConsumed callback ) + { + int theirAmount = item.Amount; + + if ( theirAmount < need ) + { + if ( callback != null ) + callback( item, theirAmount ); + + item.Delete(); + need -= theirAmount; + } + else + { + if ( callback != null ) + callback( item, need ); + + item.Consume( need ); + need = 0; + } + } + #endregion + + #region Get[Compared]Amount + public int GetComparedGroupAmount( Type[] types, bool recurse, CheckItemGroup grouper, Item compareTo ) + { + if( grouper == null ) + throw new ArgumentNullException(); + + Item[] typedItems = FindItemsByType( types, recurse ); + + bool hasComparer = false; + + if ( compareTo != null ) + { + for ( int i = 0; i < types.Length; ++i ) + { + if ( compareTo.GetType() == types[i] ) + { + hasComparer = true; + break; + } + } + } + + List> groups = new List>(); + + int idx = 0; + + while( idx < typedItems.Length ) + { + Item a = typedItems[idx++]; + List group = new List(); + + if ( !hasComparer ) + { + compareTo = a; + group.Add( a ); + } + else if ( grouper( compareTo, a ) == 0 ) + group.Add( a ); + + while( idx < typedItems.Length ) + { + Item b = typedItems[idx]; + int v = grouper( compareTo, b ); + + if( v == 0 ) + group.Add( b ); + else + break; + + ++idx; + } + + groups.Add( group ); + } + + int total = 0; + + for( int j = 0; j < groups.Count; ++j ) + { + Item[] items = groups[j].ToArray(); + + for( int k = 0; k < items.Length; ++k ) + total += items[k].Amount; + } + + return total; + } + + public int GetAmountCompared( Type[] types, CheckItemGroup grouper, Item compareTo ) + { + return GetAmountCompared( types, grouper, compareTo, true ); + } + + public int GetAmountCompared( Type[] types, CheckItemGroup grouper, Item compareTo, bool recurse ) + { + Item[] items = FindItemsByType( types, recurse ); + + int amount = 0; + + for ( int i = 0; i < items.Length; ++i ) + { + if ( compareTo == null ) + { + compareTo = items[i]; + amount += items[i].Amount; + } + else if ( grouper( compareTo, items[i] ) == 0 ) + amount += items[i].Amount; + } + + return amount; + } + #endregion + /* Note: base class insertion; we cannot serialize anything here */ public override void Serialize( GenericWriter writer ) { @@ -474,7 +717,7 @@ namespace Server.Items } } - public class Barrel : BaseContainer + public class Barrel : BaseFurnitureContainer { [Constructable] public Barrel() : base( 0xE77 ) @@ -497,14 +740,14 @@ namespace Server.Items { base.Deserialize( reader ); - int version = reader.ReadInt(); + int version = ( InheritsBaseCont ? OldVersion : reader.ReadInt() ); //Required for BaseFurnitureContainer insertion if ( Weight == 0.0 ) Weight = 25.0; } } - public class Keg : BaseContainer + public class Keg : BaseFurnitureContainer { [Constructable] public Keg() : base( 0xE7F ) @@ -527,7 +770,7 @@ namespace Server.Items { base.Deserialize( reader ); - int version = reader.ReadInt(); + int version = ( InheritsBaseCont ? OldVersion : reader.ReadInt() ); //Required for BaseFurnitureContainer insertion } } @@ -590,7 +833,7 @@ namespace Server.Items public class WoodenBox : LockableContainer { [Constructable] - public WoodenBox() : base( 0x9AA ) + public WoodenBox() : base( 0xE7D ) { Weight = 4.0; } @@ -619,9 +862,9 @@ namespace Server.Items public class SmallCrate : LockableContainer { [Constructable] - public SmallCrate() : base( 0x9A9 ) + public SmallCrate() : base( 0xE7E ) { - Weight = 2.0; + Weight = 1.0; } public SmallCrate( Serial serial ) : base( serial ) @@ -641,8 +884,8 @@ namespace Server.Items int version = reader.ReadInt(); - if ( Weight == 4.0 ) - Weight = 2.0; + if ( Weight == 4.0 || Weight == 2.0 ) + Weight = 1.0; } } @@ -651,9 +894,9 @@ namespace Server.Items public class MediumCrate : LockableContainer { [Constructable] - public MediumCrate() : base( 0xE3F ) + public MediumCrate() : base( 0xE3E ) { - Weight = 2.0; + Weight = 1.0; } public MediumCrate( Serial serial ) : base( serial ) @@ -673,8 +916,8 @@ namespace Server.Items int version = reader.ReadInt(); - if ( Weight == 6.0 ) - Weight = 2.0; + if ( Weight == 6.0 || Weight == 2.0 ) + Weight = 1.0; } } @@ -683,7 +926,7 @@ namespace Server.Items public class LargeCrate : LockableContainer { [Constructable] - public LargeCrate() : base( 0xE3D ) + public LargeCrate() : base( 0xE3C ) { Weight = 1.0; } @@ -714,6 +957,8 @@ namespace Server.Items [Flipable( 0x9A8, 0xE80 )] public class MetalBox : LockableContainer { + public override CraftResource DefaultResource{ get{ return CraftResource.Iron; } } + [Constructable] public MetalBox() : base( 0x9A8 ) { @@ -745,6 +990,8 @@ namespace Server.Items [Flipable( 0x9AB, 0xE7C )] public class MetalChest : LockableContainer { + public override CraftResource DefaultResource{ get{ return CraftResource.Iron; } } + [Constructable] public MetalChest() : base( 0x9AB ) { @@ -776,6 +1023,8 @@ namespace Server.Items [Flipable( 0xE41, 0xE40 )] public class MetalGoldenChest : LockableContainer { + public override CraftResource DefaultResource{ get{ return CraftResource.Iron; } } + [Constructable] public MetalGoldenChest() : base( 0xE41 ) { @@ -804,13 +1053,13 @@ namespace Server.Items } [Furniture] - [Flipable( 0xe43, 0xe42 )] + [Flipable( 0xE43, 0xE42 )] public class WoodenChest : LockableContainer { [Constructable] - public WoodenChest() : base( 0xe43 ) + public WoodenChest() : base( 0xE42 ) { - Weight = 2.0; + Weight = 1.0; } public WoodenChest( Serial serial ) : base( serial ) @@ -830,8 +1079,8 @@ namespace Server.Items int version = reader.ReadInt(); - if ( Weight == 15.0 ) - Weight = 2.0; + if ( Weight == 15.0 || Weight == 2.0 ) + Weight = 1.0; } } @@ -840,7 +1089,7 @@ namespace Server.Items public class PlainWoodenChest : LockableContainer { [Constructable] - public PlainWoodenChest() : base( 0x280B ) + public PlainWoodenChest() : base( 0x280C ) { } @@ -871,7 +1120,7 @@ namespace Server.Items public class OrnateWoodenChest : LockableContainer { [Constructable] - public OrnateWoodenChest() : base( 0x280D ) + public OrnateWoodenChest() : base( 0x280E ) { } @@ -902,7 +1151,7 @@ namespace Server.Items public class GildedWoodenChest : LockableContainer { [Constructable] - public GildedWoodenChest() : base( 0x280F ) + public GildedWoodenChest() : base( 0x2810 ) { } @@ -933,7 +1182,7 @@ namespace Server.Items public class WoodenFootLocker : LockableContainer { [Constructable] - public WoodenFootLocker() : base( 0x2811 ) + public WoodenFootLocker() : base( 0x2812 ) { GumpID = 0x10B; } @@ -968,7 +1217,7 @@ namespace Server.Items public class FinishedWoodenChest : LockableContainer { [Constructable] - public FinishedWoodenChest() : base( 0x2813 ) + public FinishedWoodenChest() : base( 0x2814 ) { } diff --git a/Scripts/Items/Containers/FillableContainers.cs b/Scripts/Items/Containers/FillableContainers.cs index b3bbd29fd..6ef8afeab 100644 --- a/Scripts/Items/Containers/FillableContainers.cs +++ b/Scripts/Items/Containers/FillableContainers.cs @@ -407,6 +407,8 @@ namespace Server.Items [Flipable( 0x9A8, 0xE80 )] public class FillableMetalBox : FillableContainer { + public override CraftResource DefaultResource{ get{ return CraftResource.Iron; } } + [Constructable] public FillableMetalBox() : base( 0x9A8 ) { @@ -468,6 +470,8 @@ namespace Server.Items [Flipable( 0x9AB, 0xE7C )] public class FillableMetalChest : FillableContainer { + public override CraftResource DefaultResource{ get{ return CraftResource.Iron; } } + [Constructable] public FillableMetalChest() : base( 0x9AB ) { @@ -498,6 +502,8 @@ namespace Server.Items [Flipable( 0xE41, 0xE40 )] public class FillableMetalGoldenChest : FillableContainer { + public override CraftResource DefaultResource{ get{ return CraftResource.Iron; } } + [Constructable] public FillableMetalGoldenChest() : base( 0xE41 ) { diff --git a/Scripts/Items/Containers/FurnitureContainer.cs b/Scripts/Items/Containers/FurnitureContainer.cs index 9e3d01169..5b43e916c 100644 --- a/Scripts/Items/Containers/FurnitureContainer.cs +++ b/Scripts/Items/Containers/FurnitureContainer.cs @@ -1,17 +1,162 @@ using System; using System.Collections.Generic; using Server; +using Server.Misc; using Server.Multis; using Server.Network; +using Server.Engines.Craft; namespace Server.Items { + public abstract class BaseFurnitureContainer : BaseContainer, ICraftable + { + private Mobile m_Crafter; + private CraftQuality m_Quality; + private CraftResource m_Resource; + + [CommandProperty( AccessLevel.GameMaster )] + public Mobile Crafter + { + get { return m_Crafter; } + set { m_Crafter = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public CraftQuality Quality + { + get { return m_Quality; } + set { m_Quality = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public CraftResource Resource + { + get { return m_Resource; } + set + { + if ( m_Resource != value ) + { + m_Resource = value; + Hue = CraftResources.GetHue( m_Resource ); + InvalidateProperties(); + } + } + } + + public virtual CraftResource DefaultResource{ get{ return CraftResource.RegularWood; } } + public virtual bool DisplaysResource{ get{ return true; } } + public virtual bool DisplaysMakersMark{ get{ return true; } } + + #region Old Container Serialization Vars + /* DO NOT USE! Only used in serialization of furniture containers that originally derived from BaseContainer */ + private bool m_InheritsBaseCont; + private int m_OldVersion; + + protected bool InheritsBaseCont + { + get{ return m_InheritsBaseCont; } + } + + protected int OldVersion + { + get{ return m_OldVersion; } + } + #endregion + + public BaseFurnitureContainer( int itemID ) : base( itemID ) + { + m_Quality = CraftQuality.Regular; + Resource = DefaultResource; + } + + public BaseFurnitureContainer(Serial serial) : base(serial) + { + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_Crafter != null && DisplaysMakersMark ) + list.Add( 1050043, m_Crafter.Name ); // crafted by ~1_NAME~ + + if ( m_Quality == CraftQuality.Exceptional ) + list.Add( 1060636 ); // exceptional + + if( ( m_Resource >= CraftResource.OakWood && m_Resource <= CraftResource.Frostwood ) && Hue == CraftResources.GetHue( m_Resource ) && DisplaysResource ) + list.Add( CraftResources.GetLocalizationNumber( m_Resource ) ); // resource name + } + + public override void Serialize(GenericWriter writer) + { + base.Serialize(writer); + + writer.Write((int) 2); + + writer.Write( m_Crafter ); + writer.WriteEncodedInt( (int) m_Quality ); + writer.WriteEncodedInt( (int) m_Resource ); + } + + public override void Deserialize(GenericReader reader) + { + base.Deserialize(reader); + + int version = reader.ReadInt(); + + switch ( version ) + { + case 2: + { + m_Crafter = reader.ReadMobile(); + m_Quality = (CraftQuality)reader.ReadEncodedInt(); + m_Resource = (CraftResource)reader.ReadEncodedInt(); + break; + } + case 1: //Captcha for EmptyBookcase + case 0: + { + m_InheritsBaseCont = true; + m_OldVersion = version; + m_Quality = CraftQuality.Regular; + m_Resource = DefaultResource; + break; + } + } + } + + public virtual int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue ) + { + if ( Core.ML ) + { + Quality = (CraftQuality)quality; + + if ( makersMark ) + Crafter = from; + + Type resourceType = typeRes; + + if ( resourceType == null ) + resourceType = craftItem.Resources.GetAt( 0 ).ItemType; + + Resource = CraftResources.GetFromType( resourceType ); + + CraftContext context = craftSystem.GetContext( from ); + + if ( context != null && context.DoNotColor ) + Hue = 0; + } + + return quality; + } + } + [Furniture] [Flipable( 0x2815, 0x2816 )] - public class TallCabinet : BaseContainer + public class TallCabinet : BaseFurnitureContainer { [Constructable] - public TallCabinet() : base( 0x2815 ) + public TallCabinet() : base( 0x2816 ) { Weight = 1.0; } @@ -29,16 +174,16 @@ namespace Server.Items public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); - int version = reader.ReadInt(); + int version = ( InheritsBaseCont ? OldVersion : reader.ReadInt() ); //Required for BaseFurnitureContainer insertion } } [Furniture] [Flipable( 0x2817, 0x2818 )] - public class ShortCabinet : BaseContainer + public class ShortCabinet : BaseFurnitureContainer { [Constructable] - public ShortCabinet() : base( 0x2817 ) + public ShortCabinet() : base( 0x2818 ) { Weight = 1.0; } @@ -56,19 +201,19 @@ namespace Server.Items public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); - int version = reader.ReadInt(); + int version = ( InheritsBaseCont ? OldVersion : reader.ReadInt() ); //Required for BaseFurnitureContainer insertion } } [Furniture] [Flipable( 0x2857, 0x2858 )] - public class RedArmoire : BaseContainer + public class RedArmoire : BaseFurnitureContainer { [Constructable] - public RedArmoire() : base( 0x2857 ) + public RedArmoire() : base( 0x2858 ) { - Weight = 1.0; + Weight = 10.0; } public RedArmoire( Serial serial ) : base( serial ) @@ -84,18 +229,21 @@ namespace Server.Items public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); - int version = reader.ReadInt(); + int version = ( InheritsBaseCont ? OldVersion : reader.ReadInt() ); //Required for BaseFurnitureContainer insertion + + if ( Weight == 1.0 ) + Weight = 10.0; } } [Furniture] [Flipable( 0x285D, 0x285E )] - public class CherryArmoire : BaseContainer + public class CherryArmoire : BaseFurnitureContainer { [Constructable] - public CherryArmoire() : base( 0x285D ) + public CherryArmoire() : base( 0x285E ) { - Weight = 1.0; + Weight = 10.0; } public CherryArmoire( Serial serial ) : base( serial ) @@ -111,18 +259,21 @@ namespace Server.Items public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); - int version = reader.ReadInt(); + int version = ( InheritsBaseCont ? OldVersion : reader.ReadInt() ); //Required for BaseFurnitureContainer insertion + + if ( Weight == 1.0 ) + Weight = 10.0; } } [Furniture] [Flipable( 0x285B, 0x285C )] - public class MapleArmoire : BaseContainer + public class MapleArmoire : BaseFurnitureContainer { [Constructable] - public MapleArmoire() : base( 0x285B ) + public MapleArmoire() : base( 0x285C ) { - Weight = 1.0; + Weight = 10.0; } public MapleArmoire( Serial serial ) : base( serial ) @@ -138,18 +289,21 @@ namespace Server.Items public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); - int version = reader.ReadInt(); + int version = ( InheritsBaseCont ? OldVersion : reader.ReadInt() ); //Required for BaseFurnitureContainer insertion + + if ( Weight == 1.0 ) + Weight = 10.0; } } [Furniture] [Flipable( 0x2859, 0x285A )] - public class ElegantArmoire : BaseContainer + public class ElegantArmoire : BaseFurnitureContainer { [Constructable] - public ElegantArmoire() : base( 0x2859 ) + public ElegantArmoire() : base( 0x285A ) { - Weight = 1.0; + Weight = 10.0; } public ElegantArmoire( Serial serial ) : base( serial ) @@ -165,16 +319,19 @@ namespace Server.Items public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); - int version = reader.ReadInt(); + int version = ( InheritsBaseCont ? OldVersion : reader.ReadInt() ); //Required for BaseFurnitureContainer insertion + + if ( Weight == 1.0 ) + Weight = 10.0; } } [Furniture] - [Flipable( 0xa97, 0xa99, 0xa98, 0xa9a, 0xa9b, 0xa9c )] - public class FullBookcase : BaseContainer + [Flipable( 0xA97, 0xA99, 0xA98, 0xA9A, 0xA9B, 0xA9C )] + public class FullBookcase : BaseFurnitureContainer { [Constructable] - public FullBookcase() : base( 0xA97 ) + public FullBookcase() : base( 0xA99 ) { Weight = 1.0; } @@ -192,16 +349,16 @@ namespace Server.Items public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); - int version = reader.ReadInt(); + int version = ( InheritsBaseCont ? OldVersion : reader.ReadInt() ); //Required for BaseFurnitureContainer insertion } } [Furniture] - [Flipable( 0xa9d, 0xa9e )] - public class EmptyBookcase : BaseContainer + [Flipable( 0xA9D, 0xA9E )] + public class EmptyBookcase : BaseFurnitureContainer { [Constructable] - public EmptyBookcase() : base( 0xA9D ) + public EmptyBookcase() : base( 0xA9E ) { } @@ -219,7 +376,7 @@ namespace Server.Items public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); - int version = reader.ReadInt(); + int version = ( InheritsBaseCont ? OldVersion : reader.ReadInt() ); //Required for BaseFurnitureContainer insertion if ( version == 0 && Weight == 1.0 ) Weight = -1; @@ -227,11 +384,11 @@ namespace Server.Items } [Furniture] - [Flipable( 0xa2c, 0xa34 )] - public class Drawer : BaseContainer + [Flipable( 0xA2C, 0xA34 )] + public class Drawer : BaseFurnitureContainer { [Constructable] - public Drawer() : base( 0xA2C ) + public Drawer() : base( 0xA34 ) { Weight = 1.0; } @@ -249,16 +406,16 @@ namespace Server.Items public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); - int version = reader.ReadInt(); + int version = ( InheritsBaseCont ? OldVersion : reader.ReadInt() ); //Required for BaseFurnitureContainer insertion } } [Furniture] - [Flipable( 0xa30, 0xa38 )] - public class FancyDrawer : BaseContainer + [Flipable( 0xA30, 0xA38 )] + public class FancyDrawer : BaseFurnitureContainer { [Constructable] - public FancyDrawer() : base( 0xA30 ) + public FancyDrawer() : base( 0xA38 ) { Weight = 1.0; } @@ -273,19 +430,81 @@ namespace Server.Items writer.Write( (int) 0 ); // version } + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + int version = ( InheritsBaseCont ? OldVersion : reader.ReadInt() ); //Required for BaseFurnitureContainer insertion + } + } + + [Furniture] + [Flipable( 0x2DF1, 0x2DF2 )] + public class OrnateElvenChest : BaseFurnitureContainer + { + [Constructable] + public OrnateElvenChest() : base( 0x2DF1 ) + { + Weight = 1.0; + GumpID = 0x10C; + } + + public OrnateElvenChest( Serial serial ) : base( serial ) + { + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + writer.Write( (int) 1 ); // version + } + public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); + + if ( version < 1 ) + GumpID = 0x10C; + } + } + + [Furniture] + [Flipable( 0x2DF3, 0x2DF4 )] + public class OrnateElvenBox : BaseFurnitureContainer + { + [Constructable] + public OrnateElvenBox() : base( 0x2DF3 ) + { + Weight = 1.0; + GumpID = 0x10C; + } + + public OrnateElvenBox( Serial serial ) : base( serial ) + { + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + writer.Write( (int) 1 ); // version + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + int version = reader.ReadInt(); + + if ( version < 1 ) + GumpID = 0x10C; } } [Furniture] - [Flipable( 0xa4f, 0xa53 )] - public class Armoire : BaseContainer + [Flipable( 0xA4F, 0xA53 )] + public class Armoire : BaseFurnitureContainer { [Constructable] - public Armoire() : base( 0xA4F ) + public Armoire() : base( 0xA53 ) { Weight = 1.0; } @@ -309,18 +528,18 @@ namespace Server.Items public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); - int version = reader.ReadInt(); + int version = ( InheritsBaseCont ? OldVersion : reader.ReadInt() ); //Required for BaseFurnitureContainer insertion DynamicFurniture.Close( this ); } } [Furniture] - [Flipable( 0xa4d, 0xa51 )] - public class FancyArmoire : BaseContainer + [Flipable( 0xA4D, 0xA51 )] + public class FancyArmoire : BaseFurnitureContainer { [Constructable] - public FancyArmoire() : base( 0xA4D ) + public FancyArmoire() : base( 0xA51 ) { Weight = 1.0; } @@ -344,7 +563,7 @@ namespace Server.Items public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); - int version = reader.ReadInt(); + int version = ( InheritsBaseCont ? OldVersion : reader.ReadInt() ); //Required for BaseFurnitureContainer insertion DynamicFurniture.Close( this ); } diff --git a/Scripts/Items/Containers/LockableContainer.cs b/Scripts/Items/Containers/LockableContainer.cs index c42004287..0e42044b6 100644 --- a/Scripts/Items/Containers/LockableContainer.cs +++ b/Scripts/Items/Containers/LockableContainer.cs @@ -12,6 +12,9 @@ namespace Server.Items private uint m_KeyValue; private Mobile m_Picker; private bool m_TrapOnLockpick; + private CraftQuality m_Quality; + private Mobile m_Crafter; + private CraftResource m_Resource; [CommandProperty( AccessLevel.GameMaster )] public Mobile Picker @@ -116,12 +119,39 @@ namespace Server.Items m_TrapOnLockpick = value; } } + + [CommandProperty( AccessLevel.GameMaster )] + public CraftQuality Quality + { + get{ return m_Quality; } + set{ m_Quality = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public Mobile Crafter + { + get{ return m_Crafter; } + set{ m_Crafter = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public CraftResource Resource + { + get{ return m_Resource; } + set{ m_Resource = value; Hue = CraftResources.GetHue( m_Resource ); InvalidateProperties(); } + } + + public virtual CraftResource DefaultResource{ get{ return CraftResource.RegularWood; } } public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); - writer.Write( (int) 6 ); // version + writer.Write( (int) 7 ); // version + + writer.Write( (int)m_Quality ); + writer.Write( (int)m_Resource ); + writer.WriteMobile( m_Crafter ); writer.Write( m_IsShipwreckedItem ); @@ -144,6 +174,13 @@ namespace Server.Items switch ( version ) { + case 7: + { + m_Quality = (CraftQuality)reader.ReadInt(); + m_Resource = (CraftResource)reader.ReadInt(); + m_Crafter = reader.ReadMobile(); + goto case 6; + } case 6: { m_IsShipwreckedItem = reader.ReadBool(); @@ -198,6 +235,12 @@ namespace Server.Items m_RequiredSkill = m_LockLevel; } } + + if ( version < 7 ) + { + m_Quality = CraftQuality.Regular; + m_Resource = DefaultResource; + } m_Locked = reader.ReadBool(); @@ -208,6 +251,8 @@ namespace Server.Items public LockableContainer( int itemID ) : base( itemID ) { + m_Quality = CraftQuality.Regular; + Resource = DefaultResource; m_MaxLockLevel = 100; } @@ -215,6 +260,20 @@ namespace Server.Items { } + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_Crafter != null ) + list.Add( 1050043, m_Crafter.Name ); // crafted by ~1_NAME~ + + if ( m_Quality == CraftQuality.Exceptional ) + list.Add( 1060636 ); // exceptional + + if( ( m_Resource >= CraftResource.OakWood && m_Resource <= CraftResource.Frostwood ) && Hue == CraftResources.GetHue( m_Resource ) ) + list.Add( CraftResources.GetLocalizationNumber( m_Resource ) ); // resource name + } + public override bool CheckContentDisplay( Mobile from ) { return !m_Locked && base.CheckContentDisplay( from ); @@ -360,6 +419,26 @@ namespace Server.Items public int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue ) { + if ( Core.ML ) + { + Quality = (CraftQuality)quality; + + Type resourceType = typeRes; + + if ( resourceType == null ) + resourceType = craftItem.Resources.GetAt( 0 ).ItemType; + + Resource = CraftResources.GetFromType( resourceType ); + + CraftContext context = craftSystem.GetContext( from ); + + if ( context != null && context.DoNotColor ) + Resource = DefaultResource; + + if ( makersMark ) + Crafter = from; + } + if ( from.CheckSkill( SkillName.Tinkering, -5.0, 15.0 ) ) { from.SendLocalizedMessage( 500636 ); // Your tinker skill was sufficient to make the item lockable. @@ -392,7 +471,7 @@ namespace Server.Items from.SendLocalizedMessage( 500637 ); // Your tinker skill was insufficient to make the item lockable. } - return 1; + return quality; } #endregion diff --git a/Scripts/Items/Containers/ParagonChest.cs b/Scripts/Items/Containers/ParagonChest.cs index e7bc80394..f0163d562 100644 --- a/Scripts/Items/Containers/ParagonChest.cs +++ b/Scripts/Items/Containers/ParagonChest.cs @@ -12,6 +12,8 @@ namespace Server.Items [Flipable] public class ParagonChest : LockableContainer { + public override CraftResource DefaultResource{ get{ return CraftResource.Iron; } } + private static int[] m_ItemIDs = new int[] { 0x9AB, 0xE40, 0xE41, 0xE7C diff --git a/Scripts/Items/Containers/TreasureChest.cs b/Scripts/Items/Containers/TreasureChest.cs index 87b83d48b..73d9106a2 100644 --- a/Scripts/Items/Containers/TreasureChest.cs +++ b/Scripts/Items/Containers/TreasureChest.cs @@ -36,6 +36,8 @@ namespace Server.Items [FlipableAttribute( 0xe41, 0xe40 )] public class MetalGoldenTreasureChest : BaseTreasureChest { + public override CraftResource DefaultResource{ get{ return CraftResource.Iron; } } + [Constructable] public MetalGoldenTreasureChest() : base( 0xE41 ) { @@ -63,6 +65,8 @@ namespace Server.Items [FlipableAttribute( 0x9ab, 0xe7c )] public class MetalTreasureChest : BaseTreasureChest { + public override CraftResource DefaultResource{ get{ return CraftResource.Iron; } } + [Constructable] public MetalTreasureChest() : base( 0x9AB ) { diff --git a/Scripts/Items/Games/Backgammon.cs b/Scripts/Items/Games/Backgammon.cs index 0b906c3bd..1e4ab84c2 100644 --- a/Scripts/Items/Games/Backgammon.cs +++ b/Scripts/Items/Games/Backgammon.cs @@ -4,7 +4,7 @@ using System.Collections; namespace Server.Items { [Flipable( 0xE1C, 0xFAD )] - public class Backgammon : BaseBoard + public class Backgammon : BaseGameBoard { [Constructable] public Backgammon() : base( 0xE1C ) diff --git a/Scripts/Items/Games/BaseBoard.cs b/Scripts/Items/Games/BaseGameBoard.cs similarity index 83% rename from Scripts/Items/Games/BaseBoard.cs rename to Scripts/Items/Games/BaseGameBoard.cs index 2956b2446..77860fb4c 100644 --- a/Scripts/Items/Games/BaseBoard.cs +++ b/Scripts/Items/Games/BaseGameBoard.cs @@ -10,7 +10,7 @@ using Server.Gumps; namespace Server.Items { - public abstract class BaseBoard : Container, ISecurable + public abstract class BaseGameBoard : Container, ISecurable { private SecureLevel m_Level; @@ -21,7 +21,7 @@ namespace Server.Items set{ m_Level = value; } } - public BaseBoard( int itemID ) : base( itemID ) + public BaseGameBoard( int itemID ) : base( itemID ) { CreatePieces(); @@ -51,7 +51,7 @@ namespace Server.Items public override bool IsDecoContainer{ get{ return false; } } - public BaseBoard( Serial serial ) : base( serial ) + public BaseGameBoard( Serial serial ) : base( serial ) { } @@ -124,7 +124,7 @@ namespace Server.Items SetSecureLevelEntry.AddTo( from, this, list ); } - public static bool ValidateDefault( Mobile from, BaseBoard board ) + public static bool ValidateDefault( Mobile from, BaseGameBoard board ) { if ( from.AccessLevel >= AccessLevel.GameMaster ) return true; @@ -151,9 +151,9 @@ namespace Server.Items public class DefaultEntry : ContextMenuEntry { private Mobile m_From; - private BaseBoard m_Board; + private BaseGameBoard m_Board; - public DefaultEntry( Mobile from, BaseBoard board ) : base( 6162, from.AccessLevel >= AccessLevel.GameMaster ? -1 : 1 ) + public DefaultEntry( Mobile from, BaseGameBoard board ) : base( 6162, from.AccessLevel >= AccessLevel.GameMaster ? -1 : 1 ) { m_From = from; m_Board = board; @@ -161,9 +161,9 @@ namespace Server.Items public override void OnClick() { - if ( BaseBoard.ValidateDefault( m_From, m_Board ) ) + if ( BaseGameBoard.ValidateDefault( m_From, m_Board ) ) m_Board.Reset(); } } } -} \ No newline at end of file +} diff --git a/Scripts/Items/Games/BasePiece.cs b/Scripts/Items/Games/BasePiece.cs index d22b06fb9..6599bba9c 100644 --- a/Scripts/Items/Games/BasePiece.cs +++ b/Scripts/Items/Games/BasePiece.cs @@ -5,9 +5,9 @@ namespace Server.Items { public class BasePiece : Item { - private BaseBoard m_Board; + private BaseGameBoard m_Board; - public BaseBoard Board + public BaseGameBoard Board { get { return m_Board; } set { m_Board = value; } @@ -15,7 +15,7 @@ namespace Server.Items public override bool IsVirtualItem{ get{ return true; } } - public BasePiece( int itemID, BaseBoard board ) : base( itemID ) + public BasePiece( int itemID, BaseGameBoard board ) : base( itemID ) { m_Board = board; } @@ -42,7 +42,7 @@ namespace Server.Items { case 0: { - m_Board = (BaseBoard)reader.ReadItem(); + m_Board = (BaseGameBoard)reader.ReadItem(); if ( m_Board == null || Parent == null ) Delete(); diff --git a/Scripts/Items/Games/CheckerBoard.cs b/Scripts/Items/Games/CheckerBoard.cs index df7c3a50e..12eb196b1 100644 --- a/Scripts/Items/Games/CheckerBoard.cs +++ b/Scripts/Items/Games/CheckerBoard.cs @@ -3,7 +3,7 @@ using System.Collections; namespace Server.Items { - public class CheckerBoard : BaseBoard + public class CheckerBoard : BaseGameBoard { public override int LabelNumber{ get{ return 1016449; } } // a checker board diff --git a/Scripts/Items/Games/CheckersPieces.cs b/Scripts/Items/Games/CheckersPieces.cs index 895c2440a..cabcb37c1 100644 --- a/Scripts/Items/Games/CheckersPieces.cs +++ b/Scripts/Items/Games/CheckersPieces.cs @@ -10,7 +10,7 @@ namespace Server.Items get { return "white checker"; } } - public PieceWhiteChecker( BaseBoard board ) : base( 0x3584, board ) + public PieceWhiteChecker( BaseGameBoard board ) : base( 0x3584, board ) { } @@ -38,7 +38,7 @@ namespace Server.Items get { return "black checker"; } } - public PieceBlackChecker( BaseBoard board ) : base( 0x358B, board ) + public PieceBlackChecker( BaseGameBoard board ) : base( 0x358B, board ) { } diff --git a/Scripts/Items/Games/ChessPieces.cs b/Scripts/Items/Games/ChessPieces.cs index bf3c197ea..2f341de65 100644 --- a/Scripts/Items/Games/ChessPieces.cs +++ b/Scripts/Items/Games/ChessPieces.cs @@ -10,7 +10,7 @@ namespace Server.Items get { return "white king"; } } - public PieceWhiteKing( BaseBoard board ) : base( 0x3587, board ) + public PieceWhiteKing( BaseGameBoard board ) : base( 0x3587, board ) { } @@ -38,7 +38,7 @@ namespace Server.Items get { return "black king"; } } - public PieceBlackKing( BaseBoard board ) : base( 0x358E, board ) + public PieceBlackKing( BaseGameBoard board ) : base( 0x358E, board ) { } @@ -66,7 +66,7 @@ namespace Server.Items get { return "white queen"; } } - public PieceWhiteQueen( BaseBoard board ) : base( 0x358A, board ) + public PieceWhiteQueen( BaseGameBoard board ) : base( 0x358A, board ) { } @@ -94,7 +94,7 @@ namespace Server.Items get { return "black queen"; } } - public PieceBlackQueen( BaseBoard board ) : base( 0x3591, board ) + public PieceBlackQueen( BaseGameBoard board ) : base( 0x3591, board ) { } @@ -122,7 +122,7 @@ namespace Server.Items get { return "white rook"; } } - public PieceWhiteRook( BaseBoard board ) : base( 0x3586, board ) + public PieceWhiteRook( BaseGameBoard board ) : base( 0x3586, board ) { } @@ -150,7 +150,7 @@ namespace Server.Items get { return "black rook"; } } - public PieceBlackRook( BaseBoard board ) : base( 0x358D, board ) + public PieceBlackRook( BaseGameBoard board ) : base( 0x358D, board ) { } @@ -178,7 +178,7 @@ namespace Server.Items get { return "white bishop"; } } - public PieceWhiteBishop( BaseBoard board ) : base( 0x3585, board ) + public PieceWhiteBishop( BaseGameBoard board ) : base( 0x3585, board ) { } @@ -206,7 +206,7 @@ namespace Server.Items get { return "black bishop"; } } - public PieceBlackBishop( BaseBoard board ) : base( 0x358C, board ) + public PieceBlackBishop( BaseGameBoard board ) : base( 0x358C, board ) { } @@ -234,7 +234,7 @@ namespace Server.Items get { return "white knight"; } } - public PieceWhiteKnight( BaseBoard board ) : base( 0x3588, board ) + public PieceWhiteKnight( BaseGameBoard board ) : base( 0x3588, board ) { } @@ -262,7 +262,7 @@ namespace Server.Items get { return "black knight"; } } - public PieceBlackKnight( BaseBoard board ) : base( 0x358F, board ) + public PieceBlackKnight( BaseGameBoard board ) : base( 0x358F, board ) { } @@ -290,7 +290,7 @@ namespace Server.Items get { return "white pawn"; } } - public PieceWhitePawn( BaseBoard board ) : base( 0x3589, board ) + public PieceWhitePawn( BaseGameBoard board ) : base( 0x3589, board ) { } @@ -318,7 +318,7 @@ namespace Server.Items get { return "black pawn"; } } - public PieceBlackPawn( BaseBoard board ) : base( 0x3590, board ) + public PieceBlackPawn( BaseGameBoard board ) : base( 0x3590, board ) { } diff --git a/Scripts/Items/Games/Chessboard.cs b/Scripts/Items/Games/Chessboard.cs index 58747682a..9dd325228 100644 --- a/Scripts/Items/Games/Chessboard.cs +++ b/Scripts/Items/Games/Chessboard.cs @@ -3,7 +3,7 @@ using System.Collections; namespace Server.Items { - public class Chessboard : BaseBoard + public class Chessboard : BaseGameBoard { public override int LabelNumber{ get{ return 1016450; } } // a chessboard diff --git a/Scripts/Items/Jewels/BaseJewel.cs b/Scripts/Items/Jewels/BaseJewel.cs index a77835f30..a96d4fd76 100644 --- a/Scripts/Items/Jewels/BaseJewel.cs +++ b/Scripts/Items/Jewels/BaseJewel.cs @@ -17,7 +17,7 @@ namespace Server.Items Diamond } - public abstract class BaseJewel : Item, ICraftable + public abstract class BaseJewel : Item, ICraftable, IAosAttributes { private int m_MaxHitPoints; private int m_HitPoints; diff --git a/Scripts/Items/Lights/BaseLight.cs b/Scripts/Items/Lights/BaseLight.cs index 342a57675..6a72b3a95 100644 --- a/Scripts/Items/Lights/BaseLight.cs +++ b/Scripts/Items/Lights/BaseLight.cs @@ -1,9 +1,10 @@ using System; using Server; +using Server.Engines.Craft; namespace Server.Items { - public abstract class BaseLight : Item + public abstract class BaseLight : Item, ICraftable { private Timer m_Timer; private DateTime m_End; @@ -12,6 +13,10 @@ namespace Server.Items private bool m_Protected = false; private TimeSpan m_Duration = TimeSpan.Zero; + private Mobile m_Crafter; + private CraftQuality m_Quality; + private CraftResource m_Resource; + public abstract int LitItemID{ get; } public virtual int UnlitItemID{ get { return 0; } } @@ -22,6 +27,39 @@ namespace Server.Items public virtual int BurntOutSound{ get { return 0x4b8; } } public static readonly bool Burnout = false; + + public virtual CraftResource DefaultResource{ get{ return CraftResource.Iron; } } + public virtual bool DisplaysResource{ get{ return true; } } + public virtual bool DisplaysMakersMark{ get{ return true; } } + + [CommandProperty( AccessLevel.GameMaster )] + public Mobile Crafter + { + get { return m_Crafter; } + set { m_Crafter = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public CraftQuality Quality + { + get { return m_Quality; } + set { m_Quality = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public CraftResource Resource + { + get { return m_Resource; } + set + { + if ( m_Resource != value ) + { + m_Resource = value; + Hue = CraftResources.GetHue( m_Resource ); + InvalidateProperties(); + } + } + } [CommandProperty( AccessLevel.GameMaster )] public bool Burning @@ -75,6 +113,20 @@ namespace Server.Items public BaseLight( Serial serial ) : base( serial ) { } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_Crafter != null && DisplaysMakersMark ) + list.Add( 1050043, m_Crafter.Name ); // crafted by ~1_NAME~ + + if ( m_Quality == CraftQuality.Exceptional ) + list.Add( 1060636 ); // exceptional + + if( ( m_Resource >= CraftResource.OakWood && m_Resource <= CraftResource.Frostwood ) && Hue == CraftResources.GetHue( m_Resource ) && DisplaysResource ) + list.Add( CraftResources.GetLocalizationNumber( m_Resource ) ); // resource name + } public virtual void PlayLitSound() { @@ -180,7 +232,12 @@ namespace Server.Items { base.Serialize( writer ); - writer.Write( (int) 0 ); + writer.Write( (int) 1 ); + + writer.Write( m_Crafter ); + writer.WriteEncodedInt( (int) m_Quality ); + writer.WriteEncodedInt( (int) m_Resource ); + writer.Write( m_BurntOut ); writer.Write( m_Burning ); writer.Write( m_Duration ); @@ -198,6 +255,13 @@ namespace Server.Items switch ( version ) { + case 1: + { + m_Crafter = reader.ReadMobile(); + m_Quality = (CraftQuality)reader.ReadEncodedInt(); + m_Resource = (CraftResource)reader.ReadEncodedInt(); + goto case 0; + } case 0: { m_BurntOut = reader.ReadBool(); @@ -211,6 +275,12 @@ namespace Server.Items break; } } + + if ( version < 1 ) + { + m_Quality = CraftQuality.Regular; + m_Resource = DefaultResource; + } } private class InternalTimer : Timer @@ -229,5 +299,32 @@ namespace Server.Items m_Light.Burn(); } } + + public virtual int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue ) + { + if ( Core.ML ) + { + Quality = (CraftQuality)quality; + + if ( makersMark ) + Crafter = from; + + Type resourceType = typeRes; + + if ( resourceType == null ) + resourceType = craftItem.Resources.GetAt( 0 ).ItemType; + + Resource = CraftResources.GetFromType( resourceType ); + + CraftContext context = craftSystem.GetContext( from ); + + if ( context != null && context.DoNotColor ) + Resource = DefaultResource; + } + else + Resource = DefaultResource; + + return quality; + } } } diff --git a/Scripts/Items/Lights/RedHangingLantern.cs b/Scripts/Items/Lights/RedHangingLantern.cs index 1ed424694..4ee29c3a8 100644 --- a/Scripts/Items/Lights/RedHangingLantern.cs +++ b/Scripts/Items/Lights/RedHangingLantern.cs @@ -28,14 +28,16 @@ namespace Server.Items } } + public override CraftResource DefaultResource{ get{ return CraftResource.RegularWood; } } + [Constructable] - public RedHangingLantern() : base( 0x24C2 ) + public RedHangingLantern() : base( 0x24C4 ) { Movable = true; Duration = TimeSpan.Zero; // Never burnt out Burning = false; Light = LightType.Circle300; - Weight = 3.0; + Weight = 1.0; } public RedHangingLantern( Serial serial ) : base( serial ) @@ -66,6 +68,9 @@ namespace Server.Items { base.Deserialize( reader ); int version = reader.ReadInt(); + + if ( Weight == 3.0 ) + Weight = 1.0; } } } \ No newline at end of file diff --git a/Scripts/Items/Lights/WhiteHangingLantern.cs b/Scripts/Items/Lights/WhiteHangingLantern.cs index e0dcf122a..5ab2d1675 100644 --- a/Scripts/Items/Lights/WhiteHangingLantern.cs +++ b/Scripts/Items/Lights/WhiteHangingLantern.cs @@ -28,14 +28,16 @@ namespace Server.Items } } + public override CraftResource DefaultResource{ get{ return CraftResource.RegularWood; } } + [Constructable] - public WhiteHangingLantern() : base( 0x24C6 ) + public WhiteHangingLantern() : base( 0x24C8 ) { Movable = true; Duration = TimeSpan.Zero; // Never burnt out Burning = false; Light = LightType.Circle300; - Weight = 3.0; + Weight = 1.0; } public WhiteHangingLantern( Serial serial ) : base( serial ) @@ -66,6 +68,9 @@ namespace Server.Items { base.Deserialize( reader ); int version = reader.ReadInt(); + + if ( Weight == 3.0 ) + Weight = 1.0; } } } \ No newline at end of file diff --git a/Scripts/Items/Misc/BaseCraftableItem.cs b/Scripts/Items/Misc/BaseCraftableItem.cs new file mode 100644 index 000000000..827921e86 --- /dev/null +++ b/Scripts/Items/Misc/BaseCraftableItem.cs @@ -0,0 +1,159 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Server.Network; +using Server.Engines.Craft; +using Server.Misc; + +namespace Server.Items +{ + public enum CraftQuality + { + Low, + Regular, + Exceptional + } + + public abstract class BaseCraftableItem : Item, ICraftable + { + private Mobile m_Crafter; + private CraftQuality m_Quality; + private CraftResource m_Resource; + + [CommandProperty( AccessLevel.GameMaster )] + public Mobile Crafter + { + get { return m_Crafter; } + set { m_Crafter = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public CraftQuality Quality + { + get { return m_Quality; } + set { m_Quality = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public CraftResource Resource + { + get { return m_Resource; } + set + { + if ( m_Resource != value ) + { + m_Resource = value; + Hue = CraftResources.GetHue( m_Resource ); + InvalidateProperties(); + } + } + } + + #region Old Item Serialization Vars + /* DO NOT USE! Only used in serialization of furniture that originally derived from Item */ + private bool m_InheritsItem; + private int m_OldVersion; + + protected bool InheritsItem + { + get{ return m_InheritsItem; } + } + + protected int OldVersion + { + get{ return m_OldVersion; } + } + #endregion + + public virtual CraftResource DefaultResource{ get{ return CraftResource.RegularWood; } } + public virtual bool DisplaysResource{ get{ return true; } } + //For odd entries that can be crafted exceptionally with maker's mark but don't actually display a maker's mark + public virtual bool DisplaysMakersMark{ get{ return true; } } + + public BaseCraftableItem( int itemID ) : base( itemID ) + { + m_Quality = CraftQuality.Regular; + Resource = DefaultResource; + } + + public BaseCraftableItem(Serial serial) : base(serial) + { + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_Crafter != null && DisplaysMakersMark ) + list.Add( 1050043, m_Crafter.Name ); // crafted by ~1_NAME~ + + if ( m_Quality == CraftQuality.Exceptional ) + list.Add( 1060636 ); // exceptional + + if( ( m_Resource >= CraftResource.OakWood && m_Resource <= CraftResource.Frostwood ) && Hue == CraftResources.GetHue( m_Resource ) && DisplaysResource ) + list.Add( CraftResources.GetLocalizationNumber( m_Resource ) ); // resource name + } + + public override void Serialize(GenericWriter writer) + { + base.Serialize(writer); + + writer.Write((int) 1); + + writer.Write( m_Crafter ); + writer.WriteEncodedInt( (int) m_Quality ); + writer.WriteEncodedInt( (int) m_Resource ); + } + + public override void Deserialize(GenericReader reader) + { + base.Deserialize(reader); + + int version = reader.ReadInt(); + + switch ( version ) + { + case 1: + { + m_Crafter = reader.ReadMobile(); + m_Quality = (CraftQuality)reader.ReadEncodedInt(); + m_Resource = (CraftResource)reader.ReadEncodedInt(); + break; + } + case 0: + { + m_InheritsItem = true; + m_OldVersion = version; + m_Quality = CraftQuality.Regular; + m_Resource = DefaultResource; + break; + } + } + } + + public virtual int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue ) + { + if ( Core.ML ) + { + Quality = (CraftQuality)quality; + + if ( makersMark ) + Crafter = from; + + Type resourceType = typeRes; + + if ( resourceType == null ) + resourceType = craftItem.Resources.GetAt( 0 ).ItemType; + + Resource = CraftResources.GetFromType( resourceType ); + + CraftContext context = craftSystem.GetContext( from ); + + if ( context != null && context.DoNotColor ) + Hue = 0; + } + + return (int)Quality; + } + } +} diff --git a/Scripts/Items/Misc/BaseOtherEquipable.cs b/Scripts/Items/Misc/BaseOtherEquipable.cs new file mode 100644 index 000000000..1e1bf752d --- /dev/null +++ b/Scripts/Items/Misc/BaseOtherEquipable.cs @@ -0,0 +1,683 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Server.Network; +using Server.Engines.Craft; +using Server.Factions; +using AMA = Server.Items.ArmorMeditationAllowance; +using AMT = Server.Items.ArmorMaterialType; +using ABT = Server.Items.ArmorBodyType; + + +namespace Server.Items +{ + public abstract class BaseOtherEquipable : Item, ICraftable, IAosAttributes + { + private Mobile m_Crafter; + private CraftQuality m_Quality; + private CraftResource m_Resource; + private bool m_PlayerConstructed; + + private AosAttributes m_AosAttributes; + private AosArmorAttributes m_AosArmorAttributes; + private AosSkillBonuses m_AosSkillBonuses; + + private BonusAttribute[] m_BonusRandomAttributes; + private double m_OriginalWeight; + + private int m_StrReq = -1, m_DexReq = -1, m_IntReq = -1; + + public virtual bool AllowMaleWearer{ get{ return true; } } + public virtual bool AllowFemaleWearer{ get{ return true; } } + + public virtual Race RequiredRace { get { return null; } } + + public virtual int AosStrReq{ get{ return 0; } } + public virtual int AosDexReq{ get{ return 0; } } + public virtual int AosIntReq{ get{ return 0; } } + + public virtual int OldStrReq{ get{ return 0; } } + public virtual int OldDexReq{ get{ return 0; } } + public virtual int OldIntReq{ get{ return 0; } } + + public virtual CraftResource DefaultResource{ get{ return CraftResource.RegularWood; } } + + public override void OnAfterDuped( Item newItem ) + { + BaseOtherEquipable otherEquip = newItem as BaseOtherEquipable; + + if ( otherEquip == null ) + return; + + otherEquip.m_AosAttributes = new AosAttributes( newItem, m_AosAttributes ); + otherEquip.m_AosArmorAttributes = new AosArmorAttributes( newItem, m_AosArmorAttributes ); + otherEquip.m_AosSkillBonuses = new AosSkillBonuses( newItem, m_AosSkillBonuses ); + otherEquip.m_BonusRandomAttributes = m_BonusRandomAttributes; + } + + #region Getters/Setters + [CommandProperty( AccessLevel.GameMaster )] + public bool PlayerConstructed + { + get{ return m_PlayerConstructed; } + set{ m_PlayerConstructed = value; } + } + + [CommandProperty( AccessLevel.GameMaster )] + public int StrRequirement + { + get{ return ( m_StrReq == -1 ? Core.AOS ? AosStrReq : OldStrReq : m_StrReq ); } + set{ m_StrReq = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public int DexRequirement + { + get{ return ( m_DexReq == -1 ? Core.AOS ? AosDexReq : OldDexReq : m_DexReq ); } + set{ m_DexReq = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public int IntRequirement + { + get{ return ( m_IntReq == -1 ? Core.AOS ? AosIntReq : OldIntReq : m_IntReq ); } + set{ m_IntReq = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public CraftResource Resource + { + get + { + return m_Resource; + } + set + { + if ( m_Resource != value ) + { + if ( Core.AOS && !CraftResources.IsStandard( m_Resource ) ) + { + BonusAttributesHelper.RemoveAttrsFrom( this, GetResourceBonusAttrs() ); + BonusAttributesHelper.RemoveAttrsFrom( this, RandomAttributes ); + RandomAttributes = null; + } + + m_Resource = value; + Hue = CraftResources.GetHue( m_Resource ); + + if ( Core.AOS && !CraftResources.IsStandard( m_Resource ) ) + { + // Enhance sets RandomAttributes so check if it's null/empty first before getting new random attributes. + if ( RandomAttributes == null || RandomAttributes.Length == 0 ) + RandomAttributes = BonusAttributesHelper.GetRandomAttributes( GetResourceRandomAttrs(), GetResourceAttrs().RandomAttributeCount ); + + BonusAttributesHelper.ApplyAttributesTo( this, GetResourceBonusAttrs() ); + BonusAttributesHelper.ApplyAttributesTo( this, RandomAttributes ); + } + + InvalidateProperties(); + } + } + } + + [CommandProperty( AccessLevel.GameMaster )] + public Mobile Crafter + { + get{ return m_Crafter; } + set{ m_Crafter = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public CraftQuality Quality + { + get{ return m_Quality; } + set{ m_Quality = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public AosAttributes Attributes + { + get{ return m_AosAttributes; } + set{} + } + + [CommandProperty( AccessLevel.GameMaster )] + public AosArmorAttributes ArmorAttributes + { + get{ return m_AosArmorAttributes; } + set{} + } + + public BonusAttribute[] RandomAttributes + { + get { return m_BonusRandomAttributes; } + set { m_BonusRandomAttributes = value; } + } + + #endregion + + #region Old Item Serialization Vars + /* Only used in serialization of other equipables that originally derived from Item */ + private bool m_InheritsItem; + private int m_OldVersion; + + protected bool InheritsItem + { + get{ return m_InheritsItem; } + } + + protected int OldVersion + { + get{ return m_OldVersion; } + } + #endregion + + public CraftAttributeInfo GetResourceAttrs() + { + CraftResourceInfo info = CraftResources.GetInfo( m_Resource ); + + if ( info == null ) + return CraftAttributeInfo.Blank; + + return info.AttributeInfo; + } + + public BonusAttribute[] GetResourceBonusAttrs() + { + CraftAttributeInfo attrInfo = GetResourceAttrs(); + + return attrInfo.OtherAttributes; + } + + public BonusAttribute[] GetResourceRandomAttrs() + { + CraftAttributeInfo attrInfo = GetResourceAttrs(); + + return attrInfo.OtherRandomAttributes; + } + + public int ComputeStatReq( StatType type ) + { + int v; + + if ( type == StatType.Str ) + v = StrRequirement; + else if ( type == StatType.Dex ) + v = DexRequirement; + else + v = IntRequirement; + + return AOS.Scale( v, 100 - GetLowerStatReq() ); + } + + + public BaseOtherEquipable( int itemID ) : base( itemID ) + { + m_Quality = CraftQuality.Regular; + Resource = DefaultResource; + + m_AosAttributes = new AosAttributes( this ); + m_AosArmorAttributes = new AosArmorAttributes( this ); + m_AosSkillBonuses = new AosSkillBonuses( this ); + + m_OriginalWeight = Weight; + } + + public BaseOtherEquipable( Serial serial ) : base( serial ) + { + } + + #region Serialization/Deserialization + private static void SetSaveFlag( ref SaveFlag flags, SaveFlag toSet, bool setIf ) + { + if ( setIf ) + flags |= toSet; + } + + private static bool GetSaveFlag( SaveFlag flags, SaveFlag toGet ) + { + return ( (flags & toGet) != 0 ); + } + + [Flags] + private enum SaveFlag + { + None = 0x00000000, + Attributes = 0x00000001, + ArmorAttributes = 0x00000002, + Crafter = 0x00000004, + Quality = 0x00000008, + Resource = 0x00000010, + StrReq = 0x00000020, + DexReq = 0x00000040, + IntReq = 0x00000080, + SkillBonuses = 0x00000100, + PlayerConstructed = 0x00000200, + BonusRandomAttributes = 0x00000400 + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.Write( (int) 1 ); // version + + SaveFlag flags = SaveFlag.None; + + SetSaveFlag( ref flags, SaveFlag.Attributes, !m_AosAttributes.IsEmpty ); + SetSaveFlag( ref flags, SaveFlag.ArmorAttributes, !m_AosArmorAttributes.IsEmpty ); + SetSaveFlag( ref flags, SaveFlag.Crafter, m_Crafter != null ); + SetSaveFlag( ref flags, SaveFlag.Quality, m_Quality != CraftQuality.Regular ); + SetSaveFlag( ref flags, SaveFlag.Resource, m_Resource != DefaultResource ); + SetSaveFlag( ref flags, SaveFlag.StrReq, m_StrReq != -1 ); + SetSaveFlag( ref flags, SaveFlag.DexReq, m_DexReq != -1 ); + SetSaveFlag( ref flags, SaveFlag.IntReq, m_IntReq != -1 ); + SetSaveFlag( ref flags, SaveFlag.SkillBonuses, !m_AosSkillBonuses.IsEmpty ); + SetSaveFlag( ref flags, SaveFlag.PlayerConstructed, m_PlayerConstructed != false ); + SetSaveFlag( ref flags, SaveFlag.BonusRandomAttributes, m_BonusRandomAttributes != null && m_BonusRandomAttributes.Length > 0 ); + + writer.WriteEncodedInt( (int) flags ); + + if ( GetSaveFlag( flags, SaveFlag.Attributes ) ) + m_AosAttributes.Serialize( writer ); + + if ( GetSaveFlag( flags, SaveFlag.ArmorAttributes ) ) + m_AosArmorAttributes.Serialize( writer ); + + if ( GetSaveFlag( flags, SaveFlag.Crafter ) ) + writer.Write( (Mobile) m_Crafter ); + + if ( GetSaveFlag( flags, SaveFlag.Quality ) ) + writer.WriteEncodedInt( (int) m_Quality ); + + if ( GetSaveFlag( flags, SaveFlag.Resource ) ) + writer.WriteEncodedInt( (int) m_Resource ); + + if ( GetSaveFlag( flags, SaveFlag.StrReq ) ) + writer.WriteEncodedInt( (int) m_StrReq ); + + if ( GetSaveFlag( flags, SaveFlag.DexReq ) ) + writer.WriteEncodedInt( (int) m_DexReq ); + + if ( GetSaveFlag( flags, SaveFlag.IntReq ) ) + writer.WriteEncodedInt( (int) m_IntReq ); + + if ( GetSaveFlag( flags, SaveFlag.SkillBonuses ) ) + m_AosSkillBonuses.Serialize( writer ); + + if ( GetSaveFlag( flags, SaveFlag.BonusRandomAttributes ) ) + { + writer.Write( m_BonusRandomAttributes.Length ); + for ( int i = 0; i < m_BonusRandomAttributes.Length; i++ ) + m_BonusRandomAttributes[i].Serialize( writer ); + } + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadInt(); + + switch ( version ) + { + case 1: + { + SaveFlag flags = (SaveFlag)reader.ReadEncodedInt(); + + if ( GetSaveFlag( flags, SaveFlag.Attributes ) ) + m_AosAttributes = new AosAttributes( this, reader ); + else + m_AosAttributes = new AosAttributes( this ); + + if ( GetSaveFlag( flags, SaveFlag.ArmorAttributes ) ) + m_AosArmorAttributes = new AosArmorAttributes( this, reader ); + else + m_AosArmorAttributes = new AosArmorAttributes( this ); + + if ( GetSaveFlag( flags, SaveFlag.Crafter ) ) + m_Crafter = reader.ReadMobile(); + + if ( GetSaveFlag( flags, SaveFlag.Quality ) ) + m_Quality = (CraftQuality)reader.ReadEncodedInt(); + else + m_Quality = CraftQuality.Regular; + + if ( GetSaveFlag( flags, SaveFlag.Resource ) ) + m_Resource = (CraftResource)reader.ReadEncodedInt(); + else + m_Resource = DefaultResource; + + if ( m_Resource == CraftResource.None ) + m_Resource = DefaultResource; + + if ( GetSaveFlag( flags, SaveFlag.StrReq ) ) + m_StrReq = reader.ReadEncodedInt(); + else + m_StrReq = -1; + + if ( GetSaveFlag( flags, SaveFlag.DexReq ) ) + m_DexReq = reader.ReadEncodedInt(); + else + m_DexReq = -1; + + if ( GetSaveFlag( flags, SaveFlag.IntReq ) ) + m_IntReq = reader.ReadEncodedInt(); + else + m_IntReq = -1; + + if ( GetSaveFlag( flags, SaveFlag.SkillBonuses ) ) + m_AosSkillBonuses = new AosSkillBonuses( this, reader ); + + if ( GetSaveFlag( flags, SaveFlag.PlayerConstructed ) ) + m_PlayerConstructed = true; + + if ( GetSaveFlag( flags, SaveFlag.BonusRandomAttributes ) ) + { + m_BonusRandomAttributes = new BonusAttribute[reader.ReadInt()]; + + for( int i = 0; i < m_BonusRandomAttributes.Length; i++ ) + m_BonusRandomAttributes[i] = new BonusAttribute( reader ); + } + + break; + } + case 0: + { + m_InheritsItem = true; + m_OldVersion = version; + m_AosAttributes = new AosAttributes( this ); + m_AosArmorAttributes = new AosArmorAttributes( this ); + m_Quality = CraftQuality.Regular; + m_Resource = DefaultResource; + m_PlayerConstructed = true; + break; + } + } + + if ( m_AosSkillBonuses == null ) + m_AosSkillBonuses = new AosSkillBonuses( this ); + + if ( Core.AOS && Parent is Mobile ) + m_AosSkillBonuses.AddTo( (Mobile)Parent ); + + if ( Parent is Mobile ) + ((Mobile)Parent).CheckStatTimers(); + } + #endregion + + public int GetLowerStatReq() + { + if ( !Core.AOS ) + return 0; + + int v = m_AosArmorAttributes.LowerStatReq; + + if ( v > 100 ) + v = 100; + + return v; + } + + public void ModifyWeight() + { + double v = 0; + + v = 100 - GetWeightBonus(); + + Weight = m_OriginalWeight * (v / 100); + } + + public int GetWeightBonus() + { + CraftAttributeInfo attrInfo = GetResourceAttrs(); + + int v = Attributes.LowerWeight; + + if ( v > 100 ) + v = 100; + + return v; + } + + public override bool CanEquip( Mobile from ) + { + if( !Ethics.Ethic.CheckEquip( from, this ) ) + return false; + + if( from.AccessLevel < AccessLevel.GameMaster ) + { + if( RequiredRace != null && from.Race != RequiredRace ) + { + if( RequiredRace == Race.Elf ) + from.SendLocalizedMessage( 1072203 ); // Only Elves may use this. + else + from.SendMessage( "Only {0} may use this.", RequiredRace.PluralName ); + + return false; + } + else if( !AllowMaleWearer && !from.Female ) + { + if( AllowFemaleWearer ) + from.SendLocalizedMessage( 1010388 ); // Only females can wear this. + else + from.SendMessage( "You may not wear this." ); + + return false; + } + else if( !AllowFemaleWearer && from.Female ) + { + if( AllowMaleWearer ) + from.SendLocalizedMessage( 1063343 ); // Only males can wear this. + else + from.SendMessage( "You may not wear this." ); + + return false; + } + else + { + int strReq = ComputeStatReq( StatType.Str ); + int dexReq = ComputeStatReq( StatType.Dex ); + int intReq = ComputeStatReq( StatType.Int ); + + if( from.Dex < dexReq ) + { + from.SendLocalizedMessage( 502077 ); // You do not have enough dexterity to equip this item. + return false; + } + else if( from.Str < strReq ) + { + from.SendLocalizedMessage( 500213 ); // You are not strong enough to equip that. + return false; + } + else if( from.Int < intReq ) + { + from.SendMessage( "You are not smart enough to equip that." ); + return false; + } + } + } + + return base.CanEquip( from ); + } + + public override bool OnEquip( Mobile from ) + { + from.CheckStatTimers(); + + int strBonus = m_AosAttributes.BonusStr; + int dexBonus = m_AosAttributes.BonusDex; + int intBonus = m_AosAttributes.BonusInt; + + if ( strBonus != 0 || dexBonus != 0 || intBonus != 0 ) + { + string modName = this.Serial.ToString(); + + if ( strBonus != 0 ) + from.AddStatMod( new StatMod( StatType.Str, modName + "Str", strBonus, TimeSpan.Zero ) ); + + if ( dexBonus != 0 ) + from.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) ); + + if ( intBonus != 0 ) + from.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) ); + } + + return base.OnEquip( from ); + } + + public override void OnAdded( object parent ) + { + if ( parent is Mobile ) + { + Mobile from = (Mobile)parent; + + if ( Core.AOS ) + m_AosSkillBonuses.AddTo( from ); + } + } + + public override void OnRemoved( object parent ) + { + if ( parent is Mobile ) + { + Mobile m = (Mobile)parent; + string modName = this.Serial.ToString(); + + m.RemoveStatMod( modName + "Str" ); + m.RemoveStatMod( modName + "Dex" ); + m.RemoveStatMod( modName + "Int" ); + + if ( Core.AOS ) + m_AosSkillBonuses.Remove(); + + m.CheckStatTimers(); + } + + base.OnRemoved( parent ); + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_Crafter != null ) + list.Add( 1050043, m_Crafter.Name ); // crafted by ~1_NAME~ + + if ( m_Quality == CraftQuality.Exceptional ) + list.Add( 1060636 ); // exceptional + + if ( m_AosSkillBonuses != null ) + m_AosSkillBonuses.GetProperties( list ); + + int prop; + + if ( ( m_Resource >= CraftResource.OakWood && m_Resource <= CraftResource.Frostwood ) && Hue == CraftResources.GetHue( m_Resource ) ) + list.Add( CraftResources.GetLocalizationNumber( m_Resource ) ); + + if ( (prop = m_AosAttributes.WeaponDamage) != 0 ) + list.Add( 1060401, prop.ToString() ); // damage increase ~1_val~% + + if ( (prop = m_AosAttributes.DefendChance) != 0 ) + list.Add( 1060408, prop.ToString() ); // defense chance increase ~1_val~% + + if ( (prop = m_AosAttributes.BonusDex ) != 0 ) + list.Add( 1060409, prop.ToString() ); // dexterity bonus ~1_val~ + + if ( (prop = m_AosAttributes.EnhancePotions) != 0 ) + list.Add( 1060411, prop.ToString() ); // enhance potions ~1_val~% + + if ( (prop = m_AosAttributes.CastRecovery) != 0 ) + list.Add( 1060412, prop.ToString() ); // faster cast recovery ~1_val~ + + if ( (prop = m_AosAttributes.CastSpeed) != 0 ) + list.Add( 1060413, prop.ToString() ); // faster casting ~1_val~ + + if ( (prop = m_AosAttributes.AttackChance) != 0 ) + list.Add( 1060415, prop.ToString() ); // hit chance increase ~1_val~% + + if ( (prop = m_AosAttributes.BonusHits) != 0 ) + list.Add( 1060431, prop.ToString() ); // hit point increase ~1_val~ + + if ( (prop = m_AosAttributes.BonusInt) != 0 ) + list.Add( 1060432, prop.ToString() ); // intelligence bonus ~1_val~ + + if ( (prop = m_AosAttributes.LowerManaCost) != 0 ) + list.Add( 1060433, prop.ToString() ); // lower mana cost ~1_val~% + + if ( (prop = m_AosAttributes.LowerRegCost) != 0 ) + list.Add( 1060434, prop.ToString() ); // lower reagent cost ~1_val~% + + if ( (prop = GetLowerStatReq()) != 0 ) + list.Add( 1060435, prop.ToString() ); // lower requirements ~1_val~% + + if ( (prop = m_AosAttributes.Luck) != 0 ) + list.Add( 1060436, prop.ToString() ); // luck ~1_val~ + + if ( (prop = m_AosAttributes.BonusMana) != 0 ) + list.Add( 1060439, prop.ToString() ); // mana increase ~1_val~ + + if ( (prop = m_AosAttributes.RegenMana) != 0 ) + list.Add( 1060440, prop.ToString() ); // mana regeneration ~1_val~ + + if ( (prop = m_AosAttributes.NightSight) != 0 ) + list.Add( 1060441 ); // night sight + + if ( (prop = m_AosAttributes.ReflectPhysical) != 0 ) + list.Add( 1060442, prop.ToString() ); // reflect physical damage ~1_val~% + + if ( (prop = m_AosAttributes.RegenStam) != 0 ) + list.Add( 1060443, prop.ToString() ); // stamina regeneration ~1_val~ + + if ( (prop = m_AosAttributes.RegenHits) != 0 ) + list.Add( 1060444, prop.ToString() ); // hit point regeneration ~1_val~ + + if ( (prop = m_AosAttributes.SpellChanneling) != 0 ) + list.Add( 1060482 ); // spell channeling + + if ( (prop = m_AosAttributes.SpellDamage) != 0 ) + list.Add( 1060483, prop.ToString() ); // spell damage increase ~1_val~% + + if ( (prop = m_AosAttributes.BonusStam) != 0 ) + list.Add( 1060484, prop.ToString() ); // stamina increase ~1_val~ + + if ( (prop = m_AosAttributes.BonusStr) != 0 ) + list.Add( 1060485, prop.ToString() ); // strength bonus ~1_val~ + + if ( (prop = m_AosAttributes.WeaponSpeed) != 0 ) + list.Add( 1060486, prop.ToString() ); // swing speed increase ~1_val~% + + if ( (prop = ComputeStatReq( StatType.Str )) > 0 ) + list.Add( 1061170, prop.ToString() ); // strength requirement ~1_val~ + } + + #region ICraftable Members + + public virtual int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue ) + { + if ( Core.ML ) + { + Quality = (CraftQuality)quality; + + if ( makersMark ) + Crafter = from; + + Type resourceType = typeRes; + + if ( resourceType == null ) + resourceType = craftItem.Resources.GetAt( 0 ).ItemType; + + Resource = CraftResources.GetFromType( resourceType ); + PlayerConstructed = true; + + CraftContext context = craftSystem.GetContext( from ); + + if ( context != null && context.DoNotColor ) + Hue = 0; + } + + return quality; + } + #endregion + } +} diff --git a/Scripts/Items/Misc/BonusAttribute.cs b/Scripts/Items/Misc/BonusAttribute.cs new file mode 100644 index 000000000..482e39bb3 --- /dev/null +++ b/Scripts/Items/Misc/BonusAttribute.cs @@ -0,0 +1,416 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Server.Items; + +namespace Server +{ + public static class BonusAttributesHelper + { + #region Random Attributes + + /// + /// Returns a array populated with one unique random attribute + /// chosen from '' array -or- returns null if a null or empty array is supplied. + /// + public static BonusAttribute[] GetRandomAttributes( BonusAttribute[] randAttrs ) + { + return GetRandomAttributes( randAttrs, 1 ); + } + + /// + /// Returns a array populated with '' unique random attributes + /// chosen from '' array -or- returns null if a null or empty array is supplied. + /// + public static BonusAttribute[] GetRandomAttributes( BonusAttribute[] randAttrs, int numOfAttr ) + { + BonusAttribute[] toAttrs = null; + + if ( randAttrs != null && randAttrs.Length > 0 && numOfAttr > 0) + { + toAttrs = new BonusAttribute[numOfAttr]; + + int avail = 0; + + List numList = new List(); + + for ( int i = 0; i < randAttrs.Length; ++i ) + numList.Add( avail++ ); + + if ( numOfAttr > randAttrs.Length ) + numOfAttr = randAttrs.Length; + + int v; + + for ( int i = 0; i < numOfAttr; ++i ) + { + v = Utility.Random(avail--); + + toAttrs[i] = randAttrs[numList[v]]; + + numList.RemoveAt(v); + } + } + + return toAttrs; + } + #endregion + + #region Apply Attributes + public static void ApplyAttributesTo( Item item, BonusAttribute[] attributes ) + { + if ( attributes != null && attributes.Length > 0 ) + { + int cold = 0, nrgy = 0, fire = 0, pois = 0, chaos = 0, direct = 0; + + for ( int i = 0; i < attributes.Length; i++ ) + { + if ( attributes[i].Attribute == null ) + continue; + + Type attrType = attributes[i].Attribute.GetType(); + + if ( attrType == typeof( AosAttribute ) ) + { + if ( item is IAosAttributes ) + ApplyAttribute( ((IAosAttributes)item).Attributes, (AosAttribute)attributes[i].Attribute, attributes[i].Amount ); + } + else if ( attrType == typeof( AosArmorAttribute ) ) + { + if ( (AosArmorAttribute)attributes[i].Attribute == AosArmorAttribute.DurabilityBonus ) + ApplyDurability( item, attributes[i].Amount ); + else if ( item is BaseArmor ) + ApplyAttribute( ((BaseArmor)item).ArmorAttributes, (AosArmorAttribute)attributes[i].Attribute, attributes[i].Amount ); + else if ( item is BaseOtherEquipable ) + ApplyAttribute( ((BaseOtherEquipable)item).ArmorAttributes, (AosArmorAttribute)attributes[i].Attribute, attributes[i].Amount ); + } + else if ( attrType == typeof( AosWeaponAttribute ) ) + { + if ( (AosWeaponAttribute)attributes[i].Attribute == AosWeaponAttribute.DurabilityBonus ) + ApplyDurability( item, attributes[i].Amount ); + else if ( item is BaseWeapon ) + ApplyAttribute( ((BaseWeapon)item).WeaponAttributes, (AosWeaponAttribute)attributes[i].Attribute, attributes[i].Amount ); + } + else if ( attrType == typeof( AosElementAttribute ) ) + { + if ( item is BaseWeapon ) + { + switch ( (AosElementAttribute)attributes[i].Attribute ) + { + case AosElementAttribute.Cold: cold = attributes[i].Amount; break; + case AosElementAttribute.Energy: nrgy = attributes[i].Amount; break; + case AosElementAttribute.Fire: fire = attributes[i].Amount; break; + case AosElementAttribute.Poison: pois = attributes[i].Amount; break; + case AosElementAttribute.Chaos: chaos = attributes[i].Amount; break; + case AosElementAttribute.Direct: direct = attributes[i].Amount; break; + } + } + } + else if ( attrType == typeof( ResistanceType ) ) + { + if ( item is BaseArmor ) + ApplyResistance( (BaseArmor)item, (ResistanceType)attributes[i].Attribute, attributes[i].Amount ); + } + } + + if ( item is BaseWeapon ) + ApplyElementDamages( (BaseWeapon)item, cold, nrgy, fire, pois, chaos, direct ); + } + } + + public static void ApplyAttribute( AosAttributes attrs, AosAttribute attr, int amount ) + { + if ( attr == AosAttribute.SpellChanneling && attrs.SpellChanneling == 0 ) + { + attrs[attr] = 1; + attrs.CastSpeed--; + } + else + attrs[attr] += amount; + } + + public static void ApplyAttribute( AosArmorAttributes attrs, AosArmorAttribute attr, int amount ) + { + if ( attr == AosArmorAttribute.MageArmor && attrs.MageArmor == 0 ) + attrs[attr] = 1; + else + attrs[attr] += amount; + } + + public static void ApplyAttribute( AosWeaponAttributes attrs, AosWeaponAttribute attr, int amount ) + { + attrs[attr] += amount; + } + + public static void ApplyAttribute( AosElementAttributes attrs, AosElementAttribute attr, int amount ) + { + attrs[attr] += amount; + } + + public static void ApplyElementDamages( BaseWeapon weapon, int cold, int nrgy, int fire, int pois, int chaos, int direct ) + { + + int weapPhys, weapCold, weapNrgy, weapFire, weapPois, weapChaos, weapDirect; + + weapon.GetDamageTypes( null, out weapPhys, out weapFire, out weapCold, out weapPois, out weapNrgy, out weapChaos, out weapDirect ); + + weapPhys = weapon.ApplyAttributeElementDamage( cold, ref weapCold, weapPhys ); + weapPhys = weapon.ApplyAttributeElementDamage( nrgy, ref weapNrgy, weapPhys ); + weapPhys = weapon.ApplyAttributeElementDamage( fire, ref weapFire, weapPhys ); + weapPhys = weapon.ApplyAttributeElementDamage( pois, ref weapPois, weapPhys ); + weapPhys = weapon.ApplyAttributeElementDamage( chaos, ref weapChaos, weapPhys ); + weapPhys = weapon.ApplyAttributeElementDamage( direct, ref weapDirect, weapPhys ); + + weapon.AosElementDamages.Physical = weapPhys; + weapon.AosElementDamages.Cold = weapCold; + weapon.AosElementDamages.Energy = weapNrgy; + weapon.AosElementDamages.Fire = weapFire; + weapon.AosElementDamages.Poison = weapPois; + weapon.AosElementDamages.Chaos = weapChaos; + weapon.AosElementDamages.Direct = weapDirect; + } + + public static void ApplyResistance( BaseArmor ar, ResistanceType res, int amount ) + { + switch ( res ) + { + case ResistanceType.Physical: ar.PhysicalBonus += amount; break; + case ResistanceType.Fire: ar.FireBonus += amount; break; + case ResistanceType.Cold: ar.ColdBonus += amount; break; + case ResistanceType.Poison: ar.PoisonBonus += amount; break; + case ResistanceType.Energy: ar.EnergyBonus += amount; break; + } + } + + public static void ApplyDurability( Item item, int amount ) + { + if ( item is IDurability ) + { + IDurability durableItem = (IDurability)item; + + durableItem.MaxHitPoints = ( ( 100 + amount ) * durableItem.MaxHitPoints ) / 100; + + if ( durableItem.MaxHitPoints > 255 ) + durableItem.MaxHitPoints = 255; + + durableItem.HitPoints = durableItem.MaxHitPoints; // Item is repaired upon enhancing + } + } + #endregion + + #region Remove Attributes + public static void RemoveAttrsFrom( Item item, BonusAttribute[] attributes ) + { + if ( attributes != null && attributes.Length > 0 ) + { + int cold = 0, nrgy = 0, fire = 0, pois = 0, chaos = 0, direct = 0; + + for ( int i = 0; i < attributes.Length; i++ ) + { + if ( attributes[i].Attribute == null ) + continue; + + Type attrType = attributes[i].Attribute.GetType(); + + if ( attrType == typeof( AosAttribute ) ) + { + if ( item is IAosAttributes ) + RemoveAttribute( ((IAosAttributes)item).Attributes, (AosAttribute)attributes[i].Attribute, attributes[i].Amount ); + } + else if ( attrType == typeof( AosArmorAttribute ) ) + { + if ( (AosArmorAttribute)attributes[i].Attribute == AosArmorAttribute.DurabilityBonus ) + RemoveDurability( item, attributes[i].Amount ); + else if ( item is BaseArmor ) + RemoveAttribute( ((BaseArmor)item).ArmorAttributes, (AosArmorAttribute)attributes[i].Attribute, attributes[i].Amount ); + else if ( item is BaseOtherEquipable ) + RemoveAttribute( ((BaseOtherEquipable)item).ArmorAttributes, (AosArmorAttribute)attributes[i].Attribute, attributes[i].Amount ); + } + else if ( attrType == typeof( AosWeaponAttribute ) ) + { + if ( (AosWeaponAttribute)attributes[i].Attribute == AosWeaponAttribute.DurabilityBonus ) + RemoveDurability( item, attributes[i].Amount ); + else if ( item is BaseWeapon ) + RemoveAttribute( ((BaseWeapon)item).WeaponAttributes, (AosWeaponAttribute)attributes[i].Attribute, attributes[i].Amount ); + } + else if ( attrType == typeof( AosElementAttribute ) ) + { + if ( item is BaseWeapon ) + { + switch ( (AosElementAttribute)attributes[i].Attribute ) + { + case AosElementAttribute.Cold: cold = attributes[i].Amount; break; + case AosElementAttribute.Energy: nrgy = attributes[i].Amount; break; + case AosElementAttribute.Fire: fire = attributes[i].Amount; break; + case AosElementAttribute.Poison: pois = attributes[i].Amount; break; + case AosElementAttribute.Chaos: chaos = attributes[i].Amount; break; + case AosElementAttribute.Direct: direct = attributes[i].Amount; break; + } + } + } + else if ( attrType == typeof( ResistanceType ) ) + { + if ( item is BaseArmor ) + RemoveResistance( (BaseArmor)item, (ResistanceType)attributes[i].Attribute, attributes[i].Amount ); + } + } + + if ( item is BaseWeapon ) + RemoveElementDamages( (BaseWeapon)item, cold, nrgy, fire, pois, chaos, direct ); + } + } + + public static void RemoveAttribute( AosAttributes attrs, AosAttribute attr, int amount ) + { + if ( attr == AosAttribute.SpellChanneling && attrs.SpellChanneling > 0 ) + { + attrs[attr] = 0; + attrs.CastSpeed++; + } + else + attrs[attr] = Math.Max( attrs[attr] - amount, 0 ); + } + + public static void RemoveAttribute( AosArmorAttributes attrs, AosArmorAttribute attr, int amount ) + { + if ( attr == AosArmorAttribute.MageArmor && attrs.MageArmor > 0 ) + attrs[attr] = 0; + else + attrs[attr] = Math.Max( attrs[attr] - amount, 0 ); + } + + public static void RemoveAttribute( AosWeaponAttributes attrs, AosWeaponAttribute attr, int amount ) + { + attrs[attr] = Math.Max( attrs[attr] - amount, 0 ); + } + + public static void RemoveAttribute( AosElementAttributes attrs, AosElementAttribute attr, int amount ) + { + attrs[attr] = Math.Max( attrs[attr] - amount, 0 ); + } + + public static void RemoveElementDamages( BaseWeapon weapon, int cold, int nrgy, int fire, int pois, int chaos, int direct ) + { + + int weapPhys, weapCold, weapNrgy, weapFire, weapPois, weapChaos, weapDirect; + + weapon.GetDamageTypes( null, out weapPhys, out weapFire, out weapCold, out weapPois, out weapNrgy, out weapChaos, out weapDirect ); + + // Remove the element damages in reverse order they were applied in. + + weapPhys = weapon.RemoveAttributeElementDamage( direct, ref weapDirect, weapPhys ); + weapPhys = weapon.RemoveAttributeElementDamage( chaos, ref weapChaos, weapPhys ); + weapPhys = weapon.RemoveAttributeElementDamage( pois, ref weapPois, weapPhys ); + weapPhys = weapon.RemoveAttributeElementDamage( fire, ref weapFire, weapPhys ); + weapPhys = weapon.RemoveAttributeElementDamage( nrgy, ref weapNrgy, weapPhys ); + weapPhys = weapon.RemoveAttributeElementDamage( cold, ref weapCold, weapPhys ); + + weapon.AosElementDamages.Physical = weapPhys; + weapon.AosElementDamages.Cold = weapCold; + weapon.AosElementDamages.Energy = weapNrgy; + weapon.AosElementDamages.Fire = weapFire; + weapon.AosElementDamages.Poison = weapPois; + weapon.AosElementDamages.Chaos = weapChaos; + weapon.AosElementDamages.Direct = weapDirect; + } + + public static void RemoveResistance( BaseArmor ar, ResistanceType res, int amount ) + { + switch ( res ) + { + case ResistanceType.Physical: ar.PhysicalBonus = Math.Max( ar.PhysicalBonus - amount, 0 ); break; + case ResistanceType.Fire: ar.FireBonus = Math.Max( ar.ColdBonus - amount, 0 ); break; + case ResistanceType.Cold: ar.ColdBonus = Math.Max( ar.FireBonus - amount, 0 ); break; + case ResistanceType.Poison: ar.PoisonBonus = Math.Max( ar.PoisonBonus - amount, 0 ); break; + case ResistanceType.Energy: ar.EnergyBonus = Math.Max( ar.EnergyBonus - amount, 0 ); break; + } + } + + public static void RemoveDurability( Item item, int amount ) + { + if ( item is IDurability ) + { + IDurability durableItem = (IDurability)item; + + durableItem.MaxHitPoints = ( ( 100 + amount ) * durableItem.MaxHitPoints ) / 100; + durableItem.HitPoints = durableItem.MaxHitPoints; + } + } + #endregion + } + + public sealed class BonusAttribute + { + private object m_Attribute; + private int m_Amount; + + public object Attribute{ get{ return m_Attribute; } } + public int Amount{ get{ return m_Amount; } } + + #region Constructors + public BonusAttribute( AosAttribute attr, int amount ) : this( (object)attr, amount ) + { + } + + public BonusAttribute( AosArmorAttribute attr, int amount ) : this( (object)attr, amount ) + { + } + + public BonusAttribute( AosWeaponAttribute attr, int amount ) : this( (object)attr, amount ) + { + } + + public BonusAttribute( AosElementAttribute attr, int amount ) : this( (object)attr, amount ) + { + } + + public BonusAttribute( ResistanceType attr, int amount ) : this( (object)attr, amount ) + { + } + + private BonusAttribute( object attr, int amount ) + { + m_Attribute = attr; + m_Amount = amount; + } + + public BonusAttribute( GenericReader reader ) + { + Deserialize( reader ); + } + #endregion + + public void Serialize( GenericWriter writer ) + { + writer.Write( (int) 0 ); // version + + writer.Write( m_Attribute.GetType().ToString() ); // Enum type + writer.Write( m_Attribute.ToString() ); // Enum value + writer.Write( (int) m_Amount ); + } + + public void Deserialize( GenericReader reader ) + { + int version = reader.ReadInt(); + + switch ( version ) + { + case 0: + { + string type = reader.ReadString(); + string enumValue = reader.ReadString(); + + try { + m_Attribute = Enum.Parse( Type.GetType( type ), enumValue ); + } + catch { + Console.WriteLine( "Unable to create Enum of type {0} with value of {1}.", type, enumValue ); + } + + m_Amount = reader.ReadInt(); + break; + } + } + } + } +} diff --git a/Scripts/Items/Misc/FlipableAttribute.cs b/Scripts/Items/Misc/FlipableAttribute.cs index adac01da5..4ffe852a3 100644 --- a/Scripts/Items/Misc/FlipableAttribute.cs +++ b/Scripts/Items/Misc/FlipableAttribute.cs @@ -65,19 +65,31 @@ namespace Server.Items public class FlipableAttribute : Attribute { private int[] m_ItemIDs; + private bool m_IsDynamicFlipable; public int[] ItemIDs { get { return m_ItemIDs; } } + + public bool IsDynamicFlipable + { + get { return m_IsDynamicFlipable; } + } public FlipableAttribute() : this( null ) { } - public FlipableAttribute( params int[] itemIDs ) + public FlipableAttribute( params int[] itemIDs ) + : this( true, itemIDs ) { + } + + public FlipableAttribute( bool isDynamicFlipable, params int[] itemIDs) + { + m_IsDynamicFlipable = isDynamicFlipable; m_ItemIDs = itemIDs; } diff --git a/Scripts/Items/Misc/PlayerBulletinBoards.cs b/Scripts/Items/Misc/PlayerBulletinBoards.cs index abbd4f815..1ad739125 100644 --- a/Scripts/Items/Misc/PlayerBulletinBoards.cs +++ b/Scripts/Items/Misc/PlayerBulletinBoards.cs @@ -8,9 +8,11 @@ using Server.Prompts; using Server.Mobiles; using Server.Network; using Server.ContextMenus; +using Server.Engines.Craft; namespace Server.Items { + [CraftItemID( 0x2311 )] public class PlayerBBSouth : BasePlayerBB { public override int LabelNumber{ get{ return 1062421; } } // bulletin board (south) @@ -40,6 +42,7 @@ namespace Server.Items } } + [CraftItemID( 0x2312 )] public class PlayerBBEast : BasePlayerBB { public override int LabelNumber{ get{ return 1062420; } } // bulletin board (east) @@ -69,12 +72,15 @@ namespace Server.Items } } - public abstract class BasePlayerBB : Item, ISecurable + public abstract class BasePlayerBB : Item, ISecurable, ICraftable { private PlayerBBMessage m_Greeting; private List m_Messages; private string m_Title; private SecureLevel m_Level; + + private Mobile m_Crafter; + private CraftQuality m_Quality; public List Messages { @@ -100,6 +106,20 @@ namespace Server.Items get{ return m_Level; } set{ m_Level = value; } } + + [CommandProperty( AccessLevel.GameMaster )] + public Mobile Crafter + { + get { return m_Crafter; } + set { m_Crafter = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public CraftQuality Quality + { + get { return m_Quality; } + set { m_Quality = value; InvalidateProperties(); } + } public BasePlayerBB( int itemID ) : base( itemID ) { @@ -110,6 +130,17 @@ namespace Server.Items public BasePlayerBB( Serial serial ) : base( serial ) { } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_Crafter != null ) + list.Add( 1050043, m_Crafter.Name ); // crafted by ~1_NAME~ + + if ( m_Quality == CraftQuality.Exceptional ) + list.Add( 1060636 ); // exceptional + } public override void GetContextMenuEntries( Mobile from, List list ) { @@ -121,7 +152,10 @@ namespace Server.Items { base.Serialize( writer ); - writer.Write( (int) 1 ); + writer.Write( (int) 2 ); + + writer.Write( m_Crafter ); + writer.WriteEncodedInt( (int) m_Quality ); writer.Write( (int) m_Level ); @@ -151,6 +185,12 @@ namespace Server.Items switch ( version ) { + case 2: + { + m_Crafter = reader.ReadMobile(); + m_Quality = (CraftQuality)reader.ReadEncodedInt(); + goto case 1; + } case 1: { m_Level = (SecureLevel)reader.ReadInt(); @@ -160,6 +200,9 @@ namespace Server.Items { if ( version < 1 ) m_Level = SecureLevel.Anyone; + + if ( version < 2 ) + m_Quality = CraftQuality.Regular; m_Title = reader.ReadString(); @@ -175,7 +218,7 @@ namespace Server.Items break; } - } + } } public static bool CheckAccess( BaseHouse house, Mobile from ) @@ -197,6 +240,31 @@ namespace Server.Items else if ( CheckAccess( house, from ) ) from.SendGump( new PlayerBBGump( from, house, this, 0 ) ); } + + public virtual int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue ) + { + if ( Core.ML ) + { + Quality = (CraftQuality)quality; + + if ( makersMark ) + Crafter = from; + + Type resourceType = typeRes; + + if ( resourceType == null ) + resourceType = craftItem.Resources.GetAt( 0 ).ItemType; + + Hue = CraftResources.GetHue( CraftResources.GetFromType( resourceType ) ); + + CraftContext context = craftSystem.GetContext( from ); + + if ( context != null && context.DoNotColor ) + Hue = 0; + } + + return quality; + } public class PostPrompt : Prompt { diff --git a/Scripts/Items/Shields/WoodenShield.cs b/Scripts/Items/Shields/WoodenShield.cs index 188777d45..f5feb0c70 100644 --- a/Scripts/Items/Shields/WoodenShield.cs +++ b/Scripts/Items/Shields/WoodenShield.cs @@ -17,6 +17,8 @@ namespace Server.Items public override int AosStrReq{ get{ return 20; } } public override int ArmorBase{ get{ return 8; } } + + public override bool UsesShieldAttrs{ get{ return true; } } [Constructable] public WoodenShield() : base( 0x1B7A ) diff --git a/Scripts/Items/Skill Items/Carpenter Items/Board.cs b/Scripts/Items/Skill Items/Carpenter Items/Board.cs index 9e83cea38..af648599e 100644 --- a/Scripts/Items/Skill Items/Carpenter Items/Board.cs +++ b/Scripts/Items/Skill Items/Carpenter Items/Board.cs @@ -3,7 +3,7 @@ using System; namespace Server.Items { [FlipableAttribute( 0x1BD7, 0x1BDA )] - public class Board : Item, ICommodity + public abstract class BaseBoard : Item, ICommodity { private CraftResource m_Resource; @@ -13,6 +13,22 @@ namespace Server.Items get { return m_Resource; } set { m_Resource = value; InvalidateProperties(); } } + + #region Old Board Serialization Vars + /* DO NOT USE! Only used in serialization of boards that originally derived from Board */ + private bool m_InheritsItem; + private int m_OldVersion; + + protected bool InheritsItem + { + get{ return m_InheritsItem; } + } + + protected int OldVersion + { + get{ return m_OldVersion; } + } + #endregion string ICommodity.Description { @@ -40,30 +56,12 @@ namespace Server.Items } } - [Constructable] - public Board() - : this( 1 ) - { - } - - [Constructable] - public Board( int amount ) - : this( CraftResource.RegularWood, amount ) - { - } - - public Board( Serial serial ) + public BaseBoard( Serial serial ) : base( serial ) { } - [Constructable] - public Board( CraftResource resource ) : this( resource, 1 ) - { - } - - [Constructable] - public Board( CraftResource resource, int amount ) + public BaseBoard( CraftResource resource, int amount ) : base( 0x1BD7 ) { Stackable = true; @@ -94,7 +92,7 @@ namespace Server.Items { base.Serialize( writer ); - writer.Write( (int) 3 ); + writer.Write( (int) 4 ); writer.Write( (int)m_Resource ); } @@ -107,24 +105,79 @@ namespace Server.Items switch ( version ) { - case 3: + case 4: + { + m_Resource = (CraftResource)reader.ReadInt(); + break; + } + /** Below is for deserialization of old boards that orignally inherited from Board or Item **/ + case 3: // For all boards case 2: - { - m_Resource = (CraftResource)reader.ReadInt(); - break; - } + { + m_Resource = (CraftResource)reader.ReadInt(); + goto case 0; + } + case 1: // For old standard boards + case 0: + { + m_InheritsItem = true; + m_OldVersion = version; + break; + } } if ( (version == 0 && Weight == 0.1) || ( version <= 2 && Weight == 2 ) ) Weight = -1; + } + } + + public class Board : BaseBoard + { + [Constructable] + public Board() + : this( 1 ) + { + } - if ( version <= 1 ) - m_Resource = CraftResource.RegularWood; + [Constructable] + public Board( int amount ) + : base( CraftResource.RegularWood, amount ) + { + } + + public Board( Serial serial ) + : base( serial ) + { + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.Write( (int) 4 ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); // Required for BaseBoard insertion + + switch ( version ) + { + /** Versions 0 through 3 originally inherited from Item. Versions 0 and 1 are from before Board became a CraftResource. **/ + case 1: + case 0: + { + Resource = CraftResource.RegularWood; + break; + } + } } } - public class HeartwoodBoard : Board + public class HeartwoodBoard : BaseBoard { [Constructable] public HeartwoodBoard() @@ -158,7 +211,7 @@ namespace Server.Items } } - public class BloodwoodBoard : Board + public class BloodwoodBoard : BaseBoard { [Constructable] public BloodwoodBoard() @@ -192,7 +245,7 @@ namespace Server.Items } } - public class FrostwoodBoard : Board + public class FrostwoodBoard : BaseBoard { [Constructable] public FrostwoodBoard() @@ -226,7 +279,7 @@ namespace Server.Items } } - public class OakBoard : Board + public class OakBoard : BaseBoard { [Constructable] public OakBoard() @@ -260,7 +313,7 @@ namespace Server.Items } } - public class AshBoard : Board + public class AshBoard : BaseBoard { [Constructable] public AshBoard() @@ -294,7 +347,7 @@ namespace Server.Items } } - public class YewBoard : Board + public class YewBoard : BaseBoard { [Constructable] public YewBoard() diff --git a/Scripts/Items/Skill Items/Fishing/FishingPole.cs b/Scripts/Items/Skill Items/Fishing/FishingPole.cs index 779312206..ba61ceb06 100644 --- a/Scripts/Items/Skill Items/Fishing/FishingPole.cs +++ b/Scripts/Items/Skill Items/Fishing/FishingPole.cs @@ -8,10 +8,14 @@ using Server.ContextMenus; namespace Server.Items { - public class FishingPole : Item + public class FishingPole : BaseOtherEquipable { + public override int AosStrReq{ get{ return 10; } } + + public override CraftResource DefaultResource{ get{ return CraftResource.RegularWood; } } + [Constructable] - public FishingPole() : base( 0x0DC0 ) + public FishingPole() : base( 0x0DBF ) { Layer = Layer.OneHanded; Weight = 8.0; @@ -44,7 +48,7 @@ namespace Server.Items { base.Deserialize( reader ); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseOtherEquipable insertion } } } \ No newline at end of file diff --git a/Scripts/Items/Skill Items/Lumberjack/Log.cs b/Scripts/Items/Skill Items/Lumberjack/Log.cs index 969edc0e8..cb181bade 100644 --- a/Scripts/Items/Skill Items/Lumberjack/Log.cs +++ b/Scripts/Items/Skill Items/Lumberjack/Log.cs @@ -4,7 +4,7 @@ using Server.Items; namespace Server.Items { [FlipableAttribute( 0x1bdd, 0x1be0 )] - public class Log : Item, ICommodity, IAxe + public abstract class BaseLog : Item, ICommodity, IAxe { private CraftResource m_Resource; @@ -14,6 +14,22 @@ namespace Server.Items get { return m_Resource; } set { m_Resource = value; InvalidateProperties(); } } + + #region Old Log Serialization Vars + /* DO NOT USE! Only used in serialization of logs that originally derived from Log */ + private bool m_InheritsItem; + private int m_OldVersion; + + protected bool InheritsItem + { + get{ return m_InheritsItem; } + } + + protected int OldVersion + { + get{ return m_OldVersion; } + } + #endregion string ICommodity.Description { @@ -25,23 +41,7 @@ namespace Server.Items int ICommodity.DescriptionNumber { get { return CraftResources.IsStandard( m_Resource ) ? LabelNumber : 1075062 + ( (int)m_Resource - (int)CraftResource.RegularWood ); } } - [Constructable] - public Log() : this( 1 ) - { - } - - [Constructable] - public Log( int amount ) : this( CraftResource.RegularWood, amount ) - { - } - - [Constructable] - public Log( CraftResource resource ) - : this( resource, 1 ) - { - } - [Constructable] - public Log( CraftResource resource, int amount ) + public BaseLog( CraftResource resource, int amount ) : base( 0x1BDD ) { Stackable = true; @@ -66,7 +66,7 @@ namespace Server.Items list.Add( CraftResources.GetName( m_Resource ) ); } } - public Log( Serial serial ) : base( serial ) + public BaseLog( Serial serial ) : base( serial ) { } @@ -74,7 +74,7 @@ namespace Server.Items { base.Serialize( writer ); - writer.Write( (int) 1 ); // version + writer.Write( (int) 2 ); // version writer.Write( (int)m_Resource ); } @@ -87,15 +87,24 @@ namespace Server.Items switch ( version ) { - case 1: - { - m_Resource = (CraftResource)reader.ReadInt(); - break; - } + case 2: + { + m_Resource = (CraftResource)reader.ReadInt(); + break; + } + /** Below is for deserialization of old logs that orignally inherited from Log or Item **/ + case 1: // For all logs + { + m_Resource = (CraftResource)reader.ReadInt(); + goto case 0; + } + case 0: // For old standard logs + { + m_InheritsItem = true; + m_OldVersion = version; + break; + } } - - if ( version == 0 ) - m_Resource = CraftResource.RegularWood; } public virtual bool TryCreateBoards( Mobile from, double skill, Item item ) @@ -120,7 +129,58 @@ namespace Server.Items return true; } } - public class HeartwoodLog : Log + + public class Log : BaseLog + { + [Constructable] + public Log() : this( 1 ) + { + } + + [Constructable] + public Log( int amount ) + : base( CraftResource.RegularWood, amount ) + { + } + + public Log( Serial serial ) : base( serial ) + { + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.Write( (int) 2 ); // version + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); // Required for BaseLog insertion + + switch ( version ) + { + /** Versions 0 and 1 originally inherited from Item. Version 0 is from before Log became a CraftResource. **/ + case 0: + { + Resource = CraftResource.RegularWood; + break; + } + } + } + + public override bool Axe( Mobile from, BaseAxe axe ) + { + if ( !TryCreateBoards( from , 0, new Board() ) ) + return false; + + return true; + } + } + + public class HeartwoodLog : BaseLog { [Constructable] public HeartwoodLog() : this( 1 ) @@ -156,7 +216,7 @@ namespace Server.Items } } - public class BloodwoodLog : Log + public class BloodwoodLog : BaseLog { [Constructable] public BloodwoodLog() @@ -194,7 +254,7 @@ namespace Server.Items } } - public class FrostwoodLog : Log + public class FrostwoodLog : BaseLog { [Constructable] public FrostwoodLog() @@ -236,7 +296,7 @@ namespace Server.Items } } - public class OakLog : Log + public class OakLog : BaseLog { [Constructable] public OakLog() @@ -278,7 +338,7 @@ namespace Server.Items } } - public class AshLog : Log + public class AshLog : BaseLog { [Constructable] public AshLog() @@ -320,7 +380,7 @@ namespace Server.Items } } - public class YewLog : Log + public class YewLog : BaseLog { [Constructable] public YewLog() diff --git a/Scripts/Items/Skill Items/Magical/Spellbook.cs b/Scripts/Items/Skill Items/Magical/Spellbook.cs index b2c45b9cd..bd44590a6 100644 --- a/Scripts/Items/Skill Items/Magical/Spellbook.cs +++ b/Scripts/Items/Skill Items/Magical/Spellbook.cs @@ -20,7 +20,7 @@ namespace Server.Items Arcanist } - public class Spellbook : Item, ICraftable, ISlayer + public class Spellbook : Item, ICraftable, ISlayer, IAosAttributes { public static void Initialize() { diff --git a/Scripts/Items/Skill Items/Musical Instruments/BaseInstrument.cs b/Scripts/Items/Skill Items/Musical Instruments/BaseInstrument.cs index 1f642f850..9f77d4252 100644 --- a/Scripts/Items/Skill Items/Musical Instruments/BaseInstrument.cs +++ b/Scripts/Items/Skill Items/Musical Instruments/BaseInstrument.cs @@ -24,6 +24,7 @@ namespace Server.Items private InstrumentQuality m_Quality; private Mobile m_Crafter; private int m_UsesRemaining; + private CraftResource m_Resource; [CommandProperty( AccessLevel.GameMaster )] public int SuccessSound @@ -66,6 +67,15 @@ namespace Server.Items get{ return m_Crafter; } set{ m_Crafter = value; InvalidateProperties(); } } + + [CommandProperty( AccessLevel.GameMaster )] + public CraftResource Resource + { + get{ return m_Resource; } + set{ m_Resource = value; Hue = CraftResources.GetHue( m_Resource ); InvalidateProperties(); } + } + + public virtual CraftResource DefaultResource{ get{ return CraftResource.RegularWood; } } public virtual int InitMinUses{ get{ return 350; } } public virtual int InitMaxUses{ get{ return 450; } } @@ -370,6 +380,9 @@ namespace Server.Items if( entry != null ) list.Add( entry.Title ); } + + if ( ( m_Resource >= CraftResource.OakWood && m_Resource <= CraftResource.Frostwood ) && Hue == CraftResources.GetHue( m_Resource ) ) + list.Add( CraftResources.GetLocalizationNumber( m_Resource ) ); if( m_UsesRemaining != oldUses ) Timer.DelayCall( TimeSpan.Zero, new TimerCallback( InvalidateProperties ) ); @@ -436,13 +449,14 @@ namespace Server.Items { base.Serialize( writer ); - writer.Write( (int) 3 ); // version + writer.Write( (int) 4 ); // version + writer.WriteEncodedInt( (int)m_Resource ); + writer.Write( m_ReplenishesCharges ); if( m_ReplenishesCharges ) writer.Write( m_LastReplenished ); - writer.Write( m_Crafter ); writer.WriteEncodedInt( (int) m_Quality ); @@ -463,6 +477,11 @@ namespace Server.Items switch ( version ) { + case 4: + { + m_Resource = (CraftResource)reader.ReadEncodedInt(); + goto case 3; + } case 3: { m_ReplenishesCharges = reader.ReadBool(); @@ -510,6 +529,9 @@ namespace Server.Items break; } } + + if ( version < 4 ) + m_Resource = DefaultResource; CheckReplenishUses(); } @@ -570,18 +592,34 @@ namespace Server.Items m_From.EndAction( typeof( BaseInstrument ) ); } } + #region ICraftable Members - public int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue ) { Quality = (InstrumentQuality)quality; + + if ( Core.ML ) + { + Type resourceType = typeRes; + + if ( resourceType == null ) + resourceType = craftItem.Resources.GetAt( 0 ).ItemType; + + Resource = CraftResources.GetFromType( resourceType ); + + CraftContext context = craftSystem.GetContext( from ); + if ( context != null && context.DoNotColor ) + Hue = 0; + } + else + Resource = DefaultResource; + if ( makersMark ) Crafter = from; return quality; } - #endregion } } \ No newline at end of file diff --git a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/DyeTub.cs b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/DyeTub.cs index 2d98fe40b..a8c56b085 100644 --- a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/DyeTub.cs +++ b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/DyeTub.cs @@ -215,6 +215,7 @@ namespace Server.Items if ( okay ) { item.Hue = m_Tub.DyedHue; + item.InvalidateProperties(); from.PlaySound( 0x23E ); } } diff --git a/Scripts/Items/Skill Items/Tailor Items/Misc/Dressform.cs b/Scripts/Items/Skill Items/Tailor Items/Misc/Dressform.cs index c18ea0dde..8db148983 100644 --- a/Scripts/Items/Skill Items/Tailor Items/Misc/Dressform.cs +++ b/Scripts/Items/Skill Items/Tailor Items/Misc/Dressform.cs @@ -2,16 +2,23 @@ using System; namespace Server.Items { - [FlipableAttribute(0xec6, 0xec7)] - public class Dressform : Item + [Flipable( 0xEC6, 0xEC7 )] + public class Dressform : BaseCraftableItem { + public override bool DisplaysResource{ get{ return false; } } + [Constructable] - public Dressform() : base(0xec6) + public Dressform() : this( 0xEC6 ) + { + } + + [Constructable] + public Dressform( int itemID ) : base( itemID ) { Weight = 10; } - public Dressform(Serial serial) : base(serial) + public Dressform( Serial serial ) : base( serial ) { } @@ -26,7 +33,7 @@ namespace Server.Items { base.Deserialize(reader); - int version = reader.ReadInt(); + int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion } } } \ No newline at end of file diff --git a/Scripts/Items/Skill Items/Tools/BaseRunicTool.cs b/Scripts/Items/Skill Items/Tools/BaseRunicTool.cs index ba258ffa5..833cf49c2 100644 --- a/Scripts/Items/Skill Items/Tools/BaseRunicTool.cs +++ b/Scripts/Items/Skill Items/Tools/BaseRunicTool.cs @@ -391,8 +391,6 @@ namespace Server.Items //Order is Cold, Energy, Fire, Poison -> Physical left //Cannot be looped, AoselementAttribute is 'out of order' - - weapon.Hue = weapon.GetElementalDamageHue(); } private static int AssignElementalDamage( BaseWeapon weapon, AosElementAttribute attr, int totalDamage ) @@ -473,7 +471,7 @@ namespace Server.Items int baseCount = ( isShield ? 7 : 20 ); int baseOffset = ( isShield ? 0 : 4 ); - if ( !isShield && armor.MeditationAllowance == ArmorMeditationAllowance.All ) + if ( ( !isShield && armor.MeditationAllowance == ArmorMeditationAllowance.All ) || armor.ArmorAttributes.MageArmor > 0 ) m_Props.Set( 3, true ); // remove mage armor from possible properties if ( armor.Resource >= CraftResource.RegularLeather && armor.Resource <= CraftResource.BarbedLeather ) { diff --git a/Scripts/Items/Skill Items/Tools/RunicDovetailSaw.cs b/Scripts/Items/Skill Items/Tools/RunicDovetailSaw.cs new file mode 100644 index 000000000..141f0f68c --- /dev/null +++ b/Scripts/Items/Skill Items/Tools/RunicDovetailSaw.cs @@ -0,0 +1,77 @@ +using System; +using Server; +using Server.Engines.Craft; + +namespace Server.Items +{ + [FlipableAttribute( 0x1028, 0x1029 )] + public class RunicDovetailSaw : BaseRunicTool + { + public override CraftSystem CraftSystem{ get{ return DefCarpentry.CraftSystem; } } + + public override int LabelNumber + { + get + { + int index = CraftResources.GetIndex( Resource ); + + if ( index >= 1 && index <= 6 ) + return 1072633 + index; + + return 1011196; // dovetail saw + } + } + + public override void AddNameProperties( ObjectPropertyList list ) + { + base.AddNameProperties( list ); + + int index = CraftResources.GetIndex( Resource ); + + if ( index >= 1 && index <= 6 ) + return; + + if ( !CraftResources.IsStandard( Resource ) ) + { + int num = CraftResources.GetLocalizationNumber( Resource ); + + if ( num > 0 ) + list.Add( num ); + else + list.Add( CraftResources.GetName( Resource ) ); + } + } + + [Constructable] + public RunicDovetailSaw( CraftResource resource ) : base( resource, 0x1029 ) + { + Weight = 2.0; + Hue = CraftResources.GetHue( resource ); + } + + [Constructable] + public RunicDovetailSaw( CraftResource resource, int uses ) : base( resource, uses, 0x1029 ) + { + Weight = 2.0; + Hue = CraftResources.GetHue( resource ); + } + + public RunicDovetailSaw( 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/Special/Special Scrolls/PowerScroll.cs b/Scripts/Items/Special/Special Scrolls/PowerScroll.cs index bf993766a..3aa3cf5d7 100644 --- a/Scripts/Items/Special/Special Scrolls/PowerScroll.cs +++ b/Scripts/Items/Special/Special Scrolls/PowerScroll.cs @@ -125,8 +125,8 @@ namespace Server.Items public PowerScroll( SkillName skill, double value ) : base( skill, value ) { Hue = 0x481; - - if ( Value == 105.0 ) + + if (Value == 105.0 || skill == Server.SkillName.Blacksmith || skill == Server.SkillName.Tailoring ) LootType = LootType.Regular; } @@ -210,7 +210,7 @@ namespace Server.Items int version = ( InheritsItem ? 0 : reader.ReadInt() ); //Required for SpecialScroll insertion - if ( Value == 105.0 ) + if (Value == 105.0 || Skill == SkillName.Blacksmith || Skill == SkillName.Tailoring) { LootType = LootType.Regular; } diff --git a/Scripts/Items/Weapons/BaseWeapon.cs b/Scripts/Items/Weapons/BaseWeapon.cs index 4fda0b7da..ba1e416ab 100644 --- a/Scripts/Items/Weapons/BaseWeapon.cs +++ b/Scripts/Items/Weapons/BaseWeapon.cs @@ -21,7 +21,7 @@ namespace Server.Items SlayerName Slayer2 { get; set; } } - public abstract class BaseWeapon : Item, IWeapon, IFactionItem, ICraftable, ISlayer, IDurability + public abstract class BaseWeapon : Item, IWeapon, IFactionItem, ICraftable, ISlayer, IDurability, IAosAttributes { private string m_EngravedText; @@ -92,6 +92,9 @@ namespace Server.Items private AosWeaponAttributes m_AosWeaponAttributes; private AosSkillBonuses m_AosSkillBonuses; private AosElementAttributes m_AosElementDamages; + + private BonusAttribute[] m_BonusRandomAttributes; + private double m_OriginalWeight; // Overridable values. These values are provided to override the defaults which get defined in the individual weapon scripts. private int m_StrReq, m_DexReq, m_IntReq; @@ -277,7 +280,43 @@ namespace Server.Items public CraftResource Resource { get{ return m_Resource; } - set{ UnscaleDurability(); m_Resource = value; Hue = CraftResources.GetHue( m_Resource ); InvalidateProperties(); ScaleDurability(); } + set + { + if ( m_Resource != value ) + { + if ( !Core.AOS ) + UnscaleDurability(); + + if ( Core.AOS && !CraftResources.IsStandard( m_Resource ) ) + { + BonusAttributesHelper.RemoveAttrsFrom( this, GetResourceBonusAttrs() ); + BonusAttributesHelper.RemoveAttrsFrom( this, RandomAttributes ); + RandomAttributes = null; + } + + m_Resource = value; + + if ( Core.AOS && !CraftResources.IsStandard( m_Resource ) ) + { + // Enhance sets RandomAttributes so check if it's null/empty first before getting new random attributes. + if ( RandomAttributes == null || RandomAttributes.Length == 0 ) + RandomAttributes = BonusAttributesHelper.GetRandomAttributes( GetResourceRandomAttrs(), GetResourceAttrs().RandomAttributeCount ); + + BonusAttributesHelper.ApplyAttributesTo( this, GetResourceBonusAttrs() ); + BonusAttributesHelper.ApplyAttributesTo( this, RandomAttributes ); + } + + if ( Core.AOS ) + Hue = GetElementalDamageHue( CraftResources.GetHue( m_Resource ) ); + else + Hue = CraftResources.GetHue( m_Resource ); + + InvalidateProperties(); + + if ( !Core.AOS ) + ScaleDurability(); + } + } } [CommandProperty( AccessLevel.GameMaster )] @@ -433,6 +472,12 @@ namespace Server.Items } } } + + public BonusAttribute[] RandomAttributes + { + get { return m_BonusRandomAttributes; } + set { m_BonusRandomAttributes = value; } + } #endregion @@ -447,6 +492,28 @@ namespace Server.Items weap.m_AosElementDamages = new AosElementAttributes( newItem, m_AosElementDamages ); weap.m_AosSkillBonuses = new AosSkillBonuses( newItem, m_AosSkillBonuses ); weap.m_AosWeaponAttributes = new AosWeaponAttributes( newItem, m_AosWeaponAttributes ); + weap.m_BonusRandomAttributes = m_BonusRandomAttributes; + } + + public void ModifyWeight() + { + double v = 0; + + v = 100 - GetWeightBonus(); + + Weight = m_OriginalWeight * (v / 100); + } + + public int GetWeightBonus() + { + CraftAttributeInfo attrInfo = GetResourceAttrs(); + + int v = Attributes.LowerWeight; + + if ( v > 100 ) + v = 100; + + return v; } public virtual void UnscaleDurability() @@ -466,6 +533,30 @@ namespace Server.Items m_MaxHits = ((m_MaxHits * scale) + 99) / 100; InvalidateProperties(); } + + public CraftAttributeInfo GetResourceAttrs() + { + CraftResourceInfo info = CraftResources.GetInfo( m_Resource ); + + if ( info == null ) + return CraftAttributeInfo.Blank; + + return info.AttributeInfo; + } + + public BonusAttribute[] GetResourceBonusAttrs() + { + CraftAttributeInfo attrInfo = GetResourceAttrs(); + + return attrInfo.WeaponAttributes; + } + + public BonusAttribute[] GetResourceRandomAttrs() + { + CraftAttributeInfo attrInfo = GetResourceAttrs(); + + return attrInfo.WeaponRandomAttributes; + } public int GetDurabilityBonus() { @@ -486,15 +577,6 @@ namespace Server.Items if ( Core.AOS ) { bonus += m_AosWeaponAttributes.DurabilityBonus; - - CraftResourceInfo resInfo = CraftResources.GetInfo( m_Resource ); - CraftAttributeInfo attrInfo = null; - - if ( resInfo != null ) - attrInfo = resInfo.AttributeInfo; - - if ( attrInfo != null ) - bonus += attrInfo.WeaponDurability; } return bonus; @@ -507,16 +589,6 @@ namespace Server.Items int v = m_AosWeaponAttributes.LowerStatReq; - CraftResourceInfo info = CraftResources.GetInfo( m_Resource ); - - if ( info != null ) - { - CraftAttributeInfo attrInfo = info.AttributeInfo; - - if ( attrInfo != null ) - v += attrInfo.WeaponLowerRequirements; - } - if ( v > 100 ) v = 100; @@ -933,6 +1005,7 @@ namespace Server.Items ticks = Math.Floor( ( 80000.0 / ( ( m.Stam + 100 ) * speed ) ) - 2 ); } + // Swing speed currently capped at one swing every 1.25 seconds (5 ticks). if ( ticks < 5 ) ticks = 5; @@ -2005,31 +2078,10 @@ namespace Server.Items direct = m_AosElementDamages.Direct; phys = 100 - fire - cold - pois - nrgy - chaos - direct; - - CraftResourceInfo resInfo = CraftResources.GetInfo( m_Resource ); - - if( resInfo != null ) - { - CraftAttributeInfo attrInfo = resInfo.AttributeInfo; - - if( attrInfo != null ) - { - int left = phys; - - left = ApplyCraftAttributeElementDamage( attrInfo.WeaponColdDamage, ref cold, left ); - left = ApplyCraftAttributeElementDamage( attrInfo.WeaponEnergyDamage, ref nrgy, left ); - left = ApplyCraftAttributeElementDamage( attrInfo.WeaponFireDamage, ref fire, left ); - left = ApplyCraftAttributeElementDamage( attrInfo.WeaponPoisonDamage, ref pois, left ); - left = ApplyCraftAttributeElementDamage( attrInfo.WeaponChaosDamage, ref chaos, left ); - left = ApplyCraftAttributeElementDamage( attrInfo.WeaponDirectDamage, ref direct, left ); - - phys = left; - } - } } } - private int ApplyCraftAttributeElementDamage( int attrDamage, ref int element, int totalRemaining ) + public int ApplyAttributeElementDamage( int attrDamage, ref int element, int totalRemaining ) { if( totalRemaining <= 0 ) return 0; @@ -2049,6 +2101,27 @@ namespace Server.Items return totalRemaining - appliedDamage; } + + public int RemoveAttributeElementDamage( int attrDamage, ref int element, int totalRemaining ) + { + if( totalRemaining >= 100 ) + return 100; + + if ( attrDamage <= 0 ) + return totalRemaining; + + int removedDamage = attrDamage; + + if ( (element - removedDamage) < 0 ) + removedDamage = element; + + if( removedDamage > 100 - totalRemaining ) + removedDamage = 100 - totalRemaining; + + element -= removedDamage; + + return totalRemaining + removedDamage; + } public virtual void OnMiss( Mobile attacker, Mobile defender ) { @@ -2447,20 +2520,33 @@ namespace Server.Items if ( setIf ) flags |= toSet; } + + private static void SetSaveFlag( ref SaveFlag2 flags, SaveFlag2 toSet, bool setIf ) + { + if ( setIf ) + flags |= toSet; + } private static bool GetSaveFlag( SaveFlag flags, SaveFlag toGet ) { return ( (flags & toGet) != 0 ); } + + private static bool GetSaveFlag( SaveFlag2 flags, SaveFlag2 toGet ) + { + return ( (flags & toGet) != 0 ); + } public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); - writer.Write( (int) 9 ); // version + writer.Write( (int) 10 ); // version SaveFlag flags = SaveFlag.None; + SaveFlag2 flags2 = SaveFlag2.None; + //SaveFlag SetSaveFlag( ref flags, SaveFlag.DamageLevel, m_DamageLevel != WeaponDamageLevel.Regular ); SetSaveFlag( ref flags, SaveFlag.AccuracyLevel, m_AccuracyLevel != WeaponAccuracyLevel.Regular ); SetSaveFlag( ref flags, SaveFlag.DurabilityLevel, m_DurabilityLevel != WeaponDurabilityLevel.Regular ); @@ -2492,7 +2578,23 @@ namespace Server.Items 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 ) ); - + + //SaveFlag2 + SetSaveFlag( ref flags2, SaveFlag2.BonusAttributes, m_BonusRandomAttributes != null && m_BonusRandomAttributes.Length > 0 ); + SetSaveFlag( ref flags2, SaveFlag2.OriginalWeight, m_OriginalWeight != 0 ); + + writer.Write( (int) flags2 ); + + if ( GetSaveFlag( flags2, SaveFlag2.BonusAttributes ) ) + { + writer.Write( (int)m_BonusRandomAttributes.Length ); + for ( int i = 0; i < m_BonusRandomAttributes.Length; i++ ) + m_BonusRandomAttributes[i].Serialize( writer ); + } + + if ( GetSaveFlag( flags2, SaveFlag2.OriginalWeight ) ) + writer.Write( (double)m_OriginalWeight ); + writer.Write( (int) flags ); if ( GetSaveFlag( flags, SaveFlag.DamageLevel ) ) @@ -2619,6 +2721,14 @@ namespace Server.Items ElementalDamages = 0x20000000, EngravedText = 0x40000000 } + + [Flags] + private enum SaveFlag2 + { + None = 0x00000000, + BonusAttributes = 0x00000001, + OriginalWeight = 0x00000002 + } public override void Deserialize( GenericReader reader ) { @@ -2628,6 +2738,23 @@ namespace Server.Items switch ( version ) { + case 10: + { + SaveFlag2 flags2 = (SaveFlag2)reader.ReadInt(); + + if ( GetSaveFlag( flags2, SaveFlag2.BonusAttributes ) ) + { + m_BonusRandomAttributes = new BonusAttribute[reader.ReadInt()]; + + for( int i = 0; i < m_BonusRandomAttributes.Length; i++ ) + m_BonusRandomAttributes[i] = new BonusAttribute( reader ); + } + + if ( GetSaveFlag( flags2, SaveFlag2.OriginalWeight ) ) + m_OriginalWeight = reader.ReadDouble(); + + goto case 9; + } case 9: case 8: case 7: @@ -2942,6 +3069,18 @@ namespace Server.Items if ( version < 6 ) m_PlayerConstructed = true; // we don't know, so, assume it's crafted + + if ( version < 10 ) + { + int hits = m_Hits; + int maxHits = m_MaxHits; + + m_OriginalWeight = Weight; + BonusAttributesHelper.ApplyAttributesTo( this, GetResourceBonusAttrs() ); + + m_Hits = hits; + m_MaxHits = maxHits; + } } #endregion @@ -2971,6 +3110,8 @@ namespace Server.Items m_AosWeaponAttributes = new AosWeaponAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); m_AosElementDamages = new AosElementAttributes( this ); + + m_OriginalWeight = Weight; } public BaseWeapon( Serial serial ) : base( serial ) @@ -2993,16 +3134,24 @@ namespace Server.Items get{ return base.Hue; } set{ base.Hue = value; InvalidateProperties(); } } - + public int GetElementalDamageHue() + { + return GetElementalDamageHue( 0 ); + } + + public int GetElementalDamageHue( int currentHue ) { int phys, fire, cold, pois, nrgy, chaos, direct; GetDamageTypes( null, out phys, out fire, out cold, out pois, out nrgy, out chaos, out direct ); //Order is Cold, Energy, Fire, Poison, Physical left + + if( ( m_Resource >= CraftResource.OakWood && m_Resource <= CraftResource.Frostwood ) && currentHue == CraftResources.GetHue( m_Resource ) ) + return currentHue; int currentMax = 50; - int hue = 0; - + int hue = currentHue; + if( pois >= currentMax ) { hue = 1267 + (pois - 50) / 10; @@ -3080,21 +3229,6 @@ namespace Server.Items get{ return 0; } } - public virtual int GetLuckBonus() - { - CraftResourceInfo resInfo = CraftResources.GetInfo( m_Resource ); - - if ( resInfo == null ) - return 0; - - CraftAttributeInfo attrInfo = resInfo.AttributeInfo; - - if ( attrInfo == null ) - return 0; - - return attrInfo.WeaponLuck; - } - public override void GetProperties( ObjectPropertyList list ) { base.GetProperties( list ); @@ -3143,6 +3277,9 @@ namespace Server.Items base.AddResistanceProperties( list ); int prop; + + if ( ( m_Resource >= CraftResource.OakWood && m_Resource <= CraftResource.Frostwood ) && Hue == CraftResources.GetHue( m_Resource ) ) + list.Add( CraftResources.GetLocalizationNumber( m_Resource ) ); if ( Core.ML && this is BaseRanged && ( (BaseRanged) this ).Balanced ) list.Add( 1072792 ); // Balanced @@ -3234,7 +3371,7 @@ namespace Server.Items if ( (prop = GetLowerStatReq()) != 0 ) list.Add( 1060435, prop.ToString() ); // lower requirements ~1_val~% - if ( (prop = (GetLuckBonus() + m_AosAttributes.Luck)) != 0 ) + if ( (prop = m_AosAttributes.Luck) != 0 ) list.Add( 1060436, prop.ToString() ); // luck ~1_val~ if ( (prop = m_AosWeaponAttributes.MageWeapon) != 0 ) @@ -3433,13 +3570,6 @@ namespace Server.Items if ( Core.AOS ) { - Resource = CraftResources.GetFromType( resourceType ); - - CraftContext context = craftSystem.GetContext( from ); - - if ( context != null && context.DoNotColor ) - Hue = 0; - if ( tool is BaseRunicTool ) ((BaseRunicTool)tool).ApplyAttributesTo( this ); @@ -3460,6 +3590,13 @@ namespace Server.Items from.CheckSkill( SkillName.ArmsLore, 0, 100 ); } } + + Resource = CraftResources.GetFromType( resourceType ); + + CraftContext context = craftSystem.GetContext( from ); + + if ( context != null && context.DoNotColor ) + Hue = GetElementalDamageHue(); } else if ( tool is BaseRunicTool ) { diff --git a/Scripts/Misc/AOS.cs b/Scripts/Misc/AOS.cs index f3d4de8c4..bc08bfe20 100644 --- a/Scripts/Misc/AOS.cs +++ b/Scripts/Misc/AOS.cs @@ -224,7 +224,13 @@ namespace Server EnhancePotions=0x00080000, Luck=0x00100000, SpellChanneling=0x00200000, - NightSight=0x00400000 + NightSight=0x00400000, + LowerWeight=0x00800000 + } + + public interface IAosAttributes + { + AosAttributes Attributes{ get; set; } } public sealed class AosAttributes : BaseAttributes @@ -256,43 +262,9 @@ namespace Server { Item obj = items[i]; - if( obj is BaseWeapon ) + if( obj is IAosAttributes ) { - AosAttributes attrs = ((BaseWeapon)obj).Attributes; - - if( attrs != null ) - value += attrs[attribute]; - - if( attribute == AosAttribute.Luck ) - value += ((BaseWeapon)obj).GetLuckBonus(); - } - else if( obj is BaseArmor ) - { - AosAttributes attrs = ((BaseArmor)obj).Attributes; - - if( attrs != null ) - value += attrs[attribute]; - - if( attribute == AosAttribute.Luck ) - value += ((BaseArmor)obj).GetLuckBonus(); - } - else if( obj is BaseJewel ) - { - AosAttributes attrs = ((BaseJewel)obj).Attributes; - - if( attrs != null ) - value += attrs[attribute]; - } - else if( obj is BaseClothing ) - { - AosAttributes attrs = ((BaseClothing)obj).Attributes; - - if( attrs != null ) - value += attrs[attribute]; - } - else if( obj is Spellbook ) - { - AosAttributes attrs = ((Spellbook)obj).Attributes; + AosAttributes attrs = ((IAosAttributes)obj).Attributes; if( attrs != null ) value += attrs[attribute]; @@ -422,6 +394,9 @@ namespace Server [CommandProperty( AccessLevel.GameMaster )] public int NightSight { get { return this[AosAttribute.NightSight]; } set { this[AosAttribute.NightSight] = value; } } + + [CommandProperty( AccessLevel.GameMaster )] + public int LowerWeight { get { return this[AosAttribute.LowerWeight]; } set { this[AosAttribute.LowerWeight] = value; } } } [Flags] @@ -1139,6 +1114,16 @@ namespace Server } } + if( (bitmask == (int)AosAttribute.LowerWeight) && (this is AosAttributes) ) + { + if( m_Owner is BaseArmor ) + ((BaseArmor)m_Owner).ModifyWeight(); + else if( m_Owner is BaseWeapon ) + ((BaseWeapon)m_Owner).ModifyWeight(); + else if( m_Owner is BaseOtherEquipable ) + ((BaseOtherEquipable)m_Owner).ModifyWeight(); + } + m_Owner.InvalidateProperties(); } diff --git a/Scripts/Misc/ResourceInfo.cs b/Scripts/Misc/ResourceInfo.cs index d9668235f..e9b777ba5 100644 --- a/Scripts/Misc/ResourceInfo.cs +++ b/Scripts/Misc/ResourceInfo.cs @@ -48,52 +48,32 @@ namespace Server.Items public class CraftAttributeInfo { - private int m_WeaponFireDamage; - private int m_WeaponColdDamage; - private int m_WeaponPoisonDamage; - private int m_WeaponEnergyDamage; - private int m_WeaponChaosDamage; - private int m_WeaponDirectDamage; - private int m_WeaponDurability; - private int m_WeaponLuck; - private int m_WeaponGoldIncrease; - private int m_WeaponLowerRequirements; - - private int m_ArmorPhysicalResist; - private int m_ArmorFireResist; - private int m_ArmorColdResist; - private int m_ArmorPoisonResist; - private int m_ArmorEnergyResist; - private int m_ArmorDurability; - private int m_ArmorLuck; - private int m_ArmorGoldIncrease; - private int m_ArmorLowerRequirements; + private BonusAttribute[] m_WeaponAttributes; + private BonusAttribute[] m_ArmorAttributes; + private BonusAttribute[] m_ShieldAttributes; + private BonusAttribute[] m_OtherAttributes; + + private int m_RandomAttributeCount; + private BonusAttribute[] m_WeaponRandomAttributes; + private BonusAttribute[] m_ArmorRandomAttributes; + private BonusAttribute[] m_ShieldRandomAttributes; + private BonusAttribute[] m_OtherRandomAttributes; private int m_RunicMinAttributes; private int m_RunicMaxAttributes; private int m_RunicMinIntensity; private int m_RunicMaxIntensity; - - public int WeaponFireDamage{ get{ return m_WeaponFireDamage; } set{ m_WeaponFireDamage = value; } } - public int WeaponColdDamage{ get{ return m_WeaponColdDamage; } set{ m_WeaponColdDamage = value; } } - public int WeaponPoisonDamage{ get{ return m_WeaponPoisonDamage; } set{ m_WeaponPoisonDamage = value; } } - public int WeaponEnergyDamage{ get{ return m_WeaponEnergyDamage; } set{ m_WeaponEnergyDamage = value; } } - public int WeaponChaosDamage{ get{ return m_WeaponChaosDamage; } set{ m_WeaponChaosDamage = value; } } - public int WeaponDirectDamage{ get{ return m_WeaponDirectDamage; } set{ m_WeaponDirectDamage = value; } } - public int WeaponDurability{ get{ return m_WeaponDurability; } set{ m_WeaponDurability = value; } } - public int WeaponLuck{ get{ return m_WeaponLuck; } set{ m_WeaponLuck = value; } } - public int WeaponGoldIncrease{ get{ return m_WeaponGoldIncrease; } set{ m_WeaponGoldIncrease = value; } } - public int WeaponLowerRequirements{ get{ return m_WeaponLowerRequirements; } set{ m_WeaponLowerRequirements = value; } } - - public int ArmorPhysicalResist{ get{ return m_ArmorPhysicalResist; } set{ m_ArmorPhysicalResist = value; } } - public int ArmorFireResist{ get{ return m_ArmorFireResist; } set{ m_ArmorFireResist = value; } } - public int ArmorColdResist{ get{ return m_ArmorColdResist; } set{ m_ArmorColdResist = value; } } - public int ArmorPoisonResist{ get{ return m_ArmorPoisonResist; } set{ m_ArmorPoisonResist = value; } } - public int ArmorEnergyResist{ get{ return m_ArmorEnergyResist; } set{ m_ArmorEnergyResist = value; } } - public int ArmorDurability{ get{ return m_ArmorDurability; } set{ m_ArmorDurability = value; } } - public int ArmorLuck{ get{ return m_ArmorLuck; } set{ m_ArmorLuck = value; } } - public int ArmorGoldIncrease{ get{ return m_ArmorGoldIncrease; } set{ m_ArmorGoldIncrease = value; } } - public int ArmorLowerRequirements{ get{ return m_ArmorLowerRequirements; } set{ m_ArmorLowerRequirements = value; } } + + public BonusAttribute[] WeaponAttributes{ get{ return m_WeaponAttributes; } set{ m_WeaponAttributes = value; } } + public BonusAttribute[] ArmorAttributes{ get{ return m_ArmorAttributes; } set{ m_ArmorAttributes = value; } } + public BonusAttribute[] ShieldAttributes{ get{ return m_ShieldAttributes; } set{ m_ShieldAttributes = value; } } + public BonusAttribute[] OtherAttributes{ get{ return m_OtherAttributes; } set{ m_OtherAttributes = value; } } + + public int RandomAttributeCount{ get{ return m_RandomAttributeCount; } set{ m_RandomAttributeCount = value; } } + public BonusAttribute[] WeaponRandomAttributes{ get{ return m_WeaponRandomAttributes; } set{ m_WeaponRandomAttributes = value; } } + public BonusAttribute[] ArmorRandomAttributes{ get{ return m_ArmorRandomAttributes; } set{ m_ArmorRandomAttributes = value; } } + public BonusAttribute[] ShieldRandomAttributes{ get{ return m_ShieldRandomAttributes; } set{ m_ShieldRandomAttributes = value; } } + public BonusAttribute[] OtherRandomAttributes{ get{ return m_OtherRandomAttributes; } set{ m_OtherRandomAttributes = value; } } public int RunicMinAttributes{ get{ return m_RunicMinAttributes; } set{ m_RunicMinAttributes = value; } } public int RunicMaxAttributes{ get{ return m_RunicMaxAttributes; } set{ m_RunicMaxAttributes = value; } } @@ -116,11 +96,15 @@ namespace Server.Items CraftAttributeInfo dullCopper = DullCopper = new CraftAttributeInfo(); - dullCopper.ArmorPhysicalResist = 6; - dullCopper.ArmorDurability = 50; - dullCopper.ArmorLowerRequirements = 20; - dullCopper.WeaponDurability = 100; - dullCopper.WeaponLowerRequirements = 50; + dullCopper.ArmorAttributes = new BonusAttribute[] { + new BonusAttribute( ResistanceType.Physical, 6 ), + new BonusAttribute( AosArmorAttribute.DurabilityBonus, 50 ), + new BonusAttribute( AosArmorAttribute.LowerStatReq, 20 ) + }; + dullCopper.WeaponAttributes = new BonusAttribute[] { + new BonusAttribute( AosWeaponAttribute.DurabilityBonus, 100 ), + new BonusAttribute( AosWeaponAttribute.LowerStatReq, 50 ) + }; dullCopper.RunicMinAttributes = 1; dullCopper.RunicMaxAttributes = 2; if ( Core.ML ) @@ -136,12 +120,16 @@ namespace Server.Items CraftAttributeInfo shadowIron = ShadowIron = new CraftAttributeInfo(); - shadowIron.ArmorPhysicalResist = 2; - shadowIron.ArmorFireResist = 1; - shadowIron.ArmorEnergyResist = 5; - shadowIron.ArmorDurability = 100; - shadowIron.WeaponColdDamage = 20; - shadowIron.WeaponDurability = 50; + shadowIron.ArmorAttributes = new BonusAttribute[] { + new BonusAttribute( ResistanceType.Physical, 2 ), + new BonusAttribute( ResistanceType.Fire, 1 ), + new BonusAttribute( ResistanceType.Energy, 5 ), + new BonusAttribute( AosArmorAttribute.DurabilityBonus, 100 ) + }; + shadowIron.WeaponAttributes = new BonusAttribute[] { + new BonusAttribute( AosElementAttribute.Cold, 20 ), + new BonusAttribute( AosWeaponAttribute.DurabilityBonus, 50 ) + }; shadowIron.RunicMinAttributes = 2; shadowIron.RunicMaxAttributes = 2; if ( Core.ML ) @@ -157,12 +145,16 @@ namespace Server.Items CraftAttributeInfo copper = Copper = new CraftAttributeInfo(); - copper.ArmorPhysicalResist = 1; - copper.ArmorFireResist = 1; - copper.ArmorPoisonResist = 5; - copper.ArmorEnergyResist = 2; - copper.WeaponPoisonDamage = 10; - copper.WeaponEnergyDamage = 20; + copper.ArmorAttributes = new BonusAttribute[] { + new BonusAttribute( ResistanceType.Physical, 1 ), + new BonusAttribute( ResistanceType.Fire, 1 ), + new BonusAttribute( ResistanceType.Poison, 5 ), + new BonusAttribute( ResistanceType.Energy, 2 ) + }; + copper.WeaponAttributes = new BonusAttribute[] { + new BonusAttribute( AosElementAttribute.Poison, 10 ), + new BonusAttribute( AosElementAttribute.Energy, 20 ) + }; copper.RunicMinAttributes = 2; copper.RunicMaxAttributes = 3; if ( Core.ML ) @@ -178,11 +170,15 @@ namespace Server.Items CraftAttributeInfo bronze = Bronze = new CraftAttributeInfo(); - bronze.ArmorPhysicalResist = 3; - bronze.ArmorColdResist = 5; - bronze.ArmorPoisonResist = 1; - bronze.ArmorEnergyResist = 1; - bronze.WeaponFireDamage = 40; + bronze.ArmorAttributes = new BonusAttribute[] { + new BonusAttribute( ResistanceType.Physical, 3 ), + new BonusAttribute( ResistanceType.Cold, 5 ), + new BonusAttribute( ResistanceType.Poison, 1 ), + new BonusAttribute( ResistanceType.Energy, 1 ) + }; + bronze.WeaponAttributes = new BonusAttribute[] { + new BonusAttribute( AosElementAttribute.Fire, 40 ) + }; bronze.RunicMinAttributes = 3; bronze.RunicMaxAttributes = 3; if ( Core.ML ) @@ -198,14 +194,18 @@ namespace Server.Items CraftAttributeInfo golden = Golden = new CraftAttributeInfo(); - golden.ArmorPhysicalResist = 1; - golden.ArmorFireResist = 1; - golden.ArmorColdResist = 2; - golden.ArmorEnergyResist = 2; - golden.ArmorLuck = 40; - golden.ArmorLowerRequirements = 30; - golden.WeaponLuck = 40; - golden.WeaponLowerRequirements = 50; + golden.ArmorAttributes = new BonusAttribute[] { + new BonusAttribute( ResistanceType.Physical, 1 ), + new BonusAttribute( ResistanceType.Fire, 1 ), + new BonusAttribute( ResistanceType.Cold, 2 ), + new BonusAttribute( ResistanceType.Energy, 2 ), + new BonusAttribute( AosAttribute.Luck, 40 ), + new BonusAttribute( AosArmorAttribute.LowerStatReq, 30 ) + }; + golden.WeaponAttributes = new BonusAttribute[] { + new BonusAttribute( AosAttribute.Luck, 40 ), + new BonusAttribute( AosWeaponAttribute.LowerStatReq, 50 ) + }; golden.RunicMinAttributes = 3; golden.RunicMaxAttributes = 4; if ( Core.ML ) @@ -221,13 +221,17 @@ namespace Server.Items CraftAttributeInfo agapite = Agapite = new CraftAttributeInfo(); - agapite.ArmorPhysicalResist = 2; - agapite.ArmorFireResist = 3; - agapite.ArmorColdResist = 2; - agapite.ArmorPoisonResist = 2; - agapite.ArmorEnergyResist = 2; - agapite.WeaponColdDamage = 30; - agapite.WeaponEnergyDamage = 20; + agapite.ArmorAttributes = new BonusAttribute[] { + new BonusAttribute( ResistanceType.Physical, 2 ), + new BonusAttribute( ResistanceType.Fire, 3 ), + new BonusAttribute( ResistanceType.Cold, 2 ), + new BonusAttribute( ResistanceType.Poison, 2 ), + new BonusAttribute( ResistanceType.Energy, 2 ) + }; + agapite.WeaponAttributes = new BonusAttribute[] { + new BonusAttribute( AosElementAttribute.Cold, 30 ), + new BonusAttribute( AosElementAttribute.Energy, 20 ) + }; agapite.RunicMinAttributes = 4; agapite.RunicMaxAttributes = 4; if ( Core.ML ) @@ -243,13 +247,17 @@ namespace Server.Items CraftAttributeInfo verite = Verite = new CraftAttributeInfo(); - verite.ArmorPhysicalResist = 3; - verite.ArmorFireResist = 3; - verite.ArmorColdResist = 2; - verite.ArmorPoisonResist = 3; - verite.ArmorEnergyResist = 1; - verite.WeaponPoisonDamage = 40; - verite.WeaponEnergyDamage = 20; + verite.ArmorAttributes = new BonusAttribute[] { + new BonusAttribute( ResistanceType.Physical, 3 ), + new BonusAttribute( ResistanceType.Fire, 3 ), + new BonusAttribute( ResistanceType.Cold, 2 ), + new BonusAttribute( ResistanceType.Poison, 3 ), + new BonusAttribute( ResistanceType.Energy, 1 ) + }; + verite.WeaponAttributes = new BonusAttribute[] { + new BonusAttribute( AosElementAttribute.Poison, 40 ), + new BonusAttribute( AosElementAttribute.Energy, 20 ) + }; verite.RunicMinAttributes = 4; verite.RunicMaxAttributes = 5; if ( Core.ML ) @@ -265,15 +273,19 @@ namespace Server.Items CraftAttributeInfo valorite = Valorite = new CraftAttributeInfo(); - valorite.ArmorPhysicalResist = 4; - valorite.ArmorColdResist = 3; - valorite.ArmorPoisonResist = 3; - valorite.ArmorEnergyResist = 3; - valorite.ArmorDurability = 50; - valorite.WeaponFireDamage = 10; - valorite.WeaponColdDamage = 20; - valorite.WeaponPoisonDamage = 10; - valorite.WeaponEnergyDamage = 20; + valorite.ArmorAttributes = new BonusAttribute[] { + new BonusAttribute( ResistanceType.Physical, 4 ), + new BonusAttribute( ResistanceType.Cold, 3 ), + new BonusAttribute( ResistanceType.Poison, 3 ), + new BonusAttribute( ResistanceType.Energy, 3 ), + new BonusAttribute( AosArmorAttribute.DurabilityBonus, 50 ) + }; + valorite.WeaponAttributes = new BonusAttribute[] { + new BonusAttribute( AosElementAttribute.Fire, 10 ), + new BonusAttribute( AosElementAttribute.Cold, 20 ), + new BonusAttribute( AosElementAttribute.Poison, 10 ), + new BonusAttribute( AosElementAttribute.Energy, 20 ) + }; valorite.RunicMinAttributes = 5; valorite.RunicMaxAttributes = 5; if ( Core.ML ) @@ -289,8 +301,10 @@ namespace Server.Items CraftAttributeInfo spined = Spined = new CraftAttributeInfo(); - spined.ArmorPhysicalResist = 5; - spined.ArmorLuck = 40; + spined.ArmorAttributes = new BonusAttribute[] { + new BonusAttribute( ResistanceType.Physical, 5 ), + new BonusAttribute( AosAttribute.Luck, 40 ) + }; spined.RunicMinAttributes = 1; spined.RunicMaxAttributes = 3; if ( Core.ML ) @@ -306,11 +320,13 @@ namespace Server.Items CraftAttributeInfo horned = Horned = new CraftAttributeInfo(); - horned.ArmorPhysicalResist = 2; - horned.ArmorFireResist = 3; - horned.ArmorColdResist = 2; - horned.ArmorPoisonResist = 2; - horned.ArmorEnergyResist = 2; + horned.ArmorAttributes = new BonusAttribute[] { + new BonusAttribute( ResistanceType.Physical, 2 ), + new BonusAttribute( ResistanceType.Fire, 3 ), + new BonusAttribute( ResistanceType.Cold, 2 ), + new BonusAttribute( ResistanceType.Poison, 2 ), + new BonusAttribute( ResistanceType.Energy, 2 ) + }; horned.RunicMinAttributes = 3; horned.RunicMaxAttributes = 4; if ( Core.ML ) @@ -326,11 +342,13 @@ namespace Server.Items CraftAttributeInfo barbed = Barbed = new CraftAttributeInfo(); - barbed.ArmorPhysicalResist = 2; - barbed.ArmorFireResist = 1; - barbed.ArmorColdResist = 2; - barbed.ArmorPoisonResist = 3; - barbed.ArmorEnergyResist = 4; + barbed.ArmorAttributes = new BonusAttribute[] { + new BonusAttribute( ResistanceType.Physical, 2 ), + new BonusAttribute( ResistanceType.Fire, 1 ), + new BonusAttribute( ResistanceType.Cold, 2 ), + new BonusAttribute( ResistanceType.Poison, 3 ), + new BonusAttribute( ResistanceType.Energy, 4 ) + }; barbed.RunicMinAttributes = 4; barbed.RunicMaxAttributes = 5; if ( Core.ML ) @@ -346,47 +364,235 @@ namespace Server.Items CraftAttributeInfo red = RedScales = new CraftAttributeInfo(); - red.ArmorFireResist = 10; - red.ArmorColdResist = -3; + red.ArmorAttributes = new BonusAttribute[] { + new BonusAttribute( ResistanceType.Fire, 10 ), + new BonusAttribute( ResistanceType.Cold, -3 ) + }; CraftAttributeInfo yellow = YellowScales = new CraftAttributeInfo(); - yellow.ArmorPhysicalResist = -3; - yellow.ArmorLuck = 20; + yellow.ArmorAttributes = new BonusAttribute[] { + new BonusAttribute( ResistanceType.Physical, -3 ), + new BonusAttribute( AosAttribute.Luck, 20 ) + }; CraftAttributeInfo black = BlackScales = new CraftAttributeInfo(); - black.ArmorPhysicalResist = 10; - black.ArmorEnergyResist = -3; + black.ArmorAttributes = new BonusAttribute[] { + new BonusAttribute( ResistanceType.Physical, 10 ), + new BonusAttribute( ResistanceType.Energy, -3 ) + }; CraftAttributeInfo green = GreenScales = new CraftAttributeInfo(); - green.ArmorFireResist = -3; - green.ArmorPoisonResist = 10; + green.ArmorAttributes = new BonusAttribute[] { + new BonusAttribute( ResistanceType.Fire, -3 ), + new BonusAttribute( ResistanceType.Poison, 10 ) + }; CraftAttributeInfo white = WhiteScales = new CraftAttributeInfo(); - white.ArmorPhysicalResist = -3; - white.ArmorColdResist = 10; + white.ArmorAttributes = new BonusAttribute[] { + new BonusAttribute( ResistanceType.Physical, -3 ), + new BonusAttribute( ResistanceType.Cold, 10 ) + }; CraftAttributeInfo blue = BlueScales = new CraftAttributeInfo(); - blue.ArmorPoisonResist = -3; - blue.ArmorEnergyResist = 10; - - //public static readonly CraftAttributeInfo OakWood, AshWood, YewWood, Heartwood, Bloodwood, Frostwood; + blue.ArmorAttributes = new BonusAttribute[] { + new BonusAttribute( ResistanceType.Poison, -3 ), + new BonusAttribute( ResistanceType.Energy, 10 ) + }; + #region Mondain's Legacy CraftAttributeInfo oak = OakWood = new CraftAttributeInfo(); + + oak.ArmorAttributes = new BonusAttribute[] { + new BonusAttribute( ResistanceType.Physical, 3 ), + new BonusAttribute( ResistanceType.Fire, 3 ), + new BonusAttribute( ResistanceType.Poison, 2 ), + new BonusAttribute( ResistanceType.Energy, 3 ), + new BonusAttribute( AosAttribute.Luck, 40 ), + new BonusAttribute( AosArmorAttribute.DurabilityBonus, 50 ) + }; + oak.WeaponAttributes = new BonusAttribute[] { + new BonusAttribute( AosAttribute.Luck, 40 ), + new BonusAttribute( AosAttribute.WeaponDamage, 5 ), + new BonusAttribute( AosWeaponAttribute.DurabilityBonus, 50 ) + }; + oak.ShieldAttributes = new BonusAttribute[] { + new BonusAttribute( ResistanceType.Physical, 1 ), + new BonusAttribute( ResistanceType.Fire, 1 ), + new BonusAttribute( ResistanceType.Cold, 1 ), + new BonusAttribute( ResistanceType.Poison, 1 ), + new BonusAttribute( ResistanceType.Energy, 1 ) + }; + oak.OtherAttributes = new BonusAttribute[] { + new BonusAttribute( AosAttribute.Luck, 40 ) + }; + oak.RunicMinAttributes = 1; + oak.RunicMaxAttributes = 2; + oak.RunicMinIntensity = 1; + oak.RunicMaxIntensity = 50; CraftAttributeInfo ash = AshWood = new CraftAttributeInfo(); + ash.ArmorAttributes = new BonusAttribute[] { + new BonusAttribute( ResistanceType.Physical, 3 ), + new BonusAttribute( ResistanceType.Cold, 3 ), + new BonusAttribute( ResistanceType.Poison, 2 ), + new BonusAttribute( ResistanceType.Energy, 3 ), + new BonusAttribute( AosArmorAttribute.LowerStatReq, 20 ), + new BonusAttribute( AosAttribute.LowerWeight, 75 ) + }; + ash.WeaponAttributes = new BonusAttribute[] { + new BonusAttribute( AosAttribute.WeaponSpeed, 10 ), + new BonusAttribute( AosAttribute.LowerWeight, 75 ), + new BonusAttribute( AosWeaponAttribute.LowerStatReq, 20 ) + }; + ash.ShieldAttributes = new BonusAttribute[] { + new BonusAttribute( ResistanceType.Energy, 3 ), + new BonusAttribute( AosArmorAttribute.LowerStatReq, 20 ) + }; + ash.OtherAttributes = new BonusAttribute[] { + new BonusAttribute( AosArmorAttribute.LowerStatReq, 20 ) + }; + ash.RunicMinAttributes = 2; + ash.RunicMaxAttributes = 3; + ash.RunicMinIntensity = 35; + ash.RunicMaxIntensity = 75; + CraftAttributeInfo yew = YewWood = new CraftAttributeInfo(); + yew.ArmorAttributes = new BonusAttribute[] { + new BonusAttribute( ResistanceType.Physical, 6 ), + new BonusAttribute( ResistanceType.Fire, 3 ), + new BonusAttribute( ResistanceType.Cold, 3 ), + new BonusAttribute( ResistanceType.Energy, 3 ), + new BonusAttribute( AosAttribute.RegenHits, 1 ) + }; + yew.WeaponAttributes = new BonusAttribute[] { + new BonusAttribute( AosAttribute.WeaponDamage, 10 ), + new BonusAttribute( AosAttribute.AttackChance, 5 ) + }; + yew.ShieldAttributes = new BonusAttribute[] { + new BonusAttribute( ResistanceType.Physical, 3 ), + new BonusAttribute( AosAttribute.RegenHits, 1 ) + }; + yew.OtherAttributes = new BonusAttribute[] { + new BonusAttribute( AosAttribute.RegenHits, 2 ) + }; + yew.RunicMinAttributes = 3; + yew.RunicMaxAttributes = 3; + yew.RunicMinIntensity = 40; + yew.RunicMaxIntensity = 90; + CraftAttributeInfo heart = Heartwood = new CraftAttributeInfo(); + + heart.ArmorAttributes = new BonusAttribute[] { + new BonusAttribute( ResistanceType.Physical, 2 ), + new BonusAttribute( ResistanceType.Fire, 3 ), + new BonusAttribute( ResistanceType.Cold, 2 ), + new BonusAttribute( ResistanceType.Poison, 7 ), + new BonusAttribute( ResistanceType.Energy, 2 ) + }; + + #region Random Attributes + heart.RandomAttributeCount = 1; + heart.ArmorRandomAttributes = new BonusAttribute[] { + new BonusAttribute( AosAttribute.Luck, 40 ), + new BonusAttribute( AosArmorAttribute.DurabilityBonus, 50 ), + new BonusAttribute( AosArmorAttribute.LowerStatReq, 20 ), + new BonusAttribute( AosAttribute.WeaponDamage, 10 ), + new BonusAttribute( AosAttribute.LowerWeight, 50 ), + new BonusAttribute( AosAttribute.AttackChance, 5 ), + new BonusAttribute( AosArmorAttribute.MageArmor, 1 ) + }; + + heart.WeaponRandomAttributes = new BonusAttribute[] { + new BonusAttribute( AosAttribute.Luck, 40 ), + new BonusAttribute( AosWeaponAttribute.DurabilityBonus, 50 ), + new BonusAttribute( AosWeaponAttribute.LowerStatReq, 20 ), + new BonusAttribute( AosAttribute.WeaponSpeed, 10 ), + new BonusAttribute( AosAttribute.LowerWeight, 75 ), + new BonusAttribute( AosAttribute.AttackChance, 5 ), + new BonusAttribute( AosWeaponAttribute.HitLeechHits, 13 ), + new BonusAttribute( AosAttribute.Luck, 10 ) + }; + + heart.ShieldRandomAttributes = new BonusAttribute[] { + new BonusAttribute( AosAttribute.BonusDex, 2 ), + new BonusAttribute( AosAttribute.BonusStr, 2 ), + new BonusAttribute( ResistanceType.Physical, 5 ), + new BonusAttribute( AosAttribute.ReflectPhysical, 5 ), + new BonusAttribute( AosArmorAttribute.SelfRepair, 2 ), + new BonusAttribute( ResistanceType.Cold, 3 ), + new BonusAttribute( AosAttribute.SpellChanneling, 1 ) + }; + + heart.OtherRandomAttributes = new BonusAttribute[] { + new BonusAttribute( AosAttribute.Luck, 40 ), + new BonusAttribute( AosAttribute.RegenHits, 2 ), + new BonusAttribute( AosArmorAttribute.LowerStatReq, 20 ), + new BonusAttribute( AosAttribute.SpellChanneling, 1 ), + new BonusAttribute( AosAttribute.Luck, 10 ) + }; + #endregion + + heart.RunicMinAttributes = 4; + heart.RunicMaxAttributes = 4; + heart.RunicMinIntensity = 50; + heart.RunicMaxIntensity = 100; CraftAttributeInfo blood = Bloodwood = new CraftAttributeInfo(); + + blood.ArmorAttributes = new BonusAttribute[] { + new BonusAttribute( ResistanceType.Physical, 3 ), + new BonusAttribute( ResistanceType.Fire, 8 ), + new BonusAttribute( ResistanceType.Cold, 1 ), + new BonusAttribute( ResistanceType.Poison, 3 ), + new BonusAttribute( ResistanceType.Energy, 3 ), + new BonusAttribute( AosAttribute.RegenHits, 2 ) + }; + blood.WeaponAttributes = new BonusAttribute[] { + new BonusAttribute( AosAttribute.RegenHits, 2 ), + new BonusAttribute( AosWeaponAttribute.HitLeechHits, 13 ) + }; + blood.ShieldAttributes = new BonusAttribute[] { + new BonusAttribute( ResistanceType.Fire, 3 ), + new BonusAttribute( AosAttribute.Luck, 40 ), + new BonusAttribute( AosAttribute.RegenHits, 2 ) + }; + blood.OtherAttributes = new BonusAttribute[] { + new BonusAttribute( AosAttribute.RegenHits, 2 ), + new BonusAttribute( AosAttribute.Luck, 20 ) + }; CraftAttributeInfo frost = Frostwood = new CraftAttributeInfo(); + + frost.ArmorAttributes = new BonusAttribute[] { + new BonusAttribute( ResistanceType.Physical, 2 ), + new BonusAttribute( ResistanceType.Fire, 1 ), + new BonusAttribute( ResistanceType.Cold, 8 ), + new BonusAttribute( ResistanceType.Poison, 3 ), + new BonusAttribute( ResistanceType.Energy, 4 ) + }; + blood.WeaponAttributes = new BonusAttribute[] { + + new BonusAttribute( AosWeaponAttribute.HitLeechHits, 13 ) + }; + frost.WeaponAttributes = new BonusAttribute[] { + new BonusAttribute( AosElementAttribute.Cold, 40 ), + new BonusAttribute( AosAttribute.WeaponDamage, 12 ) + }; + frost.ShieldAttributes = new BonusAttribute[] { + new BonusAttribute( ResistanceType.Cold, 3 ), + new BonusAttribute( AosAttribute.SpellChanneling, 1 ) + }; + frost.OtherAttributes = new BonusAttribute[] { + new BonusAttribute( AosAttribute.SpellChanneling, 1 ) + }; + #endregion } } diff --git a/Scripts/Mobiles/PlayerMobile.cs b/Scripts/Mobiles/PlayerMobile.cs index a103b7b2f..329a30044 100644 --- a/Scripts/Mobiles/PlayerMobile.cs +++ b/Scripts/Mobiles/PlayerMobile.cs @@ -503,6 +503,9 @@ namespace Server.Mobiles if ( fp != null ) { + if ( !fp.IsDynamicFlipable ) + return true; + int[] itemIDs = fp.ItemIDs; Point3D oldWorldLoc = bi.m_WorldLoc; diff --git a/Scripts/Multis/BaseHouse.cs b/Scripts/Multis/BaseHouse.cs index a4a6d662d..3bb3cc499 100644 --- a/Scripts/Multis/BaseHouse.cs +++ b/Scripts/Multis/BaseHouse.cs @@ -1014,7 +1014,7 @@ namespace Server.Multis return IsFriend( from ); else if ( item is PotionKeg ) return IsFriend( from ); - else if ( item is BaseBoard ) + else if ( item is BaseGameBoard ) return true; else if ( item is Dices ) return true; @@ -1456,7 +1456,7 @@ namespace Server.Multis if ( !locked ) i.SetLastMoved(); - if ( (i is Container) && (!locked || !(i is BaseBoard)) ) + if ( (i is Container) && (!locked || !(i is BaseGameBoard)) ) { foreach ( Item c in i.Items ) SetLockdown( c, locked, checkContains ); @@ -1842,6 +1842,7 @@ namespace Server.Multis if ( info != null ) { + m.CloseGump( typeof ( SetSecureLevelGump ) ); m.SendGump( new Gumps.SetSecureLevelGump( m_Owner, info, this ) ); } else if ( item.Parent != null ) @@ -1867,7 +1868,7 @@ namespace Server.Multis } else { - info = new SecureInfo( (Container)item, SecureLevel.CoOwners ); + info = new SecureInfo( (Container)item, SecureLevel.Owner ); item.IsLockedDown = false; item.IsSecure = true; @@ -1876,6 +1877,7 @@ namespace Server.Multis m_LockDowns.Remove( item ); item.Movable = false; + m.CloseGump( typeof ( SetSecureLevelGump ) ); m.SendGump( new Gumps.SetSecureLevelGump( m_Owner, info, this ) ); } } @@ -2353,7 +2355,7 @@ namespace Server.Multis { Item item = (Item)m_LockDowns[i]; - if ( item is Container && !(item is BaseBoard) ) + if ( item is Container && !(item is BaseGameBoard) ) { Container cont = (Container)item; List children = cont.Items; @@ -3751,6 +3753,7 @@ namespace Server.Multis ISecurable sec = GetSecurable( Owner.From, m_Item ); if ( sec != null ) + Owner.From.CloseGump( typeof ( SetSecureLevelGump ) ); Owner.From.SendGump( new SetSecureLevelGump( Owner.From, sec, BaseHouse.FindHouseAt( m_Item ) ) ); } } diff --git a/Scripts/Skills/Meditation.cs b/Scripts/Skills/Meditation.cs index 95ee6d3b1..478c61612 100644 --- a/Scripts/Skills/Meditation.cs +++ b/Scripts/Skills/Meditation.cs @@ -18,10 +18,7 @@ namespace Server.SkillHandlers if ( item is Spellbook || item is Runebook ) return true; - if ( Core.AOS && item is BaseWeapon && ((BaseWeapon)item).Attributes.SpellChanneling != 0 ) - return true; - - if ( Core.AOS && item is BaseArmor && ((BaseArmor)item).Attributes.SpellChanneling != 0 ) + if ( Core.AOS && item is IAosAttributes && ((IAosAttributes)item).Attributes.SpellChanneling != 0 ) return true; return false;