fix(linq): Removes linq and fixes fishing error (#674)

This commit is contained in:
Kamron Batman 2021-08-04 22:24:38 -07:00 • committed by GitHub
parent b112be4e1f
commit 410b18ceca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 253 additions and 62 deletions

View file

@ -116,10 +116,19 @@ namespace Server.Items
private static bool FindMarkContainer(Point3D p, Map map)
{
var eable = map.GetItemsInRange<MarkContainer>(p, 0);
var found = eable.Any(item => item.Z == p.Z);
eable.Free();
return found;
foreach (var item in eable)
{
if (item.Z == p.Z)
{
eable.Free();
return true;
break;
}
}
eable.Free();
return false;
}
private static void CreateMalasPassage(

View file

@ -321,7 +321,20 @@ namespace Server.Items
public static bool HasDiggingTool(Mobile m)
{
return m.Backpack?.FindItemsByType<BaseHarvestTool>().Any(tool => tool.HarvestSystem == Mining.System) == true;
if (m.Backpack == null)
{
return false;
}
foreach (var tool in m.Backpack.FindItemsByType<BaseHarvestTool>())
{
if (tool.HarvestSystem == Mining.System)
{
return true;
}
}
return false;
}
public void OnBeginDig(Mobile from)

View file

@ -80,7 +80,19 @@ namespace Server.Items
public void Refresh()
{
var found = GetMobilesInRange(CurrentRange).Any(mob => !mob.Hidden || mob.AccessLevel <= AccessLevel.Player);
var found = false;
var eable = GetMobilesInRange(CurrentRange);
foreach (var mob in eable)
{
if (!mob.Hidden || mob.AccessLevel <= AccessLevel.Player)
{
found = true;
break;
}
}
eable.Free();
ItemID = found ? ActiveItemID : InactiveItemID;
Visible = ItemID != 0x1;

View file

@ -44,7 +44,15 @@ namespace Server.Regions
private bool ContainsDeed(Container cont)
{
return cont.FindItemsByType<HouseRaffleDeed>().Any(deed => deed == m_Stone.Deed);
foreach (var deed in cont.FindItemsByType<HouseRaffleDeed>())
{
if (deed == m_Stone.Deed)
{
return true;
}
}
return false;
}
public override bool OnTarget(Mobile m, Target t, object o)

View file

@ -84,22 +84,24 @@ namespace Server.Items
return;
}
var foundPlayer = GetMobilesInRange(3)
.Where(mob => mob.Player && mob.Alive && mob.AccessLevel <= AccessLevel.Player)
.Any(mob => Z + 8 >= mob.Z && mob.Z + 16 > Z);
if (!foundPlayer)
foreach (var mob in GetMobilesInRange(3))
{
m_Spurt?.Delete();
m_Spurt = null;
}
else if (m_Spurt?.Deleted != false)
{
m_Spurt = new Static(0x3709);
m_Spurt.MoveToWorld(Location, Map);
if (mob.Player && mob.Alive && mob.AccessLevel <= AccessLevel.Player && Z + 8 >= mob.Z && mob.Z + 16 > Z)
{
if (m_Spurt?.Deleted != false)
{
m_Spurt = new Static(0x3709);
m_Spurt.MoveToWorld(Location, Map);
Effects.PlaySound(GetWorldLocation(), Map, 0x309);
Effects.PlaySound(GetWorldLocation(), Map, 0x309);
}
return;
}
}
m_Spurt?.Delete();
m_Spurt = null;
}
public override bool OnMoveOver(Mobile m)