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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Items;
|
||||
using Server.Spells.Sixth;
|
||||
using Server.Targeting;
|
||||
|
|
@ -41,13 +42,7 @@ namespace Server.Regions
|
|||
|
||||
private bool ContainsDeed(Container cont)
|
||||
{
|
||||
List<HouseRaffleDeed> deeds = cont.FindItemsByType<HouseRaffleDeed>();
|
||||
|
||||
for (int i = 0; i < deeds.Count; ++i)
|
||||
if (deeds[i] == m_Stone.Deed)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return cont.FindItemsByType<HouseRaffleDeed>().Any(deed => deed == m_Stone.Deed);
|
||||
}
|
||||
|
||||
public override bool OnTarget(Mobile m, Target t, object o)
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ namespace Server.Items
|
|||
{
|
||||
if (from.Backpack != null)
|
||||
{
|
||||
PotionKeg keg = from.Backpack.FindItemByType(typeof(PotionKeg)) as PotionKeg;
|
||||
PotionKeg keg = from.Backpack.FindItemByType<PotionKeg>();
|
||||
|
||||
if (Validate(keg) > 0)
|
||||
from.SendGump(new InternalGump(this, keg));
|
||||
|
|
@ -175,17 +175,20 @@ namespace Server.Items
|
|||
|
||||
public int Validate(PotionKeg keg)
|
||||
{
|
||||
if (keg != null && !keg.Deleted && keg.Held == 100)
|
||||
if (keg == null || keg.Deleted || keg.Held != 100)
|
||||
return 0;
|
||||
|
||||
switch (keg.Type)
|
||||
{
|
||||
if (keg.Type == PotionEffect.ExplosionLesser)
|
||||
case PotionEffect.ExplosionLesser:
|
||||
return 5;
|
||||
if (keg.Type == PotionEffect.Explosion)
|
||||
case PotionEffect.Explosion:
|
||||
return 10;
|
||||
if (keg.Type == PotionEffect.ExplosionGreater)
|
||||
case PotionEffect.ExplosionGreater:
|
||||
return 15;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void Fill(Mobile from, PotionKeg keg)
|
||||
|
|
|
|||
|
|
@ -84,9 +84,7 @@ namespace Server.Items
|
|||
}
|
||||
else
|
||||
{
|
||||
Item diamond = from.Backpack.FindItemByType(typeof(BlueDiamond));
|
||||
|
||||
if (diamond != null)
|
||||
if (from.Backpack.FindItemByType<BlueDiamond>() != null)
|
||||
from.SendGump(new ConfirmGump(this, null));
|
||||
else
|
||||
from.SendLocalizedMessage(
|
||||
|
|
@ -130,71 +128,71 @@ namespace Server.Items
|
|||
|
||||
public virtual void Recharge(Mobile from, Mobile guildmaster)
|
||||
{
|
||||
if (from.Backpack != null)
|
||||
{
|
||||
Item diamond = from.Backpack.FindItemByType(typeof(BlueDiamond));
|
||||
if (from.Backpack == null)
|
||||
return;
|
||||
|
||||
BlueDiamond diamond = from.Backpack.FindItemByType<BlueDiamond>();
|
||||
|
||||
if (guildmaster != null)
|
||||
if (guildmaster != null)
|
||||
{
|
||||
if (m_UsesRemaining <= 0)
|
||||
{
|
||||
if (m_UsesRemaining <= 0)
|
||||
if (diamond != null && Banker.Withdraw(from, 100000))
|
||||
{
|
||||
if (diamond != null && Banker.Withdraw(from, 100000))
|
||||
{
|
||||
diamond.Consume();
|
||||
UsesRemaining = 10;
|
||||
guildmaster.Say(1076165); // Your weapon engraver should be good as new!
|
||||
}
|
||||
else
|
||||
{
|
||||
guildmaster.Say(
|
||||
1076167); // You need a 100,000 gold and a blue diamond to recharge the weapon engraver.
|
||||
}
|
||||
diamond.Consume();
|
||||
UsesRemaining = 10;
|
||||
guildmaster.Say(1076165); // Your weapon engraver should be good as new!
|
||||
}
|
||||
else
|
||||
{
|
||||
guildmaster.Say(
|
||||
1076164); // I can only help with this if you are carrying an engraving tool that needs repair.
|
||||
1076167); // You need a 100,000 gold and a blue diamond to recharge the weapon engraver.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (from.Skills.Tinkering.Value == 0)
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
1076179); // Since you have no tinkering skill, you will need to find an NPC tinkerer to repair this for you.
|
||||
}
|
||||
else if (from.Skills.Tinkering.Value < 75.0)
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
1076178); // Your tinkering skill is too low to fix this yourself. An NPC tinkerer can help you repair this for a fee.
|
||||
}
|
||||
else if (diamond != null)
|
||||
{
|
||||
diamond.Consume();
|
||||
guildmaster.Say(
|
||||
1076164); // I can only help with this if you are carrying an engraving tool that needs repair.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (from.Skills.Tinkering.Value == 0)
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
1076179); // Since you have no tinkering skill, you will need to find an NPC tinkerer to repair this for you.
|
||||
}
|
||||
else if (from.Skills.Tinkering.Value < 75.0)
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
1076178); // Your tinkering skill is too low to fix this yourself. An NPC tinkerer can help you repair this for a fee.
|
||||
}
|
||||
else if (diamond != null)
|
||||
{
|
||||
diamond.Consume();
|
||||
|
||||
if (Utility.RandomDouble() < from.Skills.Tinkering.Value / 100)
|
||||
{
|
||||
UsesRemaining = 10;
|
||||
from.SendLocalizedMessage(1076165); // Your weapon engraver should be good as new! ?????
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
1076175); // You cracked the diamond attempting to fix the weapon engraver.
|
||||
}
|
||||
if (Utility.RandomDouble() < from.Skills.Tinkering.Value / 100)
|
||||
{
|
||||
UsesRemaining = 10;
|
||||
from.SendLocalizedMessage(1076165); // Your weapon engraver should be good as new! ?????
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
1076166); // You do not have a blue diamond needed to recharge the engraving tool.
|
||||
1076175); // You cracked the diamond attempting to fix the weapon engraver.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
1076166); // You do not have a blue diamond needed to recharge the engraving tool.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static WeaponEngravingTool Find(Mobile from)
|
||||
{
|
||||
return from.Backpack?.FindItemByType(typeof(WeaponEngravingTool)) as WeaponEngravingTool;
|
||||
return from.Backpack?.FindItemByType<WeaponEngravingTool>();
|
||||
}
|
||||
|
||||
private class TargetWeapon : Target
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue