Fixes code according to modern code style. Fixes a few expression bugs.
This commit is contained in:
parent
89eea25e5f
commit
970fd563b2
3324 changed files with 441118 additions and 433755 deletions
|
|
@ -1,36 +1,36 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class FertileDirt : Item
|
||||
{
|
||||
[Constructible]
|
||||
public FertileDirt() : this( 1 )
|
||||
{
|
||||
}
|
||||
public class FertileDirt : Item
|
||||
{
|
||||
[Constructible]
|
||||
public FertileDirt() : this(1)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public FertileDirt( int amount ) : base( 0xF81 )
|
||||
{
|
||||
Stackable = true;
|
||||
Weight = 1.0;
|
||||
Amount = amount;
|
||||
}
|
||||
[Constructible]
|
||||
public FertileDirt(int amount) : base(0xF81)
|
||||
{
|
||||
Stackable = true;
|
||||
Weight = 1.0;
|
||||
Amount = amount;
|
||||
}
|
||||
|
||||
public FertileDirt( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public FertileDirt(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -4,139 +4,137 @@ using Server.Network;
|
|||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class OrangePetals : Item
|
||||
{
|
||||
public override int LabelNumber => 1053122; // orange petals
|
||||
public class OrangePetals : Item
|
||||
{
|
||||
private static Hashtable m_Table = new Hashtable();
|
||||
|
||||
public override double DefaultWeight => 0.1;
|
||||
[Constructible]
|
||||
public OrangePetals() : this(1)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public OrangePetals() : this( 1 )
|
||||
{
|
||||
}
|
||||
[Constructible]
|
||||
public OrangePetals(int amount) : base(0x1021)
|
||||
{
|
||||
Stackable = true;
|
||||
Hue = 0x2B;
|
||||
Amount = amount;
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public OrangePetals( int amount ) : base( 0x1021 )
|
||||
{
|
||||
Stackable = true;
|
||||
Hue = 0x2B;
|
||||
Amount = amount;
|
||||
}
|
||||
public OrangePetals(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public OrangePetals( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int LabelNumber => 1053122; // orange petals
|
||||
|
||||
public override bool CheckItemUse( Mobile from, Item item )
|
||||
{
|
||||
if ( item != this )
|
||||
return base.CheckItemUse( from, item );
|
||||
public override double DefaultWeight => 0.1;
|
||||
|
||||
if ( from != RootParent )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it.
|
||||
return false;
|
||||
}
|
||||
public override bool CheckItemUse(Mobile from, Item item)
|
||||
{
|
||||
if (item != this)
|
||||
return base.CheckItemUse(from, item);
|
||||
|
||||
return base.CheckItemUse( from, item );
|
||||
}
|
||||
if (from != RootParent)
|
||||
{
|
||||
from.SendLocalizedMessage(1042038); // You must have the object in your backpack to use it.
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
OrangePetalsContext context = GetContext( from );
|
||||
return base.CheckItemUse(from, item);
|
||||
}
|
||||
|
||||
if ( context != null )
|
||||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1061904 );
|
||||
return;
|
||||
}
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
OrangePetalsContext context = GetContext(from);
|
||||
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1061905 );
|
||||
from.PlaySound( 0x3B );
|
||||
if (context != null)
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061904);
|
||||
return;
|
||||
}
|
||||
|
||||
Timer timer = new OrangePetalsTimer( from );
|
||||
timer.Start();
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061905);
|
||||
from.PlaySound(0x3B);
|
||||
|
||||
AddContext( from, new OrangePetalsContext( timer ) );
|
||||
Timer timer = new OrangePetalsTimer(from);
|
||||
timer.Start();
|
||||
|
||||
Consume();
|
||||
}
|
||||
AddContext(from, new OrangePetalsContext(timer));
|
||||
|
||||
private static Hashtable m_Table = new Hashtable();
|
||||
Consume();
|
||||
}
|
||||
|
||||
private static void AddContext( Mobile m, OrangePetalsContext context )
|
||||
{
|
||||
m_Table[m] = context;
|
||||
}
|
||||
private static void AddContext(Mobile m, OrangePetalsContext context)
|
||||
{
|
||||
m_Table[m] = context;
|
||||
}
|
||||
|
||||
public static void RemoveContext( Mobile m )
|
||||
{
|
||||
OrangePetalsContext context = GetContext( m );
|
||||
public static void RemoveContext(Mobile m)
|
||||
{
|
||||
OrangePetalsContext context = GetContext(m);
|
||||
|
||||
if ( context != null )
|
||||
RemoveContext( m, context );
|
||||
}
|
||||
if (context != null)
|
||||
RemoveContext(m, context);
|
||||
}
|
||||
|
||||
private static void RemoveContext( Mobile m, OrangePetalsContext context )
|
||||
{
|
||||
m_Table.Remove( m );
|
||||
private static void RemoveContext(Mobile m, OrangePetalsContext context)
|
||||
{
|
||||
m_Table.Remove(m);
|
||||
|
||||
context.Timer.Stop();
|
||||
}
|
||||
context.Timer.Stop();
|
||||
}
|
||||
|
||||
private static OrangePetalsContext GetContext( Mobile m )
|
||||
{
|
||||
return ( m_Table[m] as OrangePetalsContext );
|
||||
}
|
||||
private static OrangePetalsContext GetContext(Mobile m)
|
||||
{
|
||||
return m_Table[m] as OrangePetalsContext;
|
||||
}
|
||||
|
||||
public static bool UnderEffect( Mobile m )
|
||||
{
|
||||
return ( GetContext( m ) != null );
|
||||
}
|
||||
public static bool UnderEffect(Mobile m)
|
||||
{
|
||||
return GetContext(m) != null;
|
||||
}
|
||||
|
||||
private class OrangePetalsTimer : Timer
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
public OrangePetalsTimer( Mobile from ) : base ( TimeSpan.FromMinutes( 5.0 ) )
|
||||
{
|
||||
m_Mobile = from;
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if ( !m_Mobile.Deleted )
|
||||
{
|
||||
m_Mobile.LocalOverheadMessage( MessageType.Regular, 0x3F, true,
|
||||
"* You feel the effects of your poison resistance wearing off *" );
|
||||
}
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
RemoveContext( m_Mobile );
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
private class OrangePetalsContext
|
||||
{
|
||||
public Timer Timer { get; }
|
||||
private class OrangePetalsTimer : Timer
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public OrangePetalsContext( Timer timer )
|
||||
{
|
||||
Timer = timer;
|
||||
}
|
||||
}
|
||||
public OrangePetalsTimer(Mobile from) : base(TimeSpan.FromMinutes(5.0))
|
||||
{
|
||||
m_Mobile = from;
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
protected override void OnTick()
|
||||
{
|
||||
if (!m_Mobile.Deleted)
|
||||
m_Mobile.LocalOverheadMessage(MessageType.Regular, 0x3F, true,
|
||||
"* You feel the effects of your poison resistance wearing off *");
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
RemoveContext(m_Mobile);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
private class OrangePetalsContext
|
||||
{
|
||||
public OrangePetalsContext(Timer timer)
|
||||
{
|
||||
Timer = timer;
|
||||
}
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
public Timer Timer{ get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,100 +2,100 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class RedLeaves : Item
|
||||
{
|
||||
public override int LabelNumber => 1053123; // red leaves
|
||||
public class RedLeaves : Item
|
||||
{
|
||||
[Constructible]
|
||||
public RedLeaves() : this(1)
|
||||
{
|
||||
}
|
||||
|
||||
public override double DefaultWeight => 0.1;
|
||||
[Constructible]
|
||||
public RedLeaves(int amount) : base(0x1E85)
|
||||
{
|
||||
Stackable = true;
|
||||
Hue = 0x21;
|
||||
Amount = amount;
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public RedLeaves() : this( 1 )
|
||||
{
|
||||
}
|
||||
public RedLeaves(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public RedLeaves( int amount ) : base( 0x1E85 )
|
||||
{
|
||||
Stackable = true;
|
||||
Hue = 0x21;
|
||||
Amount = amount;
|
||||
}
|
||||
public override int LabelNumber => 1053123; // red leaves
|
||||
|
||||
public RedLeaves( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override double DefaultWeight => 0.1;
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042664 ); // You must have the object in your backpack to use it.
|
||||
return;
|
||||
}
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
from.SendLocalizedMessage(1042664); // You must have the object in your backpack to use it.
|
||||
return;
|
||||
}
|
||||
|
||||
from.Target = new InternalTarget( this );
|
||||
from.SendLocalizedMessage( 1061907 ); // Choose a book you wish to seal with the wax from the red leaf.
|
||||
}
|
||||
from.Target = new InternalTarget(this);
|
||||
from.SendLocalizedMessage(1061907); // Choose a book you wish to seal with the wax from the red leaf.
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private RedLeaves m_RedLeaves;
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
public InternalTarget( RedLeaves redLeaves ) : base( 3, false, TargetFlags.None )
|
||||
{
|
||||
m_RedLeaves = redLeaves;
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( m_RedLeaves.Deleted )
|
||||
return;
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
if ( !m_RedLeaves.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042664 ); // You must have the object in your backpack to use it.
|
||||
return;
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
if ( !(targeted is Item item) || !item.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042664 ); // You must have the object in your backpack to use it.
|
||||
}
|
||||
else if ( !(item is BaseBook) )
|
||||
{
|
||||
item.LabelTo( from, 1061911 ); // You can only use red leaves to seal the ink into book pages!
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseBook book = (BaseBook)item;
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private RedLeaves m_RedLeaves;
|
||||
|
||||
if ( !book.Writable )
|
||||
{
|
||||
book.LabelTo( from, 1061909 ); // The ink in this book has already been sealed.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_RedLeaves.Consume();
|
||||
book.Writable = false;
|
||||
public InternalTarget(RedLeaves redLeaves) : base(3, false, TargetFlags.None)
|
||||
{
|
||||
m_RedLeaves = redLeaves;
|
||||
}
|
||||
|
||||
book.LabelTo( from, 1061910 ); // You seal the ink to the page using wax from the red leaf.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (m_RedLeaves.Deleted)
|
||||
return;
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
if (!m_RedLeaves.IsChildOf(from.Backpack))
|
||||
{
|
||||
from.SendLocalizedMessage(1042664); // You must have the object in your backpack to use it.
|
||||
return;
|
||||
}
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
if (!(targeted is Item item) || !item.IsChildOf(from.Backpack))
|
||||
{
|
||||
from.SendLocalizedMessage(1042664); // You must have the object in your backpack to use it.
|
||||
}
|
||||
else if (!(item is BaseBook))
|
||||
{
|
||||
item.LabelTo(from, 1061911); // You can only use red leaves to seal the ink into book pages!
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseBook book = (BaseBook)item;
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
if (!book.Writable)
|
||||
{
|
||||
book.LabelTo(from, 1061909); // The ink in this book has already been sealed.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_RedLeaves.Consume();
|
||||
book.Writable = false;
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
book.LabelTo(from, 1061910); // You seal the ink to the page using wax from the red leaf.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue