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

@ -2,105 +2,91 @@ using Server.Mobiles;
namespace Server.Engines.Quests
{
public abstract class QuestItem : Item
{
public QuestItem( int itemID ) : base( itemID )
{
}
public abstract class QuestItem : Item
{
public QuestItem(int itemID) : base(itemID)
{
}
public QuestItem( Serial serial ) : base( serial )
{
}
public QuestItem(Serial serial) : base(serial)
{
}
public abstract bool CanDrop( PlayerMobile pm );
public virtual bool Accepted => Deleted;
public virtual bool Accepted => Deleted;
public abstract bool CanDrop(PlayerMobile pm);
public override bool DropToWorld( Mobile from, Point3D p )
{
bool ret = base.DropToWorld( from, p );
public override bool DropToWorld(Mobile from, Point3D p)
{
bool ret = base.DropToWorld(from, p);
if ( ret && !Accepted && Parent != from.Backpack )
{
if ( from.AccessLevel > AccessLevel.Player )
{
return true;
}
if (ret && !Accepted && Parent != from.Backpack)
{
if (from.AccessLevel > AccessLevel.Player) return true;
if ( !(from is PlayerMobile) || CanDrop( (PlayerMobile)from ) )
{
return true;
}
from.SendLocalizedMessage( 1049343 ); // You can only drop quest items into the top-most level of your backpack while you still need them for your quest.
return false;
}
if (!(from is PlayerMobile) || CanDrop((PlayerMobile)from)) return true;
from.SendLocalizedMessage(
1049343); // You can only drop quest items into the top-most level of your backpack while you still need them for your quest.
return false;
}
return ret;
}
return ret;
}
public override bool DropToMobile( Mobile from, Mobile target, Point3D p )
{
bool ret = base.DropToMobile( from, target, p );
public override bool DropToMobile(Mobile from, Mobile target, Point3D p)
{
bool ret = base.DropToMobile(from, target, p);
if ( ret && !Accepted && Parent != from.Backpack )
{
if ( from.AccessLevel > AccessLevel.Player )
{
return true;
}
if (ret && !Accepted && Parent != from.Backpack)
{
if (from.AccessLevel > AccessLevel.Player) return true;
if ( !(from is PlayerMobile) || CanDrop( (PlayerMobile)from ) )
{
return true;
}
from.SendLocalizedMessage( 1049344 ); // You decide against trading the item. You still need it for your quest.
return false;
}
if (!(from is PlayerMobile) || CanDrop((PlayerMobile)from)) return true;
from.SendLocalizedMessage(
1049344); // You decide against trading the item. You still need it for your quest.
return false;
}
return ret;
}
return ret;
}
public override bool DropToItem( Mobile from, Item target, Point3D p )
{
bool ret = base.DropToItem( from, target, p );
public override bool DropToItem(Mobile from, Item target, Point3D p)
{
bool ret = base.DropToItem(from, target, p);
if ( ret && !Accepted && Parent != from.Backpack )
{
if ( from.AccessLevel > AccessLevel.Player )
{
return true;
}
if (ret && !Accepted && Parent != from.Backpack)
{
if (from.AccessLevel > AccessLevel.Player) return true;
if ( !(from is PlayerMobile) || CanDrop( (PlayerMobile)from ) )
{
return true;
}
from.SendLocalizedMessage( 1049343 ); // You can only drop quest items into the top-most level of your backpack while you still need them for your quest.
return false;
}
return ret;
}
if (!(from is PlayerMobile) || CanDrop((PlayerMobile)from)) return true;
from.SendLocalizedMessage(
1049343); // You can only drop quest items into the top-most level of your backpack while you still need them for your quest.
return false;
}
public override DeathMoveResult OnParentDeath( Mobile parent )
{
if ( parent is PlayerMobile mobile && !CanDrop( mobile ) )
return DeathMoveResult.MoveToBackpack;
return ret;
}
return base.OnParentDeath( parent );
}
public override DeathMoveResult OnParentDeath(Mobile parent)
{
if (parent is PlayerMobile mobile && !CanDrop(mobile))
return DeathMoveResult.MoveToBackpack;
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
return base.OnParentDeath(parent);
}
writer.Write( (int) 0 ); // version
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
writer.Write(0); // version
}
int version = reader.ReadInt();
}
}
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
}