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

@ -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()