Adds more formatting
This commit is contained in:
parent
e77d695684
commit
f674ec2be0
68 changed files with 530 additions and 876 deletions
|
|
@ -715,10 +715,8 @@ namespace Server.Items
|
|||
if ( !IsEmpty || !Fillable || !ValidateUse( from, false ) )
|
||||
return;
|
||||
|
||||
if ( targ is BaseBeverage )
|
||||
if ( targ is BaseBeverage bev )
|
||||
{
|
||||
BaseBeverage bev = (BaseBeverage)targ;
|
||||
|
||||
if ( bev.IsEmpty || !bev.ValidateUse( from, true ) )
|
||||
return;
|
||||
|
||||
|
|
@ -737,10 +735,8 @@ namespace Server.Items
|
|||
bev.Quantity = 0;
|
||||
}
|
||||
}
|
||||
else if ( targ is BaseWaterContainer )
|
||||
else if ( targ is BaseWaterContainer bwc )
|
||||
{
|
||||
BaseWaterContainer bwc = targ as BaseWaterContainer;
|
||||
|
||||
if ( Quantity == 0 || ( Content == BeverageType.Water && !IsFull ) )
|
||||
{
|
||||
int iNeed = Math.Min( ( MaxQuantity - Quantity ), bwc.Quantity );
|
||||
|
|
@ -755,15 +751,12 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
else if ( targ is Item )
|
||||
else if ( targ is Item item )
|
||||
{
|
||||
Item item = (Item)targ;
|
||||
IWaterSource src;
|
||||
IWaterSource src = ( item as IWaterSource );
|
||||
|
||||
src = ( item as IWaterSource );
|
||||
|
||||
if ( src == null && item is AddonComponent )
|
||||
src = ( ( (AddonComponent)item ).Addon as IWaterSource );
|
||||
if ( src == null && item is AddonComponent component )
|
||||
src = ( component.Addon as IWaterSource );
|
||||
|
||||
if ( src == null || src.Quantity <= 0 )
|
||||
return;
|
||||
|
|
@ -791,10 +784,8 @@ namespace Server.Items
|
|||
|
||||
from.SendLocalizedMessage( 1010089 ); // You fill the container with water.
|
||||
}
|
||||
else if ( targ is Cow )
|
||||
else if ( targ is Cow cow )
|
||||
{
|
||||
Cow cow = (Cow)targ;
|
||||
|
||||
if ( cow.TryMilk( from ) )
|
||||
{
|
||||
Content = BeverageType.Milk;
|
||||
|
|
@ -802,21 +793,17 @@ namespace Server.Items
|
|||
from.SendLocalizedMessage( 1080197 ); // You fill the container with milk.
|
||||
}
|
||||
}
|
||||
else if ( targ is LandTarget )
|
||||
else if ( targ is LandTarget target )
|
||||
{
|
||||
int tileID = ( (LandTarget)targ ).TileID;
|
||||
int tileID = target.TileID;
|
||||
|
||||
PlayerMobile player = from as PlayerMobile;
|
||||
|
||||
if ( player != null )
|
||||
if ( from is PlayerMobile player )
|
||||
{
|
||||
QuestSystem qs = player.Quest;
|
||||
|
||||
if ( qs is WitchApprenticeQuest )
|
||||
{
|
||||
FindIngredientObjective obj = qs.FindObjective( typeof( FindIngredientObjective ) ) as FindIngredientObjective;
|
||||
|
||||
if ( obj != null && !obj.Completed && obj.Ingredient == Ingredient.SwampWater )
|
||||
if ( qs.FindObjective( typeof( FindIngredientObjective ) ) is FindIngredientObjective obj && !obj.Completed && obj.Ingredient == Ingredient.SwampWater )
|
||||
{
|
||||
bool contains = false;
|
||||
|
||||
|
|
@ -956,10 +943,8 @@ namespace Server.Items
|
|||
if ( IsEmpty || !Pourable || !ValidateUse( from, false ) )
|
||||
return;
|
||||
|
||||
if ( targ is BaseBeverage )
|
||||
if ( targ is BaseBeverage bev )
|
||||
{
|
||||
BaseBeverage bev = (BaseBeverage)targ;
|
||||
|
||||
if ( !bev.ValidateUse( from, true ) )
|
||||
return;
|
||||
|
||||
|
|
@ -1023,10 +1008,8 @@ namespace Server.Items
|
|||
|
||||
--Quantity;
|
||||
}
|
||||
else if ( targ is BaseWaterContainer )
|
||||
else if ( targ is BaseWaterContainer bwc )
|
||||
{
|
||||
BaseWaterContainer bwc = targ as BaseWaterContainer;
|
||||
|
||||
if ( Content != BeverageType.Water )
|
||||
{
|
||||
from.SendLocalizedMessage( 500842 ); // Can't pour that in there.
|
||||
|
|
@ -1048,27 +1031,23 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
else if ( targ is PlantItem )
|
||||
else if ( targ is PlantItem item )
|
||||
{
|
||||
( (PlantItem)targ ).Pour( from, this );
|
||||
item.Pour( from, this );
|
||||
}
|
||||
else if ( targ is AddonComponent &&
|
||||
( ( (AddonComponent)targ ).Addon is WaterVatEast || ( (AddonComponent)targ ).Addon is WaterVatSouth ) &&
|
||||
else if ( targ is AddonComponent component &&
|
||||
( component.Addon is WaterVatEast || component.Addon is WaterVatSouth ) &&
|
||||
this.Content == BeverageType.Water )
|
||||
{
|
||||
PlayerMobile player = from as PlayerMobile;
|
||||
|
||||
if ( player != null )
|
||||
if ( from is PlayerMobile player )
|
||||
{
|
||||
SolenMatriarchQuest qs = player.Quest as SolenMatriarchQuest;
|
||||
|
||||
if ( qs != null )
|
||||
if ( player.Quest is SolenMatriarchQuest qs )
|
||||
{
|
||||
QuestObjective obj = qs.FindObjective( typeof( GatherWaterObjective ) );
|
||||
|
||||
if ( obj != null && !obj.Completed )
|
||||
{
|
||||
BaseAddon vat = ( (AddonComponent)targ ).Addon;
|
||||
BaseAddon vat = component.Addon;
|
||||
|
||||
if ( vat.X > 5784 && vat.X < 5814 && vat.Y > 1903 && vat.Y < 1934 &&
|
||||
( ( qs.RedSolen && vat.Map == Map.Trammel ) || ( !qs.RedSolen && vat.Map == Map.Felucca ) ) )
|
||||
|
|
@ -1127,9 +1106,7 @@ namespace Server.Items
|
|||
|
||||
for( int i = 0; i < items.Length; ++i )
|
||||
{
|
||||
BaseBeverage bev = items[ i ] as BaseBeverage;
|
||||
|
||||
if ( bev != null && bev.Content == content && !bev.IsEmpty )
|
||||
if ( items[i] is BaseBeverage bev && bev.Content == content && !bev.IsEmpty )
|
||||
total += bev.Quantity;
|
||||
}
|
||||
|
||||
|
|
@ -1141,9 +1118,7 @@ namespace Server.Items
|
|||
|
||||
for( int i = 0; i < items.Length; ++i )
|
||||
{
|
||||
BaseBeverage bev = items[ i ] as BaseBeverage;
|
||||
|
||||
if ( bev == null || bev.Content != content || bev.IsEmpty )
|
||||
if ( !(items[i] is BaseBeverage bev) || bev.Content != content || bev.IsEmpty )
|
||||
continue;
|
||||
|
||||
int theirQuantity = bev.Quantity;
|
||||
|
|
|
|||
|
|
@ -74,26 +74,26 @@ namespace Server.Items
|
|||
{
|
||||
int itemID;
|
||||
|
||||
if ( targeted is Item )
|
||||
itemID = ((Item)targeted).ItemID;
|
||||
else if ( targeted is StaticTarget )
|
||||
itemID = ((StaticTarget)targeted).ItemID;
|
||||
if ( targeted is Item item )
|
||||
itemID = item.ItemID;
|
||||
else if ( targeted is StaticTarget target )
|
||||
itemID = target.ItemID;
|
||||
else
|
||||
return false;
|
||||
|
||||
if ( itemID >= 0xDE3 && itemID <= 0xDE9 )
|
||||
return true; // Campfire
|
||||
else if ( itemID >= 0x461 && itemID <= 0x48E )
|
||||
if ( itemID >= 0x461 && itemID <= 0x48E )
|
||||
return true; // Sandstone oven/fireplace
|
||||
else if ( itemID >= 0x92B && itemID <= 0x96C )
|
||||
if ( itemID >= 0x92B && itemID <= 0x96C )
|
||||
return true; // Stone oven/fireplace
|
||||
else if ( itemID == 0xFAC )
|
||||
if ( itemID == 0xFAC )
|
||||
return true; // Firepit
|
||||
else if ( itemID >= 0x184A && itemID <= 0x184C )
|
||||
if ( itemID >= 0x184A && itemID <= 0x184C )
|
||||
return true; // Heating stand (left)
|
||||
else if ( itemID >= 0x184E && itemID <= 0x1850 )
|
||||
if ( itemID >= 0x184E && itemID <= 0x1850 )
|
||||
return true; // Heating stand (right)
|
||||
else if ( itemID >= 0x398C && itemID <= 0x399F )
|
||||
if ( itemID >= 0x398C && itemID <= 0x399F )
|
||||
return true; // Fire field
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -71,8 +71,8 @@ namespace Server.Items
|
|||
{
|
||||
if ( m_Item.Deleted ) return;
|
||||
|
||||
Item targetItem = targeted as Item;
|
||||
if ( targetItem == null || targetItem.Deleted ) return;
|
||||
if ( !(targeted is Item targetItem) || targetItem.Deleted )
|
||||
return;
|
||||
|
||||
m_Item.Consume();
|
||||
|
||||
|
|
@ -171,16 +171,16 @@ namespace Server.Items
|
|||
|
||||
m_Item.Consume();
|
||||
|
||||
if ( targeted is BowlFlour )
|
||||
if ( targeted is BowlFlour flour )
|
||||
{
|
||||
((BowlFlour)targeted).Delete();
|
||||
flour.Delete();
|
||||
|
||||
from.AddToBackpack( new CakeMix() );
|
||||
}
|
||||
else if ( targeted is Campfire )
|
||||
else if ( targeted is Campfire campfire )
|
||||
{
|
||||
from.PlaySound( 0x225 );
|
||||
InternalTimer t = new InternalTimer( from, (Campfire)targeted );
|
||||
InternalTimer t = new InternalTimer( from, campfire );
|
||||
t.Start();
|
||||
}
|
||||
}
|
||||
|
|
@ -270,16 +270,16 @@ namespace Server.Items
|
|||
|
||||
m_Item.Consume();
|
||||
|
||||
if ( targeted is Dough )
|
||||
if ( targeted is Dough dough )
|
||||
{
|
||||
((Dough)targeted).Consume();
|
||||
dough.Consume();
|
||||
|
||||
from.AddToBackpack( new SweetDough() );
|
||||
}
|
||||
|
||||
if (targeted is BowlFlour)
|
||||
if (targeted is BowlFlour flour)
|
||||
{
|
||||
((BowlFlour)targeted).Delete();
|
||||
flour.Delete();
|
||||
|
||||
from.AddToBackpack( new CookieMix() );
|
||||
}
|
||||
|
|
@ -618,12 +618,10 @@ namespace Server.Items
|
|||
|
||||
public virtual void OnTarget( Mobile from, object obj )
|
||||
{
|
||||
if ( obj is AddonComponent )
|
||||
obj = (obj as AddonComponent).Addon;
|
||||
if ( obj is AddonComponent addon )
|
||||
obj = addon.Addon;
|
||||
|
||||
IFlourMill mill = obj as IFlourMill;
|
||||
|
||||
if ( mill != null )
|
||||
if ( obj is IFlourMill mill )
|
||||
{
|
||||
int needs = mill.MaxFlour - mill.CurFlour;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue