fix: Cleans up LINQ calls. (#965)

- [X] Removes several `ToList()` uses with `PooledRefQueue`
- [X] Adds a `PeekRandom` to PooledRefQueue
- [X] Updates EV/BS so they dispel each other in a more efficient manner.
- [X] Fixes Firebomb so it works like a normal firefield.
- [X] Fixes field spells so they aren't unnecessarily using a Point3D ref more than necessary.
- [X] Removes extra allocation in campfire by using reverse loop.
- [X] Removes other LINQ calls that aren't needed.
This commit is contained in:
Kamron Batman 2022-03-20 19:20:54 -07:00 • committed by GitHub
parent daf89686d1
commit 23532db603
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 585 additions and 447 deletions

View file

@ -1,5 +1,3 @@
using System.Linq;
namespace Server.Engines.Quests.Naturalist
{
public class NestArea
@ -38,7 +36,22 @@ namespace Server.Engines.Quests.Naturalist
m_Rects = rects;
}
public static int NonSpecialCount => m_Areas.Count(area => !area.Special);
public static int NonSpecialCount
{
get
{
int count = 0;
foreach (var area in m_Areas)
{
if (!area.Special)
{
count++;
}
}
return count;
}
}
public bool Special { get; }
@ -60,7 +73,15 @@ namespace Server.Engines.Quests.Naturalist
public static NestArea Find(Point3D p)
{
return m_Areas.FirstOrDefault(area => area.Contains(p));
foreach (var area in m_Areas)
{
if (area.Contains(p))
{
return area;
}
}
return null;
}
public static NestArea GetByID(int id)