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

@ -30,14 +30,16 @@ namespace Server.Spells.Third
SpellHelper.GetSurfaceTop(ref p);
var eastToWest = SpellHelper.GetEastToWest(Caster.Location, p);
var loc = new Point3D(p);
Effects.PlaySound(new Point3D(p), Caster.Map, 0x1F6);
var eastToWest = SpellHelper.GetEastToWest(Caster.Location, loc);
Effects.PlaySound(loc, Caster.Map, 0x1F6);
for (var i = -1; i <= 1; ++i)
{
var loc = new Point3D(eastToWest ? p.X + i : p.X, eastToWest ? p.Y : p.Y + i, p.Z);
var canFit = SpellHelper.AdjustField(ref loc, Caster.Map, 22, true);
var targetLoc = new Point3D(eastToWest ? p.X + i : p.X, eastToWest ? p.Y : p.Y + i, p.Z);
var canFit = SpellHelper.AdjustField(ref targetLoc, Caster.Map, 22, true);
// Effects.SendLocationParticles( EffectItem.Create( loc, Caster.Map, EffectItem.DefaultDuration ), 0x376A, 9, 10, 5025 );
@ -46,7 +48,7 @@ namespace Server.Spells.Third
continue;
}
Item item = new InternalItem(loc, Caster.Map, Caster);
Item item = new InternalItem(targetLoc, Caster.Map, Caster);
Effects.SendLocationParticles(item, 0x376A, 9, 10, 5025);