Fixes code according to modern code style. Fixes a few expression bugs.

This commit is contained in:
Kamron Batman 2018-09-15 09:58:51 -07:00
parent 89eea25e5f
commit 970fd563b2
3324 changed files with 441118 additions and 433755 deletions

View file

@ -3,170 +3,170 @@ using Server.Network;
namespace Server.Items
{
public class PlagueBeastInnard : Item, IScissorable, ICarvable
{
public PlagueBeastLord Owner => RootParent as PlagueBeastLord;
public override string DefaultName => "plague beast innards";
public class PlagueBeastInnard : Item, IScissorable, ICarvable
{
public PlagueBeastInnard(int itemID, int hue) : base(itemID)
{
Hue = hue;
Movable = false;
Weight = 1.0;
}
public PlagueBeastInnard( int itemID, int hue ) : base( itemID )
{
Hue = hue;
Movable = false;
Weight = 1.0;
}
public PlagueBeastInnard(Serial serial) : base(serial)
{
}
public virtual bool Scissor( Mobile from, Scissors scissors )
{
return false;
}
public PlagueBeastLord Owner => RootParent as PlagueBeastLord;
public override string DefaultName => "plague beast innards";
public virtual void Carve( Mobile from, Item with )
{
}
public virtual void Carve(Mobile from, Item with)
{
}
public virtual bool OnBandage( Mobile from )
{
return false;
}
public virtual bool Scissor(Mobile from, Scissors scissors)
{
return false;
}
public override bool IsAccessibleTo( Mobile check )
{
if ( (int) check.AccessLevel >= (int) AccessLevel.GameMaster )
return true;
public virtual bool OnBandage(Mobile from)
{
return false;
}
PlagueBeastLord owner = Owner;
public override bool IsAccessibleTo(Mobile check)
{
if ((int)check.AccessLevel >= (int)AccessLevel.GameMaster)
return true;
if ( owner == null )
return false;
PlagueBeastLord owner = Owner;
if ( !owner.InRange( check, 2 ) )
owner.PrivateOverheadMessage( MessageType.Label, 0x3B2, 500446, check.NetState ); // That is too far away.
else if ( owner.OpenedBy != null && owner.OpenedBy != check ) // TODO check
owner.PrivateOverheadMessage( MessageType.Label, 0x3B2, 500365, check.NetState ); // That is being used by someone else
else if ( owner.Frozen )
return true;
if (owner == null)
return false;
return false;
}
if (!owner.InRange(check, 2))
owner.PrivateOverheadMessage(MessageType.Label, 0x3B2, 500446, check.NetState); // That is too far away.
else if (owner.OpenedBy != null && owner.OpenedBy != check) // TODO check
owner.PrivateOverheadMessage(MessageType.Label, 0x3B2, 500365,
check.NetState); // That is being used by someone else
else if (owner.Frozen)
return true;
public PlagueBeastInnard( Serial serial ) : base( serial )
{
}
return false;
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt( 0 ); // version
}
writer.WriteEncodedInt(0); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
int version = reader.ReadEncodedInt();
PlagueBeastLord owner = Owner;
PlagueBeastLord owner = Owner;
if ( owner == null || !owner.Alive )
Delete();
}
}
if (owner == null || !owner.Alive)
Delete();
}
}
public class PlagueBeastComponent : PlagueBeastInnard
{
public PlagueBeastOrgan Organ { get; set; }
public class PlagueBeastComponent : PlagueBeastInnard
{
public PlagueBeastComponent(int itemID, int hue) : this(itemID, hue, false)
{
}
public bool IsBrain => ItemID == 0x1CF0;
public PlagueBeastComponent(int itemID, int hue, bool movable) : base(itemID, hue)
{
Movable = movable;
}
public bool IsGland => ItemID == 0x1CEF;
public PlagueBeastComponent(Serial serial) : base(serial)
{
}
public bool IsReceptacle => ItemID == 0x9DF;
public PlagueBeastOrgan Organ{ get; set; }
public PlagueBeastComponent( int itemID, int hue ) : this( itemID, hue, false )
{
}
public bool IsBrain => ItemID == 0x1CF0;
public PlagueBeastComponent( int itemID, int hue, bool movable ) : base( itemID, hue )
{
Movable = movable;
}
public bool IsGland => ItemID == 0x1CEF;
public override bool DropToItem( Mobile from, Item target, Point3D p )
{
if ( target is PlagueBeastBackpack )
return base.DropToItem( from, target, p );
public bool IsReceptacle => ItemID == 0x9DF;
return false;
}
public override bool DropToItem(Mobile from, Item target, Point3D p)
{
if (target is PlagueBeastBackpack)
return base.DropToItem(from, target, p);
public override bool AllowSecureTrade( Mobile from, Mobile to, Mobile newOwner, bool accepted )
{
return false;
}
return false;
}
public override bool DropToMobile( Mobile from, Mobile target, Point3D p )
{
return false;
}
public override bool AllowSecureTrade(Mobile from, Mobile to, Mobile newOwner, bool accepted)
{
return false;
}
public override bool DropToWorld( Mobile from, Point3D p )
{
return false;
}
public override bool DropToMobile(Mobile from, Mobile target, Point3D p)
{
return false;
}
public override bool OnDragDrop( Mobile from, Item dropped )
{
if ( Organ != null && Organ.OnDropped( from, dropped, this ) )
{
if ( dropped is PlagueBeastComponent component )
Organ.Components.Add( component );
}
public override bool DropToWorld(Mobile from, Point3D p)
{
return false;
}
return true;
}
public override bool OnDragDrop(Mobile from, Item dropped)
{
if (Organ != null && Organ.OnDropped(from, dropped, this))
if (dropped is PlagueBeastComponent component)
Organ.Components.Add(component);
public override bool OnDragLift( Mobile from )
{
if ( IsAccessibleTo( from ) )
{
if ( Organ != null && Organ.OnLifted( from, this ) )
{
from.SendLocalizedMessage( IsGland ? 1071895 : 1071914, null, 0x3B2 ); // * You rip the organ out of the plague beast's flesh *
return true;
}
if ( Organ.Components.Contains( this ) )
Organ.Components.Remove( this );
public override bool OnDragLift(Mobile from)
{
if (IsAccessibleTo(from))
{
if (Organ != null && Organ.OnLifted(from, this))
{
from.SendLocalizedMessage(IsGland ? 1071895 : 1071914, null,
0x3B2); // * You rip the organ out of the plague beast's flesh *
Organ = null;
from.PlaySound( 0x1CA );
}
if (Organ.Components.Contains(this))
Organ.Components.Remove(this);
return true;
}
Organ = null;
from.PlaySound(0x1CA);
}
return false;
}
return true;
}
public PlagueBeastComponent( Serial serial ) : base( serial )
{
}
return false;
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt( 0 ); // version
writer.WriteEncodedInt(0); // version
writer.WriteItem<PlagueBeastOrgan>( Organ );
}
writer.WriteItem(Organ);
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
int version = reader.ReadEncodedInt();
Organ = reader.ReadItem<PlagueBeastOrgan>();
}
}
}
Organ = reader.ReadItem<PlagueBeastOrgan>();
}
}
}