revert crafting updates of SVN538. Per Mark: changing baseclasses is a bad idea.

This commit is contained in:
xavier 2010-10-10 15:37:22 +00:00
parent 7399519cf7
commit e86794c4e6
130 changed files with 1007 additions and 4906 deletions

View file

@ -3,7 +3,7 @@ using System;
namespace Server.Items
{
[FlipableAttribute( 0x1BD7, 0x1BDA )]
public abstract class BaseBoard : Item, ICommodity
public class Board : Item, ICommodity
{
private CraftResource m_Resource;
@ -13,22 +13,6 @@ 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
{
@ -56,12 +40,30 @@ namespace Server.Items
}
}
public BaseBoard( Serial serial )
[Constructable]
public Board()
: this( 1 )
{
}
[Constructable]
public Board( int amount )
: this( CraftResource.RegularWood, amount )
{
}
public Board( Serial serial )
: base( serial )
{
}
public BaseBoard( CraftResource resource, int amount )
[Constructable]
public Board( CraftResource resource ) : this( resource, 1 )
{
}
[Constructable]
public Board( CraftResource resource, int amount )
: base( 0x1BD7 )
{
Stackable = true;
@ -92,7 +94,7 @@ namespace Server.Items
{
base.Serialize( writer );
writer.Write( (int) 4 );
writer.Write( (int) 3 );
writer.Write( (int)m_Resource );
}
@ -105,79 +107,24 @@ namespace Server.Items
switch ( version )
{
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 3:
case 2:
{
m_Resource = (CraftResource)reader.ReadInt();
goto case 0;
}
case 1: // For old standard boards
case 0:
{
m_InheritsItem = true;
m_OldVersion = version;
break;
}
{
m_Resource = (CraftResource)reader.ReadInt();
break;
}
}
if ( (version == 0 && Weight == 0.1) || ( version <= 2 && Weight == 2 ) )
Weight = -1;
}
}
public class Board : BaseBoard
{
[Constructable]
public Board()
: this( 1 )
{
}
[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;
}
}
if ( version <= 1 )
m_Resource = CraftResource.RegularWood;
}
}
public class HeartwoodBoard : BaseBoard
public class HeartwoodBoard : Board
{
[Constructable]
public HeartwoodBoard()
@ -211,7 +158,7 @@ namespace Server.Items
}
}
public class BloodwoodBoard : BaseBoard
public class BloodwoodBoard : Board
{
[Constructable]
public BloodwoodBoard()
@ -245,7 +192,7 @@ namespace Server.Items
}
}
public class FrostwoodBoard : BaseBoard
public class FrostwoodBoard : Board
{
[Constructable]
public FrostwoodBoard()
@ -279,7 +226,7 @@ namespace Server.Items
}
}
public class OakBoard : BaseBoard
public class OakBoard : Board
{
[Constructable]
public OakBoard()
@ -313,7 +260,7 @@ namespace Server.Items
}
}
public class AshBoard : BaseBoard
public class AshBoard : Board
{
[Constructable]
public AshBoard()
@ -347,7 +294,7 @@ namespace Server.Items
}
}
public class YewBoard : BaseBoard
public class YewBoard : Board
{
[Constructable]
public YewBoard()

View file

@ -8,14 +8,10 @@ using Server.ContextMenus;
namespace Server.Items
{
public class FishingPole : BaseOtherEquipable
public class FishingPole : Item
{
public override int AosStrReq{ get{ return 10; } }
public override CraftResource DefaultResource{ get{ return CraftResource.RegularWood; } }
[Constructable]
public FishingPole() : base( 0x0DBF )
public FishingPole() : base( 0x0DC0 )
{
Layer = Layer.OneHanded;
Weight = 8.0;
@ -48,7 +44,7 @@ namespace Server.Items
{
base.Deserialize( reader );
int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseOtherEquipable insertion
int version = reader.ReadInt();
}
}
}

View file

@ -4,7 +4,7 @@ using Server.Items;
namespace Server.Items
{
[FlipableAttribute( 0x1bdd, 0x1be0 )]
public abstract class BaseLog : Item, ICommodity, IAxe
public class Log : Item, ICommodity, IAxe
{
private CraftResource m_Resource;
@ -14,22 +14,6 @@ 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
{
@ -41,7 +25,23 @@ namespace Server.Items
int ICommodity.DescriptionNumber { get { return CraftResources.IsStandard( m_Resource ) ? LabelNumber : 1075062 + ( (int)m_Resource - (int)CraftResource.RegularWood ); } }
public BaseLog( CraftResource resource, int amount )
[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 )
: base( 0x1BDD )
{
Stackable = true;
@ -66,7 +66,7 @@ namespace Server.Items
list.Add( CraftResources.GetName( m_Resource ) );
}
}
public BaseLog( Serial serial ) : base( serial )
public Log( Serial serial ) : base( serial )
{
}
@ -74,7 +74,7 @@ namespace Server.Items
{
base.Serialize( writer );
writer.Write( (int) 2 ); // version
writer.Write( (int) 1 ); // version
writer.Write( (int)m_Resource );
}
@ -87,24 +87,15 @@ namespace Server.Items
switch ( version )
{
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;
}
case 1:
{
m_Resource = (CraftResource)reader.ReadInt();
break;
}
}
if ( version == 0 )
m_Resource = CraftResource.RegularWood;
}
public virtual bool TryCreateBoards( Mobile from, double skill, Item item )
@ -129,58 +120,7 @@ namespace Server.Items
return true;
}
}
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
public class HeartwoodLog : Log
{
[Constructable]
public HeartwoodLog() : this( 1 )
@ -216,7 +156,7 @@ namespace Server.Items
}
}
public class BloodwoodLog : BaseLog
public class BloodwoodLog : Log
{
[Constructable]
public BloodwoodLog()
@ -254,7 +194,7 @@ namespace Server.Items
}
}
public class FrostwoodLog : BaseLog
public class FrostwoodLog : Log
{
[Constructable]
public FrostwoodLog()
@ -296,7 +236,7 @@ namespace Server.Items
}
}
public class OakLog : BaseLog
public class OakLog : Log
{
[Constructable]
public OakLog()
@ -338,7 +278,7 @@ namespace Server.Items
}
}
public class AshLog : BaseLog
public class AshLog : Log
{
[Constructable]
public AshLog()
@ -380,7 +320,7 @@ namespace Server.Items
}
}
public class YewLog : BaseLog
public class YewLog : Log
{
[Constructable]
public YewLog()

View file

@ -20,7 +20,7 @@ namespace Server.Items
Arcanist
}
public class Spellbook : Item, ICraftable, ISlayer, IAosAttributes
public class Spellbook : Item, ICraftable, ISlayer
{
public static void Initialize()
{

View file

@ -24,7 +24,6 @@ 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
@ -67,15 +66,6 @@ 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; } }
@ -380,9 +370,6 @@ 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 ) );
@ -449,14 +436,13 @@ namespace Server.Items
{
base.Serialize( writer );
writer.Write( (int) 4 ); // version
writer.Write( (int) 3 ); // 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 );
@ -477,11 +463,6 @@ namespace Server.Items
switch ( version )
{
case 4:
{
m_Resource = (CraftResource)reader.ReadEncodedInt();
goto case 3;
}
case 3:
{
m_ReplenishesCharges = reader.ReadBool();
@ -529,9 +510,6 @@ namespace Server.Items
break;
}
}
if ( version < 4 )
m_Resource = DefaultResource;
CheckReplenishUses();
}
@ -592,34 +570,18 @@ 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
}
}

View file

@ -215,7 +215,6 @@ namespace Server.Items
if ( okay )
{
item.Hue = m_Tub.DyedHue;
item.InvalidateProperties();
from.PlaySound( 0x23E );
}
}

View file

@ -2,23 +2,16 @@ using System;
namespace Server.Items
{
[Flipable( 0xEC6, 0xEC7 )]
public class Dressform : BaseCraftableItem
[FlipableAttribute(0xec6, 0xec7)]
public class Dressform : Item
{
public override bool DisplaysResource{ get{ return false; } }
[Constructable]
public Dressform() : this( 0xEC6 )
{
}
[Constructable]
public Dressform( int itemID ) : base( itemID )
public Dressform() : base(0xec6)
{
Weight = 10;
}
public Dressform( Serial serial ) : base( serial )
public Dressform(Serial serial) : base(serial)
{
}
@ -33,7 +26,7 @@ namespace Server.Items
{
base.Deserialize(reader);
int version = ( InheritsItem ? OldVersion : reader.ReadInt() ); //Required for BaseCraftableItem insertion
int version = reader.ReadInt();
}
}
}

View file

@ -391,6 +391,8 @@ 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 )
@ -471,7 +473,7 @@ namespace Server.Items
int baseCount = ( isShield ? 7 : 20 );
int baseOffset = ( isShield ? 0 : 4 );
if ( ( !isShield && armor.MeditationAllowance == ArmorMeditationAllowance.All ) || armor.ArmorAttributes.MageArmor > 0 )
if ( !isShield && armor.MeditationAllowance == ArmorMeditationAllowance.All )
m_Props.Set( 3, true ); // remove mage armor from possible properties
if ( armor.Resource >= CraftResource.RegularLeather && armor.Resource <= CraftResource.BarbedLeather )
{

View file

@ -1,77 +0,0 @@
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();
}
}
}