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

@ -1,119 +1,120 @@
using Server.Targeting;
using Server.Items;
using Server.Engines.Harvest;
using Server.Mobiles;
using Server.Engines.Quests;
using Server.Engines.Quests.Hag;
using Server.Items;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Targets
{
public class BladedItemTarget : Target
{
private Item m_Item;
public class BladedItemTarget : Target
{
private Item m_Item;
public BladedItemTarget( Item item ) : base( 2, false, TargetFlags.None )
{
m_Item = item;
}
public BladedItemTarget(Item item) : base(2, false, TargetFlags.None)
{
m_Item = item;
}
protected override void OnTargetOutOfRange( Mobile from, object targeted )
{
if ( targeted is UnholyBone && from.InRange( ((UnholyBone)targeted), 12 ) )
((UnholyBone)targeted).Carve( from, m_Item );
else
base.OnTargetOutOfRange (from, targeted);
}
protected override void OnTargetOutOfRange(Mobile from, object targeted)
{
if (targeted is UnholyBone && from.InRange((UnholyBone)targeted, 12))
((UnholyBone)targeted).Carve(from, m_Item);
else
base.OnTargetOutOfRange(from, targeted);
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( m_Item.Deleted )
return;
protected override void OnTarget(Mobile from, object targeted)
{
if (m_Item.Deleted)
return;
if ( targeted is ICarvable )
{
((ICarvable)targeted).Carve( from, m_Item );
}
else if ( targeted is SwampDragon && ((SwampDragon)targeted).HasBarding )
{
SwampDragon pet = (SwampDragon)targeted;
if (targeted is ICarvable)
{
((ICarvable)targeted).Carve(from, m_Item);
}
else if (targeted is SwampDragon && ((SwampDragon)targeted).HasBarding)
{
SwampDragon pet = (SwampDragon)targeted;
if ( !pet.Controlled || pet.ControlMaster != from )
from.SendLocalizedMessage( 1053022 ); // You cannot remove barding from a swamp dragon you do not own.
else
pet.HasBarding = false;
}
else
{
if ( targeted is StaticTarget )
{
int itemID = ((StaticTarget)targeted).ItemID;
if (!pet.Controlled || pet.ControlMaster != from)
from.SendLocalizedMessage(1053022); // You cannot remove barding from a swamp dragon you do not own.
else
pet.HasBarding = false;
}
else
{
if (targeted is StaticTarget)
{
int itemID = ((StaticTarget)targeted).ItemID;
if ( itemID == 0xD15 || itemID == 0xD16 ) // red mushroom
{
PlayerMobile player = from as PlayerMobile;
if (itemID == 0xD15 || itemID == 0xD16) // red mushroom
{
PlayerMobile player = from as PlayerMobile;
QuestSystem qs = player?.Quest;
QuestSystem qs = player?.Quest;
if ( qs is WitchApprenticeQuest )
{
FindIngredientObjective obj = qs.FindObjective( typeof( FindIngredientObjective ) ) as FindIngredientObjective;
if (qs is WitchApprenticeQuest)
{
FindIngredientObjective obj =
qs.FindObjective(typeof(FindIngredientObjective)) as FindIngredientObjective;
if ( obj != null && !obj.Completed && obj.Ingredient == Ingredient.RedMushrooms )
{
player.SendLocalizedMessage( 1055036 ); // You slice a red cap mushroom from its stem.
obj.Complete();
return;
}
}
}
}
if (obj != null && !obj.Completed && obj.Ingredient == Ingredient.RedMushrooms)
{
player.SendLocalizedMessage(1055036); // You slice a red cap mushroom from its stem.
obj.Complete();
return;
}
}
}
}
HarvestSystem system = Lumberjacking.System;
HarvestDefinition def = Lumberjacking.System.Definition;
HarvestSystem system = Lumberjacking.System;
HarvestDefinition def = Lumberjacking.System.Definition;
int tileID;
Map map;
Point3D loc;
int tileID;
Map map;
Point3D loc;
if ( !system.GetHarvestDetails( from, m_Item, targeted, out tileID, out map, out loc ) )
{
from.SendLocalizedMessage( 500494 ); // You can't use a bladed item on that!
}
else if ( !def.Validate( tileID ) )
{
from.SendLocalizedMessage( 500494 ); // You can't use a bladed item on that!
}
else
{
HarvestBank bank = def.GetBank( map, loc.X, loc.Y );
if (!system.GetHarvestDetails(from, m_Item, targeted, out tileID, out map, out loc))
{
from.SendLocalizedMessage(500494); // You can't use a bladed item on that!
}
else if (!def.Validate(tileID))
{
from.SendLocalizedMessage(500494); // You can't use a bladed item on that!
}
else
{
HarvestBank bank = def.GetBank(map, loc.X, loc.Y);
if ( bank == null )
return;
if (bank == null)
return;
if ( bank.Current < 5 )
{
from.SendLocalizedMessage( 500493 ); // There's not enough wood here to harvest.
}
else
{
bank.Consume( 5, from );
if (bank.Current < 5)
{
from.SendLocalizedMessage(500493); // There's not enough wood here to harvest.
}
else
{
bank.Consume(5, from);
Item item = new Kindling();
Item item = new Kindling();
if ( from.PlaceInBackpack( item ) )
{
from.SendLocalizedMessage( 500491 ); // You put some kindling into your backpack.
from.SendLocalizedMessage( 500492 ); // An axe would probably get you more wood.
}
else
{
from.SendLocalizedMessage( 500490 ); // You can't place any kindling into your backpack!
if (from.PlaceInBackpack(item))
{
from.SendLocalizedMessage(500491); // You put some kindling into your backpack.
from.SendLocalizedMessage(500492); // An axe would probably get you more wood.
}
else
{
from.SendLocalizedMessage(500490); // You can't place any kindling into your backpack!
item.Delete();
}
}
}
}
}
}
item.Delete();
}
}
}
}
}
}
}

View file

@ -1,50 +1,51 @@
using Server.Targeting;
using Server.Commands;
using Server.Commands.Generic;
using Server.Targeting;
namespace Server.Targets
{
public class MoveTarget : Target
{
private object m_Object;
public class MoveTarget : Target
{
private object m_Object;
public MoveTarget( object o ) : base( -1, true, TargetFlags.None )
{
m_Object = o;
}
public MoveTarget(object o) : base(-1, true, TargetFlags.None)
{
m_Object = o;
}
protected override void OnTarget( Mobile from, object o )
{
IPoint3D p = o as IPoint3D;
protected override void OnTarget(Mobile from, object o)
{
IPoint3D p = o as IPoint3D;
if ( p != null )
{
if ( !BaseCommand.IsAccessible( from, m_Object ) )
{
from.SendMessage( "That is not accessible." );
return;
}
if (p != null)
{
if (!BaseCommand.IsAccessible(from, m_Object))
{
from.SendMessage("That is not accessible.");
return;
}
if ( p is Item )
p = ((Item)p).GetWorldTop();
if (p is Item)
p = ((Item)p).GetWorldTop();
CommandLogging.WriteLine( from, "{0} {1} moving {2} to {3}", from.AccessLevel, CommandLogging.Format( from ), CommandLogging.Format( m_Object ), new Point3D( p ) );
CommandLogging.WriteLine(from, "{0} {1} moving {2} to {3}", from.AccessLevel, CommandLogging.Format(from),
CommandLogging.Format(m_Object), new Point3D(p));
if ( m_Object is Item )
{
Item item = (Item)m_Object;
if (m_Object is Item)
{
Item item = (Item)m_Object;
if ( !item.Deleted )
item.MoveToWorld( new Point3D( p ), from.Map );
}
else if ( m_Object is Mobile )
{
Mobile m = (Mobile)m_Object;
if (!item.Deleted)
item.MoveToWorld(new Point3D(p), from.Map);
}
else if (m_Object is Mobile)
{
Mobile m = (Mobile)m_Object;
if ( !m.Deleted )
m.MoveToWorld( new Point3D( p ), from.Map );
}
}
}
}
if (!m.Deleted)
m.MoveToWorld(new Point3D(p), from.Map);
}
}
}
}
}

View file

@ -1,24 +1,24 @@
using Server.Targeting;
using Server.Commands.Generic;
using Server.Targeting;
namespace Server.Targets
{
public class PickMoveTarget : Target
{
public PickMoveTarget() : base( -1, false, TargetFlags.None )
{
}
public class PickMoveTarget : Target
{
public PickMoveTarget() : base(-1, false, TargetFlags.None)
{
}
protected override void OnTarget( Mobile from, object o )
{
if ( !BaseCommand.IsAccessible( from, o ) )
{
from.SendMessage( "That is not accessible." );
return;
}
protected override void OnTarget(Mobile from, object o)
{
if (!BaseCommand.IsAccessible(from, o))
{
from.SendMessage("That is not accessible.");
return;
}
if ( o is Item || o is Mobile )
from.Target = new MoveTarget( o );
}
}
if (o is Item || o is Mobile)
from.Target = new MoveTarget(o);
}
}
}