Fixes bad expressions, bad bool checks in loops, a few null pointer exceptions, and optimizes constructors.
This commit is contained in:
parent
8da55d6043
commit
f93c3b992e
62 changed files with 318 additions and 634 deletions
|
|
@ -18,8 +18,8 @@ namespace Server.Targets
|
|||
|
||||
protected override void OnTargetOutOfRange(Mobile from, object targeted)
|
||||
{
|
||||
if (targeted is UnholyBone && from.InRange((UnholyBone)targeted, 12))
|
||||
((UnholyBone)targeted).Carve(from, m_Item);
|
||||
if (targeted is UnholyBone bone && from.InRange(bone, 12))
|
||||
bone.Carve(from, m_Item);
|
||||
else
|
||||
base.OnTargetOutOfRange(from, targeted);
|
||||
}
|
||||
|
|
@ -29,14 +29,12 @@ namespace Server.Targets
|
|||
if (m_Item.Deleted)
|
||||
return;
|
||||
|
||||
if (targeted is ICarvable)
|
||||
if (targeted is ICarvable carvable)
|
||||
{
|
||||
((ICarvable)targeted).Carve(from, m_Item);
|
||||
carvable.Carve(from, m_Item);
|
||||
}
|
||||
else if (targeted is SwampDragon && ((SwampDragon)targeted).HasBarding)
|
||||
else if (targeted is SwampDragon pet && pet.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
|
||||
|
|
@ -44,9 +42,9 @@ namespace Server.Targets
|
|||
}
|
||||
else
|
||||
{
|
||||
if (targeted is StaticTarget)
|
||||
if (targeted is StaticTarget target)
|
||||
{
|
||||
int itemID = ((StaticTarget)targeted).ItemID;
|
||||
int itemID = target.ItemID;
|
||||
|
||||
if (itemID == 0xD15 || itemID == 0xD16) // red mushroom
|
||||
{
|
||||
|
|
@ -56,10 +54,7 @@ namespace Server.Targets
|
|||
|
||||
if (qs is WitchApprenticeQuest)
|
||||
{
|
||||
FindIngredientObjective obj =
|
||||
qs.FindObjective(typeof(FindIngredientObjective)) as FindIngredientObjective;
|
||||
|
||||
if (obj != null && !obj.Completed && obj.Ingredient == Ingredient.RedMushrooms)
|
||||
if (qs.FindObjective(typeof(FindIngredientObjective)) is FindIngredientObjective obj && !obj.Completed && obj.Ingredient == Ingredient.RedMushrooms)
|
||||
{
|
||||
player.SendLocalizedMessage(1055036); // You slice a red cap mushroom from its stem.
|
||||
obj.Complete();
|
||||
|
|
@ -72,11 +67,7 @@ namespace Server.Targets
|
|||
HarvestSystem system = Lumberjacking.System;
|
||||
HarvestDefinition def = Lumberjacking.System.Definition;
|
||||
|
||||
int tileID;
|
||||
Map map;
|
||||
Point3D loc;
|
||||
|
||||
if (!system.GetHarvestDetails(from, m_Item, targeted, out tileID, out map, out loc))
|
||||
if (!system.GetHarvestDetails(from, m_Item, targeted, out int tileID, out Map map, out Point3D loc))
|
||||
{
|
||||
from.SendLocalizedMessage(500494); // You can't use a bladed item on that!
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue