fix: Changes Map.Sector.Mobiles to link list & Fixes various related crash bugs (#1553)
### Summary
Eliminates `IPooledEnumerable<T>` and `eable.Free()` from `Map` for mobiles. This drastically simplifies code that iterates in range, for example:
```cs
foreach (var m in m.GetMobilesInRange(5))
{
}
```
The code above no longer requires an eable and calling `Free()`.
- [X] Fixed several locations where an NPC that was damaged would cause a server crash.
- [X] Removed an unnecessary allocation in guard fake calls (NPCs calling guards on you)
- [X] Fixes damage precision loss in Poison Strike Spell
- [X] BogThing no longer attempts to "search" for boglings to eat when it is at full health
This commit is contained in:
parent
27f0cec1fa
commit
28c06c1cc0
71 changed files with 796 additions and 591 deletions
|
|
@ -58,27 +58,29 @@ namespace Server.SkillHandlers
|
|||
|
||||
if (range > 0)
|
||||
{
|
||||
var inRange = src.Map.GetMobilesInRange(p, range);
|
||||
|
||||
foreach (var trg in inRange)
|
||||
foreach (var trg in src.Map.GetMobilesInRange(p, range))
|
||||
{
|
||||
if (trg.Hidden && src != trg)
|
||||
if (!trg.Hidden || src == trg)
|
||||
{
|
||||
var ss = srcSkill + Utility.Random(21) - 10;
|
||||
var ts = trg.Skills.Hiding.Value + Utility.Random(21) - 10;
|
||||
|
||||
if (src.AccessLevel >= trg.AccessLevel && (ss >= ts || inHouse && house.IsInside(trg)))
|
||||
{
|
||||
if (trg is ShadowKnight && (trg.X != p.X || trg.Y != p.Y))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
trg.RevealingAction();
|
||||
trg.SendLocalizedMessage(500814); // You have been revealed!
|
||||
foundAnyone = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
var ss = srcSkill + Utility.Random(21) - 10;
|
||||
var ts = trg.Skills.Hiding.Value + Utility.Random(21) - 10;
|
||||
|
||||
if (src.AccessLevel < trg.AccessLevel || ss < ts && (!inHouse || !house.IsInside(trg)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (trg is ShadowKnight && (trg.X != p.X || trg.Y != p.Y))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
trg.RevealingAction();
|
||||
trg.SendLocalizedMessage(500814); // You have been revealed!
|
||||
foundAnyone = true;
|
||||
}
|
||||
|
||||
if (Faction.Find(src) != null)
|
||||
|
|
|
|||
|
|
@ -60,8 +60,7 @@ namespace Server.SkillHandlers
|
|||
{
|
||||
if (!CombatOverride)
|
||||
{
|
||||
var eable = m.GetMobilesInRange(range);
|
||||
foreach (var check in eable)
|
||||
foreach (var check in m.GetMobilesInRange(range))
|
||||
{
|
||||
if (check.InLOS(m) && check.Combatant == m)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -118,9 +118,8 @@ namespace Server.SkillHandlers
|
|||
|
||||
calmed = true;
|
||||
|
||||
m.SendLocalizedMessage(
|
||||
500616
|
||||
); // You hear lovely music, and forget to continue battling!
|
||||
// You hear lovely music, and forget to continue battling!
|
||||
m.SendLocalizedMessage(500616);
|
||||
m.Combatant = null;
|
||||
m.Warmode = false;
|
||||
|
||||
|
|
@ -132,9 +131,8 @@ namespace Server.SkillHandlers
|
|||
|
||||
if (!calmed)
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
1049648
|
||||
); // You play hypnotic music, but there is nothing in range for you to calm.
|
||||
// You play hypnotic music, but there is nothing in range for you to calm.
|
||||
from.SendLocalizedMessage(1049648);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -216,9 +214,8 @@ namespace Server.SkillHandlers
|
|||
{
|
||||
from.SendLocalizedMessage(1049532); // You play hypnotic music, calming your target.
|
||||
|
||||
targ.SendLocalizedMessage(
|
||||
500616
|
||||
); // You hear lovely music, and forget to continue battling!
|
||||
// You hear lovely music, and forget to continue battling!
|
||||
targ.SendLocalizedMessage(500616);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -210,20 +210,17 @@ namespace Server.SkillHandlers
|
|||
from.SendGump(new TrackWhoGump(from, mobs, range));
|
||||
from.SendLocalizedMessage(1018093); // Select the one you would like to track.
|
||||
}
|
||||
else if (type == 0)
|
||||
{
|
||||
from.SendLocalizedMessage(502991); // You see no evidence of animals in the area.
|
||||
}
|
||||
else if (type == 1)
|
||||
{
|
||||
from.SendLocalizedMessage(502993); // You see no evidence of creatures in the area.
|
||||
}
|
||||
else
|
||||
{
|
||||
if (type == 0)
|
||||
{
|
||||
from.SendLocalizedMessage(502991); // You see no evidence of animals in the area.
|
||||
}
|
||||
else if (type == 1)
|
||||
{
|
||||
from.SendLocalizedMessage(502993); // You see no evidence of creatures in the area.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(502995); // You see no evidence of people in the area.
|
||||
}
|
||||
from.SendLocalizedMessage(502995); // You see no evidence of people in the area.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue