Fixes FindItemsByType and FindItemByType and new override of IsLockedDown and IsSecure by renaming their methods.
This commit is contained in:
parent
7321fa1b63
commit
a48ebb3a5f
50 changed files with 416 additions and 643 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
|
|
@ -310,30 +311,20 @@ namespace Server.Engines.Plants
|
|||
}
|
||||
case 6: // Water
|
||||
{
|
||||
Item[] item = from.Backpack.FindItemsByType(typeof(BaseBeverage));
|
||||
BaseBeverage bev = from.Backpack.FindItemsByType<BaseBeverage>().Find(beverage =>
|
||||
beverage.IsEmpty && beverage.Pourable && beverage.Content == BeverageType.Water);
|
||||
|
||||
bool foundUsableWater = false;
|
||||
|
||||
if (item != null && item.Length > 0)
|
||||
for (int i = 0; i < item.Length; ++i)
|
||||
{
|
||||
BaseBeverage beverage = (BaseBeverage)item[i];
|
||||
|
||||
if (!beverage.IsEmpty && beverage.Pourable && beverage.Content == BeverageType.Water)
|
||||
{
|
||||
foundUsableWater = true;
|
||||
m_Plant.Pour(from, beverage);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundUsableWater)
|
||||
if (bev == null)
|
||||
{
|
||||
from.Target = new PlantPourTarget(m_Plant);
|
||||
from.SendLocalizedMessage(1060808,
|
||||
"#" + m_Plant
|
||||
.GetLocalizedPlantStatus()); // Target the container you wish to use to water the ~1_val~.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Plant.Pour(from, bev);
|
||||
}
|
||||
|
||||
from.SendGump(new MainPlantGump(m_Plant));
|
||||
|
||||
|
|
|
|||
|
|
@ -413,25 +413,17 @@ namespace Server.Engines.Plants
|
|||
{
|
||||
Mobile from = args.Mobile;
|
||||
|
||||
if (from.Backpack != null)
|
||||
from.Backpack?.FindItemsByType<PlantItem>().ForEach(plant =>
|
||||
{
|
||||
List<PlantItem> plants = from.Backpack.FindItemsByType<PlantItem>();
|
||||
if (plant.IsGrowable)
|
||||
plant.PlantSystem.DoGrowthCheck();
|
||||
});
|
||||
|
||||
foreach (PlantItem plant in plants)
|
||||
if (plant.IsGrowable)
|
||||
plant.PlantSystem.DoGrowthCheck();
|
||||
}
|
||||
|
||||
BankBox bank = from.FindBankNoCreate();
|
||||
|
||||
if (bank != null)
|
||||
from.FindBankNoCreate()?.FindItemsByType<PlantItem>().ForEach(plant =>
|
||||
{
|
||||
List<PlantItem> plants = bank.FindItemsByType<PlantItem>();
|
||||
|
||||
foreach (PlantItem plant in plants)
|
||||
if (plant.IsGrowable)
|
||||
plant.PlantSystem.DoGrowthCheck();
|
||||
}
|
||||
if (plant.IsGrowable)
|
||||
plant.PlantSystem.DoGrowthCheck();
|
||||
});
|
||||
}
|
||||
|
||||
public static void GrowAll()
|
||||
|
|
@ -443,7 +435,7 @@ namespace Server.Engines.Plants
|
|||
{
|
||||
PlantItem plant = (PlantItem)plants[i];
|
||||
|
||||
if (plant.IsGrowable && plant.RootParent as Mobile == null && now >= plant.PlantSystem.NextGrowth)
|
||||
if (plant.IsGrowable && !(plant.RootParent is Mobile) && now >= plant.PlantSystem.NextGrowth)
|
||||
plant.PlantSystem.DoGrowthCheck();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue